Esempio n. 1
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;
 }
 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();
 }