Пример #1
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'));
 }
Пример #2
0
	/**
	 * Make an internal link.
	 *
	 * @param string $sUrl Internal link.
	 * @param array $aParams ARRAY of params to include in the link.
	 * @param bool $bFullPath Not using this argument any longer.
	 * @return string Full URL.
	 */
	public function makeUrl($sUrl, $aParams = array(), $bFullPath = false)
	{		
		if (defined('PHPFOX_INSTALLER'))
		{
			if (is_array($aParams))
			{
				$aParams['sessionid'] = Phpfox_Installer::getSessionId();
			}
			else 
			{
				$aParams = array($aParams, 'sessionid' => Phpfox_Installer::getSessionId());	
			}
		}
		
		if (preg_match('/http:\/\//i', $sUrl))
		{
		    return $sUrl;
		}		
		
		if ($sUrl == 'current')
		{
			$sUrl = '';			
			foreach ($this->_aParams as $sKey => $sValue)
			{
				if (substr($sKey, 0, 3) == 'req')
				{
					$sUrl .= $sValue . '.';
				}
				else 
				{					
					$sUrl .= $sKey . '_' . $sValue . '.';
				}
			}			
		}
		
		(($sPlugin = Phpfox_Plugin::get('check_url_is_array')) ? eval($sPlugin) : false);
		
		// Make it an array if its not an array already (Used as shortcut)
		if (!is_array($aParams))
		{
			$aParams = array($aParams);
		}
		
		if (!defined('PHPFOX_INSTALLER'))
		{
			if ($sUrl == 'profile')
			{
				if (empty($aParams[0]) && isset($aParams[1]) && $aParams[1] > 0)
				{
					$sUrl = '';
					$sUrl .= 'pages';					
				}
				else 
				{
					$sUrl = '';
					$sUrl .= (isset($aParams[0]) ? $aParams[0] : Phpfox::getUserBy('user_name'));
	
					unset($aParams[0]);					
				}				
			}		
			else 
			{
				if (Phpfox::isUser() && preg_match("/profile/i", $sUrl))
				{
					$aParts = explode('.', $sUrl);
					if (isset($aParts[0]) && $aParts[0] == 'profile')
					{
						unset($aParts[0]);
						if (isset($aParts[1]) && $aParts[1] == 'my')
						{
							unset($aParts[1]);	
						}
						$sUrl = '';
						/*
						if (Phpfox::getParam('user.profile_use_id'))
						{
							$sUrl .= 'profile.';
						}
						*/				
						$sUrl .= (isset($aParams[0]) ? $aParams[0] : Phpfox::getUserBy('user_name'));
						$sUrl .= '.' . implode('.', $aParts);						
					}
				}			
			}
			
			if ($sUrl == 'profile' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE)
			{
				$sUrl = '';
			}		
		}
		
		$sUrl = trim($sUrl, '.');		
		$sUrls = '';
		
		if ($sUrl == 'phpfox_full_site')
		{
			$sUrl = '';
		}
		else 
		{
			if ($this->isMobile())
			{
				$sUrl = 'mobile.' . $sUrl;
			}					
		}		
		
		switch (Phpfox::getParam('core.url_rewrite'))
		{
			// www.site.com/foo/bar/
			case 1:
				$aParts = explode('.', $sUrl);				
				if ($bFullPath)
				{
					$sUrls .= Phpfox::getParam('core.path');
				}
				$sUrls .= Phpfox::getParam('core.path');				
				$sUrls .= $this->_makeUrl($aParts, $aParams);	
				
							
				break;
			// www.site.com/index.php?foo=bar
			case 2:
				$aParts = explode('.', $sUrl);
				if ($bFullPath)
				{
					$sUrls .= Phpfox::getParam('core.path');
				}				
				$sUrls .= Phpfox::getParam('core.path') . PHPFOX_INDEX_FILE . '?' . PHPFOX_GET_METHOD . '=/';
				$sUrls .= $this->_makeUrl($aParts, $aParams);		
				break;
			// foo.site.com/bar/
			case 3:				
				if (empty($sUrl))
				{
					$sUrl = 'www';
				}
				
				$aParts = explode('.', $sUrl);
				if (isset($this->aRewrite[$aParts[0]]) && !is_array($this->aRewrite[$aParts[0]]))
				{
					$aParts[0] = $this->aRewrite[$aParts[0]];
				}				
				$sUrls = preg_replace("/http:\/\/(.*?)\.(.*?)/i", "http://{$aParts[0]}.$2", Phpfox::getParam('core.path'));
				$sUrls .= $this->_makeUrl($aParts, $aParams);
				break;
		}
		
		if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.force_https_secure_pages'))
		{
			if (in_array($sUrl, Phpfox::getService('core')->getSecurePages()))
			{
				$sUrls = str_replace('http://', 'https://', $sUrls);
			}
			else 
			{
				$sUrls = str_replace('https://', 'http://', $sUrls);
			}
		}
		
		(($sPlugin = Phpfox_Plugin::get('check_url_is_array_return')) ? eval($sPlugin) : false);
		
		return $sUrls;
	}
