Server IP : 80.241.246.6 / Your IP : 216.73.216.167 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/kharagauli1/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'], ['menu_index','change_menu_pos','page'] ]; } 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); } private function menu_position($json){ $_ = $this; $select = $_->select("*","menu","big")['body']; if($json->delete_menu_name_var && count((array)$json->delete_menu_name_var))$_->delete_menu_name_var($json->delete_menu_name_var); if($json->change_home_page_var)$_->update_home_page($json->change_home_page_var); for($i = 0; $i < count($select); $i++){ $page = $select[$i]; if($json->menu_index_variable && count((array)$json->menu_index_variable)){ $json_ = array_filter($json->menu_index_variable); if($json_[$page['id']]->pos != $page['pos'] || $json_[$page['id']]->parent != $page['parent']){ $_->update("menu",[["parent","pos"],[$json_[$page['id']]->parent,$json_[$page['id']]->pos],["id",$page['id']]]); //echo 1; } } if($json->change_menu_checkbox_visible_var){ $json_ = $json->change_menu_checkbox_visible_var; if(isset($json_->{$page['id']}) && $json_->{$page['id']} != $page['visible']){ $_->update("menu",[["visible"],[$json_->{$page['id']}],["id",$page['id']]]); //echo 1; } } if($json->change_menu_name_var){ $json_ = $json->change_menu_name_var; if(isset($json_->{$page['id']}) && $json_->{$page['id']} != $page['name_'.$_->_lang]){ $_->update("menu",[['name_'.$_->_lang],[$json_->{$page['id']}],["id",$page['id']]]); } } }echo 1; } private function update_home_page($id){ $_ = $this; $_->update("menu",[["home_page"],[0],["home_page",1]]); $_->update("menu",[["home_page"],[1],["id",$id]]); } private function delete_menu_name_var($a){ $_ = $this; $obj = new stdClass(); $obj->c_type = "big"; $obj->sql = ""; $select = $_->select("*","menu",$obj)['body']; function delete_files($file,$_){ if($_->startSwith($file,'http') || !$file)return; if($_->endSwith($file,'.mp4')){ $image_name_ = str_replace('.mp4', '.jpg', $file); if(file_exists($_->_dir.'img/banners/video/'.$file))@unlink($_->_dir.'img/banners/video/'.$file); if(file_exists($_->_dir.'img/banners/video/img/'.$image_name_))@unlink($_->_dir.'img/banners/video/img/'.$image_name_); if(file_exists($_->_dir.'img/banners/video/img/small/'.$image_name_))@unlink($_->_dir.'img/banners/video/img/small/'.$image_name_); }else{ if(file_exists($_->_dir.'img/banners/'.$file))@unlink($_->_dir.'img/banners/'.$file); if(file_exists($_->_dir.'img/banners/small/'.$file))@unlink($_->_dir.'img/banners/small/'.$file); } } function delete_from_body($_,$a,$b){ //$_->delete("menu",["id",$a]); if(!count($b))return; $_->con->exec("delete from $a where id in(".join(",",$b).")"); } $ids = []; $ids2 = []; function inline_delete(&$ids,$_,$select,$a,$c = 1){ if(!count($select))return; for($i = 0; $i < count($select); $i++){ if($select[$i]['home_page'] == 1)continue; if(in_array($select[$i]['parent'], (array)$a)){ $ids[] = $select[$i]['id']; inline_delete($ids,$_,$select,[$select[$i]['id']],2); } if($c == 1) if(in_array($select[$i]['id'], (array)$a)){ $ids[] = $select[$i]['id']; } } } function inline_delete_body(&$ids2,$ids,$_){ $obj = new stdClass(); $obj->c_type = "big"; $obj->sql = " and page_id in (".join(',',$ids).")"; $select = $_->select("*","body",$obj); $length = isset($select['body'])?count($select['body']):0; if(!$length)return; $maines = []; for($i = 0; $i < $length; $i++){ delete_files($select['body'][$i]['logo'],$_); $ids2[] = $select['body'][$i]['id']; $maines[] = $select['body'][$i]['id']; } inline_delete_body($ids2,$maines,$_); } inline_delete($ids,$_,$select,$a,1); if(!count($ids))return; ///must by deleted from menu delete_from_body($_,'menu',$ids); ///must by deleted from menu //$_->pre($ids); //echo '---------------------'; inline_delete_body($ids2,$ids,$_); delete_from_body($_,'body',$ids2); //$_->pre($ids2); } }