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 Base_class * * @author suxoza <suxoza@gmail.com> */ class Base_class extends Central{ protected $_url_masiv,$lang,$lang_url,$_widgets; public $smarty; public $session,$_ip,$_menu_,$_menu_2; public $_for_left_menu_slide_down = []; public $_menu_icon_size = []; public function __construct(){ parent::__construct(); $this->session = session_id(); $this->_ip = $_SERVER['REMOTE_ADDR']; $this->must_by_removed = $_SERVER['DOCUMENT_ROOT']; $this->make_widget(); $this->_Smarty(); //$this->scaner_smarty(); $this->menu_icon_size(); ///$this->authorization(); // $this->menu_names(); //echo $this->user_balance('cdebi'); $this->create_message_container_start(); // $this->partner_banners(); } public function make_masiv(){ $this->_url_masiv = [ 'Geo' => ['','/'], //'Eng' => ['','/'], ['hello_word','hello_word'] ]; } public function make_widget(){ $this->_widgets = [ ['ბანერები','ამინდის_პროგნოზი','ვალუტის_კურსი','კალენდარი'], ['banners','weather','valute','calendar'] ]; } function create_message_container_start(){ $_ = $this; $select = $_->select("*","messages","small"); if(strlen(strip_tags($select['title_'.$_->_lang])) < 3)return; if(isset($_COOKIE['_message_container']) && $_COOKIE['_message_container'] == $select['date'])return; setcookie('_message_container',$select['date'],time()+604800); $_->create_message_container_select = $select; } public function create_message_container(){ $_ = $this; if(!isset($_->create_message_container_select))return; $html = "<style>body{width: 100%;height: 100%;position: fixed;}</style>"; $html .= '<div id="cover"> </div><div id="_message_container"><div class="_message_container_close" onclick="_message_container_close()"></div>'.trim(stripcslashes($_->create_message_container_select['title_'.$_->_lang])).'</div>'; return $html; } protected function authorization(){ $_ = $this; if(!isset($_SESSION['admin_olimpiad'])){ if(isset($_POST['username'])){ if($_POST){ if(isset($_POST['username'],$_POST['password']) && $_->clier($_POST['username']) == 'admin' && $_->clier($_POST['password']) == 'admin'){ $_SESSION['admin_olimpiad'] = 'admin'; header('Location:/'); }else{ $_SESSION['message_info'] = 'user not found'; header("Location:/admin.php"); } } }else exit($this->render('default')); } } public function return_img_path($a){ return str_replace('../img/banners','/admin/img/banners',$a); } private function scaner_smarty(){ $address = $this->must_by_removed.'/templates/'.$this->_default_theme['name'].'/templates_c/'; $a = scandir($address); foreach($a as $key => $value){ if($value == '.' || $value == '..')continue; @unlink($address.$value); } } public function render($a,$b = []){ if(count($b)){ foreach($b as $key => $value) $this->smarty->assign($key, $value); } $this->smarty->display($a.'.tpl'); } public function _Smarty(){ $this->smarty = new Smarty(); $this->smarty->caching = false; $this->smarty->template_dir = $this->must_by_removed.'/templates/'.$this->_default_theme['name'].'/templates_1'; $this->smarty->compile_dir = $this->must_by_removed.'/templates/'.$this->_default_theme['name'].'/templates_c'; $this->smarty->config_dir = $this->must_by_removed.'/templates/'.$this->_default_theme['name'].'/configs'; $this->smarty->assign('_class_',$this); } public function smarty($a,$b = []){ if(count($b))$this->smarty->assign('maines',$b); $this->smarty->display($a); } public function reflection($url_masiv,$a = __Class__){ $_ = $this; $reflection = new ReflectionClass($a); foreach($url_masiv['Geo'] as $key => $value){ if($_->_url == $value){ if($reflection->hasMethod($url_masiv[0][$key])) echo $reflection->getMethod($url_masiv[0][$key])->invoke($_,$value); } } } private function new_menu_position($select,$arrays,&$menu){ $_ = $this; $length = count($select); $array = []; for($j = 0; $j < $length; $j++){ // if($select[$j]['visible'] == 0)continue; if(!$select[$j]['parent']) if($select[$j]['home_page'])$menu['home_page'] = ['id' => $select[$j]['id'],'name' => $select[$j]['name_'.$_->_lang]]; $_mas_mas = []; for($i = 0; $i < count($arrays); $i++){ if(!in_array($select[$j]['id'], $_mas_mas)){ $menu['_page_url'][] = $select[$j]['url_'.$_->_lang]; } $_mas_mas[] = $select[$j]['id']; if($select[$j]['menu_pos'] == $i) $array[$arrays[$i]][] = $select[$j]; } }return $array; } /** * @param $select */ private function for_left_menu_slide_down($select){ $_ = $this; $_->_for_left_menu_slide_down = []; if(!function_exists('inl')){ function inl($_,$select){ foreach($select as $key => $value){ $_->_for_left_menu_slide_down[] = $value['name']['url_Georgia']; if(isset($value['child']) && $value['child']) inl($_,$value['child']); } } } inl($_,$select); //$_->pre($_->_for_left_menu_slide_down); } protected function menu_names($boolean = 0){ $_ = $this; $obj = new stdClass(); $obj->c_type = "big"; $arrays = ['top','left','right','bottom']; $menu = []; $obj->sql = " order by pos asc"; $select = $_->select("*","menu",$obj); $select = count($select)?$select['body']:''; $selects = $_->new_menu_position($select,$arrays,$menu); for($i = 0; $i < 4; $i++){ $menu[$arrays[$i]] = NULL; if(isset($selects[$arrays[$i]])){ $menu[$arrays[$i]] = $_->recursion($selects[$arrays[$i]]); if($arrays[$i] == 'left') $_->for_left_menu_slide_down($menu[$arrays[$i]]); } } $menu['lang'] = (array)$this->language_config; $menu['lang_choised'] = $_->buble_2($this->language_config, $_->_lang); $menu['dir'] = ''; $menu['tmp_name'] = $this->_default_theme['name']; $menu['_url'] = explode('/',$_SERVER['REQUEST_URI']); $menu['slide'] = $_->select('*','body','big',["page_id",324])['body']; //$_->pre($menu['slide']); //echo count($menu['_url']); try{ if(!isset($menu['home_page']))throw new Home_page; }catch(Home_page $ex){ die($ex->getMessage()); } $menu['dir'] = $_->must_by_removed.'/templates/'.$this->_default_theme['name'].'/templates_1/'; $_->_menu_ = $menu; $_->_menu_2 = $select; $menu['top']['json_title_images'] = []; if(!$boolean)return $menu; } private function menu_icon_size(){ $_ = $this; if(file_exists($_SERVER['DOCUMENT_ROOT'].'/img/files/menu.json')) $_->_menu_icon_size = (array)json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'].'/img/files/menu.json')); } private function recursion($select){ $_ = $this; $menu = []; for($i = 0; $i < count($select); $i++){ $parent = $select[$i]['parent']; $name = $select[$i]['name_'.$_->_lang]; $id = $select[$i]['id']; if($parent || array_key_exists($id, $menu))continue; $menu[$id]['name'] = $select[$i]; $this->inline_recs($select,$menu,$id,$menu[$id]['child']); }return $menu; } private function inline_recs($select,$menu_old,$ids,&$menu){ if(!count($menu_old))return; $_ = $this; for($i = 0; $i < count($select); $i++){ $parent = $select[$i]['parent']; $name = $select[$i]['name_'.$_->_lang]; $id = $select[$i]['id']; if(array_key_exists($parent, $menu_old) && $parent && $parent == $ids){ $menu[$id]['name'] = $select[$i]; // sort($menu[$id]['name'],$menu[$id]['name']['parent']); $this->inline_recs($select,$menu,$id,$menu[$id]['child']); } } } public function return_current_element($array,$id,$colum = 'id',$loop = false,$finder = false){ $_ = $this; $length = count($array); $return = []; for($i = 0; $i < $length; $i++){ if(!$loop){ if($array[$i][$colum] == $id) return $array[$i]; }else{ if($array[$i][$colum] == $id){ if($finder){ if($array[$i][$finder[0]] == $finder[1])continue; }$return[] = $array[$i]; } } }return $return; } public function page($a){ $_ = $this; $name = lcfirst(get_called_class()); try{ $url = explode('/',$_SERVER['REQUEST_URI']); $_id = (int)$url[(int)array_search('page', $url) + 1]; if(!$_id)throw new Page_not_found; $menu_names = $_->menu_names(); $select_menu = $_->return_current_element($_->_menu_,$_id); if(!$select_menu)throw new Page_not_found; $_->_moduls(); if(!isset($_->moduls->moduls[$select_menu['category']]))throw new Module_not_found; $category = $_->moduls->moduls[$select_menu['category']]; if(!in_array($category,$_->available_moduls) || !file_exists($_->_dir.'moduls/'.$category.'/admin/'.$name.'.php')) throw new Module_not_found; }catch(Page_not_found $ex){ die($this->render('404',["menu" => $menu_names,'message' => $ex->getMessage()])); }catch(Module_not_found $ex){ die($this->render('modul_not_found',["menu" => $menu_names,'message' => $ex->getMessage()])); } require_once $_->_dir.'moduls/'.$category.'/admin/'.$name.'.php'; } public function widgets($a){ $_ = $this; $class = lcfirst(get_called_class()); $menu = $_->menu_names(); try{ $name = array_search($a, $_->_widgets[0]); if($name == -1) throw new Page_not_found; $name = $_->_widgets[1][$name]; if(!file_exists($this->_dir.'moduls/'.$name) || !file_exists($_->_dir.'moduls/'.$name.'/admin/'.$class.'.php'))throw new Module_not_found("ვიჯეტი ვერ მოიძებნა!!!"); if(!in_array($name, $_->show_tables())) throw new Table_not_found; }catch(Page_not_found $ex){ die($this->render('404',["menu" => $menu,'message' => $ex->getMessage()])); }catch(Module_not_found $ex){ die($this->render('modul_not_found',["menu" => $menu,'message' => $ex->getMessage()])); }catch(Table_not_found $ex){ die($this->render('table_not_found',["menu" => $menu,'message' => $ex->getMessage()])); } $url = explode('/',$_SERVER['REQUEST_URI']); require_once $_->_dir.'moduls/'.$name.'/admin/'.$class.'.php'; } public function partner_banners(){ $_ = $this; $sel = $_->select_(["*","banners","new_big"]); $select = []; for($i = 0; $i < count($sel); $i++) $select[$sel[$i]['category']][] = $sel[$i]; return $select; } public function all_pages($a){ $_ = $this; $href = trim(strip_tags($a)); $select_menu = $_->return_current_element($_->_menu_2,$href,"url_".$this->_lang); $any_menus = []; if($select_menu['parent']) $any_menus = $_->return_current_element($_->_menu_2,$select_menu['parent'],"parent",true,["id",$select_menu['id']]); $_->_menu_['any_menus'] = $any_menus; $name = lcfirst(get_called_class()); try{ if(!$select_menu)throw new Page_not_found; $_->_moduls(); if(!isset($_->moduls->moduls[$select_menu['category']]))throw new Module_not_found; $category = $_->moduls->moduls[$select_menu['category']]; if(!in_array($category,$_->available_moduls) || !file_exists($_->_dir.'moduls/'.$category.'/site/'.$name.'.php')) throw new Module_not_found; //$select = $_->select("*","body",""); }catch(Page_not_found $ex){ $_->smarty->template_dir = $_->_dir.'view/templates_1'; die($this->render('404',["menu" => $_->menu_names(),'message' => $ex->getMessage()])); }catch(Module_not_found $ex){ $_->smarty->template_dir = $_->_dir.'view/templates_1'; die($this->render('404',["menu" => $_->menu_names(),'message' => $ex->getMessage()])); } //$_->pre($_->_menu_); $url = explode('/',$_SERVER['REQUEST_URI']); require_once $_->_dir.'moduls/'.$category.'/site/'.$name.'.php'; } function upload_image($file,$_logo){ $_ = $this; $file_name = time().'_'.mb_substr($file['name'],-5); $file_name_small = explode('.',$file_name)[0]; if(move_uploaded_file($file['tmp_name'],$_->_dir.'img/banners/'.$file_name)){ $_->main_images($file_name,$_->_dir.'img/banners',$_->_dir.'img/banners/small',$file_name_small,240,2); if($_logo){ if(file_exists($_->_dir.'img/banners/'.$_logo))@unlink($_->_dir.'img/banners/'.$_logo); if(file_exists($_->_dir.'img/banners/small/'.$_logo))@unlink($_->_dir.'img/banners/small/'.$_logo); } $file_name = (preg_match('/[.](jpeg)|(JPEG)$/',$file_name))?explode('.',$file_name)[0].'.jpg':$file_name; return $file_name; } } public function returt_cookie($a,$b){ if(isset($_COOKIE[$a])) return $_COOKIE[$a]; return $b; } public function _get_location_href($href = '',$n_p = 'current'){ $_ = $this; $url = explode('/',urldecode($_->clier($_SERVER['REQUEST_URI']))); if(in_array($href,$url)){ if($n_p == 'current')return $href; elseif($n_p == 'prev' && isset($url[array_search($href,$url) - 1]))return $url[array_search($href,$url) - 1]; elseif($n_p == 'next' && isset($url[array_search($href,$url) + 1]))return $url[array_search($href,$url) + 1]; return false; } return false; } } ?>