コード例 #1
0
ファイル: installer.class.php プロジェクト: lev1976g/core
 public function __construct()
 {
     header('Cache-Control: no-cache');
     header('Pragma: no-cache');
     session_start();
     $this->_oTpl = Phpfox_Template::instance();
     $this->_oReq = Phpfox_Request::instance();
     $this->_oUrl = Phpfox_Url::instance();
     $this->_sTempDir = Phpfox_File::instance()->getTempDir();
     $this->_sPage = $this->_oReq->get('page');
     $this->_sUrl = $this->_oReq->get('req1') == 'upgrade' ? 'upgrade' : 'install';
     self::$_sSessionId = $this->_oReq->get('sessionid') ? $this->_oReq->get('sessionid') : uniqid();
     if (defined('PHPFOX_IS_UPGRADE')) {
         $this->_oTpl->assign('bIsUprade', true);
         $this->_bUpgrade = true;
         if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php')) {
             $_CONF = [];
             require_once PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php';
             $this->_aOldConfig = $_CONF;
         }
     }
     if (!Phpfox_File::instance()->isWritable($this->_sTempDir)) {
         if (PHPFOX_SAFE_MODE) {
             $this->_sTempDir = PHPFOX_DIR_FILE . 'log' . PHPFOX_DS;
             if (!Phpfox_File::instance()->isWritable($this->_sTempDir)) {
                 exit('Unable to write to temporary folder: ' . $this->_sTempDir);
             }
         } else {
             exit('Unable to write to temporary folder: ' . $this->_sTempDir);
         }
     }
     $this->_sSessionFile = $this->_sTempDir . 'installer_' . ($this->_bUpgrade ? 'upgrade_' : '') . '_' . self::$_sSessionId . '_' . 'phpfox.log';
     $this->_hFile = fopen($this->_sSessionFile, 'a');
     if ($this->_sUrl == 'install' && $this->_oReq->get('req2') == '') {
         if (file_exists(PHPFOX_DIR_SETTING . 'server.sett.php')) {
             require PHPFOX_DIR_SETTING . 'server.sett.php';
             if (isset($_CONF['core.is_installed']) && $_CONF['core.is_installed'] === true) {
                 $this->_oUrl->forward('../install/index.php?' . PHPFOX_GET_METHOD . '=/upgrade/');
             }
         }
         if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php')) {
             $this->_oUrl->forward('../install/index.php?' . PHPFOX_GET_METHOD . '=/upgrade/');
         }
     }
     // Define some needed params
     Phpfox::getLib('setting')->setParam(array('core.path' => self::getHostPath(), 'core.url_static_script' => self::getHostPath() . 'static/jscript/', 'core.url_static_css' => self::getHostPath() . 'static/style/', 'core.url_static_image' => self::getHostPath() . 'static/image/', 'sCookiePath' => '/', 'sCookieDomain' => '', 'sWysiwyg' => false, 'bAllowHtml' => false, 'core.url_rewrite' => '2'));
 }
コード例 #2
0
 public function __construct()
 {
     header('Cache-Control: no-cache');
     header('Pragma: no-cache');
     session_start();
     $this->_oTpl = Phpfox_Template::instance();
     $this->_oReq = Phpfox_Request::instance();
     $this->_oUrl = Phpfox_Url::instance();
     $this->_sTempDir = Phpfox_File::instance()->getTempDir();
     $this->_sPage = $this->_oReq->get('page');
     $this->_sUrl = $this->_oReq->get('req1') == 'upgrade' ? 'upgrade' : 'install';
     self::$_sSessionId = $this->_oReq->get('sessionid') ? $this->_oReq->get('sessionid') : uniqid();
     if (defined('PHPFOX_IS_UPGRADE')) {
         $this->_oTpl->assign('bIsUprade', true);
         $this->_bUpgrade = true;
         if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php')) {
             $_CONF = [];
             require_once PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php';
             $this->_aOldConfig = $_CONF;
         }
     }
     if (!Phpfox_File::instance()->isWritable($this->_sTempDir)) {
         if (PHPFOX_SAFE_MODE) {
             $this->_sTempDir = PHPFOX_DIR_FILE . 'log' . PHPFOX_DS;
             if (!Phpfox_File::instance()->isWritable($this->_sTempDir)) {
                 exit('Unable to write to temporary folder: ' . $this->_sTempDir);
             }
         } else {
             exit('Unable to write to temporary folder: ' . $this->_sTempDir);
         }
     }
     $this->_sSessionFile = $this->_sTempDir . 'installer_' . ($this->_bUpgrade ? 'upgrade_' : '') . '_' . self::$_sSessionId . '_' . 'phpfox.log';
     $this->_hFile = fopen($this->_sSessionFile, 'a');
     if ($this->_sUrl == 'install' && $this->_oReq->get('req2') == '') {
         if (file_exists(PHPFOX_DIR_SETTING . 'server.sett.php')) {
             require PHPFOX_DIR_SETTING . 'server.sett.php';
             if (isset($_CONF['core.is_installed']) && $_CONF['core.is_installed'] === true) {
                 $this->_oUrl->forward('../install/index.php?' . PHPFOX_GET_METHOD . '=/upgrade/');
             }
         }
         if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'server.sett.php')) {
             $this->_oUrl->forward('../install/index.php?' . PHPFOX_GET_METHOD . '=/upgrade/');
         }
     }
     // Define some needed params
     Phpfox::getLib('setting')->setParam(array('core.path' => self::getHostPath(), 'core.url_static_script' => self::getHostPath() . 'static/jscript/', 'core.url_static_css' => self::getHostPath() . 'static/style/', 'core.url_static_image' => self::getHostPath() . 'static/image/', 'sCookiePath' => '/', 'sCookieDomain' => '', 'sWysiwyg' => false, 'bAllowHtml' => false, 'core.url_rewrite' => '2'));
     /*
     $sLanguageFile = PHPFOX_DIR_XML . 'installer' . PHPFOX_XML_SUFFIX;
     
     if (!file_exists($sLanguageFile))
     {
     	Phpfox_Error::trigger('Unable to load locale language package: ' . $sLanguageFile, E_USER_ERROR);
     }
     
     // Cache language file
     $bCache = false;
     $sCacheFile = PHPFOX_DIR_CACHE . 'installer_language.php';
     if (Phpfox_File::instance()->isWritable(PHPFOX_DIR_CACHE) && file_exists($sCacheFile))
     {
     	$bCache = true;	
     }
     		
     if ($bCache === false)
     {
     	$aPhrases = Phpfox::getLib('xml.parser')->parse($sLanguageFile);
     	foreach ($aPhrases['phrases']['phrase'] as $aPhrase)
     	{
     		self::$_aPhrases[$aPhrase['var_name']] = $aPhrase['value'];
     	}
     	
     	if (Phpfox_File::instance()->isWritable(PHPFOX_DIR_CACHE))
     	{
     		$sData = '<?php' . "\n";
     		$sData .= 'self::$_aPhrases = ';
     		$sData .= var_export(self::$_aPhrases, true);
     		$sData .= ";\n" . '?>';
     		Phpfox_File::instance()->writeToCache('installer_language.php', $sData);
     	}
     }
     else 
     {
     	require_once($sCacheFile);
     }
     */
 }