Exemple #1
0
 /**
  * @param bool $bAdmin = false
  *
  * @return array
  */
 private function indexTemplateParameters($bAdmin = false)
 {
     $sLanguage = 'en';
     $sTheme = 'Default';
     list($sLanguage, $sTheme) = $this->oActions->GetLanguageAndTheme($bAdmin);
     $bAppJsDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_js', false);
     $bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
     $sStaticPrefix = \RainLoop\Utils::WebStaticPath();
     $aData = array('Language' => $sLanguage, 'Theme' => $sTheme, 'FaviconIcoLink' => $sStaticPrefix . 'favicon.ico', 'FaviconPngLink' => $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sStaticPrefix . 'apple-touch-icon.png', 'AppCssLink' => $sStaticPrefix . 'css/app' . ($bAppCssDebug ? '' : '.min') . '.css', 'BootJsLink' => $sStaticPrefix . 'js/min/boot.js', 'ComponentsJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . 'components.js', 'LibJsLink' => $sStaticPrefix . 'js/min/libs.js', 'EditorJsLink' => $sStaticPrefix . 'ckeditor/ckeditor.js', 'OpenPgpJsLink' => $sStaticPrefix . 'js/min/openpgp.min.js', 'AppJsCommonLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . 'common.js', 'AppJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . ($bAdmin ? 'admin' : 'app') . '.js');
     $aTemplateParameters = array('{{BaseAppDataScriptLink}}' => $bAdmin ? './?/AdminAppData/' : './?/AppData/', '{{BaseAppFaviconIcoFile}}' => $aData['FaviconIcoLink'], '{{BaseAppFaviconPngFile}}' => $aData['FaviconPngLink'], '{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'], '{{BaseAppMainCssLink}}' => $aData['AppCssLink'], '{{BaseAppBootScriptLink}}' => $aData['BootJsLink'], '{{BaseAppComponentsScriptLink}}' => $aData['ComponentsJsLink'], '{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'], '{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'], '{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'], '{{BaseAppMainCommonScriptLink}}' => $aData['AppJsCommonLink'], '{{BaseAppMainScriptLink}}' => $aData['AppJsLink'], '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr');
     $aTemplateParameters['{{BaseHash}}'] = \md5(\implode('~', array($bAdmin ? '1' : '0', \md5($this->oActions->Config()->Get('cache', 'index', '')), $this->oActions->Plugins()->Hash(), \RainLoop\Utils::WebVersionPath(), APP_VERSION)) . \implode('~', $aTemplateParameters));
     return $aTemplateParameters;
 }
 /**
  * @param bool $bAdmin = false
  * @param bool $bJsOutput = true
  *
  * @return string
  */
 public function compileTemplates($bAdmin = false, $bJsOutput = true)
 {
     $aTemplates = array();
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/Components', 'Component');
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'User'));
     \RainLoop\Utils::CompileTemplates($aTemplates, APP_VERSION_ROOT_PATH . 'app/templates/Views/Common');
     $this->oActions->Plugins()->CompileTemplate($aTemplates, $bAdmin);
     $sHtml = '';
     foreach ($aTemplates as $sName => $sFile) {
         $sName = \preg_replace('/[^a-zA-Z0-9]/', '', $sName);
         $sHtml .= '<script id="' . $sName . '" type="text/html" data-cfasync="false">' . $this->oActions->ProcessTemplate($sName, \file_get_contents($sFile)) . '</script>';
     }
     unset($aTemplates);
     return $bJsOutput ? 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';' : $sHtml;
 }
 /**
  * @param bool $bAdmin
  *
  * @return array
  */
 private function indexTemplateParameters($bAdmin)
 {
     $sLanguage = 'en';
     $sTheme = 'Default';
     if (!$bAdmin) {
         list($sLanguage, $sTheme) = $this->oActions->GetLanguageAndTheme();
     }
     $sLanguage = $this->oActions->ValidateLanguage($sLanguage);
     $sTheme = $this->oActions->ValidateTheme($sTheme);
     $bAppJsDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_js', false);
     $bAppCssDebug = !!$this->oActions->Config()->Get('labs', 'use_app_debug_css', false);
     $sStaticPrefix = APP_WEB_STATIC_PATH;
     $aData = array('Language' => $sLanguage, 'Theme' => $sTheme, 'LoadingDescription' => $this->oActions->Config()->Get('webmail', 'loading_description', 'RainLoop'), 'FaviconIcoLink' => $sStaticPrefix . 'favicon.ico', 'FaviconPngLink' => $sStaticPrefix . 'favicon.png', 'AppleTouchLink' => $sStaticPrefix . 'apple-touch-icon.png', 'AppCssLink' => $sStaticPrefix . 'css/app' . ($bAppCssDebug ? '' : '.min') . '.css', 'BootJsLink' => $sStaticPrefix . 'js/min/boot.js', 'LibJsLink' => $sStaticPrefix . 'js/min/libs.js', 'EditorJsLink' => $sStaticPrefix . 'ckeditor/ckeditor.js', 'OpenPgpJsLink' => $sStaticPrefix . 'js/min/openpgp.min.js', 'AppJsLink' => $sStaticPrefix . 'js/' . ($bAppJsDebug ? '' : 'min/') . ($bAdmin ? 'admin' : 'app') . '.js');
     $aTemplateParameters = array('{{BaseAppDataScriptLink}}' => $bAdmin ? './?/AdminAppData/' : './?/AppData/', '{{BaseAppFaviconIcoFile}}' => $aData['FaviconIcoLink'], '{{BaseAppFaviconPngFile}}' => $aData['FaviconPngLink'], '{{BaseAppAppleTouchFile}}' => $aData['AppleTouchLink'], '{{BaseAppMainCssLink}}' => $aData['AppCssLink'], '{{BaseAppBootScriptLink}}' => $aData['BootJsLink'], '{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'], '{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'], '{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'], '{{BaseAppMainScriptLink}}' => $aData['AppJsLink'], '{{BaseAppLoadingDescription}}' => \htmlspecialchars($aData['LoadingDescription'], ENT_QUOTES | ENT_IGNORE, 'UTF-8'), '{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr');
     $aTemplateParameters['{{BaseHash}}'] = \md5(\implode('~', array(\md5($this->oActions->Config()->Get('cache', 'index', '')), $this->oActions->Plugins()->Hash(), APP_WEB_PATH, APP_VERSION)) . \implode('~', $aTemplateParameters));
     return $aTemplateParameters;
 }
 /**
  * @param bool $bAdmin = false
  * @param bool $bJsOutput = true
  *
  * @return string
  */
 public function compileTemplates($bAdmin = false, $bJsOutput = true)
 {
     $sHtml = \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Components', $this->oActions, 'Component') . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'User'), $this->oActions) . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Common', $this->oActions) . $this->oActions->Plugins()->CompileTemplate($bAdmin);
     return $bJsOutput ? 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';' : $sHtml;
 }
 /**
  * @param bool $bAdmin = false
  *
  * @return string
  */
 private function compileTemplates($bAdmin = false)
 {
     $sHtml = \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/' . ($bAdmin ? 'Admin' : 'App'), $this->oActions) . \RainLoop\Utils::CompileTemplates(APP_VERSION_ROOT_PATH . 'app/templates/Views/Common', $this->oActions) . $this->oActions->Plugins()->CompileTemplate($bAdmin);
     return 'window.rainloopTEMPLATES=' . \MailSo\Base\Utils::Php2js(array($sHtml), $this->Logger()) . ';';
 }
Exemple #6
0
 /**
  * @param bool $bAppJsDebug
  * @param bool $bAdmin
  *
  * @return string
  */
 private function generateIndexCacheHash($bAppJsDebug, $bAdmin)
 {
     return \md5(APP_WEB_PATH . $this->oActions->Config()->Get('webmail', 'loading_description', 'RainLoop') . \md5($this->oActions->Config()->Get('cache', 'index', '')) . $this->oActions->Plugins()->Hash() . APP_VERSION . ($bAppJsDebug ? 'd' : 'm') . ($bAdmin ? 'a' : 'w'));
 }