Index: branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php =================================================================== diff -u -r4248 -r4534 --- branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4248) +++ branches/unlabeled/unlabeled-1.19.2/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4534) @@ -11,7 +11,7 @@ function OnReflectMultiLingualFields($event) { $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); - + $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader'); foreach ($unit_config_reader->configData as $prefix => $config_data) { $ml_helper->createFields($prefix); @@ -34,7 +34,7 @@ $object->setPrimary(); } } - + /** * [HOOK] Reset primary status of other languages if we are saving primary language * @@ -44,29 +44,29 @@ { $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SwitchToLive(); - + // set primary for each languages, that have this checkbox checked $ids = explode(',', $event->MasterEvent->getEventParam('ids')); foreach ($ids as $id) { $object->Load($id); if ($object->GetDBField('PrimaryLang')) { $object->setPrimary(); } - + } - + // if no primary language left, then set primary last language (not to load again) from edited list $sql = 'SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE PrimaryLang = 1'; $primary_language = $this->Conn->GetOne($sql); - + if (!$primary_language) { $object->setPrimary(false); } } - - + + /** * Occurse before updating item * @@ -82,7 +82,7 @@ $object->SetDBField($status_field, 1); } } - + /** * Shows only enabled languages on front * @@ -261,7 +261,7 @@ { $done_percent = 100; } - + $block_params = Array( 'name' => $template_name, 'title' => $import_titles[$import_source], 'percent_done' => $done_percent, @@ -373,6 +373,9 @@ $filename = EXPORT_PATH.'/'.$field_values['LangFile']; $lang_xml =& $this->Application->recallObject('LangXML'); + if ($object->GetDBField('DoNotEncode')) { + $lang_xml->SetEncoding('plain'); + } $lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']); } Index: branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl =================================================================== diff -u -r3666 -r4534 --- branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 3666) +++ branches/unlabeled/unlabeled-1.6.10/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 4534) @@ -21,7 +21,7 @@ submit_event('lang', 'OnGoBack'); } ) ); - + a_toolbar.Render(); @@ -30,20 +30,20 @@ - + - + "> - + -
" id="" value="" />  
+ + - \ No newline at end of file Index: branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php =================================================================== diff -u -r2211 -r4534 --- branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php (.../phrases_config.php) (revision 2211) +++ branches/unlabeled/unlabeled-1.4.48/kernel/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4534) @@ -7,8 +7,8 @@ 'EventHandlerClass' => Array('class'=>'PhrasesEventHandler','file'=>'phrases_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 'AutoLoad' => true, - - 'Hooks' => Array( + + 'Hooks' => Array( Array( 'Mode' => hBEFORE, 'Conditional' => false, @@ -19,7 +19,7 @@ 'DoSpecial' => '', 'DoEvent' => 'OnBeforePhraseCreate', ), - + Array( 'Mode' => hAFTER, 'Conditional' => false, @@ -31,29 +31,29 @@ 'DoEvent' => 'OnSetLastUpdated', ), ), - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', 4 => 'label', ), 'IDField' => 'PhraseId', - + 'StatusField' => Array('Type'), - + 'TitleField' => 'Phrase', - + 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'), 'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'), 'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'), ), - + 'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'), - + ), - + 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_front','show_admin','show_both'), 'type' => WHERE_FILTER), @@ -64,36 +64,36 @@ 'show_both' => Array('label' => 'la_PhraseType_Both', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 2' ), ) ), - + 'TableName' => TABLE_PREFIX.'Phrase', - + 'CalculatedFields' => Array( '' => Array( 'PrimaryTranslation' => 'pri.Translation', ), - + ), - + 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)'), - + 'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)',), - + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('Phrase' => 'asc'), ) ), - + 'ForeignKey' => 'LanguageId', 'ParentTableKey' => 'LanguageId', 'ParentPrefix' => 'lang', 'AutoDelete' => true, 'AutoClone' => true, - + 'Fields' => Array( 'Phrase' => Array('type' => 'string','required'=>1,'unique'=>Array('LanguageId'),'not_null' => '1','default' => ''), 'Translation' => Array('type' => 'string','required'=>1,'not_null' => '1','default' => ''), @@ -104,13 +104,14 @@ 'LastChangeIP' => Array('type' => 'string','not_null' => '1','default' => ''), 'Module' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules ORDER BY Name', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'), ), - - 'VirtualFields' => Array( + + 'VirtualFields' => Array( 'PrimaryTranslation' => Array(), 'LangFile' => Array(), 'ImportOverwrite' => Array(), + 'DoNotEncode' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_language_var.gif'), @@ -122,7 +123,7 @@ 'LastChanged' => Array( 'title'=>'la_col_LastChanged' ), 'Module' => Array( 'title'=>'la_col_Module' ), ), - + ), ), ); Index: branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php =================================================================== diff -u -r3984 -r4534 --- branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 3984) +++ branches/unlabeled/unlabeled-1.16.2/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 4534) @@ -1,101 +1,108 @@ Conn =& $this->Application->GetADODBConnection(); - + $this->Application->SetVar('lang_mode', 't'); - + $this->tables['lang'] = $this->prepareTempTable('lang'); $this->Application->setUnitOption('lang','AutoLoad',false); $this->lang_object =& $this->Application->recallObject('lang.imp'); - + $this->tables['phrases'] = $this->prepareTempTable('phrases'); $this->tables['emailmessages'] = $this->prepareTempTable('emailmessages'); - + $sql = 'SELECT EventId, CONCAT(Event,"_",Type) AS EventMix FROM '.TABLE_PREFIX.'Events'; $this->events_hash = $this->Conn->GetCol($sql, 'EventMix'); - + $this->ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR'); } - + + function SetEncoding($enc) + { + $this->Encoding = $enc; + } + function renameTable($table_prefix, $new_name) { $this->Conn->Query('ALTER TABLE '.$this->tables[$table_prefix].' RENAME '.$new_name); $this->tables[$table_prefix] = $new_name; } - + /** * Create temp table for prefix, if table already exists, then delete it and create again * @@ -106,56 +113,56 @@ $idfield = $this->Application->getUnitOption($prefix, 'IDField'); $table = $this->Application->getUnitOption($prefix,'TableName'); $temp_table = kTempTablesHandler::GetTempName($table); - + $sql = 'DROP TABLE IF EXISTS %s'; $this->Conn->Query( sprintf($sql, $temp_table) ); - + $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; } - + function Parse($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; - + $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; - + //if (in_array('In-Portal',) - + $xml_parser = xml_parser_create(); xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') ); xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') ); - + $fdata = file_get_contents($filename); - + $ret = xml_parse($xml_parser, $fdata); - xml_parser_free($xml_parser); // clean up the parser object - + xml_parser_free($xml_parser); // clean up the parser object + $this->Application->SetVar('lang_mode', ''); return $ret; } - + function startElement(&$parser, $element, $attributes) { array_push($this->path, $element); $path = implode(' ',$this->path); //check what path we are in - + switch($path) { case 'LANGUAGES LANGUAGE': - $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME']); - + $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME'], 'Encoding' => $attributes['ENCODING']); + $sql = 'SELECT %s FROM %s WHERE PackName = %s'; $sql = sprintf( $sql, $this->lang_object->IDField, @@ -169,27 +176,27 @@ $this->lang_object->Load($language_id); } break; - + case 'LANGUAGES LANGUAGE PHRASES': case 'LANGUAGES LANGUAGE EVENTS': if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1'; $this->lang_object->SetFieldsFromHash($this->current_language); - + if( !getArrayValue($this->current_language,'LanguageId') ) { if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID(); } elseif($this->import_mode == LANG_OVERWRITE_EXISTING) { $this->lang_object->TableName = $this->Application->getUnitOption($this->lang_object->Prefix, 'TableName'); - $this->lang_object->Update(); + $this->lang_object->Update(); } break; - + case 'LANGUAGES LANGUAGE PHRASES PHRASE': $phrase_module = getArrayValue($attributes,'MODULE'); if(!$phrase_module) $phrase_module = 'In-Portal'; - + $this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'], 'Phrase' => $attributes['LABEL'], 'PhraseType' => $attributes['TYPE'], @@ -198,41 +205,41 @@ 'LastChangeIP' => $this->ip_address, 'Translation' => ''); break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': $this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'], 'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ], 'MessageType' => $attributes['MESSAGETYPE'], 'Template' => ''); break; - - + + } - - // if($path == 'SHIPMENT PACKAGE') + + // if($path == 'SHIPMENT PACKAGE') } - - function characterData(&$parser, $line) - { + + function characterData(&$parser, $line) + { $line = trim($line); if(!$line) return ; - - $path = join (' ',$this->path); - + + $path = join (' ',$this->path); + $language_nodes = Array('DATEFORMAT','TIMEFORMAT','INPUTDATEFORMAT','INPUTTIMEFORMAT','DECIMAL','THOUSANDS','CHARSET','UNITSYSTEM'); - - + + $node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat', 'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat', - + 'LANGUAGES LANGUAGE INPUTDATEFORMAT'=> 'InputDateFormat', 'LANGUAGES LANGUAGE INPUTTIMEFORMAT'=> 'InputTimeFormat', - + 'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint', 'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep', 'LANGUAGES LANGUAGE CHARSET' => 'Charset', 'LANGUAGES LANGUAGE UNITSYSTEM' => 'UnitSystem'); - + if( in_array( end($this->path), $language_nodes) ) { $this->current_language[ $node_field_map[$path] ] = $line; @@ -247,57 +254,67 @@ $this->current_phrase['Translation'] .= $line; } break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': $this->current_event['Template'] .= $line; break; - } + } } } - + function endElement(&$parser, $element) { $path = implode(' ',$this->path); - + switch($path) { case 'LANGUAGES LANGUAGE PHRASES PHRASE': if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) ) { - $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); + if ($this->current_language['Encoding'] == 'plain') { + // nothing to decode! + } + else { + $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); + } $this->insertRecord($this->tables['phrases'], $this->current_phrase); } break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': - $this->current_event['Template'] = base64_decode($this->current_event['Template']); + if ($this->current_language['Encoding'] == 'plain') { + // nothing to decode! + } + else { + $this->current_event['Template'] = base64_decode($this->current_event['Template']); + } $this->insertRecord($this->tables['emailmessages'],$this->current_event); break; } - + array_pop($this->path); } - + function insertRecord($table, $fields_hash) { $fields = ''; $values = ''; - + foreach($fields_hash as $field_name => $field_value) { $fields .= '`'.$field_name.'`,'; $values .= $this->Conn->qstr($field_value).','; } - + $fields = preg_replace('/(.*),$/', '\\1', $fields); $values = preg_replace('/(.*),$/', '\\1', $values); - + $sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')'; $this->Conn->Query($sql); - + // return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all } - + /** * Creates XML file with exported language data * @@ -310,17 +327,17 @@ { $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'; @@ -329,12 +346,12 @@ { // languages $row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) ); - $ret .= "\t".''.$row['DateFormat'].''; + $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 @@ -344,18 +361,19 @@ $ret .= "\t\t".''."\n"; foreach($rows as $row) { - $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], base64_encode($row['Translation']) ); + $data = $this->Encoding == '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"; @@ -368,13 +386,14 @@ foreach($rows as $row) { list($event_name, $event_type) = explode('_', $this->events_hash[ $row['EventId'] ] ); - $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, base64_encode($row['Template']) ); + $data = $this->Encoding == '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); Index: branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt =================================================================== diff -u -r3393 -r4534 --- branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt (.../editcategory_general.txt) (revision 3393) +++ branches/unlabeled/unlabeled-1.2.20/kernel/admin/include/help/editcategory_general.txt (.../editcategory_general.txt) (revision 4534) @@ -5,6 +5,9 @@
  • Description - this is the category description
  • Automatic Directory Name � specifies whether the Directory Name used for mod_rewrite should be generated automatically from the category name, or entered manually. If checked, the Directory Name will be generated from the category name, replacing all special characters ( !@#$%^&*()+|\=-~`{}][:��;,./?>< ) by the underscore character (�_�), and all multiple underscores with a single underscore. If the resulting name ends with an underscore followed by number, an additional letter will be appended, since the names ending with a number are reserved for system use. The resulting name will also be checked for uniqueness, and if it�s not unique, additional letters will be appended to the end of the name
  • Directory Name � the directory name used for the URL generation when using mod_rewrite. The field is disabled if Automatic Directory Name is On. If Automatic Directory Name is Off, the administrator may enter the directory name manually, however it will still be checked for uniqueness, special characters and whether it ends with a number. In such cases the Directory Name will be automatically corrected before saving. +
  • Category Temple � the template file name used for displaying category index (item listing). If not explicitly set, the template filename will be inherited from the parent category, or taken from the URL if present. When used in conjunction with mod_rewrite, the template name will be eliminated from the URLs pointing to the category index, deduced by matching the category name from the URLs. The Category Template may be set to different values for different categories providing the ability to adjust the design of different categories. +
  • Item Template � the template file name used for displaying items (such as links, products, articles etc) inside the given category. Works exactly the same way as the Category Template, except it�s used for URLs pointing to an item. +
  • �Editor' � this icon that looks like a notepad and a pen, will pop up the online HTML editor for the category description. It will only work if the Enable HTML check box is checked.
  • Status � this is the category status
  • New � this is the control for the �New' flag. The �auto' setting will let the system set the �new' flag automatically, based on the number of days since its creation and a setting; �always' will enable the flag, and �never' will disable it. Index: branches/unlabeled/unlabeled-1.21.2/admin/help/manual.pdf =================================================================== diff -u -r4249 -r4534 Binary files differ Index: branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php =================================================================== diff -u -r4354 -r4534 --- branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4354) +++ branches/unlabeled/unlabeled-1.5.52/core/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4534) @@ -1,122 +1,130 @@ -'iterateItems', - 'OnMassDecline'=>'iterateItems', - 'OnMassMoveUp'=>'iterateItems', - 'OnMassMoveDown'=>'iterateItems', - ); - - $this->eventMethods = array_merge($this->eventMethods, $common_events); - } - - /** - * Apply same processing to each item beeing selected in grid - * - * @param kEvent $event - * @access private - */ - function iterateItems(&$event) - { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { - return; - } - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $object =& $event->getObject(); - $this->StoreSelectedIDs($event); - $ids=$this->getSelectedIDs($event); - - if($ids) - { - $status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') ); - - foreach($ids as $id) - { - $object->Load($id); - - switch ($event->Name) - { - case 'OnMassApprove': - $object->SetDBField($status_field, 1); - break; - - case 'OnMassDecline': - $object->SetDBField($status_field, 0); - break; - - case 'OnMassMoveUp': - $object->SetDBField('Priority', $object->GetDBField('Priority') + 1); - break; - - case 'OnMassMoveDown': - $object->SetDBField('Priority', $object->GetDBField('Priority') - 1); - break; - } - - if( $object->Update() ) - { - $event->status=erSUCCESS; - $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay! - } - else - { - $event->status=erFAIL; - $event->redirect=false; - break; - } - } - } - } - - /** - * Enter description here... - * - * @param kEvent $event - */ - function OnMassClone(&$event) - { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { - return; - } - - $event->status=erSUCCESS; - - $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - - $this->StoreSelectedIDs($event); - $ids=$this->getSelectedIDs($event); - - if($ids) - { - $temp->CloneItems($event->Prefix, $event->Special, $ids); - } - } - - function check_array($records, $field, $value) - { - foreach ($records as $record) - { - if ($record[$field] == $value) - { - return true; - } - } - return false; - } - - function OnPreSavePopup(&$event) - { - $event->CallSubEvent('OnPreSave'); - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->redirect = 'incs/just_close'; - } - } - - +'iterateItems', + 'OnMassDecline'=>'iterateItems', + 'OnMassMoveUp'=>'iterateItems', + 'OnMassMoveDown'=>'iterateItems', + ); + + $this->eventMethods = array_merge($this->eventMethods, $common_events); + } + + /** + * Apply same processing to each item beeing selected in grid + * + * @param kEvent $event + * @access private + */ + function iterateItems(&$event) + { + if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { + return; + } + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + $this->StoreSelectedIDs($event); + $ids=$this->getSelectedIDs($event); + + if($ids) + { + $status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') ); + + foreach($ids as $id) + { + $object->Load($id); + + switch ($event->Name) + { + case 'OnMassApprove': + $object->SetDBField($status_field, 1); + break; + + case 'OnMassDecline': + $object->SetDBField($status_field, 0); + break; + + case 'OnMassMoveUp': + $object->SetDBField('Priority', $object->GetDBField('Priority') + 1); + break; + + case 'OnMassMoveDown': + $object->SetDBField('Priority', $object->GetDBField('Priority') - 1); + break; + } + + if( $object->Update() ) + { + $event->status=erSUCCESS; + $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay! + } + else + { + $event->status=erFAIL; + $event->redirect=false; + break; + } + } + } + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnMassClone(&$event) + { + if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { + return; + } + + $event->status=erSUCCESS; + + $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); + + $this->StoreSelectedIDs($event); + $ids=$this->getSelectedIDs($event); + + if($ids) + { + $temp->CloneItems($event->Prefix, $event->Special, $ids); + } + } + + function check_array($records, $field, $value) + { + foreach ($records as $record) + { + if ($record[$field] == $value) + { + return true; + } + } + return false; + } + + function OnPreSavePopup(&$event) + { + $object =& $event->getObject(); + $this->RemoveRequiredFields($object); + $event->CallSubEvent('OnPreSave'); + + // 2. RESTORE SAVED LAST TEMPLATE AS LAST PARAM FOR FINILIZE_POPUP + $return_template = $this->Application->RecallVar('return_template'); + $this->finalizePopup($event, '', $return_template); + + +// $event->CallSubEvent('OnPreSave'); +// $event->redirect = 'incs/just_close'; + } + } + + ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php =================================================================== diff -u -r4354 -r4534 --- branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4354) +++ branches/unlabeled/unlabeled-1.5.52/kernel/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4534) @@ -1,122 +1,130 @@ -'iterateItems', - 'OnMassDecline'=>'iterateItems', - 'OnMassMoveUp'=>'iterateItems', - 'OnMassMoveDown'=>'iterateItems', - ); - - $this->eventMethods = array_merge($this->eventMethods, $common_events); - } - - /** - * Apply same processing to each item beeing selected in grid - * - * @param kEvent $event - * @access private - */ - function iterateItems(&$event) - { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { - return; - } - - $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); - $object =& $event->getObject(); - $this->StoreSelectedIDs($event); - $ids=$this->getSelectedIDs($event); - - if($ids) - { - $status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') ); - - foreach($ids as $id) - { - $object->Load($id); - - switch ($event->Name) - { - case 'OnMassApprove': - $object->SetDBField($status_field, 1); - break; - - case 'OnMassDecline': - $object->SetDBField($status_field, 0); - break; - - case 'OnMassMoveUp': - $object->SetDBField('Priority', $object->GetDBField('Priority') + 1); - break; - - case 'OnMassMoveDown': - $object->SetDBField('Priority', $object->GetDBField('Priority') - 1); - break; - } - - if( $object->Update() ) - { - $event->status=erSUCCESS; - $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay! - } - else - { - $event->status=erFAIL; - $event->redirect=false; - break; - } - } - } - } - - /** - * Enter description here... - * - * @param kEvent $event - */ - function OnMassClone(&$event) - { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { - return; - } - - $event->status=erSUCCESS; - - $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - - $this->StoreSelectedIDs($event); - $ids=$this->getSelectedIDs($event); - - if($ids) - { - $temp->CloneItems($event->Prefix, $event->Special, $ids); - } - } - - function check_array($records, $field, $value) - { - foreach ($records as $record) - { - if ($record[$field] == $value) - { - return true; - } - } - return false; - } - - function OnPreSavePopup(&$event) - { - $event->CallSubEvent('OnPreSave'); - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->redirect = 'incs/just_close'; - } - } - - +'iterateItems', + 'OnMassDecline'=>'iterateItems', + 'OnMassMoveUp'=>'iterateItems', + 'OnMassMoveDown'=>'iterateItems', + ); + + $this->eventMethods = array_merge($this->eventMethods, $common_events); + } + + /** + * Apply same processing to each item beeing selected in grid + * + * @param kEvent $event + * @access private + */ + function iterateItems(&$event) + { + if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { + return; + } + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + $this->StoreSelectedIDs($event); + $ids=$this->getSelectedIDs($event); + + if($ids) + { + $status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') ); + + foreach($ids as $id) + { + $object->Load($id); + + switch ($event->Name) + { + case 'OnMassApprove': + $object->SetDBField($status_field, 1); + break; + + case 'OnMassDecline': + $object->SetDBField($status_field, 0); + break; + + case 'OnMassMoveUp': + $object->SetDBField('Priority', $object->GetDBField('Priority') + 1); + break; + + case 'OnMassMoveDown': + $object->SetDBField('Priority', $object->GetDBField('Priority') - 1); + break; + } + + if( $object->Update() ) + { + $event->status=erSUCCESS; + $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay! + } + else + { + $event->status=erFAIL; + $event->redirect=false; + break; + } + } + } + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnMassClone(&$event) + { + if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 0)) { + return; + } + + $event->status=erSUCCESS; + + $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); + + $this->StoreSelectedIDs($event); + $ids=$this->getSelectedIDs($event); + + if($ids) + { + $temp->CloneItems($event->Prefix, $event->Special, $ids); + } + } + + function check_array($records, $field, $value) + { + foreach ($records as $record) + { + if ($record[$field] == $value) + { + return true; + } + } + return false; + } + + function OnPreSavePopup(&$event) + { + $object =& $event->getObject(); + $this->RemoveRequiredFields($object); + $event->CallSubEvent('OnPreSave'); + + // 2. RESTORE SAVED LAST TEMPLATE AS LAST PARAM FOR FINILIZE_POPUP + $return_template = $this->Application->RecallVar('return_template'); + $this->finalizePopup($event, '', $return_template); + + +// $event->CallSubEvent('OnPreSave'); +// $event->redirect = 'incs/just_close'; + } + } + + ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt =================================================================== diff -u -r4518 -r4534 --- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt (.../readme_1_1_8.txt) (revision 4518) +++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/readme_1_1_8.txt (.../readme_1_1_8.txt) (revision 4534) @@ -2,14 +2,14 @@ Intechnic Corporation, May 4, 2006 New features: - - Category Template and Item Template properties added to category edit allowing eliminating template filename in the URL when using mod_rewrite and use different template for displaying different sub-categories and items in different sub-categories - - Custom field mechanism fully redone, resulting an improved performance when querying, displaying and searching through custom fields. All custom fields data is now stored as a single record in a table rather then a record for each custom field. The table structure is automatically altered when custom fields are being added or removed. - - Extended quick search syntax in number of sections (Languages, all In-commerce sections) allowing usage of exact match (by enclosing keywords into double quotes, i.e. "exact match"), include or exclude single keywords or exact match keywords (by using +/- operators before keywords, i.e. +keyword +"exact match" -keyword1 -"exact match2") - - Save warning in the administrative console when trying to switch between sections in the tree without saving an item currently being edited lowers the possibility of accidental data loss - - Logging of Advanced Search on the front end + - Category Template and Item Template properties added to the Category Edit form, allowing to eliminate template filename in the URL when using mod_rewrite and to use a different template for displaying different sub-categories and items in different sub-categories + - Custom field mechanism fully reengineered, resulting in an improved performance when querying, displaying and searching through custom fields. All custom field data is now stored as a single record in a table rather then in a record for each custom field. The table structure is automatically altered when custom fields are being added or removed. + - Extended quick search syntax added in a number of sections (Languages, all In-commerce sections) allowing usage of exact match (by enclosing keywords into double quotes, i.e. "exact match"), allowing to include or exclude single keywords or exact match keywords (by using +/- operators before keywords, i.e. +keyword +"exact match" -keyword1 -"exact match2") + - 'Save' warning in the administrative console when trying to switch between sections in the tree without saving the current form. This lowers the possibility of accidental data loss. + - Logging of Advanced Search queries on the front end Bug fixes: - Automatic password assignment - Possibility of selecting two languages as primary - Searching and sorting of user list when editing a group - - Editing of Home category may have resulted a blank screen + - Editing of the Home category in some situations resulted in a blank screen Index: branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php =================================================================== diff -u -r4248 -r4534 --- branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4248) +++ branches/unlabeled/unlabeled-1.19.2/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4534) @@ -11,7 +11,7 @@ function OnReflectMultiLingualFields($event) { $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); - + $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader'); foreach ($unit_config_reader->configData as $prefix => $config_data) { $ml_helper->createFields($prefix); @@ -34,7 +34,7 @@ $object->setPrimary(); } } - + /** * [HOOK] Reset primary status of other languages if we are saving primary language * @@ -44,29 +44,29 @@ { $object =& $event->getObject( Array('skip_autoload' => true) ); $object->SwitchToLive(); - + // set primary for each languages, that have this checkbox checked $ids = explode(',', $event->MasterEvent->getEventParam('ids')); foreach ($ids as $id) { $object->Load($id); if ($object->GetDBField('PrimaryLang')) { $object->setPrimary(); } - + } - + // if no primary language left, then set primary last language (not to load again) from edited list $sql = 'SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE PrimaryLang = 1'; $primary_language = $this->Conn->GetOne($sql); - + if (!$primary_language) { $object->setPrimary(false); } } - - + + /** * Occurse before updating item * @@ -82,7 +82,7 @@ $object->SetDBField($status_field, 1); } } - + /** * Shows only enabled languages on front * @@ -261,7 +261,7 @@ { $done_percent = 100; } - + $block_params = Array( 'name' => $template_name, 'title' => $import_titles[$import_source], 'percent_done' => $done_percent, @@ -373,6 +373,9 @@ $filename = EXPORT_PATH.'/'.$field_values['LangFile']; $lang_xml =& $this->Application->recallObject('LangXML'); + if ($object->GetDBField('DoNotEncode')) { + $lang_xml->SetEncoding('plain'); + } $lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']); } Index: branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php =================================================================== diff -u -r3984 -r4534 --- branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php (.../import_xml.php) (revision 3984) +++ branches/unlabeled/unlabeled-1.16.2/core/units/languages/import_xml.php (.../import_xml.php) (revision 4534) @@ -1,101 +1,108 @@ Conn =& $this->Application->GetADODBConnection(); - + $this->Application->SetVar('lang_mode', 't'); - + $this->tables['lang'] = $this->prepareTempTable('lang'); $this->Application->setUnitOption('lang','AutoLoad',false); $this->lang_object =& $this->Application->recallObject('lang.imp'); - + $this->tables['phrases'] = $this->prepareTempTable('phrases'); $this->tables['emailmessages'] = $this->prepareTempTable('emailmessages'); - + $sql = 'SELECT EventId, CONCAT(Event,"_",Type) AS EventMix FROM '.TABLE_PREFIX.'Events'; $this->events_hash = $this->Conn->GetCol($sql, 'EventMix'); - + $this->ip_address = getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : getenv('REMOTE_ADDR'); } - + + function SetEncoding($enc) + { + $this->Encoding = $enc; + } + function renameTable($table_prefix, $new_name) { $this->Conn->Query('ALTER TABLE '.$this->tables[$table_prefix].' RENAME '.$new_name); $this->tables[$table_prefix] = $new_name; } - + /** * Create temp table for prefix, if table already exists, then delete it and create again * @@ -106,56 +113,56 @@ $idfield = $this->Application->getUnitOption($prefix, 'IDField'); $table = $this->Application->getUnitOption($prefix,'TableName'); $temp_table = kTempTablesHandler::GetTempName($table); - + $sql = 'DROP TABLE IF EXISTS %s'; $this->Conn->Query( sprintf($sql, $temp_table) ); - + $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; } - + function Parse($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; - + $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; - + //if (in_array('In-Portal',) - + $xml_parser = xml_parser_create(); xml_set_element_handler( $xml_parser, Array(&$this, 'startElement'), Array(&$this, 'endElement') ); xml_set_character_data_handler( $xml_parser, Array(&$this, 'characterData') ); - + $fdata = file_get_contents($filename); - + $ret = xml_parse($xml_parser, $fdata); - xml_parser_free($xml_parser); // clean up the parser object - + xml_parser_free($xml_parser); // clean up the parser object + $this->Application->SetVar('lang_mode', ''); return $ret; } - + function startElement(&$parser, $element, $attributes) { array_push($this->path, $element); $path = implode(' ',$this->path); //check what path we are in - + switch($path) { case 'LANGUAGES LANGUAGE': - $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME']); - + $this->current_language = Array('PackName' => $attributes['PACKNAME'], 'LocalName' => $attributes['PACKNAME'], 'Encoding' => $attributes['ENCODING']); + $sql = 'SELECT %s FROM %s WHERE PackName = %s'; $sql = sprintf( $sql, $this->lang_object->IDField, @@ -169,27 +176,27 @@ $this->lang_object->Load($language_id); } break; - + case 'LANGUAGES LANGUAGE PHRASES': case 'LANGUAGES LANGUAGE EVENTS': if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1'; $this->lang_object->SetFieldsFromHash($this->current_language); - + if( !getArrayValue($this->current_language,'LanguageId') ) { if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID(); } elseif($this->import_mode == LANG_OVERWRITE_EXISTING) { $this->lang_object->TableName = $this->Application->getUnitOption($this->lang_object->Prefix, 'TableName'); - $this->lang_object->Update(); + $this->lang_object->Update(); } break; - + case 'LANGUAGES LANGUAGE PHRASES PHRASE': $phrase_module = getArrayValue($attributes,'MODULE'); if(!$phrase_module) $phrase_module = 'In-Portal'; - + $this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'], 'Phrase' => $attributes['LABEL'], 'PhraseType' => $attributes['TYPE'], @@ -198,41 +205,41 @@ 'LastChangeIP' => $this->ip_address, 'Translation' => ''); break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': $this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'], 'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ], 'MessageType' => $attributes['MESSAGETYPE'], 'Template' => ''); break; - - + + } - - // if($path == 'SHIPMENT PACKAGE') + + // if($path == 'SHIPMENT PACKAGE') } - - function characterData(&$parser, $line) - { + + function characterData(&$parser, $line) + { $line = trim($line); if(!$line) return ; - - $path = join (' ',$this->path); - + + $path = join (' ',$this->path); + $language_nodes = Array('DATEFORMAT','TIMEFORMAT','INPUTDATEFORMAT','INPUTTIMEFORMAT','DECIMAL','THOUSANDS','CHARSET','UNITSYSTEM'); - - + + $node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat', 'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat', - + 'LANGUAGES LANGUAGE INPUTDATEFORMAT'=> 'InputDateFormat', 'LANGUAGES LANGUAGE INPUTTIMEFORMAT'=> 'InputTimeFormat', - + 'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint', 'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep', 'LANGUAGES LANGUAGE CHARSET' => 'Charset', 'LANGUAGES LANGUAGE UNITSYSTEM' => 'UnitSystem'); - + if( in_array( end($this->path), $language_nodes) ) { $this->current_language[ $node_field_map[$path] ] = $line; @@ -247,57 +254,67 @@ $this->current_phrase['Translation'] .= $line; } break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': $this->current_event['Template'] .= $line; break; - } + } } } - + function endElement(&$parser, $element) { $path = implode(' ',$this->path); - + switch($path) { case 'LANGUAGES LANGUAGE PHRASES PHRASE': if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) ) { - $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); + if ($this->current_language['Encoding'] == 'plain') { + // nothing to decode! + } + else { + $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); + } $this->insertRecord($this->tables['phrases'], $this->current_phrase); } break; - + case 'LANGUAGES LANGUAGE EVENTS EVENT': - $this->current_event['Template'] = base64_decode($this->current_event['Template']); + if ($this->current_language['Encoding'] == 'plain') { + // nothing to decode! + } + else { + $this->current_event['Template'] = base64_decode($this->current_event['Template']); + } $this->insertRecord($this->tables['emailmessages'],$this->current_event); break; } - + array_pop($this->path); } - + function insertRecord($table, $fields_hash) { $fields = ''; $values = ''; - + foreach($fields_hash as $field_name => $field_value) { $fields .= '`'.$field_name.'`,'; $values .= $this->Conn->qstr($field_value).','; } - + $fields = preg_replace('/(.*),$/', '\\1', $fields); $values = preg_replace('/(.*),$/', '\\1', $values); - + $sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')'; $this->Conn->Query($sql); - + // return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all } - + /** * Creates XML file with exported language data * @@ -310,17 +327,17 @@ { $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'; @@ -329,12 +346,12 @@ { // languages $row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) ); - $ret .= "\t".''.$row['DateFormat'].''; + $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 @@ -344,18 +361,19 @@ $ret .= "\t\t".''."\n"; foreach($rows as $row) { - $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['Module'], $row['PhraseType'], base64_encode($row['Translation']) ); + $data = $this->Encoding == '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"; @@ -368,13 +386,14 @@ foreach($rows as $row) { list($event_name, $event_type) = explode('_', $this->events_hash[ $row['EventId'] ] ); - $ret .= sprintf($event_tpl, $row['MessageType'], $event_name, $event_type, base64_encode($row['Template']) ); + $data = $this->Encoding == '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); Index: branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php =================================================================== diff -u -r2211 -r4534 --- branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 2211) +++ branches/unlabeled/unlabeled-1.4.48/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4534) @@ -7,8 +7,8 @@ 'EventHandlerClass' => Array('class'=>'PhrasesEventHandler','file'=>'phrases_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), 'AutoLoad' => true, - - 'Hooks' => Array( + + 'Hooks' => Array( Array( 'Mode' => hBEFORE, 'Conditional' => false, @@ -19,7 +19,7 @@ 'DoSpecial' => '', 'DoEvent' => 'OnBeforePhraseCreate', ), - + Array( 'Mode' => hAFTER, 'Conditional' => false, @@ -31,29 +31,29 @@ 'DoEvent' => 'OnSetLastUpdated', ), ), - + 'QueryString' => Array( 1 => 'id', 2 => 'page', 3 => 'event', 4 => 'label', ), 'IDField' => 'PhraseId', - + 'StatusField' => Array('Type'), - + 'TitleField' => 'Phrase', - + 'TitlePresets' => Array( 'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'), 'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'), 'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'), ), - + 'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'), - + ), - + 'FilterMenu' => Array( 'Groups' => Array( Array('mode' => 'AND', 'filters' => Array('show_front','show_admin','show_both'), 'type' => WHERE_FILTER), @@ -64,36 +64,36 @@ 'show_both' => Array('label' => 'la_PhraseType_Both', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 2' ), ) ), - + 'TableName' => TABLE_PREFIX.'Phrase', - + 'CalculatedFields' => Array( '' => Array( 'PrimaryTranslation' => 'pri.Translation', ), - + ), - + 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)'), - + 'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)',), - + 'ListSortings' => Array( '' => Array( 'Sorting' => Array('Phrase' => 'asc'), ) ), - + 'ForeignKey' => 'LanguageId', 'ParentTableKey' => 'LanguageId', 'ParentPrefix' => 'lang', 'AutoDelete' => true, 'AutoClone' => true, - + 'Fields' => Array( 'Phrase' => Array('type' => 'string','required'=>1,'unique'=>Array('LanguageId'),'not_null' => '1','default' => ''), 'Translation' => Array('type' => 'string','required'=>1,'not_null' => '1','default' => ''), @@ -104,13 +104,14 @@ 'LastChangeIP' => Array('type' => 'string','not_null' => '1','default' => ''), 'Module' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules ORDER BY Name', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'), ), - - 'VirtualFields' => Array( + + 'VirtualFields' => Array( 'PrimaryTranslation' => Array(), 'LangFile' => Array(), 'ImportOverwrite' => Array(), + 'DoNotEncode' => Array(), ), - + 'Grids' => Array( 'Default' => Array( 'Icons' => Array('default'=>'icon16_language_var.gif'), @@ -122,7 +123,7 @@ 'LastChanged' => Array( 'title'=>'la_col_LastChanged' ), 'Module' => Array( 'title'=>'la_col_Module' ), ), - + ), ), );