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/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/modules/default/classes/DefaultMgr.php
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Copyright (c) 2008, Demian Turner                                         |
// | All rights reserved.                                                      |
// |                                                                           |
// | Redistribution and use in source and binary forms, with or without        |
// | modification, are permitted provided that the following conditions        |
// | are met:                                                                  |
// |                                                                           |
// | o Redistributions of source code must retain the above copyright          |
// |   notice, this list of conditions and the following disclaimer.           |
// | o Redistributions in binary form must reproduce the above copyright       |
// |   notice, this list of conditions and the following disclaimer in the     |
// |   documentation and/or other materials provided with the distribution.    |
// | o The names of the authors may not be used to endorse or promote          |
// |   products derived from this software without specific prior written      |
// |   permission.                                                             |
// |                                                                           |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     |
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     |
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          |
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE     |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.      |
// |                                                                           |
// +---------------------------------------------------------------------------+
// | Seagull 0.6                                                               |
// +---------------------------------------------------------------------------+
// | DefaultMgr.php                                                            |
// +---------------------------------------------------------------------------+
// | Author:   Demian Turner <demian@phpkitchen.com>                           |
// +---------------------------------------------------------------------------+
// $Id: DefaultMgr.php,v 1.12 2005/04/21 06:34:39 demian Exp $

/**
 * Sets up objects for home page.
 *
 * @package default
 * @author  Demian Turner <demian@phpkitchen.com>
 * @version $Revision: 1.12 $
 */
class DefaultMgr extends SGL_Manager
{
    function DefaultMgr()
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        parent::SGL_Manager();

        $this->pageTitle    = 'Home';
        $this->template     = 'home.html';

        $this->_aActionsMapping =  array(
            'list'   => array('list'),
        );
    }

    function validate($req, &$input)
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
      //  require_once(SGL_MOD_DIR . '/../lib/RVSGL/DaoFactory.php');

       // $aMethods = DaoFactory::getClassMethods();
       // echo "<pre>";
       // print_r($aMethods);exit;
        $this->validated    = true;
        $input->masterTemplate = $this->masterTemplate;
        $input->template    = $this->template;
        $input->pageTitle   = $this->pageTitle;

        // congratulate user on successful install their first visit
        $input->welcome     = $req->get('welcome');
       /* if ($input->welcome) {
            SGL::raiseMsg('Congratulations, install successful!', false, SGL_MESSAGE_INFO);
        }*/

        $input->action      = ($req->get('action')) ? $req->get('action') : 'list';
    }

    function _cmd_list(&$input, &$output)
    {
        SGL::logMessage(null, PEAR_LOG_DEBUG);
        $output->isHome = true;
      /*  $tryoutConfPath = SGL_config::get('path.webRoot') . '/tryout/tryout_config.ini.php';
        if (is_file($tryoutConfPath)) {
        	$output->randomTemplateData = $this->getRandomTemplateData();
        }*/
    }
    
    function getRandomTemplateData()
    { 
    	require_once(SGL_MOD_DIR . '/../lib/RVSGL/SitebuilderDao/DbWrapper.php');
    	require_once(SGL_MOD_DIR . '/../lib/RVSGL/SitebuilderDao/TryoutDao.php');
    	require_once(SGL_MOD_DIR . '/../lib/RVSGL/SitebuilderDao/TemplateDao.php');
    	require_once(SGL_MOD_DIR . '/../lib/RVSGL/SitebuilderDao/UsrDao.php');
    	require_once(SGL_MOD_DIR . '/../lib/RVSGL/DaoFactory.php');
        
        $oSitebuilder = TryoutDao::singleton($autoload = false);
        $aSitebuilderConfig = $oSitebuilder->getSitebuilderConfig();
        $dbh = $oSitebuilder->rvsConnectDb();
        $oSitebuilder->registRvsConf($aSitebuilderConfig, $dbh);
        // Initialise Db DataObject
        $oSitebuilder->rvsInitialiseDbDataObject();
        $aData = $oSitebuilder->findTemplateItemFolderAndTypePreviewByRandam('getRow');
        $randomTemplateData['template_url'] = $this->getFileSystemPath();
        $randomTemplateData['template_item_folder'] = $aData['template_item_folder'];
        $randomTemplateData['template_type_s_preview'] = $aData['template_type_s_preview'];
        return $randomTemplateData;

    }
    
    function getFileSystemPath()
    {
    	SGL::logMessage(null, PEAR_LOG_DEBUG);

    	if (preg_match('/^192\.168/i',$_SERVER['HTTP_HOST'])) {
    		$pathTemplateUrl = SGL_BASE_URL . '/../../rvsitebuilder/template';
    	}
    	else {
    		$pathTemplateUrl = SGL_BASE_URL . '/tryout/template';
    	}
    	return $pathTemplateUrl;
    }
}
?>