HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //opt/alt/php54/usr/share/pear/RVSeagullMod/modules/photogallery/classes/PhotogalleryMgr.php
<?php
##copyright##

/**
 * Photogallery Manager
 *
 * @package forums
 * @author  Pairote Manunphol <pairote@rvglobalsoft.com>
 */


class PhotogalleryMgr extends SGL_Manager 
{
    function  PhotogalleryMgr()
    {
       SGL::logMessage(null, PEAR_LOG_DEBUG);
        parent::SGL_Manager();
        
        $this->pageTitle        = 'photogallery';
        $this->template         = 'photogallery.html';
        
        $this->_aActionsMapping =  array(
            'view'   => array('view') 
        );   
    }
    
    function validate($req, &$input)
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        $this->validated    = true;
        $input->error       = array();
        $input->pageTitle   = $this->pageTitle;
        $input->template    = $this->template;
        $input->gallery     = true;
        $input->action      = ($req->get('action')) ? $req->get('action') : 'view';
        $input->galleryId   = ($req->get('galleryId')) ? $req->get('galleryId') : 'view';
 		$input->img   = ($req->get('img')) ? $req->get('img') : '';
        $input->pageId = str_replace('gallery_','',$input->galleryId);
        $input->masterTemplate = (is_file(SGL_THEME_DIR . '/rvtheme/default/' . $input->pageId . '_master.html'))
                                    ? $input->pageId . '_master.html' 
                                    : 'master.html';
        $input->fileHeader = 'headerPhotogallery_' . $input->pageId . '-utf8.html';
        $input->fileFooter = 'footerPhotogallery_' . $input->pageId . '-utf8.html';
        $this->publishPath = RVSGLWrapper::getWebRoot(0);
 
        $input->currentPage = preg_replace('/\'/','\\\'', RVSGLWrapper::getCurrentUrl(0));
        $input->aConf = $this->_loadGalleryConf(RvsLibs_File::buildPath(array($this->publishPath, 'scripts', 'PhotoGallery', $input->galleryId, 'setting.ini.php')));
        if (count($input->aConf) == 0) {
        	SGL::raiseMsg('Cannot load photo gallery configuration');
        }
        
