Index: core/install/upgrades.sql IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/upgrades.sql (revision 15601) +++ core/install/upgrades.sql (revision ) @@ -2876,3 +2876,10 @@ WHERE PhraseKey = 'LA_PROMPT_OVERWRITEPHRASES'; DELETE FROM LanguageLabels WHERE PhraseKey = 'LC_IMPORTLANG_PHRASEWARNING'; + +DELETE FROM LanguageLabels WHERE PhraseKey = 'LA_CONFIG_USETEMPLATECOMPRESSION'; +DELETE FROM SystemSettings WHERE VariableName = 'UseTemplateCompression'; + +UPDATE SystemSettings +SET DisplayOrder = ROUND(DisplayOrder - 0.01, 2) +WHERE (DisplayOrder BETWEEN 60.04 AND 60.10) AND (ModuleOwner = 'In-Portal') AND (Section = 'in-portal:configure_advanced'); Index: core/install/install_data.sql IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/install_data.sql (revision 15601) +++ core/install/install_data.sql (revision ) @@ -91,13 +91,12 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'DefaultEmailRecipients', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_config_DefaultEmailRecipients', 'text', NULL, NULL, 50.10, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'UseOutputCompression', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseOutputCompression', 'checkbox', '', '', 60.01, 0, 1, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'OutputCompressionLevel', '7', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_OutputCompressionLevel', 'text', '', '', 60.02, 0, 1, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'UseTemplateCompression', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseTemplateCompression', 'checkbox', '', '', 60.03, 0, 1, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'TrimRequiredFields', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_TrimRequiredFields', 'checkbox', '', '', 60.04, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'RunScheduledTasksFromCron', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_UseCronForRegularEvent', 'checkbox', NULL, NULL, 60.05, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'UseChangeLog', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseChangeLog', 'checkbox', '', '', 60.06, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'Backup_Path', '/home/alex/web/in-portal.rc/system/backupdata', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_backup_path', 'text', '', '', 60.07, 0, 1, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL); -INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.09, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'TrimRequiredFields', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_TrimRequiredFields', 'checkbox', '', '', 60.03, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'RunScheduledTasksFromCron', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_UseCronForRegularEvent', 'checkbox', NULL, NULL, 60.04, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'UseChangeLog', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_UseChangeLog', 'checkbox', '', '', 60.05, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'Backup_Path', '/home/alex/web/in-portal.rc/system/backupdata', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_backup_path', 'text', '', '', 60.06, 0, 1, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.07, 0, 0, NULL); +INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL); INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog'); INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EmailLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 65.02, 0, 0, 'hint:la_config_EmailLogRotationInterval'); INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval'); \ No newline at end of file Index: core/install/english.lang IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/english.lang (revision 15601) +++ core/install/english.lang (revision ) @@ -224,7 +224,6 @@ RWRpdGluZyBXaW5kb3cgU3R5bGU= RW1haWwgYWN0aXZhdGlvbiBleHBpcmF0aW9uIHRpbWVvdXQgKGluIG1pbnV0ZXMp VXNlIFNtYWxsIFNlY3Rpb24gSGVhZGVycw== - Q29tcHJlc3MgQ29tcGlsZWQgUEhQIFRlbXBsYXRlcw== VXNlIFRvb2xiYXIgTGFiZWxz VXNlIFZpc2l0b3IgVHJhY2tpbmc= VXNlIEphdmFTY3JpcHQgcmVkaXJlY3Rpb24gYWZ0ZXIgbG9naW4vbG9nb3V0IChmb3IgSUlTKQ== \ No newline at end of file Index: core/kernel/nparser/template_cache.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/nparser/template_cache.php (revision 15601) +++ core/kernel/nparser/template_cache.php (revision ) @@ -41,13 +41,6 @@ var $_compileToDatabase = false; /** - * Compress compiled templates - * - * @var bool - */ - var $_compressOutput = false; - - /** * Template locations of each module * * @var Array @@ -61,14 +54,13 @@ $this->BasePath = FULL_PATH . THEMES_PATH; $this->_compileToDatabase = defined('SAFE_MODE') && SAFE_MODE; - $this->_compressOutput = $this->Application->ConfigValue('UseTemplateCompression'); - if ($this->Application->isAdmin) { + if ( $this->Application->isAdmin ) { // prepare module template paths for quick access $module_paths = Array (); foreach ($this->Application->ModuleInfo as $module_name => $module_info) { - $module_paths[ mb_strtolower($module_name) ] = rtrim($module_info['Path'], '/'); + $module_paths[mb_strtolower($module_name)] = rtrim($module_info['Path'], '/'); } $this->_modulePaths = $module_paths; @@ -83,7 +75,7 @@ */ function GetTemplatePaths($filename) { - if ($this->Application->isAdmin && array_key_exists($filename, $this->Application->ReplacementTemplates)) { + if ( $this->Application->isAdmin && array_key_exists($filename, $this->Application->ReplacementTemplates) ) { // process admin template replacement $filename = $this->Application->ReplacementTemplates[$filename]; } @@ -91,7 +83,7 @@ // allows to use non-replaced version of replaced template $filename = preg_replace('/^original:(.*)/', '\\1', $filename); - if (preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs)) { + if ( preg_match('#^[\/]{0,1}([^\/]*)\/(.*)#', $filename, $regs) ) { $first_dir = $regs[1]; $module_filename = $regs[2]; } @@ -100,16 +92,16 @@ $module_filename = $filename; } - if (is_string($this->forceThemeName)) { + if ( is_string($this->forceThemeName) ) { // when defined, then all templates are read from given theme name $first_dir = 'theme:' . $this->forceThemeName . ($first_dir ? '/' . $first_dir : ''); } - if ($this->Application->isAdmin && array_key_exists($first_dir, $this->_modulePaths)) { + if ( $this->Application->isAdmin && array_key_exists($first_dir, $this->_modulePaths) ) { // template belongs to one of the modules $path = FULL_PATH . '/' . $this->_modulePaths[$first_dir] . '/admin_templates'; } - elseif ($this->forceThemeName && preg_match('/^theme:(.*)/', $first_dir, $regs)) { + elseif ( $this->forceThemeName && preg_match('/^theme:(.*)/', $first_dir, $regs) ) { // ability to use Front-End templates in admin (only during mass compilation) $path = FULL_PATH . '/themes/' . $regs[1]; } @@ -131,7 +123,8 @@ function GetRealFilename($filename) { list ($path, $module_filename) = $this->GetTemplatePaths($filename); + - return $path.'/'.trim($module_filename, '/'); + return $path . '/' . trim($module_filename, '/'); } /** @@ -142,13 +135,13 @@ */ function TemplateExists($filename) { - if ((strpos($filename, '../') !== false) || (trim($filename) !== $filename)) { + if ( (strpos($filename, '../') !== false) || (trim($filename) !== $filename) ) { // when relative paths or special chars are found template names from url, then it's hacking attempt return false; } - $real_file = $this->GetRealFilename( strtolower($filename) ); + $real_file = $this->GetRealFilename(strtolower($filename)); - if (substr($real_file, -4) != '.tpl') { + if ( substr($real_file, -4) != '.tpl' ) { // add ".tpl" file extension, when not specified in template name $real_file .= '.tpl'; } @@ -168,28 +161,28 @@ $fname = str_replace(FULL_PATH, WRITEABLE . '/cache', $real_name . '.php'); $tname = $real_name . '.tpl'; - if (!file_exists($tname)) { + if ( !file_exists($tname) ) { // given template doesn't exist return false; } - if ($this->_compileToDatabase) { + if ( $this->_compileToDatabase ) { $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'SystemCache WHERE VarName = "' . $fname . '"'; $cached = $this->Conn->GetRow($sql); - if ($cached !== false && $cached['Cached'] > filemtime($tname)) { + if ( $cached !== false && $cached['Cached'] > filemtime($tname) ) { return Array ('active' => 1, 'fname' => $fname, 'tname' => $tname, 'mode' => 'db', 'content' => $cached['Data']); } } else { - if (file_exists($fname) && file_exists($tname) && filemtime($fname) > filemtime($tname)) { + if ( file_exists($fname) && file_exists($tname) && filemtime($fname) > filemtime($tname) ) { return Array ('active' => 1, 'fname' => $fname, 'tname' => $tname, 'mode' => 'file'); } - if (!file_exists($fname)) { + if ( !file_exists($fname) ) { - // make sure to create directory if pre-parsed file does not exist + // make sure to create directory if pre-parsed file does not exist $this->CheckDir(dirname($fname), WRITEABLE . '/cache'); } } @@ -204,10 +197,12 @@ * * @param string $filename * @param string $compiled_template + * @return void + * @throws ParserException */ function saveTemplate($filename, &$compiled_template) { - if ($this->_compileToDatabase) { + if ( $this->_compileToDatabase ) { $fields_hash = Array ( 'VarName' => $filename, 'Data' => &$compiled_template, @@ -221,16 +216,11 @@ $fp = fopen($filename, 'w'); - if ($this->_compressOutput) { - $compiled_template = $this->_compress($compiled_template); - } - if ( !fwrite($fp, $compiled_template) ) { throw new ParserException('Saving compiled template failed'); } fclose($fp); - } /** @@ -244,19 +234,18 @@ { ob_start(); - if ($this->_compileToDatabase) { + if ( $this->_compileToDatabase ) { $sql = 'SELECT * FROM ' . TABLE_PREFIX . 'SystemCache WHERE VarName = "' . $pre_parsed['fname'] . '"'; - $cached = $this->Conn->GetRow($sql); - if (($cached !== false) && ($cached['Cached'] > filemtime($pre_parsed['tname']))) { + if ( ($cached !== false) && ($cached['Cached'] > filemtime($pre_parsed['tname'])) ) { eval('?' . '>' . $cached['Data']); } } else { - if ($pre_parsed['mode'] == 'file') { + if ( $pre_parsed['mode'] == 'file' ) { include($pre_parsed['fname']); } else { @@ -270,148 +259,6 @@ } /** - * Compress given php code - * - * @param string $src - * @return string - */ - function _compress($src) { - // Whitespaces left and right from this signs can be ignored - static $IW = array( - T_CONCAT_EQUAL, // .= - T_DOUBLE_ARROW, // => - T_BOOLEAN_AND, // && - T_BOOLEAN_OR, // || - T_IS_EQUAL, // == - T_IS_NOT_EQUAL, // != or <> - T_IS_SMALLER_OR_EQUAL, // <= - T_IS_GREATER_OR_EQUAL, // >= - T_INC, // ++ - T_DEC, // -- - T_PLUS_EQUAL, // += - T_MINUS_EQUAL, // -= - T_MUL_EQUAL, // *= - T_DIV_EQUAL, // /= - T_IS_IDENTICAL, // === - T_IS_NOT_IDENTICAL, // !== - T_DOUBLE_COLON, // :: - T_PAAMAYIM_NEKUDOTAYIM, // :: - T_OBJECT_OPERATOR, // -> - T_DOLLAR_OPEN_CURLY_BRACES, // ${ - T_AND_EQUAL, // &= - T_MOD_EQUAL, // %= - T_XOR_EQUAL, // ^= - T_OR_EQUAL, // |= - T_SL, // << - T_SR, // >> - T_SL_EQUAL, // <<= - T_SR_EQUAL, // >>= - ); - - $tokens = token_get_all($src); - - $new = ""; - $c = sizeof($tokens); - $iw = false; // ignore whitespace - $ih = false; // in HEREDOC - $ls = ""; // last sign - $ot = null; // open tag - - for ($i = 0; $i < $c; $i++) { - $token = $tokens[$i]; - - if (is_array($token)) { - list ($tn, $ts) = $token; // tokens: number, string, line - $tname = token_name($tn); - - if ($tn == T_INLINE_HTML) { - $new .= $ts; - $iw = false; - } else { - if ($tn == T_OPEN_TAG) { - if (strpos($ts, " ") || strpos($ts, "\n") || strpos($ts, "\t") || strpos($ts, "\r")) { - $ts = rtrim($ts); - } - - $ts .= " "; - $new .= $ts; - $ot = T_OPEN_TAG; - $iw = true; - } elseif ($tn == T_OPEN_TAG_WITH_ECHO) { - $new .= $ts; - $ot = T_OPEN_TAG_WITH_ECHO; - $iw = true; - } elseif ($tn == T_CLOSE_TAG) { - if ($ot == T_OPEN_TAG_WITH_ECHO) { - $new = rtrim($new, "; "); - } else { - $ts = " ".$ts; - } - - $new .= $ts; - $ot = null; - $iw = false; - } elseif (in_array($tn, $IW)) { - $new .= $ts; - $iw = true; - } elseif ($tn == T_CONSTANT_ENCAPSED_STRING || $tn == T_ENCAPSED_AND_WHITESPACE) { - if ($ts[0] == '"') { - $ts = addcslashes($ts, "\n\t\r"); - } - - $new .= $ts; - $iw = true; - } elseif ($tn == T_WHITESPACE) { - $nt = @$tokens[$i+1]; - if (!$iw && (!is_string($nt) || $nt == '$') && !in_array($nt[0], $IW)) { - $new .= " "; - } - - $iw = false; - } elseif ($tn == T_START_HEREDOC) { - $new .= "<<