Пример #3
0
 /**
  * Gets the full path of a file based on the current style being used.
  *
  * @param string $sType Type of file we are working with.
  * @param string $sValue File name.
  * @param string $sModule Module name. Only if its part of a module.
  * @return string Returns the full path to the item.
  */
 public function getStyle($sType = 'css', $sValue = null, $sModule = null)
 {
     if ($sModule !== null) {
         if ($sType == 'static_script') {
             $sType = 'jscript';
         }
         $sUrl = Phpfox::getParam('core.path') . 'module/' . $sModule . '/static/' . $sType . '/';
         $sDir = PHPFOX_DIR_MODULE . $sModule . PHPFOX_DS . 'static' . PHPFOX_DS . $sType . PHPFOX_DS;
         if ($sType == 'jscript') {
             $sPath = $sUrl . $sValue;
         } else {
             $bPass = false;
             if (file_exists($sDir . $this->_sThemeFolder . PHPFOX_DS . $this->_sStyleFolder . PHPFOX_DS . $sValue)) {
                 $bPass = true;
                 $sPath = $sUrl . $this->_sThemeFolder . '/' . $this->_sStyleFolder . '/' . $sValue;
             }
             if ($bPass === false) {
                 $sPath = $sUrl . 'default/default/' . $sValue;
             }
         }
         return $sPath;
     }
     if ($sType == 'static_script') {
         $sPath = Phpfox::getParam('core.url_static_script') . $sValue;
     } else {
         $sPath = (defined('PHPFOX_INSTALLER') ? Phpfox_Installer::getHostPath() : Phpfox::getParam('core.path')) . 'theme/' . $this->_sThemeLayout . '/' . $this->_sThemeFolder . '/style/' . $this->_sStyleFolder . '/' . $sType . '/';
         if ($sPlugin = Phpfox_Plugin::get('library_template_getstyle_1')) {
             eval($sPlugin);
             if (isset($bReturnFromPlugin)) {
                 return $bReturnFromPlugin;
             }
         }
         if ($sValue !== null) {
             $bPass = false;
             if (isset($this->_aTheme['style_parent_id']) && $this->_aTheme['style_parent_id'] > 0) {
                 $bPass = false;
                 if (file_exists(PHPFOX_DIR . 'theme' . PHPFOX_DS . $this->_sThemeLayout . PHPFOX_DS . $this->_sThemeFolder . PHPFOX_DS . 'style' . PHPFOX_DS . $this->_sStyleFolder . PHPFOX_DS . $sType . PHPFOX_DS . $sValue)) {
                     $bPass = true;
                     $sPath = Phpfox::getParam('core.path') . 'theme' . '/' . $this->_sThemeLayout . '/' . $this->_sThemeFolder . '/' . 'style' . '/' . $this->_sStyleFolder . '/' . $sType . '/' . $sValue;
                 }
                 if (isset($this->_aTheme['parent_theme_folder'])) {
                     if ($bPass === false && file_exists(PHPFOX_DIR . 'theme' . PHPFOX_DS . $this->_sThemeLayout . PHPFOX_DS . $this->_aTheme['parent_theme_folder'] . PHPFOX_DS . 'style' . PHPFOX_DS . $this->_aTheme['parent_style_folder'] . PHPFOX_DS . $sType . PHPFOX_DS . $sValue)) {
                         $bPass = true;
                         $sPath = Phpfox::getParam('core.path') . 'theme' . '/' . $this->_sThemeLayout . '/' . $this->_aTheme['parent_theme_folder'] . '/' . 'style' . '/' . $this->_aTheme['parent_style_folder'] . '/' . $sType . '/' . $sValue;
                     }
                 } else {
                     if ($bPass === false && file_exists(PHPFOX_DIR . 'theme' . PHPFOX_DS . $this->_sThemeLayout . PHPFOX_DS . $this->_sThemeFolder . PHPFOX_DS . 'style' . PHPFOX_DS . $this->_aTheme['parent_style_folder'] . PHPFOX_DS . $sType . PHPFOX_DS . $sValue)) {
                         $bPass = true;
                         $sPath = Phpfox::getParam('core.path') . 'theme' . '/' . $this->_sThemeLayout . '/' . $this->_sThemeFolder . '/' . 'style' . '/' . $this->_aTheme['parent_style_folder'] . '/' . $sType . '/' . $sValue;
                     }
                 }
             } else {
                 if (!defined('PHPFOX_INSTALLER')) {
                     if (file_exists(PHPFOX_DIR . 'theme' . PHPFOX_DS . $this->_sThemeLayout . PHPFOX_DS . $this->_sThemeFolder . PHPFOX_DS . 'style' . PHPFOX_DS . $this->_sStyleFolder . PHPFOX_DS . $sType . PHPFOX_DS . $sValue)) {
                         $bPass = true;
                         $sPath = Phpfox::getParam('core.path') . 'theme' . '/' . $this->_sThemeLayout . '/' . $this->_sThemeFolder . '/' . 'style' . '/' . $this->_sStyleFolder . '/' . $sType . '/' . $sValue;
                     }
                 }
             }
             if ($bPass === false) {
                 if (defined('PHPFOX_INSTALLER')) {
                     $sPath = (defined('PHPFOX_INSTALLER') ? Phpfox_Installer::getHostPath() : Phpfox::getParam('core.path')) . 'theme' . '/' . $this->_sThemeLayout . '/' . 'default' . '/' . 'style' . '/' . 'default' . '/' . $sType . '/' . $sValue;
                 } else {
                     if (file_exists(PHPFOX_DIR . 'theme' . '/' . $this->_sThemeLayout . '/' . 'default' . '/' . 'style' . '/' . 'default' . '/' . $sType . '/' . $sValue)) {
                         $sPath = Phpfox::getParam('core.path') . 'theme' . '/' . $this->_sThemeLayout . '/' . 'default' . '/' . 'style' . '/' . 'default' . '/' . $sType . '/' . $sValue;
                     } else {
                         if (file_exists(PHPFOX_DIR . 'theme' . '/frontend/' . $this->_sThemeFolder . '/' . 'style' . '/' . $this->_sStyleFolder . '/' . $sType . '/' . $sValue)) {
                             $sPath = Phpfox::getParam('core.path') . 'theme' . '/frontend/' . $this->_sThemeFolder . '/' . 'style' . '/' . $this->_sStyleFolder . '/' . $sType . '/' . $sValue;
                         } else {
                             $sPath = Phpfox::getParam('core.path') . 'theme' . '/frontend/' . 'default' . '/' . 'style' . '/' . 'default' . '/' . $sType . '/' . $sValue;
                         }
                     }
                 }
             }
         }
     }
     return $sPath;
 }
