Index: trunk/core/units/languages/import_xml.php =================================================================== diff -u -N -r3983 -r4712 --- trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 3983) +++ trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 4712) @@ -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: trunk/kernel/units/languages/import_xml.php =================================================================== diff -u -N -r3983 -r4712 --- trunk/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 3983) +++ trunk/kernel/units/languages/import_xml.php (.../import_xml.php) (revision 4712) @@ -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: trunk/admin/install/langpacks/english.lang =================================================================== diff -u -N -r4637 -r4712 --- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 4637) +++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 4712) @@ -1,5 +1,5 @@ - m/d/Yg:i:s Am/d/Yg:i:s A.,iso-8859-12 + m/d/Yg:i:s Am/d/Yg:i:s A.,iso-8859-12 WW91ciBwYXNzd29yZCBoYXMgYmVlbiByZXNldC4gWW91IHdpbGwgcmVjZWl2ZSB5b3VyIG5ldyBwYXNzd29yZCBpbiB0aGUgZW1haWwgc2hvcnRseS4= QWN0aXZl @@ -298,6 +298,7 @@ RGVjaW1hbCBQb2ludA== RGVzY3JpcHRpb24= RGlzcGxheQ== + QXMgUGxhaW4gVGV4dA== RHVyYXRpb24= RWRpdG9ycyBQaWNr RW5hYmxlZA== Index: trunk/kernel/units/languages/languages_event_handler.php =================================================================== diff -u -N -r4674 -r4712 --- trunk/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4674) +++ trunk/kernel/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4712) @@ -28,7 +28,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); @@ -51,7 +51,7 @@ $object->setPrimary(); } } - + /** * [HOOK] Reset primary status of other languages if we are saving primary language * @@ -61,29 +61,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 * @@ -99,7 +99,7 @@ $object->SetDBField($status_field, 1); } } - + /** * Shows only enabled languages on front * @@ -278,7 +278,7 @@ { $done_percent = 100; } - + $block_params = Array( 'name' => $template_name, 'title' => $import_titles[$import_source], 'percent_done' => $done_percent, @@ -390,6 +390,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: trunk/core/units/languages/languages_event_handler.php =================================================================== diff -u -N -r4674 -r4712 --- trunk/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4674) +++ trunk/core/units/languages/languages_event_handler.php (.../languages_event_handler.php) (revision 4712) @@ -28,7 +28,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); @@ -51,7 +51,7 @@ $object->setPrimary(); } } - + /** * [HOOK] Reset primary status of other languages if we are saving primary language * @@ -61,29 +61,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 * @@ -99,7 +99,7 @@ $object->SetDBField($status_field, 1); } } - + /** * Shows only enabled languages on front * @@ -278,7 +278,7 @@ { $done_percent = 100; } - + $block_params = Array( 'name' => $template_name, 'title' => $import_titles[$import_source], 'percent_done' => $done_percent, @@ -390,6 +390,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: trunk/admin/install/upgrades/readme_1_1_8.txt =================================================================== diff -u -N --- trunk/admin/install/upgrades/readme_1_1_8.txt (revision 0) +++ trunk/admin/install/upgrades/readme_1_1_8.txt (revision 4712) @@ -0,0 +1,15 @@ +Readme notes for In-Portal 1.1.8 +Intechnic Corporation, May 4, 2006 + +New features: + - 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 the Home category in some situations resulted in a blank screen Index: trunk/kernel/admin/include/help/editcategory_general.txt =================================================================== diff -u -N -r3392 -r4712 --- trunk/kernel/admin/include/help/editcategory_general.txt (.../editcategory_general.txt) (revision 3392) +++ trunk/kernel/admin/include/help/editcategory_general.txt (.../editcategory_general.txt) (revision 4712) @@ -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: trunk/core/units/phrases/phrases_config.php =================================================================== diff -u -N -r4471 -r4712 --- trunk/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4471) +++ trunk/core/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4712) @@ -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,27 +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), @@ -62,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' => ''), @@ -102,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'), @@ -120,7 +123,7 @@ 'LastChanged' => Array( 'title'=>'la_col_LastChanged' ), 'Module' => Array( 'title'=>'la_col_Module' ), ), - + ), ), ); Index: trunk/admin/help/manual.pdf =================================================================== diff -u -N -r4243 -r4712 Binary files differ Index: trunk/kernel/units/phrases/phrases_config.php =================================================================== diff -u -N -r4471 -r4712 --- trunk/kernel/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4471) +++ trunk/kernel/units/phrases/phrases_config.php (.../phrases_config.php) (revision 4712) @@ -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,27 +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), @@ -62,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' => ''), @@ -102,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'), @@ -120,7 +123,7 @@ 'LastChanged' => Array( 'title'=>'la_col_LastChanged' ), 'Module' => Array( 'title'=>'la_col_Module' ), ), - + ), ), ); Index: trunk/admin/install/upgrades/changelog_1_1_8.txt =================================================================== diff -u -N -r4446 -r4712 --- trunk/admin/install/upgrades/changelog_1_1_8.txt (.../changelog_1_1_8.txt) (revision 4446) +++ trunk/admin/install/upgrades/changelog_1_1_8.txt (.../changelog_1_1_8.txt) (revision 4712) @@ -5,6 +5,9 @@ File in-portal/admin/subitems.php changed File in-portal/admin/category/addcategory.php changed File in-portal/admin/category/addcategory_custom.php changed +File in-portal/admin/category/addcategory_permissions.php changed +File in-portal/admin/category/addpermission.php changed +File in-portal/admin/category/addpermission_modules.php changed File in-portal/admin/category/permcacheupdate.php changed File in-portal/admin/config/addcustomfield.php is removed; release_1_1_7 revision 1.11 File in-portal/admin/config/addlang.php is removed; release_1_1_7 revision 1.15 @@ -20,6 +23,7 @@ File in-portal/admin/editor/FCKeditor/css/fck_editorarea.php changed File in-portal/admin/editor/FCKeditor/filemanager/upload/php/upload.php changed File in-portal/admin/email/sendmail.php changed +File in-portal/admin/help/manual.pdf changed File in-portal/admin/import/import_funcs.php changed File in-portal/admin/include/elements.php changed File in-portal/admin/include/mainscript.php changed @@ -28,35 +32,40 @@ File in-portal/admin/install/inportal_schema.sql changed File in-portal/admin/install/install_lib.php changed File in-portal/admin/install/langpacks/english.lang changed -File in-portal/admin/install/upgrades/changelog_1_1_8.txt is new; release_1_1_8 revision 1.1.2.3 +File in-portal/admin/install/upgrades/changelog_1_1_8.txt is new; release_1_1_8 revision 1.1.2.8 File in-portal/admin/install/upgrades/inportal_upgrade_v1.1.8.php is new; release_1_1_8 revision 1.1 -File in-portal/admin/install/upgrades/inportal_upgrade_v1.1.8.sql is new; release_1_1_8 revision 1.3.2.1 +File in-portal/admin/install/upgrades/inportal_upgrade_v1.1.8.sql is new; release_1_1_8 revision 1.3.2.3 +File in-portal/admin/install/upgrades/readme_1_1_8.txt is new; release_1_1_8 revision 1.1.2.3 File in-portal/admin/listview/listview.php changed File in-portal/admin/logs/searchlog.php changed File in-portal/admin/modules/mod_status.php changed File in-portal/admin/tree/ftiens4.js changed File in-portal/admin/tree/tree.php changed File in-portal/admin/users/addgroup.php changed +File in-portal/admin/users/addgroup_users.php changed File in-portal/admin/users/adduser.php changed File in-portal/admin/users/adduser_custom.php changed File in-portal/kernel/action.php changed File in-portal/kernel/frontaction.php changed File in-portal/kernel/startup.php changed File in-portal/kernel/admin/include/navmenu.php changed +File in-portal/kernel/admin/include/help/editcategory_general.txt changed File in-portal/kernel/admin_templates/config/config_email.tpl is new; release_1_1_8 revision 1.1 File in-portal/kernel/admin_templates/config/config_search.tpl is new; release_1_1_8 revision 1.2 -File in-portal/kernel/admin_templates/config/config_universal.tpl is new; release_1_1_8 revision 1.1 +File in-portal/kernel/admin_templates/config/config_universal.tpl is new; release_1_1_8 revision 1.1.2.1 File in-portal/kernel/admin_templates/config_email/config_email_list.tpl is removed; release_1_1_7 revision 1.2 File in-portal/kernel/admin_templates/custom_fields/custom_fields_edit.tpl is new; release_1_1_8 revision 1.1 File in-portal/kernel/admin_templates/custom_fields/custom_fields_list.tpl is new; release_1_1_8 revision 1.1 -File in-portal/kernel/admin_templates/incs/config_blocks.tpl is new; release_1_1_8 revision 1.1 +File in-portal/kernel/admin_templates/incs/config_blocks.tpl is new; release_1_1_8 revision 1.1.2.1 File in-portal/kernel/admin_templates/incs/custom_blocks.tpl changed File in-portal/kernel/admin_templates/incs/export.js changed File in-portal/kernel/admin_templates/incs/form_blocks.tpl changed File in-portal/kernel/admin_templates/incs/grid_blocks.tpl changed File in-portal/kernel/admin_templates/incs/header.tpl changed +File in-portal/kernel/admin_templates/incs/just_close.tpl is new; release_1_1_8 revision 1.1.2.1 File in-portal/kernel/admin_templates/incs/script.js changed File in-portal/kernel/admin_templates/incs/style.css changed +File in-portal/kernel/admin_templates/regional/languages_export.tpl changed File in-portal/kernel/admin_templates/regional/languages_list.tpl changed File in-portal/kernel/include/advsearch.php changed File in-portal/kernel/include/category.php changed @@ -66,12 +75,14 @@ File in-portal/kernel/include/item.php changed File in-portal/kernel/include/itemdb.php changed File in-portal/kernel/include/parseditem.php changed +File in-portal/kernel/include/portalgroup.php changed File in-portal/kernel/include/portaluser.php changed File in-portal/kernel/include/searchconfig.php changed File in-portal/kernel/include/searchitems.php changed File in-portal/kernel/units/categories/categories_config.php changed File in-portal/kernel/units/categories/categories_event_handler.php changed File in-portal/kernel/units/categories/categories_tag_processor.php changed +File in-portal/kernel/units/config_general/config_general_tag_processor.php changed File in-portal/kernel/units/config_search/config_search_config.php changed File in-portal/kernel/units/config_search/config_search_event_handler.php changed File in-portal/kernel/units/config_search/config_search_tag_processor.php changed @@ -97,10 +108,12 @@ File in-portal/kernel/units/general/helpers/multilanguage.php is new; release_1_1_8 revision 1.3.2.2 File in-portal/kernel/units/general/helpers/search_helper.php is new; release_1_1_8 revision 1.2 File in-portal/kernel/units/help/help_tag_processor.php changed +File in-portal/kernel/units/languages/import_xml.php changed File in-portal/kernel/units/languages/languages_config.php changed File in-portal/kernel/units/languages/languages_event_handler.php changed File in-portal/kernel/units/languages/languages_item.php changed File in-portal/kernel/units/modules/modules_event_handler.php changed +File in-portal/kernel/units/phrases/phrases_config.php changed File in-portal/kernel/units/translator/translator_event_handler.php changed File in-portal/kernel/units/users/users_config.php changed File in-portal/kernel/units/users/users_event_handler.php changed @@ -123,6 +136,7 @@ File kernel4_dev/kernel4/processors/main_processor.php changed File kernel4_dev/kernel4/processors/tag_processor.php changed File kernel4_dev/kernel4/utility/cache.php is new; release_1_1_8 revision 1.1 +File kernel4_dev/kernel4/utility/debugger.php changed File kernel4_dev/kernel4/utility/event.php changed File kernel4_dev/kernel4/utility/factory.php changed File kernel4_dev/kernel4/utility/formatters.php changed @@ -137,3 +151,5 @@ Changes in phrases and events: +! m/d/Yg:i:s Am/d/Yg:i:s A.,iso-8859-12 +! m/d/Yg:i:s Am/d/Yg:i:s A.,iso-8859-12 Index: trunk/core/units/general/inp_db_event_handler.php =================================================================== diff -u -N -r4625 -r4712 --- trunk/core/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4625) +++ trunk/core/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4712) @@ -112,9 +112,11 @@ function OnPreSavePopup(&$event) { + $object =& $event->getObject(); + $this->RemoveRequiredFields($object); $event->CallSubEvent('OnPreSave'); - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->redirect = 'incs/just_close'; + + $this->finalizePopup($event); } } Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -N -r4569 -r4712 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 4569) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 4712) @@ -983,7 +983,7 @@ if (preg_match('/(.*)#([\d]+)$/', $errstr, $rets) ) { // replace short message with long one (due triger_error limitations on message size) $long_id = $rets[2]; - $errstr = $this->longErrors[$long_id]; + $errstr=$this->longErrors[$long_id]; unset($this->longErrors[$long_id]); } @@ -1023,7 +1023,7 @@ exit; } } - function breakOutofBuffering($flush=true) + function breakOutofBuffering($flush = true) { while (ob_get_level()) { Index: trunk/kernel/units/general/inp_db_event_handler.php =================================================================== diff -u -N -r4625 -r4712 --- trunk/kernel/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4625) +++ trunk/kernel/units/general/inp_db_event_handler.php (.../inp_db_event_handler.php) (revision 4712) @@ -112,9 +112,11 @@ function OnPreSavePopup(&$event) { + $object =& $event->getObject(); + $this->RemoveRequiredFields($object); $event->CallSubEvent('OnPreSave'); - $this->Application->StoreVar('PermCache_UpdateRequired', 1); - $event->redirect = 'incs/just_close'; + + $this->finalizePopup($event); } } Index: trunk/kernel/admin_templates/regional/languages_export.tpl =================================================================== diff -u -N -r3664 -r4712 --- trunk/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 3664) +++ trunk/kernel/admin_templates/regional/languages_export.tpl (.../languages_export.tpl) (revision 4712) @@ -21,7 +21,7 @@ submit_event('lang', 'OnGoBack'); } ) ); - + a_toolbar.Render(); @@ -30,20 +30,20 @@ - + - + "> - + -
    " id="" value="" />  
    + + - \ No newline at end of file Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4689 -r4712 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4689) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4712) @@ -972,14 +972,6 @@ $skip_master = false; $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); - // newly created item - /*if($this->getPassedID($event) == 0) - { - $master_id = $temp->CopyMasterToOriginal(); - $temp->UpdateForeignKeys($master_id); // save linked field values - $skip_master = true; //we've already copied master table to get the id - }*/ - if (!$this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { $temp->SaveEdit($skip_master); } @@ -1053,8 +1045,11 @@ $object->SetDefaultValues(); $object->Load($id); $object->SetFieldsFromHash($field_values); - if ($object->Update($id)) { - $event->status = erSUCCESS; + $this->customProcessing($event, 'before'); + if( $object->Update($id) ) + { + $this->customProcessing($event, 'after'); + $event->status=erSUCCESS; } else { $event->status = erFAIL; @@ -1469,7 +1464,7 @@ { case 'kOptionsFormatter': $search_keys = Array(); - + $field_value = getArrayValue($custom_filters, $search_field); if ($field_value !== false) { // if keyword passed through advanced search filter (e.g. on Visits lists section) Index: trunk/kernel/frontaction.php =================================================================== diff -u -N -r4259 -r4712 --- trunk/kernel/frontaction.php (.../frontaction.php) (revision 4259) +++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 4712) @@ -7,19 +7,19 @@ //echo $objSession->GetSessionKey()."
    \n"; $url_params = Array(); $application =& kApplication::Instance(); - + if ($objConfig->Get("CookieSessions") == 1 && $_COOKIE["cookies_on"] != "1") { $FormError["login"]["login_user"] = language("lu_cookies_error"); } - else + else { - $MissingCount = SetMissingDataErrors("login"); + $MissingCount = SetMissingDataErrors("login"); if($MissingCount==2) { $FormError["login"]["login_user"]= language("lu_ferror_loginboth"); unset($FormError["login"]["login_password"]); } - + if($MissingCount==0) { if($_POST["login_user"]=="root") @@ -39,18 +39,18 @@ $c .= $pw; set_cookie('login', $c, adodb_mktime() + 2592000); } - + // set new destination template if passed $dest = GetVar('dest', true); if(!$dest) $dest = GetVar('DestTemplate', true); if($dest) $var_list['t'] = $dest; - + $next_template = $objSession->GetVariable('next_template'); if($next_template) { $objSession->SetVariable('next_template',''); $var_list_update['t'] = $next_template; - + $url_params['pass'] = 'all'; header('Location: ' . HREF_Wrapper('', $url_params) ); exit; @@ -60,13 +60,13 @@ { $var_list['t'] = 'index'; } - + $event_params = Array('user' => $_POST['login_user'], 'pass' => $_POST['login_password']); $application->HandleEvent( new kEvent('u:OnInpLogin', $event_params) ); - - $redirect_template = getArrayValue($var_list_update, 't') ? $var_list_update['t'] : $var_list['t']; + + $redirect_template = getArrayValue($var_list_update, 't') ? $var_list_update['t'] : $var_list['t']; $application->Redirect($redirect_template); - + } else { @@ -75,7 +75,7 @@ case -1: // user or/and pass wrong $FormError["login"]["login_password"] = language("lu_incorrect_login"); break; - + case -2: // user ok, but has no permission $FormError["login"]["login_password"] = language("la_text_nopermissions"); break; @@ -85,19 +85,19 @@ } } break; - + case "m_resetpw": $passed_key = $_GET['user_key']; - - $u = $objUsers->GetItemByField("PwResetConfirm", $passed_key); - $found = is_object($u); - + + $u = $objUsers->GetItemByField("PwResetConfirm", $passed_key); + $found = is_object($u); + if($found) - { + { $exp_time = $u->Get('PwRequestTime') + 3600; $u->Set("PwResetConfirm", ''); $u->Set("PwRequestTime", 0); - if ($exp_time > adodb_mktime()) + if ($exp_time > adodb_mktime()) { $objSession->SetVariable('codevalidationresult', 'lu_resetpw_confirm_text'); $newpw = makepassword(); @@ -117,15 +117,15 @@ } } else { $objSession->SetVariable('codevalidationresult', 'lu_code_is_not_valid'); - } + } break; - + case "m_forgotpw": $MissingCount = SetMissingDataErrors("forgotpw"); // $pass_reset_add = $objConfig->Get("Users_AllowReset"); - + if($MissingCount==0) - { + { $username = $_POST["username"]; $email = $_POST["email"]; $found = false; @@ -142,22 +142,22 @@ if(is_object($u)) $found = ($u->Get("Email")==$email && $u->Get("Status")==1) && strlen($u->Get("Password")); } - - if(is_object($u)) + + if(is_object($u)) { $PwResetConfirm = $u->Get('PwResetConfirm'); $PwRequestTime = $u->Get('PwRequestTime'); $PassResetTime = $u->Get('PassResetTime'); $MinPwResetDelay = $u->Get('MinPwResetDelay'); - $allow_reset = (strlen($PwResetConfirm) ? - adodb_mktime() > $PwRequestTime + $MinPwResetDelay : + $allow_reset = (strlen($PwResetConfirm) ? + adodb_mktime() > $PwRequestTime + $MinPwResetDelay : adodb_mktime() > $PassResetTime + $MinPwResetDelay); } - + if($found && $allow_reset) { //$newpw = makepassword(); - //$objSession->Set('password', $newpw); + //$objSession->Set('password', $newpw); $objSession->Set('tmp_user_id', $u->Get("PortalUserId")); $objSession->Set('tmp_email', $u->Get("Email")); //$u->Set("Password",$newpw); @@ -167,20 +167,20 @@ //$u->Set("Password",md5($newpw)); //$u->Update(); $u->Clean(); - + $var_list['t'] = GetVar('Confirm'); } else { if(!strlen($username) && !strlen($email)) - { + { $FormError["forgotpw"]["username"] = language("lu_ferror_forgotpw_nodata"); $MissingCount++; } else - { + { $error_phrases=Array(); - + if($allow_reset) { $error_phrases['username']='lu_ferror_unknown_username'; @@ -191,7 +191,7 @@ $error_phrases['username']='lu_ferror_reset_denied'; $error_phrases['email']='lu_ferror_reset_denied'; } - + foreach ($error_phrases as $field_name => $phrase_name) { if(GetVar($field_name)) { @@ -209,12 +209,12 @@ if(strlen($_GET["error"])) $var_list["t"] = $_GET["error"]; break; - case "m_subscribe_confirm": - - $t = ""; - $_GET["subscribe_email"] = $_POST["subscribe_email"]; - $SubscribeAddress = $_POST["subscribe_email"]; - + case "m_subscribe_confirm": + + $t = ""; + $_GET["subscribe_email"] = $_POST["subscribe_email"]; + $SubscribeAddress = $_POST["subscribe_email"]; + if(!ValidEmail($SubscribeAddress)&& strlen($SubscribeAddress)) { $t = $_GET["Error"]; @@ -231,15 +231,15 @@ if(strlen($email)>0) { $u = $objUsers->GetItemByField("Email",$email); - + if(is_object($u)) { if($u->CheckBanned()) { $t = $_GET["Error"]; $objSession->SetVariable('SubscribeError', 'lu_subscribe_banned'); } - else + else { if($u->IsInGroup($g->Get("GroupId"))) { @@ -256,36 +256,36 @@ { $t = $_GET["Error"]; $objSession->SetVariable('SubscribeError', 'lu_subscribe_no_address'); - } + } } else { $t = $_GET["Error"]; $objSession->SetVariable('SubscribeError', 'lu_subscribe_unknown_error'); } - } + } } if(strlen($t)) { $var_list["t"] = $t; $var_list_update["t"] = $t; } $objSession->SetVariable('SubscribeAddress', $SubscribeAddress); - + break; case "m_subscribe": if($_POST["buttons"][0]==language("lu_button_yes")) - { + { $SubscribeAddress = $_POST["subscribe_email"]; if(strlen($SubscribeAddress)>0) - { + { if(ValidEmail($SubscribeAddress)) - { + { $GroupId = (int)$objConfig->Get("User_SubscriberGroup"); if ($GroupId) - { - $g = $objGroups->GetItem($GroupId); + { + $g = $objGroups->GetItem($GroupId); $u = $objUsers->GetItemByField("Email",$SubscribeAddress); if(is_object($u)) { @@ -297,10 +297,10 @@ $bExists = FALSE; } if($bExists) - { + { $g->AddUser($u->Get("PortalUserId"),0,false); } - else + else { $u = new clsPortalUser(NULL); $u->Set("Email",$SubscribeAddress); @@ -313,104 +313,104 @@ $g->AddUser($u->Get("PortalUserId"),1,false); } else - $SubscribeResult = "lu_subscribe_banned"; + $SubscribeResult = "lu_subscribe_banned"; } - + $SubscribeResult = "lu_subscribe_success"; $u->SendUserEventMail("USER.SUBSCRIBE",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.SUBSCRIBE"); if(strlen($_GET["Subscribe"])>0) $var_list["t"] = $_GET["Subscribe"]; - } + } } - else + else { $SubscribeResult = "lu_invalid_emailaddress"; } } - else + else $SubscribeResult = "lu_subscribe_missing_address"; } - + if(!strlen($SubscribeResult)) - $SubscribeResult = "lu_subscribe_success"; - + $SubscribeResult = "lu_subscribe_success"; + break; case "m_unsubscribe": - + if($_POST["buttons"][0]==language("lu_button_yes")) { $MissingCount = SetMissingDataErrors("m_unsubscribe"); - + if($MissingCount==0) - { + { $email = $_POST["subscribe_email"]; $u = $objUsers->GetItemByField("Email",$email); if(is_object($u)) { if(strtolower($u->Get("Email"))==strtolower($email)) - { + { $GroupId = (int)$objConfig->Get("User_SubscriberGroup"); if($u->PrimaryGroup()==$GroupId) { $u_gorup_list = $u->GetGroupList(); - - if (count($u_gorup_list) > 1) { + + if (count($u_gorup_list) > 1) { $u->RemoveFromGroup($GroupId); } else { $u->RemoveFromAllGroups(); $u->Delete(); } - } - else + } + else { $u->RemoveFromGroup($GroupId); - } + } } } if(strlen($_GET["Subscribe"])>0) $var_list["t"] = $_GET["Subscribe"]; - } + } } - + break; - + case "m_register": $_POST=inp_escape($_POST); $MissingCount = SetMissingDataErrors("m_register"); - + if(!$objConfig->Get("User_Password_Auto")) - { + { if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) { $MissingCount++; $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); } - + if(strlen($_POST["password"])>30) { // echo "VAR: ".$_POST["password"]; die(); $MissingCount++; $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); } - + if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) { $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); - } + $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); + } } - + if(($_POST["username"]=="root")) { $MissingCount++; - $FormError["m_register"]["username"] = language("lu_user_exists"); + $FormError["m_register"]["username"] = language("lu_user_exists"); } else { - - $u = $objUsers->GetItemByField("Login",$_POST["username"]); + + $u = $objUsers->GetItemByField("Login",$_POST["username"]); if(is_object($u)) { if($u->Get("Login")==$_POST["username"]) @@ -420,23 +420,23 @@ } } } - - - + + + if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) { $MissingCount++; - $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); - } - + $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); + } + if(!$MissingCount) { $CreatedOn = adodb_date("U"); $GroupId = $objConfig->Get("User_NewGroup"); $Status=0; - + /* determine the status of new users */ - switch ($objConfig->Get("User_Allow_New")) + switch ($objConfig->Get("User_Allow_New")) { case "1": $Status=1; @@ -445,12 +445,12 @@ $Status=2; break; } - + /* set Destination template */ $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; - + if($Status>0) - { + { if ($objConfig->Get("User_Password_Auto")) { $password = makepassword(); // $objSession->Set("password", $password); @@ -459,10 +459,10 @@ else { $password = $_POST["password"]; } - - $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); + + $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); $ip = $_SERVER['REMOTE_ADDR']; - + $fields_hash = Array('Login' => $_POST['username'], 'Password' => md5($password), 'FirstName' => $_POST['firstname'], @@ -482,13 +482,13 @@ 'dob' => $dob, 'ip' => $ip); $u =& $objUsers->Add_User_NEW($fields_hash, true); - + if(!is_object($u)) { $RuleId=$u; $r = $objBanList->GetItem($RuleId); $err = $r->Get("ErrorTag"); - + if(strlen($err)) { $FormError["m_register"][$r->Get("ItemField")] = language($err); @@ -504,7 +504,7 @@ $g = $objGroups->GetItem($GroupId); $g->AddUser($u->Get("PortalUserId"),1,false); } - + $custom = $_POST["custom"]; if (is_array($custom)) { for($x = 0; $x < count($custom); $x++) { @@ -514,21 +514,21 @@ } if($Status==1) - { + { if($objConfig->Get("User_Password_Auto")) { $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.VALIDATE"); } else { - $doLoginNow = true; + $doLoginNow = true; $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.ADD"); } } else - { + { $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); $u->SendAdminEventMail("USER.ADD.PENDING"); } @@ -547,12 +547,12 @@ exit; $var_list['t'] = $next_template.'.tpl'; } - + } } - } - } - } + } + } + } break; case "m_add_friend": $id = $_GET["UserId"]; @@ -570,8 +570,8 @@ $u =& $objUsers->GetItem($id); $u->DeleteFavorite(); DeleteModuleTagCache('kernel'); - break; - + break; + case 'm_acctinfo': $_POST = inp_escape($_POST); $MissingCount = SetMissingDataErrors("m_acctinfo"); @@ -580,7 +580,7 @@ $MissingCount++; $FormError["m_acctinfo"]["UserId"] = language("lu_ferror_m_profile_userid"); } - + if ($_POST["password"]) { if (($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) { $MissingCount++; @@ -598,24 +598,25 @@ $FormError["m_acctinfo"]["password"] = language("lu_ferror_pswd_tooshort"); } } - + $db =& GetADODBConnection(); $email = GetVar('email'); $test_id = $db->GetOne('SELECT PortalUserId FROM '.GetTablePrefix().'PortalUser WHERE Email = '.$db->qstr($email)); if ($test_id && ($test_id != $objSession->Get('PortalUserId')) ) { $MissingCount++; $FormError["m_acctinfo"]["email"] = language("lu_ferror_email_duplicate"); } - - + + if (!$MissingCount) { /* save profile */ $u =& $objUsers->GetItem($UserId); $status = $u->Get("Status"); $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); $password = strlen($_POST["password"]) > 0 ? md5($_POST["password"]) : ''; - + $fields_hash = Array( 'Login' => $_POST['username'], + 'Password' => $password, 'FirstName' => $_POST['firstname'], 'LastName' => $_POST['lastname'], 'Company' => $_POST['company'], Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r4630 -r4712 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4630) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4712) @@ -72,11 +72,11 @@ - + "> - " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + " id="" value="" tabindex="" size="" maxlength="" class="" onblur="" onkeyup="">   @@ -183,18 +183,18 @@ - + "> - " id="" value="" tabindex="" size="" class=""> - - ');"> - + " id="" value="" tabindex="" size="" class="" onkeyup=""> + + ');"> + ', '', '');"> - - + +   @@ -241,7 +241,7 @@ - +