        $fileAutoConf = SGL_VAR_DIR . '/listcomponentmemberpage.ini.php';
        if (is_file($fileAutoConf) == true) {
            $aAutoConf = RvsLibs_Config::parse_ini_file($fileAutoConf, true);
        }
        //is member by page
        $isMemberPage = (isset($aAutoConf['isMember_PhotoGallery_' . $input->pageId])) 
                        ? $aAutoConf['isMember_PhotoGallery_' . $input->pageId] : '0';
        //is member redirect to memberpage
        if ($isMemberPage == '1') {
        	if (!SGL_Session::getUid()) {
        	 	 $aUrl = array(
                    'managerName' => 'memberpage',
                    'moduleName'  => 'default',
                    'page'     => 'PhotoGallery',
        	 	    'pageId'     => $input->pageId
                     );
                    SGL_HTTP::redirect($aUrl);
        	 }
        	 
        }

    }
    
    function _cmd_view($input, &$output)
    {
       
    }

    function display(&$output)
    {
        $output->addJavascriptFile('js/photogallery/galleria.js');
        $output->addJavascriptFile('js/photogallery/plugins/galleria.rvsbuildin.js');
        $output->addJavascriptFile('js/jquery-ui/ui/jquery.pagination.js');
        $output->addJavascriptFile('js/jquery.url.js');
    }
  
    function _loadGalleryConf($fileConf)
    {
        $aConf = array();
        if (is_file($fileConf) === true) {
            $aConf = RvsLibs_Config::parse_ini_file($fileConf, true);
        }
        return $this->_setGalleryConf($aConf);
    }
    
    function _setGalleryConf(&$aConf)
    {
    	$slideDelay = (isset($aConf['slideDelay'])) ? $aConf['slideDelay'] : '2sec';
    	switch ($slideDelay) {
    		case '2sec' : 
    			         $aConf['slideDelay'] = '2000';
    			         break;
    		case '3sec' : 
    			         $aConf['slideDelay'] = '3000';
    			         break;
    		case '5sec' : 
    			         $aConf['slideDelay'] = '5000';
    			         break;
    		case '7sec':
    			         $aConf['slideDelay'] = '7000';
    		             break;
    	}
    	//default 50
    	$thumbnailPerPage = (isset($aConf['viewImageThumbnailPerPage']))
    	                       ? $aConf['viewImageThumbnailPerPage']
    	                       : 50;
    	//defualt 140
    	$imagesSize = (isset($aConf['thumbnailImagesSize'])) ? $aConf['thumbnailImagesSize'] : 140;
    	                  
    	$aConf['thumbnailImagesSize'] = (isset($aConf['thumbnailImagesSize']) && $aConf['thumbnailImagesSize'] < 50) ? 120 : $imagesSize;
    	$aConf['slideEffect'] = (isset($aConf['slideEffect'])) ? $aConf['slideEffect'] : 'flash';
    	$aConf['slideDelay'] = (isset($aConf['slideDelay'])) ? $aConf['slideDelay'] : '3000';
    	$aConf['viewImageThumbnailPerPage'] = (isset($aConf['viewImageThumbnailPerPage']) && $aConf['viewImageThumbnailPerPage'] < 40) 
                                                                                   ? 40 
                                                                                   : $thumbnailPerPage;
    	$aConf['autoPlay'] = (isset($aConf['autoPlay']) && ($aConf['autoPlay'] == 'false' || $aConf['autoPlay'] == '0')) ? 'false' : 'true';
    	$aConf['facebook'] = (isset($aConf['facebook']) && ($aConf['facebook'] == 'false' || $aConf['facebook'] == '0')) ? 'false' : 'true';
    	$aConf['twitter'] = (isset($aConf['twitter']) && ($aConf['twitter'] == 'false' || $aConf['twitter'] == '0')) ? 'false' : 'true';
    	$aConf['myspace'] = (isset($aConf['myspace']) && ($aConf['myspace'] == 'false' || $aConf['myspace'] == '0')) ? 'false' : 'true';
    	$aConf['email'] = (isset($aConf['email']) && ($aConf['email'] == 'false' || $aConf['email'] == '0')) ? 'false' : 'true';
    	$aConf['viewImageFitSize'] = (isset($aConf['viewImageFitSize']) && ($aConf['viewImageFitSize'] == 'true' || $aConf['viewImageFitSize'] == '1')) ? 'false' : 'true';
        if (isset($aConf['viewImageFullSize'])) {
    		$aConf['viewImageFullSize'] = ($aConf['viewImageFullSize'] == 'true' || $aConf['viewImageFullSize'] == '1') ? 'true' : 'false';
    	} else {
    		//default
    		$aConf['viewImageFullSize'] = 'true';
    	}
    	
    	$aConf['showPhotoDescrition'] = (isset($aConf['showPhotoDescrition']) && ($aConf['showPhotoDescrition'] == 'false' || $aConf['showPhotoDescrition'] == '0')) 
    	                                                               ? 'false' : 'true';
    	$aConf['showAlbumDescription'] = (isset($aConf['showAlbumDescription']) && ($aConf['showAlbumDescription'] == 'false' || $aConf['showAlbumDescription'] == '0')) 
    	                                                               ? 'false' : 'true';
    	$aConf['zoomLevel'] = (isset($aConf['zoomLevel']) && $aConf['zoomLevel'] != '') ? $aConf['zoomLevel'] : '4';
    	
    	$aConf['transitionSpeed'] = (isset($aConf['transitionSpeed'])) ? $aConf['transitionSpeed'] : '2';
    	switch ($aConf['transitionSpeed']) {
    		case '1' : $aConf['transitionSpeed'] = '0.50'; 	break;
    		case '2' : $aConf['transitionSpeed'] = '0.75'; 	break;
    		case '3' : $aConf['transitionSpeed'] = '1';     break;
    		case '4' : $aConf['transitionSpeed'] = '1.25'; 	break;
    		case '5' : $aConf['transitionSpeed'] = '1.50'; 	break;
    		case '6' : $aConf['transitionSpeed'] = '1.75'; 	break;
    		case '7' : $aConf['transitionSpeed'] = '2';     break;
    		case '8' : $aConf['transitionSpeed'] = '2.50'; 	break;
    		case '9' : $aConf['transitionSpeed'] = '3';     break;
    		default : $aConf['transitionSpeed'] = '0.75';  	break;
    	}
                                                            
    	return $aConf;
    }
    
}
?>