Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/controllers.zip
Назад
PK z�[␅�$ �$ ajax.json.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.39 @build 4th April, 2023 @created 17th December, 2020 @package Reservation @subpackage ajax.json.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Ajax Controller */ class ReservationControllerAjax extends JControllerLegacy { public function __construct($config) { parent::__construct($config); // make sure all json stuff are set JFactory::getDocument()->setMimeEncoding( 'application/json' ); JResponse::setHeader('Content-Disposition','attachment;filename="getajax.json"'); JResponse::setHeader("Access-Control-Allow-Origin", "*"); // load the tasks $this->registerTask('saveChat', 'ajax'); $this->registerTask('conversation', 'ajax'); $this->registerTask('ajaxReadMessage', 'ajax'); $this->registerTask('deleteChat', 'ajax'); $this->registerTask('goToClass', 'ajax'); $this->registerTask('getCatLevelOne', 'ajax'); $this->registerTask('getCatLevelTwo', 'ajax'); } public function ajax() { $user = JFactory::getUser(); $jinput = JFactory::getApplication()->input; // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { $task = $this->getTask(); switch($task) { case 'saveChat': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $messageValue = $jinput->get('message', NULL, 'RAW'); $fromValue = $jinput->get('from', NULL, 'STRING'); $toValue = $jinput->get('to', NULL, 'STRING'); $seidValue = $jinput->get('seid', NULL, 'INT'); $pidValue = $jinput->get('pid', NULL, 'INT'); $replyidValue = $jinput->get('replyid', 0, 'INT'); $pmidValue = $jinput->get('pmid', 0, 'INT'); if($messageValue && $user->id != 0 && $fromValue && $toValue && $seidValue && $pidValue) { $result = $this->getModel('ajax')->saveChat($messageValue, $fromValue, $toValue, $seidValue, $pidValue, $replyidValue, $pmidValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'conversation': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $user1Value = $jinput->get('user1', NULL, 'INT'); $user2Value = $jinput->get('user2', NULL, 'INT'); $seidValue = $jinput->get('seid', NULL, 'INT'); $pidValue = $jinput->get('pid', NULL, 'INT'); if($user1Value && $user->id != 0 && $user2Value && $seidValue && $pidValue) { $result = $this->getModel('ajax')->conversation($user1Value, $user2Value, $seidValue, $pidValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'ajaxReadMessage': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $midValue = $jinput->get('mid', NULL, 'INT'); $seidValue = $jinput->get('seid', NULL, 'INT'); if($midValue && $user->id != 0 && $seidValue) { $result = $this->getModel('ajax')->ajaxReadMessage($midValue, $seidValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'deleteChat': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $midValue = $jinput->get('mid', NULL, 'INT'); if($midValue && $user->id != 0) { $result = $this->getModel('ajax')->deleteChat($midValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'goToClass': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $user1Value = $jinput->get('user1', NULL, 'INT'); $user2Value = $jinput->get('user2', NULL, 'INT'); $seidValue = $jinput->get('seid', NULL, 'INT'); $pidValue = $jinput->get('pid', NULL, 'INT'); if($user1Value && $user->id != 0 && $user2Value && $seidValue && $pidValue) { $result = $this->getModel('ajax')->goToClass($user1Value, $user2Value, $seidValue, $pidValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'getCatLevelOne': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $extensionValue = $jinput->get('extension', NULL, 'STRING'); if($extensionValue) { $result = $this->getModel('ajax')->getCatLevelOne($extensionValue); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; case 'getCatLevelTwo': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $catIdLevel1Value = $jinput->get('catIdLevel1', NULL, 'INT'); if($catIdLevel1Value) { $result = $this->getModel('ajax')->getCatLevelTwo($catIdLevel1Value); } else { $result = false; } if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback . "(".json_encode($result).");"; } elseif($returnRaw) { echo json_encode($result); } else { echo "(".json_encode($result).");"; } } catch(Exception $e) { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode($e).");"; } else { echo "(".json_encode($e).");"; } } break; } } else { if($callback = $jinput->get('callback', null, 'CMD')) { echo $callback."(".json_encode(false).");"; } else { echo "(".json_encode(false).");"; } } } } PK z�[���� � comment.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.39 @build 4th April, 2023 @created 17th December, 2020 @package Reservation @subpackage comment.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Comment Controller */ class ReservationControllerComment extends JControllerForm { /** * Current or most recently performed task. * * @var string * @since 12.2 * @note Replaces _task. */ protected $task; public function __construct($config = array()) { $this->view_list = 'login'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); } /***[JCBGUI.site_view.php_controller.32.$$$$]***/ public function save($key = NULL, $urlVar = NULL) { $app= JFactory::getApplication(); $data= $app->input->get('jform',array(),'array'); $uid= $app->input->get('uid', 0); $userid= JFactory::getUser()->get('id', 0); $seid= $app->input->get('seid', 0); $currentUrl= (string)JUri::getInstance(); \JPluginHelper::importPlugin('reservation'); $dispatcher = \JEventDispatcher::getInstance(); $result= $dispatcher->trigger('onBeforeSaveComment',array($uid,$userid,$seid)); $data['seid']= $seid; $data['sickid']= $result[0]['sickid']; $data['consultantid']= $result[0]['consultantid']; $data['token']= md5(uniqid(rand(), true)); JLoader::register('ReservationModelComment',JPATH_COMPONENT_ADMINISTRATOR.'/models/comment.php'); $commentModel= new ReservationModelComment(); \JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms'); $form= $commentModel->getForm($data,false); $filterData= $form->filter($data); $filterData['published']= 0; $validData= $commentModel->validate($form,$filterData); if ($validData === false) { $errors= $commentModel->getErrors(); foreach ($errors as $error) { $app->enqueueMessage($error->getMessage(),'warning'); } $app->setUserState('comment.data',$filterData); $app->redirect($currentUrl); } if($commentModel->save($filterData)) { $app->setUserState('status',1); $app->setUserState('comment.data',''); $app->redirect($currentUrl); } }/***[/JCBGUI$$$$]***/ /** * Method to check if you can edit an existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 12.2 */ protected function allowEdit($data = array(), $key = 'id') { // to insure no other tampering return false; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { // to insure no other tampering return false; } /** * Method to check if you can save a new or existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 12.2 */ protected function allowSave($data, $key = 'id') { // to insure no other tampering return false; } /** * Function that allows child controller access to model data * after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 12.2 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { } } PK z�[wb�v� � consultantsignup.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.39 @build 4th April, 2023 @created 17th December, 2020 @package Reservation @subpackage consultantsignup.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Consultantsignup Controller */ class ReservationControllerConsultantsignup extends JControllerForm { /** * Current or most recently performed task. * * @var string * @since 12.2 * @note Replaces _task. */ protected $task; public function __construct($config = array()) { $this->view_list = 'login'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); } /***[JCBGUI.site_view.php_controller.31.$$$$]***/ public function signup() { $app= JFactory::getApplication(); if(!JFactory::getUser()->guest) { $app->enqueueMessage('برای ساخت حساب جدید ابتدا از حساب فعلی خود خارج شوید','warning'); $app->redirect(JUri::root()); } $uri = (string)JUri::getInstance(); JLoader::register('ReservationModelConsultant', JPATH_COMPONENT_ADMINISTRATOR.'/models/consultant.php'); \JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms'); $data= JFactory::getApplication()->input->get('jform',array(),'array'); $consultantModel= new ReservationModelConsultant; $form = $consultantModel->getForm($data, false); $xml = new SimpleXMLElement('<field name="password" validate="password"/>'); $form->setField($xml); // $rule= JFormHelper::loadRuleType('password'); // $res= $rule->test($xml,$data['password']); // $filteredData = $form->filter($data); $filter= JFilterInput::getInstance(); $data['name']= preg_replace('/[0-9]+/', '', $data['name']); $data['capital']= preg_replace('/[0-9]+/', '', $data['capital']); $data['msn']= $filter->clean( $data['msn'], 'int'); $data['nationalnumber']= $filter->clean( $data['nationalnumber'], 'int'); $data['experience']= $filter->clean( $data['experience'], 'int'); $model= $this->getModel(); if($model->checkPhoneExist($data['phonenumber'])) { $app->enqueueMessage('این شماره تلفن قبلا در این سامانه ثبت شده است لطفا با شماره تلفن دیگری ثبت نام کنید','warning'); $app->setUserState('consultant.data',$data); $app->redirect($uri); } $validData = $consultantModel->validate($form, $data); if ($validData === false) { $errors = $consultantModel->getErrors(); foreach ($errors as $error) { $app->enqueueMessage($error->getMessage(),'warning'); } $app->setUserState('consultant.data',$data); $app->redirect($uri); } else{ $userdata = array( "name"=> $data['name'], "username"=> $data['phonenumber'], "password"=> $data['password'], "password2"=> $data['password'], "email"=> 'R_'.$data['phonenumber'].'@gmail.com', "block"=> 0, ); jimport('joomla.user.helper'); $params= $app->getparams('com_reservation'); $userGroup= $params->get('consultantgroup'); if(!isset($userGroup)) $userGroup = 2; $userdata["groups"] = $userGroup; $user = new JUser; if(!$user->bind($userdata)) { $app->enqueueMessage($user->getError(), 'warning'); $app->redirect($uri); return false; } if (!$user->save()) { $app->enqueueMessage($user->getError(), 'warning'); $app->redirect($uri); return false; } $app->setUserState('consultant.data',$data); $userId= $user->id; $consultantInfo= array( 'userid'=> $userId, 'msn' => $data['msn'], 'nationalnumber' => $data['nationalnumber'], 'catid' => $data['catid'], 'capital' => $data['capital'], 'phonenumber' => $data['phonenumber'], 'experience' => $data['experience'] ); if(!$consultantModel->save($consultantInfo)) { $app->enqueueMessage('اطلاعات خود را تصحیح کرده و سپس وارد نمایید', 'warning'); $app->redirect($uri); } $app->setUserState('consultant.data',''); echo 'user saved successfully'; } $credentials = array(); $credentials['username'] = $data['phonenumber']; $credentials['password'] = $data['password']; $login_site = JFactory::getApplication('site'); $login_site->login($credentials, $options=array()); $redirect = JUri::root(); $login_site->redirect($redirect); }/***[/JCBGUI$$$$]***/ /** * Method to check if you can edit an existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 12.2 */ protected function allowEdit($data = array(), $key = 'id') { // to insure no other tampering return false; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { // to insure no other tampering return false; } /** * Method to check if you can save a new or existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 12.2 */ protected function allowSave($data, $key = 'id') { // to insure no other tampering return false; } /** * Function that allows child controller access to model data * after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 12.2 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { } } PK z�[p�a�� � consultant_plan.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.39 @build 4th April, 2023 @created 17th December, 2020 @package Reservation @subpackage consultant_plan.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Consultant_plan Controller */ class ReservationControllerConsultant_plan extends JControllerForm { /** * Current or most recently performed task. * * @var string * @since 12.2 * @note Replaces _task. */ protected $task; public function __construct($config = array()) { $this->view_list = 'login'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); } /***[JCBGUI.site_view.php_controller.37.$$$$]***/ public function delete($key = NULL, $urlVar = NULL) { $app= JFactory::getApplication(); $uri= (string)JUri::getInstance(); $user= JFactory::getUser(); $jform= $app->input->get('jform',array(),'array'); $consultant= ReservationHelper::getConsultant($jform['consultantid']); if ($consultant->userid != $user->get('id', 0)) $app->redirect(JUri::root()); $filename = __DIR__ . '/delete.txt'; $plans = array_keys($jform['plans']); $plans = array_map(function ($a) { return intval(substr($a, 5)); }, $plans); // file_put_contents($filename, 'plans = ' . print_r($plans, true) . "\n" , FILE_APPEND); JLoader::register('ReservationModelPlan', JPATH_ADMINISTRATOR . '/components/com_reservation/models/plan.php'); JLoader::register('ReservationTablePlan', JPATH_ADMINISTRATOR . '/components/com_reservation/tables/plan.php'); JPluginHelper::importPlugin('reservation'); $dispatcher = JEventDispatcher::getInstance(); foreach($plans as $pid) { $db = JFactory::getDbo(); $planmodel = new ReservationTablePlan($db); $pkco = array( 'id' => $pid ); $planmodel->publish($pkco, -2); $pks = array($pid); $dispatcher->trigger('onReservationPlanStateChanged', array($pks, -2)); $planmodel->delete($pkco); } $app->redirect($uri); } public function save($key = NULL, $urlVar = NULL) { $filename = __DIR__ . '/save.txt'; // file_put_contents($filename, 'key = ' . print_r($key, true) . "\n" , FILE_APPEND); $uri= (string)JUri::getInstance(); $user= JFactory::getUser(); $app= JFactory::getApplication(); $jform= $app->input->get('jform',array(),'array'); $consultant= ReservationHelper::getConsultant($jform['consultantid']); if ($consultant->userid != $user->get('id', 0)) $app->redirect(JUri::root()); JLoader::register('ReservationModelPlan', JPATH_ADMINISTRATOR.'/components/com_reservation/models/plan.php'); if(isset($jform['planid']) && $jform['planid']) { $jform['id'] = $jform['planid']; $planmodel = new ReservationModelPlan(); $planObj = $planmodel->getItem($jform['id']); $consultant= ReservationHelper::getConsultant($planObj->consultantid); if ($consultant->userid != $user->get('id', 0)) $app->redirect(JUri::root()); } unset($jform['planid']); // file_put_contents($filename, 'jform = ' . print_r($jform, true) . "\n" , FILE_APPEND); $planmodel= new ReservationModelPlan; if (!$planmodel->save($jform)) { $app->enqueueMessage(JText::_('COM_RESERVATION_FAILED_TO_SAVE_PLAN', 'danger')); // failed to save plan $app->redirect($uri); } $validData = (array)$planmodel->getItem(); JPluginHelper::importPlugin('reservation'); $dispatcher = JEventDispatcher::getInstance(); $dispatcher->trigger('onReservationPlanCreated', array($validData)); $app->enqueueMessage(JText::_('COM_RESERVATION_PLAN_SAVED_SUCCESSFULLY', 'success')); // plan saved successfully $app->redirect($uri); } /***[/JCBGUI$$$$]***/ /** * Method to check if you can edit an existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 12.2 */ protected function allowEdit($data = array(), $key = 'id') { // to insure no other tampering return false; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { // to insure no other tampering return false; } /** * Method to check if you can save a new or existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 12.2 */ protected function allowSave($data, $key = 'id') { // to insure no other tampering return false; } /** * Function that allows child controller access to model data * after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 12.2 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { } } PK z�[r9Ѥr r doctors.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.22 @build 1st March, 2021 @created 17th December, 2020 @package Reservation @subpackage doctors.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Doctors Controller */ class ReservationControllerDoctors extends JControllerForm { /** * Current or most recently performed task. * * @var string * @since 12.2 * @note Replaces _task. */ protected $task; public function __construct($config = array()) { $this->view_list = 'doctor'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); } /***[JCBGUI.site_view.php_controller.33.$$$$]***/ public function check() { $app= JFactory::getApplication(); $uid= $app->input->get('uid'); $params= $app->getparams('com_reservation'); $userGroups= !empty($params->get('doctorgroup'))? $params->get('doctorgroup'): [0]; $db= JFactory::getDbo(); $query= $db->getQuery(true) ->select($db->quoteName('d.id')) ->from($db->quoteName('#__reservation_doctor','d')) ->join('inner',$db->quoteName('#__user_usergroup_map','uu').'on'.$db->quoteName('uu.user_id').'='.$db->quoteName('d.userid')) ->where($db->quoteName('d.userid').'='.$db->quote($uid)) ->where($db->quoteName('uu.group_id').'IN('.implode(',',$userGroups).')'); $db->setQuery($query); $result= $db->loadObject(); if (empty($result)) $app->redirect(JUri::root()); $app->redirect(JRoute::_('index.php?option=com_reservation&view=doctor&uid'.$uid,false)); }/***[/JCBGUI$$$$]***/ /** * Method to check if you can edit an existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 12.2 */ protected function allowEdit($data = array(), $key = 'id') { // to insure no other tampering return false; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { // to insure no other tampering return false; } /** * Method to check if you can save a new or existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 12.2 */ protected function allowSave($data, $key = 'id') { // to insure no other tampering return false; } /** * Function that allows child controller access to model data * after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 12.2 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { } } PK z�[� �'Q Q doctorsignup.phpnu �[��� <?php /*----------------------------------------------------------------------------------| www.vdm.io |----/ fdsh /-------------------------------------------------------------------------------------------------------/ @version 1.0.39 @build 4th April, 2023 @created 17th December, 2020 @package Reservation @subpackage doctorsignup.php @author farhad shahbazi <http://farhad.com> @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) .-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( \____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Reservation Doctorsignup Controller */ class ReservationControllerDoctorsignup extends JControllerForm { /** * Current or most recently performed task. * * @var string * @since 12.2 * @note Replaces _task. */ protected $task; public function __construct($config = array()) { $this->view_list = 'login'; // safeguard for setting the return view listing to the default site view. parent::__construct($config); } /***[JCBGUI.site_view.php_controller.34.$$$$]***/ public function signup() { $app= JFactory::getApplication(); if(!JFactory::getUser()->guest) { $app->enqueueMessage('برای ساخت حساب جدید ابتدا از حساب فعلی خود خارج شوید','warning'); $app->redirect(JUri::root()); } $uri = (string)JUri::getInstance(); JLoader::register('ReservationModelDoctor', JPATH_COMPONENT_ADMINISTRATOR.'/models/doctor.php'); \JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms'); $data= JFactory::getApplication()->input->get('jform',array(),'array'); $doctorsModel= new ReservationModelDoctor; $form = $doctorsModel->getForm($data, false); $xml = new SimpleXMLElement('<field name="password" validate="password"/>'); $form->setField($xml); // $rule= JFormHelper::loadRuleType('password'); // $res= $rule->test($xml,$data['password']); // $filteredData = $form->filter($data); $filter= JFilterInput::getInstance(); $data['name']= preg_replace('/[0-9]+/', '', $data['name']); $data['msn']= $filter->clean( $data['msn'], 'int'); $model= $this->getModel(); if($model->checkPhoneExist($data['phonenumber'])) { $app->enqueueMessage('این شماره تلفن قبلا در این سامانه ثبت شده است لطفا با شماره تلفن دیگری ثبت نام کنید','warning'); $app->setUserState('doctor.data',$data); $app->redirect($uri); } $validData = $doctorsModel->validate($form, $data); if ($validData === false) { $errors = $doctorsModel->getErrors(); foreach ($errors as $error) { $app->enqueueMessage($error->getMessage(),'warning'); } $app->setUserState('doctor.data',$data); $app->redirect($uri); } else{ $userdata = array( "name"=> $data['name'], "username"=> $data['phonenumber'], "password"=> $data['password'], "password2"=> $data['password'], "email"=> 'R_'.$data['phonenumber'].'@gmail.com', "block"=> 0, ); $userGroup = 2; $userdata["groups"] = array($userGroup); $user = new JUser; if(!$user->bind($userdata)) { $app->enqueueMessage($user->getError(), 'warning'); $app->redirect($uri); } if (!$user->save()) { $app->enqueueMessage($user->getError(), 'warning'); $app->redirect($uri); } $app->setUserState('doctor.data',$data); $userId= $user->id; $doctorInfo= array( 'userid'=> $userId, 'msn' => $data['msn'], 'catid' => $data['catid'], 'capitalid' => $data['capitalid'], 'cityid' => $data['cityid'], 'phonenumber' => $data['phonenumber'], 'officephone' => $data['officephone'], 'address' => $data['address'], ); if(!$doctorsModel->save($doctorInfo)) { $app->enqueueMessage('اطلاعات خود را تصحیح کرده و سپس وارد نمایید', 'warning'); $app->redirect($uri); } $app->setUserState('doctor.data',''); echo 'user saved successfully'; } $credentials = array(); $credentials['username'] = $data['phonenumber']; $credentials['password'] = $data['password']; $login_site = JFactory::getApplication('site'); $login_site->login($credentials, $options=array()); $redirect = JUri::root(); $login_site->redirect($redirect); }/***[/JCBGUI$$$$]***/ /** * Method to check if you can edit an existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @since 12.2 */ protected function allowEdit($data = array(), $key = 'id') { // to insure no other tampering return false; } /** * Method override to check if you can add a new record. * * @param array $data An array of input data. * * @return boolean * * @since 1.6 */ protected function allowAdd($data = array()) { // to insure no other tampering return false; } /** * Method to check if you can save a new or existing record. * * Extended classes can override this if necessary. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key. * * @return boolean * * @since 12.2 */ protected function allowSave($data, $key = 'id') { // to insure no other tampering return false; } /** * Function that allows child controller access to model data * after the data has been saved. * * @param JModelLegacy $model The data model object. * @param array $validData The validated data. * * @return void * * @since 12.2 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { } } PK z�[oɢ�� � fileupload.phpnu �[��� <?php define('_JEXEC', 1); define('JPATH_BASE', dirname(dirname(dirname(dirname(__FILE__))))); require_once JPATH_BASE . '/includes/defines.php'; require_once JPATH_BASE . '/includes/framework.php'; $app = JFactory::getApplication('site'); use Joomla\CMS\Filesystem\File; // var_dump(function_exists('gd_info')); // check GD extension installed and enabled on php // var_dump(function_exists('getimagesize')); // die(); $filename = __DIR__ . '/log.txt'; // file_put_contents($filename, '$_FILES = ' . print_r($_FILES, True) . "\n", FILE_APPEND); // file_put_contents($filename, '$_POST = ' . print_r($_POST, True) . "\n", FILE_APPEND); // file_put_contents($filename, '$_req = ' . file_get_contents( 'php://input' ) . "\n", FILE_APPEND); // file_put_contents($filename, 'input files = ' . print_r($app->input->files->get('atachedfile'), True) . "\n", FILE_APPEND); function getName($n) { $characters = '0123456789abcdefghijklmnopqrstuvwxyz'; $randomString = ''; for ($i = 0; $i < $n; $i++) { $index = rand(0, strlen($characters) - 1); $randomString .= $characters[$index]; } return $randomString; } $file = $app->input->files->get('atachedfile'); $info = pathinfo($file['name']); if(isset($info['extension'])) { $ext = $info['extension']; // get the extension of the file $newname = getName(10) . ".$ext"; $target = dirname(dirname(__FILE__)) . '/files/' . $newname; $allowUnsafe = false; // if (move_uploaded_file($file['tmp_name'], $target)) if(JFile::upload($file['tmp_name'], $target, false, $allowUnsafe)) { if(function_exists('gd_info') && !function_exists('compress_image')) { function compress_image($src, $dest , $quality) { $info = getimagesize($src); if ($info['mime'] == 'image/jpeg') { $image = imagecreatefromjpeg($src); } elseif ($info['mime'] == 'image/gif') { $image = imagecreatefromgif($src); } elseif ($info['mime'] == 'image/png') { $image = imagecreatefrompng($src); } else { die('Unknown image file format'); } //compress and save file to jpg imagejpeg($image, $dest, $quality); //return destination file return $dest; } compress_image($target, $target, 30); } echo $newname; // file_put_contents($filename, 'File is valid, and was successfully uploaded'. "\n", FILE_APPEND); } else { // file_put_contents($filename, 'Upload failed'. "\n", FILE_APPEND); } } ?>PK z�[��B�"