403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/kharagauli_new/clases/Base_class.php
<?php

/**
 * Class Base_class
 *
 * @author suxoza <suxoza@gmail.com>
 */

class Base_class extends Central{  
   protected $_url_masiv,$lang,$lang_url,$_widgets;
   public $smarty,$news_anounces_container,$_url_,$reversed_link;
   public $session,$_ip,$_menu_,$_menu_2;
   public $_for_left_menu_slide_down = [];
   
   public function __construct(){
      parent::__construct();
      $this->_url_ = $this->_lang == 'Georgia'?'':'/en';
      $this->session = session_id();
      $this->_ip = $_SERVER['REMOTE_ADDR'];
      $this->must_by_removed = $_SERVER['DOCUMENT_ROOT'];
      
      $this->make_widget();
      $this->_Smarty();
      
      $this->scaner_smarty();


    }







    
   public function make_masiv(){

        $this->_url_masiv = [
            'Geo' => ['','/'],
            //'Eng' => ['','/'],
            ['hello_word','hello_word']
        ];
    }
    
   public function make_widget(){
       $this->_widgets = [
        [],[]
       ];
   }

   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;
          //echo 1;
          $reflection = new ReflectionClass($a);
            foreach($url_masiv['Geo'] as $key => $value){
                //echo $key.' | '.$value.'<br>'; 
                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'] = $_->_lang;
        $menu['dir'] = '';
        $menu['tmp_name'] = $this->_default_theme['name'];
        $menu['_url'] = explode('/',$_SERVER['REQUEST_URI']);
        //$_->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['icons_array'] = ['fa-group','fa-institution','fa-street-view','fa-user-md','fa-image'];
        $_->_menu_ = $menu;
        $_->_menu_2 = $select;
        $menu['top']['json_title_images'] = [];



        if(!$boolean)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_link_to_id($id){
        $_ = $this;
        foreach($_->_menu_2 as $key => $value)
          if($value['id'] == $id)
            return $_->_url_."/".$value['url_'.$_->_lang];
        return $_->_url_;
    }
    
    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;
	#if($_SERVER['REMOTE_ADDR'] == '178.134.198.58')die;
        $name = lcfirst(get_called_class());
        try{
                $url = explode('/',$_SERVER['REQUEST_URI']);  
                $_id = (int)$url[(int)array_search('page', $url) + 1];
		#echo "<pre>";
		#print_r($url);
		#echo "</pre>";
                #$_id = (int)explode('?',$url[array_search('page', $url) + 1])[0];

                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 all_pages($a,$for_include = false){
        $_ = $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();
            $moduls_new_category = ($select_menu['category'] == 4)?2:$select_menu['category'];
            if(!isset($_->moduls->moduls[$moduls_new_category]))throw new Module_not_found;
            $category = $_->moduls->moduls[$moduls_new_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()]));
        }

