Server IP : 80.241.246.6 / Your IP : 216.73.216.188 Web Server : Apache/2.4.25 (Debian) System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64 User : www-data ( 33) PHP Version : 7.0.33-0+deb9u12 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/kharagauli_new/clases/ |
Upload File : |
<?php /** * Class Ajax * * @author suxoza <suxoza@gmail.com> */ class Ajax extends Base_class{ public $_url_masiv_2; private $URL; public function __construct(){ parent::__construct(); $this->URL = explode('/',urldecode($_SERVER['REQUEST_URI'])); $this->make_url(); //$this->language = } public function make_url(){ $_ = $this; $_->make_masiv(); $lang = 1; $_->_url = $_->URL[$lang]; $_->_url = (!$_->_url || strlen($_->_url) < 2)?'/':$_->_url; try{ if($_->_url && in_array($_->_url,$_->_url_masiv['Geo'])) $_->reflection($_->_url_masiv,__CLASS__); elseif($_->_url && in_array($_->_url,$_->_url_masiv_2['Geo'])) $_->reflection($_->_url_masiv_2,__CLASS__); ///widgets elseif($_->_url && in_array($_->_url,$_->_widgets[0])){ $reflection = new ReflectionClass(__CLASS__); echo $reflection->getMethod('widgets')->invoke($_,$_->_url); } ///end widgets else throw new Page_not_found; }catch(Page_not_found $ex){ die($this->render('404',["menu" => $_->menu_names(),'message' => $ex->getMessage()])); } } public function make_masiv(){ parent::make_masiv(); $this->_url_masiv_2 = [ //'Eng' => [''], 'Geo' => ['menu_index','change_menu_pos','page','question_answers','datepicker','search'], ['menu_index','change_menu_pos','page','question_answers','datepicker','search'] ]; } public function change_menu_pos($a){ $_ = $this; $json = json_decode($_POST['change_menu_pos']); if($_->update("menu",[['menu_pos'],[$json->vals],["id",$json->id]]))echo 1; } public function menu_index($a){ $_ = $this; $json = json_decode($_->clear($_POST[$a])); $_->menu_position($json); } public function question_answers($a){ $_ = $this; if(!isset($_POST['answer_id'],$_POST['question_id']))return; $answer_id = (int)$_POST['answer_id']; $question_id = (int)$_POST['question_id']; if(isset($_COOKIE['question_answers'])){ $qw = json_decode($_COOKIE['question_answers']); if(isset($qw->{$question_id}))return; } $sql = "update question_answers set choosed = choosed + 1 where question_id = $question_id and id = $answer_id"; $_->select_([$sql,"call"]); echo 1; } public function datepicker($a){ $_ = $this; $obj = new stdClass(); $obj->c_type = "big"; $__date = ($_POST['datepicker'] && $_POST['datepicker'] != 'undefined')?$_->clier($_POST['datepicker']):date("d-m-Y",time()); list($start_,$end_,$any_) = explode('-',$__date); $__date = strtotime($__date); $t = date('t',strtotime($__date)); $start = ($start_-1)*86400; $end = ($t-($start_ + 1))*86400; $sql = " select t.menu_id, t1.page_date, t2.id as from_menu from menu_body t join body t1 on t1.id = t.body_id and (t1.page_date >= '".($__date-$start)."' and t1.page_date <= '".($__date+$end)."') join menu t2 on t2.id = t.menu_id and t2.search_with_calendar = 1 where 1 group by t1.id "; $page_date = $_->select_([$sql,"big"]); $page_date = (isset($page_date['body']))?$page_date['body']:[]; $length = count($page_date); $return = []; for($i = 0; $i < $length; $i++){ if(!$page_date[$i]['page_date'])continue; $return[] = date('j',$page_date[$i]['page_date']); } echo json_encode($return); } function search($a){ $_ = $this; $val = $_->clear(addslashes($_POST['search'])); $sql = " select t.body_id, t1.page_date,t1.name_".$_->_lang." as body_name, t2.id as from_menu,t2.url_".$_->_lang." as url_name from menu_body t join body t1 on t1.id = t.body_id and ( t1.name_Georgia like '%".$val."%' or t1.name_English like '%".$val."%' or t1.body_Georgia like '%".$val."%' or t1.body_English like '%".$val."%' ) join menu t2 on t2.id = t.menu_id and t2.search_with_rss = 1 where 1 group by t.body_id limit 10 "; //echo $sql; $select = $_->select_([$sql,"new_big"]); echo Base_class::_json_encode($select); } }