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/kharagauli1/site/clases1/ |
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_; public function __construct(){ parent::__construct(); $this->session = session_id(); $this->_ip = $_SERVER['REMOTE_ADDR']; $this->must_by_removed = 'olimpiad_admin'; $this->make_widget(); $this->_Smarty(); //$this->scaner_smarty(); $this->authorization(); // $this->menu_names(); //echo $this->user_balance('cdebi'); } public function make_masiv(){ $this->_url_masiv = [ 'Geo' => ['','/'], //'Eng' => ['','/'], ['hello_word','hello_word'] ]; } public function make_widget(){ $this->_widgets = [ ['ბანერები','ამინდის_პროგნოზი','ვალუტის_კურსი','კალენდარი'], ['banners','weather','valute','calendar'] ]; } 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')); } } private function scaner_smarty(){ $address = '/var/www/'.$this->must_by_removed.'/view/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 = './view/templates_1'; $this->smarty->compile_dir = './view/templates_c'; $this->smarty->config_dir = './view/configs'; } 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 = []; $menu['big_pages'] = []; for($j = 0; $j < $length; $j++){ if(!$select[$j]['parent']){ if($select[$j]['home_page'])$menu['home_page'] = ['id' => $select[$j]['id'],'name' => $select[$j]['name_'.$_->_lang]]; else $menu['big_pages'][] = ['id' => $select[$j]['id'],'name' => $select[$j]['name_'.$_->_lang]]; } for($i = 0; $i < count($arrays); $i++){ if($select[$j]['menu_pos'] == $i) $array[$arrays[$i]][] = $select[$j]; } }return $array; } protected function menu_names(){ $_ = $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]]); } $menu['lang'] = (array)$this->language_config; $menu['lang_choised'] = $_->buble_2($this->language_config, $_->_lang); $menu['dir'] = ''; try{ if(!isset($menu['home_page']))throw new Home_page; }catch(Exception $ex){ die($this->render('404',["menu" => $menu,'message' => $ex->getMessage()])); } $_->_menu_ = $select; return $menu; } 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'){ $_ = $this; $length = count($array); for($i = 0; $i < $length; $i++){ if($array[$i][$colum] == $id) return $array[$i]; } } 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'; } 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; } } ?>