        $url = explode('/',$_SERVER['REQUEST_URI']);
        if(!$for_include){//if($_SERVER['REMOTE_ADDR'] == '178.134.198.58'){echo $_->_dir.'moduls/'.$category.'/site/'.$name.'.php';echo "<pre>";print_r($url);echo "</pre>";};
           require_once $_->_dir.'moduls/'.$category.'/site/'.$name.'.php';
        }elseif(gettype($for_include) == 'array'){
          $menu = $_->_menu_;
          $menu['select_body'] = $for_include;
          $_->smarty->template_dir = $for_include['template_dir'];
          $_dd = explode('/',__DIR__);
          $menu['self_dir'] = $_->admin_dir().'moduls/'.$_dd[count($_dd) - 2].'/'.$_dd[count($_dd) - 1];
          return die($this->render('date',["menu" => $menu]));
        }else
          return die($this->render('base',["menu" => $_->menu_names()]));
    }
    
   public function returt_cookie($a,$b){
        if(isset($_COOKIE[$a]))
            return $_COOKIE[$a];
        return $b;
   }

   public function get_news(){
      $_ = $this;
      $select = [];
      $sql = function($start = 0, $end = 2){ 
        $_ = $this;
        return "
        select 
          t1.*,
          t2.name_".$_->_lang." as category_name_,t2.url_".$_->_lang." as category_url_,
          t.menu_id
         from menu_body t 
         join body t1 on t1.id = t.body_id
         join menu t2 on t2.id = t.menu_id
          where t.menu_id = {}
          order by t1.page_date desc limit $start,$end
      ";};
      $select[] = $_->select_([str_replace('{}', 70, $sql(0,2)),"new_big"]);
      $select[] = $_->select_([str_replace('{}', 70, $sql(2, 2)),"new_big"]);
      $_->news_anounces_container = $select;
   }

   public function get_news_items($count){
      $_ = $this;
      return $_->news_anounces_container;
   }

   public function question_answers_(){
      $_ = $this;
      $obj = new stdClass();
      $obj->c_type = "small";
      $obj->sql = " and start_date <= ".time()." and end_date >= ".time()." order by rand() limit 1";
      $select = $_->select_(["*","question",$obj]);
      if(!$select)return false;
      $select['answers'] = $_->select_(["*","question_answers","new_big",["question_id",$select["id"]]]);
      $select['sum'] = array_sum(array_map(function($var){
          return $var['choosed'];
      }, $select['answers']));
      $select['already_answered'] = false;
      if(isset($_COOKIE['question_answers'])){
          $qw = json_decode($_COOKIE['question_answers']);
          if(isset($qw->{$select['id']}))
            $select['already_answered'] = true;
      }
      return $select;
   }

   public function get_banners($limit = 3,$category = 0){
      $_ = $this;
      $obj = new stdClass();
      $obj->c_type = "big";
      $obj->sql = " order by ind limit ".$limit;
      $select = $_->select_(["*","banners",$obj,["category",$category]]);
      return $select;
   }

   public function get_map_or_contact($table_name){
      $_ = $this;
      $select = $_->select_(["*",$table_name,"small"]);
      return $select;
   }

   public function trnslt($elem){
      $_ = $this;
      if($_->_lang == 'English')
        return $elem;
      return array_key_exists($elem, $_->language_config_)?$_->language_config_[$elem]:$elem;
   }

   public function get_slide(){
      $_ = $this;
      $select = [];
      $obj = new stdClass();
      $obj->c_type = "big";
      $obj->sql = " order by id desc limit 0,5";

      $sql = "
        select 
          t1.*,
          t2.url_".$_->_lang." as category_url_,
          t.menu_id
         from menu_body t 
         join body t1 on t1.id = t.body_id and slide_1 = 1
         join menu t2 on t2.id = t.menu_id
          where 1
          group by t1.id
          order by t1.id desc limit 0,5
      ";

      $select[] = $_->select_([$sql,"new_big"]);
      $select[] = $_->get_banners(5);
      //$_->pre($select);
      return $select;
   }

   public function help_page(){
      $_ = $this;
      $obj = new stdClass();
      $obj->c_type = "big";
      $obj->sql = " order by sort";
      $select = $_->select_(["*",'help_page',$obj]);
      return $select;

   }

   public function home_page_link(){
      $_ = $this;
      if($_->_lang == "Georgia")
        return "/";
      else 
        return "/en";
   }

   public function switch_to_languages(){
      $_ = $this;
      $new_url = $_->URL;
      if($new_url[1] == 'en'){
        $new_url[1] = $_->reversed_link;
        if(isset($new_url[2]))
          array_splice($new_url,2,1);
      }else{
        $new_url[1] = $_->reversed_link;
      }
      $new_url = join('/',$new_url);
      return $new_url;
   }

   public function reverse_link_for_lang(){
      $_ = $this; 
      return ($_->_lang == 'English')?"url_Georgia":"url_English";
   }

   public function log_method($obj){
      $_ = $this;
   }

   public function custom_get_images($body){
        $_ = $this;
        if(!$body)return '';
        $html = str_get_html($body);
        foreach(@$html->find('img') as $value){
            $src = $value->src;
            $value->src = $_->custom_get_images_src($src);
        }
        foreach($html->find('a') as $value){
            $src = $value->href;
            $value->href = $_->custom_get_images_src($src);
           
        }
        return $html;
    }

  public function custom_get_images_src($src){
      $_ = $this;
      if(!trim($src) || $src == '%20')return $src;
      if(substr($src, 0, 5) == 'link:')return str_replace('link:','',$src);
      $lnk = strpos($_SERVER['HTTP_HOST'],'new') !== false?'new.admin':'admin';

      if(strpos($_SERVER['HTTP_HOST'],'gov.ge') !== false){
       # echo 'src is:'.$src;

        @$src = explode('images', $src)[1];
        $src =  "https://".$_SERVER['HTTP_HOST'].'/admin/images'.$src;
        return $src;
      }
      if(strpos($src,'http://'.$_SERVER['HTTP_HOST']) === false && strpos($src,'admin.') !== false) {
           $src = explode('images', $src)[1];
           $src =  "https://".$lnk.".".str_replace('new.','',$_SERVER['HTTP_HOST']).'/images'.$src;
      }
      if(strpos($src,'../images/') !== false){
           $src = explode('images', $src)[1];
           $src =  "https://".$lnk.".".str_replace('new.','',$_SERVER['HTTP_HOST']).'/images'.$src;
      }
      
      return $src;
  }  

}


?>

Youez - 2016 - github.com/yon3zu
LinuXploit