Пример #4
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);
     }
     */
 }
Пример #5
0
 /**
  * Make an internal link.
  *
  * @param string $sUrl Internal link.
  * @param array $aParams ARRAY of params to include in the link.
  * @param bool $bFullPath Not using this argument any longer.
  * @return string Full URL.
  */
 public function makeUrl($sUrl, $aParams = array(), $bFullPath = false)
 {
     $sUrl = trim($sUrl, '/');
     if (defined('PHPFOX_INSTALLER')) {
         if (is_array($aParams)) {
             $aParams['sessionid'] = Phpfox_Installer::getSessionId();
         } else {
             $aParams = array($aParams, 'sessionid' => Phpfox_Installer::getSessionId());
         }
     }
     if (preg_match('/https?:\\/\\//i', $sUrl)) {
         return $sUrl;
     }
     if ($sUrl == 'current') {
         $sUrl = '';
         foreach ($this->_aParams as $sKey => $sValue) {
             if (substr($sKey, 0, 3) == 'req') {
                 $sUrl .= urlencode($sValue) . '.';
             } else {
                 // $sUrl .= $sKey . '_' . urlencode($sValue) . '.';
                 $aParams[$sKey] = $sValue;
             }
         }
         $aGets = $_GET;
         unset($aGets['do']);
         if ($aGets) {
             if (!is_array($aParams)) {
                 $aParams = [];
             }
             $aParams = array_merge($aParams, $aGets);
         }
         $sUrl = rtrim($sUrl, '.');
     }
     ($sPlugin = Phpfox_Plugin::get('check_url_is_array')) ? eval($sPlugin) : false;
     // Make it an array if its not an array already (Used as shortcut)
     if (!is_array($aParams)) {
         $aParams = array($aParams);
     }
     if (!defined('PHPFOX_INSTALLER')) {
         if ($sUrl == 'profile') {
             if (empty($aParams[0]) && isset($aParams[1]) && $aParams[1] > 0) {
                 $sUrl = '';
                 $sUrl .= 'pages';
             } else {
                 $sUrl = '';
                 $sUrl .= isset($aParams[0]) ? $aParams[0] : Phpfox::getUserBy('user_name');
                 unset($aParams[0]);
             }
         } else {
             if (Phpfox::isUser() && preg_match("/profile/i", $sUrl)) {
                 $aParts = explode('.', $sUrl);
                 if (isset($aParts[0]) && $aParts[0] == 'profile') {
                     unset($aParts[0]);
                     if (isset($aParts[1]) && $aParts[1] == 'my') {
                         unset($aParts[1]);
                     }
                     $sUrl = '';
                     /*
                     if (Phpfox::getParam('user.profile_use_id'))
                     {
                     	$sUrl .= 'profile.';
                     }
                     */
                     $sUrl .= isset($aParams[0]) ? $aParams[0] : Phpfox::getUserBy('user_name');
                     $sUrl .= '.' . implode('.', $aParts);
                 }
             }
         }
         if ($sUrl == 'profile' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE) {
             $sUrl = '';
         }
     }
     $sUrl = trim($sUrl, '.');
     $sUrls = '';
     switch (Phpfox::getParam('core.url_rewrite')) {
         // www.site.com/foo/bar/
         case 1:
         case 2:
             $aParts = explode('.', $sUrl);
             $sUrls .= Phpfox::getParam('core.path');
             $sUrls .= $this->_makeUrl($aParts, $aParams);
             break;
             // www.site.com/index.php?foo=bar
             /*
             case 2:
             	$aParts = explode('.', $sUrl);
             	if ($bFullPath)
             	{
             		$sUrls .= Phpfox::getParam('core.path');
             	}				
             	$sUrls .= Phpfox::getParam('core.path') . PHPFOX_INDEX_FILE . '?' . PHPFOX_GET_METHOD . '=/';
             	$sUrls .= $this->_makeUrl($aParts, $aParams);		
             	break;
             */
     }
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.force_https_secure_pages')) {
         if (Phpfox::getParam('core.force_secure_site')) {
             $sUrls = str_replace('http://', 'https://', $sUrls);
         } else {
             if (in_array(str_replace('mobile.', '', $sUrl), Phpfox::getService('core')->getSecurePages())) {
                 $sUrls = str_replace('http://', 'https://', $sUrls);
             } else {
                 $sUrls = str_replace('https://', 'http://', $sUrls);
             }
         }
     }
     ($sPlugin = Phpfox_Plugin::get('check_url_is_array_return')) ? eval($sPlugin) : false;
     if (defined('PHPFOX_IS_HOSTED_SCRIPT') && defined('PHPFOX_IS_HOSTED_VERSION')) {
         $sUrls = str_replace('/' . PHPFOX_IS_HOSTED_VERSION . '/', '/', $sUrls);
     }
     return $sUrls;
 }
