Index: branches/RC/core/units/categories/categories_tag_processor.php
===================================================================
diff -u -r11690 -r11711
--- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11690)
+++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 11711)
@@ -400,14 +400,22 @@
$wid = $this->Application->GetVar('m_wid');
list($index_file, $env) = explode('|', $this->Application->RecallVar(rtrim('last_template_'.$wid, '_')), 2);
+
+ $vars_backup = Array ();
$vars = $this->Application->HttpQuery->processQueryString( str_replace('%5C', '\\', $env) );
+
foreach ($vars as $var_name => $var_value) {
+ $vars_backup[$var_name] = $this->Application->GetVar($var_name);
$this->Application->SetVar($var_name, $var_value);
}
// update required fields
$this->Application->SetVar('m_cat_id', $category_id);
$this->Application->Session->SaveLastTemplate($params['template']);
+
+ foreach ($vars_backup as $var_name => $var_value) {
+ $this->Application->SetVar($var_name, $var_value);
+ }
}
function GetParentCategory($params)
@@ -1019,7 +1027,7 @@
$cached_navbar = $this->Conn->GetOne($sql);
}
- $cached_navbar = preg_replace('/^Content&\|&/i', '', $cached_navbar);
+ $cached_navbar = preg_replace('/^(Content&\|&|Content)/i', '', $cached_navbar);
$category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $cached_navbar), ' > ');
}
Index: branches/RC/core/units/general/cat_tag_processor.php
===================================================================
diff -u -r11649 -r11711
--- branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 11649)
+++ branches/RC/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 11711)
@@ -184,7 +184,7 @@
if ($category_path === false) {
// not chached
if ($category_id > 0) {
- $cached_navbar = preg_replace('/^Content&\|&/i', '', $object->GetField('CachedNavbar'));
+ $cached_navbar = preg_replace('/^(Content&\|&|Content)/i', '', $object->GetField('CachedNavbar'));
$category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $cached_navbar), ' > ');
}
else {
Fisheye: Tag 11711 refers to a dead (removed) revision in file `branches/RC/core/units/languages/import_xml.php'.
Fisheye: No comparison available. Pass `N' to diff?
Index: branches/RC/core/units/general/helpers/language_import_helper.php
===================================================================
diff -u
--- branches/RC/core/units/general/helpers/language_import_helper.php (revision 0)
+++ branches/RC/core/units/general/helpers/language_import_helper.php (revision 11711)
@@ -0,0 +1,583 @@
+lang_object =& $this->Application->recallObject('lang.import', null, Array ('skip_autoload' => true));
+
+ if (!(defined('IS_INSTALL') && IS_INSTALL)) {
+ // perform only, when not in installation mode
+ $this->_updateEventsCache();
+ }
+
+ $this->ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR');
+
+// $this->_debugMode = $this->Application->isDebugMode();
+ }
+
+ /**
+ * Performs import of given language pack (former Parse method)
+ *
+ * @param string $filename
+ * @param string $phrase_types
+ * @param Array $module_ids
+ * @param int $import_mode
+ * @return bool
+ */
+ function performImport($filename, $phrase_types, $module_ids, $import_mode = LANG_SKIP_EXISTING)
+ {
+ // define the XML parsing routines/functions to call based on the handler path
+ if (!file_exists($filename) || !$phrase_types /*|| !$module_ids*/) {
+ return false;
+ }
+
+ if ($this->_debugMode) {
+ $start_time = getmicrotime();
+ $this->Application->Debugger->appendHTML(__CLASS__ . '::' . __FUNCTION__ . '("' . $filename . '")');
+ }
+
+ if (defined('IS_INSTALL') && IS_INSTALL) {
+ // new events could be added during module upgrade
+ $this->_updateEventsCache();
+ }
+
+ $this->_initImportTables();
+
+ $phrase_types = explode('|', substr($phrase_types, 1, -1) );
+// $module_ids = explode('|', substr($module_ids, 1, -1) );
+
+ $this->phrase_types_allowed = array_flip($phrase_types);
+ $this->import_mode = $import_mode;
+
+ $this->_parseXML($filename);
+
+ // copy data from temp tables to live
+ foreach ($this->_languages as $language_id) {
+ $this->_performUpgrade($language_id, 'phrases', 'Phrase');
+ $this->_performUpgrade($language_id, 'emailmessages', 'EventId');
+ }
+
+ $this->_initImportTables(true);
+
+ if ($this->_debugMode) {
+ $this->Application->Debugger->appendHTML(__CLASS__ . '::' . __FUNCTION__ . '("' . $filename . '"): ' . (getmicrotime() - $start_time));
+ }
+
+ return true;
+ }
+
+ /**
+ * Creates XML file with exported language data (former Create method)
+ *
+ * @param string $filename filename to export into
+ * @param Array $phrase_types phrases types to export from modules passed in $module_ids
+ * @param Array $language_ids IDs of languages to export
+ * @param Array $module_ids IDs of modules to export phrases from
+ */
+ function performExport($filename, $phrase_types, $language_ids, $module_ids)
+ {
+ $fp = fopen($filename,'w');
+ if (!$fp || !$phrase_types || !$module_ids || !$language_ids) {
+ return false;
+ }
+
+ $phrase_types = explode('|', substr($phrase_types, 1, -1) );
+ $module_ids = explode('|', substr($module_ids, 1, -1) );
+
+ $this->events_hash = array_flip($this->events_hash);
+
+ $lang_table = $this->Application->getUnitOption('lang','TableName');
+ $phrases_table = $this->Application->getUnitOption('phrases','TableName');
+ $emailevents_table = $this->Application->getUnitOption('emailmessages','TableName');
+ $mainevents_table = $this->Application->getUnitOption('emailevents','TableName');
+
+ $phrase_tpl = "\t\t\t".'%s'."\n";
+ $event_tpl = "\t\t\t".'%s'."\n";
+ $sql = 'SELECT * FROM %s WHERE LanguageId = %s';
+ $ret = ''."\n";
+ foreach ($language_ids as $language_id) {
+ // languages
+ $row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) );
+ $ret .= "\t".''.$row['DateFormat'].'';
+ $ret .= ''.$row['TimeFormat'].''.$row['InputDateFormat'].'';
+ $ret .= ''.$row['InputTimeFormat'].''.$row['DecimalPoint'].'';
+ $ret .= ''.$row['ThousandSep'].''.$row['Charset'].'';
+ $ret .= ''.$row['UnitSystem'].''."\n";
+
+ // phrases
+ $phrases_sql = 'SELECT * FROM '.$phrases_table.' WHERE LanguageId = %s AND PhraseType IN (%s) AND Module IN (%s) ORDER BY Phrase';
+ if( in_array('In-Portal',$module_ids) ) array_push($module_ids, ''); // for old language packs
+ $rows = $this->Conn->Query( sprintf($phrases_sql,$language_id, implode(',',$phrase_types), '\''.implode('\',\'',$module_ids).'\'' ) );
+ if($rows)
+ {
+ $ret .= "\t\t".''."\n";
+ foreach($rows as $row)
+ {
+ $data = $this->_exportEncoding == 'base64' ? base64_encode($row['Translation']) : '';
+ $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], $data );
+ }
+ $ret .= "\t\t".''."\n";
+ }
+
+ // email events
+ if( in_array('In-Portal',$module_ids) ) unset( $module_ids[array_search('',$module_ids)] ); // for old language packs
+ $module_sql = preg_replace('/(.*) OR $/', '\\1', preg_replace('/(.*),/U', 'INSTR(Module,\'\\1\') OR ', implode(',', $module_ids).',' ) );
+
+ $sql = 'SELECT EventId FROM '.$mainevents_table.' WHERE '.$module_sql;
+ $event_ids = $this->Conn->GetCol($sql);
+
+ if($event_ids)
+ {
+ $ret .= "\t\t".''."\n";
+ $event_sql = ' SELECT em.*
+ FROM '.$emailevents_table.' em
+ LEFT JOIN '.$mainevents_table.' e ON e.EventId = em.EventId
+ WHERE em.LanguageId = %s AND em.EventId IN (%s)
+ ORDER BY e.Event, e.Type';
+ $rows = $this->Conn->Query( sprintf($event_sql,$language_id, $event_ids ? implode(',',$event_ids) : '' ) );
+ foreach($rows as $row)
+ {
+ if (!array_key_exists($row['EventId'], $this->events_hash)) {
+ // don't export existing translations of missing events
+ continue;
+ }
+
+ list($event_name, $event_type) = explode('_', $this->events_hash[ $row['EventId'] ] );
+ $data = $this->_exportEncoding == 'base64' ? base64_encode($row['Template']) : '';
+ $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, $data );
+ }
+ $ret .= "\t\t".''."\n";
+ }
+ $ret .= "\t".''."\n";
+ }
+
+ $ret .= '';
+ fwrite($fp, $ret);
+ fclose($fp);
+
+ return true;
+ }
+
+ /**
+ * Sets language pack encoding (not charset) used during export
+ *
+ * @param string $encoding
+ */
+ function setExportEncoding($encoding)
+ {
+ $this->_exportEncoding = $encoding;
+ }
+
+ /**
+ * Performs upgrade of given language pack part
+ *
+ * @param int $language_id
+ * @param string $prefix
+ * @param string $unique_field
+ */
+ function _performUpgrade($language_id, $prefix, $unique_field)
+ {
+ // TODO: find a way to compare (intersect,diff) phrases in non-case sensitive way, but keeping original case in result
+ $live_records = $this->_getTableData($language_id, $prefix, $unique_field, false);
+ $temp_records = $this->_getTableData($language_id, $prefix, $unique_field, true);
+
+ if ($this->import_mode == LANG_OVERWRITE_EXISTING) {
+ // remove existing records before copy
+ $common_records = array_intersect($temp_records, $live_records);
+ if ($common_records) {
+ $live_records = array_diff($live_records, $common_records); // remove overlaping records
+ $common_records = array_map(Array(&$this->Conn, 'qstr'), $common_records);
+
+ $sql = 'DELETE FROM ' . $this->Application->getUnitOption($prefix, 'TableName') . '
+ WHERE (LanguageId = ' . $language_id . ') AND (' . $unique_field . ' IN (' . implode(',', $common_records) . '))';
+ $this->Conn->Query($sql);
+ }
+ }
+
+ $temp_records = array_diff($temp_records, $live_records);
+
+ if (!$temp_records) {
+ // no new records found in temp table while comparing it to live table
+ return ;
+ }
+
+ $temp_records = array_map(Array(&$this->Conn, 'qstr'), $temp_records);
+
+ $sql = 'INSERT INTO ' . $this->Application->getUnitOption($prefix, 'TableName') . '
+ SELECT *
+ FROM ' . $this->_tables[$prefix] . '
+ WHERE (LanguageId = ' . $language_id . ')';
+
+ if ($live_records) {
+ // subsctract live records from temp table during coping
+ $sql .= ' AND (' . $unique_field . ' IN (' . implode(',', $temp_records) . '))';
+ }
+
+ $this->Conn->Query($sql);
+ }
+
+ /**
+ * Returns data from given table used for language pack upgrade
+ *
+ * @param int $language_id
+ * @param string $prefix
+ * @param string $unique_field
+ * @param bool $temp_mode
+ * @return Array
+ */
+ function _getTableData($language_id, $prefix, $unique_field, $temp_mode = false)
+ {
+ $table_name = $this->Application->getUnitOption($prefix, 'TableName');
+
+ if ($temp_mode) {
+ $table_name = $this->Application->GetTempName($table_name, 'prefix:' . $prefix);
+ }
+
+ $sql = 'SELECT ' . $unique_field . '
+ FROM ' . $table_name . '
+ WHERE LanguageId = ' . $language_id;
+ return $this->Conn->GetCol($sql);
+ }
+
+ function _parseXML($filename)
+ {
+ if ($this->_debugMode) {
+ $start_time = getmicrotime();
+ $this->Application->Debugger->appendHTML(__CLASS__ . '::' . __FUNCTION__ . '("' . $filename . '")');
+ }
+
+ $fdata = file_get_contents($filename);
+
+ $xml_parser =& $this->Application->recallObject('kXMLHelper');
+ /* @var $xml_parser kXMLHelper */
+
+ $root_node =& $xml_parser->Parse($fdata);
+ if (!is_object($root_node) || !is_a($root_node, 'kXMLNode')) {
+ // invalid language pack contents
+ return false;
+ }
+
+ if ($root_node->Children) {
+ $this->_processLanguages($root_node->firstChild);
+ }
+
+ if ($this->_debugMode) {
+ $this->Application->Debugger->appendHTML(__CLASS__ . '::' . __FUNCTION__ . '("' . $filename . '"): ' . (getmicrotime() - $start_time));
+ }
+
+ return true;
+ }
+
+ /**
+ * Creates temporary tables, used during language import
+ *
+ * @param bool $drop_only
+ */
+ function _initImportTables($drop_only = false)
+ {
+ $this->_tables['phrases'] = $this->_prepareTempTable('phrases', $drop_only);
+ $this->_tables['emailmessages'] = $this->_prepareTempTable('emailmessages', $drop_only);
+ }
+
+ /**
+ * Create temp table for prefix, if table already exists, then delete it and create again
+ *
+ * @param string $prefix
+ */
+ function _prepareTempTable($prefix, $drop_only = false)
+ {
+ $idfield = $this->Application->getUnitOption($prefix, 'IDField');
+ $table = $this->Application->getUnitOption($prefix,'TableName');
+ $temp_table = $this->Application->GetTempName($table);
+
+ $sql = 'DROP TABLE IF EXISTS %s';
+ $this->Conn->Query( sprintf($sql, $temp_table) );
+
+ if (!$drop_only) {
+ $sql = 'CREATE TABLE %s SELECT * FROM %s WHERE 0';
+ $this->Conn->Query( sprintf($sql, $temp_table, $table) );
+
+ $sql = 'ALTER TABLE %1$s CHANGE %2$s %2$s INT(11) NOT NULL';
+ $this->Conn->Query( sprintf($sql, $temp_table, $idfield) );
+ }
+
+ return $temp_table;
+ }
+
+ /**
+ * Prepares mapping between event name+type and their ids in database
+ *
+ */
+ function _updateEventsCache()
+ {
+ $sql = 'SELECT EventId, CONCAT(Event,"_",Type) AS EventMix
+ FROM ' . TABLE_PREFIX . 'Events';
+ $this->events_hash = $this->Conn->GetCol($sql, 'EventMix');
+ }
+
+ /**
+ * Processes parsed XML
+ *
+ * @param kXMLNode $language_node
+ */
+ function _processLanguages(&$language_node)
+ {
+ $field_mapping = Array (
+ 'DATEFORMAT' => 'DateFormat',
+ 'TIMEFORMAT' => 'TimeFormat',
+ 'INPUTDATEFORMAT' => 'InputDateFormat',
+ 'INPUTTIMEFORMAT' => 'InputTimeFormat',
+ 'DECIMAL' => 'DecimalPoint',
+ 'THOUSANDS' => 'ThousandSep',
+ 'CHARSET' => 'Charset',
+ 'UNITSYSTEM' => 'UnitSystem',
+ );
+
+ do {
+ $language_id = false;
+
+ $fields_hash = Array (
+ 'PackName' => $language_node->Attributes['PACKNAME'],
+ 'LocalName' => $language_node->Attributes['PACKNAME'],
+ 'Encoding' => $language_node->Attributes['ENCODING'],
+ 'Charset' => 'iso-8859-1',
+ );
+
+ $sub_node =& $language_node->firstChild;
+ /* @var $sub_node kXMLNode */
+
+ do {
+ switch ($sub_node->Name) {
+ case 'PHRASES':
+ if ($sub_node->Children) {
+ if (!$language_id) {
+ $language_id = $this->_processLanguage($fields_hash);
+ }
+
+ if ($this->_debugMode) {
+ $start_time = getmicrotime();
+ }
+
+ $this->_processPhrases($sub_node->firstChild, $language_id, $fields_hash['Encoding']);
+
+ if ($this->_debugMode) {
+ $this->Application->Debugger->appendHTML(__CLASS__ . '::' . '_processPhrases: ' . (getmicrotime() - $start_time));
+ }
+ }
+ break;
+
+ case 'EVENTS':
+ if ($sub_node->Children) {
+ if (!$language_id) {
+ $language_id = $this->_processLanguage($fields_hash);
+ }
+
+ $this->_processEvents($sub_node->firstChild, $language_id, $fields_hash['Encoding']);
+ }
+ break;
+
+ default:
+ $fields_hash[ $field_mapping[$sub_node->Name] ] = $sub_node->Data;
+ break;
+ }
+ } while (($sub_node =& $sub_node->NextSibling()));
+ } while (($language_node =& $language_node->NextSibling()));
+ }
+
+ /**
+ * Performs phases import
+ *
+ * @param kXMLNode $phrase_node
+ * @param int $language_id
+ * @param string $language_encoding
+ */
+ function _processPhrases(&$phrase_node, $language_id, $language_encoding)
+ {
+ do {
+ $fields_hash = Array (
+ 'LanguageId' => $language_id,
+ 'Phrase' => $phrase_node->Attributes['LABEL'],
+ 'PhraseType' => $phrase_node->Attributes['TYPE'],
+ 'Module' => array_key_exists('MODULE', $phrase_node->Attributes) ? $phrase_node->Attributes['MODULE'] : 'Core',
+ 'LastChanged' => adodb_mktime(),
+ 'LastChangeIP' => $this->ip_address,
+ 'Translation' => $phrase_node->Data,
+ );
+
+ if (array_key_exists($fields_hash['PhraseType'], $this->phrase_types_allowed)) {
+ if ($language_encoding != 'plain') {
+ $fields_hash['Translation'] = base64_decode($fields_hash['Translation']);
+ }
+
+ $this->Conn->doInsert($fields_hash, $this->_tables['phrases'], 'INSERT', false);
+ }
+ } while (($phrase_node =& $phrase_node->NextSibling()));
+
+ $this->Conn->doInsert($fields_hash, $this->_tables['phrases'], 'INSERT');
+ }
+
+ /**
+ * Performs email event import
+ *
+ * @param kXMLNode $event_node
+ * @param int $language_id
+ * @param string $language_encoding
+ */
+ function _processEvents(&$event_node, $language_id, $language_encoding)
+ {
+ do {
+ $event_id = $this->_getEventId($event_node->Attributes['EVENT'], $event_node->Attributes['TYPE']);
+ if ($event_id) {
+ $fields_hash = Array (
+ 'LanguageId' => $language_id,
+ 'EventId' => $event_id,
+ 'MessageType' => $event_node->Attributes['MESSAGETYPE'],
+ );
+
+ if ($language_encoding == 'plain') {
+ $fields_hash['Template'] = rtrim($event_node->Data);
+ }
+ else {
+ $fields_hash['Template'] = base64_decode($event_node->Data);
+ }
+
+ $this->Conn->doInsert($fields_hash, $this->_tables['emailmessages'], 'INSERT', false);
+ }
+ } while (($event_node =& $event_node->NextSibling()));
+
+ $this->Conn->doInsert($fields_hash, $this->_tables['emailmessages'], 'INSERT');
+ }
+
+ /**
+ * Creates/updates language based on given fields and returns it's id
+ *
+ * @param Array $fields_hash
+ * @return int
+ */
+ function _processLanguage($fields_hash)
+ {
+ // 1. get language from database
+ $sql = 'SELECT ' . $this->lang_object->IDField . '
+ FROM ' . $this->lang_object->TableName . '
+ WHERE PackName = ' . $this->Conn->qstr($fields_hash['PackName']);
+ $language_id = $this->Conn->GetOne($sql);
+
+ if ($language_id) {
+ // 2. language found -> update, when allowed
+ $this->lang_object->Load($language_id);
+
+ if ($this->import_mode == LANG_OVERWRITE_EXISTING) {
+ // update live language record based on data from xml
+ $this->lang_object->SetFieldsFromHash($fields_hash);
+ $this->lang_object->Update();
+ }
+ }
+ else {
+ // 3. language not found -> create
+ $this->lang_object->SetFieldsFromHash($fields_hash);
+ $this->lang_object->SetDBField('Enabled', STATUS_ACTIVE);
+
+ if ($this->lang_object->Create()) {
+ $language_id = $this->lang_object->GetID();
+
+ if (defined('IS_INSTALL') && IS_INSTALL) {
+ // language created during install becomes admin interface language
+ $this->lang_object->setPrimary(true, true);
+ }
+ }
+ }
+
+ // 4. collect ID of every processed language
+ if (!in_array($language_id, $this->_languages)) {
+ $this->_languages[] = $language_id;
+ }
+
+ return $language_id;
+ }
+
+ /**
+ * Returns event id based on it's name and type
+ *
+ * @param string $event_name
+ * @param string $event_type
+ * @return int
+ */
+ function _getEventId($event_name, $event_type)
+ {
+ $cache_key = $event_name . '_' . $event_type;
+
+ return array_key_exists($cache_key, $this->events_hash) ? $this->events_hash[$cache_key] : 0;
+ }
+ }
\ No newline at end of file
Index: branches/RC/core/kernel/db/db_connection.php
===================================================================
diff -u -r11408 -r11711
--- branches/RC/core/kernel/db/db_connection.php (.../db_connection.php) (revision 11408)
+++ branches/RC/core/kernel/db/db_connection.php (.../db_connection.php) (revision 11711)
@@ -617,21 +617,46 @@
return $this->errorMessage;
}
- function doInsert($fields_hash, $table, $type = 'INSERT')
+ /**
+ * Performs insert of given data (useful with small number of queries)
+ * or stores it to perform multiple insert later (useful with large number of queries)
+ *
+ * @param Array $fields_hash
+ * @param string $table
+ * @param string $type
+ * @param bool $insert_now
+ * @return bool
+ */
+ function doInsert($fields_hash, $table, $type = 'INSERT', $insert_now = true)
{
- $fields_sql = '';
+ static $value_sqls = Array ();
+
+ if ($insert_now) {
+ $fields_sql = '`' . implode('`,`', array_keys($fields_hash)) . '`';
+ }
+
$values_sql = '';
foreach ($fields_hash as $field_name => $field_value) {
- $fields_sql .= '`'.$field_name.'`,';
$values_sql .= ( is_null($field_value) ? 'NULL' : $this->qstr($field_value) ) . ',';
}
// don't use preg here, as it may fail when string is too long
- $fields_sql = rtrim($fields_sql, ',');
- $values_sql = rtrim($values_sql, ',');
- $sql = strtoupper($type).' INTO `'.$table.'` ('.$fields_sql.') VALUES ('.$values_sql.')';
+ $value_sqls[] = rtrim($values_sql, ',');
- return $this->ChangeQuery($sql);
+ $insert_result = true;
+ if ($insert_now) {
+ $insert_count = count($value_sqls);
+ if (($insert_count > 1) && ($value_sqls[$insert_count - 1] == $value_sqls[$insert_count - 2])) {
+ // last two records are the same
+ array_pop($value_sqls);
+ }
+
+ $sql = strtoupper($type) . ' INTO `' . $table . '` (' . $fields_sql . ') VALUES (' . implode('),(', $value_sqls) . ')';
+ $insert_result = $this->ChangeQuery($sql);
+ $value_sqls = Array ();
+ }
+
+ return $insert_result;
}
function doUpdate($fields_hash, $table, $key_clause)
@@ -643,8 +668,8 @@
$fields_sql .= '`'.$field_name.'` = ' . ( is_null($field_value) ? 'NULL' : $this->qstr($field_value) ) . ',';
}
- // don't use preg here!
- $fields_sql = rtrim($fields_sql, ',');
+ // don't use preg here, as it may fail when string is too long
+ $fields_sql = rtrim($fields_sql, ',');
$sql = 'UPDATE `'.$table.'` SET '.$fields_sql.' WHERE '.$key_clause;
Index: branches/RC/core/units/email_messages/email_messages_config.php
===================================================================
diff -u -r11677 -r11711
--- branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11677)
+++ branches/RC/core/units/email_messages/email_messages_config.php (.../email_messages_config.php) (revision 11711)
@@ -101,7 +101,7 @@
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif'),
'Fields' => Array(
- 'Subject' => Array( 'title'=>'la_col_Subject', 'filter_block' => 'grid_like_filter'),
+ 'Subject' => Array( 'title'=>'la_col_Subject', 'filter_block' => 'grid_like_filter'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td', 'filter_block' => 'grid_like_filter'),
'Type' => Array( 'title'=>'la_col_Type', 'filter_block' => 'grid_options_filter'),
),
@@ -111,6 +111,7 @@
'Emails' => Array(
'Icons' => Array ('default' => 'icon16_custom.gif'),
'Fields' => Array(
+ 'EventId' => Array( 'title'=>'la_col_Id', 'filter_block' => 'grid_range_filter'),
'Subject' => Array( 'title'=>'la_col_Subject', 'filter_block' => 'grid_like_filter'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td', 'filter_block' => 'grid_like_filter'),
'Type' => Array( 'title'=>'la_col_Type', 'filter_block' => 'grid_options_filter'),
Index: branches/RC/core/kernel/utility/factory.php
===================================================================
diff -u -r8929 -r11711
--- branches/RC/core/kernel/utility/factory.php (.../factory.php) (revision 8929)
+++ branches/RC/core/kernel/utility/factory.php (.../factory.php) (revision 11711)
@@ -201,6 +201,10 @@
trigger_error('Real Class '.$real_class.' is not registered with the Factory', E_USER_ERROR);
}
if(!file_exists(FULL_PATH.$this->Files[$real_class])) {
+ if ($this->Application->isDebugMode()) {
+ $this->Application->Debugger->appendTrace();
+ }
+
trigger_error('Include file for class '.$real_class.' ('.FULL_PATH.$this->Files[$real_class].') does not exists', E_USER_ERROR);
}
Index: branches/RC/core/install/english.lang
===================================================================
diff -u -r11685 -r11711
--- branches/RC/core/install/english.lang (.../english.lang) (revision 11685)
+++ branches/RC/core/install/english.lang (.../english.lang) (revision 11711)
@@ -118,6 +118,7 @@
Rmlyc3QgTmFtZQ==
QWxsb3cgUmVnaXN0cmF0aW9uIG9uIEZyb250LWVuZA==
R3JvdXAgTmFtZQ==
+ SGl0cw==
SUQ=
SW1hZ2U=
U3RhdHVz
@@ -180,6 +181,7 @@
UmF0aW5n
UmVmZXJlcg==
UmVsYXRpb24gVHlwZQ==
+ UmV2aWV3IENvdW50
UmV2aWV3ZWQgQnk=
UmV2aWV3IFRleHQ=
UnVsZSBUeXBl
@@ -1571,13 +1573,15 @@
UmVzZXQgU2VjdGlvbnMgQ2FjaGU=
Q2xvbmU=
Q2xvbmU=
+ Q29udGludWU=
RG93bg==
TW9kaWZ5
RXhwb3J0
R28gVXA=
SW1wb3J0
RG93bg==
VXA=
+ TmV3
UmVidWlsZA==
UmVzY2FuIFRoZW1lcw==
UmVzZXQ=
@@ -2276,6 +2280,7 @@
UHJpbnQ=
UHJvY2VzcyBRdWV1ZQ==
UmVidWlsZCBDYXRlZ29yeSBDYWNoZQ==
+ UmVjYWxjdWxhdGUgUHJpb3JpdGllcw==
UmVmcmVzaA==
RGVsZXRlIFVzZXIgRnJvbSBHcm91cA==
UmVzY2FuIFRoZW1lcw==
Index: branches/RC/core/admin_templates/skins/skin_edit.tpl
===================================================================
diff -u -r11707 -r11711
--- branches/RC/core/admin_templates/skins/skin_edit.tpl (.../skin_edit.tpl) (revision 11707)
+++ branches/RC/core/admin_templates/skins/skin_edit.tpl (.../skin_edit.tpl) (revision 11711)
@@ -55,8 +55,6 @@
-
-
@@ -84,7 +82,7 @@
-
+
Index: branches/RC/core/units/users/users_config.php
===================================================================
diff -u -r11623 -r11711
--- branches/RC/core/units/users/users_config.php (.../users_config.php) (revision 11623)
+++ branches/RC/core/units/users/users_config.php (.../users_config.php) (revision 11711)
@@ -349,7 +349,7 @@
'LastName' => Array( 'title'=>'la_col_LastName', 'filter_block' => 'grid_like_filter'),
'FirstName' => Array( 'title'=>'la_col_FirstName', 'filter_block' => 'grid_like_filter'),
'Email' => Array( 'title'=>'la_col_Email', 'filter_block' => 'grid_like_filter'),
- 'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_options_filter'),
+ 'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_like_filter'),
'CreatedOn' => Array('title' => 'la_col_CreatedOn', 'filter_block' => 'grid_date_range_filter'),
),
),
@@ -363,7 +363,7 @@
'LastName' => Array( 'title'=>'la_col_LastName', 'filter_block' => 'grid_like_filter'),
'FirstName' => Array( 'title'=>'la_col_FirstName', 'filter_block' => 'grid_like_filter'),
'Email' => Array( 'title'=>'la_col_Email', 'filter_block' => 'grid_like_filter'),
- 'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_options_filter'),
+ 'PrimaryGroup' => Array( 'title'=>'la_col_PrimaryGroup', 'filter_block' => 'grid_like_filter'),
'CreatedOn' => Array('title' => 'la_col_CreatedOn', 'filter_block' => 'grid_date_range_filter'),
),
),
Index: branches/RC/core/units/general/helpers/sections_helper.php
===================================================================
diff -u -r11353 -r11711
--- branches/RC/core/units/general/helpers/sections_helper.php (.../sections_helper.php) (revision 11353)
+++ branches/RC/core/units/general/helpers/sections_helper.php (.../sections_helper.php) (revision 11711)
@@ -41,7 +41,10 @@
return ;
}
- $this->Application->UnitConfigReader->ReReadConfigs();
+ if (!(defined('IS_INSTALL') && IS_INSTALL)) {
+ // don't reread all configs during install, because they are reread on every install step
+ $this->Application->UnitConfigReader->ReReadConfigs();
+ }
$this->Tree = Array();
Index: branches/RC/core/install/upgrades.sql
===================================================================
diff -u -r11685 -r11711
--- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11685)
+++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11711)
@@ -1314,7 +1314,7 @@
SET SimpleSearch = 0
WHERE FieldType NOT IN ('text', 'range') AND SimpleSearch = 1;
-DELETE FROM PersistantSessionData WHERE VariableName IN ('c_columns_.', 'c.showall_columns_.');
+DELETE FROM PersistantSessionData WHERE VariableName IN ('c_columns_.', 'c.showall_columns_.', 'emailevents_columns_.', 'emailmessages_columns_.');
DELETE FROM Modules WHERE Name = 'Proj-Base';
UPDATE Modules SET Version = '5.0.0', Loaded = 1 WHERE Name = 'In-Portal';
\ No newline at end of file
Index: branches/RC/core/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -r11685 -r11711
--- branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 11685)
+++ branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 11711)
@@ -69,7 +69,7 @@
@@ -613,7 +613,7 @@
-
+
Index: branches/RC/core/units/general/helpers/search_helper.php
===================================================================
diff -u -r11538 -r11711
--- branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 11538)
+++ branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 11711)
@@ -331,7 +331,7 @@
// update "custom filter" with values from submit: begin
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
- $custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name, ALLOW_DEFAULT_SETTINGS);
+ $custom_filters = $this->Application->RecallPersistentVar($event->getPrefixSpecial().'_custom_filter.'.$view_name/*, ALLOW_DEFAULT_SETTINGS*/);
if ($custom_filters) {
$custom_filters = unserialize($custom_filters);
$custom_filter = isset($custom_filters[$grid_name]) ? $custom_filters[$grid_name] : Array ();
@@ -414,7 +414,7 @@
}
$view_name = $this->Application->RecallVar($prefix_special . '_current_view');
- $custom_filters = $this->Application->RecallPersistentVar($prefix_special . '_custom_filter.' . $view_name, ALLOW_DEFAULT_SETTINGS);
+ $custom_filters = $this->Application->RecallPersistentVar($prefix_special . '_custom_filter.' . $view_name/*, ALLOW_DEFAULT_SETTINGS*/);
if (!$custom_filters) {
// filters not defined for given prefix
$cache[$cache_key] = false;
Index: branches/RC/core/admin_templates/catalog/catalog.tpl
===================================================================
diff -u -r11693 -r11711
--- branches/RC/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 11693)
+++ branches/RC/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 11711)
@@ -201,7 +201,13 @@
$menu.addItem(rs('editcat'), '', 'javascript:executeButton("editcat");');
$menu.addItem(rs('export'), '', 'javascript:executeButton("export");');
+ $menu.addSeparator();
$menu.addItem(rs('rebuild_cache'), '', 'javascript:executeButton("rebuild_cache");');
+
+ if ($Catalog.ActivePrefix == 'c') {
+ $menu.addItem(rs('recalculate_priorities'), '', 'javascript:executeButton("recalculate_priorities");');
+ }
+
renderMenus();
nls_showMenu(rs('tools_menu'), a_toolbar.GetButtonImage('rebuild_cache'));
@@ -235,6 +241,11 @@
case 'rebuild_cache':
openSelector('c', '');
break;
+
+ case 'recalculate_priorities':
+ $Catalog.submit_event('c', 'OnRecalculatePriorities');
+ break;
+
}
}
Index: branches/RC/core/install.php
===================================================================
diff -u -r11623 -r11711
--- branches/RC/core/install.php (.../install.php) (revision 11623)
+++ branches/RC/core/install.php (.../install.php) (revision 11711)
@@ -154,7 +154,7 @@
if (!$this->toolkit->getSystemConfig('Misc', 'WriteablePath')) {
// set global writable folder when such setting is missing
- $this->toolkit->setSystemConfig('Misc', 'WriteablePath', '/system');
+ $this->toolkit->setSystemConfig('Misc', 'WriteablePath', DIRECTORY_SEPARATOR . 'system');
$this->toolkit->SaveConfig(true); // immediately save, because this path will be used in Application later
}
@@ -687,7 +687,7 @@
$config_values = Array (
'RootPass' => $password,
'Site_Path' => BASE_PATH.'/', // set Site_Path (for SSL & old in-portal code)
- 'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . '/backupdata',
+ 'Backup_Path' => FULL_PATH . $this->toolkit->getSystemConfig('Misc', 'WriteablePath') . DIRECTORY_SEPARATOR . 'backupdata',
'Smtp_AdminMailFrom' => 'portal@' . $this->toolkit->getSystemConfig('Intechnic', 'Domain')
);
Index: branches/RC/core/units/general/helpers/helpers_config.php
===================================================================
diff -u -r11368 -r11711
--- branches/RC/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 11368)
+++ branches/RC/core/units/general/helpers/helpers_config.php (.../helpers_config.php) (revision 11711)
@@ -32,5 +32,6 @@
Array ('pseudo' => 'TemplateHelper', 'class' => 'TemplateHelper', 'file' => 'template_helper.php', 'build_event' => '', 'require_classes' => 'kHelper'),
Array ('pseudo' => 'MailingListHelper', 'class' => 'MailingListHelper', 'file' => 'mailing_list_helper.php', 'build_event' => '', 'require_classes' => 'kHelper'),
Array ('pseudo' => 'JSONHelper', 'class' => 'JSONHelper', 'file' => 'json_helper.php', 'build_event' => '', 'require_classes' => 'kHelper'),
+ Array ('pseudo' => 'LanguageImportHelper', 'class' => 'LanguageImportHelper', 'file' => 'language_import_helper.php', 'build_event' => '', 'require_classes' => 'kHelper'),
),
);
\ No newline at end of file
Index: branches/RC/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl
===================================================================
diff -u -r11623 -r11711
--- branches/RC/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl (.../item_selector_catalog.tpl) (revision 11623)
+++ branches/RC/core/admin_templates/catalog/item_selector/item_selector_catalog.tpl (.../item_selector_catalog.tpl) (revision 11711)
@@ -15,7 +15,7 @@
"/>
|
Index: branches/RC/core/units/category_items/category_items_tag_processor.php
===================================================================
diff -u -r11538 -r11711
--- branches/RC/core/units/category_items/category_items_tag_processor.php (.../category_items_tag_processor.php) (revision 11538)
+++ branches/RC/core/units/category_items/category_items_tag_processor.php (.../category_items_tag_processor.php) (revision 11711)
@@ -10,7 +10,7 @@
/* @var $object kDBList */
$root_phrase = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
- $cached_navbar = preg_replace('/^Content&\|&/i', '', $object->GetDBField($field));
+ $cached_navbar = preg_replace('/^(Content&\|&|Content)/i', '', $object->GetDBField($field));
$value = str_replace('&|&', ' > ', $cached_navbar);
$ret = $root_phrase . ($value ? ' > ' : '') . $value;
Index: branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js
===================================================================
diff -u -r11678 -r11711
--- branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 11678)
+++ branches/RC/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 11711)
@@ -540,14 +540,29 @@
vertical: $window.outerHeight() - $window.height()
};
+ var $top = $(window).scrollTop() + Math.round((pagesize[1] - TB.Height - $borders.vertical) / 2);
+ var $left = Math.round((pagesize[0] - TB.Width - $borders.horizontal) / 2);
+
$window.css(
{
width: TB.Width + 'px',
- height: TB.Height + 'px',
- left: Math.round((pagesize[0] - TB.Width - $borders.horizontal) / 2) + 'px',
- top: $(window).scrollTop() + Math.round((pagesize[1] - TB.Height - $borders.vertical) / 2) + 'px'
+ height: TB.Height + 'px'
}
- )
+ );
+
+ if ($left > 0) {
+ // when something large is opened from right, then we got negative left
+ // (negative values breaks down "draggable.containment")
+ $window.css('left', $left + 'px');
+ }
+
+ if ($top > 0) {
+ // when Firebug console is opened from bottom, then we got negative top
+ // (negative values breaks down "draggable.containment")
+ $window.css('top', $top + 'px');
+ }
+
+ $window
.resizable(
{
alsoResize: '#' + TB.getId('TB_iframeContent'),
Index: branches/RC/core/units/email_events/email_events_config.php
===================================================================
diff -u -r11654 -r11711
--- branches/RC/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 11654)
+++ branches/RC/core/units/email_events/email_events_config.php (.../email_events_config.php) (revision 11711)
@@ -81,6 +81,7 @@
'Default' => Array (
'Icons' => Array('default'=>'icon16_custom.gif'),
'Fields' => Array(
+ 'EventId' => Array('title' => 'la_col_Id', 'filter_block' => 'grid_range_filter'),
'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td', 'filter_block' => 'grid_like_filter'),
'Event' => Array( 'title'=>'la_col_Event', 'filter_block' => 'grid_like_filter'),
'Module' => Array( 'title'=>'la_col_Module', 'filter_block' => 'grid_like_filter'),
Index: branches/RC/core/admin_templates/catalog_tab.tpl
===================================================================
diff -u -r11668 -r11711
--- branches/RC/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 11668)
+++ branches/RC/core/admin_templates/catalog_tab.tpl (.../catalog_tab.tpl) (revision 11711)
@@ -55,7 +55,12 @@
- ">
+
+
+
+
+
+
@@ -69,25 +74,25 @@
*
-
+
-
-
-
+
+
+
+
+
-
+
-
-
-
+ ##-->
Index: branches/RC/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl
===================================================================
diff -u -r11623 -r11711
--- branches/RC/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 11623)
+++ branches/RC/core/admin_templates/catalog/item_selector/item_selector_advanced_view.tpl (.../item_selector_advanced_view.tpl) (revision 11711)
@@ -21,7 +21,7 @@
this.switchTab();
}
- var $Catalog = new Catalog('', 'is_advanced_view_', 0);
+ var $Catalog = new Catalog('', 'is_advanced_view_', 0);
Index: branches/RC/core/install/install_toolkit.php
===================================================================
diff -u -r11693 -r11711
--- branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11693)
+++ branches/RC/core/install/install_toolkit.php (.../install_toolkit.php) (revision 11711)
@@ -75,7 +75,7 @@
$this->Conn =& $this->Application->GetADODBConnection();
}
- $this->INIFile = FULL_PATH . '/config.php';
+ $this->INIFile = FULL_PATH . DIRECTORY_SEPARATOR . 'config.php';
$this->systemConfig = $this->ParseConfig(true);
}
@@ -325,6 +325,7 @@
*
* @param string $lang_file
* @param bool $upgrade
+ * @todo Import for "core/install/english.lang" (322KB) takes 18 seconds to work on Windows
*/
function ImportLanguage($lang_file, $upgrade = false)
{
@@ -333,10 +334,10 @@
return ;
}
- $lang_xml =& $this->Application->recallObject('LangXML');
- /* @var $lang_xml LangXML_Parser */
+ $language_import_helper =& $this->Application->recallObject('LanguageImportHelper');
+ /* @var $language_import_helper LanguageImportHelper */
- $lang_xml->Parse($lang_file, '|0|1|2|', '', $upgrade ? LANG_SKIP_EXISTING : LANG_OVERWRITE_EXISTING);
+ $language_import_helper->performImport($lang_file, '|0|1|2|', '', $upgrade ? LANG_SKIP_EXISTING : LANG_OVERWRITE_EXISTING);
}
/**
@@ -438,7 +439,7 @@
function SaveConfig($silent = false)
{
- if (!is_writeable($this->INIFile)) {
+ if (!is_writable($this->INIFile) && !is_writable(dirname($this->INIFile))) {
trigger_error('Cannot write to "' . $this->INIFile . '" file.', $silent ? E_USER_NOTICE : E_USER_ERROR);
return ;
}
@@ -612,8 +613,13 @@
function linkCustomFields($module_folder, $prefix, $item_type)
{
$module_folder = strtolower($module_folder);
- $module_name = ($module_folder == 'kernel') ? 'in-portal' : $module_folder;
+ $module_name = $module_folder;
+ if ($module_folder == 'kernel') {
+ $module_name = 'in-portal';
+ $module_folder = 'core';
+ }
+
$db =& $this->Application->GetADODBConnection();
$sql = 'SELECT FieldName, CustomFieldId
@@ -632,8 +638,10 @@
// because of configs was read only from installed before modules (in-portal), then reread configs
$unit_config_reader =& $this->Application->recallObject('kUnitConfigReader');
- $unit_config_reader->scanModules(MODULES_PATH . '/' . $module_folder);
+ /* @var $unit_config_reader kUnitConfigReader */
+ $unit_config_reader->scanModules(MODULES_PATH . DIRECTORY_SEPARATOR . $module_folder);
+
// create correct columns in CustomData table
$ml_helper =& $this->Application->recallObject('kMultiLanguageHelper');
$ml_helper->createFields($prefix . '-cdata', true);
Index: branches/RC/core/units/languages/languages_config.php
===================================================================
diff -u -r11635 -r11711
--- branches/RC/core/units/languages/languages_config.php (.../languages_config.php) (revision 11635)
+++ branches/RC/core/units/languages/languages_config.php (.../languages_config.php) (revision 11711)
@@ -6,9 +6,6 @@
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'LanguagesEventHandler','file'=>'languages_event_handler.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'LanguagesTagProcessor','file'=>'languages_tag_processor.php','build_event'=>'OnBuild'),
- 'RegisterClasses' => Array(
- Array('pseudo'=>'LangXML','class'=>'LangXML_Parser','file'=>'import_xml.php'),
- ),
'AutoLoad' => true,
'Hooks' => Array(
Index: branches/RC/core/kernel/application.php
===================================================================
diff -u -r11702 -r11711
--- branches/RC/core/kernel/application.php (.../application.php) (revision 11702)
+++ branches/RC/core/kernel/application.php (.../application.php) (revision 11711)
@@ -1950,7 +1950,7 @@
$cache_key = $this->GetVar('t').$this->GetVar('m_theme').$this->GetVar('m_lang').$this->IsAdmin();
$query = sprintf("SELECT PhraseList, ConfigVariables FROM %s WHERE Template = %s",
TABLE_PREFIX.'PhraseCache',
- $this->Conn->Qstr(md5($cache_key)));
+ $this->Conn->qstr(md5($cache_key)));
$res = $this->Conn->GetRow($query);
if ($res) {
Index: branches/RC/core/units/languages/languages_event_handler.php
===================================================================
diff -u -r11674 -r11711
--- branches/RC/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 11674)
+++ branches/RC/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 11711)
@@ -249,11 +249,11 @@
$filename = getArrayValue($field_values, 'LangFile', 'tmp_name');
if ( filesize($filename) ) {
- $lang_xml =& $this->Application->recallObject('LangXML');
- /* @var $lang_xml LangXML_Parser */
+ $language_import_helper =& $this->Application->recallObject('LanguageImportHelper');
+ /* @var $language_import_helper LanguageImportHelper */
$modules = getArrayValue($field_values, 'Module');
- $lang_xml->Parse($filename, $field_values['PhraseType'], $modules, $field_values['ImportOverwrite'] ? LANG_OVERWRITE_EXISTING : LANG_SKIP_EXISTING);
+ $language_import_helper->performImport($filename, $field_values['PhraseType'], $modules, $field_values['ImportOverwrite'] ? LANG_OVERWRITE_EXISTING : LANG_SKIP_EXISTING);
$event->SetRedirectParam('opener', 'u');
}
@@ -315,12 +315,15 @@
if( substr($field_values['LangFile'], -5) != '.lang' ) $field_values['LangFile'] .= '.lang';
$filename = EXPORT_PATH.'/'.$field_values['LangFile'];
- $lang_xml =& $this->Application->recallObject('LangXML');
+ $language_import_helper =& $this->Application->recallObject('LanguageImportHelper');
+ /* @var $language_import_helper LanguageImportHelper */
+
if ($object->GetDBField('DoNotEncode')) {
- $lang_xml->SetEncoding('plain');
+ $language_import_helper->setExportEncoding('plain');
}
- $lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']);
+ $language_import_helper->performExport($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']);
+
}
$event->redirect = 'regional/languages_export_step2';
Index: branches/RC/core/admin_templates/js/script.js
===================================================================
diff -u -r11576 -r11711
--- branches/RC/core/admin_templates/js/script.js (.../script.js) (revision 11576)
+++ branches/RC/core/admin_templates/js/script.js (.../script.js) (revision 11711)
@@ -591,11 +591,11 @@
return false;
}
-function std_precreate_item(prefix_special, edit_template)
+function std_precreate_item(prefix_special, edit_template, $onAfterOpenPopup)
{
set_hidden_field(prefix_special+'_mode', 't');
if (use_popups(prefix_special, 'OnPreCreate')) {
- open_popup(prefix_special, 'OnPreCreate', edit_template);
+ open_popup(prefix_special, 'OnPreCreate', edit_template, null, $onAfterOpenPopup);
}
else {
opener_action('d');
@@ -604,10 +604,10 @@
// set_hidden_field(prefix_special+'_mode', '');
}
-function std_new_item(prefix_special, edit_template)
+function std_new_item(prefix_special, edit_template, $onAfterOpenPopup)
{
if (use_popups(prefix_special, 'OnNew')) {
- open_popup(prefix_special, 'OnNew', edit_template);
+ open_popup(prefix_special, 'OnNew', edit_template, null, $onAfterOpenPopup);
}
else {
opener_action('d');
@@ -628,10 +628,10 @@
// set_hidden_field(prefix_special+'_mode', '');
}
-function std_edit_temp_item(prefix_special, edit_template)
+function std_edit_temp_item(prefix_special, edit_template, $onAfterOpenPopup)
{
if (use_popups(prefix_special, '')) {
- open_popup(prefix_special, '', edit_template);
+ open_popup(prefix_special, '', edit_template, null, $onAfterOpenPopup);
}
else {
opener_action('d');
Index: branches/RC/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r11682 -r11711
--- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11682)
+++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 11711)
@@ -734,7 +734,7 @@
$view_name = $this->Application->RecallVar($event->getPrefixSpecial().'_current_view');
$storage_prefix = $event->getEventParam('same_special') ? $event->Prefix : $event->getPrefixSpecial();
- $per_page = $this->Application->RecallPersistentVar($storage_prefix.'_PerPage.'.$view_name, '_USE_DEFAULT_USER_DATA_');
+ $per_page = $this->Application->RecallPersistentVar($storage_prefix.'_PerPage.'.$view_name, ALLOW_DEFAULT_SETTINGS);
if (!$per_page) {
// per-page is stored to current session
@@ -2110,6 +2110,8 @@
if ($event->Special == 'export' || $event->Special == 'import')
{
$export_helper =& $this->Application->recallObject('CatItemExportHelper');
+ /* @var $export_helper kCatDBItemExportHelper */
+
$export_helper->prepareExportColumns($event);
}
}
Index: branches/RC/core/units/general/cat_dbitem_export.php
===================================================================
diff -u -r11693 -r11711
--- branches/RC/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 11693)
+++ branches/RC/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 11711)
@@ -1139,6 +1139,11 @@
{
$object =& $event->getObject( Array('skip_autoload' => true) );
+ if (!array_key_exists('ExportColumns', $object->Fields)) {
+ // import/export prefix was used (see kDBEventHandler::prepareObject) but object don't plan to be imported/exported
+ return ;
+ }
+
$available_columns = Array();
if ($this->Application->getUnitOption($event->Prefix, 'CatalogItem')) {
Index: branches/RC/core/units/general/helpers/modules.php
===================================================================
diff -u -r11702 -r11711
--- branches/RC/core/units/general/helpers/modules.php (.../modules.php) (revision 11702)
+++ branches/RC/core/units/general/helpers/modules.php (.../modules.php) (revision 11711)
@@ -148,7 +148,7 @@
}
$modules = Array();
- $vars = parse_portal_ini(FULL_PATH . '/config.php');
+ $vars = parse_portal_ini(FULL_PATH . DIRECTORY_SEPARATOR . 'config.php');
$license = array_key_exists('License', $vars) ? base64_decode($vars['License']) : false;
if ($license) {
list ( , , $i_Keys) = $this->_ParseLicense($license);
@@ -163,13 +163,14 @@
}
}
else {
+ // all already installed modules are licensed for localhost
$modules = array_keys($this->Application->ModuleInfo);
}
}
// all modules starting from "in-" doesn't require license
$base_modules = Array ('Core', 'In-Portal', 'Custom');
- $modules = array_merge($modules, $base_modules, $this->_getFreeModules());
+ $modules = array_merge($modules, $base_modules, $this->_getFreeModules($vars));
$modules = array_unique( array_map('strtolower', $modules) );
return $modules;
@@ -180,9 +181,15 @@
*
* @return Array
*/
- function _getFreeModules()
+ function _getFreeModules($vars)
{
- $skip_modules = Array ('.', '..', 'in-commerce', 'in-auction');
+ $skip_modules = Array ('.', '..');
+ $domain = $this->_GetDomain($vars);
+
+ if (!$this->_IsLocalSite($domain)) {
+ array_push($skip_modules, 'in-commerce', 'in-auction');
+ }
+
$folder = dir(MODULES_PATH);
$ret = Array ();
Index: branches/RC/core/kernel/utility/debugger.php
===================================================================
diff -u -r11501 -r11711
--- branches/RC/core/kernel/utility/debugger.php (.../debugger.php) (revision 11501)
+++ branches/RC/core/kernel/utility/debugger.php (.../debugger.php) (revision 11711)
@@ -251,12 +251,20 @@
$ip = trim($ip);
if ($network == $ip) {
- // comparing 2 ip addresses directly
+ // comparing two ip addresses directly
return true;
}
$d = strpos($network, '-');
- if ($d === false) {
+ if ($d !== false) {
+ // ip address range specified
+ $from = ip2long(trim(substr($network, 0, $d)));
+ $to = ip2long(trim(substr($network, $d + 1)));
+
+ $ip = ip2long($ip);
+ return ($ip >= $from && $ip <= $to);
+ }
+ elseif (strpos($network, '/') !== false) {
// sigle subnet specified
$ip_arr = explode('/', $network);
@@ -272,14 +280,8 @@
return ($ip_long & $mask) == ($network_long & $mask);
}
- else {
- // ip address range specified
- $from = ip2long(trim(substr($network, 0, $d)));
- $to = ip2long(trim(substr($network, $d + 1)));
- $ip = ip2long($ip);
- return ($ip >= $from && $ip <= $to);
- }
+ return false;
}
function InitReport()
Index: branches/RC/core/admin_templates/categories/ci_blocks.tpl
===================================================================
diff -u -r11698 -r11711
--- branches/RC/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 11698)
+++ branches/RC/core/admin_templates/categories/ci_blocks.tpl (.../ci_blocks.tpl) (revision 11711)
@@ -14,22 +14,28 @@
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
Index: branches/RC/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r11693 -r11711
--- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11693)
+++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 11711)
@@ -955,8 +955,6 @@
/* @var $object kDBList */
$params['value'] = $this->SearchField($params);
- $view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view');
- $custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name, ALLOW_DEFAULT_SETTINGS);
return $this->PredefinedOptions($params);
}
@@ -1868,7 +1866,7 @@
$field = $this->SelectParam($params, 'field,name');
$view_name = $this->Application->RecallVar($this->getPrefixSpecial().'_current_view');
- $custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name, ALLOW_DEFAULT_SETTINGS);
+ $custom_filter = $this->Application->RecallPersistentVar($this->getPrefixSpecial().'_custom_filter.'.$view_name/*, ALLOW_DEFAULT_SETTINGS*/);
$custom_filter = $custom_filter ? unserialize($custom_filter) : Array();
if (isset($custom_filter[ $params['grid'] ][$field])) {
Index: branches/RC/core/kernel/session/session.php
===================================================================
diff -u -r11682 -r11711
--- branches/RC/core/kernel/session/session.php (.../session.php) (revision 11682)
+++ branches/RC/core/kernel/session/session.php (.../session.php) (revision 11711)
@@ -131,7 +131,9 @@
$query = ' SELECT * FROM '.$this->TableName.' WHERE '.$this->IDField.' = '.$this->Conn->qstr($sid);
$result = $this->Conn->GetRow($query);
- if($result===false) return false;
+ if ($result === false) {
+ return false;
+ }
$this->DirectVars = $result;
@@ -332,7 +334,7 @@
function RecallPersistentVar(&$session, $var_name, $default = false)
{
if ($session->RecallVar('user_id') == -2) {
- if ($default == '_USE_DEFAULT_USER_DATA_') {
+ if ($default == ALLOW_DEFAULT_SETTINGS) {
$default = null;
}
return $session->RecallVar($var_name, $default);
@@ -341,7 +343,7 @@
if (array_key_exists($var_name, $this->PersistentVars)) {
return $this->PersistentVars[$var_name];
}
- elseif ($default == '_USE_DEFAULT_USER_DATA_') {
+ elseif ($default == ALLOW_DEFAULT_SETTINGS) {
$default_user_id = $this->Application->ConfigValue('DefaultSettingsUserId');
if (!$default_user_id) {
$default_user_id = -1;
Index: branches/RC/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -r11403 -r11711
--- branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 11403)
+++ branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 11711)
@@ -21,14 +21,32 @@
var $AfterConfigProcessed = array();
/**
- * Scan kernel and user classes
- * for available configs
- *
- * @access protected
- */
+ * Escaped directory separator for using in regular expressions
+ *
+ * @var string
+ */
+ var $_directorySeparator = '';
+
+ /**
+ * Folders to skip during unit config search
+ *
+ * @var Array
+ */
+ var $_skipFolders = Array ('CVS', '.svn', 'admin_templates', 'libchart');
+
+ /**
+ * Scan kernel and user classes
+ * for available configs
+ *
+ * @access protected
+ */
function Init($prefix,$special)
{
parent::Init($prefix,$special);
+
+ $this->_directorySeparator = preg_quote(DIRECTORY_SEPARATOR);
+ $this->_skipFolders[] = trim(WRITEBALE_BASE, '/'); // system folder (where web server can write)
+ $this->_skipFolders[] = array_pop( explode('/', trim(EDITOR_PATH, '/')) ); // last of cmseditor folders
}
function CacheParsedData()
@@ -170,30 +188,52 @@
$this->StoreCache = $cache;
}
- function findConfigFiles($folderPath)
+ function findConfigFiles($folderPath, $level = 0)
{
+ /*if ($level == 0) {
+ if ($this->Application->isDebugMode()) {
+ $start_time = getmicrotime();
+ $this->Application->Debugger->appendHTML('kUnitConfigReader::findConfigFiles("' . $folderPath . '")');
+ $this->Application->Debugger->appendTrace();
+ }
+ }*/
+
// if FULL_PATH = "/" ensure, that all "/" in $folderPath are not deleted
- $reg_exp = '/^'.preg_quote(FULL_PATH, '/').'/';
+ $reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/';
$folderPath = preg_replace($reg_exp, '', $folderPath, 1); // this make sense, since $folderPath may NOT contain FULL_PATH
- $fh = opendir(FULL_PATH.$folderPath);
- while (($sub_folder = readdir($fh))) {
- $full_path = FULL_PATH.$folderPath.'/'.$sub_folder;
- if ($this->isDir($full_path)) {
- if (preg_match('/^\./', $sub_folder)) continue; // don't scan .folders
- //the following is to exclude OLD, not removed files when upgrading to 'core'
- if (preg_match('/^\/kernel\/kernel4\//', $folderPath) || ($folderPath == '/kernel/units' && file_exists(FULL_PATH.$this->getConfigName('/core/units/'.$sub_folder)))) {
- continue;
- }
- if (file_exists(FULL_PATH.$this->getConfigName($folderPath.'/'.$sub_folder))) {
- $this->configFiles[] = $this->getConfigName($folderPath.'/'.$sub_folder);
- }
- $this->findConfigFiles($full_path);
+ $base_folder = FULL_PATH . $folderPath . DIRECTORY_SEPARATOR;
+ $sub_folders = glob($base_folder . '*', GLOB_ONLYDIR);
- // if (filemtime($full_path) > $cached) { }
+ if ($level == 0) {
+ // don't scan Front-End themes because of extensive directory structure
+ $sub_folders = array_diff($sub_folders, Array ($base_folder . 'themes', $base_folder . 'tools'));
+ }
+ foreach ($sub_folders as $full_path) {
+ $sub_folder = substr($full_path, strlen($base_folder));
+
+ if (in_array($sub_folder, $this->_skipFolders)) {
+ continue;
}
+
+ if (preg_match('/^\./', $sub_folder)) {
+ // don't scan ".folders"
+ continue;
+ }
+
+ if (file_exists(FULL_PATH . $this->getConfigName($folderPath . DIRECTORY_SEPARATOR . $sub_folder))) {
+ $this->configFiles[] = $this->getConfigName($folderPath . DIRECTORY_SEPARATOR . $sub_folder);
+ }
+
+ $this->findConfigFiles($full_path, $level + 1);
}
+
+ /*if ($level == 0) {
+ if ($this->Application->isDebugMode()) {
+ $this->Application->Debugger->appendHTML('kUnitConfigReader::findConfigFiles("' . FULL_PATH . $folderPath . '"): ' . (getmicrotime() - $start_time));
+ }
+ }*/
}
function includeConfigFiles($folderPath, $cache = true)
@@ -209,6 +249,12 @@
shuffle($this->configFiles);
}
else {
+ $old_kernel_path = FULL_PATH . DIRECTORY_SEPARATOR . 'kernel' . DIRECTORY_SEPARATOR . 'kernel4';
+ if (file_exists($old_kernel_path)) {
+ // when we got both kernel (one from "kernel/kernel4" and other from "core/kernel") version after upgrade
+ die('Please remove "' . $old_kernel_path . '" folder.');
+ }
+
$this->findConfigFiles($folderPath); // search from base directory
}
@@ -347,12 +393,12 @@
}
/**
- * Register nessasary classes
- * This method should only process the data which is cached!
- *
- * @param string $prefix
- * @access private
- */
+ * Register nessasary classes
+ * This method should only process the data which is cached!
+ *
+ * @param string $prefix
+ * @access private
+ */
function parseConfig($prefix)
{
$config =& $this->configData[$prefix];
@@ -380,9 +426,10 @@
}
$config['_Dependencies'][$class_info['class']] = array_merge($config['_Dependencies'][$class_info['class']], $require_classes);
}
+
$this->Application->registerClass(
$class_info['class'],
- $config['BasePath'].'/'.$class_info['file'],
+ $config['BasePath'] . DIRECTORY_SEPARATOR . $class_info['file'],
$class_info['pseudo']/*,
getArrayValue($class_info, 'require_classes')*/
);
@@ -626,36 +673,42 @@
{
$config_found = file_exists(FULL_PATH.$filename) && $this->configAllowed($filename);
- if( defined('DEBUG_MODE') && DEBUG_MODE && constOn('DBG_PROFILE_INCLUDES') )
- {
- if ( in_array($filename, get_required_files()) ) return;
+ if (defined('DEBUG_MODE') && DEBUG_MODE && defined('DBG_PROFILE_INCLUDES') && DBG_PROFILE_INCLUDES) {
+ if ( in_array($filename, get_required_files()) ) {
+ return;
+ }
+
global $debugger;
- if($config_found) {
- $file = FULL_PATH.$filename;
- $debugger->ProfileStart('inc_'.crc32($file), $file);
+
+ if ($config_found) {
+ $file = FULL_PATH . $filename;
+ $file_crc = crc32($file);
+
+ $debugger->ProfileStart('inc_' . $file_crc, $file);
include_once($file);
- $debugger->ProfileFinish('inc_'.crc32($file));
- $debugger->profilerAddTotal('includes', 'inc_'.crc32($file));
+ $debugger->ProfileFinish('inc_' . $file_crc);
+ $debugger->profilerAddTotal('includes', 'inc_' . $file_crc);
}
}
- else
- {
- if ($config_found) include_once(FULL_PATH.$filename);
+ elseif ($config_found) {
+ include_once(FULL_PATH . $filename);
}
if ($config_found) {
if (isset($config) && $config) {
// config file is included for 1st time -> save it's content for future processing
- $prefix = isset($config['Prefix']) ? $config['Prefix'] : '';
+ $prefix = array_key_exists('Prefix', $config) ? $config['Prefix'] : '';
- preg_match('/\/(.*)\//U', $filename, $rets);
+ preg_match('#' . $this->_directorySeparator . '(.*)' . $this->_directorySeparator . '#U', $filename, $rets);
$config['ModuleFolder'] = $rets[1];
- $config['BasePath'] = dirname(FULL_PATH.$filename);
- if (isset($config['AdminTemplatePath'])) {
+ $config['BasePath'] = dirname(FULL_PATH . $filename);
+
+ if (array_key_exists('AdminTemplatePath', $config)) {
// append template base folder for admin templates path of this prefix
- $module_templates = $rets[1] == 'core' ? '' : $rets[1].'/';
- $config['AdminTemplatePath'] = $module_templates.$config['AdminTemplatePath'];
+ $module_templates = $rets[1] == 'core' ? '' : $rets[1] . '/';
+ $config['AdminTemplatePath'] = $module_templates . $config['AdminTemplatePath'];
}
+
$this->configData[$prefix] = $config;
$this->prefixFiles[$prefix] = $filename;
return $prefix;
@@ -666,6 +719,7 @@
return $prefix;
}
}
+
return 'dummy';
}
@@ -692,15 +746,15 @@
}
/**
- * Reads unit (specified by $prefix)
- * option specified by $option
- *
- * @param string $prefix
- * @param string $name
- * @param mixed $default
- * @return string
- * @access public
- */
+ * Reads unit (specified by $prefix)
+ * option specified by $option
+ *
+ * @param string $prefix
+ * @param string $name
+ * @param mixed $default
+ * @return string
+ * @access public
+ */
function getUnitOption($prefix, $name, $default = false)
{
if (preg_match('/(.*)\.(.*)/', $prefix, $rets)) {
@@ -721,12 +775,12 @@
}
/**
- * Read all unit with $prefix options
- *
- * @param string $prefix
- * @return Array
- * @access public
- */
+ * Read all unit with $prefix options
+ *
+ * @param string $prefix
+ * @return Array
+ * @access public
+ */
function getUnitOptions($prefix)
{
if (!isset($this->configData[$prefix])) {
@@ -737,13 +791,13 @@
}
/**
- * Set's new unit option value
- *
- * @param string $prefix
- * @param string $name
- * @param string $value
- * @access public
- */
+ * Set's new unit option value
+ *
+ * @param string $prefix
+ * @param string $name
+ * @param string $value
+ * @access public
+ */
function setUnitOption($prefix, $name, $value)
{
if (preg_match('/(.*)\.(.*)/', $prefix, $rets)) {
@@ -773,71 +827,60 @@
}
/**
- * Get's config file name based
- * on folder name supplied
- *
- * @param string $folderPath
- * @return string
- * @access private
- */
+ * Get's config file name based
+ * on folder name supplied
+ *
+ * @param string $folderPath
+ * @return string
+ * @access private
+ */
function getConfigName($folderPath)
{
- return $folderPath.'/'.basename($folderPath).'_config.php';
+ return $folderPath . DIRECTORY_SEPARATOR . basename($folderPath) . '_config.php';
}
/**
- * is_dir ajustment to work with
- * directory listings too
- *
- * @param string $folderPath
- * @return bool
- * @access private
- */
- function isDir($folderPath)
- {
- $base_name = basename($folderPath);
- $ret = !( $base_name == '.' || $base_name == '..' );
- return $ret && is_dir($folderPath);
- }
-
- /**
- * Checks if config file is allowed for includion (if module of config is installed)
- *
- * @param string $config_path relative path from in-portal directory
- */
+ * Checks if config file is allowed for includion (if module of config is installed)
+ *
+ * @param string $config_path relative path from in-portal directory
+ */
function configAllowed($config_path)
{
if (defined('IS_INSTALL') && IS_INSTALL) {
// at installation start no modules in db and kernel configs could not be read
return true;
}
- if (preg_match('#/plugins/|/core#', $config_path)) {
+ if (preg_match('#' . $this->_directorySeparator . 'plugins' . $this->_directorySeparator . '|' . $this->_directorySeparator . 'core#', $config_path)) {
+ // always allow to include configs from core and plugins folder
return true;
}
$module_found = false;
- if (!$this->Application->ModuleInfo) return false;
+ if (!$this->Application->ModuleInfo) {
+ return false;
+ }
- foreach($this->Application->ModuleInfo as $module_name => $module_info)
- {
- $module_path = '/'.$module_info['Path'];
- if (preg_match('/^'.preg_quote($module_path, '/').'/', $config_path)) {
- // if (mb_substr($config_path, 0, mb_strlen($module_path)) == $module_path) {
- // config file path starts with module folder path
+ foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
+ $module_path = DIRECTORY_SEPARATOR . trim($module_info['Path'], '/') . DIRECTORY_SEPARATOR;
+
+ // config file path starts with module folder path
+ if (substr($config_path, 0, strlen($module_path)) == $module_path) {
+// if (preg_match('#^' . preg_quote($module_path, '/') . '#', $config_path)) {
$module_found = true;
break;
}
}
+
return $module_found;
}
/**
- * Returns true if config exists and is allowed for reading
- *
- * @param string $prefix
- * @return bool
- */
+ * Returns true if config exists and is allowed for reading
+ *
+ * @param string $prefix
+ * @return bool
+ */
function prefixRegistred($prefix)
{
return isset($this->prefixFiles[$prefix]) ? true : false;