!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/msdp.undp.org.ua/modules/photogallery/   drwxr-xr-x
Free 106.19 GB of 200.55 GB (52.95%)
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.46 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
class Photogallery
{
    var 
$UserMode   true;
    var 
$AdminMode  true;
    var 
$AdminAsynchMode true;
    var 
$SearchMode false;
    var 
$PanelMode  false;
    var 
$AlbumTable;
    var 
$PhotosTable;
    var 
$Directory;
    var 
$FilesDirectory;    
    var 
$ClassName 'Photogallery';
    function 
Photogallery()
    {
        
$this->FilesDirectory "data/photogallery/";
        
$this->Directory dirname(__FILE__);    
        
$this->AlbumTable = new AMTable2('AMCMS_photogallery_albums');
        
$this->AlbumTable->AddIndexField('album_id');
        
$this->AlbumTable->AddPositionField("album_position");    
        
$this->AlbumTable->Module($this->ClassName);

        
$this->PhotosTable = new AMTable2('AMCMS_photogallery_photos');
        
$this->PhotosTable->AddIndexField('photo_id');
        
$this->PhotosTable->Module($this->ClassName);
        
$this->PhotosTable->AddPositionField("photo_position");    
        
    }
    function 
User()
    {                
         global 
$ulang$ULANG;         
        if (isset(
$_GET['photogallery']) && isset($_GET['album_id']))
        {
            
$album $this->AlbumTable->GetRowById($_GET['album_id']);
            if (
$album == null)
            {
                
header("Location: /photogallery");
                return;            
            }
            
$rows $this->PhotosTable->GetRows("photo_position DESC""photo_album_id='{$_GET['album_id']}'");
            
$html  "<table align=\"center\" class=\"photos\">\n";
            
$cols 3;
            
$arr explode("x",GetParam("PhotogallerySmallPhotoSize"));
            if (isset(
$_SESSION['screen_width']) && $_SESSION['screen_width'] > 1024)
            {
                if (
GetParam("PhotogalleryCols") == "float")    
                    
$cols GetParam("PhotogalleryPicturesInColumn") + floor(($_SESSION['screen_width'] - 1024) / $arr[0]);
            }
            
$index 0;
            foreach(
$rows as $key => $value)
            {
                if (
$index == 0)
                   
$html .= "<tr align=\"center\" valign=\"top\">\n"
                
$html .= "<td ><table><tr><td align=\"center\" valign=\"center\" >";                
                
$html .= "<a class=\"fancybox\" rel=\"group\" title=\"".strip_tags($value['photo_caption_'.$ulang])."\" href=\"/data/photogallery/"."b".$value['photo_filename'].".jpg\" >";
                
$html .= "<img src=\"/data/photogallery/"."s".$value['photo_filename'].".jpg\" />";
                
$html .= "<br />";
                
$html .= $value['photo_title_'.$ulang];
                
$html .= "</a>";
                
$html .= "</td></tr></table></td>\n";
                
$index++;
                if (
$index == $cols)
                   
$html .= "</tr>\n"
                
$index $index $cols;                
            }
            for (
$i 0$i $cols $index$i++)
            {
                
$html .= "<td>";                
                
$html .= "&nbsp;";                
                
$html .= "</td>\n";                
            }
            if (
$cols 1!= $index)
              
$html .= "</tr>\n";
            
$html .= "</table>\n";
            
$html "<div class=\"gallery\">".$html."</div>";
            
$result['Title'] = $album['album_name_'.$ulang];
            
$result['Content'] = $html;
            
$navigator = new AMNavigator();
            
$navigator->AddLink(GetParam("ModulePhotogallery"$ulang), "/photogallery");
            
$navigator->AddLink($album['album_name_'.$ulang], "/photogallery/".$album['album_id']);
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;    
            return 
$result;            
        }
         if (isset(
$_GET['photogallery']))
        {        
            
$smarty GetUserSmarty($this->ClassName);
            
$rows $this->AlbumTable->GetRows("album_position DESC");
            
$photogallery_user_display_type GetParam('photogallery_user_display_type');
            
$smarty->assign("rows"$rows);                                
            
            
$navigator = new AMNavigator();
            
$navigator->AddLink(GetParam("ModulePhotogallery"$ulang), "/photogallery" );
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Title'] = GetParam("ModulePhotogallery"$ulang);
            
$result['Print'] = true;    
            
$result['Content'] = $smarty->fetch("album.tpl");
            return 
$result;
        }
    }    
    function 
Menu()
    {
        global 
$ALANG;
        return array(
                array(
'title' => $ALANG['PhotogalleryMenuAlbumAdd'],  'link' => '?mod='.$this->ClassName.'&album&add'),
                array(
'title' => $ALANG['PhotogalleryMenuAlbumList'], 'link' => '?mod='.$this->ClassName.'&album&list'),
                array(
'title' => $ALANG['PhotogalleryMenuPhotoAdd'],  'link' => '?mod='.$this->ClassName.'&photo&add'),
                array(
'title' => $ALANG['PhotogalleryMenuPhotoList'], 'link' => '?mod='.$this->ClassName.'&photo&list'),
                array(
'title' => $ALANG['PhotogalleryMenuPhotoOrder'], 'link' => '?mod='.$this->ClassName.'&photo&order'),
                array(
'title' => $ALANG['PhotogalleryMenuPhotoPacket'], 'link' => '?mod='.$this->ClassName.'&photo&packet'),
            );
    }
    function 
AdminAsynch()
    {
        if (isset(
$_REQUEST['mod']) && ($_REQUEST['mod'] == $this->ClassName))
        {                  
            if (isset(
$_REQUEST['photo']) && isset($_REQUEST['add']) && !empty($_FILES))
            {
                
$_POST['photo_date_of_creation'] = GetCurrentDateAndTime();
                
$_POST['photo_date_of_edition'] = GetCurrentDateAndTime();
                
$extension "jpg";
                
$sourceFile $_FILES['Filedata']['tmp_name'];
                
$filename uniqid("");
                
$destantionFileI $this->FilesDirectory."i".$filename.".".$extension;
                
$destantionFileB $this->FilesDirectory."b".$filename.".".$extension;
                
$destantionFileS $this->FilesDirectory."s".$filename.".".$extension;
                
$sizeSmall explode("x"GetParam("PhotogallerySmallPhotoSize"));
                
$sizeBig   explode("x"GetParam("PhotogalleryBigPhotoSize"));                        
                
ImageResize($sourceFile$destantionFileI80800xFFFFFF90);
                
ImageResize($sourceFile$destantionFileS$sizeSmall[0], $sizeSmall[1], 0xFFFFFF75);
                
ImageResize($sourceFile$destantionFileB$sizeBig[0], $sizeBig[1], 0xFFFFFF75);                                    
                
$_POST['photo_filename'] = $filename;
                
$_POST['photo_album_id'] = $_POST['album_id'];
                
$id $this->PhotosTable->Insert($_POST);
                
$this->UpdateAlbumsInfo();
                echo 
'1';                    
                die;                    
            }    
        }        
        if (
$_POST['oper'] == 'cover')
        {            
            
$photo $this->PhotosTable->GetRowById($_POST['id']);
            
$row['album_cover_filename'] = $photo['photo_filename'];
            
$this->AlbumTable->Update($row$photo['photo_album_id']);
            
$res["status"] = "ok";
            echo 
json_encode($res);
            die;
        }
        
$this->AlbumTable->Run($_POST);
        
$this->PhotosTable->Run($_POST);
        
$this->UpdateAlbumsInfo();
    }
    function 
Admin()
    {
            global 
$ALANG$alang;
            
$smarty GetAdminSmarty($this->ClassName);
            if (isset(
$_GET['album']) && isset($_GET['list']))
            {
                
$rows $this->AlbumTable->GetRows("album_position DESC");
                
$smarty->assign("rows"$rows);
                
$html $smarty->Fetch('photoalbumblock.tpl');
                
$result['Title']     = $ALANG['PhotogalleryAlbumList'];
                
$result['Content']  = $html;
                return 
$result;
            }            
            if (isset(
$_GET['edit']) && isset($_GET['album_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    
$_POST['album_date_of_edition']  = GetCurrentDateAndTime();
                    
$id $_GET['album_id'];
                    
$this->AlbumTable->Update($_POST$id);
                    
header("Location: ?mod=".$this->ClassName."&PhotoalbumsList");
                    die;
                }
                
$id $_GET['album_id'];
                
$row $this->AlbumTable->GetRowById($id);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');
                  
$result['Title']     = $ALANG['PhotoalbumEdition'];
                
$result['Content']     = $smarty->fetch('photoalbum.tpl');
                  return 
$result;                    
            }
            if (isset(
$_GET['photo']) && isset($_GET['packet']))
            {                
                  
$albums $this->AlbumTable->GetRows("album_position DESC");
                  
$photo_album_values  = array();
                  
$photo_album_captions = array();
                  foreach(
$albums as $key => $value)
                  {
                      
$photo_album_values[] = $value['album_id'];
                      
$photo_album_captions[] = $value['album_name_'.GetParam("DefaultLanguage")];
                  }
                  
$smarty->assign('sid'session_id());                
                  
$smarty->assign('photo_album_values'$photo_album_values);
                  
$smarty->assign('photo_album_captions'$photo_album_captions);
                
$smarty->assign('photo_album_id'$_GET['album_id']);                                 
                
$result['Title']     = $ALANG['PhotogalleryPhotoPacket'];
                
$result['Content']  = $smarty->Fetch('addmanyphotos.tpl');
                return 
$result;            
            }
            
            if (isset(
$_GET['photo']) && isset($_GET['order']))
            {
                
$albums $this->AlbumTable->GetRows("album_position DESC");                
                if (!isset(
$_REQUEST['album_id']))
                    
$album_id $albums[0]['album_id'];
                else
                    
$album_id $_REQUEST['album_id'];
                
$photos $this->PhotosTable->GetRows("photo_position DESC""photo_album_id='{$album_id}'");
                
$smarty->assign('albums'$albums);
                
$smarty->assign('photos'$photos);
                
$result['Title']     = $ALANG['PhotogalleryPhotoOrder'];
                
$result['Content']  = $html.$smarty->Fetch('photosorder.tpl');;
                return 
$result;
            }
            if (isset(
$_GET['photo']) && isset($_GET['list']))
            {
                
$albums $this->AlbumTable->GetRows("album_position DESC");
                if (!isset(
$_REQUEST['album_id']))
                    
$album_id $albums[0]['album_id'];
                else
                    
$album_id $_REQUEST['album_id'];
                
$photos $this->PhotosTable->GetRows("photo_position DESC""photo_album_id='{$album_id}'");
                
$smarty->assign('albums'$albums);
                
$smarty->assign('photos'$photos);
                if (isset(
$album_id))
                {
                    
$html $smarty->Fetch('photoblock.tpl');
                }
                
$result['Title']     = $ALANG['PhotogalleryPhotoList'];
                
$result['Content']     = $html;
                return 
$result;
            }            
    
            if (isset(
$_GET['album']) && isset($_GET['add']))
            {
                if (isset(
$_POST['add']))
                {
                    
$_POST['album_date_of_creation'] = GetCurrentDateAndTime();
                    
$_POST['album_date_of_edition']  = GetCurrentDateAndTime();
                    
$id $this->AlbumTable->Insert($_POST);
                    
$this->UpdateAlbumsInfo();
                    
header("Location: ?mod=".$this->ClassName."&album&list");
                }
                  foreach(
$_POST as $key => $value)
                      
$smarty->assign($key$value);
                  
$smarty->assign('oper''add');
                  
$result['Title']     = $ALANG['PhotogalleryAlbumAdd'];
                  
$result['Content']     = $smarty->fetch('photoalbum.tpl');
                return 
$result;
            }
            if (isset(
$_GET['photo']) && isset($_GET['add']))
            {                
                if (isset(
$_POST['add']))
                {
                    
$_POST['photo_date_of_creation'] = GetCurrentDateAndTime();
                    
$extension "jpg";
                    
$sourceFile $_FILES['photo_filename']['tmp_name'];
                    
$filename uniqid("");
                    
$destantionFileI $this->FilesDirectory."i".$filename.".".$extension;
                    
$destantionFileB $this->FilesDirectory."b".$filename.".".$extension;
                    
$destantionFileS $this->FilesDirectory."s".$filename.".".$extension;
                    
$sizeSmall explode("x"GetParam("PhotogallerySmallPhotoSize"));
                    
$sizeBig   explode("x"GetParam("PhotogalleryBigPhotoSize"));                        
                    
ImageResize($sourceFile$destantionFileI80800xFFFFFF90);
                    
ImageResize($sourceFile$destantionFileS$sizeSmall[0], $sizeSmall[1], 0xFFFFFF75);
                    
ImageResize($sourceFile$destantionFileB$sizeBig[0], $sizeBig[1], 0xFFFFFF75);                                
                    
$_POST['photo_filename'] = $filename;
                    
$id $this->PhotosTable->Insert($_POST);
                    
$this->UpdateAlbumsInfo();
                    
header("Location: ?mod=".$this->ClassName."&photo&add&album_id=".$_POST['photo_album_id'].'&ok');
                }
                  foreach(
$_POST as $key => $value)
                      
$smarty->assign($key$value);
                  
$smarty->assign('oper''add');
                  
$albums $this->AlbumTable->GetRows("album_position DESC");
                  
$photo_album_values  = array();
                  
$photo_album_captions = array();
                  foreach(
$albums as $key => $value)
                  {
                      
$photo_album_values[] = $value['album_id'];
                      
$photo_album_captions[] = $value['album_name_'.GetParam("DefaultLanguage")];
                  }
                  
$smarty->assign('photo_album_values'$photo_album_values);
                  
$smarty->assign('photo_album_captions'$photo_album_captions);
                
$smarty->assign('photo_album_id'$_GET['album_id']);                 
                  if (isset(
$_GET['ok']))
                    
$smarty->assign("message"$ALANG['PictureAddOK']);                      
                  if (isset(
$_GET['fail']))
                    
$smarty->assign("message"$ALANG['PictureAddFail']);                      
                  
$result['Title']     = $ALANG['PhotogalleryPhotoAdd'];
                  
$result['Content']     = $smarty->fetch('photo.tpl');
                return 
$result;
            }
            if (isset(
$_GET['edit']) && isset($_GET['photo_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    
$row $this->PhotosTable->GetRowById($_GET['photo_id']);
                    if (
strlen($_FILES['photo_filename']['tmp_name']) > 0)
                    {
                        @
unlink($this->FilesDirectory."i".$row['photo_filename'].".jpg");
                        @
unlink($this->FilesDirectory."b".$row['photo_filename'].".jpg");
                        @
unlink($this->FilesDirectory."s".$row['photo_filename'].".jpg");
                        
$extension "jpg";
                        
$sourceFile $_FILES['photo_filename']['tmp_name'];
                        
$filename uniqid("");
                        
$destantionFileI $this->FilesDirectory."i".$filename.".".$extension;
                        
$destantionFileB $this->FilesDirectory."b".$filename.".".$extension;
                        
$destantionFileS $this->FilesDirectory."s".$filename.".".$extension;
                        
$sizeSmall explode("x"GetParam("PhotogallerySmallPhotoSize"));
                        
$sizeBig   explode("x"GetParam("PhotogalleryBigPhotoSize"));                        
                        
ImageResize($sourceFile$destantionFileI80800xFFFFFF90);
                        
ImageResize($sourceFile$destantionFileS$sizeSmall[0], $sizeSmall[1], 0xFFFFFF75);
                        
ImageResize($sourceFile$destantionFileB$sizeBig[0], $sizeBig[1], 0xFFFFFF75);                                    
                        
$_POST['photo_filename'] = $filename;
                    }
                    
$this->PhotosTable->Update($_POST$_GET['photo_id']);
                    
$this->UpdateAlbumsInfo();
                    
header("Location: admin.php?mod=Photogallery&photo&list&album_id=".$row['photo_album_id']);
                }
                
$row $this->PhotosTable->GetRowById($_GET['photo_id']);
                
$albums $this->AlbumTable->GetRows("album_position DESC");
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');
                  
$photo_album_values  = array();
                  
$photo_album_captions = array();
                  foreach(
$albums as $key => $value)
                  {
                      
$photo_album_values[] = $value['album_id'];
                      
$photo_album_captions[] = $value['album_name_'.$alang];
                  }
                  
$smarty->assign('photo_album_values'$photo_album_values);
                  
$smarty->assign('photo_album_captions'$photo_album_captions);
                  
$result['Title']     = $ALANG['PhotogalleryPhotoEdit'];
                
$result['Content']     = $smarty->fetch('photo.tpl');
                  return 
$result;                    
            }
    }    
    function 
UpdateAlbumsInfo()
    {
        
$res1 mysql_query("SELECT album_id FROM AMCMS_photogallery_albums");
        while (
$row1 mysql_fetch_array($res1))
        {
            
$res2 mysql_query("SELECT COUNT(*) FROM AMCMS_photogallery_photos WHERE photo_album_id = '{$row1['album_id']}'");
            
$row2 mysql_fetch_array($res2);
            
mysql_query("UPDATE AMCMS_photogallery_albums SET album_count_of_photos = '{$row2['COUNT(*)']}' WHERE album_id = '{$row1['album_id']}'");
        }
    }    
    function 
Panel()
    {
        global 
$ULANG$ulang;
        
$res mysql_query("SELECT * FROM AMCMS_photos WHERE photo_album_id = 0 ORDER BY RAND()");
        if (
mysql_num_rows($res) == 0)
          return;
          
$html "<div align=\"center\" id=\"MySlideshow\">";
        while( (
$row mysql_fetch_array($res)) != 0)
        {
            
$html .= "<img src=\"/data/photogallery/b".$row['photo_filename'].".".$row['photo_filetype']."\" />";
        }
        
$html .= "</div>";
//        $html = "<div align=\"center\" id=\"MySlideshow\">"."<a href=\"/photogallery/{$row['photo_album_id']}\"><img src=\"/data/photogallery/b".$row['photo_filename'].".".$row['photo_filetype']."\" /></a>";
        
$result['Photogallery'] = array('panelName' => GetParam('RandomPhotoPanelName_'.$ulang),
                     
'panelHtml' => $html.strip_tags($row['photo_caption_'.$ulang])."</div>",
                     
'PanelLink' => MOD_REWRITE "/photogallery" "?photogallery",
                     
'PanelLinkTitle' => $ULANG['Photogallery'],
                     
'PanelLinkClass' => "LinkAll");
        return 
$result;
    }
    


$Modules [] = new Photogallery();
?>

:: 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.0095 ]--