Пример #6
0
 *
 */
define('PHPFOX', true);
/**
 * Directory Seperator
 *
 */
define('PHPFOX_DS', DIRECTORY_SEPARATOR);
/**
 * phpFox Root Directory
 *
 */
define('PHPFOX_DIR', dirname(dirname(__FILE__)) . PHPFOX_DS);
define('PHPFOX_DIR_INSTALL', PHPFOX_DIR . 'install' . PHPFOX_DS);
define('PHPFOX_NO_PLUGINS', true);
define('PHPFOX_NO_USER_SESSION', true);
define('PHPFOX_NO_CSRF', true);
define('PHPFOX_INSTALLER', true);
// Require phpFox Init
require PHPFOX_DIR . 'include' . PHPFOX_DS . 'init.inc.php';
$oFile = Phpfox::getLib('file');
if (!$oFile->isWritable(PHPFOX_DIR_CACHE)) {
    if ($oFile->isWritable($oFile->getTempDir())) {
        define('PHPFOX_TMP_DIR', $oFile->getTempDir());
    } else {
        define('PHPFOX_INSTALLER_NO_TMP', true);
    }
}
require_once PHPFOX_DIR_INSTALL . 'include' . PHPFOX_DS . 'installer.class.php';
$oInstaller = new Phpfox_Installer();
$oInstaller->run();
Пример #7
0
 public function run()
 {
     if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
         $this->_update();
         exit;
     }
     if ($this->_bUpgrade && (int) substr($this->_getCurrentVersion(), 0, 1) < 2 && file_exists(PHPFOX_DIR . '.htaccess')) {
         $sHtaccessContent = file_get_contents(PHPFOX_DIR . '.htaccess');
         if (preg_match('/RewriteEngine/i', $sHtaccessContent)) {
             exit('In order for us to continue with the upgrade you will need to rename or remove the file ".htaccess".');
         }
     }
     $sStep = $this->_oReq->get('req2') ? strtolower($this->_oReq->get('req2')) : 'key';
     $this->_oTpl->setTitle(self::getPhrase('phpfox_installer'))->setBreadcrumb(self::getPhrase('phpfox_installer'));
     $bPass = false;
     if (!in_array($sStep, $this->_aSteps)) {
         if (in_array($sStep, $this->_aModuleInstalls)) {
             $bPass = true;
         } else {
             exit('Invalid step.');
         }
     }
     $sMethod = '_' . $sStep;
     $iStep = 0;
     foreach ($this->_aSteps as $iKey => $sMyStep) {
         if ($sMyStep === $sStep) {
             $iStep = $iKey - 1;
             break;
         }
     }
     if ($bPass === false && isset($this->_aSteps[$iStep]) && !$this->_isPassed($this->_aSteps[$iStep])) {
         $this->_oUrl->forward($this->_step($this->_aSteps[$iStep]));
     }
     $this->_sStep = $sStep;
     if (method_exists($this, $sMethod)) {
         call_user_func(array(&$this, $sMethod));
     } else {
         $sStep = 'key';
     }
     if (PHPFOX_DEBUG) {
         $this->_oTpl->setHeader(array('debug.css' => 'style_css'));
     }
     if (!file_exists($this->_oTpl->getLayoutFile($sStep))) {
         $sStep = 'default';
     }
     list($aBreadCrumbs, $aBreadCrumbTitle) = $this->_oTpl->getBreadCrumb();
     $this->_oTpl->setImage(array('ajax_small' => 'ajax/small.gif', 'ajax_large' => 'ajax/large.gif', 'loading_animation' => 'misc/loading_animation.gif', 'close' => 'misc/close.gif'));
     $this->_oTpl->setHeader(array('<link rel="shortcut icon" type="image/x-icon" href="' . Phpfox_Installer::getHostPath() . 'favicon.ico?v=' . $this->_oTpl->getStaticVersion() . '" />', 'layout.css' => 'style_css', 'thickbox.css' => 'style_css', 'jquery/jquery.js' => 'static_script', 'common.js' => 'static_script', 'main.js' => 'static_script', 'thickbox/thickbox.js' => 'static_script'))->assign(array('sTemplate' => $sStep, 'sLocaleDirection' => 'ltr', 'sLocaleCode' => 'en', 'sUrl' => $this->_sUrl, 'aErrors' => Phpfox_Error::get(), 'sPublicMessage' => Phpfox::getMessage(), 'aBreadCrumbs' => $aBreadCrumbs, 'aBreadCrumbTitle' => $aBreadCrumbTitle, 'aSteps' => $this->_getSteps()));
     if ($this->_bUpgrade) {
         $this->_oTpl->setTitle('Upgrading from: ' . $this->_getCurrentVersion());
     }
     header("X-Content-Encoded-By: phpFox " . PhpFox::getVersion());
     $this->_oTpl->getLayout('template');
     Phpfox::clearMessage();
 }