Index: trunk/kernel/admin_templates/img/toolbar/tool_place_order_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_conf_regional.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_denied.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/american_express.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/s.gif =================================================================== diff -u Binary files differ Index: trunk/admin/save_redirect.php =================================================================== diff -u --- trunk/admin/save_redirect.php (revision 0) +++ trunk/admin/save_redirect.php (revision 1566) @@ -0,0 +1,98 @@ +Logout(); + header("Location: ".$adminURL."/index.php?logout=1"); + exit; + + } + + /*$m = GetModuleArray(); + foreach($m as $key=>$value) + { + $path = $pathtoroot.$value.'admin/include/parser.php'; + if( file_exists($path) ) include_once($path); + }*/ + + $rootURL = 'http://'.ThisDomain().$objConfig->Get('Site_Path'); + $location = $rootURL.GetVar('do').'?env='.GetVar('env'); + header('Location: '.$location); + exit; +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_process_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_settings_email.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/is.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/is.js (revision 0) +++ trunk/kernel/admin_templates/incs/is.js (revision 1566) @@ -0,0 +1,211 @@ +// Ultimate client-side JavaScript client sniff. Version 3.03 +// (C) Netscape Communications 1999. Permission granted to reuse and distribute. +// Revised 17 May 99 to add is.nav5up and is.ie5up (see below). +// Revised 21 Nov 00 to add is.gecko and is.ie5_5 Also Changed is.nav5 and is.nav5up to is.nav6 and is.nav6up +// Revised 22 Feb 01 to correct Javascript Detection for IE 5.x, Opera 4, +// correct Opera 5 detection +// add support for winME and win2k +// synch with browser-type-oo.js +// Revised 26 Mar 01 to correct Opera detection +// Revised 02 Oct 01 to add IE6 detection + +// Everything you always wanted to know about your JavaScript client +// but were afraid to ask ... "Is" is the constructor function for "is" object, +// which has properties indicating: +// (1) browser vendor: +// is.nav, is.ie, is.opera, is.hotjava, is.webtv, is.TVNavigator, is.AOLTV +// (2) browser version number: +// is.major (integer indicating major version number: 2, 3, 4 ...) +// is.minor (float indicating full version number: 2.02, 3.01, 4.04 ...) +// (3) browser vendor AND major version number +// is.nav2, is.nav3, is.nav4, is.nav4up, is.nav6, is.nav6up, is.gecko, is.ie3, +// is.ie4, is.ie4up, is.ie5, is.ie5up, is.ie5_5, is.ie5_5up, is.ie6, is.ie6up, is.hotjava3, is.hotjava3up +// (4) JavaScript version number: +// is.js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...) +// (5) OS platform and version: +// is.win, is.win16, is.win32, is.win31, is.win95, is.winnt, is.win98, is.winme, is.win2k +// is.os2 +// is.mac, is.mac68k, is.macppc +// is.unix +// is.sun, is.sun4, is.sun5, is.suni86 +// is.irix, is.irix5, is.irix6 +// is.hpux, is.hpux9, is.hpux10 +// is.aix, is.aix1, is.aix2, is.aix3, is.aix4 +// is.linux, is.sco, is.unixware, is.mpras, is.reliant +// is.dec, is.sinix, is.freebsd, is.bsd +// is.vms +// +// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and +// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html +// for detailed lists of userAgent strings. +// +// Note: you don't want your Nav4 or IE4 code to "turn off" or +// stop working when Nav5 and IE5 (or later) are released, so +// in conditional code forks, use is.nav4up ("Nav4 or greater") +// and is.ie4up ("IE4 or greater") instead of is.nav4 or is.ie4 +// to check version in code which you want to work on future +// versions. + +function Is () +{ // convert all characters to lowercase to simplify testing + var agt=navigator.userAgent.toLowerCase(); + + // *** BROWSER VERSION *** + // Note: On IE5, these return 4, so use is.ie5up to detect IE5. + + this.major = parseInt(navigator.appVersion); + this.minor = parseFloat(navigator.appVersion); + + // Note: Opera and WebTV spoof Navigator. We do strict client detection. + // If you want to allow spoofing, take out the tests for opera and webtv. + this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) + && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) + && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)); + this.nav2 = (this.nav && (this.major == 2)); + this.nav3 = (this.nav && (this.major == 3)); + this.nav4 = (this.nav && (this.major == 4)); + this.nav4up = (this.nav && (this.major >= 4)); + this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || + (agt.indexOf("; nav") != -1)) ); + this.nav6 = (this.nav && (this.major == 5)); + this.nav6up = (this.nav && (this.major >= 5)); + this.gecko = (agt.indexOf('gecko') != -1); + + + this.ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); + this.ie3 = (this.ie && (this.major < 4)); + this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) ); + this.ie4up = (this.ie && (this.major >= 4)); + this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); + this.ie5_5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1)); + this.ie5up = (this.ie && !this.ie3 && !this.ie4); + this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5); + this.ie6 = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.")!=-1) ); + this.ie6up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5); + + // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser + // or if this is the first browser window opened. Thus the + // variables is.aol, is.aol3, and is.aol4 aren't 100% reliable. + this.aol = (agt.indexOf("aol") != -1); + this.aol3 = (this.aol && this.ie3); + this.aol4 = (this.aol && this.ie4); + this.aol5 = (agt.indexOf("aol 5") != -1); + this.aol6 = (agt.indexOf("aol 6") != -1); + + this.opera = (agt.indexOf("opera") != -1); + this.opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1); + this.opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1); + this.opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1); + this.opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); + this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4); + + this.webtv = (agt.indexOf("webtv") != -1); + + this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); + this.AOLTV = this.TVNavigator; + + this.hotjava = (agt.indexOf("hotjava") != -1); + this.hotjava3 = (this.hotjava && (this.major == 3)); + this.hotjava3up = (this.hotjava && (this.major >= 3)); + + // *** JAVASCRIPT VERSION CHECK *** + if (this.nav2 || this.ie3) this.js = 1.0; + else if (this.nav3) this.js = 1.1; + else if (this.opera5up) this.js = 1.3; + else if (this.opera) this.js = 1.1; + else if ((this.nav4 && (this.minor <= 4.05)) || this.ie4) this.js = 1.2; + else if ((this.nav4 && (this.minor > 4.05)) || this.ie5) this.js = 1.3; + else if (this.hotjava3up) this.js = 1.4; + else if (this.nav6 || this.gecko) this.js = 1.5; + // NOTE: In the future, update this code when newer versions of JS + // are released. For now, we try to provide some upward compatibility + // so that future versions of Nav and IE will show they are at + // *least* JS 1.x capable. Always check for JS version compatibility + // with > or >=. + else if (this.nav6up) this.js = 1.5; + // note ie5up on mac is 1.4 + else if (this.ie5up) this.js = 1.3 + + // HACK: no idea for other browsers; always check for JS version with > or >= + else this.js = 0.0; + + // *** PLATFORM *** + this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) ); + // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all + // Win32, so you can't distinguish between Win95 and WinNT. + this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1)); + + // is this a 16 bit compiled version? + this.win16 = ((agt.indexOf("win16")!=-1) || + (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || + (agt.indexOf("windows 16-bit")!=-1) ); + + this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || + (agt.indexOf("windows 16-bit")!=-1)); + + // NOTE: Reliable detection of Win98 may not be possible. It appears that: + // - On Nav 4.x and before you'll get plain "Windows" in userAgent. + // - On Mercury client, the 32-bit version will return "Win98", but + // the 16-bit version running on Win98 will still return "Win95". + this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1)); + this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1)); + this.win32 = (this.win95 || this.winnt || this.win98 || + ((this.major >= 4) && (navigator.platform == "Win32")) || + (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)); + + this.winme = ((agt.indexOf("win 9x 4.90")!=-1)); + this.win2k = ((agt.indexOf("windows nt 5.0")!=-1)); + + this.os2 = ((agt.indexOf("os/2")!=-1) || + (navigator.appVersion.indexOf("OS/2")!=-1) || + (agt.indexOf("ibm-webexplorer")!=-1)); + + this.mac = (agt.indexOf("mac")!=-1); + // hack ie5 js version for mac + if (this.mac && this.ie5up) this.js = 1.4; + this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || + (agt.indexOf("68000")!=-1))); + this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || + (agt.indexOf("powerpc")!=-1))); + + this.sun = (agt.indexOf("sunos")!=-1); + this.sun4 = (agt.indexOf("sunos 4")!=-1); + this.sun5 = (agt.indexOf("sunos 5")!=-1); + this.suni86= (this.sun && (agt.indexOf("i86")!=-1)); + this.irix = (agt.indexOf("irix") !=-1); // SGI + this.irix5 = (agt.indexOf("irix 5") !=-1); + this.irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1)); + this.hpux = (agt.indexOf("hp-ux")!=-1); + this.hpux9 = (this.hpux && (agt.indexOf("09.")!=-1)); + this.hpux10= (this.hpux && (agt.indexOf("10.")!=-1)); + this.aix = (agt.indexOf("aix") !=-1); // IBM + this.aix1 = (agt.indexOf("aix 1") !=-1); + this.aix2 = (agt.indexOf("aix 2") !=-1); + this.aix3 = (agt.indexOf("aix 3") !=-1); + this.aix4 = (agt.indexOf("aix 4") !=-1); + this.linux = (agt.indexOf("inux")!=-1); + this.sco = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1); + this.unixware = (agt.indexOf("unix_system_v")!=-1); + this.mpras = (agt.indexOf("ncr")!=-1); + this.reliant = (agt.indexOf("reliantunix")!=-1); + this.dec = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || + (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || + (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); + this.sinix = (agt.indexOf("sinix")!=-1); + this.freebsd = (agt.indexOf("freebsd")!=-1); + this.bsd = (agt.indexOf("bsd")!=-1); + this.unix = ((agt.indexOf("x11")!=-1) || this.sun || this.irix || this.hpux || + this.sco ||this.unixware || this.mpras || this.reliant || + this.dec || this.sinix || this.aix || this.linux || this.bsd || this.freebsd); + + this.vms = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1)); +} + +var is; +var isIE3Mac = false; +// this section is designed specifically for IE3 for the Mac + +if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) && +(parseInt(navigator.appVersion)==3)) + isIE3Mac = true; +else is = new Is(); Index: trunk/themes/default/img/my_orders_s.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_template.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/adodb/adodb.inc.php =================================================================== diff -u -r965 -r1566 --- trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 965) +++ trunk/kernel/include/adodb/adodb.inc.php (.../adodb.inc.php) (revision 1566) @@ -723,7 +723,7 @@ ADOConnection::outp( "=----\n($this->databaseType): ".($sqlTxt)." \n-----\n",false); flush(); - $profileSQLs = defined('SQL_PROFILE')&&(SQL_PROFILE==1); + $profileSQLs = defined('DBG_SQL_PROFILE')&&DBG_SQL_PROFILE; if($profileSQLs) { $isSkipTable = isSkipTable($sql); @@ -752,7 +752,7 @@ $e = $this->ErrorNo(); $m = $this->ErrorMsg(); - $errorLevel = defined('SQL_ERROR_DIE')&&SQL_ERROR_DIE ? E_USER_ERROR : E_USER_WARNING; + $errorLevel = defined('DBG_SQL_FAILURE')&&DBG_SQL_FAILURE ? E_USER_ERROR : E_USER_WARNING; $debugger->dumpVars($_REQUEST); $debugger->appendTrace(); Index: trunk/core/units/languages/languages_event_handler.php =================================================================== diff -u --- trunk/core/units/languages/languages_event_handler.php (revision 0) +++ trunk/core/units/languages/languages_event_handler.php (revision 1566) @@ -0,0 +1,311 @@ +Application->getUnitOption($event->Prefix,'TableName'); + $languages_count = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$table_name); + $languages_count = $languages_count + 5 - ( $languages_count % 5 ? ($languages_count % 5) : 5 ); + + $sqls = Array(); + + $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader'); + foreach($unit_config_reader->configData as $prefix => $config_data) + { + $table_name = getArrayValue($config_data,'TableName'); + $fields = getArrayValue($config_data,'Fields'); + if(!($table_name && $fields) ) continue; + + foreach($fields as $field_name => $field_options) + { + if( isset($field_options['formatter']) && $field_options['formatter'] == 'kMultiLanguage' ) + { + $describe = $this->Conn->Query('DESCRIBE '.$table_name.' \'l%_'.$field_name.'\''); + $field_mask = 'l%s_'.$field_name.' '.$describe[0]['Type']; + $create_count = $languages_count - count($describe); + if($create_count) + { + $sqls[] = 'ALTER TABLE '.$table_name.( $this->generateAlterSQL($field_mask, count($describe) + 1, $create_count) ); + } + } + } + } + if($sqls) $this->Conn->Query( implode("\n",$sqls) ); + } + + /** + * Returns ALTER statement part for adding required fields to table + * + * @param string $field_mask sql mask for creating field with correct definition (type & size) + * @param int $start_index add new fields starting from this index + * @param int $create_count create this much new multilingual field translations + * @return string + */ + function generateAlterSQL($field_mask, $start_index, $create_count) + { + $i_count = $start_index + $create_count; + $ret = ''; + while($start_index < $i_count) + { + list($prev_field,$type) = explode(' ', sprintf($field_mask, $start_index-1) ); + $ret .= ' ADD COLUMN '.sprintf($field_mask,$start_index).' AFTER '.$prev_field.', '; + $start_index++; + } + return preg_replace('/, $/',';',$ret); + } + + /** + * Copy labels from another language + * + * @param kEvent $event + */ + function OnCopyLabels(&$event) + { + $object =& $event->getObject(); + $from_lang_id = $object->GetDBField('CopyFromLanguage'); + + if( ($event->MasterEvent->status == erSUCCESS) && $object->GetDBField('CopyLabels') == 1 && ($from_lang_id > 0) ) + { + $lang_id = $object->GetID(); + + // 1. phrases import + $phrases_live = $this->Application->getUnitOption('phrases','TableName'); + $phrases_temp = kTempTablesHandler::GetTempName($phrases_live); + $sql = 'INSERT INTO '.$phrases_temp.' + SELECT Phrase, Translation, PhraseType, 0-PhraseId, '.$lang_id.' + FROM '.$phrases_live.' + WHERE LanguageId='.$from_lang_id; + $this->Conn->Query($sql); + + // 2. events import + $em_table_live = $this->Application->getUnitOption('emailmessages','TableName'); + $em_table_temp = kTempTablesHandler::GetTempName($em_table_live); + + $sql = 'SELECT * FROM '.$em_table_live.' WHERE LanguageId = '.$from_lang_id; + $email_messages = $this->Conn->Query($sql); + if($email_messages) + { + $id = $this->Conn->GetOne('SELECT MIN(EmailMessageId) FROM '.$em_table_live); + if($id > 0) $id = 0; + $id--; + + $sqls = Array(); + foreach($email_messages as $email_message) + { + $sqls[] = $id.','.$this->Conn->qstr($email_message['Template']).','.$this->Conn->qstr($email_message['MessageType']).','.$lang_id.','.$email_message['EventId']; + $id--; + } + $sql = 'INSERT INTO '.$em_table_temp.'(EmailMessageId,Template,MessageType,LanguageId,EventId) VALUES ('.implode('),(',$sqls).')'; + $this->Conn->Query($sql); + } + + $object->SetDBField('CopyLabels', 0); + } + } + + /** + * Prepare temp tables for creating new item + * but does not create it. Actual create is + * done in OnPreSaveCreated + * + * @param kEvent $event + */ + function OnPreCreate(&$event) + { + parent::OnPreCreate($event); + + $object =& $event->getObject(); + $object->SetDBField('CopyLabels', 1); + + $live_table = kTempTablesHandler::GetLiveName($object->TableName); + $primary_lang_id = $this->Conn->GetOne('SELECT '.$object->IDField.' FROM '.$live_table.' WHERE PrimaryLang = 1'); + + $object->SetDBField('CopyFromLanguage', $primary_lang_id); + } + + + function OnChangeLanguage(&$event) + { + $this->Application->SetVar('m_lang', $this->Application->GetVar('language')); + + $this->Application->LinkVar('language', 'm_lang'); + } + + /** + * Parse language XML file into temp tables and redirect to progress bar screen + * + * @param kEvent $event + */ + function OnImportLanguage(&$event) + { + $items_info = $this->Application->GetVar('phrases_import'); + if($items_info) + { + list($id,$field_values) = each($items_info); + + $lang_xml =& $this->Application->recallObject('LangXML'); + $lang_xml->Parse($field_values['LangFile']['tmp_name'], $field_values['PhraseType'], $field_values['Module']); + } + $event->redirect = 'dummy'; + $event->SetRedirectParam('lang_event', 'OnImportProgress'); + $event->SetRedirectParam('pass', 'all,lang'); + } + + /** + * Copies imported from xml file from temp table to live table + * + * @param kEvent $event + */ + function OnImportProgress(&$event) + { + define('IMPORT_BY', 300); // import this much records per step + $template_name = 'in-commerce/regional/languages_import_step2'; + + $import_source = (int)$this->Application->GetVar('source'); + $import_steps = Array(0 => 'lang', 1 => 'phrases', 2 => 'emailmessages', 3 => 'finish'); + $import_titles = Array(0 => 'la_ImportingLanguages', 1 => 'la_ImportingPhrases', 2 => 'la_ImportingEmailEvents', 3 => 'la_Done'); + + // --- BEFORE --- + $import_prefix = $import_steps[$import_source]; + $import_start = (int)$this->Application->GetVar('start'); + $dst_table = $this->Application->getUnitOption($import_prefix,'TableName'); + $src_table = kTempTablesHandler::GetTempName($dst_table); + + $import_total = $this->Application->GetVar('total'); + if(!$import_total) $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table); + // --- AFTER --- + + if($import_start == $import_total) + { + $import_source++; + $import_prefix = $import_steps[$import_source]; + if($import_prefix == 'finish') + { + $event->SetRedirectParam('opener','u'); + return true; + } + + $import_start = 0; + $dst_table = $this->Application->getUnitOption($import_prefix,'TableName'); + $src_table = kTempTablesHandler::GetTempName($dst_table); + $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table); + } + + $done_percent = ($import_start * 100) / $import_total; + $block_params = Array( 'name' => $template_name, + 'title' => $import_titles[$import_source], + 'percent_done' => $done_percent, + 'percent_left' => 100 - $done_percent); + + $this->Application->InitParser(); + $this->Application->setUnitOption('phrases','AutoLoad',false); + echo $this->Application->ParseBlock($block_params); + flush(); + + $fields = array_keys( $this->Application->getUnitOption($import_prefix,'Fields') ); + + $sql = 'SELECT * FROM %s LIMIT %s,%s'; + $rows = $this->Conn->Query( sprintf($sql,$src_table,$import_start,IMPORT_BY) ); + + $fields_sql = ''; + foreach($fields as $field_name) + { + $fields_sql .= '`'.$field_name.'`,'; + } + $fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql); + $values_sql = ''; + + foreach($rows as $row) + { + $values_sql .= '('; + foreach($row as $field_value) + { + $values_sql .= $this->Conn->qstr($field_value).','; + } + $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql).'),'; + } + $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); + + $sql = sprintf('INSERT INTO %s (%s) VALUES %s', $dst_table, $fields_sql, $values_sql); + $this->Conn->Query($sql); + + $event->setRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'start' => $import_start += count($rows), 'total' => $import_total, 'source' => $import_source) ); + } + + /** + * Stores ids of selected languages and redirects to export language step 1 + * + * @param kEvent $event + */ + function OnExportLanguage(&$event) + { + $this->Application->setUnitOption('phrases','AutoLoad',false); + + $this->StoreSelectedIDs($event); + $this->Application->StoreVar('export_language_ids', implode(',', $this->getSelectedIDs($event)) ); + + $event->setRedirectParams( Array('m_opener'=>'d','phrases.export_event'=>'OnNew','pass'=>'all,phrases.export') ); + $event->redirect = 'in-commerce/regional/languages_export'; + } + + /** + * Saves selected languages to xml file passed + * + * @param kEvent $event + */ + function OnExportProgress(&$event) + { + $this->Application->setUnitOption('phrases','AutoLoad',false); + $object =& $this->Application->recallObject('phrases.export'); + + $items_info = $this->Application->GetVar('phrases_export'); + if($items_info) + { + list($id,$field_values) = each($items_info); + + $lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') ); + + if( !getArrayValue($field_values,'LangFile') ) + { + $object->SetError('LangFile', 'required'); + $event->redirect = false; + return false; + } + if( !is_writable(EXPORT_PATH) ) + { + $object->SetError('LangFile', 'write_error', 'la_ExportFolderNotWritable'); + $event->redirect = false; + return false; + } + $field_values['LangFile'] .= '.lang'; + $filename = EXPORT_PATH.'/'.$field_values['LangFile']; + + $lang_xml =& $this->Application->recallObject('LangXML'); + $lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']); + + } + + $event->redirect = 'in-commerce/regional/languages_export_step2'; + $event->SetRedirectParam('export_file', $field_values['LangFile']); + } + + /** + * Returns to previous template in opener stack + * + * @param kEvent $event + */ + function OnGoBack(&$event) + { + $event->redirect_params['opener'] = 'u'; + } + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon46_settings_in-link.gif =================================================================== diff -u Binary files differ Index: trunk/admin/include/elements.php =================================================================== diff -u -r1510 -r1566 --- trunk/admin/include/elements.php (.../elements.php) (revision 1510) +++ trunk/admin/include/elements.php (.../elements.php) (revision 1566) @@ -269,7 +269,7 @@ print $onLoad; } else - print " onload=\"if (clear_checkboxes) clear_checkboxes();\""; + print " onload=\"if (clear_checkboxes) clear_checkboxes(); if (typeof(theMainScript) != 'undefined') theMainScript.ProcessOnload(); \""; print ">"; global $b_header_addon; Index: trunk/kernel/admin_templates/img/toolbar/tool_editcat.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_search.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_tool_import.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/config_general/config_general_event_handler.php =================================================================== diff -u --- trunk/kernel/units/config_general/config_general_event_handler.php (revision 0) +++ trunk/kernel/units/config_general/config_general_event_handler.php (revision 1566) @@ -0,0 +1,90 @@ +getObject(); + $object->addFilter('by_name', '%1$s.Name = "In-Commerce"'); + + } + + function OnSelectItems(&$event){ + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $selected_cat=$this->Application->GetVar("c"); + reset($selected_cat); + //print_r($selected_cat); + foreach($selected_cat as $cat_resource_id=>$val){} + + + if ($cat_resource_id){ + $category_id = $this->Conn->GetOne('SELECT CategoryId FROM '.TABLE_PREFIX.'Category WHERE ResourceId='.$cat_resource_id); + $this->Application->StoreVar("StoredRootCatId", $category_id); + } + + $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf,confg'); + + $this->finalizePopup($event,'confg','in-commerce/config/config_general.tpl'); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + + + function OnBeforeItemUpdate(&$event) + { + $object =& $event->getObject(); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + + function OnAfterItemUpdate(&$event) + { + $object =& $event->getObject(); + } + + function OnUpdate(&$event) + { + parent::OnUpdate($event); + $event->redirect_params = Array('opener' => 's', 'pass'=>'all,conf'); //stay! + } + + function OnCancel(&$event) + { + parent::OnCancel($event); + $event->redirect_params = Array('opener' => 's', 'pass'=>'all,confg'); //stay! + } + + /* + function myUrlDecode($str){ + $str=str_replace(';',':', $str); + $str=str_replace('!','-', $str); + return $str; + } + + function myUrlEncode($str){ + $str=str_replace('-', '!', $str); + $str=str_replace(':', ';', $str); + return $str; + } + */ + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon46_list_banlist.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_new.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/inp_login_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon24_conf_general.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_paymenttype_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/general_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/tools/debug_sample.php =================================================================== diff -u -r874 -r1566 --- trunk/tools/debug_sample.php (.../debug_sample.php) (revision 874) +++ trunk/tools/debug_sample.php (.../debug_sample.php) (revision 1566) @@ -1,114 +1,39 @@ Affected_Rows().'] '.$after; + } - if($newline) $msg .= "
\n"; - if( defined('SQL_TO_SCREEN') && SQL_TO_SCREEN == 1 ) echo $msg; - if( defined('SQL_TO_FILE') && SQL_TO_FILE == 1 ) + function isSkipTable($sql) { - if($file_reset == false && defined('SQL_OVERWRITE') && SQL_OVERWRITE) - { - if( file_exists(SQL_OUTPUT) ) unlink(SQL_OUTPUT); - $file_reset = true; - } - $msg = str_replace(Array("
\n",'   ','<','>','"'),Array('','','<','>','"'),$msg); - $fp = fopen(SQL_OUTPUT, 'a'); - fwrite($fp,$msg); - fclose($fp); + static $skipTables = Array( 'Modules','Language','PermissionConfig','PermCache', + 'SessionData','ConfigurationValues','Events','Phrase', + 'PersistantSessionData','EmailQueue','UserSession', + 'Permissions','ThemeFiles'); + + foreach($skipTables as $table) if( tableMatch($table,$sql) ) return true; + return false; } - } - - /** - * @return string - * @desc Returnts trace results to place where called from - */ - function trace() - { - die('Error: Depricated call. Use $debugger->appendTrace(); instead'); - /*$trace_results = debug_backtrace(); - array_shift($trace_results); - echo 'Called from ['.$trace_results[0]['function'].']
'; - print_pre($trace_results);*/ - } - - function DebugByFile() - { - $ScriptName = basename( $_SERVER['PHP_SELF'] ); - switch ($ScriptName) + + function tableMatch($table_name,$sql) { - case 'step3.php': - global $objSession; - $objSession->SetVariable('import_sql_type', 'mysql'); - $objSession->SetVariable('import_server', 'localhost'); - $objSession->SetVariable('import_db', 'alex_in_portal'); //maris_inlink'); - $objSession->SetVariable('import_user', 'dev'); - $objSession->SetVariable('import_pass', 'dev-25-sql'); - - $objSession->SetVariable('categoryid', 101); // resource id - $objSession->SetVariable('import_category_id', 1); // category id - $objSession->SetVariable('catnavbar', 'Home>Directory (debug_auto_complete)'); - $objSession->SetVariable('user_admin_names','admin'); - $objSession->SetVariable('user_admin_values', 11); - $objSession->SetVariable('user_regular_names','Member'); - $objSession->SetVariable('user_regular_values', 13); - break; + static $prefix = ''; + $prefix = defined('TABLE_PREFIX')?TABLE_PREFIX:GetTablePrefix(); + return strpos($sql,$prefix.$table_name)!==false; } } - ?> \ No newline at end of file Index: trunk/themes/default/img/btn_continue_shopping.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_foldersearch.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_manufacturer_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_to_user.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_currency.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -r1462 -r1566 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1462) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 1566) @@ -273,7 +273,7 @@ { if($this->IsPopItem()) { - $ret = $element->attributes["_label"]; + $ret = $element->GetAttributeByName('_label'); if(!strlen($ret)) $ret = "lu_pop"; $ret = language($ret); @@ -923,6 +923,7 @@ $n = new $this->classname(); $n->tablename = $this->SourceTable; $n->LoadFromDatabase($ID); + $n->Set( $n->IdField(), $ID ); // in case if no loaded set ID anyway $index = array_push($this->Items, $n); $i =& $this->Items[count($this->Items)-1]; } @@ -1662,7 +1663,7 @@ echo "Items Queries: ".$this->QueryItemCount."
"; echo "=====
"; */ - if($this->Page > $NumPages && $PerPage != -1) + if( ($this->Page > $NumPages || $this->Page == 0) && $PerPage != -1) { switch($fix_method) { @@ -2076,29 +2077,22 @@ return $ret; } - function SqlGlobalCount($attribs=array()) - { - global $objSession; - - $p = $this->BasePermission.".VIEW"; - $t = $this->SourceTable; - if($attribs["_today"]) - { - $today = mktime(0,0,0,date("m"),date("d"),date("Y")); - $where = "($t.CreatedOn>=$today)"; - } + function SqlGlobalCount($attribs=array()) + { + global $objSession; + + $p = $this->BasePermission.".VIEW"; + $t = $this->SourceTable; + if( getArrayValue($attribs,'_today') ) + { + $today = mktime(0,0,0,date("m"),date("d"),date("Y")); + $where = "($t.CreatedOn>=$today)"; + } - if($attribs["_grouponly"]) - { - $GroupList = $objSession->Get("GroupList"); - } - else - $GroupList = NULL; - - $sql = $this->GetCountSQL($p,NULL,$GroupList,$where); - - return $sql; - } + $GroupList = getArrayValue($attribs,'_grouponly') ? $objSession->Get('GroupList') : null; + $sql = $this->GetCountSQL($p,NULL,$GroupList); + return $sql; + } function DoGlobalCount($attribs) { Index: trunk/kernel/admin_templates/img/toolbar/tool_deny_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/blocks2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_listing_types.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_payment_primary.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_continue_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_to_base.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/portalgroup.php =================================================================== diff -u -r955 -r1566 --- trunk/kernel/include/portalgroup.php (.../portalgroup.php) (revision 955) +++ trunk/kernel/include/portalgroup.php (.../portalgroup.php) (revision 1566) @@ -32,7 +32,7 @@ function HasSystemPermission($PermissionName) { - $GroupId = $this->Get("GroupId"); + $GroupId = (int)$this->Get("GroupId"); $sql = "SELECT * FROM ".GetTablePrefix()."Permissions WHERE GroupId=$GroupId AND Permission='$PermissionName' AND type=1"; $result = $this->adodbConnection->Execute($sql); if($result && !$result->EOF) Index: trunk/kernel/admin_templates/img/toolbar/tool_arrange_f2.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/my_account.tpl =================================================================== diff -u -r601 -r1566 --- trunk/themes/default/my_account.tpl (.../my_account.tpl) (revision 601) +++ trunk/themes/default/my_account.tpl (.../my_account.tpl) (revision 1566) @@ -212,6 +212,9 @@
+ + +
Index: trunk/kernel/admin_templates/img/old/menu_check_in.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_orders.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_modules.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_select_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_cat_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_denied.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/category_items/category_items_dbitem.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/in-link/toolbar/tool_new_link.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/cat_dbitem.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon24_link_editor.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_option_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/icon16_search_reset_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/category_items/category_items_tag_processor.php'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/custom_fields.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon46_list_validate.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_cat_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_currency_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_hot.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_language.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_tools.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_theme_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_search_b_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/cat_dblist.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_archive.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/script.js (revision 0) +++ trunk/kernel/admin_templates/incs/script.js (revision 1566) @@ -0,0 +1,418 @@ +var Grids = new Array(); +var Toolbars = new Array(); +var $Menus = new Array(); +var $ViewMenus = new Array(); +if(!$fw_menus) var $fw_menus = new Array(); + +var $env = ''; +var submitted = false; + +function resort_grid(prefix_special,field,form_action) +{ + document.getElementById(prefix_special+'_Sort1').value = field; + submit_event(prefix_special,'OnSetSorting',null,form_action); +} + +function direct_sort_grid($prefix_special,$field,$direction,$field_pos) +{ + if(!isset($field_pos)) $field_pos = 1; + set_hidden_field($prefix_special+'_Sort'+$field_pos,$field); + set_hidden_field($prefix_special+'_Sort'+$field_pos+'_Dir',$direction); + set_hidden_field($prefix_special+'_SortPos',$field_pos); + submit_event($prefix_special,'OnSetSortingDirect'); +} + +function reset_sorting($prefix_special) +{ + submit_event($prefix_special,'OnResetSorting'); +} + +function set_per_page($prefix_special,$per_page) +{ + set_hidden_field($prefix_special+'_PerPage',$per_page); + submit_event($prefix_special,'OnSetPerPage'); +} + +function submit_event(prefix_special,event,t,form_action) +{ + if (isset(event)) { + set_hidden_field('events['+prefix_special+']', event); + } + + if(isset(t)) document.getElementById('t').value = t; + if(isset(form_action)) { + var old_env = ''; + if ( !form_action.match(/\?/) ) { + document.getElementById('kernel_form').action.match(/.*(\?.*)/); + old_env = RegExp.$1; + } + document.getElementById('kernel_form').action = form_action+old_env; + } + submit_kernel_form(); +} + +function show_form_data() +{ + var $kf = document.getElementById('kernel_form'); + $ret = ''; + for(var i in $kf.elements) + { + $elem = $kf.elements[i]; + $ret += $elem.id + ' = ' + $elem.value + "\n"; + } + alert($ret); +} + +function submit_kernel_form() +{ + if (submitted) { + return; + } + submitted = true; + var $form = document.getElementById('kernel_form'); + + if (typeof $form.onsubmit == "function") { + $form.onsubmit(); + } + + $form.submit(); + $form.target = ''; + $form.t.value = t; + + window.setTimeout(function() {submitted = false}, 500); +} + +function set_event(prefix_special, event) +{ + var event_field=document.getElementById('events[' + prefix_special + ']'); + if(isset(event_field)) + { + event_field.value = event; + } +} + +function isset(variable) +{ + if(variable==null) return false; + return (typeof(variable)=='undefined')?false:true; +} + +function print_pre(variable) +{ + var s = ""; + for (prop in variable) { + s += prop+" => "+variable[prop] + ""; + } + alert(s); +} + +function go_to_page(prefix_special, page) +{ + set_hidden_field(prefix_special+'_Page', page); + submit_event(prefix_special); +} + +function go_to_list(prefix_special, tab) +{ + document.getElementById(prefix_special+'_GoTab').value = tab; + submit_event(prefix_special,'OnUpdateAndGoToTab',null); +} + +function go_to_tab(prefix_special, tab) +{ + document.getElementById(prefix_special+'_GoTab').value = tab; + submit_event(prefix_special,'OnPreSaveAndGoToTab',null); +} + +function go_to_id(prefix_special, id) +{ + document.getElementById(prefix_special+'_GoId').value = id; + submit_event(prefix_special,'OnPreSaveAndGo') +} + +// in-portal compatibility functions: begin +function getScriptURL($script_name) +{ + var $asid = document.getElementById('sid').value; + return base_url+$script_name+'?env='+( isset($env)&&$env?$env:$asid )+'&en=0'; +} + +function OpenEditor(extra_env,TargetForm,TargetField) +{ + var $url = getScriptURL('admin/editor/editor_new.php'); + $url = $url+'&TargetForm='+TargetForm+'&TargetField='+TargetField+'&destform=popup'; + if(extra_env.length>0) $url += extra_env; + openwin($url,'html_edit',800,575); +} + +function OpenUserSelector(extra_env,TargetForm,TargetField) +{ + var $url = getScriptURL('admin/users/user_select.php'); + $url += '&destform='+TargetForm+'&Selector=radio&destfield='+TargetField+'&IdField=Login'; + if(extra_env.length>0) $url += extra_env; + openwin($url,'user_select',800,575); + return false; +} + +function OpenCatSelector(extra_env) +{ + var $url = getScriptURL('admin/cat_select.php'); + if(extra_env.length>0) $url += extra_env; + openwin($url,'catselect',750,400); +} + + +function OpenItemSelector(extra_env,$TargetForm) +{ + var $url = getScriptURL('admin/relation_select.php') + '&destform='+$TargetForm; + if(extra_env.length>0) $url += extra_env; + openwin($url,'groupselect',750,400); +} + +function OpenUserEdit($user_id, $extra_env) +{ + var $url = getScriptURL('admin/users/adduser.php') + '&direct_id=' + $user_id; + if( isset($extra_env) ) $url += $extra_env; + window.location.href = $url; +} + +function OpenLinkEdit($link_id, $extra_env) +{ + var $url = getScriptURL('in-link/admin/addlink.php') + '&item=' + $link_id; + if( isset($extra_env) ) $url += $extra_env; + window.location.href = $url; +} + +function OpenHelp($help_link) +{ + +// $help_link.match('http://(.*).lv/in-commerce/admin(.*)'); +// alert(RegExp.$2); + openwin($help_link,'HelpPopup',750,400); +} +// in-portal compatibility functions: end + + +function PreSaveAndOpenTranslator(prefix,field,t,$width,$height) +{ + if(!isset($window_name)) var $window_name = 'select_'+t.replace(/(\/|-)/g, '_'); + if(!isset($width)) $width=750; + if(!isset($height)) $height=400; + openwin('',$window_name,$width,$height); + set_hidden_field('translator_wnd_name', $window_name); + set_hidden_field('translator_field', field); + set_hidden_field('translator_t', t); + document.kernel_form.target=$window_name; + submit_event(prefix,'OnPreSaveAndOpenTranslator'); +} + +function openTranslator(prefix,field,url,wnd) +{ + set_hidden_field('trans_prefix', prefix); + set_hidden_field('trans_field', field); + set_hidden_field('events[trans]', 'OnLoad'); + + var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); + var $t = $regex.exec(url)[2]; + document.kernel_form.target = wnd; + submit_event(prefix,'',$t,url); +} + +function openSelector($prefix,$url,$window_name,$width,$height,$event) +{ + var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); + var $t = $regex.exec($url)[2]; + if(!isset($window_name)) var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); + if(!isset($width)) $width=750; + if(!isset($height)) $height=400; + if(!isset($event)) $event=''; + set_hidden_field('m_opener','s'); + openwin('',$window_name,$width,$height); + set_hidden_field('main_prefix', $prefix); + document.kernel_form.target=$window_name; + var old_action = document.kernel_form.action; + document.kernel_form.action = $url; + submit_event($prefix,$event,$t); + document.kernel_form.action = old_action; +} + +function openwin($url,$name,$width,$height) +{ + var $window_params = 'width='+$width+',height='+$height+',status=yes,resizable=yes,menubar=no,scrollbars=yes,toolbar=no'; + return window.open($url,$name,$window_params); +} + +function opener_action(new_action) +{ + document.getElementById('m_opener').value=new_action; +} + +function std_precreate_item(prefix_special, edit_template) +{ + opener_action('d'); + set_hidden_field(prefix_special+'_mode', 't'); + submit_event(prefix_special,'OnPreCreate', edit_template) +} + +function std_new_item(prefix_special, edit_template) +{ + opener_action('d'); + submit_event(prefix_special,'OnNew', edit_template) +} + +function std_edit_item(prefix_special, edit_template) + { + opener_action('d'); + set_hidden_field(prefix_special+'_mode', 't'); + submit_event(prefix_special,'OnEdit',edit_template) +} + +function std_edit_temp_item(prefix_special, edit_template) +{ + opener_action('d'); + submit_event(prefix_special,'',edit_template) +} + +function std_delete_items(prefix_special) +{ + if (inpConfirm('Are you sure you want to delete selected items?')) + submit_event(prefix_special,'OnMassDelete') +} + +// sets hidden field value +// if the field does not exist - creates it +function set_hidden_field($field_id, $value) +{ + var $field = document.getElementById($field_id); + if($field) + { + $field.value = $value; + return true; + } + + $field = document.createElement('INPUT'); + $field.type = 'hidden'; + $field.name = $field_id; + $field.id = $field_id; + $field.value = $value; + document.kernel_form.appendChild($field); + return false; +} + +function search($prefix_special, $grid_name) +{ + set_hidden_field('grid_name', $grid_name); + submit_event($prefix_special,'OnSearch'); +} + +function search_reset($prefix_special) +{ + submit_event($prefix_special,'OnSearchReset'); +} + +function search_keydown($event) +{ + if(!$event && window.event) $event = window.event; + if($event.keyCode == 13) + { + var $prefix_special = this.getAttribute('PrefixSpecial'); + var $grid = this.getAttribute('Grid'); + search($prefix_special,$grid); + } +} + +function getRealLeft(el) +{ + xPos = el.offsetLeft; + tempEl = el.offsetParent; + while (tempEl != null) + { + xPos += tempEl.offsetLeft; + tempEl = tempEl.offsetParent; + } + return xPos; +} + +function getRealTop(el) +{ + yPos = el.offsetTop; + tempEl = el.offsetParent; + while (tempEl != null) + { + yPos += tempEl.offsetTop; + tempEl = tempEl.offsetParent; + } + return yPos; +} + +function show_viewmenu($toolbar, $button_id) +{ + var $img = $toolbar.GetButtonImage($button_id); + var $pos_x = getRealLeft($img) - ((document.all) ? 6 : -2); + var $pos_y = getRealTop($img) + 32; + + var $prefix_special = ''; + window.triedToWriteMenus = false; + + if($ViewMenus.length == 1) + { + $prefix_special = $ViewMenus[$ViewMenus.length-1]; + $fw_menus[$prefix_special+'_view_menu'](); + $Menus[$prefix_special+'_view_menu'].writeMenus('MenuContainers['+$prefix_special+']'); + window.FW_showMenu($Menus[$prefix_special+'_view_menu'], $pos_x, $pos_y); + } + else + { + // prepare menus + for(var $i in $ViewMenus) + { + $prefix_special = $ViewMenus[$i]; + $fw_menus[$prefix_special+'_view_menu'](); + } + $Menus['mixed'] = new Menu('ViewMenu_mixed'); + + // merge menus into new one + for(var $i in $ViewMenus) + { + $prefix_special = $ViewMenus[$i]; + $Menus['mixed'].addMenuItem( $Menus[$prefix_special+'_view_menu'] ); + } + + $Menus['mixed'].writeMenus('MenuContainers[mixed]'); + window.FW_showMenu($Menus['mixed'], $pos_x, $pos_y); + } +} + +function set_window_title($title) +{ + var $window = window; + if($window.parent) $window = $window.parent; + $window.document.title = (main_title.length ? main_title + ' - ' : '') + $title; +} + +function set_filter($prefix_special, $filter_id, $filter_value) +{ + set_hidden_field('filter_id',$filter_id); + set_hidden_field('filter_value',$filter_value); + submit_event($prefix_special,'OnSetFilter'); +} + +function filters_remove_all($prefix_special) +{ + submit_event($prefix_special,'OnRemoveFilters'); +} + +function filters_apply_all($prefix_special) +{ + submit_event($prefix_special,'OnApplyFilters'); +} + +function RemoveTranslationLink($string) +{ + return $string.match(/(.*)<\/a>/) ? RegExp.$2 : $string; +} + +function redirect($url) +{ + window.location.href = $url; +} \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon24_settings_email.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_currency_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/translator/translator_config.php =================================================================== diff -u --- trunk/core/units/translator/translator_config.php (revision 0) +++ trunk/core/units/translator/translator_config.php (revision 1566) @@ -0,0 +1,52 @@ + 'trans', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'TranslatorEventHandler','file'=>'translator_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => false, + 'hooks' => Array(), + 'QueryString' => Array( + 1 => 'prefix', + 2 => 'field', + 3 => 'event', + ), + 'IDField' => 'N/A', + + 'TitleField' => 'Translator', + + 'TitlePhrase' => 'la_text_Translation', + + 'TitlePresets' => Array( + 'default' => Array( + 'new_status_labels' => Array('trans'=>'!la_title_Adding_Order!'), + 'edit_status_labels' => Array('trans'=>'!la_title_Editing_Order!'), + 'new_titlefield' => Array('trans'=>'!la_title_New_Order!'), + ), + + 'trans_edit' => Array('prefixes' => Array('trans'), 'format' => '!la_title_EditingTranslation!'), + + ), + /* + 'TableName' => 'N/A', + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s',), + + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',),*/ + + 'Fields' => Array( + ), + + 'VirtualFields' => Array( + 'Original' => Array(), + 'Language' => Array(), + 'SwitchLanguage' => Array('formatter'=>'kOptionsFormatter', + 'options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field'=>'LanguageId','option_title_field'=>'PackName'), + 'Translation' => Array(), + ), + 'Grids' => Array(), + ); + +?> \ No newline at end of file Index: trunk/themes/default/img/ic_head_incommerce.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab_active_back2.jpg =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/inp1_parser.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon46_list_summary_logs.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon46_settings_in-link.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/browse.php =================================================================== diff -u -r1510 -r1566 --- trunk/admin/browse.php (.../browse.php) (revision 1510) +++ trunk/admin/browse.php (.../browse.php) (revision 1566) @@ -14,11 +14,35 @@ ############################################################## //$pathtoroot=""; + +//KERNEL4 STARTUP - FOR ACTIONS HANDLING + +function k4getmicrotime() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +$start = k4getmicrotime(); + +define('ADMIN', 1); +define('FULL_PATH', realpath(dirname(__FILE__).'/..')); +define('APPLICATION_CLASS', 'MyApplication'); +define('ADMINS_LIST','/in-portal/users/users.php'); +include_once(FULL_PATH."/kernel/kernel4/startup.php"); + +$application =& kApplication::Instance(); +$application->Init(); +$application->ProcessRequest(); +if($application->GetVar('Action') == 'm_paste') define('REDIRECT_REQUIRED',1); // this script can issue redirect header + +//KERNEL4 END + define('REQUIRE_LAYER_HEADER', 1); $b_topmargin = "0"; //$b_header_addon = "

"; -if(!strlen($pathtoroot)) +if( !(isset($pathtoroot) && $pathtoroot) ) { $path=dirname(realpath(__FILE__)); if(strlen($path)) @@ -134,6 +158,20 @@ @include_once($path); } } + + +$application->InitParser(); + +$cat_templates = $objModules->ExecuteFunction('GetModuleInfo', 'catalog_template'); +foreach ($cat_templates as $a_mod => $a_template) { + if (!$a_template) continue; + $a_var = $a_mod.'_TAB_HTML'; + $$a_var = $application->ParseBlock(Array('name'=>$a_template), 0, true); +} + +//$application->SetVar('t', 'in-commerce/products/products_catalog'); + + if(!defined('IS_INSTALL'))define('IS_INSTALL',0); if(!IS_INSTALL) { @@ -177,11 +215,16 @@ // where should all edit popups submit changes $objSession->SetVariable("ReturnScript", basename($_SERVER['PHP_SELF']) ); $charset = GetRegionalOption('Charset'); + +$m_tag_processor =& $application->recallObject('m_TagProcessor'); +$base_href = $m_tag_processor->Base_Ref(); + /* page header */ print << In-portal + $base_href + + + + + + + + + + + + + +> + + + +Reload frame || Show debugger + + + + + + + + + + + + + +
+ + +
+ +"> +"> + + + + + + + + +
+ + \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_move_down.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin/include/toolbar/catselect.php =================================================================== diff -u -r407 -r1566 --- trunk/kernel/admin/include/toolbar/catselect.php (.../catselect.php) (revision 407) +++ trunk/kernel/admin/include/toolbar/catselect.php (.../catselect.php) (revision 1566) @@ -277,7 +277,7 @@ catch(err) { } - bf.$destfield.value = CheckList('categories'); + bf.elements['$destfield'].value = CheckList('categories'); bf.submit(); window.close(); } @@ -366,7 +366,7 @@ function check_submit(page,actionValue) { - if (actionValue.match(/delete$/)) { + if (actionValue.match(/delete$/)) { if (!theMainScript.Confirm(lang_DeleteConfirm)) return; } Index: trunk/kernel/admin_templates/img/toolbar/tool_archive_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_template_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/admin/include/fw_menu.js =================================================================== diff -u -r13 -r1566 --- trunk/admin/include/fw_menu.js (.../fw_menu.js) (revision 13) +++ trunk/admin/include/fw_menu.js (.../fw_menu.js) (revision 1566) @@ -50,15 +50,22 @@ this.onMenuItemAction = onMenuItemAction; this.hideMenu = hideMenu; this.hideChildMenu = hideChildMenu; - + + label = RemoveTranslationLink(label); if (!window.menus) window.menus = new Array(); this.label = label || "menuLabel" + window.menus.length; window.menus[this.label] = this; window.menus[window.menus.length] = this; if (!window.activeMenus) window.activeMenus = new Array(); } +function RemoveTranslationLink($string) +{ + return $string.match(/(.*)<\/a>/) ? RegExp.$2 : $string; +} + function addMenuItem(label, action, type) { + if( typeof(label) == 'string' ) label = RemoveTranslationLink(label); this.items[this.items.length] = label; this.actions[this.actions.length] = action; if (type == 1) this.types[this.types.length] = this.imagePath+"check_on.gif"; Index: trunk/kernel/admin_templates/img/toolbar/tool_clone_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/list_horiz_propagate.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/help/help_tag_processor.php =================================================================== diff -u --- trunk/kernel/units/help/help_tag_processor.php (revision 0) +++ trunk/kernel/units/help/help_tag_processor.php (revision 1566) @@ -0,0 +1,62 @@ +Application->GetVar('h_prefix') ); + $this->Prefix = $rets[0]; + $this->Special = isset($rets[1]) ? $rets[1] : ''; + //$this->Prefix = $this->Application->GetVar('h_prefix'); + $title_preset_name = $this->Application->GetVar('h_title_preset'); + + $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); + + $format = $title_presets[$title_preset_name]['format']; + $format = preg_replace('/[ ]*( ([\'"]{1}) | ([\(]{1}) ) \#.*\# (?(2) \1 | \) )[ ]*/Ux', ' ', $format); + $title_presets[$title_preset_name]['format'] = $format; + $this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets); + + $params['title_preset'] = $title_preset_name; + + $ret = parent::SectionTitle($params); + + + + return $ret; + } + + function ShowHelp($params) + { + $module = $this->Application->GetVar('h_module'); + $title_preset = $this->Application->GetVar('h_title_preset'); + + $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) ); + $module_path = $this->Conn->GetOne($sql); + + $help_file = FULL_PATH.'/'.$module_path.'module_help/'.$title_preset.'.txt'; + + if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_EDIT_HELP') ) + { + global $debugger; + $ret = 'Help file: '.$debugger->getLocalFile($help_file).'
'; + } + else + { + $ret = ''; + } + + if( file_exists($help_file) ) + { + $ret .= file_get_contents($help_file); + } + else + { + $ret .= $this->Application->Phrase('la_section_help_file_missing'); + } + return $ret; + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_next_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_validate.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_refresh.gif =================================================================== diff -u Binary files differ Index: trunk/admin/install/inportal_data.sql =================================================================== diff -u -r1384 -r1566 --- trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 1384) +++ trunk/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 1566) @@ -39,6 +39,7 @@ INSERT INTO ConfigurationAdmin VALUES ('SocketBlockingMode', 'la_Text_Website', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 11, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_UserName', 'la_Text_General', 'la_text_min_username', 'text', '', '', 1, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_Password', 'la_Text_General', 'la_text_min_password', 'text', '', '', 2, 0); +INSERT INTO ConfigurationAdmin VALUES ('Email_As_Login', 'la_Text_General', 'la_use_emails_as_login', 'checkbox', NULL, NULL, 1, 0); INSERT INTO ConfigurationValues VALUES ('Columns_Category', '2', 'In-Portal', 'Categories') INSERT INTO ConfigurationValues VALUES ('DomainSelect','1','In-Portal','in-portal:configure_general') @@ -153,6 +154,7 @@ INSERT INTO ConfigurationValues VALUES ('Perpage_CustomData', '20', 'In-Portal', ''); INSERT INTO ConfigurationValues VALUES ('Search_MinKeyword_Length', '3', 'In-Portal', ''); INSERT INTO ConfigurationValues VALUES ('Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users'); +INSERT INTO ConfigurationValues VALUES ('Email_As_Login', '1', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO Events VALUES (30, 'USER.ADD', 1, 0, 'In-Portal:Users', 'la_event_user.add', 0) INSERT INTO Events VALUES (32, 'USER.ADD', 2, 0, 'In-Portal:Users', 'la_event_user.add', 1) Index: trunk/kernel/admin_templates/img/itemicons/icon16_review_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_archives.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/backordered.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_catsearch.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_import_language_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab_back.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_search_reset.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_settings_email.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_manufacturers.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/configuration/configuration_tag_processor.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_view_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_user_denied.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_stop_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/action.php =================================================================== diff -u -r1381 -r1566 --- trunk/kernel/action.php (.../action.php) (revision 1381) +++ trunk/kernel/action.php (.../action.php) (revision 1566) @@ -1224,7 +1224,7 @@ if(!(int)$_POST["enabled"]) $Primary = 0; $t = $objEditItems->AddTheme($_POST["name"],$_POST["description"],(int)$_POST["enabled"],$Primary, - (int)$_POST["CacheTimeout"]); + (int)$_POST["CacheTimeout"],GetVar('StylesheetId')); $t->Files->ThemeId=$t->Get("ThemeId"); $rs = $ado->Execute("SELECT MIN(ThemeId) as MinValue FROM ".$objEditItems->SourceTable); @@ -1244,7 +1244,7 @@ $Primary = 0; $objEditItems->EditTheme($_POST["ThemeId"],$_POST["name"],$_POST["description"], - (int)$_POST["enabled"],$Primary,(int)$_POST["CacheTimeout"]); + (int)$_POST["enabled"],$Primary,(int)$_POST["CacheTimeout"], GetVar('StylesheetId')); // if ($Primary==1) // { // $objEditItems->SetPrimaryTheme($_POST["ThemeId"]); Index: trunk/kernel/admin_templates/img/icons/icon24_users.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_tool_backup.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_image_disabled.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/inp_login_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_new_order.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_ship_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/languages/languages_tag_processor.php =================================================================== diff -u --- trunk/kernel/units/languages/languages_tag_processor.php (revision 0) +++ trunk/kernel/units/languages/languages_tag_processor.php (revision 1566) @@ -0,0 +1,61 @@ +Application->GetVar('phrases_label'); + + $top_prefix = $this->Application->GetTopmostPrefix($this->Prefix); + if( $this->Application->GetVar($top_prefix.'_mode') == 't' && !$edit_direct ) + { + $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + return $object->GetDBField('Charset'); + } + $lang_current =& $this->Application->recallObject('lang.current'); + return $lang_current->GetDBField('Charset'); + } + + function ListLanguages($params) + { + $this->Special = 'list'; + return $this->PrintList2($params); + } + + function SelectedLanguage($params) + { + $object =& $this->Application->recallObject($this->getPrefixSpecial()); + + return $object->GetDBField('LanguageId') == $this->Application->RecallVar('m_lang'); + } + + /** + * Returns path where exported languages should be saved + * + * @param unknown_type $params + */ + function ExportPath($params) + { + $admin_folder = $this->Application->ConfigValue('AdminDirectory'); + if(!$admin_folder) $admin_folder = 'admin'; + $ret = DOC_ROOT.BASE_PATH.'/'.$admin_folder.'/export/'; + + if( getArrayValue($params,'as_url') ) + { + $ret = str_replace( DOC_ROOT.BASE_PATH.'/', $this->Application->BaseURL(), $ret); + } + return $ret; + } + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_paymenttype_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_conf_general.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/smicon6.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_preview_template_f2.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/help/help_tag_processor.php =================================================================== diff -u --- trunk/core/units/help/help_tag_processor.php (revision 0) +++ trunk/core/units/help/help_tag_processor.php (revision 1566) @@ -0,0 +1,62 @@ +Application->GetVar('h_prefix') ); + $this->Prefix = $rets[0]; + $this->Special = isset($rets[1]) ? $rets[1] : ''; + //$this->Prefix = $this->Application->GetVar('h_prefix'); + $title_preset_name = $this->Application->GetVar('h_title_preset'); + + $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); + + $format = $title_presets[$title_preset_name]['format']; + $format = preg_replace('/[ ]*( ([\'"]{1}) | ([\(]{1}) ) \#.*\# (?(2) \1 | \) )[ ]*/Ux', ' ', $format); + $title_presets[$title_preset_name]['format'] = $format; + $this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets); + + $params['title_preset'] = $title_preset_name; + + $ret = parent::SectionTitle($params); + + + + return $ret; + } + + function ShowHelp($params) + { + $module = $this->Application->GetVar('h_module'); + $title_preset = $this->Application->GetVar('h_title_preset'); + + $sql = 'SELECT Path FROM '.TABLE_PREFIX.'Modules WHERE LOWER(Name)='.$this->Conn->qstr( strtolower($module) ); + $module_path = $this->Conn->GetOne($sql); + + $help_file = FULL_PATH.'/'.$module_path.'module_help/'.$title_preset.'.txt'; + + if( $this->Application->isDebugMode() && dbg_ConstOn('DBG_EDIT_HELP') ) + { + global $debugger; + $ret = 'Help file: '.$debugger->getLocalFile($help_file).'
'; + } + else + { + $ret = ''; + } + + if( file_exists($help_file) ) + { + $ret .= file_get_contents($help_file); + } + else + { + $ret .= $this->Application->Phrase('la_section_help_file_missing'); + } + return $ret; + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_return_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_usertogroup_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_conf_regional.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_custom.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/configuration/configuration_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/units/languages/languages_item.php =================================================================== diff -u --- trunk/kernel/units/languages/languages_item.php (revision 0) +++ trunk/kernel/units/languages/languages_item.php (revision 1566) @@ -0,0 +1,12 @@ +IDField.') FROM '.kTempTablesHandler::GetLiveName($this->TableName); + return $this->Conn->GetOne($sql) + 1; + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/tab_back.jpg =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_settings_output.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_move_down_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_search_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/progress_bar_segment.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_pending.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/icon16_search_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_summary.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/button_back.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/languages/languages_config.php =================================================================== diff -u --- trunk/core/units/languages/languages_config.php (revision 0) +++ trunk/core/units/languages/languages_config.php (revision 1566) @@ -0,0 +1,140 @@ + 'lang', + 'ItemClass' => Array('class'=>'LanguagesItem','file'=>'languages_item.php','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'LanguagesEventHandler','file'=>'languages_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'LanguagesTagProcessor','file'=>'languages_tag_processor.php','build_event'=>'OnBuild'), + + 'RegisterClasses' => Array( + Array('pseudo'=>'LangXML','class'=>'LangXML_Parser','file'=>'import_xml.php'), + ), + + 'AutoLoad' => true, + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'lang', + 'HookToSpecial' => '', + 'HookToEvent' => Array('OnSave'), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnReflectMultiLingualFields', + ), + + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'lang', + 'HookToSpecial' => '', + 'HookToEvent' => Array('OnPreSave'), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnCopyLabels', + ), + ), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + 'IDField' => 'LanguageId', + + 'StatusField' => Array('Enabled','PrimaryLang'), // field, that is affected by Approve/Decline events + + 'TitleField' => 'PackName', // field, used in bluebar when editing existing item + + 'TitlePresets' => Array( + 'default' => Array( 'new_status_labels' => Array('lang'=>'!la_title_Adding_Language!'), + 'edit_status_labels' => Array('lang'=>'!la_title_Editing_Language!'), + 'new_titlefield' => Array('lang'=>'!la_title_New_Language!'), + ), + + 'languages_list' => Array( 'prefixes' => Array('lang_List'), 'format' => "!la_title_Configuration! - !la_title_LanguagePacks! (#lang_recordcount#)"), + + 'languages_edit_general' => Array( 'prefixes' => Array('lang'), 'format' => "#lang_status# '#lang_titlefield#' - !la_title_General!"), + + 'phrases_list' => Array( 'prefixes' => Array('lang','phrases_List'), 'format' => "#lang_status# '#lang_titlefield#' - !la_title_Labels! (#phrases_recordcount#)"), + + 'import_language' => Array( 'prefixes' => Array('phrases.import'), 'format' => "!la_title_InstallLanguagePackStep1!"), + + 'import_language_step2' => Array( 'prefixes' => Array('phrases.import'), 'format' => "!la_title_InstallLanguagePackStep2!"), + + 'export_language' => Array( 'prefixes' => Array('phrases.export'), 'format' => "!la_title_ExportLanguagePackStep1!"), + + 'export_language_results' => Array( 'prefixes' => Array('phrases.export'), 'format' => "!la_title_ExportLanguagePackResults!"), + + 'events_list' => Array( 'prefixes' => Array('lang','emailevents_List'), 'format' => "#lang_status# '#lang_titlefield#' - !la_title_EmailEvents! (#emailevents_recordcount#)"), + + 'event_edit' => Array( 'prefixes' => Array('emailevents'), + 'edit_status_labels' => Array('emailevents' => '!la_title_Editing_EmailEvent!'), + 'format' => '#emailevents_status# - #emailevents_titlefield#'), + + 'email_messages_edit' => Array( 'prefixes' => Array('lang','emailmessages'), + 'new_titlefield' => Array('emailmessages' => '!la_NoSubject!'), + 'format' => "#lang_status# '#lang_titlefield#' - !la_title_EditingEmailEvent! '#emailmessages_titlefield#'"), + ), + + 'TableName' => TABLE_PREFIX.'Language', + 'SubItems' => Array('phrases','emailmessages'), + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER), + ), + + 'Filters' => Array( + 0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ), + 1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ), + ) + ), + + 'AutoDelete' => true, + + 'AutoClone' => true, + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', + ), + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('PackName' => 'asc'), + ) + ), + 'Fields' => Array( + 'LanguageId' => Array(), + 'PackName' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + 'LocalName' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + 'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'), + 'PrimaryLang' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'IconURL' => Array('type' => 'string','default' => ''), + 'DateFormat' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + 'TimeFormat' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + 'DecimalPoint' => Array('type' => 'string','not_null' => '1','default' => '.'), + 'ThousandSep' => Array('type' => 'string','not_null' => '1','default' => ','), + 'Charset' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + ), + + 'VirtualFields' => Array( + 'CopyLabels' => Array('type' => 'int', 'default' => 0), + 'CopyFromLanguage' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Language ORDER BY PackName', 'option_title_field' => 'PackName', 'option_key_field' => 'LanguageId'), + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif','0_0'=>'icon16_language_disabled.gif','1_0'=>'icon16_language.gif','0_1'=>'icon16_language_disabled.gif','1_1'=>'icon16_language_primary.gif'), + 'Fields' => Array( + 'PackName' => Array( 'title'=>'la_col_PackName', 'data_block' => 'grid_checkbox_td'), + 'LocalName' => Array( 'title'=>'la_col_LocalName' ), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/old/menu_edit_cat.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/arrow16.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_back.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_frontend_mail_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_tool_import.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_relation_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_to_shipping_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_cat_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_group_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/cat_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/units/users/users_config.php =================================================================== diff -u --- trunk/kernel/units/users/users_config.php (revision 0) +++ trunk/kernel/units/users/users_config.php (revision 1566) @@ -0,0 +1,94 @@ + 'u', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'UsersEventHandler','file'=>'users_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'UsersTagProcessor','file'=>'users_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'u', + 'HookToSpecial' => '', + 'HookToEvent' => Array('OnAfterItemLoad', 'OnBeforeItemCreate', 'OnBeforeItemUpdate', 'OnUpdateAddress'), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnPrepareStates', + ), + ), + + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + 'IDField' => 'PortalUserId', + 'TableName' => TABLE_PREFIX.'PortalUser', + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', + ), + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Login' => 'asc'), + ) + ), + + 'SubItems' => Array('addr'), + + 'Fields' => Array + ( + 'PortalUserId' => Array(), + 'Login' => Array('type' => 'string', 'unique'=>Array('Login'), 'default' => '','required'=>1), + 'Password' => Array('type' => 'string', 'formatter' => 'kPasswordFormatter', 'encryption_method' => 'md5', 'verify_field' => 'VerifyPassword', 'skip_empty' => 1, 'default' => md5('') ), + 'FirstName' => Array('type' => 'string','default' => ''), + 'LastName' => Array('type' => 'string','default' => ''), + 'Email' => Array('type' => 'string', 'formatter'=>'kFormatter', 'regexp'=>'/^[_a-zA-Z0-9-\.]+@[a-zA-Z0-9-\.]+\.[a-z]{2,4}$/', 'unique'=>Array('Email'), 'not_null' => '1', 'required'=>1, 'default' => '', 'error_msgs' => Array('invalid_format'=>'!la_invalid_email!') ), + 'CreatedOn' => Array('type'=>'int', 'formatter' => 'kDateFormatter', 'default'=>time(), 'not_null' => '1' ), + 'Phone' => Array('type' => 'string','default' => ''), + 'Street' => Array('type' => 'string','default' => ''), + 'City' => Array('type' => 'string','default' => ''), + 'State' => Array('formatter'=>'kOptionsFormatter', + 'options' => Array(), + 'option_key_field'=>'DestAbbr','option_title_field'=>'Translation', + 'not_null' => '1','default' => ''), + 'Zip' => Array('type' => 'string','default' => ''), + 'Country' => Array('formatter'=>'kOptionsFormatter', + 'options_sql'=>'SELECT %s + FROM '.TABLE_PREFIX.'StdDestinations + LEFT JOIN '.TABLE_PREFIX.'Phrase + ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName + WHERE + DestType=1 + AND + LanguageId = 1 + ORDER BY Translation', + 'option_key_field'=>'DestAbbr','option_title_field'=>'Translation', + 'not_null' => '1','default' => ''), + 'ResourceId' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'Status' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array(1=>'la_Enabled', 0=>'la_Disabled', 2=>'la_Pending'), 'use_phrases'=>1, 'not_null' => '1','default' => 2), + 'Modified' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'not_null' => '1', 'default' => time() ), + 'dob' => Array('type'=>'int', 'formatter' => 'kDateFormatter', 'not_null' => '1', 'default' => '', 'required'=>1), + 'tz' => Array('type' => 'int','default' => ''), + 'ip' => Array('type' => 'string','default' => ''), + 'IsBanned' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'PassResetTime' => Array('type' => 'int','default' => ''), + 'PwResetConfirm' => Array('type' => 'string','default' => ''), + 'PwRequestTime' => Array('type' => 'int','default' => ''), + 'MinPwResetDelay' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array('300' => '5', '600' => '10', '900' => '15', '1800' => '30', '3600' => '60'), 'use_phrases' => 0, 'not_null' => '1', 'default' => 30), + ), + + 'VirtualFields' => Array( + 'ValidateLogin' => Array('type'=>'string','default'=>''), + 'SubscribeEmail' => Array('type'=>'string','default'=>''), + ), + + 'Grids' => Array(), + + ); + +?> \ No newline at end of file Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/custom_fields/custom_fields_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_refresh_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_prev_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_cat.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_upcat_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/modules.php =================================================================== diff -u -r1462 -r1566 --- trunk/kernel/include/modules.php (.../modules.php) (revision 1462) +++ trunk/kernel/include/modules.php (.../modules.php) (revision 1566) @@ -44,16 +44,19 @@ if(strlen($key)) { $parsed=FALSE; + $parser_name = $key . "_ParseEnv"; for($i=1; $i\n"; - if(($objConfig->Get("CookieSessions")==0 || !$FrontEnd || ($objConfig->Get("CookieSessions")==2 && $SessionQueryString==TRUE))) - { - if(!$objSession->UseTempKeys) - { - $sessionkey = $objSession->GetSessionKey(); - } - else - $sessionkey = $objSession->Get("CurrentTempKey"); - $env = $sessionkey; - } - $env .= "-"; - - if (isset($var_list_update["t"])) - { - if($var_list_update["t"]=="_referer_") - { - $var_list_update["t"] =$objSession->GetVariable("Template_Referer"); - } - - $t = $var_list_update["t"]; - if(!is_numeric($t)) - { - if(!is_object($theme)) - $theme = $objThemes->GetItem($m_var_list["theme"]); - $id = $theme->GetTemplateId($t); - $var_list_update["t"] = $id; - } - $env .= $var_list_update["t"]; - } + static $theme; + + $env = ""; + //echo "Query String: $SessionQueryString
\n"; + if(($objConfig->Get("CookieSessions")==0 || !$FrontEnd || ($objConfig->Get("CookieSessions")==2 && $SessionQueryString==TRUE))) + { + if(!$objSession->UseTempKeys) + { + $sessionkey = $objSession->GetSessionKey(); + } + else + $sessionkey = $objSession->Get("CurrentTempKey"); + $env = $sessionkey; + } + $env .= "-"; + + if (isset($var_list_update["t"])) + { + if($var_list_update["t"]=="_referer_") + { + $var_list_update["t"] =$objSession->GetVariable("Template_Referer"); + } + + $t = $var_list_update["t"]; + + if (substr($t, 0, strlen('kernel4:')) == 'kernel4:') + { + $t = substr($t, strlen('kernel4:')); + $env .= $t; + } + else { + if(!is_numeric($t)) + { + if(!is_object($theme)) + $theme = $objThemes->GetItem($m_var_list["theme"]); + $id = $theme->GetTemplateId($t); + $var_list_update["t"] = $id; + } + $env .= $var_list_update["t"]; + } + } else - { - $t = isset($var_list['t']) ? $var_list['t'] : ''; - if(!is_numeric($t)) - { - if(!is_object($theme)) - $theme = $objThemes->GetItem($m_var_list["theme"]); - $id = $theme->GetTemplateId($t); - $t = $id; - } - $env .= $t; - } + { + $t = isset($var_list['t']) ? $var_list['t'] : ''; + if(!is_numeric($t)) + { + if(!is_object($theme)) + $theme = $objThemes->GetItem($m_var_list["theme"]); + $id = $theme->GetTemplateId($t); + $t = $id; + } + $env .= $t; + } - if(is_array($mod_prefix)) - { - foreach($mod_prefix as $key => $value) - { - $builder_name = $key . "_BuildEnv"; - if(function_exists($builder_name)) - { - $GLOBALS[$key.'_var_list_update']['test'] = 'test'; - $env .= $builder_name(); - } - } - } - - $extra = ""; - $keys = array_keys($ExtraVars); - if(is_array($keys)) - { - for($i=0;$i $value) + { + $builder_name = $key . "_BuildEnv"; + if(function_exists($builder_name)) + { + $GLOBALS[$key.'_var_list_update']['test'] = 'test'; + $env .= $builder_name(); + } + } + } - $e = "&".$key."=".$ExtraVars[$key]; - $extra .= $e; - $e = ""; - } - } - $env .= $extra; - + $extra = ""; + $keys = array_keys($ExtraVars); + if(is_array($keys)) + { + for($i=0;$i $folder_name) { + $var_to_global = $key.'_var_list'; + global $$var_to_global; + if( $FrontEnd==0 || !is_numeric($FrontEnd) || $FrontEnd==2) { $rootURL="http://".ThisDomain().$objConfig->Get("Site_Path"); Index: trunk/kernel/admin_templates/img/toolbar/tool_next.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/stylesheets/stylesheets_event_handler.php =================================================================== diff -u --- trunk/core/units/stylesheets/stylesheets_event_handler.php (revision 0) +++ trunk/core/units/stylesheets/stylesheets_event_handler.php (revision 1566) @@ -0,0 +1,66 @@ +Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + $object->SwitchToLive(); + + $ids = explode(',', $event->MasterEvent->getEventParam('ids') ); + + if($ids) + { + $this->Application->setUnitOption('selectors','AutoLoad',false); + $selector_item =& $this->Application->recallObject('selectors.item', 'selectors', Array('live_table'=>true) ); + $parent_field = $this->Application->getUnitOption($selector_item->Prefix,'ForeignKey'); + + $sql_template = 'SELECT '.$selector_item->IDField.' FROM '.$selector_item->TableName.' WHERE '.$parent_field.' = %s'; + + foreach($ids as $id) + { + $object->Load($id); + $selectors_ids = $this->Conn->GetCol( sprintf($sql_template,$id) ); + $ret = '/* This file is generated automatically. Don\'t edit it manually ! */'."\n\n"; + + foreach($selectors_ids as $selector_id) + { + $selector_item->Load($selector_id); + $ret .= $selector_item->CompileStyle()."\n"; + } + + $ret .= $object->GetDBField('AdvancedCSS'); + + $compile_ts = time(); + $css_path = DOC_ROOT.BASE_PATH.'/kernel/stylesheets/'; + + $css_file = $css_path.strtolower($object->GetDBField('Name')).'-'.$compile_ts.'.css'; + + $fp = fopen($css_file,'w'); + if($fp) + { + $prev_css = $css_path.strtolower($object->GetDBField('Name')).'-'.$object->GetDBField('LastCompiled').'.css'; + if( file_exists($prev_css) ) unlink($prev_css); + + fwrite($fp, $ret); + fclose($fp); + + $object->SetDBField('LastCompiled_date', $compile_ts); + $object->SetDBField('LastCompiled_time', $compile_ts); + $object->Update(); + } + } + } + } + + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_shipping_f2.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/languages/languages_item.php =================================================================== diff -u --- trunk/core/units/languages/languages_item.php (revision 0) +++ trunk/core/units/languages/languages_item.php (revision 1566) @@ -0,0 +1,12 @@ +IDField.') FROM '.kTempTablesHandler::GetLiveName($this->TableName); + return $this->Conn->GetOne($sql) + 1; + } + } + +?> \ No newline at end of file Index: trunk/admin/users/adduser_images.php =================================================================== diff -u -r1015 -r1566 --- trunk/admin/users/adduser_images.php (.../adduser_images.php) (revision 1015) +++ trunk/admin/users/adduser_images.php (.../adduser_images.php) (revision 1566) @@ -133,9 +133,12 @@ $ListForm = "imagelistform"; $CheckClass = "ImageChecks"; /* ------------------------------------- Configure the toolbar ------------------------------------------- */ + +$saveURL = $admin."/".$objSession->GetVariable('ReturnScript'); + $objListToolBar = new clsToolBar(); -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif"); +$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$saveURL."',1);","tool_select.gif"); +$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$saveURL."',2);","tool_cancel.gif"); if($itemcount == 1) $objListToolBar->Add("divider"); $objListToolBar->Set("section",$section); Index: trunk/kernel/admin_templates/img/toolbar/tool_new_paymenttype.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_catsearch.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin/include/toolbar/advanced_view.php =================================================================== diff -u -r1333 -r1566 --- trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 1333) +++ trunk/kernel/admin/include/toolbar/advanced_view.php (.../advanced_view.php) (revision 1566) @@ -225,6 +225,14 @@ form_name = activeTab.id; action_prefix = activeTab.getAttribute("ActionPrefix"); if(page.length == 0) page = activeTab.getAttribute("EditURL"); + + if ( action_prefix.match("k4:(.*)") ) + { + act = RegExp.$1; + act = act.replace('$\$event$$', actionValue); + eval(act); + return; + } } var f = document.getElementsByName(form_name+'_form')[0]; Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/grid.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/grid.js (revision 0) +++ trunk/kernel/admin_templates/incs/grid.js (revision 1566) @@ -0,0 +1,315 @@ +function GridItem(grid, an_element, cb, item_id, class_on, class_off) +{ + this.Grid = grid; + this.selected = false; + this.id = an_element.id; + this.ItemId = item_id; + this.sequence = parseInt(an_element.getAttribute('sequence')); + this.class_on = class_on; + if (class_off == ':original') { + this.class_off = an_element.className; + } + else + this.class_off = class_off; + this.HTMLelement = an_element; + this.CheckBox = cb; + + this.value = this.ItemId; + this.ItemType = 11; +} + +GridItem.prototype.Init = function () +{ + this.HTMLelement.GridItem = this; + this.HTMLelement.onclick = function(ev) { + this.GridItem.Click(ev); + }; + this.HTMLelement.ondblclick = function(ev) { + this.GridItem.DblClick(ev); + } + if ( isset(this.CheckBox) ) { + this.CheckBox.GridItem = this; + this.CheckBox.onclick = function(ev) { + this.GridItem.cbClick(ev); + }; + this.CheckBox.ondblclick = function(ev) { + this.GridItem.DblClick(ev); + } + } +} + +GridItem.prototype.DisableClicking = function () +{ + this.HTMLelement.onclick = function(ev) { + return false; + }; + this.HTMLelement.ondblclick = function(ev) { + return false; + } + if ( isset(this.CheckBox) ) { + this.CheckBox.onclick = function(ev) { + return false; + }; + } +} + +GridItem.prototype.Select = function () +{ + if (this.selected) return; + this.selected = true; + this.HTMLelement.className = this.class_on; + if ( isset(this.CheckBox) ) { + this.CheckBox.checked = true; + } + this.Grid.LastSelectedId = this.ItemId; + this.Grid.SelectedCount++; + + // this is for in-portal only (used in relation select) + LastCheckedItem = this; +} + +GridItem.prototype.UnSelect = function ( force ) +{ + if ( !this.selected && !force) return; + this.selected = false; + this.HTMLelement.className = this.class_off; + if ( isset(this.CheckBox) ) { + this.CheckBox.checked = false; + } + this.Grid.SelectedCount--; +} + +GridItem.prototype.Click = function (ev) +{ + if (!is.ie) { + var e = ev; + window.getSelection().removeAllRanges(); //Other browsers + } + else { + var e = window.event; + document.selection.empty() //IE + } + + this.Grid.ClearAlternativeGridsSelection(); + + if (e.shiftKey && !this.Grid.RadioMode) { + this.Grid.SelectRangeUpTo(this.sequence); + } + else { + if (e.ctrlKey && !this.Grid.RadioMode) { + this.Toggle() + } + else { + this.Grid.ClearSelection(null,'GridItem.Click'); + this.Toggle(); + } + } + this.Grid.CheckDependencies(); + e.cancelBubble = true; +} + +GridItem.prototype.cbClick = function (ev) +{ + var e = is.ie ? window.event : ev; + if (this.Grid.RadioMode) this.Grid.ClearSelection(null,'GridItem.cbClick'); + this.Grid.ClearAlternativeGridsSelection(); + this.Toggle(); + this.Grid.CheckDependencies(); + e.cancelBubble = true; +} + +GridItem.prototype.DblClick = function (ev) +{ + var e = is.ie ? window.event : ev; + this.Grid.Edit(); +} + +GridItem.prototype.Toggle = function () +{ + if (this.selected) this.UnSelect() + else { + this.Grid.LastSelectedSequence = this.sequence; + this.Select(); + } +} + +GridItem.prototype.FallsInRange = function (from, to) +{ + return (from <= to) ? + (this.sequence >= from && this.sequence <= to) : + (this.sequence >= to && this.sequence <= from); +} + + +function Grid(class_on, class_off, dbl_click, toolbar) +{ + this.class_on = class_on; + this.class_off = class_off; + this.Items = new Array(); + this.LastSelectedSequence = 1; + this.LastSelectedId = null; + this.DblClick = dbl_click; + this.ToolBar = toolbar; + this.SelectedCount = 0; + this.AlternativeGrids = new Array(); + this.DependantButtons = new Array(); + this.RadioMode = false; +} + +Grid.prototype.AddItem = function( an_item ) { + this.Items[an_item.id] = an_item; +} + +Grid.prototype.AddItemsByIdMask = function ( tag, mask, cb_mask ) { + var $item_id=0; + elements = document.getElementsByTagName(tag.toUpperCase()); + for (var i=0; i < elements.length; i++) { + if ( typeof(elements[i].id) == 'undefined') { + continue; + } + if ( !elements[i].id.match(mask)) continue; + $item_id=RegExp.$1; + + cb_name = cb_mask.replace('$$ID$$',$item_id); + + cb = document.getElementById(cb_name); + if (typeof(cb) == 'undefined') alert ('No Checkbox defined for item '+elements[i].id); + + this.AddItem( new GridItem( this, elements[i], cb, $item_id, this.class_on, this.class_off ) ); + } +} + +Grid.prototype.InitItems = function() { + for (var i in this.Items) { + this.Items[i].Init(); + } + this.ClearSelection( true,'Grid.InitItems' ); +} + +Grid.prototype.DisableClicking = function() { + for (var i in this.Items) { + this.Items[i].DisableClicking(); + } + this.ClearSelection( true, 'Grid.DisableClicking' ); +} + +Grid.prototype.ClearSelection = function( force, called_from ) { + if (typeof(force) == 'undefined') force = false; + if (this.CountSelected() == 0 && !force) return; + for (var i in this.Items) { + this.Items[i].UnSelect(force); + } + this.SelectedCount = 0; + this.CheckDependencies(); +} + +Grid.prototype.InvertSelection = function() { + for (var i in this.Items) + { + if( this.Items[i].selected ) + { + this.Items[i].UnSelect(); + } + else + { + this.Items[i].Select(); + } + } + this.CheckDependencies(); +} + +Grid.prototype.SelectAll = function() { + for (var i in this.Items) { + this.Items[i].Select(); + } + this.CheckDependencies(); + this.ClearAlternativeGridsSelection(); +} + +Grid.prototype.SelectRangeUpTo = function( last_sequence ) { + for (var i in this.Items) { + if (this.Items[i].FallsInRange(this.LastSelectedSequence, last_sequence)) { + this.Items[i].Select(); + } + } +} + +Grid.prototype.CountSelected = function () +{ + return this.SelectedCount; +} + +Grid.prototype.Edit = function() { + if ( this.CountSelected() == 0 ) return; + this.DblClick(); +} + +Grid.prototype.SetDependantToolbarButtons = function( buttons, mode ) +{ + if (typeof(mode) == 'undefined') mode = 1; //direct (use 0 for invert mode) + for (var i in buttons) { + this.DependantButtons.push(new Array(buttons[i], mode)); + } + //this.DependantButtons = buttons; + this.CheckDependencies(); +} + +Grid.prototype.CheckDependencies = function() +{ + var enabling = (this.CountSelected() > 0) + for (var i in this.DependantButtons) { + if (this.DependantButtons[i][0].match("portal:(.*)")) { + button_name = RegExp.$1; + if (toolbar) { + if (enabling == this.DependantButtons[i][1]) { + toolbar.enableButton(button_name, true); + } + else + { + toolbar.disableButton(button_name, true); + } + } + } + else { + if (enabling == this.DependantButtons[i][1]) { + this.ToolBar.EnableButton(this.DependantButtons[i][0]); + } + else { + this.ToolBar.DisableButton(this.DependantButtons[i][0]); + } + } + } + //if (enabling) this.ClearAlternativeGridsSelection(); + +} + +Grid.prototype.ClearAlternativeGridsSelection = function () +{ + for (var i in this.AlternativeGrids) { + this.AlternativeGrids[i].ClearSelection(null,'Grid.ClearAlternativeGridsSelection'); + } +} + +Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal) +{ + this.AlternativeGrids.push(alt_grid); + if (typeof(reciprocal) != 'undefined' && reciprocal) { + alt_grid.AddAlternativeGrid(this); + } +} + +Grid.prototype.FirstSelected = function () +{ + min_sequence = null; + var res = null + for (var i in this.Items) { + if (!this.Items[i].selected) continue; + if (min_sequence == null) + min_sequence = this.Items[i].sequence; + if (this.Items[i].sequence <= min_sequence) { + res = this.Items[i].ItemId; + min_sequence = this.Items[i].sequence; + } + } + return res; +} \ No newline at end of file Index: trunk/themes/default/img/bullet1.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_theme_f3.gif =================================================================== diff -u Binary files differ Index: trunk/admin/include/tabs.js =================================================================== diff -u -r1016 -r1566 --- trunk/admin/include/tabs.js (.../tabs.js) (revision 1016) +++ trunk/admin/include/tabs.js (.../tabs.js) (revision 1566) @@ -147,7 +147,7 @@ if(full_env.substr(0,3) != "env") full_env = 'env=' + full_env; f = document.getElementById(formname); - + if(f) { var valid = false; @@ -165,10 +165,12 @@ } if(valid || save_value==2 || save_value==-1) { - var URLPrefix = ''; + var URLPrefix = ''; if( targetURL.substring(0, rootURL.length) != rootURL ) URLPrefix = rootURL; - f.action = URLPrefix + targetURL + '?' + full_env; + f.action = URLPrefix + targetURL; + if( !f.action.match('(.*)?env=(.*)') ) f.action += '?' + full_env; + if(status_field.length > 0) { f.elements[status_field].value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save @@ -181,7 +183,9 @@ if(!valid) alert(ErrorMsg); } else + { alert('Form '+formname+' was not found.'); + } } //Used when the save or cancel buttin is hit @@ -195,7 +199,10 @@ f = document.getElementById(formname); if(f) { - f.action = rootURL + targetURL + '?' + full_env; + f.action = rootURL + targetURL; + + if( !f.action.match('(.*)?env=(.*)') ) f.action += '?' + full_env; + //alert(f.action); if(status_field.length>0) { Index: trunk/kernel/admin_templates/img/icons/icon46_summary_logs.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_e-mail_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_users.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/users/users_tag_processor.php =================================================================== diff -u --- trunk/core/units/users/users_tag_processor.php (revision 0) +++ trunk/core/units/users/users_tag_processor.php (revision 1566) @@ -0,0 +1,126 @@ + 'all,m,u', 'u_event' => 'OnLogout'); + return $this->Application->HREF('', '', $pass); + } + + function UseUsernames($params) + { + return $this->Application->ConfigValue('Email_As_Login') != 1; + } + + function RegistrationEnabled($params) + { + return $this->Application->ConfigValue('User_Allow_New') != 2; + } + + function ConfirmPasswordLink($params) + { + //global $m_var_list_update, $var_list_update, $objSession, $objConfig; + + $template = "forgotpw_reset_result"; + + $tmp_user_id = $this->Application->RecallVar("tmp_user_id"); + + $saved_denerated_code = $this->Application->GetVar('saved_denerated_code'); + if ($saved_denerated_code){ + $code = $saved_denerated_code; + } + else { + $code = md5($this->GenerateCode()); + $this->Application->SetVar('saved_denerated_code', $code); + } + + + + $sql = 'UPDATE '.TABLE_PREFIX.'PortalUser SET PwResetConfirm="'.$code.'", PwRequestTime='.mktime().' WHERE PortalUserId='.$tmp_user_id; + + $this->Conn->Query($sql); + + $params = array_merge($params, array('pass'=>'m', 'user_key'=>$code)); + + $main_processor =& $this->Application->recallObject('m_TagProcessor'); + + return $main_processor->T($params); + + } + + function GenerateCode() + { + list($usec, $sec) = explode(" ",microtime()); + + $id_part_1 = substr($usec, 4, 4); + $id_part_2 = mt_rand(1,9); + $id_part_3 = substr($sec, 6, 4); + $digit_one = substr($id_part_1, 0, 1); + if ($digit_one == 0) { + $digit_one = mt_rand(1,9); + $id_part_1 = ereg_replace("^0","",$id_part_1); + $id_part_1=$digit_one.$id_part_1; + } + return $id_part_1.$id_part_2.$id_part_3; + } + + function ForgottenPassword($params){ + return $this->Application->GetVar('ForgottenPassword'); + } + + function TestCodeIsValid($param){ + + $passed_key = $this->Application->GetVar('user_key'); + + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + if (strlen(trim($passed_key)) == 0) { + + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + return false; + } + + + if($user_object->Load(array('PwResetConfirm'=>$passed_key))) + { + $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; + if ($exp_time > mktime()) + { + + + } else { + $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired'; + return false; + + } + } else { + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + return false; + + } + + return true; + } + + /** + * Returns sitem administrator email + * + * @param Array $params + * @return string + */ + function SiteAdminEmail($params) + { + return $this->Application->ConfigValue('Smtp_AdminMailFrom'); + } + + } + + + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_arrange.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_go_up.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/list_arrow_no.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u --- trunk/kernel/units/email_events/email_events_event_handler.php (revision 0) +++ trunk/kernel/units/email_events/email_events_event_handler.php (revision 1566) @@ -0,0 +1,196 @@ +Special == 'module') + { + $object =& $event->getObject(); + $object->addFilter('module_filter', '%1$s.Module = \'In-Commerce\''); + } + } + + /** + * Sets status Front-End Only to selected email events + * + * @param kEvent $event + */ + function OnFrontOnly(&$event) + { + $this->StoreSelectedIDs($event); + $ids = $this->getSelectedIDs($event); + $ids = implode(',', $ids); + + $table = $this->Application->getUnitOption($event->Prefix,'TableName'); + $sql = 'UPDATE '.$table.' SET Enabled = 2 WHERE EventId IN ('.$ids.')'; + $this->Conn->Query($sql); + } + + /** + * Sets selected user to email events selected + * + * @param kEvent $event + */ + function OnSelectUser(&$event) + { + $user_name = $this->Application->GetVar( $event->getPrefixSpecial(true).'_PopupSelectedUser' ); + if( strlen($user_name) > 0 ) + { + $this->StoreSelectedIDs($event); + $ids = $this->getSelectedIDs($event); + $ids = implode(',', $ids); + + $user_id = $this->Conn->GetOne('SELECT PortalUserId FROM '.TABLE_PREFIX.'PortalUser WHERE Login = '.$this->Conn->qstr($user_name) ); + + $table = $this->Application->getUnitOption($event->Prefix,'TableName'); + $sql = 'UPDATE '.$table.' SET FromUserId = '.$user_id.' WHERE EventId IN ('.$ids.')'; + + $this->Conn->Query($sql); + } + } + + /** + * Raised when email message shoul be sent + * + * @param kEvent $event + */ + function OnEmailEvent(&$event){ + + $email_event = $event->getEventParam('EmailEventName'); + $to_user_id = $event->getEventParam('EmailEventToUserId'); + $email_event_type = $event->getEventParam('EmailEventType'); + + $this->Application->setUnitOption('emailmessages', 'AutoLoad', false); + $message_object = &$this->Application->recallObject('emailmessages'); + + $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); + + $event_object = &$event->getObject(); + $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); + + $event_id = $event_object->GetDBField('EventId'); + $from_user_id = $event_object->GetDBField('FromUserId'); + $type = $event_object->GetDBField('Type'); + $enabled = $event_object->GetDBField('Enabled'); + + $direct_send_params = $event->getEventParam('DirectSendParams'); + + if ($enabled == 0) return; // disabled event + if ($enabled == 2 && defined("ADMIN")) return; // event only for front-end + + if ($type == 1){ + // For type "Admin" recipient is a user from field FromUserId which means From/To user in Email events list + $to_user_id = $from_user_id; + $from_user_id = -1; + } + + if (!($to_user_id > 0) && !$direct_send_params){ + // if we can not determine recepient we will not send email + return; + } + + //Parse Message Template + $message_object->Load(array('EventId' => $event_id, 'LanguageId' => $this->Application->GetVar('m_lang'))); + $message_type = $message_object->GetDBField('MessageType'); + $message_template = $message_object->GetDBField('Template'); + + $this->Application->InitParser(); + $template =& $this->Application->makeClass('Template'); + $template->SetBody($message_template); + + $template_object = &$this->Application->recallObject('TemplatesCache'); + $template_object->SetTemplate('EmailTemplate', $template); + + + $email_object = &$this->Application->recallObject('kEmailMessage'); + + $old_autoload = $this->Application->getUnitOption('u', 'AutoLoad'); + $this->Application->setUnitOption('u', 'AutoLoad', false); + + $from_user_object = &$this->Application->recallObject('u.-item'); + $from_user_object->Load($from_user_id); + // here if we don't have from_user loaded, it takes a default user from config values + $from_user_email = $from_user_object->GetDBField('Email')?$from_user_object->GetDBField('Email'):$this->Application->ConfigValue('Smtp_AdminMailFrom'); + $from_user_name = trim($from_user_object->GetDBField('FirstName').' '.$from_user_object->GetDBField('LastName')); + + $to_user_object = &$this->Application->recallObject('u.-item'); + $to_user_object->Load($to_user_id); + $to_user_email = $to_user_object->GetDBField('Email'); + $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); + + $this->Application->setUnitOption('u', 'AutoLoad', $old_autoload); + + if($direct_send_params){ + $to_user_email = ($direct_send_params['to_email']?$direct_send_params['to_email']:$to_user_email); + $to_user_name = ($direct_send_params['to_name']?$direct_send_params['to_name']:$to_user_name); + $from_user_email = ($direct_send_params['from_email']?$direct_send_params['from_email']:$from_user_email); + $from_user_name = ($direct_send_params['from_name']?$direct_send_params['from_name']:$from_user_name); + $message_body_additional = $direct_send_params['message']; + } + + $params = array_merge( array('name'=>'EmailTemplate', 'message_text'=>$message_body_additional), $direct_send_params ); + $message_template = $this->Application->ParseBlock($params); + + $message_template = str_replace("\r", "", $message_template); + + list($message_headers, $message_body) = explode("\n\n", $message_template, 2); + + + $email_object->setFrom($from_user_email, $from_user_name); + $email_object->setTo($to_user_email, $to_user_name); + $email_object->setSubject('Mail message'); + + + $email_object->setHeaders($message_headers); + + if ($message_type == 'html'){ + $email_object->setHTMLBody($message_body); + } + else { + $email_object->setTextBody($message_body); + } + + $smtp_object = &$this->Application->recallObject('kSmtpClient'); + + $smtp_server = $this->Application->ConfigValue('Smtp_Server'); + $smtp_port = $this->Application->ConfigValue('Smtp_Port'); + + $smtp_authenticate = $this->Application->ConfigValue('Smtp_Authenticate'); + if ($smtp_authenticate){ + $smtp_user = $this->Application->ConfigValue('Smtp_User'); + $smtp_pass = $this->Application->ConfigValue('Smtp_Pass'); + }else{ + $smtp_user = ''; + $smtp_pass = ''; + } + + + if ($smtp_server){ + if ($email_object->sendSMTP($smtp_object, $smtp_server, $smtp_user, $smtp_pass, $smtp_authenticate)){ + $event->status=erSUCCESS; + } + else { + $event->status=erFAIL; + } + }else{ + if($email_object->send()){ + $event->status=erSUCCESS; + } + else { + $event->status=erFAIL; + } + } + + return $event; + } + } +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_import_language.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_translate.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_shipping.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_discounts.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/configuration/configuration_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon46_list_taxes.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_more_brackets_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/sort_2_asc.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/index.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/index.tpl (revision 0) +++ trunk/kernel/admin_templates/index.tpl (revision 1566) @@ -0,0 +1 @@ \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon46_settings_output.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_attn.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_help.gif =================================================================== diff -u Binary files differ Index: trunk/admin/advanced_view.php =================================================================== diff -u -r1510 -r1566 --- trunk/admin/advanced_view.php (.../advanced_view.php) (revision 1510) +++ trunk/admin/advanced_view.php (.../advanced_view.php) (revision 1566) @@ -12,8 +12,32 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## -//$pathtoroot=""; +//KERNEL4 STARTUP - FOR ACTIONS HANDLING + +function k4getmicrotime() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +$start = k4getmicrotime(); + +define('ADMIN', 1); +define('FULL_PATH', realpath(dirname(__FILE__).'/..')); +define('APPLICATION_CLASS', 'MyApplication'); +define('ADMINS_LIST','/in-portal/users/users.php'); +include_once(FULL_PATH."/kernel/kernel4/startup.php"); + +$application =& kApplication::Instance(); +$application->Init(); + +$application->SetVar('t', 'in-commerce/products/products_advanced_view'); + +$application->Run(); + +//KERNEL4 END + define('REQUIRE_LAYER_HEADER', 1); $b_topmargin = "0"; //$b_header_addon = "

"; @@ -255,7 +279,7 @@ print << - + @@ -348,8 +372,10 @@ include_once($path); } } + $admin = $objConfig->Get("AdminDirectory"); + if(!strlen($admin)) $admin = "admin"; ?> -
+ Index: trunk/kernel/admin_templates/img/toolbar/tool_editcat_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/parse.php =================================================================== diff -u -r1120 -r1566 --- trunk/kernel/include/parse.php (.../parse.php) (revision 1120) +++ trunk/kernel/include/parse.php (.../parse.php) (revision 1566) @@ -335,8 +335,21 @@ return $filename; } - function LoadFile($template_root="",$SupressError=FALSE) + function LoadFile($template_root="",$SupressError=FALSE, $tbody) { + if (class_exists('kApplication') ) { + if ( !isset($tbody) ) { + $application =& kApplication::Instance(); + $t = $this->name; + $t = preg_replace("/\.tpl$/", '', $t); + $tbody = $application->ParseBlock( Array('name' => $t, 'from_inportal' => true), null, true ); + } + $this->source = $tbody; + + return true; + } + + $filename = $this->TemplateFilename($template_root); if(file_exists($filename)) { @@ -422,7 +435,7 @@ return in_array($template,$this->stack) ? true : false; } - function GetTemplate($name,$SupressError=FALSE) + function GetTemplate($name,$SupressError=FALSE, $tbody=null) { if(!strlen($name)) { @@ -436,18 +449,23 @@ else { $ret = FALSE; - foreach($this->templates as $n => $t) - { - if($n == $name) + + if ( !isset($tbody) ) { //Kernel4 fix + $ret = isset($this->templates[$name]) ? $this->templates[$name] : false; + // this was original: + /*foreach($this->templates as $n => $t) { - $ret=$t; - break; - } + if($n == $name) + { + $ret = $t; + break; + } + }*/ } if(!is_object($ret)) { $ret = new clsTemplate($name); - if($ret->LoadFile($this->root_dir,$SupressError)) + if($ret->LoadFile($this->root_dir, $SupressError, $tbody)) { $this->templates[$name]=$ret; } @@ -812,6 +830,28 @@ unset($t); return $html; } + + function ParseTemplateFromBuffer($tname, $tbody, $NoCache=0, $NoStack=0,$SupressError=FALSE) + { + $html = ""; + if( defined('TEMPLATE_PREFIX') ) $tname = TEMPLATE_PREFIX.'/'.$tname; + $t = $this->GetTemplate($tname, $SupressError, $tbody); + + if(is_object($t)) + { + if(!$NoStack) + array_push($this->stack,$tname); + $html = $t->source; + $html = $this->ParseTemplateText($html); + if(!$NoStack) + array_pop($this->stack); + $t->out = $html; + if(!$NoCache) + $this->SaveTemplateCache($t); + } + unset($t); + return $html; + } } class clsAdminTemplateList extends clsTemplateList Index: trunk/kernel/admin_templates/img/toolbar/tool_e-mail.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_settings_censor.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/search_results/cat_search_results.tpl =================================================================== diff -u -r1061 -r1566 --- trunk/themes/default/search_results/cat_search_results.tpl (.../cat_search_results.tpl) (revision 1061) +++ trunk/themes/default/search_results/cat_search_results.tpl (.../cat_search_results.tpl) (revision 1566) @@ -108,7 +108,7 @@
- + Index: trunk/kernel/admin_templates/img/ic_new.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_tool_import.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_settings_general.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_archive_f2.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u --- trunk/core/units/email_events/email_events_event_handler.php (revision 0) +++ trunk/core/units/email_events/email_events_event_handler.php (revision 1566) @@ -0,0 +1,196 @@ +Special == 'module') + { + $object =& $event->getObject(); + $object->addFilter('module_filter', '%1$s.Module = \'In-Commerce\''); + } + } + + /** + * Sets status Front-End Only to selected email events + * + * @param kEvent $event + */ + function OnFrontOnly(&$event) + { + $this->StoreSelectedIDs($event); + $ids = $this->getSelectedIDs($event); + $ids = implode(',', $ids); + + $table = $this->Application->getUnitOption($event->Prefix,'TableName'); + $sql = 'UPDATE '.$table.' SET Enabled = 2 WHERE EventId IN ('.$ids.')'; + $this->Conn->Query($sql); + } + + /** + * Sets selected user to email events selected + * + * @param kEvent $event + */ + function OnSelectUser(&$event) + { + $user_name = $this->Application->GetVar( $event->getPrefixSpecial(true).'_PopupSelectedUser' ); + if( strlen($user_name) > 0 ) + { + $this->StoreSelectedIDs($event); + $ids = $this->getSelectedIDs($event); + $ids = implode(',', $ids); + + $user_id = $this->Conn->GetOne('SELECT PortalUserId FROM '.TABLE_PREFIX.'PortalUser WHERE Login = '.$this->Conn->qstr($user_name) ); + + $table = $this->Application->getUnitOption($event->Prefix,'TableName'); + $sql = 'UPDATE '.$table.' SET FromUserId = '.$user_id.' WHERE EventId IN ('.$ids.')'; + + $this->Conn->Query($sql); + } + } + + /** + * Raised when email message shoul be sent + * + * @param kEvent $event + */ + function OnEmailEvent(&$event){ + + $email_event = $event->getEventParam('EmailEventName'); + $to_user_id = $event->getEventParam('EmailEventToUserId'); + $email_event_type = $event->getEventParam('EmailEventType'); + + $this->Application->setUnitOption('emailmessages', 'AutoLoad', false); + $message_object = &$this->Application->recallObject('emailmessages'); + + $event_table = $this->Application->getUnitOption('emailevents', 'TableName'); + + $event_object = &$event->getObject(); + $event_object->Load(array('Event'=>$email_event, 'Type'=>$email_event_type)); + + $event_id = $event_object->GetDBField('EventId'); + $from_user_id = $event_object->GetDBField('FromUserId'); + $type = $event_object->GetDBField('Type'); + $enabled = $event_object->GetDBField('Enabled'); + + $direct_send_params = $event->getEventParam('DirectSendParams'); + + if ($enabled == 0) return; // disabled event + if ($enabled == 2 && defined("ADMIN")) return; // event only for front-end + + if ($type == 1){ + // For type "Admin" recipient is a user from field FromUserId which means From/To user in Email events list + $to_user_id = $from_user_id; + $from_user_id = -1; + } + + if (!($to_user_id > 0) && !$direct_send_params){ + // if we can not determine recepient we will not send email + return; + } + + //Parse Message Template + $message_object->Load(array('EventId' => $event_id, 'LanguageId' => $this->Application->GetVar('m_lang'))); + $message_type = $message_object->GetDBField('MessageType'); + $message_template = $message_object->GetDBField('Template'); + + $this->Application->InitParser(); + $template =& $this->Application->makeClass('Template'); + $template->SetBody($message_template); + + $template_object = &$this->Application->recallObject('TemplatesCache'); + $template_object->SetTemplate('EmailTemplate', $template); + + + $email_object = &$this->Application->recallObject('kEmailMessage'); + + $old_autoload = $this->Application->getUnitOption('u', 'AutoLoad'); + $this->Application->setUnitOption('u', 'AutoLoad', false); + + $from_user_object = &$this->Application->recallObject('u.-item'); + $from_user_object->Load($from_user_id); + // here if we don't have from_user loaded, it takes a default user from config values + $from_user_email = $from_user_object->GetDBField('Email')?$from_user_object->GetDBField('Email'):$this->Application->ConfigValue('Smtp_AdminMailFrom'); + $from_user_name = trim($from_user_object->GetDBField('FirstName').' '.$from_user_object->GetDBField('LastName')); + + $to_user_object = &$this->Application->recallObject('u.-item'); + $to_user_object->Load($to_user_id); + $to_user_email = $to_user_object->GetDBField('Email'); + $to_user_name = trim($to_user_object->GetDBField('FirstName').' '.$to_user_object->GetDBField('LastName')); + + $this->Application->setUnitOption('u', 'AutoLoad', $old_autoload); + + if($direct_send_params){ + $to_user_email = ($direct_send_params['to_email']?$direct_send_params['to_email']:$to_user_email); + $to_user_name = ($direct_send_params['to_name']?$direct_send_params['to_name']:$to_user_name); + $from_user_email = ($direct_send_params['from_email']?$direct_send_params['from_email']:$from_user_email); + $from_user_name = ($direct_send_params['from_name']?$direct_send_params['from_name']:$from_user_name); + $message_body_additional = $direct_send_params['message']; + } + + $params = array_merge( array('name'=>'EmailTemplate', 'message_text'=>$message_body_additional), $direct_send_params ); + $message_template = $this->Application->ParseBlock($params); + + $message_template = str_replace("\r", "", $message_template); + + list($message_headers, $message_body) = explode("\n\n", $message_template, 2); + + + $email_object->setFrom($from_user_email, $from_user_name); + $email_object->setTo($to_user_email, $to_user_name); + $email_object->setSubject('Mail message'); + + + $email_object->setHeaders($message_headers); + + if ($message_type == 'html'){ + $email_object->setHTMLBody($message_body); + } + else { + $email_object->setTextBody($message_body); + } + + $smtp_object = &$this->Application->recallObject('kSmtpClient'); + + $smtp_server = $this->Application->ConfigValue('Smtp_Server'); + $smtp_port = $this->Application->ConfigValue('Smtp_Port'); + + $smtp_authenticate = $this->Application->ConfigValue('Smtp_Authenticate'); + if ($smtp_authenticate){ + $smtp_user = $this->Application->ConfigValue('Smtp_User'); + $smtp_pass = $this->Application->ConfigValue('Smtp_Pass'); + }else{ + $smtp_user = ''; + $smtp_pass = ''; + } + + + if ($smtp_server){ + if ($email_object->sendSMTP($smtp_object, $smtp_server, $smtp_user, $smtp_pass, $smtp_authenticate)){ + $event->status=erSUCCESS; + } + else { + $event->status=erFAIL; + } + }else{ + if($email_object->send()){ + $event->status=erSUCCESS; + } + else { + $event->status=erFAIL; + } + } + + return $event; + } + } +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_cut_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_style.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_search.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_clone_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_image_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_homecat_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_clone.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/theme.php =================================================================== diff -u -r1066 -r1566 --- trunk/kernel/include/theme.php (.../theme.php) (revision 1066) +++ trunk/kernel/include/theme.php (.../theme.php) (revision 1566) @@ -616,12 +616,12 @@ return $this->Query_Item($sql); } - function AddTheme($Name,$Description,$Enabled,$Primary,$CacheTimeout=3600) + function AddTheme($Name,$Description,$Enabled,$Primary,$CacheTimeout=3600,$StylesheetId=1) { $t = new clsTheme(); $t->tablename = $this->SourceTable; - $t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout"), - array($Name,$Description,$Enabled,$Primary,$CacheTimeout)); + $t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout",'StylesheetId'), + array($Name,$Description,$Enabled,$Primary,$CacheTimeout,$StylesheetId)); $t->Create(); $t->Files->ThemeId=$t->Get("ThemeId"); if($Primary==1) @@ -632,7 +632,7 @@ return $t; } - function EditTheme($ThemeId,$Name,$Description,$Enabled,$Primary, $CacheTimeout) + function EditTheme($ThemeId,$Name,$Description,$Enabled,$Primary, $CacheTimeout, $StylesheetId) { $t = $this->GetItem($ThemeId); $oldName = $t->Get("Name"); @@ -642,8 +642,8 @@ if(!rename($dir.'/'.$oldName,$dir.'/'.$Name)) $Name=$oldName; } - $t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout"), - array($Name, $Description, $Enabled, $Primary, $CacheTimeout)); + $t->Set(array("Name","Description","Enabled","PrimaryTheme","CacheTimeout", 'StylesheetId'), + array($Name, $Description, $Enabled, $Primary, $CacheTimeout,$StylesheetId)); $t->Dirty(); $t->Update(); if($Primary==1) Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/configuration/configuration_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/itemicons/icon16_listing.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/version_bg.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_import_language_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/globe.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/modules/modules_event_handler.php =================================================================== diff -u --- trunk/core/units/modules/modules_event_handler.php (revision 0) +++ trunk/core/units/modules/modules_event_handler.php (revision 1566) @@ -0,0 +1,36 @@ +Application->SetVar($this->Prefix."_".$event->Special."_id", $event->Special); + parent::OnItemBuild($event); + } + + function SetCustomQuery(&$event){ + $object=&$event->getObject(); + $object->addFilter("current_module", "Name=".$event->Special); + + } + +} + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_edit_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon46_list_settings_in-link.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_custom_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/languages/import_xml.php =================================================================== diff -u --- trunk/core/units/languages/import_xml.php (revision 0) +++ trunk/core/units/languages/import_xml.php (revision 1566) @@ -0,0 +1,280 @@ +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'); + } + + /** + * Create temp table for prefix, if table already exists, then delete it and create again + * + * @param string $prefix + */ + function prepareTempTable($prefix) + { + $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) + { + // define the XML parsing routines/functions to call based on the handler path + if( !file_exists($filename) ) return false; + + $this->phrase_types_allowed = array_flip($phrase_types); + + //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 + + $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']); + break; + + case 'LANGUAGES LANGUAGE PHRASES': + case 'LANGUAGES LANGUAGE EVENTS': + if( !getArrayValue($this->current_language,'LanguageId') ) + { + if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1'; + $this->lang_object->SetFieldsFromHash($this->current_language); + if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID(); + } + 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'], + 'Module' => $phrase_module, + 'LastChanged' => time(), + 'LastChangeIP' => $this->ip_address ); + 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']); + break; + + + } + + // if($path == 'SHIPMENT PACKAGE') + } + + function characterData(&$parser, $line) + { + $line = trim($line); + if(!$line) return ; + + $path = join (' ',$this->path); + + $language_nodes = Array('DATEFORMAT','TIMEFORMAT','DECIMAL','THOUSANDS','CHARSET'); + + + $node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat', + 'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat', + 'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint', + 'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep', + 'LANGUAGES LANGUAGE CHARSET' => 'Charset'); + + if( in_array( end($this->path), $language_nodes) ) + { + $this->current_language[ $node_field_map[$path] ] = $line; + } + else + { + switch($path) + { + case 'LANGUAGES LANGUAGE PHRASES PHRASE': + if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) ) + { + $this->current_phrase['Translation'] = base64_decode($line); + $this->insertRecord($this->tables['phrases'], $this->current_phrase); + } + break; + + case 'LANGUAGES LANGUAGE EVENTS EVENT': + $this->current_event['Template'] = base64_decode($line); + $this->insertRecord($this->tables['emailmessages'],$this->current_event); + break; + } + } + } + + function endElement(&$parser, $element) + { + $path = implode(' ',$this->path); + 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 + * + * @param string $filename filename to export into + * @param Array $phrase_types phrases types to export from modules passed in $module_ids + * @param Array $language_ids IDs of languages to export + * @param Array $module_ids IDs of modules to export phrases from + */ + function Create($filename, $phrase_types, $language_ids, $module_ids) + { + $fp = fopen($filename,'w'); + if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false; + + $this->events_hash = array_flip($this->events_hash); + + $lang_table = $this->Application->getUnitOption('lang','TableName'); + $phrases_table = $this->Application->getUnitOption('phrases','TableName'); + $emailevents_table = $this->Application->getUnitOption('emailmessages','TableName'); + $mainevents_table = $this->Application->getUnitOption('emailevents','TableName'); + + $phrase_tpl = "\t\t\t".'%s'."\n"; + $event_tpl = "\t\t\t".'%s'."\n"; + $sql = 'SELECT * FROM %s WHERE LanguageId = %s'; + $ret = ''."\n"; + foreach($language_ids as $language_id) + { + // languages + $row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) ); + $ret .= "\t".''.$row['DateFormat'].''; + $ret .= ''.$row['TimeFormat'].''.$row['DecimalPoint'].''; + $ret .= ''.$row['ThousandSep'].''.$row['Charset'].''."\n"; + + // phrases + $ret .= "\t\t".''."\n"; + $phrases_sql = 'SELECT * FROM '.$phrases_table.' WHERE LanguageId = %s AND PhraseType IN (%s) AND Module IN (%s)'; + if( in_array('In-Portal',$module_ids) ) array_push($module_ids, ''); // for old language packs + $rows = $this->Conn->Query( sprintf($phrases_sql,$language_id, implode(',',$phrase_types), '\''.implode('\',\'',$module_ids).'\'' ) ); + foreach($rows as $row) + { + $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['PhraseType'], base64_encode($row['Translation']) ); + } + $ret .= "\t\t".''."\n"; + + // email events + $ret .= "\t\t".''."\n"; + 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); + + $event_sql = 'SELECT * FROM '.$emailevents_table.' WHERE LanguageId = %s AND EventId IN (%s)'; + $rows = $this->Conn->Query( sprintf($event_sql,$language_id, $event_ids ? implode(',',$event_ids) : '' ) ); + 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']) ); + } + $ret .= "\t\t".''."\n"; + $ret .= "\t".''."\n"; + } + + $ret .= ''; + fwrite($fp, $ret); + fclose($fp); + return true; + } + } + +?> \ No newline at end of file Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/category_items/category_items_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin/include/toolbar/edituser_items.php =================================================================== diff -u -r979 -r1566 --- trunk/kernel/admin/include/toolbar/edituser_items.php (.../edituser_items.php) (revision 979) +++ trunk/kernel/admin/include/toolbar/edituser_items.php (.../edituser_items.php) (revision 1566) @@ -98,8 +98,11 @@ function edit_submit(formname, targetURL) { var env_str = '$envar'; + var url = '$rootURL' + targetURL; - document.location = '$rootURL' + targetURL + '?' + env_str; + if( !url.match('(.*)?env=(.*)') ) url += '?' + env_str; + + document.location = url; } @@ -110,7 +113,9 @@ f = document.getElementById(formname); if(f) { - f.action = '$rootURL' + targetURL + '?' + env_str; + f.action = '$rootURL' + targetURL; + if( !f.action.match('(.*)?env=(.*)') ) f.action += '?' + env_str; + f.UserEditStatus.value = save_value; //0= stay in temp, 1=save to perm, 2 = purge no save f.submit(); } Index: trunk/kernel/admin_templates/img/itemicons/icon16_review.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab_right.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/languages/languages_event_handler.php =================================================================== diff -u --- trunk/kernel/units/languages/languages_event_handler.php (revision 0) +++ trunk/kernel/units/languages/languages_event_handler.php (revision 1566) @@ -0,0 +1,311 @@ +Application->getUnitOption($event->Prefix,'TableName'); + $languages_count = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$table_name); + $languages_count = $languages_count + 5 - ( $languages_count % 5 ? ($languages_count % 5) : 5 ); + + $sqls = Array(); + + $unit_config_reader =& $this->Application->recallObject('kUnitConfigReader'); + foreach($unit_config_reader->configData as $prefix => $config_data) + { + $table_name = getArrayValue($config_data,'TableName'); + $fields = getArrayValue($config_data,'Fields'); + if(!($table_name && $fields) ) continue; + + foreach($fields as $field_name => $field_options) + { + if( isset($field_options['formatter']) && $field_options['formatter'] == 'kMultiLanguage' ) + { + $describe = $this->Conn->Query('DESCRIBE '.$table_name.' \'l%_'.$field_name.'\''); + $field_mask = 'l%s_'.$field_name.' '.$describe[0]['Type']; + $create_count = $languages_count - count($describe); + if($create_count) + { + $sqls[] = 'ALTER TABLE '.$table_name.( $this->generateAlterSQL($field_mask, count($describe) + 1, $create_count) ); + } + } + } + } + if($sqls) $this->Conn->Query( implode("\n",$sqls) ); + } + + /** + * Returns ALTER statement part for adding required fields to table + * + * @param string $field_mask sql mask for creating field with correct definition (type & size) + * @param int $start_index add new fields starting from this index + * @param int $create_count create this much new multilingual field translations + * @return string + */ + function generateAlterSQL($field_mask, $start_index, $create_count) + { + $i_count = $start_index + $create_count; + $ret = ''; + while($start_index < $i_count) + { + list($prev_field,$type) = explode(' ', sprintf($field_mask, $start_index-1) ); + $ret .= ' ADD COLUMN '.sprintf($field_mask,$start_index).' AFTER '.$prev_field.', '; + $start_index++; + } + return preg_replace('/, $/',';',$ret); + } + + /** + * Copy labels from another language + * + * @param kEvent $event + */ + function OnCopyLabels(&$event) + { + $object =& $event->getObject(); + $from_lang_id = $object->GetDBField('CopyFromLanguage'); + + if( ($event->MasterEvent->status == erSUCCESS) && $object->GetDBField('CopyLabels') == 1 && ($from_lang_id > 0) ) + { + $lang_id = $object->GetID(); + + // 1. phrases import + $phrases_live = $this->Application->getUnitOption('phrases','TableName'); + $phrases_temp = kTempTablesHandler::GetTempName($phrases_live); + $sql = 'INSERT INTO '.$phrases_temp.' + SELECT Phrase, Translation, PhraseType, 0-PhraseId, '.$lang_id.' + FROM '.$phrases_live.' + WHERE LanguageId='.$from_lang_id; + $this->Conn->Query($sql); + + // 2. events import + $em_table_live = $this->Application->getUnitOption('emailmessages','TableName'); + $em_table_temp = kTempTablesHandler::GetTempName($em_table_live); + + $sql = 'SELECT * FROM '.$em_table_live.' WHERE LanguageId = '.$from_lang_id; + $email_messages = $this->Conn->Query($sql); + if($email_messages) + { + $id = $this->Conn->GetOne('SELECT MIN(EmailMessageId) FROM '.$em_table_live); + if($id > 0) $id = 0; + $id--; + + $sqls = Array(); + foreach($email_messages as $email_message) + { + $sqls[] = $id.','.$this->Conn->qstr($email_message['Template']).','.$this->Conn->qstr($email_message['MessageType']).','.$lang_id.','.$email_message['EventId']; + $id--; + } + $sql = 'INSERT INTO '.$em_table_temp.'(EmailMessageId,Template,MessageType,LanguageId,EventId) VALUES ('.implode('),(',$sqls).')'; + $this->Conn->Query($sql); + } + + $object->SetDBField('CopyLabels', 0); + } + } + + /** + * Prepare temp tables for creating new item + * but does not create it. Actual create is + * done in OnPreSaveCreated + * + * @param kEvent $event + */ + function OnPreCreate(&$event) + { + parent::OnPreCreate($event); + + $object =& $event->getObject(); + $object->SetDBField('CopyLabels', 1); + + $live_table = kTempTablesHandler::GetLiveName($object->TableName); + $primary_lang_id = $this->Conn->GetOne('SELECT '.$object->IDField.' FROM '.$live_table.' WHERE PrimaryLang = 1'); + + $object->SetDBField('CopyFromLanguage', $primary_lang_id); + } + + + function OnChangeLanguage(&$event) + { + $this->Application->SetVar('m_lang', $this->Application->GetVar('language')); + + $this->Application->LinkVar('language', 'm_lang'); + } + + /** + * Parse language XML file into temp tables and redirect to progress bar screen + * + * @param kEvent $event + */ + function OnImportLanguage(&$event) + { + $items_info = $this->Application->GetVar('phrases_import'); + if($items_info) + { + list($id,$field_values) = each($items_info); + + $lang_xml =& $this->Application->recallObject('LangXML'); + $lang_xml->Parse($field_values['LangFile']['tmp_name'], $field_values['PhraseType'], $field_values['Module']); + } + $event->redirect = 'dummy'; + $event->SetRedirectParam('lang_event', 'OnImportProgress'); + $event->SetRedirectParam('pass', 'all,lang'); + } + + /** + * Copies imported from xml file from temp table to live table + * + * @param kEvent $event + */ + function OnImportProgress(&$event) + { + define('IMPORT_BY', 300); // import this much records per step + $template_name = 'in-commerce/regional/languages_import_step2'; + + $import_source = (int)$this->Application->GetVar('source'); + $import_steps = Array(0 => 'lang', 1 => 'phrases', 2 => 'emailmessages', 3 => 'finish'); + $import_titles = Array(0 => 'la_ImportingLanguages', 1 => 'la_ImportingPhrases', 2 => 'la_ImportingEmailEvents', 3 => 'la_Done'); + + // --- BEFORE --- + $import_prefix = $import_steps[$import_source]; + $import_start = (int)$this->Application->GetVar('start'); + $dst_table = $this->Application->getUnitOption($import_prefix,'TableName'); + $src_table = kTempTablesHandler::GetTempName($dst_table); + + $import_total = $this->Application->GetVar('total'); + if(!$import_total) $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table); + // --- AFTER --- + + if($import_start == $import_total) + { + $import_source++; + $import_prefix = $import_steps[$import_source]; + if($import_prefix == 'finish') + { + $event->SetRedirectParam('opener','u'); + return true; + } + + $import_start = 0; + $dst_table = $this->Application->getUnitOption($import_prefix,'TableName'); + $src_table = kTempTablesHandler::GetTempName($dst_table); + $import_total = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$src_table); + } + + $done_percent = ($import_start * 100) / $import_total; + $block_params = Array( 'name' => $template_name, + 'title' => $import_titles[$import_source], + 'percent_done' => $done_percent, + 'percent_left' => 100 - $done_percent); + + $this->Application->InitParser(); + $this->Application->setUnitOption('phrases','AutoLoad',false); + echo $this->Application->ParseBlock($block_params); + flush(); + + $fields = array_keys( $this->Application->getUnitOption($import_prefix,'Fields') ); + + $sql = 'SELECT * FROM %s LIMIT %s,%s'; + $rows = $this->Conn->Query( sprintf($sql,$src_table,$import_start,IMPORT_BY) ); + + $fields_sql = ''; + foreach($fields as $field_name) + { + $fields_sql .= '`'.$field_name.'`,'; + } + $fields_sql = preg_replace('/(.*),$/', '\\1', $fields_sql); + $values_sql = ''; + + foreach($rows as $row) + { + $values_sql .= '('; + foreach($row as $field_value) + { + $values_sql .= $this->Conn->qstr($field_value).','; + } + $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql).'),'; + } + $values_sql = preg_replace('/(.*),$/', '\\1', $values_sql); + + $sql = sprintf('INSERT INTO %s (%s) VALUES %s', $dst_table, $fields_sql, $values_sql); + $this->Conn->Query($sql); + + $event->setRedirectParams( Array('lang_event' => 'OnImportProgress', 'pass' => 'all,lang', 'start' => $import_start += count($rows), 'total' => $import_total, 'source' => $import_source) ); + } + + /** + * Stores ids of selected languages and redirects to export language step 1 + * + * @param kEvent $event + */ + function OnExportLanguage(&$event) + { + $this->Application->setUnitOption('phrases','AutoLoad',false); + + $this->StoreSelectedIDs($event); + $this->Application->StoreVar('export_language_ids', implode(',', $this->getSelectedIDs($event)) ); + + $event->setRedirectParams( Array('m_opener'=>'d','phrases.export_event'=>'OnNew','pass'=>'all,phrases.export') ); + $event->redirect = 'in-commerce/regional/languages_export'; + } + + /** + * Saves selected languages to xml file passed + * + * @param kEvent $event + */ + function OnExportProgress(&$event) + { + $this->Application->setUnitOption('phrases','AutoLoad',false); + $object =& $this->Application->recallObject('phrases.export'); + + $items_info = $this->Application->GetVar('phrases_export'); + if($items_info) + { + list($id,$field_values) = each($items_info); + + $lang_ids = explode(',', $this->Application->RecallVar('export_language_ids') ); + + if( !getArrayValue($field_values,'LangFile') ) + { + $object->SetError('LangFile', 'required'); + $event->redirect = false; + return false; + } + if( !is_writable(EXPORT_PATH) ) + { + $object->SetError('LangFile', 'write_error', 'la_ExportFolderNotWritable'); + $event->redirect = false; + return false; + } + $field_values['LangFile'] .= '.lang'; + $filename = EXPORT_PATH.'/'.$field_values['LangFile']; + + $lang_xml =& $this->Application->recallObject('LangXML'); + $lang_xml->Create($filename, $field_values['PhraseType'], $lang_ids, $field_values['Module']); + + } + + $event->redirect = 'in-commerce/regional/languages_export_step2'; + $event->SetRedirectParam('export_file', $field_values['LangFile']); + } + + /** + * Returns to previous template in opener stack + * + * @param kEvent $event + */ + function OnGoBack(&$event) + { + $event->redirect_params['opener'] = 'u'; + } + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon24_summary_logs.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icons16_permissions_inherited.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tabnav_left.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/novus.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_ship_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_delete_cat.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_paymenttype_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/cat_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/themes/default/common/footer.tpl =================================================================== diff -u -r1364 -r1566 --- trunk/themes/default/common/footer.tpl (.../footer.tpl) (revision 1364) +++ trunk/themes/default/common/footer.tpl (.../footer.tpl) (revision 1566) @@ -1,4 +1,5 @@ - + +
@@ -14,5 +15,5 @@ - + \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon24_shipping.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_check_out.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_listings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_permission.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_discounts.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/btn_checkout.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/my_application.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/smicon5.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_pick.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/stylesheets/stylesheets_config.php =================================================================== diff -u --- trunk/core/units/stylesheets/stylesheets_config.php (revision 0) +++ trunk/core/units/stylesheets/stylesheets_config.php (revision 1566) @@ -0,0 +1,114 @@ + 'css', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'StylesheetsEventHandler','file'=>'stylesheets_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'css', + 'HookToSpecial' => '', + 'HookToEvent' => Array('OnSave'), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnCompileStylesheet', + ), + ), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + 'IDField' => 'StylesheetId', + + 'StatusField' => Array('Enabled'), + + 'TitleField' => 'Name', + + 'TitlePresets' => Array( + 'default' => Array( 'new_status_labels' => Array('css'=>'!la_title_Adding_Stylesheet!'), + 'edit_status_labels' => Array('css'=>'!la_title_Editing_Stylesheet!'), + 'new_titlefield' => Array('css'=>'!la_title_New_Stylesheet!'), + ), + + 'styles_list' => Array('prefixes' => Array('css_List'), 'format' => "!la_title_Stylesheets! (#css_recordcount#)"), + + 'stylesheets_edit' => Array('prefixes' => Array('css'), 'format' => "#css_status# '#css_titlefield#' - !la_title_General!"), + + 'base_styles' => Array('prefixes' => Array('css','selectors.base_List'), 'format' => "#css_status# '#css_titlefield#' - !la_title_BaseStyles! (#selectors.base_recordcount#)"), + + 'block_styles' => Array('prefixes' => Array('css','selectors.block_List'), 'format' => "#css_status# '#css_titlefield#' - !la_title_BlockStyles! (#selectors.block_recordcount#)"), + + 'base_style_edit' => Array( 'prefixes' => Array('css','selectors'), + 'new_status_labels' => Array('selectors'=>'!la_title_Adding_BaseStyle!'), + 'edit_status_labels' => Array('selectors'=>'!la_title_Editing_BaseStyle!'), + 'new_titlefield' => Array('selectors'=>'!la_title_New_BaseStyle!'), + 'format' => "#css_status# '#css_titlefield#' - #selectors_status# '#selectors_titlefield#'"), + + 'block_style_edit' => Array( 'prefixes' => Array('css','selectors'), + 'new_status_labels' => Array('selectors'=>'!la_title_Adding_BlockStyle!'), + 'edit_status_labels' => Array('selectors'=>'!la_title_Editing_BlockStyle!'), + 'new_titlefield' => Array('selectors'=>'!la_title_New_BlockStyle!'), + 'format' => "#css_status# '#css_titlefield#' - #selectors_status# '#selectors_titlefield#'"), + + 'style_edit' => Array('prefixes' => Array('selectors'), 'format' => "!la_title_EditingStyle! '#selectors_titlefield#'"), + ), + + 'TableName' => TABLE_PREFIX.'Stylesheets', + 'SubItems' => Array('selectors'), + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER), + ), + + 'Filters' => Array( + 0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ), + 1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ), + ) + ), + + 'AutoDelete' => true, + 'AutoClone' => true, + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', + ), + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Name' => 'asc'), + ) + ), + 'Fields' => Array( + 'StylesheetId' => Array(), + 'Name' => Array('type' => 'string','not_null' => '1','default' => '','required'=>1), + 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), + 'AdvancedCSS' => Array('type' => 'string','not_null' => '1','default' => ''), + 'LastCompiled' => Array('type' => 'int', 'formatter' => 'kDateFormatter', 'not_null' => '1','default' => '0'), + 'Enabled' => Array('type' => 'int', 'formatter'=>'kOptionsFormatter', 'options'=>Array(0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, 'not_null' => '1','default' => 0), + ), + + 'VirtualFields' => Array(), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif',0=>'icon16_style_disabled.gif',1=>'icon16_style.gif'), + 'Fields' => Array( + 'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'), + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + 'LastCompiled' => Array('title' => 'la_col_LastCompiled'), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/include/category.php =================================================================== diff -u -r1442 -r1566 --- trunk/kernel/include/category.php (.../category.php) (revision 1442) +++ trunk/kernel/include/category.php (.../category.php) (revision 1566) @@ -998,13 +998,12 @@ case "link_selector": $m_var_list_update["cat"] = $this->Get("CategoryId"); $ret = $_SERVER["PHP_SELF"]."?env=" . BuildEnv(); + - // pass through selector - if( isset($_REQUEST['Selector']) ) $ret .= '&Selector='.$_REQUEST['Selector']; + $tmp = GetVar('Selector'); if($tmp) $ret .= '&Selector='.$tmp; + $tmp = GetVar('new'); if($tmp) $ret .= '&new='.$tmp; + $tmp = GetVar('destform'); if($tmp) $ret .= '&destform='.$tmp; - // pass new status - if( isset($_REQUEST['new']) ) $ret .= '&new='.$_REQUEST['new']; - unset($m_var_list_update["cat"]); return $ret; break; @@ -1823,7 +1822,10 @@ $selector = isset($_REQUEST['Selector']) ? '&Selector='.$_REQUEST['Selector'] : ''; $new = isset($_REQUEST['new']) ? '&new='.$_REQUEST['new'] : ''; - + $destform = GetVar('destform') !== false ? '&destform='.GetVar('destform') : ''; + + $add = $selector.$new.$destform; + $nav = ""; $m_var_list_update["p"]=1; if(strlen($target_template)==0) @@ -1836,7 +1838,7 @@ if ($LinkRoot) { $var_list_update["t"] = strlen($RootTemplate)? $RootTemplate : $target_template; - $nav = "
$cat_name"; } + $nav = "$cat_name"; } else $nav = "$cat_name"; } @@ -1866,7 +1868,7 @@ { if ($admin == 1) { - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; } else { @@ -1878,7 +1880,7 @@ { $var_list_update["t"] = $target_template; } - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; } } } @@ -1895,7 +1897,7 @@ { if ($admin == 1) { - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; } else { @@ -1905,7 +1907,7 @@ } else $var_list_update["t"] = $target_template; - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; } } @@ -1939,12 +1941,12 @@ { if ($admin == 1) { - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; } else { $var_list_update["t"] = $t; - $nav[] = "".$cat_name.""; + $nav[] = "".$cat_name.""; unset($var_list_update["t"]); } } Index: trunk/kernel/admin_templates/img/toolbar/tool_usertogroup_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/ic_hot.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/arrow.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/ic_pop.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_search_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_export_language.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_help.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/help/help_config.php =================================================================== diff -u --- trunk/kernel/units/help/help_config.php (revision 0) +++ trunk/kernel/units/help/help_config.php (revision 1566) @@ -0,0 +1,15 @@ + 'h', + 'EventHandlerClass' => Array('class'=>'kEventHandler','file'=>'','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'HelpTagProcessor','file'=>'help_tag_processor.php','build_event'=>'OnBuild'), + 'QueryString' => Array( + 1 => 'prefix', + 2 => 'icon', + 3 => 'module', + 4 => 'title_preset', + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_print_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_settings_censor.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/users/users_tag_processor.php =================================================================== diff -u --- trunk/kernel/units/users/users_tag_processor.php (revision 0) +++ trunk/kernel/units/users/users_tag_processor.php (revision 1566) @@ -0,0 +1,126 @@ + 'all,m,u', 'u_event' => 'OnLogout'); + return $this->Application->HREF('', '', $pass); + } + + function UseUsernames($params) + { + return $this->Application->ConfigValue('Email_As_Login') != 1; + } + + function RegistrationEnabled($params) + { + return $this->Application->ConfigValue('User_Allow_New') != 2; + } + + function ConfirmPasswordLink($params) + { + //global $m_var_list_update, $var_list_update, $objSession, $objConfig; + + $template = "forgotpw_reset_result"; + + $tmp_user_id = $this->Application->RecallVar("tmp_user_id"); + + $saved_denerated_code = $this->Application->GetVar('saved_denerated_code'); + if ($saved_denerated_code){ + $code = $saved_denerated_code; + } + else { + $code = md5($this->GenerateCode()); + $this->Application->SetVar('saved_denerated_code', $code); + } + + + + $sql = 'UPDATE '.TABLE_PREFIX.'PortalUser SET PwResetConfirm="'.$code.'", PwRequestTime='.mktime().' WHERE PortalUserId='.$tmp_user_id; + + $this->Conn->Query($sql); + + $params = array_merge($params, array('pass'=>'m', 'user_key'=>$code)); + + $main_processor =& $this->Application->recallObject('m_TagProcessor'); + + return $main_processor->T($params); + + } + + function GenerateCode() + { + list($usec, $sec) = explode(" ",microtime()); + + $id_part_1 = substr($usec, 4, 4); + $id_part_2 = mt_rand(1,9); + $id_part_3 = substr($sec, 6, 4); + $digit_one = substr($id_part_1, 0, 1); + if ($digit_one == 0) { + $digit_one = mt_rand(1,9); + $id_part_1 = ereg_replace("^0","",$id_part_1); + $id_part_1=$digit_one.$id_part_1; + } + return $id_part_1.$id_part_2.$id_part_3; + } + + function ForgottenPassword($params){ + return $this->Application->GetVar('ForgottenPassword'); + } + + function TestCodeIsValid($param){ + + $passed_key = $this->Application->GetVar('user_key'); + + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + if (strlen(trim($passed_key)) == 0) { + + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + return false; + } + + + if($user_object->Load(array('PwResetConfirm'=>$passed_key))) + { + $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; + if ($exp_time > mktime()) + { + + + } else { + $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired'; + return false; + + } + } else { + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + return false; + + } + + return true; + } + + /** + * Returns sitem administrator email + * + * @param Array $params + * @return string + */ + function SiteAdminEmail($params) + { + return $this->Application->ConfigValue('Smtp_AdminMailFrom'); + } + + } + + + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/old/sort_2_desc.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_settings_general.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_banlist.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_flip.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin/include/toolbar/userselect.php =================================================================== diff -u -r718 -r1566 --- trunk/kernel/admin/include/toolbar/userselect.php (.../userselect.php) (revision 718) +++ trunk/kernel/admin/include/toolbar/userselect.php (.../userselect.php) (revision 1566) @@ -133,7 +133,7 @@ if(retval.length>0) { - bf.$destfield.value = retval; + bf.elements["$destfield"].value = retval; if(DoSubmit) { bf.submit(); Index: trunk/kernel/admin_templates/img/toolbar/tool_copy_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_prev_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_upcat_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/adduser_custom.php =================================================================== diff -u -r881 -r1566 --- trunk/admin/users/adduser_custom.php (.../adduser_custom.php) (revision 881) +++ trunk/admin/users/adduser_custom.php (.../adduser_custom.php) (revision 1566) @@ -128,11 +128,13 @@ $formaction = $adminURL."/user/adduser_custom.php?".$envar; +$saveURL = $admin."/".$objSession->GetVariable('ReturnScript'); + //Display header $sec = $objSections->GetSection($section); $objListToolbar = new clsToolBar(); -$objListToolbar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif"); -$objListToolbar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif"); +$objListToolbar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',1);","tool_select.gif"); +$objListToolbar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',2);","tool_cancel.gif"); if ( isset($en_prev) || isset($en_next) ) { Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/custom_values/custom_value_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon24_tool_export.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_product_pending.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/users/users_event_handler.php =================================================================== diff -u --- trunk/core/units/users/users_event_handler.php (revision 0) +++ trunk/core/units/users/users_event_handler.php (revision 1566) @@ -0,0 +1,591 @@ +Application->setUnitOption($event->Prefix, 'AutoLoad', false); + $object =& $this->Application->recallObject('u'); + + $password = $this->Application->GetVar('password'); + if(!$password) + { + $object->SetError('ValidateLogin', 'blank_password', 'lu_blank_password'); + $event->status = erFAIL; + return false; + } + + $email_as_login = $this->Application->ConfigValue('Email_As_Login'); + list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login'); + $login_value = $this->Application->GetVar($submit_field); + + $sql = 'SELECT PortalUserId FROM '.$object->TableName.' WHERE (%s = %s) AND (Password = MD5(%s))'; + $user_id = $this->Conn->GetOne( sprintf($sql, $login_field, $this->Conn->qstr($login_value), $this->Conn->qstr($password) ) ); + + if($user_id) + { + $object->Load($user_id); + if( $object->GetDBField('Status') == STATUS_ACTIVE ) + { + $session =& $this->Application->recallObject('Session'); + $session->SetField('PortalUserId', $user_id); + $this->Application->SetVar('u_id', $user_id); + $this->Application->StoreVar('user_id', $user_id); + + $sql = 'SELECT DISTINCT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId = '.$user_id; + if( $groups = $this->Conn->GetCol($sql) ) + { + $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + } + + $next_template = $this->Application->GetVar('next_template'); + if($next_template) $event->redirect = $next_template; + } + else + { + $event->redirect = $this->Application->GetVar('pending_disabled_template'); + } + } + else + { + $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); + $event->status = erFAIL; + } + } + + function OnLogout(&$event) + { + $session =& $this->Application->recallObject('Session'); + $session->SetField('PortalUserId', -2); + $this->Application->SetVar('u_id', -2); + $this->Application->StoreVar('user_id', -2); + $object =& $this->Application->recallObject('u'); + $object->Load(-2); + + $this->Application->DestroySession(); + } + + /** + * Prefill states dropdown with correct values + * + * @param kEvent $event + * @access public + */ + function OnPrepareStates(&$event) + { + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->PopulateStates($event, 'State', 'Country'); + + $object =& $event->getObject(); + + if( $cs_helper->CountryHasStates( $object->GetDBField('Country') ) ) $object->Fields['State']['required'] = true; + + if( $this->Application->ConfigValue('Email_As_Login') ) + { + $object->SetDBField('Login', $object->GetDBField('Email') ); + } + } + + /** + * Redirects user after succesfull registration to confirmation template (on Front only) + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + $is_subscriber = $this->Application->GetVar('IsSubscriber'); + if (!$is_subscriber){ + + $object =& $event->getObject(); + $group_id = $this->Application->ConfigValue('User_NewGroup'); + + $sql = 'INSERT INTO '.TABLE_PREFIX.'UserGroup(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,1)'; + $this->Conn->Query( sprintf($sql, $object->GetID(), $group_id) ); + + } + } + + /** + * Login user if possible, if not then redirect to corresponding template + * + * @param kEvent $event + */ + function autoLoginUser(&$event) + { + $object =& $event->getObject(); + $this->Application->SetVar('u_id', $object->GetID() ); + + if($object->GetDBField('Status') == STATUS_ACTIVE) + { + $email_as_login = $this->Application->ConfigValue('Email_As_Login'); + list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login'); + + $this->Application->SetVar($submit_field, $object->GetDBField($login_field) ); + $this->Application->SetVar('password', $object->GetDBField('Password_plain') ); + + $event->CallSubEvent('OnLogin'); + } + } + + /** + * Creates new user + * + * @param kEvent $event + */ + function OnCreate(&$event) + { + if( !$this->Application->IsAdmin() ) $this->setUserStatus($event); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->CheckStateField($event, 'State', 'Country'); + + parent::OnCreate($event); + + $this->setNextTemplate($event); + + if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect) $this->autoLoginUser($event); + } + + /** + * Set's new user status based on config options + * + * @param kEvent $event + */ + function setUserStatus(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $new_users_allowed = $this->Application->ConfigValue('User_Allow_New'); + // 1 - Instant, 2 - Not Allowed, 3 - Pending + + switch ($new_users_allowed) + { + case 1: // Instant + $object->SetDBField('Status', 1); + $event->redirect = $this->Application->GetVar('registration_confirm_template'); + break; + + case 3: // Pending + $event->redirect = $this->Application->GetVar('registration_confirm_pending_template'); + $object->SetDBField('Status', 2); + break; + + case 2: // Not Allowed + $object->SetDBField('Status', 0); + break; + } + } + + /** + * Set's new unique resource id to user + * + * @param kEvent $event + */ + function OnAfterItemValidate(&$event) + { + $object =& $event->getObject(); + $object->SetDBField('ResourceId', $this->Application->NextResourceId() ); + } + + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnRecommend(&$event){ + + $friend_email = $this->Application->GetVar('friend_email'); + $friend_name = $this->Application->GetVar('friend_email'); + + if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $friend_email)) + { + + $send_params = array(); + $send_params['to_email']=$friend_email; + $send_params['to_name']=$friend_name; + + $user_id = $this->Application->GetVar('u_id'); + $email_event = &$this->Application->EmailEventUser('SITE.SUGGEST', $user_id, $send_params); + if ($email_event->status == erSUCCESS){ + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = $this->Application->GetVar('template_success'); + } + else { +// $event->redirect_params = array('opener' => 's', 'pass' => 'all'); +// $event->redirect = $this->Application->GetVar('template_fail'); + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['send_error'] = $this->Application->Phrase('lu_email_send_error'); + $object->FieldErrors['Email']['pseudo'] = 'send_error'; + $event->status = erFAIL; + + } + } + else { + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); + $object->FieldErrors['Email']['pseudo'] = 'invalid_email'; + $event->status = erFAIL; + } + + + } + + /** + * Saves address changes and mades no redirect + * + * @param kEvent $event + */ + function OnUpdateAddress(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id,$field_values) = each($items_info); + if($id > 0) $object->Load($id); + $object->SetFieldsFromHash($field_values); + $object->setID($id); + $object->Validate(); + } + + $event->redirect = false; + } + + function OnSubscribeQuery(&$event){ + + $user_email = $this->Application->GetVar('subscriber_email'); + if ( eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $user_email) ){ + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object = &$this->Application->recallObject($this->Prefix.'.subscriber'); + + $this->Application->StoreVar('SubscriberEmail', $user_email); + + if( $object->Load(array('Email'=>$user_email)) ){ + $group_info = $this->GetGroupInfo($object->GetID()); + if($group_info){ + $event->redirect = $this->Application->GetVar('unsubscribe_template'); + } + else { + $event->redirect = $this->Application->GetVar('subscribe_template'); + } + } + else { + $event->redirect = $this->Application->GetVar('subscribe_template'); + $this->Application->StoreVar('SubscriberEmail', $user_email); + } + + } + else { + + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); + $object->FieldErrors['SubscribeEmail']['pseudo'] = 'invalid_email'; + $event->status = erFAIL; + + } + + + //subscribe_query_ok_template + } + + function OnSubscribeUser(&$event){ + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object = &$this->Application->recallObject($this->Prefix.'.subscriber'); + + $user_email = $this->Application->RecallVar('SubscriberEmail'); + + if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $user_email)){ + + if($object->Load(array('Email'=>$user_email))){ + + $group_info = $this->GetGroupInfo($object->GetID()); + + if ($group_info){ + if ($group_info['PrimaryGroup']){ + // delete user + $object->Delete(); + } + else { + $this->RemoveSubscriberGroup($object->GetID()); + } + + $event->redirect = $this->Application->GetVar('unsubscribe_ok_template'); + + } + else { + $this->AddSubscriberGroup($object->GetID(), 0); + $event->redirect = $this->Application->GetVar('subscribe_ok_template'); + } + + + } + else { + + $object->SetField('Email', $user_email); + $object->SetField('Login', $user_email); + $object->SetDBField('dob_date', 1); + $object->SetDBField('dob_time', 1); + $ip = getenv('HTTP_X_FORWARDED_FOR')?getenv('HTTP_X_FORWARDED_FOR'):getenv('REMOTE_ADDR'); + $object->SetDBField('ip', $ip); + + $this->Application->SetVar('IsSubscriber', 1); + + if ($object->Create()) { + + $this->AddSubscriberGroup($object->GetID(), 1); + $event->redirect = $this->Application->GetVar('subscribe_ok_template'); + } + + $this->Application->SetVar('IsSubscriber', 0); + } + } + else { + // error handling here + $event->redirect = $this->Application->GetVar('subscribe_fail_template'); + } + + + } + + function AddSubscriberGroup($user_id, $is_primary){ + + $group_id = $this->Application->ConfigValue('User_SubscriberGroup'); + $sql = 'INSERT INTO '.TABLE_PREFIX.'UserGroup(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,'.$is_primary.')'; + $this->Conn->Query( sprintf($sql, $user_id, $group_id) ); + + } + + function RemoveSubscriberGroup($user_id){ + + $group_id = $this->Application->ConfigValue('User_SubscriberGroup'); + $sql = 'DELETE FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId='.$user_id.' AND GroupId='.$this->Application->ConfigValue('User_SubscriberGroup'); + $this->Conn->Query($sql); + + } + + function GetGroupInfo($user_id){ + + $group_info = $this->Conn->GetRow('SELECT * FROM '.TABLE_PREFIX.'UserGroup + WHERE PortalUserId='.$user_id.' + AND GroupId='.$this->Application->ConfigValue('User_SubscriberGroup')); + return $group_info; + + } + + function OnForgotPassword(&$event){ + + $this->Application->setUnitOption('u', 'AutoLoad', false); + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + $username = $this->Application->GetVar('username'); + $email = $this->Application->GetVar('email'); + $found = false; + $allow_reset = true; + + if( strlen($username) ) + { + if( $user_object->Load(array('Login'=>$username)) ) + $found = ($user_object->GetDBField("Login")==$username && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } + else if( strlen($email) ) + { + if( $user_object->Load(array('Email'=>$email)) ) + $found = ($user_object->GetDBField("Email")==$email && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } + + if($user_object->Loaded) + { + $PwResetConfirm = $user_object->GetDBField('PwResetConfirm'); + $PwRequestTime = $user_object->GetDBField('PwRequestTime'); + $PassResetTime = $user_object->GetDBField('PassResetTime'); + //$MinPwResetDelay = $user_object->GetDBField('MinPwResetDelay'); + $MinPwResetDelay = $this->Application->ConfigValue('Users_AllowReset'); + + $allow_reset = (strlen($PwResetConfirm) ? + mktime() > $PwRequestTime + $MinPwResetDelay : + mktime() > $PassResetTime + $MinPwResetDelay); + } + + if($found && $allow_reset) + { + $this->Application->StoreVar('tmp_user_id', $user_object->GetDBField("PortalUserId")); + $this->Application->StoreVar('tmp_email', $user_object->GetDBField("Email")); + + $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + + $event->redirect = $this->Application->GetVar('template_success'); + + } + else + { + if(!strlen($username) && !strlen($email)) + { + $user_current_object->ErrorMsgs['forgotpw_nodata'] = $this->Application->Phrase('lu_ferror_forgotpw_nodata'); + $user_current_object->FieldErrors['Login']['pseudo'] = 'lu_ferror_forgotpw_nodata'; + } + else + { + + if($allow_reset) + { + if( strlen($username) ){ + $user_current_object->ErrorMsgs['unknown_username'] = $this->Application->Phrase('lu_ferror_unknown_username'); + $user_current_object->FieldErrors['Login']['pseudo']='unknown_username'; + } + if( strlen($email) ){ + $user_current_object->ErrorMsgs['unknown_email'] = $this->Application->Phrase('lu_ferror_unknown_email'); + $user_current_object->FieldErrors['Email']['pseudo']='unknown_email'; + } + } + else + { + $user_current_object->ErrorMsgs['reset_denied'] = $this->Application->Phrase('lu_ferror_reset_denied'); + if( strlen($username) ){ + $user_current_object->FieldErrors['Login']['pseudo']='reset_denied'; + } + if( strlen($email) ){ + $user_current_object->FieldErrors['Email']['pseudo']='reset_denied'; + } + } + + } + + if($user_current_object->FieldErrors){ + $event->redirect = false; + } + } + + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnResetPassword(&$event){ + + $user_object = &$this->Application->recallObject('u.forgot'); + + if($user_object->Load($this->Application->RecallVar('tmp_user_id'))){ + + $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + $event->redirect = $this->Application->GetVar('template_success'); + + $mod_object =& $this->Application->recallObject('mod.'.'In-Commerce'); + $m_cat_id = $mod_object->GetDBField('RootCat'); + $event->SetRedirectParam('pass', 'm'); + //$event->SetRedirectParam('m_cat_id', $m_cat_id); + $this->Application->SetVar('m_cat_id', $m_cat_id); + + + } + + } + + function OnResetPasswordConfirmed(&$event){ + + $passed_key = $this->Application->GetVar('user_key'); + + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + if (strlen(trim($passed_key)) == 0) { + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = false; + + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + } + + + if($user_object->Load(array('PwResetConfirm'=>$passed_key))) + { + $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; + $user_object->SetDBField("PwResetConfirm", ''); + $user_object->SetDBField("PwRequestTime", 0); + if ($exp_time > mktime()) + { + //$m_var_list_update['codevalidationresult'] = 'lu_resetpw_confirm_text'; + $newpw = makepassword4(); + + $this->Application->StoreVar('password', $newpw); + + $user_object->SetDBField("Password",$newpw); + $user_object->SetDBField("PassResetTime", time()); + $user_object->SetDBField("PwResetConfirm", ''); + $user_object->SetDBField("PwRequestTime", 0); + $user_object->Update(); + + $this->Application->SetVar('ForgottenPassword', $newpw); + + $email_event_user = &$this->Application->EmailEventUser('INCOMMERCEUSER.PSWD', $user_object->GetDBField('PortalUserId')); + $email_event_admin = &$this->Application->EmailEventAdmin('INCOMMERCEUSER.PSWD'); + + $this->Application->DeleteVar('ForgottenPassword'); + + if ($email_event_user->status == erSUCCESS){ + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = $this->Application->GetVar('template_success'); + } + + $user_object->SetDBField("Password",md5($newpw)); + $user_object->Update(); + + } else { + $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired'; + $event->redirect = false; + + } + } else { + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + $event->redirect = false; + + } + } + + function OnUpdate(&$event) + { + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->CheckStateField($event, 'State', 'Country'); + + parent::OnUpdate($event); + + $this->setNextTemplate($event); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function setNextTemplate(&$event) + { + if( !$this->Application->IsAdmin() ) + { + $event->redirect_params['opener'] = 's'; + $object =& $event->getObject(); + if($object->GetDBField('Status') == STATUS_ACTIVE) + { + $next_template = $this->Application->GetVar('next_template'); + if($next_template) $event->redirect = $next_template; + } + } + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_select.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_to_billing_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_discount_pending.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/email_events/email_events_config.php =================================================================== diff -u --- trunk/kernel/units/email_events/email_events_config.php (revision 0) +++ trunk/kernel/units/email_events/email_events_config.php (revision 1566) @@ -0,0 +1,97 @@ + 'emailevents', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'EmailEventsEventsHandler','file'=>'email_events_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => true, + + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + + 'IDField' => 'EventId', + + 'StatusField' => Array('Enabled'), + + 'TitleField' => 'Event', + + 'TitlePresets' => Array( + 'email_settings_list' => Array('prefixes' => Array('emailevents.module_List'), 'format' => '!la_title_EmailSettings! (#emailevents.module_recordcount#)'), + ), + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array('show_enabled','show_disabled','show_frontonly'), 'type' => WHERE_FILTER), + ), + 'Filters' => Array( + 'show_enabled' => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ), + 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ), + 'show_frontonly' => Array('label' => 'la_Text_FrontOnly', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 2' ), + ) + ), + + 'TableName' => TABLE_PREFIX.'Events', + + 'CalculatedFields' => Array( + '' => Array ( + 'FromUser' => 'u.Login', + ) + ), + + 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s + FROM %1$s + LEFT JOIN '.TABLE_PREFIX.'PortalUser u ON %1$s.FromUserId = u.PortalUserId', + ), // key - special, value - list select sql), + + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s'), + + 'ListSortings' => Array( + '' => Array('Sorting' => Array('Module' => 'asc', 'Description' => 'asc') ), + + 'module' => Array('Sorting' => Array('Description' => 'asc') ), + ), + + 'Fields' => Array( + 'EventId' => Array(), + 'Event' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Enabled' => Array('type'=>'int', 'formatter'=>'kOptionsFormatter', 'options' => Array(1 => 'la_Enabled', 0 => 'la_Disabled', 2 => 'la_Text_FrontOnly'), 'use_phrases' => 1, 'default' => 1, 'not_null' => 1), + 'FromUserId' => Array('formatter' => 'kLEFTFormatter','options' => Array(-1=>'root'), 'left_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'PortalUser WHERE `%s` = \'%s\'', 'left_key_field' => 'PortalUserId', 'left_title_field' => 'Login', 'required'=>1, 'not_null' => 1, 'default' => -1), + 'Module' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Description' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Type' => Array('formatter'=>'kOptionsFormatter', 'options' => Array (1 => 'la_Text_Admin', 0 => 'la_Text_User'), 'use_phrases' => 1, 'default' => 0, 'not_null' => 1), + ), + 'VirtualFields' => Array( + 'FromUser' => Array(), + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif'), + 'Fields' => Array( + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td'), + 'Module' => Array( 'title'=>'la_col_Module' ), + 'Type' => Array( 'title'=>'la_col_Type' ), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + ), + + ), + + 'EmailSettings' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif'), + 'Fields' => Array( + 'Description' => Array('title'=>'la_col_Description', 'data_block' => 'label_grid_checkbox_td' ), + 'Type' => Array('title'=>'la_col_Type'), + 'Enabled' => Array('title'=>'la_col_Status'), + 'FromUser' => Array('title'=>'la_col_FromToUser'), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/old/icon_select_page.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_conf_themes.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_theme_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab_active_left.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_move_down.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_clear_all.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/calendar.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/calendar.js (revision 0) +++ trunk/kernel/admin_templates/incs/calendar.js (revision 1566) @@ -0,0 +1,1318 @@ +var cbPath = ""; + /* +preloadImage(cbPath); +preloadImage(cbPathO); +preloadImage(cbPathA); +*/ + +//addScript("core.js"); +//addScript("lang.js"); + +//addCss("wnd.css"); +//addCss("calendar.css"); + +function initCalendar(id, dateFormat) +{ + var input = document.getElementById(id); + if (!input) return; + input.dateFormat = dateFormat; + var cbPath = input.getAttribute("datepickerIcon"); + + var inputContainer = document.createElement("DIV"); + inputContainer.className = "dpContainer"; + inputContainer.noWrap = true; + var pNode = input.parentNode; + pNode.insertBefore(inputContainer, input.nextSibling); +// inputContainer.appendChild(pNode.removeChild(input)); + + var calendarButton = document.createElement("IMG"); + calendarButton.setAttribute("width", "24"); + calendarButton.setAttribute("height", "24"); + calendarButton.setAttribute("align", "absMiddle"); + calendarButton.style.width=24 + calendarButton.style.height=24 + calendarButton.style.cursor = "hand"; + + calendarButton.setAttribute("hspace", 2); + calendarButton.src = cbPath; + calendarButton.onmouseover = cbMouseOver; + calendarButton.onmouseout = cbMouseOut; + calendarButton.onmouseup = calendarButton.onmouseout; + calendarButton.onmousedown = cbMouseDown; + calendarButton.showCalendar = wnd_showCalendar; + inputContainer.appendChild(calendarButton); + inputContainer.dateInput = input; +} + +var calendar; + +function cbMouseOver(e) +{ +// this.src = cbPathO; + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; +} + +function cbMouseOut(e) +{ +// this.src = cbPath; + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; +} + +function cbMouseDown(e) +{ +// this.src = cbPathA; + // alert("cbMouseDown"); + var evt = (e) ? e : event; if (evt) evt.cancelBubble = true; + this.showCalendar(); +} + +function wnd_showCalendar() +{ + var el = this.parentNode.dateInput; + if (calendar != null) calendar.hide(); + else + { + var calendarObject = new Calendar(false, null, dateSelected, closeHandler); + calendar = calendarObject; + calendarObject.setRange(1900, 2070); + calendarObject.create(); + } + calendar.setDateFormat(el.dateFormat); + calendar.parseDate(el.value); + calendar.sel = el; + calendar.showAtElement(el); + + Calendar.addEvent(document, "mousedown", checkCalendar); + return false; +} + +function dateSelected(calendarObject, date) +{ + calendarObject.sel.value = date; + calendarObject.callCloseHandler(); +} + +function closeHandler(calendarObject) +{ + calendarObject.hide(); + Calendar.removeEvent(document, "mousedown", checkCalendar); +} + +function checkCalendar(ev) +{ + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + + for (; el != null; el = el.parentNode) + if (el == calendar.element || el.tagName == "A") break; + + if (el == null) + { + calendar.callCloseHandler(); + Calendar.stopEvent(ev); + } +} + +function preloadImage(path) +{ + var img = new Image(); + img.src = path; + preloadImages.push(img); +} + +function addCss(path) +{ + path = cssPath + path; + document.write(""); +} + +/**/ +/* Copyright Mihai Bazon, 2002 + * http://students.infoiasi.ro/~mishoo + * + * Version: 0.9.1 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + +/** The Calendar object constructor. */ +Calendar = function (mondayFirst, dateStr, onSelected, onClose) { + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.checkDisabled = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.mondayFirst = mondayFirst; + this.dateStr = dateStr; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.daynames = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + + // one-time initializations + if (!Calendar._DN3) { + // table of short day names + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, 3); + } + Calendar._DN3 = ar; + // table of short month names + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, 3); + } + Calendar._MN3 = ar; + } +}; + +// ** constants + +/// "static", needed for event handlers. +Calendar._C = null; + +/// detect a special case of "web browser" +Calendar.is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) && + (navigator.userAgent.toLowerCase().indexOf("opera") == -1) ); + +// short day names array (initialized at first constructor call) +Calendar._DN3 = null; + +// short month names array (initialized at first constructor call) +Calendar._MN3 = null; + +// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate +// library, at some point. + +Calendar.getAbsolutePos = function(el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + if (el.offsetParent) { + var tmp = Calendar.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +Calendar.isRelated = function (el, evt) { + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; +}; + +Calendar.removeClass = function(el, className) { + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); +}; + +Calendar.addClass = function(el, className) { + el.className += " " + className; +}; + +Calendar.getElement = function(ev) { + if (Calendar.is_ie) { + return window.event.srcElement; + } else { + return ev.currentTarget; + } +}; + +Calendar.getTargetElement = function(ev) { + if (Calendar.is_ie) { + return window.event.srcElement; + } else { + return ev.target; + } +}; + +Calendar.stopEvent = function(ev) { + if (Calendar.is_ie) { + window.event.cancelBubble = true; + window.event.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } +}; + +Calendar.addEvent = function(el, evname, func) { + if (Calendar.is_ie) { + el.attachEvent("on" + evname, func); + } else { + el.addEventListener(evname, func, true); + } +}; + +Calendar.removeEvent = function(el, evname, func) { + if (Calendar.is_ie) { + el.detachEvent("on" + evname, func); + } else { + el.removeEventListener(evname, func, true); + } +}; + +Calendar.createElement = function(type, parent) { + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; +}; + +// END: UTILITY FUNCTIONS + +// BEGIN: CALENDAR STATIC FUNCTIONS + +/** Internal -- adds a set of events to make some element behave like a button. */ +Calendar._add_evs = function(el) { + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } +}; + +Calendar.findMonth = function(el) { + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.findYear = function(el) { + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.showMonthsCombo = function () { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + mc.style.left = cd.offsetLeft; + mc.style.top = cd.offsetTop + cd.offsetHeight; + mc.style.display = "block"; +}; + +Calendar.showYearsCombo = function (fwd) { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.firstChild.data = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? 2 : -2; + } + if (show) { + yc.style.left = cd.offsetLeft; + yc.style.top = cd.offsetTop + cd.offsetHeight; + yc.style.display = "block"; + } +}; + +// event handlers + +Calendar.tableMouseUp = function(ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el); + } + var mon = Calendar.findMonth(target); + var date = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + stopEvent(ev); + _C = null; + } +}; + +Calendar.tableMouseOver = function (ev) { + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + } else { + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + } + Calendar.stopEvent(ev); +}; + +Calendar.tableMouseDown = function (ev) { + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + Calendar.stopEvent(ev); + } +}; + +Calendar.calDragIt = function (ev) { + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + Calendar.stopEvent(ev); +}; + +Calendar.calDragEnd = function (ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseover", stopEvent); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); +}; + +Calendar.dayMouseDown = function(ev) { + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + addClass(el, "hilite active"); + addEvent(document, "mouseover", tableMouseOver); + addEvent(document, "mousemove", tableMouseOver); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + Calendar.stopEvent(ev); + if (el.navtype == -1 || el.navtype == 1) { + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } +}; + +Calendar.dayMouseDblClick = function(ev) { + Calendar.cellClick(Calendar.getElement(ev)); + if (Calendar.is_ie) { + document.selection.empty(); + } +}; + +Calendar.dayMouseOver = function(ev) { + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + var date = null; + with (el.calendar.date) { + date = new Date(getFullYear(), getMonth(), el.caldate); + } + el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.firstChild.data = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + } + Calendar.stopEvent(ev); +}; + +Calendar.dayMouseOut = function(ev) { + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) { + return false; + } + removeClass(el, "hilite"); + el.calendar.tooltips.firstChild.data = _TT["SEL_DATE"]; + stopEvent(ev); + } +}; + +/** + * A generic "click" handler :) handles all types of buttons defined in this + * calendar. + */ +Calendar.cellClick = function(el) { + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + if (typeof el.navtype == "undefined") { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + cal.date.setDate(el.caldate); + date = cal.date; + newdate = true; + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = (el.navtype == 0) ? new Date() : new Date(cal.date); + var year = date.getFullYear(); + var mon = date.getMonth(); + var setMonth = function (mon) { + var day = date.getDate(); + var max = date.getMonthDays(); + if (day > max) { + date.setDate(max); + } + date.setMonth(mon); + }; + switch (el.navtype) { + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setMondayFirst(!cal.mondayFirst); + return; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = el.navtype == 0; + } + } + if (newdate) { + cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + } +}; + +// END: CALENDAR STATIC FUNCTIONS + +// BEGIN: CALENDAR OBJECT FUNCTIONS + +/** + * This function creates the calendar inside the given parent. If _par is + * null than it creates a popup calendar inside the BODY element. If _par is + * an element, be it BODY, then it creates a non-popup calendar (still + * hidden). Some properties need to be set before calling this function. + */ +Calendar.prototype.create = function (_par) { + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + if (text.substr(0, 1) != "&") { + cell.appendChild(document.createTextNode(text)); + } + else { + // FIXME: dirty hack for entities + cell.innerHTML = text; + } + return cell; + }; + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + hh("-", 1, 100).ttip = Calendar._TT["TOGGLE"]; + this.title = hh("", this.isPopup ? 5 : 6, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("X", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + hh("«", 1, -2).ttip = Calendar._TT["PREV_YEAR"]; + hh("‹", 1, -1).ttip = Calendar._TT["PREV_MONTH"]; + hh(Calendar._TT["TODAY"], 3, 0).ttip = Calendar._TT["GO_TODAY"]; + hh("›", 1, 1).ttip = Calendar._TT["NEXT_MONTH"]; + hh("»", 1, 2).ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + this.daynames = row; + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + cell.appendChild(document.createTextNode("")); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.appendChild(document.createTextNode("")); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = "label"; + mn.month = i; + mn.appendChild(document.createTextNode(Calendar._MN3[i])); + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = "label"; + yr.appendChild(document.createTextNode("")); + div.appendChild(yr); + } + + this._init(this.mondayFirst, this.date); + parent.appendChild(this.element); +}; + +/** + * (RE)Initializes the calendar to the given date and style (if mondayFirst is + * true it makes Monday the first day of week, otherwise the weeks start on + * Sunday. + */ +Calendar.prototype._init = function (mondayFirst, date) { + var today = new Date(); + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.mondayFirst = mondayFirst; + this.date = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + date.setDate(1); + var wday = date.getDay(); + var MON = mondayFirst ? 1 : 0; + var SAT = mondayFirst ? 5 : 6; + var SUN = mondayFirst ? 6 : 0; + if (mondayFirst) { + wday = (wday > 0) ? (wday - 1) : 6; + } + var iday = 1; + var row = this.tbody.firstChild; + var MN = Calendar._MN3[month]; + var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month)); + var todayDate = today.getDate(); + for (var i = 0; i < 6; ++i) { + if (iday > no_days) { + row.className = "emptyrow"; + row = row.nextSibling; + continue; + } + var cell = row.firstChild; + row.className = "daysrow"; + for (var j = 0; j < 7; ++j) { + if ((!i && j < wday) || iday > no_days) { + cell.className = "emptycell"; + cell = cell.nextSibling; + continue; + } + cell.firstChild.data = iday; + cell.className = "day"; + cell.disabled = false; + if (typeof this.checkDisabled == "function") { + date.setDate(iday); + if (this.checkDisabled(date)) { + cell.className += " disabled"; + cell.disabled = true; + } + } + if (!cell.disabled) { + cell.caldate = iday; + cell.ttip = "_"; + if (iday == mday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (hasToday && (iday == todayDate)) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (wday == SAT || wday == SUN) { + cell.className += " weekend"; + } + } + ++iday; + ((++wday) ^ 7) || (wday = 0); + cell = cell.nextSibling; + } + row = row.nextSibling; + } + this.title.firstChild.data = Calendar._MN[month] + ", " + year; + // PROFILE + // this.tooltips.firstChild.data = "Generated in " + ((new Date()) - today) + " ms"; +}; + +/** + * Calls _init function above for going to a certain date (but only if the + * date is different than the currently selected one). + */ +Calendar.prototype.setDate = function (date) { + if (!date.equalsTo(this.date)) { + this._init(this.mondayFirst, date); + } +}; + +/** Modifies the "mondayFirst" parameter (EU/US style). */ +Calendar.prototype.setMondayFirst = function (mondayFirst) { + this._init(mondayFirst, this.date); + this._displayWeekdays(); +}; + +/** + * Allows customization of what dates are enabled. The "unaryFunction" + * parameter must be a function object that receives the date (as a JS Date + * object) and returns a boolean value. If the returned value is true then + * the passed date will be marked as disabled. + */ +Calendar.prototype.setDisabledHandler = function (unaryFunction) { + this.checkDisabled = unaryFunction; +}; + +/** Customization of allowed year range for the calendar. */ +Calendar.prototype.setRange = function (a, z) { + this.minYear = a; + this.maxYear = z; +}; + +/** Calls the first user handler (selectedHandler). */ +Calendar.prototype.callHandler = function () { + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } +}; + +/** Calls the second user handler (closeHandler). */ +Calendar.prototype.callCloseHandler = function () { + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); +}; + +/** Removes the calendar object from the DOM tree and destroys it. */ +Calendar.prototype.destroy = function () { + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + delete el; +}; + +/** + * Moves the calendar element to a different section in the DOM tree (changes + * its parent). + */ +Calendar.prototype.reparent = function (new_parent) { + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); +}; + +/** Shows the calendar. */ +Calendar.prototype.show = function () { + this.element.style.display = "block"; + this.hideShowCovered(); +}; + +/** + * Hides the calendar. Also removes any "hilite" from the class of any TD + * element. + */ +Calendar.prototype.hide = function () { + var trs = this.table.getElementsByTagName("td"); + for (var i = trs.length; i > 0; ) { + Calendar.removeClass(trs[--i], "hilite"); + } + this.element.style.display = "none"; +}; + +/** + * Shows the calendar at a given absolute position (beware that, depending on + * the calendar element style -- position property -- this might be relative + * to the parent's containing rectangle). + */ +Calendar.prototype.showAt = function (x, y) { + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); +}; + +/** Shows the calendar near a given element. */ +Calendar.prototype.showAtElement = function (el) { + var p = Calendar.getAbsolutePos(el); + + var cw = 190; + var ch = -200; + + if (Calendar.is_ie) + { + var posX = getWndX(el) + el.offsetWidth + 18; if (posX + ch > document.body.scrollLeft + document.body.offsetWidth) posX = document.body.scrollLeft + document.body.offsetWidth - ch + var posY = p.y + el.offsetHeight; if (posY + cw > document.body.scrollTop + document.body.offsetHeight) posY = getWndY(el) - cw; + //document.body.scrollTop + document.body.offsetHeight - cw - el.offsetHeight + this.showAt(posX, posY); + } + else + { + // for other browsers types + this.showAt(getWndX(el) + el.offsetWidth + 30, p.y + el.offsetHeight-200); + } +}; + +function getWndC(object, c) +{ + pos = 0; + while (object != null) + { + pos += (c == "y") ? object.offsetTop : object.offsetLeft; + object = object.offsetParent; + } + return pos; +} + +function getWndX(object) {return getWndC(object, "x")} +function getWndY(object) {return getWndC(object, "y")} + + +/** Customizes the date format. */ +Calendar.prototype.setDateFormat = function (str) { + this.dateFormat = str; +}; + +/** Customizes the tooltip date format. */ +Calendar.prototype.setTtDateFormat = function (str) { + this.ttDateFormat = str; +}; + +/** + * Tries to identify the date represented in a string. If successful it also + * calls this.setDate which moves the calendar to the given date. + */ +Calendar.prototype.parseDate = function (str, fmt) { + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + if (!fmt) { + fmt = this.dateFormat; + } + var b = fmt.split(/\W+/); + var i = 0, j = 0; + for (i = 0; i < a.length; ++i) { + if (b[i] == "D" || b[i] == "DD") { + continue; + } + if (b[i] == "j" || b[i] == "d") { + d = a[i]; + } + if (b[i] == "n" || b[i] == "m") { + m = a[i]-1; + } +// if (b[i] == "y") { +// y = a[i]; +// } + if ((b[i] == "Y")||(b[i] == "y")) { +// if (b[i] == "yy") { + if (a[i].length == 4) { + y = a[i]; + } + else { + if (parseInt(a[i]) < 70) { + y = parseInt(a[i]) + 2000; + } + else { + y = parseInt(a[i]) + 1900; + } + } + } + if (b[i] == "M" || b[i] == "MM") { + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + } + } + if (y != 0 && m != -1 && d != 0) { + this.setDate(new Date(y, m, d)); + return; + } + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i]) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i]) > 31 && y == 0) { + y = a[i]; + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) { + var today = new Date(); + y = today.getFullYear(); + } + if (m != -1 && d != 0) { + this.setDate(new Date(y, m, d)); + } +}; + +Calendar.prototype.hideShowCovered = function () { + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + cc.style.visibility = "visible"; + } else { + cc.style.visibility = "hidden"; + } + } + } +}; + +/** Internal function; it displays the bar with the names of the weekday. */ +Calendar.prototype._displayWeekdays = function () { + var MON = this.mondayFirst ? 0 : 1; + var SUN = this.mondayFirst ? 6 : 0; + var SAT = this.mondayFirst ? 5 : 6; + var cell = this.daynames.firstChild; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + if (!i) { + cell.ttip = this.mondayFirst ? Calendar._TT["SUN_FIRST"] : Calendar._TT["MON_FIRST"]; + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + if (i == SUN || i == SAT) { + Calendar.addClass(cell, "weekend"); + } + cell.firstChild.data = Calendar._DN3[i + 1 - MON]; + cell = cell.nextSibling; + } +}; + +/** Internal function. Hides all combo boxes that might be displayed. */ +Calendar.prototype._hideCombos = function () { + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; +}; + +/** Internal function. Starts dragging the element. */ +Calendar.prototype._dragStart = function (ev) { + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseover", stopEvent); + addEvent(document, "mouseup", calDragEnd); + } +}; + +// BEGIN: DATE OBJECT PATCHES + +/** Adds the number of days array to the Date object. */ +Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + +/** Returns the number of days in the current month */ +Date.prototype.getMonthDays = function() { + var year = this.getFullYear(); + var month = this.getMonth(); + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } +}; + +/** Checks dates equality (ignores time) */ +Date.prototype.equalsTo = function(date) { + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate())); +}; + +/** Prints the date in a string according to the given format. */ +Date.prototype.print = function (frm) { + var str = new String(frm); + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var w = this.getDay(); + var s = new Array(); + s["j"] = d; + s["d"] = (d < 10) ? ("0" + d) : d; + s["n"] = 1+m; + s["m"] = (m < 9) ? ("0" + (1+m)) : (1+m); + s["Y"] = y; + s["y"] = new String(y).substr(2, 2); + with (Calendar) { + s["D"] = _DN3[w]; + s["DD"] = _DN[w]; + s["M"] = _MN3[m]; + s["MM"] = _MN[m]; + } + var re = /(.*)(\W|^)(j|d|n|m|y|Y|MM|M|DD|D)(\W|$)(.*)/; + while (re.exec(str) != null) { + str = RegExp.$1 + RegExp.$2 + s[RegExp.$3] + RegExp.$4 + RegExp.$5; + } + return str; +}; + +// END: DATE OBJECT PATCHES +/**/ +/**/ +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["TOGGLE"] = "Toggle first day of week"; +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; +Calendar._TT["MON_FIRST"] = "Display Monday first"; +Calendar._TT["SUN_FIRST"] = "Display Sunday first"; +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd"; +Calendar._TT["TT_DATE_FORMAT"] = "D, M d"; +/**/ +/**/ +document.write("") +/* The main calendar widget. DIV containing a table. */ + Index: trunk/kernel/admin_templates/img/old/icon_select_all.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/email_messages/email_messages_event_handler.php =================================================================== diff -u --- trunk/core/units/email_messages/email_messages_event_handler.php (revision 0) +++ trunk/core/units/email_messages/email_messages_event_handler.php (revision 1566) @@ -0,0 +1,138 @@ +getEmailEventId(); + $object =& $event->getObject(); + + $parent_info = $object->getLinkedInfo(); + + $sql = 'SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE ('.$parent_info['ForeignKey'].' = '.$parent_info['ParentId'].') AND (EventId = '.$email_event_id.')'; + + $id = (int)$this->Conn->GetOne($sql); + if(!$id) + { + $object->SetDBField('EventId', $email_event_id); + $object->SetDBField('Headers', $this->Application->ConfigValue('Smtp_DefaultHeaders') ); + } + return $id; + } + + function getEmailEventId() + { + return parent::getPassedID( new kEvent('emailevents:OnDummy') ); + } + + /** + * If loading empty item, then set parent id + * + * @param kEvent $event + */ + function OnBeforeItemLoad(&$event) + { + if( !$event->getEventParam('id') ) + { + $this->OnNew($event); + $event->status = erFATAL; + } + } + + + /** + * Parse message template (split into header, subject & body) + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + $object =& $event->getObject(); + + $lines = explode("\n", $object->GetDBField('Template') ); + + $headers = Array(); + + foreach($lines as $line) + { + if( strlen(trim($line)) == 0 || ($line == '.') ) break; + + $parts = explode(':', $line, 2); + if(strtolower($parts[0]) == 'subject') + { + $object->SetDBField('Subject', trim($parts[1]) ); + } + else + { + $headers[] = $line; + } + } + $object->SetDBField('Headers', implode("\n", $headers) ); + + $message_body = ''; + while( (list($line_id,$line) = each($lines)) ) + { + $message_body .= $line; + } + $object->SetDBField('Body', $message_body); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + $this->parseVirtualFields($event); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + $this->parseVirtualFields($event); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function parseVirtualFields(&$event) + { + $object =& $event->getObject(); + if( $object->GetDBField('Headers') || $object->GetDBField('Subject') || $object->GetDBField('Body') ) + { + $ret = $object->GetDBField('Headers'); + if($ret) $ret .= "\n"; + + $ret = $this->removeTrailingCRLF($ret); + $ret .= 'Subject: '.$object->GetDBField('Subject')."\n\n"; + $ret .= $object->GetDBField('Body'); + $object->SetDBField('Template', $ret); + } + } + + /** + * Remove trailing CR/LF chars from string + * + * @param string $string + * @return string + */ + function removeTrailingCRLF($string) + { + return preg_replace('/(\n|\r)+/',"\\1",$string); + } + } + +?> \ No newline at end of file Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/inp_db_event_handler.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_modify_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/header.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/incs/header.tpl (revision 0) +++ trunk/kernel/admin_templates/incs/header.tpl (revision 1566) @@ -0,0 +1,49 @@ + + + +In-Commerce + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + +Reload frame || Show debugger + \ No newline at end of file Index: trunk/core/units/modules/modules_config.php =================================================================== diff -u --- trunk/core/units/modules/modules_config.php (revision 0) +++ trunk/core/units/modules/modules_config.php (revision 1566) @@ -0,0 +1,41 @@ + 'mod', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'ModulesEventHandler','file'=>'modules_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'hooks' => Array(), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + 'IDField' => 'Name', + 'TitleField' => 'Name', // field, used in bluebar when editing existing item + 'TableName' => TABLE_PREFIX.'Modules', + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', + ), + 'ListSortings' => Array(), + 'Fields' => Array( + 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Path' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Var' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Version' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Loaded' => Array('type' => 'int','not_null' => '1','default' => '1'), + 'LoadOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'TemplatePath' => Array('type' => 'string','not_null' => '1','default' => ''), + 'RootCat' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'BuildDate' => Array('type' => 'double','not_null' => '1','default' => '0'), + ), + 'VirtualFields' => Array(), + + 'Grids' => Array(), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_manufacturer.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_user_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_valid.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/logo.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/footer.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/incs/footer.tpl (revision 0) +++ trunk/kernel/admin_templates/incs/footer.tpl (revision 1566) @@ -0,0 +1,4 @@ + + + + \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_update_rates.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/themes/themes_config.php =================================================================== diff -u --- trunk/core/units/themes/themes_config.php (revision 0) +++ trunk/core/units/themes/themes_config.php (revision 1566) @@ -0,0 +1,78 @@ + 'theme', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'InpDBEventHandler','file'=>'','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'ThemesTagProcessor','file'=>'themes_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'Hooks' => Array(), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + 'IDField' => 'ThemeId', + + 'StatusField' => Array('Enabled','Primary'), + + 'TitleField' => 'Name', + + 'TableName' => TABLE_PREFIX.'Theme', + 'SubItems' => Array('themefiles'), + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER), + ), + + 'Filters' => Array( + 0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ), + 1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ), + ) + ), + + 'AutoDelete' => true, + 'AutoClone' => true, + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>' SELECT %1$s.*, style.LastCompiled, style.Name AS StyleName + FROM %s + LEFT JOIN '.TABLE_PREFIX.'Stylesheets style ON style.StylesheetId = %1$s.StylesheetId', + ), + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Name' => 'asc'), + ) + ), + 'Fields' => Array( + 'ThemeId' => Array(), + 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1=>'la_Enabled', 0=>'la_Disabled'), 'use_phrases'=>1, 'not_null' => '1','default' => '1'), + 'Description' => Array('type' => 'string','default' => ''), + 'PrimaryTheme' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'CacheTimeout' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'StylesheetId' => Array('type' => 'int','not_null' => '1','default' => '0'), + ), + + 'VirtualFields' => Array( + 'LastCompiled' => Array('type'=>'int', 'formatter'=>'kDateFormatter' ), + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif',0=>'icon16_style_disabled.gif',1=>'icon16_style.gif'), + 'Fields' => Array( + 'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'), + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/menu_bar.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/act_addtocart.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_orders.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/sort_asc.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_theme.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_selector_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_language_var_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_banlist.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_cut_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_style.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/translator/translator_event_handler.php =================================================================== diff -u --- trunk/core/units/translator/translator_event_handler.php (revision 0) +++ trunk/core/units/translator/translator_event_handler.php (revision 1566) @@ -0,0 +1,83 @@ +Application->GetVar($event->getPrefixSpecial(true).'_prefix'); + $object = $this->Application->recallObject($obj_prefix); + + /*$items_info = $this->Application->GetVar( $obj_prefix ); + if($items_info) $field_values = array_shift($items_info); + $object->SetFieldsFromHash($field_values); + $object->Update();*/ + + $field = $this->Application->GetVar($event->getPrefixSpecial(true).'_field'); + + $translator =& $this->Application->recallObject($event->getPrefixSpecial()); + + $def_lang = $this->Application->GetDefaultLanguageId(); + + $current_lang = $translator->GetDBField('Language'); + if (!$current_lang) $current_lang = $this->Application->RecallVar('trans_lang'); + if (!$current_lang) $current_lang = $this->Application->GetVar('m_lang'); + /*if ($current_lang == $def_lang) { + $current_lang = $def_lang + 1; + }*/ + $this->Application->StoreVar('trans_lang', $current_lang); //remember translation language for user friendlyness + + + $translator->SetId(1); + $translator->SetDBField('Original', $object->GetDBField('l'.$this->Application->GetVar('m_lang').'_'.$field)); + $translator->SetDBField('Language', $current_lang); + $translator->SetDBField('SwitchLanguage', $current_lang); + + $translator->SetDBField('Translation', $object->GetDBField('l'.$current_lang.'_'.$field)); + + $cur_lang = $this->Application->recallObject('lang.current'); + $cur_lang->Load($current_lang); + + $translator->SetDBField('Charset', $cur_lang->GetDBField('Charset')); + + $event->redirect = false; + } + + function OnSaveAndClose(&$event) + { + $event->CallSubEvent('OnPreSave'); + $this->finalizePopup($event, '', 'in-commerce/products/products_edit'); + } + + function OnPreSave(&$event) + { + $translator =& $this->Application->recallObject($event->getPrefixSpecial()); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) $field_values = array_shift($items_info); + + $translator->SetFieldsFromHash($field_values); + + $object = $this->Application->recallObject($this->Application->GetVar($event->getPrefixSpecial(true).'_prefix')); + $field = $this->Application->GetVar($event->getPrefixSpecial(true).'_field'); + + $lang = $translator->GetDBField('Language'); + $object->Fields['l'.$lang.'_'.$field] = Array(); + $object->SetDBField('l'.$lang.'_'.$field, $translator->GetDBField('Translation')); + $this->RemoveRequiredFields($object); + $object->Update(); + } + + function OnChangeLanguage(&$event) + { + $event->CallSubEvent('OnPreSave'); + $translator =& $this->Application->recallObject($event->getPrefixSpecial()); + $translator->SetDBField('Language', $translator->GetDBField('SwitchLanguage')); + $event->CallSubEvent('OnLoad'); + $event->redirect = false; + } + + } + + +?> \ No newline at end of file Index: trunk/admin/editor/editor_new.php =================================================================== diff -u --- trunk/admin/editor/editor_new.php (revision 0) +++ trunk/admin/editor/editor_new.php (revision 1566) @@ -0,0 +1,208 @@ +Get("Site_Path"); +$admin = $objConfig->Get("AdminDirectory"); +if(!strlen($admin)) + $admin = "admin"; +$adminURL = $rootURL.$admin; +$imagesURL = $adminURL."/images"; +require_once ($pathtoroot.$admin."/include/elements.php"); +require_once ($pathtoroot."kernel/admin/include/navmenu.php"); +require_once($pathtoroot.$admin."/toolbar.php"); +require_once($pathtoroot.$admin."/editor/cmseditor/fckeditor.php"); + +$style_sheet_global = $adminURL."/include/style.css"; +?> + + + Online Editor + \n"; ?> + + + + +
+Set("section",$section); + $objListToolBar->Set("load_menu_func",""); + $objListToolBar->Set("CheckClass",""); + + $listImages = array(); + //$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick + + $objListToolBar->Add("select", "la_ToolTip_Select","#","swap('select','toolbar/tool_select_f2.gif');", + "swap('select', 'toolbar/tool_select.gif');", + "document.frm.submit();","tool_select.gif"); + + $objListToolBar->Add("cancel", "la_ToolTip_Stop","#","swap('cancel','toolbar/tool_stop_f2.gif');", + "swap('cancel', 'toolbar/tool_stop.gif');","window.close();","tool_stop.gif"); + + $title = "Online HTML Editor"; + + $objSections->SetCurrentSection($section); + print $objSections->section_header($envar,NULL,$title); + $TargetForm = $_GET["TargetForm"]; + $TargetField = $_GET["TargetField"]; + echo $objListToolBar->Build(); +?> + +BasePath = 'cmseditor/' ; + $oFCKeditor->Width = '100%' ; + $oFCKeditor->Height = '500' ; + $oFCKeditor->ToolbarSet = 'Default' ; + $oFCKeditor->Value = '' ; + $oFCKeditor->Config = Array( + 'UserFilesPath' => $pathtoroot.'kernel/userfiles', + 'ProjectPath' => $objConfig->Get("Site_Path"), + 'CustomConfigurationsPath' => $rootURL.'admin/editor/inp_fckconfig.js', + + 'Debug' => 1, + ); + + echo $oFCKeditor->CreateHtml() ; +?> + +
+ + + + + + Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/cat_dbitem.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon46_list_currencies.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_image_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/my_application.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_homecat_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/cat_dblist.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/themes/default/img/menu_bg.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_tool_export.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_edit_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/selectors/selectors_tag_processor.php =================================================================== diff -u --- trunk/kernel/units/selectors/selectors_tag_processor.php (revision 0) +++ trunk/kernel/units/selectors/selectors_tag_processor.php (revision 1566) @@ -0,0 +1,89 @@ +Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); + $style_data = $object->GetDBField( $params['field'] ); + + $ret = $object->CompileStyleBody( getArrayValue($params,'inline') ? STYLE_INLINE : STYLE_PREVIEW ); + + return $ret; + } + + /** + * Returns input field name to + * be placed on form (for correct + * event processing) + * + * @param Array $params + * @return string + * @access public + */ + function InputName($params) + { + $ret = parent::InputName($params); + $subfield = getArrayValue($params,'subfield'); + if($subfield && $subfield != '$subfield') + { + $ret .= '['.$subfield.']'; + } + return $ret; + } + + function Field($params) + { + $subfield = getArrayValue($params,'subfield'); + if($subfield && $subfield != '$subfield') + { + $params['no_special'] = 'no_special'; + } + $ret = parent::Field($params); + if($subfield && $subfield != '$subfield') + { + $ret = getArrayValue($ret,$subfield); + return $ret !== false ? $ret : ''; + } + return $ret; + } + + function PredefinedOptions($params) + { + $field = $params['field']; + $object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params); + + $value = $object->GetDBField($field); + $subfield = getArrayValue($params,'subfield'); + if($subfield && $subfield != '$subfield') $value = $value[$subfield]; + + $value_field = getArrayValue($params,'value_field'); + if(!$value_field) $value_field = $field; + + $options = $object->GetFieldOptions($value_field); + + $block_params['name'] = $params['block']; + $block_params['field'] = $params['field']; + $block_params['pass_params'] = 'true'; + + $selected_param_name = $params['selected_param']; + if (!$selected_param_name) $selected_param_name = $params['selected']; + $selected = $params['selected']; + + $o = ''; + foreach ($options['options'] as $key => $val) { + $block_params['key'] = $key; + $block_params['option'] = $val; + $block_params['field_name'] = $this->InputName($params); + $block_params[$selected_param_name] = ( $key == $value ? ' '.$selected : ''); + $block_params['PrefixSpecial'] = $this->getPrefixSpecial(); + $o .= $this->Application->ParseBlock($block_params, 1); + } + + return $o; + } + + } + +?> \ No newline at end of file Index: trunk/themes/default/img/cube.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_listing.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_products.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_conf_themes.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_theme.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_settings_in-newz.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_move_up_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_tool_restore.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_paste.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/fw_menu.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/fw_menu.js (revision 0) +++ trunk/kernel/admin_templates/incs/fw_menu.js (revision 1566) @@ -0,0 +1,745 @@ +/** + * fw_menu 24OCT2000 Version 4.0 + * John Ahlquist, October 2000 + * Copyright (c) 2000 Macromedia, Inc. + * + * based on menu.js + * by gary smith, July 1997 + * Copyright (c) 1997-1999 Netscape Communications Corp. + * + * Netscape grants you a royalty free license to use or modify this + * software provided that this copyright notice appears on all copies. + * This software is provided "AS IS," without a warranty of any kind. + * + * Modified By Intechnic Corporation for use in In-Portal + * 6/28/02 + * + */ +function Menu(label) { + this.version = "990702 [xMenu; fw_menu.js]"; + this.type = "Menu"; + this.menuWidth = 0; + this.menuItemHeight = 0; + this.fontSize = 11; + this.fontWeight = "normal"; + this.fontFamily = "helvetica, arial, verdana, helvetica"; + this.fontColor = "#000000"; + this.fontColorHilite = "#000000"; + this.bgColor = "#555555"; + this.menuBorder = 1; + this.menuItemBorder = 0; + this.menuItemBgColor = "#f0f1eb"; + this.menuLiteBgColor = "#ffffff"; + this.menuBorderBgColor = "#777777"; + this.menuHiliteBgColor = "#e0e0da"; + this.menuContainerBgColor = "#cccccc"; + this.imagePath = (typeof(activeTab) != 'undefined') ? 'images/' : 'img/'; + this.childMenuIcon = "menu_arrow.gif"; + this.items = new Array(); + this.actions = new Array(); + this.types = new Array(); //for check/radio type to show pics + this.childMenus = new Array(); + + this.hideOnMouseOut = true; + + this.addMenuItem = addMenuItem; + this.addMenuSeparator = addMenuSeparator; + this.writeMenus = writeMenus; + this.FW_showMenu = FW_showMenu; + this.onMenuItemOver = onMenuItemOver; + this.onMenuItemAction = onMenuItemAction; + this.hideMenu = hideMenu; + this.hideChildMenu = hideChildMenu; + + label = RemoveTranslationLink(label); + if (!window.menus) window.menus = new Array(); + this.label = label || "menuLabel" + window.menus.length; + window.menus[this.label] = this; + window.menus[window.menus.length] = this; + if (!window.activeMenus) window.activeMenus = new Array(); +} + +function addMenuItem(label, action, type) +{ + if( typeof(label) == 'string' ) label = RemoveTranslationLink(label); + if( isset(type) ) type = parseInt(type); + this.items[this.items.length] = label; + this.actions[this.actions.length] = action; + switch(type) + { + case 1: + this.types[this.types.length] = this.imagePath+'check_on.gif'; + break; + case 2: + this.types[this.types.length] = this.imagePath+'menu_dot.gif'; + break; + default: + this.types[this.types.length] = ''; + } +} + +function addMenuSeparator() { + this.items[this.items.length] = "separator"; + this.actions[this.actions.length] = ""; + this.types[this.types.length] = ""; + this.menuItemBorder = 0; +} + +// For NS6. +function FIND(item,called_from) +{ + if (document.all) return(document.all[item]); + if (document.getElementById) return(document.getElementById(item)); + return(false); +} + +function writeMenus(container_id) { + + if (window.triedToWriteMenus) return; + var container = null; + + if (!container_id && document.layers) { + window.delayWriteMenus = this.writeMenus; + var timer = setTimeout('delayWriteMenus()', 100); + container = new Layer(100); + clearTimeout(timer); + } else if (document.all || document.hasChildNodes) { + if( !isset(container_id) ) container_id = 'menuContainer'; + container = FIND(container_id); + if (!container) + { + container = document.createElement('SPAN'); + container.id = container_id; + document.body.appendChild(container); + container = FIND(container_id); + } + else + { + container.innerHTML = ''; + } + } + + window.fwHideMenuTimer = null; + if (!container) return; window.triedToWriteMenus = true; + container.isContainer = true; + container.menus = new Array(); + + for (var i=0; i
\n'; + } + i=x; + } + if (document.layers) { + container.clip.width = window.innerWidth; + container.clip.height = window.innerHeight; + container.onmouseout = mouseoutMenu; + container.menuContainerBgColor = this.menuContainerBgColor; + for (var i=0; i0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder; + l.hilite = l.document.layers[1]; + if (proto.bgImageUp) l.background.src = proto.bgImageUp; + l.document.layers[1].isHilite = true; + if (l.document.layers[0].id.indexOf("menuSeparator") != -1) { + l.hilite = null; + l.clip.height -= l.clip.height / 2; + l.document.layers[0].document.bgColor = proto.bgColor; + l.document.layers[0].clip.width = l.clip.width -2; + l.document.layers[0].clip.height = 1; + l.document.layers[1].document.bgColor = proto.menuLiteBgColor; + l.document.layers[1].clip.width = l.clip.width -2; + l.document.layers[1].clip.height = 1; + l.document.layers[1].top = l.document.layers[0].top + 1; + } else if (l.document.layers.length > 2) { + l.childMenu = container.menus[i].items[n].menuLayer; + l.document.layers[2].left = l.clip.width -13; + l.document.layers[2].top = (l.clip.height / 2) -4; + l.document.layers[2].clip.left += 3; + l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu; + } + } + body.document.bgColor = proto.bgColor; + body.clip.width = l.clip.width +proto.menuBorder; + body.clip.height = l.top + l.clip.height +proto.menuBorder; + var focusItem = body.document.layers[n]; + focusItem.clip.width = body.clip.width; + focusItem.Menu = l.Menu; + focusItem.top = -30; + focusItem.captureEvents(Event.MOUSEDOWN); + focusItem.onmousedown = onMenuItemDown; + menu.document.bgColor = proto.menuBorderBgColor; + var lite = menu.document.layers[0]; + lite.document.bgColor = proto.menuLiteBgColor; + lite.clip.width = body.clip.width +1; + lite.clip.height = body.clip.height +1; + menu.clip.width = body.clip.width + (proto.menuBorder * 3) ; + menu.clip.height = body.clip.height + (proto.menuBorder * 3); + } + } else { + if ((document.all) || (container.hasChildNodes)) { + container.innerHTML=content; + } else { + container.document.open("text/html"); + container.document.writeln(content); + container.document.close(); + } + if (!FIND("menuLayer0")) return; + var menuCount = 0; + for (var x=0; x window.innerWidth || + NS4sIH > window.innerHeight || + NS4sIH < window.innerHeight ) + { + window.location.reload(); + } +} + +function onMenuItemOver(e, l) { + FW_clearTimeout(); + l = l || this; + a = window.ActiveMenuItem; + if (document.layers) { + if (a) { + a.document.bgColor = a.saveColor; + if (a.hilite) a.hilite.visibility = "hidden"; + if (a.Menu.bgImageOver) { + a.background.src = a.Menu.bgImageUp; + } + a.focusItem.top = -100; + a.clicked = false; + } + if (l.hilite) { + l.document.bgColor = l.menuHiliteBgColor; + l.zIndex = 100; + l.hilite.visibility = "inherit"; + l.hilite.zIndex = 101; + l.document.layers[1].zIndex = 100; + l.focusItem.zIndex = this.zIndex +2; + } + if (l.Menu.bgImageOver) { + l.background.src = l.Menu.bgImageOver; + } + l.focusItem.top = this.top; + l.Menu.hideChildMenu(l); + } else if (l.style && l.Menu) { + if (a) { + a.style.backgroundColor = a.saveColor; + if (a.hilite) a.hilite.style.visibility = "hidden"; + if (a.Menu.bgImageUp) { + a.style.background = "url(" + a.Menu.bgImageUp +")";; + } + } + if (l.isSeparator) return; + l.style.backgroundColor = l.menuHiliteBgColor; + l.zIndex = 100; // magic IE 4.5 mac happy doohicky. jba + if (l.Menu.bgImageOver) { + l.style.background = "url(" + l.Menu.bgImageOver +")"; + } + if (l.hilite) { + l.style.backgroundColor = l.menuHiliteBgColor; + l.hilite.style.visibility = "inherit"; + } + l.focusItem.style.top = l.focusItem.style.pixelTop = l.style.pixelTop; + l.focusItem.style.zIndex = l.zIndex +1; +// alert(l.Menu.childMenus); + + + l.Menu.hideChildMenu(l); + } else { + return; // not a menu - magic IE 4.5 mac happy doohicky. jba + } + window.ActiveMenuItem = l; +} + +function onMenuItemAction(e, l) { + l = window.ActiveMenuItem; + if (!l) return; + hideActiveMenus(); + if (l.action) { + eval("" + l.action); + } + window.ActiveMenuItem = 0; +} + +function FW_clearTimeout() +{ + if (fwHideMenuTimer) clearTimeout(fwHideMenuTimer); + fwHideMenuTimer = null; + fwDHFlag = false; +} +function FW_startTimeout() +{ + fwStart = new Date(); + fwDHFlag = true; + fwHideMenuTimer = setTimeout("fwDoHide()", 1000); +} + +function fwDoHide() +{ + if (!fwDHFlag) return; + var elapsed = new Date() - fwStart; + if (elapsed < 1000) { + fwHideMenuTimer = setTimeout("fwDoHide()", 1100-elapsed); + return; + } + fwDHFlag = false; + hideActiveMenus(); + window.ActiveMenuItem = 0; +} + +function FW_showMenu(menu, x, y, child) { + if (!window.fwWroteMenu) + { + alert('No Menu Written'); + return; + } + FW_clearTimeout(); + if (document.layers) { + if (menu) { + var l = menu.menuLayer || menu; + l.left = 1; + l.top = 1; + hideActiveMenus(); + if (this.visibility) l = this; + window.ActiveMenu = l; + } else { + var l = child; + } + if (!l) return; + for (var i=0; i 0) + FW_showMenu(null, "relative", "relative", l.layers[i]); + } + if (l.parentLayer) { + if (x != "relative") + l.parentLayer.left = x || window.pageX || 0; + if (l.parentLayer.left + l.clip.width > window.innerWidth) + l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth); + if (y != "relative") + l.parentLayer.top = y || window.pageY || 0; + if (l.parentLayer.isContainer) { + l.Menu.xOffset = window.pageXOffset; + l.Menu.yOffset = window.pageYOffset; + l.parentLayer.clip.width = window.ActiveMenu.clip.width +2; + l.parentLayer.clip.height = window.ActiveMenu.clip.height +2; + if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor; + } + } + l.visibility = "inherit"; + if (l.Menu) l.Menu.container.visibility = "inherit"; + } else if (FIND("menuItem0")) { + var l = menu.menuLayer || menu; + hideActiveMenus(); +// alert('L: '+l); + if (typeof(l) == "string") { + l = FIND(l,'line 550'); + } + window.ActiveMenu = l; + var s = l.style; + s.visibility = "inherit"; + if (x != "relative") + s.left = s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0; + if (y != "relative") + s.top = s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0; + l.Menu.xOffset = document.body.scrollLeft; + l.Menu.yOffset = document.body.scrollTop; + } + if (menu) { + window.activeMenus[window.activeMenus.length] = l; + } +} + +function onMenuItemDown(e, l) { + var a = window.ActiveMenuItem; + if (document.layers) { + if (a) { + a.eX = e.pageX; + a.eY = e.pageY; + a.clicked = true; + } + } +} + +function mouseupMenu(e) +{ + hideMenu(true, e); + hideActiveMenus(); + return true; +} + +function mouseoutMenu() +{ + hideMenu(false, false); + return true; +} + + +function hideMenu(mouseup, e) { + var a = window.ActiveMenuItem; + if (a && document.layers) { + a.document.bgColor = a.saveColor; + a.focusItem.top = -30; + if (a.hilite) a.hilite.visibility = "hidden"; + if (mouseup && a.action && a.clicked && window.ActiveMenu) { + if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) { + setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2); + } + } + a.clicked = false; + if (a.Menu.bgImageOver) { + a.background.src = a.Menu.bgImageUp; + } + } else if (window.ActiveMenu && FIND("menuItem0")) { + if (a) { + a.style.backgroundColor = a.saveColor; + if (a.hilite) a.hilite.style.visibility = "hidden"; + if (a.Menu.bgImageUp) { + a.style.background = "url(" + a.Menu.bgImageUp +")";; + } + } + } + if (!mouseup && window.ActiveMenu) { + if (window.ActiveMenu.Menu) { + if (window.ActiveMenu.Menu.hideOnMouseOut) { + FW_startTimeout(); + } + return(true); + } + } + return(true); +} + +function PxToNum(pxStr) +{ // pxStr == 27px, we want 27. + if (pxStr.length > 2) { + n = Number(pxStr.substr(0, pxStr.length-2)); + return(n); + } + return(0); +} + +function hideChildMenu(hcmLayer) +{ + FW_clearTimeout(); + var l = hcmLayer; + for (var i = 0; i < l.Menu.childMenus.length; i++) + { + var theLayer = l.Menu.childMenus[i]; + if (document.layers) + { + theLayer.visibility = "hidden"; + } + else + { + theLayer = FIND(theLayer,'method "hideChildMenu" (1st for cycle)'); + theLayer.style.visibility = "hidden"; + } + theLayer.Menu.hideChildMenu(theLayer); + } + + if (l.childMenu) { + var childMenu = l.childMenu; + if (document.layers) { + l.Menu.FW_showMenu(null,null,null,childMenu.layers[0]); + childMenu.zIndex = l.parentLayer.zIndex +1; + childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top + l.Menu.menuItemHeight/3; + if (childMenu.left + childMenu.clip.width > window.innerWidth) { + childMenu.left = l.parentLayer.left - childMenu.clip.width + l.Menu.menuLayer.left + 15; + l.Menu.container.clip.left -= childMenu.clip.width; + } else { + childMenu.left = l.parentLayer.left + l.parentLayer.clip.width + l.Menu.menuLayer.left -5; + } + var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left; + if (w > l.Menu.container.clip.width) + l.Menu.container.clip.width = w; + var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top; + if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h; + l.document.layers[1].zIndex = 0; + childMenu.visibility = "inherit"; + } else if (FIND("menuItem0")) { + childMenu = FIND(l.childMenu,'method "hideChildMenu" (menuItem0 childmenu finding)'); + var menuLayer = FIND(l.Menu.menuLayer,'method "hideChildMenu" (menuItem0 layer finding)'); + var s = childMenu.style; + s.zIndex = menuLayer.style.zIndex+1; + if (document.all) { // ie case. + s.pixelTop = l.style.pixelTop + menuLayer.style.pixelTop + l.Menu.menuItemHeight/3; + left = s.pixelLeft = (menuLayer.style.pixelWidth) + menuLayer.style.pixelLeft -5; +// alert(left + parseInt(s.width) - document.body.scrollLeft) + if (left + parseInt(s.width) > document.body.scrollLeft + document.body.offsetWidth) + left -= parseInt(s.width) + l.offsetWidth - 5; + s.left = left; + + + } else { // zilla case + var top = PxToNum(l.style.top) + PxToNum(menuLayer.style.top) + l.Menu.menuItemHeight/3; + var left = (PxToNum(menuLayer.style.width)) + PxToNum(menuLayer.style.left) -5; + s.top = top; +// alert() + if (left + parseInt(s.width) > document.body.offsetWidth) + left -= parseInt(s.width) + l.offsetWidth - 5; + s.left = left; + } + childMenu.style.visibility = "inherit"; + } else { + return; + } + window.activeMenus[window.activeMenus.length] = childMenu; + } +} + +function hideActiveMenus() { + if (!window.activeMenus) return; + for (var i=0; i < window.activeMenus.length; i++) { + if (!activeMenus[i]) continue; + if (activeMenus[i].visibility && activeMenus[i].Menu) { + activeMenus[i].visibility = "hidden"; + activeMenus[i].Menu.container.visibility = "hidden"; + activeMenus[i].Menu.container.clip.left = 0; + } else if (activeMenus[i].style) { + var s = activeMenus[i].style; + s.visibility = "hidden"; + s.left = -200; + s.top = -200; + } + } + if (window.ActiveMenuItem) { + hideMenu(false, false); + } + window.activeMenus.length = 0; +} + + Index: trunk/kernel/admin_templates/img/icons/icon46_list_settings_custom.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/tabs.js =================================================================== diff -u --- trunk/kernel/admin_templates/incs/tabs.js (revision 0) +++ trunk/kernel/admin_templates/incs/tabs.js (revision 1566) @@ -0,0 +1,221 @@ +function Tab(tab_name, active_class, inactive_class, grid, a_toolbar, initial_state) +{ + this.TabName = tab_name; + this.hidden = false; + + this.Grid = grid; + this.ToolBar = a_toolbar; + + this.ActiveClass = active_class; + this.InactiveClass = inactive_class; + + this.InitialState = initial_state; + + this.curTop = 0; + + this.dX = 0; + this.dY = 0; + this.targetX = 0; + this.targetY = 0; +} + +Tab.prototype.Init = function () +{ + this.Handle = document.getElementById(this.TabName+'_tab'); + this.Divider = document.getElementById(this.TabName+'_tab_divider'); + this.Content = document.getElementById(this.TabName+'_tab_content'); + this.Handle.Tab = this; + + this.Container = document.createElement('DIV'); + this.Container.style.padding = '0'; + //this.Container.style.position = 'relative'; + this.Container.style.overflow = 'hidden'; + //alert(this.Content.tagName); + this.Content.parentNode.insertBefore(this.Container, this.Content); + + this.Content.style.overflow = 'hidden'; + //this.Content.style.position = 'relative'; + + var ContentClone = this.Content.cloneNode(true); + this.Content.parentNode.removeChild(this.Content); + this.Container.appendChild(ContentClone); + this.Content = ContentClone; + + this.OriginalHeight = this.Container.offsetHeight; + + this.StateField = document.createElement('INPUT'); + this.StateField.name = this.TabName+'_tab_state'; + this.StateField.type = 'hidden'; + this.StateField.value = this.InitialState; + document.kernel_form.appendChild(this.StateField); + + //alert(this.TabName + ' initial '+ this.InitialState); + if (this.InitialState == '0') { + this.Hide(1); + } + + this.Handle.onclick = function() { + this.Tab.Click(); + }; +} + +Tab.prototype.Click = function () +{ + if (this.hidden) + this.Show(); + else + this.Hide(); +} + +Tab.prototype.Show = function (effect) +{ + if (typeof(effect) == 'undefined') effect = true; + this.Container.style.display = ''; + if (effect) { + this.Roll(0, 10, 0, 0); + } + this.hidden = false; + this.Handle.className = this.ActiveClass; + this.Divider.src = 'img/itemtabs/divider_up.gif' + this.CheckDependencies(); + this.StateField.value = 1; +} + +Tab.prototype.Hide = function (no_effect) +{ + this.Grid.ClearSelection(null,'Tab.Hide'); + window.scrollTo(window.scrollLeft, 0); + this.Content.style.position = 'relative'; + if (typeof(no_effect) == 'undefined') effect = true; + else { + this.Content.style.posTop = -this.Container.offsetHeight; + this.curTop = -this.Container.offsetHeight; + this.Container.style.height = 1; + this.Container.style.display = 'none'; + effect = false; + } + if (effect) this.Roll(0, -10, 0, 0); + //this.Content.style.display = 'none'; + this.hidden = true; + this.Handle.className = this.InactiveClass; + this.Divider.src = 'img/itemtabs/divider_empty.gif' + this.CheckDependencies(); + this.StateField.value = 0; +} + +Tab.prototype.Roll = function (dX, dY, targetX, targetY) +{ + var tab = this; + this.dX = dX; + this.dY = dY; + this.targetX = targetX; + this.targetY = targetY; + + this.i = 0; + + function DoRoll() + { + if (tab.dX != 0) { + tab.Content.offsetWidth += tab.dX; + } + if (tab.dY != 0) { + //if ( confirm (' top '+tab.Content.offsetTop + ' height '+tab.Container.offsetHeight) ) return; + + //tab.Content.style.pixelTop = tab.curTop; + if (tab.Container.offsetHeight + dY > 0) { + + if ((tab.Container.offsetHeight + dY >= tab.OriginalHeight)) { + tab.Container.style.height = tab.OriginalHeight; + tab.Content.style.posTop = 0; + } + else { + tab.curTop += dY; + tab.Content.style.posTop = tab.curTop; + tab.Container.style.height = tab.Container.offsetHeight + dY; + } + } + else { + tab.Container.style.height = 1; + } + } + + xRes = 1; + if (tab.dX != 0) { + xRes = tab.dX > 0 ? tab.Content.offsetWidth >= tab.targetX : tab.Content.offsetWidth <= tab.targetX; + } + yRes = 1; + if (tab.dY != 0) { + yRes = tab.dY > 0 ? tab.Container.offsetHeight >= tab.OriginalHeight : tab.Container.offsetHeight <= 1; + } + + if (!xRes || !yRes) { + tab.i++; + if (tab.i < 500) { + setTimeout(DoRoll, 0) + } + } + else { + if (tab.Container.offsetHeight <= 1) tab.Container.style.display = 'none'; + if (tab.Container.offsetHeight >= tab.OriginalHeight) tab.Content.style.position = 'static'; + } + } + setTimeout(DoRoll, 0) +} + +function showCategories() +{ + var container = document.getElementById("firstContainer"); + var categories = document.getElementById("categories"); + var scrollJumpA = scrollJump; + if (!categories.startTime) + { + categories.startTime = new Date(); + + } + else + { + var cDate = new Date(); + if (cDate - categories.startTime >= animationTimeout) scrollJumpA = categories.offsetHeight; + //ert(animationTimeout); + } + (categories.active) ? container.pY += scrollJumpA : container.pY -= scrollJumpA; + if (container.pY < container.pTop - categories.offsetHeight) + container.pY = container.pTop - categories.offsetHeight; + + if (container.pY > container.pTop) + container.pY = container.pTop; + + container.style.top = container.pY; + if (((Math.abs(container.pY) <= categories.offsetHeight + container.pTop) && (!categories.active)) || ((container.pY < container.pTop) && (categories.active))) + setTimeout("showCategories()", 0) + else + { + unselectAll("categories"); + if (categories.active) + { + var devider = document.getElementById("categoriesDevider"); + //devider.style.display = "none"; + } + categories.startTime = null; + } +} + +Tab.prototype.SetDependantToolbarButtons = function( buttons ) +{ + this.DependantButtons = buttons; + this.CheckDependencies(); +} + +Tab.prototype.CheckDependencies = function() +{ + if (this.hidden) { + for (var i in this.DependantButtons) { + this.ToolBar.HideButton(this.DependantButtons[i]); + } + } + else { + for (var i in this.DependantButtons) { + this.ToolBar.ShowButton(this.DependantButtons[i]); + } + } +} Index: trunk/kernel/admin_templates/img/toolbar/tool_recalculate_order_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemtabs/divider_up.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/smicon4.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_deny.gif =================================================================== diff -u Binary files differ Index: trunk/admin/install.php =================================================================== diff -u -r1510 -r1566 --- trunk/admin/install.php (.../install.php) (revision 1510) +++ trunk/admin/install.php (.../install.php) (revision 1566) @@ -464,30 +464,30 @@ $inst_error = "Your license must be updated before you can upgrade. Please don't use 'Existing License' option, instead either Download from Intechnic or Upload a new license file!"; } else { - $sql = "SELECT Name, Version FROM ".$g_TablePrefix."Modules ORDER BY LoadOrder asc"; + $sql = "SELECT Name, Version, Path FROM ".$g_TablePrefix."Modules ORDER BY LoadOrder asc"; $rs = $ado->Execute($sql); $i = 0; while ($rs && !$rs->EOF) { - $p = strtolower($rs->fields['Name']); + $p = $rs->fields['Path']; - if ($p == 'in-portal') { + if ($rs->fields['Name'] == 'In-Portal') { $p = ''; } - $dir_name = $pathtoroot.$p."/admin";///install/upgrades/"; + $dir_name = $pathtoroot.$p."admin";///install/upgrades/"; - if($rs->fields['Version']!=$newver=GetMaxPortalVersion($dir_name)) + if($rs->fields['Version'] != $newver = GetMaxPortalVersion($dir_name)) { //////////////////// - $mod_name = strtolower($rs->fields['Name']); + $mod_path = $rs->fields['Path']; $current_version = $rs->fields['Version']; - if ($mod_name == 'in-portal')$mod_name = ''; + if ($rs->fields['Name'] == 'In-Portal') $mod_path = ''; - $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; + $dir_name = $pathtoroot.$mod_path."/admin/install/upgrades/"; $dir = @dir($dir_name); $upgrades_arr = Array(); @@ -513,7 +513,7 @@ $file_tmp = str_replace(".php", "", $file_tmp); if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { - $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + $filename = $pathtoroot.$mod_path."/admin/install/upgrades/$file"; if(file_exists($filename)) { include($filename); @@ -586,16 +586,19 @@ { $mod_name = strtolower($p); - $sql = "SELECT Version FROM ".$g_TablePrefix."Modules WHERE Name = '$p'"; + $sql = "SELECT Version, Path FROM ".$g_TablePrefix."Modules WHERE Name = '$p'"; $rs = $ado->Execute($sql); $current_version = $rs->fields['Version']; if ($mod_name == 'in-portal') { - $mod_name = ''; + $mod_path = ''; } + else { + $mod_path = $rs->fields['Path']; + } - $dir_name = $pathtoroot.$mod_name."/admin/install/upgrades/"; + $dir_name = $pathtoroot.$mod_path."/admin/install/upgrades/"; $dir = @dir($dir_name); $upgrades_arr = Array(); @@ -616,7 +619,7 @@ $file_tmp = str_replace(".sql", "", $file_tmp); if (ConvertVersion($file_tmp) > ConvertVersion($current_version)) { - $filename = $pathtoroot.$mod_name."/admin/install/upgrades/$file"; + $filename = $pathtoroot.$mod_path."/admin/install/upgrades/$file"; //echo "Running: $filename
"; if(file_exists($filename)) { @@ -625,7 +628,7 @@ } } - set_ini_value("Module Versions", $p, GetMaxPortalVersion($pathtoroot.$mod_name."/admin/")); + set_ini_value("Module Versions", $p, GetMaxPortalVersion($pathtoroot.$mod_path."/admin/")); save_values(); } @@ -1028,6 +1031,8 @@ $dir = @dir($dir_name); //echo "
"; print_r($dir); echo "
"; + if ($dir === false) continue; + while ($file = $dir->read()) { if ($file != "." && $file != ".." && !is_dir($dir_name.$file)) { Index: trunk/kernel/admin_templates/img/icons/icon46_users_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/usersession.php =================================================================== diff -u -r1462 -r1566 --- trunk/kernel/include/usersession.php (.../usersession.php) (revision 1462) +++ trunk/kernel/include/usersession.php (.../usersession.php) (revision 1566) @@ -44,7 +44,7 @@ if( !isset($_SERVER['HTTP_REFERER']) ) $_SERVER['HTTP_REFERER'] = ''; if(!isset($_GET['destform'])) $_GET['destform'] = null; if(!isset($_GET['continue_sess'])) $_GET['continue_sess'] = null; - if( strlen($id) && (strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path")) || $_GET['destform'] == 'popup' || $_GET['continue_sess'] == 1)) + if( strlen($id) && (strstr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'].$objConfig->Get("Site_Path")) || (defined('IS_POPUP') && IS_POPUP) || $_GET['destform'] == 'popup' || $_GET['continue_sess'] == 1)) { $this->Set("SessionKey",$id); return $this->LoadFromDatabase($id); @@ -431,38 +431,40 @@ } else { - // logging in any user (admin & front) - $pre = GetTablePrefix(); - $sql = "SELECT *,MD5(".$pre."PortalUser.Password) as md5pw FROM ".$pre."PortalUser LEFT JOIN ".$pre."UserGroup USING (PortalUserId) " - ."LEFT JOIN ".$pre."PortalGroup ON (".$pre."UserGroup.GroupId=".$pre."PortalGroup.GroupId) - WHERE - ".$pre."PortalUser.Login='$userLogin' AND ".$pre."PortalUser.Status=1 - AND (".$pre."PortalUser.Password='$userPassword' OR MD5(".$pre."PortalUser.Password)='$userPassword' OR ".$pre."PortalUser.Password='".md5($userPassword)."') - ORDER BY ".$pre."UserGroup.PrimaryGroup DESC, ".$pre."PortalGroup.Personal DESC"; -//echo $sql."
\n"; - $result = $this->adodbConnection->Execute($sql); + // logging in any user (admin & front) + $db =& $this->adodbConnection; + $prefix = GetTablePrefix(); - if ($result === false) - { - $this->m_Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Login"); - return false; - } - - if($result->EOF) return -1; // no any user with username & pass specified + $key_clause = $objConfig->Get('Email_As_Login') ? 'pu.Email = %1$s' : 'pu.Login = %1$s'; + + $sql = 'SELECT *, MD5(pu.Password) AS md5pw + FROM '.$prefix.'PortalUser pu + LEFT JOIN '.$prefix.'UserGroup ug USING (PortalUserId) + LEFT JOIN '.$prefix.'PortalGroup pg ON ug.GroupId = pg.GroupId + WHERE ('.$key_clause.') AND (pu.Status = 1) AND (pu.Password = %2$s OR MD5(pu.Password) = %2$s OR pu.Password = MD5(%1$s) ) + ORDER BY ug.PrimaryGroup DESC, pg.Personal DESC'; + + $result = $db->Execute( sprintf($sql, $db->qstr($userLogin), $db->qstr($userPassword) ) ); + + if($result === false) + { + $this->m_Errors->AddError('error.DatabaseError',NULL,$this->adodbConnection->ErrorMsg(),'',get_class($this),'Login'); + return false; + } + + if($result->EOF) return -1; // no any user with username & pass specified } - if(!strlen($this->GetSessionKey())) - { - $this->GetNewSession(); - } + if( !strlen($this->GetSessionKey()) ) $this->GetNewSession(); + $this->Set("PortalUserId", $result->fields["PortalUserId"]); - // unset($this->CurrentUser); - $this->CurrentUser=null; - if(strlen($result->fields["tz"])>0) - $this->Set("tz",$result->fields["tz"]); - $PrimaryGroup=0; - $PersonalGroup=0; - $GroupList = array(); + // unset($this->CurrentUser); + $this->CurrentUser = null; + if( strlen($result->fields['tz']) > 0 ) $this->Set('tz',$result->fields['tz']); + $PrimaryGroup = 0; + $PersonalGroup = 0; + $GroupList = Array(); + while($result && !$result->EOF) { $skipadd=0; @@ -520,14 +522,16 @@ { global $objConfig; - $this->Set("PortalUserId", 0); + $this->Set("PortalUserId", 0); // not logged-in + $this->Set('LastAccessed',0); // session become expired $this->Set("GroupId", $objConfig->Get("User_GuestGroup")); #$this->SetPersistantVariable("LastLogin", time()); $this->Set("GroupList",$objConfig->Get("User_GuestGroup")); $this->Set("IpAddress",$_SERVER['REMOTE_ADDR']); + $this->DeleteSessionData($this->GetSessionKey()); $this->Update(); - $this->Delete(); + //$this->Delete(); $this->ResetSysPermCache(); $this->PermCache = array(); } @@ -634,7 +638,9 @@ } if(!is_object($this->CurrentUser)) + { $this->CurrentUser = $objUsers->GetItem($this->Get("PortalUserId")); + } if(!$this->CurrentUser->VarsLoaded) { $this->CurrentUser->LoadPersistantVars(); @@ -681,53 +687,43 @@ function DeleteEditTables() { - $tables = $this->adodbConnection->MetaTables(); - $sql = "SHOW TABLES"; - //echo "
";print_r($tables); echo "
"; - for($i=0;$i0) - { - $key = "AD".strtoupper(substr($t,strlen($p),strpos($t,"FD_")-strlen($p)))."FD"; - $sql = "SELECT * FROM ".GetTablePrefix()."UserSession WHERE SessionKey='$key'"; - //echo $sql."
\n"; - $rs = $this->adodbConnection->Execute($sql); - if(!$rs || $rs->EOF) - { - //echo "Dropping Table $tables[$i]
\n"; - @$this->adodbConnection->Execute("DROP TABLE IF EXISTS ".$tables[$i]); - } - } - } + $tables = $this->adodbConnection->MetaTables(); + $mask = '/'.GetTablePrefix().'ses_(.*)_edit_(.*)/'; + $sql='SELECT COUNT(*) FROM '.GetTablePrefix().'UserSession WHERE SessionKey = \'%s\''; + foreach($tables as $table) + { + if( preg_match($mask,$table,$rets) ) + { + $sid=$rets[1]; + $is_alive = $this->adodbConnection->GetOne( sprintf($sql,$sid) ); + if(!$is_alive) @$this->adodbConnection->Execute('DROP TABLE IF EXISTS '.$table); + } + } } function DeleteExpiredSessions() { - global $objConfig; + global $objConfig; $cutoff = time()-$objConfig->Get("SessionTimeout"); $thiskey = $this->GetSessionKey(); $sql = "SELECT SessionKey from ".GetTablePrefix()."UserSession WHERE LastAccessed<$cutoff AND SessionKey != '$thiskey'"; $result = $this->adodbConnection->Execute($sql); - $keys = array(); - while ($result && !$result->EOF) - { - $keys[] = "SessionKey='" . $result->fields["SessionKey"] . "'"; - $result->MoveNext(); + $keys = array(); + while ($result && !$result->EOF) + { + $keys[] = "SessionKey='" . $result->fields["SessionKey"] . "'"; + $result->MoveNext(); } - if(count($keys)>0) - { - $keywhere = implode(" OR ", $keys); - $sql = "DELETE FROM ".GetTablePrefix()."SessionData WHERE $keywhere"; - //echo $sql; - $this->adodbConnection->Execute($sql); - $this->adodbConnection->Execute("DELETE FROM ".GetTablePrefix()."UserSession WHERE LastAccessed<$cutoff"); - $this->DeleteEditTables(); - } + if(count($keys)>0) + { + $keywhere = implode(" OR ", $keys); + $sql = "DELETE FROM ".GetTablePrefix()."SessionData WHERE $keywhere"; + //echo $sql; + $this->adodbConnection->Execute($sql); + $this->adodbConnection->Execute("DELETE FROM ".GetTablePrefix()."UserSession WHERE LastAccessed<$cutoff"); + $this->DeleteEditTables(); + } } function SetSysPermCache() Index: trunk/kernel/units/users/users_event_handler.php =================================================================== diff -u --- trunk/kernel/units/users/users_event_handler.php (revision 0) +++ trunk/kernel/units/users/users_event_handler.php (revision 1566) @@ -0,0 +1,591 @@ +Application->setUnitOption($event->Prefix, 'AutoLoad', false); + $object =& $this->Application->recallObject('u'); + + $password = $this->Application->GetVar('password'); + if(!$password) + { + $object->SetError('ValidateLogin', 'blank_password', 'lu_blank_password'); + $event->status = erFAIL; + return false; + } + + $email_as_login = $this->Application->ConfigValue('Email_As_Login'); + list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login'); + $login_value = $this->Application->GetVar($submit_field); + + $sql = 'SELECT PortalUserId FROM '.$object->TableName.' WHERE (%s = %s) AND (Password = MD5(%s))'; + $user_id = $this->Conn->GetOne( sprintf($sql, $login_field, $this->Conn->qstr($login_value), $this->Conn->qstr($password) ) ); + + if($user_id) + { + $object->Load($user_id); + if( $object->GetDBField('Status') == STATUS_ACTIVE ) + { + $session =& $this->Application->recallObject('Session'); + $session->SetField('PortalUserId', $user_id); + $this->Application->SetVar('u_id', $user_id); + $this->Application->StoreVar('user_id', $user_id); + + $sql = 'SELECT DISTINCT GroupId FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId = '.$user_id; + if( $groups = $this->Conn->GetCol($sql) ) + { + $this->Application->StoreVar( 'UserGroups', implode(',', $groups) ); + } + + $next_template = $this->Application->GetVar('next_template'); + if($next_template) $event->redirect = $next_template; + } + else + { + $event->redirect = $this->Application->GetVar('pending_disabled_template'); + } + } + else + { + $object->SetError('ValidateLogin', 'invalid_password', 'lu_invalid_password'); + $event->status = erFAIL; + } + } + + function OnLogout(&$event) + { + $session =& $this->Application->recallObject('Session'); + $session->SetField('PortalUserId', -2); + $this->Application->SetVar('u_id', -2); + $this->Application->StoreVar('user_id', -2); + $object =& $this->Application->recallObject('u'); + $object->Load(-2); + + $this->Application->DestroySession(); + } + + /** + * Prefill states dropdown with correct values + * + * @param kEvent $event + * @access public + */ + function OnPrepareStates(&$event) + { + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->PopulateStates($event, 'State', 'Country'); + + $object =& $event->getObject(); + + if( $cs_helper->CountryHasStates( $object->GetDBField('Country') ) ) $object->Fields['State']['required'] = true; + + if( $this->Application->ConfigValue('Email_As_Login') ) + { + $object->SetDBField('Login', $object->GetDBField('Email') ); + } + } + + /** + * Redirects user after succesfull registration to confirmation template (on Front only) + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + $is_subscriber = $this->Application->GetVar('IsSubscriber'); + if (!$is_subscriber){ + + $object =& $event->getObject(); + $group_id = $this->Application->ConfigValue('User_NewGroup'); + + $sql = 'INSERT INTO '.TABLE_PREFIX.'UserGroup(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,1)'; + $this->Conn->Query( sprintf($sql, $object->GetID(), $group_id) ); + + } + } + + /** + * Login user if possible, if not then redirect to corresponding template + * + * @param kEvent $event + */ + function autoLoginUser(&$event) + { + $object =& $event->getObject(); + $this->Application->SetVar('u_id', $object->GetID() ); + + if($object->GetDBField('Status') == STATUS_ACTIVE) + { + $email_as_login = $this->Application->ConfigValue('Email_As_Login'); + list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login'); + + $this->Application->SetVar($submit_field, $object->GetDBField($login_field) ); + $this->Application->SetVar('password', $object->GetDBField('Password_plain') ); + + $event->CallSubEvent('OnLogin'); + } + } + + /** + * Creates new user + * + * @param kEvent $event + */ + function OnCreate(&$event) + { + if( !$this->Application->IsAdmin() ) $this->setUserStatus($event); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->CheckStateField($event, 'State', 'Country'); + + parent::OnCreate($event); + + $this->setNextTemplate($event); + + if( !$this->Application->IsAdmin() && ($event->status == erSUCCESS) && $event->redirect) $this->autoLoginUser($event); + } + + /** + * Set's new user status based on config options + * + * @param kEvent $event + */ + function setUserStatus(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $new_users_allowed = $this->Application->ConfigValue('User_Allow_New'); + // 1 - Instant, 2 - Not Allowed, 3 - Pending + + switch ($new_users_allowed) + { + case 1: // Instant + $object->SetDBField('Status', 1); + $event->redirect = $this->Application->GetVar('registration_confirm_template'); + break; + + case 3: // Pending + $event->redirect = $this->Application->GetVar('registration_confirm_pending_template'); + $object->SetDBField('Status', 2); + break; + + case 2: // Not Allowed + $object->SetDBField('Status', 0); + break; + } + } + + /** + * Set's new unique resource id to user + * + * @param kEvent $event + */ + function OnAfterItemValidate(&$event) + { + $object =& $event->getObject(); + $object->SetDBField('ResourceId', $this->Application->NextResourceId() ); + } + + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnRecommend(&$event){ + + $friend_email = $this->Application->GetVar('friend_email'); + $friend_name = $this->Application->GetVar('friend_email'); + + if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $friend_email)) + { + + $send_params = array(); + $send_params['to_email']=$friend_email; + $send_params['to_name']=$friend_name; + + $user_id = $this->Application->GetVar('u_id'); + $email_event = &$this->Application->EmailEventUser('SITE.SUGGEST', $user_id, $send_params); + if ($email_event->status == erSUCCESS){ + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = $this->Application->GetVar('template_success'); + } + else { +// $event->redirect_params = array('opener' => 's', 'pass' => 'all'); +// $event->redirect = $this->Application->GetVar('template_fail'); + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['send_error'] = $this->Application->Phrase('lu_email_send_error'); + $object->FieldErrors['Email']['pseudo'] = 'send_error'; + $event->status = erFAIL; + + } + } + else { + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); + $object->FieldErrors['Email']['pseudo'] = 'invalid_email'; + $event->status = erFAIL; + } + + + } + + /** + * Saves address changes and mades no redirect + * + * @param kEvent $event + */ + function OnUpdateAddress(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id,$field_values) = each($items_info); + if($id > 0) $object->Load($id); + $object->SetFieldsFromHash($field_values); + $object->setID($id); + $object->Validate(); + } + + $event->redirect = false; + } + + function OnSubscribeQuery(&$event){ + + $user_email = $this->Application->GetVar('subscriber_email'); + if ( eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $user_email) ){ + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object = &$this->Application->recallObject($this->Prefix.'.subscriber'); + + $this->Application->StoreVar('SubscriberEmail', $user_email); + + if( $object->Load(array('Email'=>$user_email)) ){ + $group_info = $this->GetGroupInfo($object->GetID()); + if($group_info){ + $event->redirect = $this->Application->GetVar('unsubscribe_template'); + } + else { + $event->redirect = $this->Application->GetVar('subscribe_template'); + } + } + else { + $event->redirect = $this->Application->GetVar('subscribe_template'); + $this->Application->StoreVar('SubscriberEmail', $user_email); + } + + } + else { + + $object =& $this->Application->recallObject('u'); + $object->ErrorMsgs['invalid_email'] = $this->Application->Phrase('lu_InvalidEmail'); + $object->FieldErrors['SubscribeEmail']['pseudo'] = 'invalid_email'; + $event->status = erFAIL; + + } + + + //subscribe_query_ok_template + } + + function OnSubscribeUser(&$event){ + + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object = &$this->Application->recallObject($this->Prefix.'.subscriber'); + + $user_email = $this->Application->RecallVar('SubscriberEmail'); + + if (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $user_email)){ + + if($object->Load(array('Email'=>$user_email))){ + + $group_info = $this->GetGroupInfo($object->GetID()); + + if ($group_info){ + if ($group_info['PrimaryGroup']){ + // delete user + $object->Delete(); + } + else { + $this->RemoveSubscriberGroup($object->GetID()); + } + + $event->redirect = $this->Application->GetVar('unsubscribe_ok_template'); + + } + else { + $this->AddSubscriberGroup($object->GetID(), 0); + $event->redirect = $this->Application->GetVar('subscribe_ok_template'); + } + + + } + else { + + $object->SetField('Email', $user_email); + $object->SetField('Login', $user_email); + $object->SetDBField('dob_date', 1); + $object->SetDBField('dob_time', 1); + $ip = getenv('HTTP_X_FORWARDED_FOR')?getenv('HTTP_X_FORWARDED_FOR'):getenv('REMOTE_ADDR'); + $object->SetDBField('ip', $ip); + + $this->Application->SetVar('IsSubscriber', 1); + + if ($object->Create()) { + + $this->AddSubscriberGroup($object->GetID(), 1); + $event->redirect = $this->Application->GetVar('subscribe_ok_template'); + } + + $this->Application->SetVar('IsSubscriber', 0); + } + } + else { + // error handling here + $event->redirect = $this->Application->GetVar('subscribe_fail_template'); + } + + + } + + function AddSubscriberGroup($user_id, $is_primary){ + + $group_id = $this->Application->ConfigValue('User_SubscriberGroup'); + $sql = 'INSERT INTO '.TABLE_PREFIX.'UserGroup(PortalUserId,GroupId,PrimaryGroup) VALUES (%s,%s,'.$is_primary.')'; + $this->Conn->Query( sprintf($sql, $user_id, $group_id) ); + + } + + function RemoveSubscriberGroup($user_id){ + + $group_id = $this->Application->ConfigValue('User_SubscriberGroup'); + $sql = 'DELETE FROM '.TABLE_PREFIX.'UserGroup WHERE PortalUserId='.$user_id.' AND GroupId='.$this->Application->ConfigValue('User_SubscriberGroup'); + $this->Conn->Query($sql); + + } + + function GetGroupInfo($user_id){ + + $group_info = $this->Conn->GetRow('SELECT * FROM '.TABLE_PREFIX.'UserGroup + WHERE PortalUserId='.$user_id.' + AND GroupId='.$this->Application->ConfigValue('User_SubscriberGroup')); + return $group_info; + + } + + function OnForgotPassword(&$event){ + + $this->Application->setUnitOption('u', 'AutoLoad', false); + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + $username = $this->Application->GetVar('username'); + $email = $this->Application->GetVar('email'); + $found = false; + $allow_reset = true; + + if( strlen($username) ) + { + if( $user_object->Load(array('Login'=>$username)) ) + $found = ($user_object->GetDBField("Login")==$username && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } + else if( strlen($email) ) + { + if( $user_object->Load(array('Email'=>$email)) ) + $found = ($user_object->GetDBField("Email")==$email && $user_object->GetDBField("Status")==1) && strlen($user_object->GetDBField("Password")); + } + + if($user_object->Loaded) + { + $PwResetConfirm = $user_object->GetDBField('PwResetConfirm'); + $PwRequestTime = $user_object->GetDBField('PwRequestTime'); + $PassResetTime = $user_object->GetDBField('PassResetTime'); + //$MinPwResetDelay = $user_object->GetDBField('MinPwResetDelay'); + $MinPwResetDelay = $this->Application->ConfigValue('Users_AllowReset'); + + $allow_reset = (strlen($PwResetConfirm) ? + mktime() > $PwRequestTime + $MinPwResetDelay : + mktime() > $PassResetTime + $MinPwResetDelay); + } + + if($found && $allow_reset) + { + $this->Application->StoreVar('tmp_user_id', $user_object->GetDBField("PortalUserId")); + $this->Application->StoreVar('tmp_email', $user_object->GetDBField("Email")); + + $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + + $event->redirect = $this->Application->GetVar('template_success'); + + } + else + { + if(!strlen($username) && !strlen($email)) + { + $user_current_object->ErrorMsgs['forgotpw_nodata'] = $this->Application->Phrase('lu_ferror_forgotpw_nodata'); + $user_current_object->FieldErrors['Login']['pseudo'] = 'lu_ferror_forgotpw_nodata'; + } + else + { + + if($allow_reset) + { + if( strlen($username) ){ + $user_current_object->ErrorMsgs['unknown_username'] = $this->Application->Phrase('lu_ferror_unknown_username'); + $user_current_object->FieldErrors['Login']['pseudo']='unknown_username'; + } + if( strlen($email) ){ + $user_current_object->ErrorMsgs['unknown_email'] = $this->Application->Phrase('lu_ferror_unknown_email'); + $user_current_object->FieldErrors['Email']['pseudo']='unknown_email'; + } + } + else + { + $user_current_object->ErrorMsgs['reset_denied'] = $this->Application->Phrase('lu_ferror_reset_denied'); + if( strlen($username) ){ + $user_current_object->FieldErrors['Login']['pseudo']='reset_denied'; + } + if( strlen($email) ){ + $user_current_object->FieldErrors['Email']['pseudo']='reset_denied'; + } + } + + } + + if($user_current_object->FieldErrors){ + $event->redirect = false; + } + } + + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnResetPassword(&$event){ + + $user_object = &$this->Application->recallObject('u.forgot'); + + if($user_object->Load($this->Application->RecallVar('tmp_user_id'))){ + + $this->Application->EmailEventUser('INCOMMERCEUSER.PSWDC', $user_object->GetDBField("PortalUserId")); + $event->redirect = $this->Application->GetVar('template_success'); + + $mod_object =& $this->Application->recallObject('mod.'.'In-Commerce'); + $m_cat_id = $mod_object->GetDBField('RootCat'); + $event->SetRedirectParam('pass', 'm'); + //$event->SetRedirectParam('m_cat_id', $m_cat_id); + $this->Application->SetVar('m_cat_id', $m_cat_id); + + + } + + } + + function OnResetPasswordConfirmed(&$event){ + + $passed_key = $this->Application->GetVar('user_key'); + + $user_object = &$this->Application->recallObject('u.forgot'); + $user_current_object = &$this->Application->recallObject('u'); + + if (strlen(trim($passed_key)) == 0) { + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = false; + + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + } + + + if($user_object->Load(array('PwResetConfirm'=>$passed_key))) + { + $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; + $user_object->SetDBField("PwResetConfirm", ''); + $user_object->SetDBField("PwRequestTime", 0); + if ($exp_time > mktime()) + { + //$m_var_list_update['codevalidationresult'] = 'lu_resetpw_confirm_text'; + $newpw = makepassword4(); + + $this->Application->StoreVar('password', $newpw); + + $user_object->SetDBField("Password",$newpw); + $user_object->SetDBField("PassResetTime", time()); + $user_object->SetDBField("PwResetConfirm", ''); + $user_object->SetDBField("PwRequestTime", 0); + $user_object->Update(); + + $this->Application->SetVar('ForgottenPassword', $newpw); + + $email_event_user = &$this->Application->EmailEventUser('INCOMMERCEUSER.PSWD', $user_object->GetDBField('PortalUserId')); + $email_event_admin = &$this->Application->EmailEventAdmin('INCOMMERCEUSER.PSWD'); + + $this->Application->DeleteVar('ForgottenPassword'); + + if ($email_event_user->status == erSUCCESS){ + $event->redirect_params = array('opener' => 's', 'pass' => 'all'); + $event->redirect = $this->Application->GetVar('template_success'); + } + + $user_object->SetDBField("Password",md5($newpw)); + $user_object->Update(); + + } else { + $user_current_object->ErrorMsgs['code_expired'] = $this->Application->Phrase('lu_code_expired'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_expired'; + $event->redirect = false; + + } + } else { + $user_current_object->ErrorMsgs['code_is_not_valid'] = $this->Application->Phrase('lu_code_is_not_valid'); + $user_current_object->FieldErrors['PwResetConfirm']['pseudo'] = 'code_is_not_valid'; + $event->redirect = false; + + } + } + + function OnUpdate(&$event) + { + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + $cs_helper->CheckStateField($event, 'State', 'Country'); + + parent::OnUpdate($event); + + $this->setNextTemplate($event); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function setNextTemplate(&$event) + { + if( !$this->Application->IsAdmin() ) + { + $event->redirect_params['opener'] = 's'; + $object =& $event->getObject(); + if($object->GetDBField('Status') == STATUS_ACTIVE) + { + $next_template = $this->Application->GetVar('next_template'); + if($next_template) $event->redirect = $next_template; + } + } + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_preview_theme_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_infinity_f2.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/general/country_states.php =================================================================== diff -u --- trunk/core/units/general/country_states.php (revision 0) +++ trunk/core/units/general/country_states.php (revision 1566) @@ -0,0 +1,114 @@ +Conn =& $this->Application->GetADODBConnection(); + } + + function CountryHasStates($country_code) + { + return !$country_code ? false : in_array($country_code,$this->CountriesWithStates); + } + + /** + * Prepares states dropdown based on country selected + * + * @param kEvent $event + * @param string $state_field + * @param string $country_field + */ + function PopulateStates(&$event, $state_field, $country_field) + { + $object =& $event->getObject(); + $country_abbr = $object->GetDBField($country_field); + + if (!$country_abbr) return; + $country_id = $this->Conn->GetOne('SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1 AND DestAbbr = '.$this->Conn->qstr($country_abbr)); + if (!$country_id) return; + + $query = + 'SELECT p.Translation as DestName, sd.DestAbbr + FROM '.TABLE_PREFIX.'StdDestinations AS sd + LEFT JOIN '.TABLE_PREFIX.'Phrase AS p + ON p.Phrase = sd.DestName + WHERE + DestType=2 AND DestParentId='.$country_id.' + AND + LanguageId = '.$this->Application->GetVar('m_lang').' + ORDER BY Translation'; + + $states = $this->Conn->GetCol($query, 'DestAbbr'); + $object->Fields[$state_field]['options'] = $states; + $object->Fields[$state_field]['options'][''] = ''; + } + + /** + * Returns valid state code for state name and country code passed + * + * @param string $state_name + * @param string $country_code + * @return string + */ + function CheckState($state_name, $country_code) + { + if( !$this->CountryHasStates($country_code) ) return ''; + + $sql = 'SELECT sdStates.DestAbbr + FROM '.TABLE_PREFIX.'StdDestinations AS sdStates + LEFT JOIN '.TABLE_PREFIX.'Phrase AS p ON p.Phrase = sdStates.DestName + LEFT JOIN '.TABLE_PREFIX.'StdDestinations AS sdCountries ON sdStates.DestParentId = sdCountries.DestId + WHERE (sdStates.DestType = 2) AND + (sdStates.DestParentId = sdCountries.DestId) AND + (p.LanguageId = %1$s) AND + (sdCountries.DestAbbr = %2$s) AND + ( + (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.Translation) = %3$s) + )'; + + $state_name = trim( strtolower($state_name) ); + $sql = sprintf($sql, $this->Application->GetVar('m_lang'), $this->Conn->qstr($country_code), $this->Conn->qstr($state_name) ); + + return $this->Conn->GetOne($sql); + } + + function CheckStateField(&$event, $state_field, $country_field) + { + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id, $field_values) = each($items_info); + if( isset($field_values[$state_field]) && isset($field_values[$country_field]) ) + { + $user_state = getArrayValue($field_values,$state_field); + $valid_state = $this->CheckState($user_state, getArrayValue($field_values,$country_field) ); + if($valid_state !== false) + { + $field_values[$state_field] = $valid_state; + $items_info[$id] = $field_values; + $this->Application->SetVar( $event->getPrefixSpecial(true), $items_info); + } + else + { + $object =& $event->getObject(); + $object->Fields[$state_field]['options'][$user_state] = $user_state; + $object->SetError($state_field, 'invalid_state', 'la_invalid_state'); + } + } + } + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/itemicons/icon16_tax.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_print_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_restart_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_theme_f3.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/adduser.php =================================================================== diff -u -r881 -r1566 --- trunk/admin/users/adduser.php (.../adduser.php) (revision 881) +++ trunk/admin/users/adduser.php (.../adduser.php) (revision 1566) @@ -111,7 +111,10 @@ } else { - $en = GetVar('en'); + $direct_id = GetVar('direct_id'); + if($direct_id) $_POST['itemlist'] = Array($direct_id); + + $en = GetVar('en'); if (isset($_POST["itemlist"])) { $objUsers->CopyToEditTable("ResourceId",$_POST["itemlist"]); @@ -167,11 +170,13 @@ $title = GetTitle("la_Text_User", "la_Text_General", $c->Get('PortalUserId'), $c->Get('Login')); $c->Data=inp_htmlize($c->Data); +$saveURL = $admin."/".$objSession->GetVariable('ReturnScript'); + //Display header $sec = $objSections->GetSection($section); $objCatToolBar = new clsToolBar(); -$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif"); -$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif"); +$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',1);","tool_select.gif"); +$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',2);","tool_cancel.gif"); if ( isset($en_prev) || isset($en_next) ) { Index: trunk/kernel/admin_templates/img/toolbar/tool_entire_order_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/user_select.php =================================================================== diff -u -r927 -r1566 --- trunk/admin/users/user_select.php (.../user_select.php) (revision 927) +++ trunk/admin/users/user_select.php (.../user_select.php) (revision 1566) @@ -13,6 +13,8 @@ ## privileges along maximum prosecution allowed by law. ## ############################################################## +define('IS_POPUP', 1); + if(!strlen($pathtoroot)) { $path=dirname(realpath(__FILE__)); Index: trunk/kernel/admin/include/toolbar/editcategory_relationselect.php =================================================================== diff -u -r1317 -r1566 --- trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (.../editcategory_relationselect.php) (revision 1317) +++ trunk/kernel/admin/include/toolbar/editcategory_relationselect.php (.../editcategory_relationselect.php) (revision 1566) @@ -146,6 +146,7 @@ $lang_SubItems = language("la_Text_Subitems"); $selector = isset($_GET['Selector']) ? '&Selector='.$_GET['Selector'] : ''; +$destform = GetVar('destform'); print << @@ -180,17 +181,19 @@ var hostname = '$rootURL'; var env = '$envar'; var actionlist = new Array(); -var homeURL = "$homeURL$selector"; -var upURL = "$upURL$selector"; +var homeURL = "$homeURL$selector&destform=$destform"; +var upURL = "$upURL$selector&destform=$destform"; var Categories_Paste = false; - function InitPage() - { - addCommonActions(); - initToolbar('mainToolBar', actionHandler); - initCheckBoxes(); - toggleMenu(); - } + function InitPage() + { + var main_form='popup'; + if('$destform') main_form='$destform'; + addCommonActions(main_form); + initToolbar('mainToolBar', actionHandler); + initCheckBoxes(); + //toggleMenu(); + } function AddButtonAction(actionname,actionval) { @@ -214,11 +217,11 @@ } } - function addCommonActions() + function addCommonActions(main_form) { AddButtonAction('upcat',"get_to_server(upURL,'');");// UP AddButtonAction('homecat',"get_to_server(homeURL,'');"); //home - AddButtonAction('select',"check_submit();"); //edit + AddButtonAction('select',"check_submit('"+main_form+"');"); //edit AddButtonAction('stop',"window.close();"); //delete AddButtonAction('view',"toggleMenu(); window.FW_showMenu(window.cat_menu,getRealLeft(button) - ((document.all) ? 6 : -2),getRealTop(button)+32);"); //AddButtonAction('search_a',"setSearchMenu(); window.FW_showMenu(window.SearchMenu,getRealLeft(button)-134 - ((document.all) ? 8 : -1),getRealTop(button)+22);"); @@ -317,10 +320,10 @@ return true; } - function check_submit() + function check_submit(main_form) { var formname = ''; - + if ((activeTab) && (!isAnyChecked('categories'))) { form_name = activeTab.id; @@ -330,11 +333,11 @@ form_name = 'categories'; } var f = document.getElementsByName(form_name+'_form')[0]; - var bf = window.opener.document.getElementById('popup'); - + var bf = window.opener.document.getElementById(main_form); + if(bf) { - if(LastCheckedItem) + if(typeof(LastCheckedItem.value) != 'undefined') { try{ item_id = LastCheckedItem.value; Index: trunk/kernel/admin_templates/img/itemicons/icon16_relation_one-way_disabled.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_rule_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_view.gif =================================================================== diff -u Binary files differ Index: trunk/globals.php =================================================================== diff -u -r1442 -r1566 --- trunk/globals.php (.../globals.php) (revision 1442) +++ trunk/globals.php (.../globals.php) (revision 1566) @@ -1,5 +1,58 @@ \n") { + $resave = true; + } + $ln++; + $line = trim($line); + $line = eregi_replace(';[.]*','',$line); + if(strlen($line) > 0) { + //echo $line . " - "; + if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { + //echo 'section'; + $section = substr($line,1,(strlen($line)-2)); + if ($parse_section) { + $retval[$section] = array(); + } + continue; + } elseif(eregi('=',$line)) { + //echo 'main element'; + list($key,$val) = explode(' = ',$line); + if (!$parse_section) { + $retval[trim($key)] = str_replace('"', '', $val); + } + else { + $retval[$section][trim($key)] = str_replace('"', '', $val); + } + } //end if + //echo '
'; + } //end if + } //end foreach + if ($resave) { + $fp = fopen($file, "w"); + reset($contents); + fwrite($fp,'<'.'?'.'php die() ?'.">\n\n"); + foreach($contents as $line) fwrite($fp,"$line"); + fclose($fp); + } + + return $retval; + } +} + $vars = parse_portal_ini($pathtoroot."config.php"); while($key = key($vars)) @@ -32,58 +85,6 @@ $LogLevel=0; $LogFile = NULL; - -function parse_portal_ini($file, $parse_section = false) { - if(!file_exists($file) && !is_readable($file)) - die('Could Not Open Ini File'); - - $contents = file($file); - - $retval = array(); - - $section = ''; - $ln = 1; - $resave = false; - foreach($contents as $line) { - if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") { - $resave = true; - } - $ln++; - $line = trim($line); - $line = eregi_replace(';[.]*','',$line); - if(strlen($line) > 0) { - //echo $line . " - "; - if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { - //echo 'section'; - $section = substr($line,1,(strlen($line)-2)); - if ($parse_section) { - $retval[$section] = array(); - } - continue; - } elseif(eregi('=',$line)) { - //echo 'main element'; - list($key,$val) = explode(' = ',$line); - if (!$parse_section) { - $retval[trim($key)] = str_replace('"', '', $val); - } - else { - $retval[$section][trim($key)] = str_replace('"', '', $val); - } - } //end if - //echo '
'; - } //end if - } //end foreach - if ($resave) { - $fp = fopen($file, "w"); - reset($contents); - fwrite($fp,'<'.'?'.'php die() ?'.">\n\n"); - foreach($contents as $line) fwrite($fp,"$line"); - fclose($fp); - } - - return $retval; -} - /** * @return object * @desc Returns reference to database connection @@ -741,12 +742,15 @@ return $ret; } -function getmicrotime() -{ - list($usec, $sec) = explode(" ",microtime()); - return ((float)$usec + (float)$sec); -} +if (!function_exists( 'getmicrotime' ) ) { + function getmicrotime() + { + list($usec, $sec) = explode(" ",microtime()); + return ((float)$usec + (float)$sec); + } +} + function SetMissingDataErrors($f) { global $FormError; @@ -1367,10 +1371,12 @@ return $x; } -function print_pre($str) -{ - // no comments here :) - echo '
'.print_r($str, true).'
'; +if (!function_exists('print_pre')) { + function print_pre($str) + { + // no comments here :) + echo '
'.print_r($str, true).'
'; + } } function GetOptions($field) // by Alex @@ -1566,18 +1572,20 @@ if($SFValue == 1 || $SFValue == 2) $list->Clear(); } -/** - * Returns array value if key exists - * - * @param Array $aArray - * @param int $aIndex - * @return string - */ -function getArrayValue(&$aArray, $aIndex) +if( !function_exists('getArrayValue') ) { - return isset($aArray[$aIndex]) ? $aArray[$aIndex] : false; + /** + * Returns array value if key exists + * + * @param Array $aArray + * @param int $aIndex + * @return string + */ + function getArrayValue(&$aArray, $aIndex) + { + return isset($aArray[$aIndex]) ? $aArray[$aIndex] : false; + } } - function MakeHTMLTag($element, $attrib_prefix) { $result = Array(); Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -r1451 -r1566 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 1451) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 1566) @@ -337,6 +337,9 @@ PhraseType int(11) NOT NULL default '0', PhraseId int(11) NOT NULL auto_increment, LanguageId int(11) NOT NULL default '0', + LastChanged int(10) unsigned NOT NULL default '0', + LastChangeIP varchar(15) NOT NULL default '', + Module varchar(30) NOT NULL default '', PRIMARY KEY (PhraseId), INDEX Phrase_Index (Phrase) ) @@ -348,6 +351,7 @@ PhraseList text NOT NULL, CacheDate int(11) NOT NULL default '0', ThemeId int(11) NOT NULL default '0', + StylesheetId int(10) unsigned NOT NULL default '0', PRIMARY KEY (Template) ) @@ -382,7 +386,7 @@ Phone varchar(20) default NULL, Street varchar(255) default NULL, City varchar(20) default NULL, - State varchar(20) default NULL, + State varchar(20) NOT NULL default '', Zip varchar(20) default NULL, Country varchar(20) NOT NULL default '', ResourceId int(11) NOT NULL default '0', @@ -616,4 +620,31 @@ is_requred_fields varchar(255) NOT NULL default '', is_enabled tinyint(1) unsigned NOT NULL default '0', PRIMARY KEY (is_id) +) + +# -------------------------------------------------------- + +CREATE TABLE StylesheetSelectors ( + SelectorId int(11) NOT NULL auto_increment, + StylesheetId int(11) NOT NULL default '0', + Name varchar(255) NOT NULL default '', + SelectorName varchar(255) NOT NULL default '', + SelectorData text NOT NULL, + Description text NOT NULL, + Type tinyint(4) NOT NULL default '0', + AdvancedCSS text NOT NULL, + ParentId int(11) NOT NULL default '0', + PRIMARY KEY (SelectorId) +) + +# -------------------------------------------------------- + +CREATE TABLE Stylesheets ( + StylesheetId int(11) NOT NULL auto_increment, + Name varchar(255) NOT NULL default '', + Description varchar(255) NOT NULL default '', + AdvancedCSS text NOT NULL, + LastCompiled int(10) unsigned NOT NULL default '0', + Enabled int(11) NOT NULL default '0', + PRIMARY KEY (StylesheetId) ) \ No newline at end of file Index: trunk/kernel/admin_templates/dummy.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/dummy.tpl (revision 0) +++ trunk/kernel/admin_templates/dummy.tpl (revision 1566) @@ -0,0 +1 @@ +kruta \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_copy_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/modules/modules_config.php =================================================================== diff -u --- trunk/kernel/units/modules/modules_config.php (revision 0) +++ trunk/kernel/units/modules/modules_config.php (revision 1566) @@ -0,0 +1,41 @@ + 'mod', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'ModulesEventHandler','file'=>'modules_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'hooks' => Array(), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + ), + 'IDField' => 'Name', + 'TitleField' => 'Name', // field, used in bluebar when editing existing item + 'TableName' => TABLE_PREFIX.'Modules', + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s', + ), + 'ListSortings' => Array(), + 'Fields' => Array( + 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Path' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Var' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Version' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Loaded' => Array('type' => 'int','not_null' => '1','default' => '1'), + 'LoadOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'TemplatePath' => Array('type' => 'string','not_null' => '1','default' => ''), + 'RootCat' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'BuildDate' => Array('type' => 'double','not_null' => '1','default' => '0'), + ), + 'VirtualFields' => Array(), + + 'Grids' => Array(), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_language_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_divider.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/ico_arrow.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin/include/toolbar/browse.php =================================================================== diff -u -r1333 -r1566 --- trunk/kernel/admin/include/toolbar/browse.php (.../browse.php) (revision 1333) +++ trunk/kernel/admin/include/toolbar/browse.php (.../browse.php) (revision 1566) @@ -218,7 +218,7 @@ addCommonActions(); initToolbar('mainToolBar', actionHandler); initCheckBoxes(); - toggleMenu(); + //toggleMenu(); } function AddButtonAction(actionname,actionval) @@ -236,7 +236,7 @@ a = actionlist[i]; if(button.action==a[0]) { - //alert('Button action '+a[0]+' is '+a[1]); +// alert('Button action '+a[0]+' is '+a[1]); eval(a[1]); break; } @@ -366,18 +366,25 @@ var action_prefix =''; if ((activeTab) && (!isAnyChecked('categories'))) - { - form_name = activeTab.id; - action_prefix = activeTab.getAttribute("ActionPrefix"); - if(page.length==0) - page = activeTab.getAttribute("EditURL"); + { + form_name = activeTab.id; + action_prefix = activeTab.getAttribute("ActionPrefix"); + if(page.length==0) + page = activeTab.getAttribute("EditURL"); + + if ( action_prefix.match("k4:(.*)") ) { + act = RegExp.$1; + act = act.replace('$\$event$$', actionValue); + eval(act); + return; + } } - else - { - form_name = 'categories'; - action_prefix = 'm_cat_'; - if(page.length==0) - page="$admin" + '/category/addcategory'; + else + { + form_name = 'categories'; + action_prefix = 'm_cat_'; + if(page.length==0) + page="$admin" + '/category/addcategory'; } var f = document.getElementsByName(form_name+'_form')[0]; @@ -569,13 +576,12 @@ var categories = document.getElementById('categories'); if (!categories) return; toggleCategories(instant); - - document.getElementById('l_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active_l" : "tab_inactive_l") + ".gif" - document.getElementById('m_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif" - document.getElementById('m1_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif" - document.getElementById('r_cat').background = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active_r" : "tab_inactive_r") + ".gif" - //tabHeader.setAttribute("background", '$imagesURL'+'/itemtabs/' + ((categories.active) ? "tab_active" : "tab_inactive") + ".gif") - + var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive'); + SetBackground('l_cat', active_str + '_l.gif'); + SetBackground('m_cat', active_str + '.gif'); + SetBackground('m1_cat', active_str + '.gif'); + SetBackground('r_cat', active_str + '_r.gif'); + var images = tabHeader.getElementsByTagName("IMG"); if (images.length < 1) return; images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif"; @@ -631,7 +637,7 @@ var images = tabHeader.getElementsByTagName("IMG"); if (images.length < 1) continue; - images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif"; + images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_dn") + ".gif"; } } @@ -702,7 +708,7 @@ var images = tabHeader.getElementsByTagName("IMG"); if (images.length < 1) continue; - images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_empty") + ".gif"; + images[0].src = "$imagesURL/itemtabs/" + ((tab.active) ? "divider_up" : "divider_dn") + ".gif"; } } Index: trunk/kernel/admin_templates/img/toolbar/tool_new_item_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin/include/toolbar/reviews.php =================================================================== diff -u -r1333 -r1566 --- trunk/kernel/admin/include/toolbar/reviews.php (.../reviews.php) (revision 1333) +++ trunk/kernel/admin/include/toolbar/reviews.php (.../reviews.php) (revision 1566) @@ -222,6 +222,13 @@ form_name = activeTab.id; action_prefix = activeTab.getAttribute("ActionPrefix"); if(page.length == 0) page = activeTab.getAttribute("EditURL"); + if ( action_prefix.match("k4:(.*)") ) + { + act = RegExp.$1; + act = act.replace('$\$event$$', actionValue); + eval(act); + return; + } } var f = document.getElementsByName(form_name+'_form')[0]; Index: trunk/kernel/admin_templates/img/toolbar/tool_flip_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_permission_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_recalculate_order.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_payment_types.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_ban_user.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_sessions_log.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/translator/translator_config.php =================================================================== diff -u --- trunk/kernel/units/translator/translator_config.php (revision 0) +++ trunk/kernel/units/translator/translator_config.php (revision 1566) @@ -0,0 +1,52 @@ + 'trans', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'TranslatorEventHandler','file'=>'translator_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'), + 'AutoLoad' => false, + 'hooks' => Array(), + 'QueryString' => Array( + 1 => 'prefix', + 2 => 'field', + 3 => 'event', + ), + 'IDField' => 'N/A', + + 'TitleField' => 'Translator', + + 'TitlePhrase' => 'la_text_Translation', + + 'TitlePresets' => Array( + 'default' => Array( + 'new_status_labels' => Array('trans'=>'!la_title_Adding_Order!'), + 'edit_status_labels' => Array('trans'=>'!la_title_Editing_Order!'), + 'new_titlefield' => Array('trans'=>'!la_title_New_Order!'), + ), + + 'trans_edit' => Array('prefixes' => Array('trans'), 'format' => '!la_title_EditingTranslation!'), + + ), + /* + 'TableName' => 'N/A', + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s',), + + 'ItemSQLs' => Array( ''=>'SELECT * FROM %s',),*/ + + 'Fields' => Array( + ), + + 'VirtualFields' => Array( + 'Original' => Array(), + 'Language' => Array(), + 'SwitchLanguage' => Array('formatter'=>'kOptionsFormatter', + 'options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'Language', 'option_key_field'=>'LanguageId','option_title_field'=>'PackName'), + 'Translation' => Array(), + ), + 'Grids' => Array(), + ); + +?> \ No newline at end of file Index: trunk/admin/lv/js/in-portal.js =================================================================== diff -u -r13 -r1566 --- trunk/admin/lv/js/in-portal.js (.../in-portal.js) (revision 13) +++ trunk/admin/lv/js/in-portal.js (.../in-portal.js) (revision 1566) @@ -7,6 +7,8 @@ this.ReadCookies(); this.Grids = new Array(); + + this.LoadEvents = new Array(); } @@ -21,9 +23,6 @@ } - - - MainScript.prototype.ReadCookies = function() { @@ -178,10 +177,19 @@ } +MainScript.prototype.AddOnLoad = function(onload) +{ + this.LoadEvents.push(onload); +} +MainScript.prototype.ProcessOnload = function() +{ + for (var i in this.LoadEvents) { + eval(this.LoadEvents[i]); + } +} - var theMainScript = new MainScript(); window.theMainScript = theMainScript; \ No newline at end of file Index: trunk/kernel/admin_templates/img/blue_bar_help.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_products.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_settings_search.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_users.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_discount_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_tool_restore.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/searchitems.php =================================================================== diff -u -r1171 -r1566 --- trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1171) +++ trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1566) @@ -405,7 +405,7 @@ $where = ""; } - $complete = BuildWhereClause($where, $req_where, $not_where, &$this); + $complete = BuildWhereClause($where, $req_where, $not_where, $this); if ($complete) { $this->WhereClauses[$FieldName]="(".$complete.")"; Index: trunk/kernel/admin_templates/img/toolbar/tool_apply_rules_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_continue.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_user_pending.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_modify_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/install/upgrades/changelog_1_0_9.txt =================================================================== diff -u --- trunk/admin/install/upgrades/changelog_1_0_9.txt (revision 0) +++ trunk/admin/install/upgrades/changelog_1_0_9.txt (revision 1566) @@ -0,0 +1,11 @@ +File in-portal/admin/install/inportal_data.sql changed +File in-portal/admin/install/install_lib.php changed +File in-portal/admin/install/upgrades/changelog_1_0_9.txt is new +File in-portal/admin/install/upgrades/inportal_upgrade_v1.0.9.sql is new +File in-portal/admin/install/upgrades/readme_1_0_9.txt is new +File in-portal/admin/modules/addmodule.php changed + + +Changes in phrases and events: + + Index: trunk/kernel/admin_templates/img/icons/icon46_logs_reports.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_image.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_image_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_usersearch.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_shipping.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/inp_ses_storage.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/incs/style.css =================================================================== diff -u --- trunk/kernel/admin_templates/incs/style.css (revision 0) +++ trunk/kernel/admin_templates/incs/style.css (revision 1566) @@ -0,0 +1,466 @@ +/* --- In-Portal --- */ + + +.head_version { + font-family: verdana, arial; + font-size: 10px; + font-weight: normal; + color: white; + padding-right: 5px; + text-decoration: none; +} + +body { + font-family: Verdana, Arial, Helvetica, Sans-serif; + font-size: 12px; + color: #000000; + scrollbar-3dlight-color: #333333; + scrollbar-arrow-color: #ffffff; + scrollbar-track-color: #88d2f8; + scrollbar-darkshadow-color: #333333; + scrollbar-highlight-color: #009ffd; + scrollbar-shadow-color: #009ffd; + scrollbar-face-color: #009ffd; + overflow-x: auto; overflow-y: auto; +} + +A { + color: #006699; + text-decoration: none; +} + +A:hover { + color: #009ff0; + text-decoration: none; +} + +TD { + font-family: verdana,helvetica; + font-size: 10pt; + text-decoration: none; +} + +form { + display: inline; +} + +.text { + font-family: verdana, arial; + font-size: 12px; + font-weight: normal; + text-decoration: none; +} + +.tablenav { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFFFFF; + + text-decoration: none; + background-color: #73C4F5; + background: url(../img/tabnav_back.gif) repeat-x; +} + +.tablenav_link { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFFFFF; + text-decoration: none; +} + +.header_left_bg { + background: url(../img/tabnav_left.gif) no-repeat; +} + +.tablenav_link:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #ffcc00; + text-decoration: none; +} + +.tableborder { + font-family: arial, helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; + border-top-width: 0px; +} + +.tableborder_full, .tableborder_full_kernel { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; +} + + +.button { + font-family: arial, verdana; + font-size: 12px; + font-weight: normal; + color: #000000; + background: url(../img/button_back.gif) #f9eeae repeat-x; + text-decoration: none; +} + +.hint_red { + font-family: Arial, Helvetica, sans-serif; + font-size: 10px; + font-style: normal; + color: #FF0000; + /* background-color: #F0F1EB; */ +} + +.tree_head { + font-family: verdana, arial; + font-size: 10px; + font-weight: bold; + color: #FFFFFF; + text-decoration: none; +} + +.admintitle { + font-family: verdana, arial; + font-size: 20px; + font-weight: bold; + color: #009FF0; + text-decoration: none; +} + +.table_border_notop, .table_border_nobottom { + background-color: #F0F1EB; + border: 1px solid #000000; +} + +.table_border_notop { + border-top-width: 0px; +} + +.table_border_nobottom { + border-bottom-width: 0px; +} + +.pagination_bar { + background-color: #D7D7D7; + border: 1px solid #000000; + border-top-width: 0px; +} + +/* Categories */ + +.priority { + color: #FF0000; + padding-left: 1px; + padding-right: 1px; + font-size: 11px; +} + +.cat_no, .cat_desc, .cat_new, .cat_pick, .cats_stats { + font-family: arial, verdana, sans-serif; +} + +.cat_no { + font-size: 10px; + color: #707070; +} + +.cat_desc { + font-size: 9pt; + color: #000000; +} + +.cat_new { + font-size: 12px; + vertical-align: super; + color: blue; +} + +.cat_pick { + font-size: 12px; + vertical-align: super; + color: #009900; +} + +.cats_stats { + font-size: 11px; + color: #707070; +} + +/* Links */ + +.link, .link:hover, .link_desc, .link_detail { + font-family: arial, helvetica, sans-serif; +} + +.link { + font-size: 9pt; + color: #1F569A; +} + +.link:hover { + font-size: 9pt; + color: #009FF0; +} + +.link_desc { + font-size: 9pt; + color: #000000; +} + +.link_detail { + font-size: 11px; + color: #707070; +} + +.link_rate, .link_review, .link_modify, .link_div, .link_new, .link_top, .link_pop, .link_pick { + font-family: arial, helvetica, sans-serif; + font-size: 12px; +} + +.link_rate, .link_review, .link_modify, .link_div { + text-decoration: none; +} + +.link_rate { color: #006600; } +.link_review { color: #A27900; } +.link_modify { color: #800000; } +.link_div { color: #000000; } + +.link_new, .link_top, .link_pop, .link_pick { + vertical-align: super; +} + +.link_new { color: #0000FF; } +.link_top { color: #FF0000; } +.link_pop { color: FFA500; } +.link_pick { color: #009900; } + +/* ToolBar */ + +.divider { + BACKGROUND-COLOR: #999999 +} + +.toolbar { + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + border: 1px solid #000000; + border-width: 0 1 1 1; + background-color: #F0F1EB; +} + +.current_page { + font-family: verdana; + font-size: 12px; + font-weight: bold; + background-color: #C4C4C4; + padding-left: 1px; + padding-right: 1px; +} + +.nav_url { + font-family: verdana; + font-size: 12px; + font-weight: bold; + color: #1F569A; +} + +.nav_arrow { + font-family: verdana; + font-size: 12px; + font-weight: normal; + color: #1F569A; + padding-left: 3px; + padding-right: 3px; +} + +.nav_current_item { + font-family: verdana; + font-size: 12px; + font-weight: bold; + color: #666666; +} + +/* Edit forms */ + +.hint { + font-family: arial, helvetica, sans-serif; + font-size: 12px; + font-style: normal; + color: #666666; +} + +.table_color1, .table_color2 { + font-family: verdana, arial; + font-size: 14px; + font-weight: normal; + color: #000000; + text-decoration: none; +} + +.table_color1 { background-color: #F6F6F6; } +.table_color2 { background-color: #EBEBEB; } + +.table_white { + font-family: verdana, arial; + font-weight: normal; + font-size: 14px; + color: #000000; + background-color: #FFFFFF; + text-decoration: none; +} + +.subsectiontitle { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFFFFF; + background-color: #999999; + text-decoration: none; + height: 24px; +} +.subsectiontitle:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + color: #FFCC00; + background-color: #999999; + text-decoration: none; +} + +.error { + font-family: arial, helvetica, sans-serif; + font-weight: bold; + font-size: 9pt; + color: #FF0000; +} + +/* Tabs */ + +.tab_border { + border: 1px solid #000000; + border-width: 1 0 0 0; +} + +.tab, .tab:hover { + font-family: verdana, arial, helvetica; + font-size: 12px; + font-weight: bold; + color: #000000; + text-decoration: none; +} + +.tab2, .tab2:hover { + font-family: verdana, arial, helvetica; + font-size: 12px; + font-weight: bold; + text-decoration: none; +} + +.tab2 { color: #FFFFFF; } +.tab2:hover { color: #000000; } + +/* Item DIVS */ + +.selected_div { background-color: #C6D6EF; } +.notselected_div { background-color: #FFFFFF; } + +/* Item tabs */ + + +.itemtab_active { + background: url("../img/itemtabs/tab_active.gif") #eee repeat-x; +} + +.itemtab_inactive { + background: url("../img/itemtabs/tab_inactive.gif") #F9EEAE repeat-x; +} + + +/* Grids */ + +.columntitle, .columntitle:hover { + font-family: verdana, arial; + font-size: 14px; + font-weight: bold; + background-color: #999999; + text-decoration: none; +} + +.columntitle { color: #FFFFFF; } +.columntitle:hover { color: #FFCC00; } + +.columntitle_small, .columntitle_small:hover { + font-family: verdana, arial; + font-size: 12px; + font-weight: bold; + background-color: #999999; + text-decoration: none; +} + +.columntitle_small { color: #FFFFFF; } +.columntitle_small:hover { color: #FFCC00; } + +/* ----------------------------- */ + +.section_header_bg { + background: url(../img/logo_bg.gif) no-repeat top right; +} + +.small { + font-size: 9px; + font-family: Verdana, Arial, Helvetica, sans-serif; +} + +.order_preview_header, .order_preview_header TD { + background-color: #C9E9FE; + font-family: Arial; + font-size: 10pt; + font-weight: bold; +} + +.order_preview_field_name { + font-family: Arial; + font-size: 10pt; + font-weight: bold; +} +.order_preview_field_value { + font-family: Arial; + font-size: 10pt; +} + +.arial2i { + font-family: Arial; + font-size: 10pt; + font-style: italic; +} +.border1 { + border: 1px solid #111111; +} +.arial2r { + font-family: Arial; + font-size: 10pt; + color: #602830; + font-weight: bold; +} + +.orders_flat_table { + border-collapse: collapse; +} + +.orders_flat_table TD { + border: 1px solid #000000; + padding-left: 2px; + padding-right: 2px; +} + +.help_box { + padding: 5px 10px 5px 10px; +} + +.progress_bar +{ + background: url(../img/progress_bar_segment.gif); +} \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon24_users_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_searchgroups.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_manuf.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/languages/import_xml.php =================================================================== diff -u --- trunk/kernel/units/languages/import_xml.php (revision 0) +++ trunk/kernel/units/languages/import_xml.php (revision 1566) @@ -0,0 +1,280 @@ +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'); + } + + /** + * Create temp table for prefix, if table already exists, then delete it and create again + * + * @param string $prefix + */ + function prepareTempTable($prefix) + { + $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) + { + // define the XML parsing routines/functions to call based on the handler path + if( !file_exists($filename) ) return false; + + $this->phrase_types_allowed = array_flip($phrase_types); + + //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 + + $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']); + break; + + case 'LANGUAGES LANGUAGE PHRASES': + case 'LANGUAGES LANGUAGE EVENTS': + if( !getArrayValue($this->current_language,'LanguageId') ) + { + if( !getArrayValue($this->current_language,'Charset') ) $this->current_language['Charset'] = 'iso-8859-1'; + $this->lang_object->SetFieldsFromHash($this->current_language); + if( $this->lang_object->Create() ) $this->current_language['LanguageId'] = $this->lang_object->GetID(); + } + 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'], + 'Module' => $phrase_module, + 'LastChanged' => time(), + 'LastChangeIP' => $this->ip_address ); + 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']); + break; + + + } + + // if($path == 'SHIPMENT PACKAGE') + } + + function characterData(&$parser, $line) + { + $line = trim($line); + if(!$line) return ; + + $path = join (' ',$this->path); + + $language_nodes = Array('DATEFORMAT','TIMEFORMAT','DECIMAL','THOUSANDS','CHARSET'); + + + $node_field_map = Array('LANGUAGES LANGUAGE DATEFORMAT' => 'DateFormat', + 'LANGUAGES LANGUAGE TIMEFORMAT' => 'TimeFormat', + 'LANGUAGES LANGUAGE DECIMAL' => 'DecimalPoint', + 'LANGUAGES LANGUAGE THOUSANDS' => 'ThousandSep', + 'LANGUAGES LANGUAGE CHARSET' => 'Charset'); + + if( in_array( end($this->path), $language_nodes) ) + { + $this->current_language[ $node_field_map[$path] ] = $line; + } + else + { + switch($path) + { + case 'LANGUAGES LANGUAGE PHRASES PHRASE': + if( isset($this->phrase_types_allowed[ $this->current_phrase['PhraseType'] ]) ) + { + $this->current_phrase['Translation'] = base64_decode($line); + $this->insertRecord($this->tables['phrases'], $this->current_phrase); + } + break; + + case 'LANGUAGES LANGUAGE EVENTS EVENT': + $this->current_event['Template'] = base64_decode($line); + $this->insertRecord($this->tables['emailmessages'],$this->current_event); + break; + } + } + } + + function endElement(&$parser, $element) + { + $path = implode(' ',$this->path); + 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 + * + * @param string $filename filename to export into + * @param Array $phrase_types phrases types to export from modules passed in $module_ids + * @param Array $language_ids IDs of languages to export + * @param Array $module_ids IDs of modules to export phrases from + */ + function Create($filename, $phrase_types, $language_ids, $module_ids) + { + $fp = fopen($filename,'w'); + if(!$fp || !$phrase_types || !$module_ids || !$language_ids) return false; + + $this->events_hash = array_flip($this->events_hash); + + $lang_table = $this->Application->getUnitOption('lang','TableName'); + $phrases_table = $this->Application->getUnitOption('phrases','TableName'); + $emailevents_table = $this->Application->getUnitOption('emailmessages','TableName'); + $mainevents_table = $this->Application->getUnitOption('emailevents','TableName'); + + $phrase_tpl = "\t\t\t".'%s'."\n"; + $event_tpl = "\t\t\t".'%s'."\n"; + $sql = 'SELECT * FROM %s WHERE LanguageId = %s'; + $ret = ''."\n"; + foreach($language_ids as $language_id) + { + // languages + $row = $this->Conn->GetRow( sprintf($sql, $lang_table, $language_id) ); + $ret .= "\t".''.$row['DateFormat'].''; + $ret .= ''.$row['TimeFormat'].''.$row['DecimalPoint'].''; + $ret .= ''.$row['ThousandSep'].''.$row['Charset'].''."\n"; + + // phrases + $ret .= "\t\t".''."\n"; + $phrases_sql = 'SELECT * FROM '.$phrases_table.' WHERE LanguageId = %s AND PhraseType IN (%s) AND Module IN (%s)'; + if( in_array('In-Portal',$module_ids) ) array_push($module_ids, ''); // for old language packs + $rows = $this->Conn->Query( sprintf($phrases_sql,$language_id, implode(',',$phrase_types), '\''.implode('\',\'',$module_ids).'\'' ) ); + foreach($rows as $row) + { + $ret .= sprintf($phrase_tpl, $row['Phrase'], $row['PhraseType'], base64_encode($row['Translation']) ); + } + $ret .= "\t\t".''."\n"; + + // email events + $ret .= "\t\t".''."\n"; + 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); + + $event_sql = 'SELECT * FROM '.$emailevents_table.' WHERE LanguageId = %s AND EventId IN (%s)'; + $rows = $this->Conn->Query( sprintf($event_sql,$language_id, $event_ids ? implode(',',$event_ids) : '' ) ); + 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']) ); + } + $ret .= "\t\t".''."\n"; + $ret .= "\t".''."\n"; + } + + $ret .= ''; + fwrite($fp, $ret); + fclose($fp); + return true; + } + } + +?> \ No newline at end of file Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/category_items/category_items_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/itemicons/icon16_product.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_site.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_language_var_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_community.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/adduser_permissions.php =================================================================== diff -u -r822 -r1566 --- trunk/admin/users/adduser_permissions.php (.../adduser_permissions.php) (revision 822) +++ trunk/admin/users/adduser_permissions.php (.../adduser_permissions.php) (revision 1566) @@ -129,12 +129,14 @@ $formaction = $adminURL."/user/adduser_permissions.php?".$envar; +$saveURL = $admin."/".$objSession->GetVariable('ReturnScript'); + //Display header $sec = $objSections->GetSection($section); //echo "
"; print_r($sec); echo "
"; $objCatToolBar = new clsToolBar(); -$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif"); -$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif"); +$objCatToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',1);","tool_select.gif"); +$objCatToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","edit_submit('edituser','UserEditStatus','".$saveURL."',2);","tool_cancel.gif"); if ( isset($en_prev) || isset($en_next) ) { Index: trunk/kernel/admin_templates/img/tabnav_back.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/tab2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/install/install_lib.php =================================================================== diff -u -r1183 -r1566 --- trunk/admin/install/install_lib.php (.../install_lib.php) (revision 1183) +++ trunk/admin/install/install_lib.php (.../install_lib.php) (revision 1566) @@ -1,795 +1,825 @@ -read()) { - if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) { - if (strstr($file, 'inportal_upgrade_v')) { - $upgrades_arr[] = $file; - } - } - } - - usort($upgrades_arr, "VersionSort"); - - foreach($upgrades_arr as $file) { - $file_tmp = str_replace("inportal_upgrade_v", "", $file); - $file_tmp = str_replace(".sql", "", $file_tmp); - - if (ConvertVersion($file_tmp) > ConvertVersion($version)) { - $version = $file_tmp; - } - } - - return $version; -} - -function ConvertVersion($version) -{ - $parts = explode('.', $version); - - $bin = ''; - foreach ($parts as $part) { - $bin .= str_pad(decbin($part), 8, '0', STR_PAD_LEFT); - } - - $dec = bindec($bin); - - return $dec; -} - -function TableExists($ado, $tables) -{ - global $g_TablePrefix; - - $t = explode(",",$tables); - - $i = $ado->MetaTables(); - for($x=0;$x\n\n"); - foreach($ini_vars as $secname => $section) - { - fwrite($fp,"[".$secname."]\n"); - foreach($section as $key => $value) fwrite($fp,"$key = \"$value\"\n"); - fwrite($fp,"\n"); - } - fclose($fp); - //} -} - -function RunSchemaFile($ado,$filename) -{ - if(file_exists($filename)) - { - $fp = fopen($filename, "r");//open file - $sql = fread($fp, filesize($filename)); - fclose($fp); - if(strlen($sql)) - RunSchemaText($ado,$sql); - } -} - -function RunSchemaText($ado,$sql) -{ - global $g_TablePrefix; - - if(strlen($g_TablePrefix)) - { - $what = "CREATE TABLE "; - $replace = "CREATE TABLE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "DROP TABLE "; - $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "INSERT INTO "; - $replace = "INSERT INTO ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "UPDATE "; - $replace = "UPDATE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "ALTER TABLE "; - $replace = "ALTER TABLE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - } - $commands = explode("# --------------------------------------------------------",$sql); - if(count($commands)>0) - { - for($i=0;$i0) - { - $ado->Execute($cmd); - if($ado->ErrorNo()!=0) - { - $db_error = $ado->ErrorMsg()." COMMAND:
$cmd
"; - } - } - } - } -} - -function RunSQLText($ado,$allsql) -{ - global $g_TablePrefix; - - $line = 0; - while($line0 && substr($sql,0,1)!="#") - { - if(strlen($g_TablePrefix)) - { - $what = "CREATE TABLE "; - $replace = "CREATE TABLE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "DELETE FROM "; - $replace = "DELETE FROM ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "DROP TABLE "; - $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "DROP TABLE IF EXISTS "; - $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "INSERT INTO "; - $replace = "INSERT INTO ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "UPDATE "; - $replace = "UPDATE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - - $what = "ALTER TABLE "; - $replace = "ALTER TABLE ".$g_TablePrefix; - $sql = ereg_replace($what, $replace, $sql); - } - $sql = trim($sql); - if(strlen($sql)>0) - { - $ado->Execute($sql); - if($ado->ErrorNo()!=0) - { - $db_error = $ado->ErrorMsg()." COMMAND:
$sql
"; - $error = TRUE; - } - } - } - $line++; - } -} - -function RunSQLFile($ado,$filename) -{ - if(file_exists($filename)) - { - $allsql = file($filename); - RunSQLText($ado,$allsql); - } -} - -function RunRestoreFile($ado,$filename,$FileOffset,$MaxLines) -{ - $size = filesize($filename); - - if($FileOffset > $size) - return -2; - - $fp = fopen($filename,"r"); - if(!$fp) - return -1; - - if($FileOffset>0) - { - fseek($fp,$FileOffset); - } - else - { - $EndOfSQL = FALSE; - $sql = ""; - while(!feof($fp) && !$EndOfSQL) - { - $l = fgets($fp,16384); - if(substr($l,0,11)=="INSERT INTO") - { - $EndOfSQL = TRUE; - } - else - { - $sql .= $l; - $FileOffset = ftell($fp) - strlen($l); - } - } - if(strlen($sql)) - { - RunSchemaText($ado,$sql); - } - fseek($fp,$FileOffset); - } - $LinesRead = 0; - $sql = ""; - $AllSql = array(); - while($LinesRead < $MaxLines && !feof($fp)) - { - $sql = fgets($fp, 16384); - if(strlen($sql)) - { - $AllSql[] = $sql; - $LinesRead++; - } - } - if(!feof($fp)) - { - $FileOffset = ftell($fp); - } - else - { - $FileOffset = $TotalSize; - } - fclose($fp); - if(count($AllSql)>0) - RunSQLText($ado,$AllSql); - return (int)$FileOffset; -} - - -function _inst_keyED($txt,$encrypt_key) -{ - $encrypt_key = md5($encrypt_key); - $ctr=0; - $tmp = ""; - for ($i=0;$i= 5 && $i < 7) return _inst_GetObscureValue($z)*_inst_GetObscureValue('e'); - if ($i > 30) return Array(0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74); - if ($i > 20) return 99; - if ($i > 10) return '.'.(_inst_GetObscureValue(6.5)+1); - if ($i == 'a') return 0xa; -} - -function _inst_Chr($val) -{ - $x = _inst_GetObscureValue(25); - $f = chr($x).chr($x+5).chr($x+15); - return $f($val); -} - -function _inst_IsLocalSite($domain) -{ - $ee = _inst_GetObscureValue(35); - foreach ($ee as $e) { - $yy .= _inst_Chr($e); - } - $localb = FALSE; - if(substr($domain,0,3)==_inst_GetObscureValue('x')) - { - $b = substr($domain,0,6); - $p = explode(".",$domain); - $subnet = $p[1]; - if($p[1]>15 && $p[1]<32) - $localb=TRUE; - } - $zz = _inst_GetObscureValue('z')._inst_GetObscureValue(5).'.'.(int)_inst_GetObscureValue(7)._inst_GetObscureValue(12); - $ff = _inst_GetObscureValue('z')+65; - $hh = $ff-0x18; - if($domain==$yy || $domain==$zz || substr($domain,0,7)==$ff._inst_Chr(46).$hh || - substr($domain,0,3)==_inst_GetObscureValue('a')._inst_Chr(46) || $localb || strpos($domain,".")==0) - { - return TRUE; - } - return FALSE; -} - -function _inst_falseIsLocalSite($domain) -{ - $localb = FALSE; - if(substr($domain,0,3)=="172" || $domain == '##code##') - { - $b = substr($domain,0,6); - $p = explode(".",$domain); - $subnet = $p[1]; - if($p[1]>15 && $p[1]<32) - $localb=TRUE; - } - if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" || - substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0) - { - return TRUE; - } - return FALSE; -} - -function ed592fe427e1ce60e32ffcb0c82d8557($name) -{ - return _inst_ModuleLicensed($name); -} - -function _inst_ModuleLicensed($name) -{ - global $i_Keys, $objConfig, $g_License, $g_Domain; - - $lic = base64_decode($g_License); - _inst_ParseLicense($lic); - - $modules = array(); - if(!_inst_IsLocalSite($g_Domain)) - { - for($x=0;$x\n") { - $resave = true; - } - $ln++; - $line = trim($line); - $line = eregi_replace(';[.]*','',$line); - if(strlen($line) > 0) { - if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { - $section = substr($line,1,(strlen($line)-2)); - if ($parse_section) { - $retval[$section] = array(); - } - continue; - } elseif(eregi('=',$line)) { - list($key,$val) = explode(' = ',$line); - if (!$parse_section) { - $retval[trim($key)] = str_replace('"', '', $val); - } - else { - $retval[$section][trim($key)] = str_replace('"', '', $val); - } - } //end if - } //end if - } //end foreach - if ($resave) { - $fp = fopen($file, "w"); - reset($contents); - fwrite($fp,'<'.'?'.'php die() ?'.">\n\n"); - foreach($contents as $line) fwrite($fp,"$line"); - fclose($fp); - } - - return $retval; -} - -function a48d819089308a9aeb447e7248b2587f() -{ - return _inst_GetModuleList(); -} - -function _inst_GetModuleList() -{ - global $rootpath,$pathchar,$admin, $pathtoroot; - - $path = $pathtoroot; - - $new = array(); - if ($dir = @opendir($path)) - { - while (($file = readdir($dir)) !== false) - { - if($file !="." && $file !=".." && substr($file,0,1)!="_") - { - if(is_dir($path."/".$file)) - { - $ModuleAdminDir = $path.$file.'/admin/'; - $inst_file = $ModuleAdminDir.'install.php'; - if( file_exists($inst_file) && file_exists($ModuleAdminDir.'install/inportal_schema.sql') ) - { - if(_inst_ModuleLicensed($file)) { - $new[$file] = $inst_file; - } - } - } - } - } - closedir($dir); - } - return array_keys($new); -} - -function GetDirList ($dirName) -{ - - $filedates = array(); - $d = dir($dirName); - - while($entry = $d->read()) - { - if ($entry != "." && $entry != "..") - { - if (!is_dir($dirName."/".$entry)) - { - $filedate[]=$entry; - } - } - } - $d->close(); - return $filedate; -} - -function GetLanguageList() -{ - global $pathtoroot, $admin; - - $packs = array(); - $dir = $pathtoroot.$admin."/install/langpacks"; - $files = GetDirList($dir); - - if(is_array($files)) - { - foreach($files as $f) - { - $p = pathinfo($f); - if($p["extension"]=="lang") - { - $packs[] = $f; - } - } - } - return $packs; -} - -function section_header($title, $return_result = false) -{ - $ret = ''. - '
 '.$title.''. - ''. - "". - '
'; - if( $return_result ) - return $ret; - else - echo $ret; -} - -function &VerifyDB($error_state, $next_state, $success_func = null, $db_must_exist = false) -{ - // perform various check type to database specified - // 1. user is allowed to connect to database - // 2. user has all types of permissions in database - global $state, $db_error; - - // enshure we use data from post & not from config - $GLOBALS['g_DBType'] = $_POST["ServerType"]; - $GLOBALS['g_DBHost'] = $_POST["ServerHost"]; - $GLOBALS['g_DBName'] = $_POST["ServerDB"]; - $GLOBALS['g_DBUser'] = $_POST["ServerUser"]; - $GLOBALS['g_DBUserPassword'] = $_POST["ServerPass"]; - - // connect to database - $ado =& inst_GetADODBConnection(); - if($ado->ErrorNo() != 0) - { - // was error while connecting - $db_error = "Connection Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); - $state = $error_state; - - } - elseif( $ado->ErrorNo() == 0 ) - { - // if connected, then check if all sql statements work - $test_result = 1; - - $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; - $sql_tests[] = 'CREATE TABLE test_table(test_col mediumint(6))'; - $sql_tests[] = 'INSERT INTO test_table(test_col) VALUES (5)'; - $sql_tests[] = 'UPDATE test_table SET test_col = 12'; - $sql_tests[] = 'ALTER TABLE test_table ADD COLUMN new_col varchar(10)'; - $sql_tests[] = 'SELECT * FROM test_table'; - $sql_tests[] = 'DELETE FROM test_table'; - $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; - - foreach($sql_tests as $sql_test) - { - $ado->Execute($sql_test); - if( $ado->ErrorNo()!=0 ) - { - $test_result = 0; - break; - } - } - - if($test_result == 1) - { - // if statements work & connection made, then check table existance - $db_exists = TableExists($ado,"ConfigurationAdmin,Category,Permissions"); - if($db_exists != $db_must_exist) - { - $state = $error_state; - $db_error = $db_must_exist ? 'An In-Portal Database already exists at this location' : 'An In-Portal Database was not found at this location'; - } - else - { - $state = $next_state; - if( isset($success_func) ) $success_func(); - } - } - else - { - // user has insufficient permissions in database specified - $db_error = "Permission Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); - $state = $error_state; - } - } - return $ado; -} - -function SaveDBConfig() -{ - // save new database configuration - set_ini_value("Database", "DBType",$_POST["ServerType"]); - set_ini_value("Database", "DBHost",$_POST["ServerHost"]); - set_ini_value("Database", "DBName",$_POST["ServerDB"]); - set_ini_value("Database", "DBUser",$_POST["ServerUser"]); - set_ini_value("Database", "DBUserPassword",$_POST["ServerPass"]); - set_ini_value("Database","TablePrefix",$_POST["TablePrefix"]); - save_values(); - $GLOBALS['include_file'] = 'install/install_finish.php'; -} - -function ReSetVar($var) -{ - // define varible if not defined before - if( !isset($GLOBALS[$var]) ) $GLOBALS[$var] = ''; -} - -// if globals.php not yet included (1st steps of install), -// then define GetVar function -if( !function_exists('GetVar') ) -{ - function GetVar($name, $post_priority = false) - { - if(!$post_priority) // follow gpc_order in php.ini - return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false; - else // get variable from post 1stly if not found then from get - return isset($_POST[$name]) && $_POST[$name] ? $_POST[$name] : ( isset($_GET[$name]) && $_GET[$name] ? $_GET[$name] : false ); - } -} - -function RadioChecked($name, $value) -{ - // return " checked" word in case if radio is checked - $submit_value = GetVar($name); - return $submit_value == $value ? ' checked' : ''; -} - -?> +read()) { + if ($file != "." && $file != ".." && !is_dir($admindirname.$file)) { + if (strstr($file, 'inportal_upgrade_v')) { + $upgrades_arr[] = $file; + } + } + } + + usort($upgrades_arr, "VersionSort"); + + foreach($upgrades_arr as $file) { + $file_tmp = str_replace("inportal_upgrade_v", "", $file); + $file_tmp = str_replace(".sql", "", $file_tmp); + + if (ConvertVersion($file_tmp) > ConvertVersion($version)) { + $version = $file_tmp; + } + } + + return $version; +} + +function ConvertVersion($version) +{ + $parts = explode('.', $version); + + $bin = ''; + foreach ($parts as $part) { + $bin .= str_pad(decbin($part), 8, '0', STR_PAD_LEFT); + } + + $dec = bindec($bin); + + return $dec; +} + +function TableExists(&$ado, $tables) +{ + global $g_TablePrefix; + + $t = explode(",",$tables); + + $i = $ado->MetaTables(); + for($x=0;$x\n\n"); + foreach($ini_vars as $secname => $section) + { + fwrite($fp,"[".$secname."]\n"); + foreach($section as $key => $value) fwrite($fp,"$key = \"$value\"\n"); + fwrite($fp,"\n"); + } + fclose($fp); + //} +} + +function getConnectionInterface($action, $dbo_type='adodb') +{ + if($dbo_type == 'adodb') + { + switch($action) + { + case 'query': return 'Execute'; break; + case 'errorno': return 'ErrorNo'; break; + case 'errormsg': return 'ErrorMsg'; break; + } + } + + if($dbo_type == 'dbconnection') + { + switch($action) + { + case 'query': return 'Query'; break; + case 'errorno': return 'getErrorCode'; break; + case 'errormsg': return 'getErrorMsg'; break; + } + + } +} + +function RunSchemaFile(&$ado, $filename, $dbo_type='adodb') +{ + if( file_exists($filename) ) + { + $sql = file_get_contents($filename); + if($sql) RunSchemaText($ado,$sql,$dbo_type); + } +} + +function RunSchemaText(&$ado, $sql, $dbo_type='adodb') +{ + global $g_TablePrefix; + + if(strlen($g_TablePrefix)) + { + $what = "CREATE TABLE "; + $replace = "CREATE TABLE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "DROP TABLE "; + $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "INSERT INTO "; + $replace = "INSERT INTO ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "UPDATE "; + $replace = "UPDATE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "ALTER TABLE "; + $replace = "ALTER TABLE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + } + + $commands = explode("# --------------------------------------------------------",$sql); + if(count($commands)>0) + { + $query_func = getConnectionInterface('query',$dbo_type); + $errorno_func = getConnectionInterface('errorno',$dbo_type); + $errormsg_func = getConnectionInterface('errormsg',$dbo_type); + + for($i = 0; $i < count($commands); $i++) + { + $cmd = $commands[$i]; + $cmd = trim($cmd); + if(strlen($cmd)>0) + { + $ado->$query_func($cmd); + if($ado->$errorno_func() != 0) + { + $db_error = $ado->$errormsg_func()." COMMAND:
$cmd
"; + } + } + } + } +} + +function RunSQLText(&$ado, $allsql, $dbo_type='adodb') +{ + global $g_TablePrefix; + + $line = 0; + $query_func = getConnectionInterface('query',$dbo_type); + $errorno_func = getConnectionInterface('errorno',$dbo_type); + $errormsg_func = getConnectionInterface('errormsg',$dbo_type); + + while($line0 && substr($sql,0,1)!="#") + { + if(strlen($g_TablePrefix)) + { + $what = "CREATE TABLE "; + $replace = "CREATE TABLE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "DELETE FROM "; + $replace = "DELETE FROM ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "DROP TABLE "; + $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "DROP TABLE IF EXISTS "; + $replace = "DROP TABLE IF EXISTS ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "INSERT INTO "; + $replace = "INSERT INTO ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "UPDATE "; + $replace = "UPDATE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + + $what = "ALTER TABLE "; + $replace = "ALTER TABLE ".$g_TablePrefix; + $sql = ereg_replace($what, $replace, $sql); + } + $sql = trim($sql); + if(strlen($sql)>0) + { + $ado->$query_func($sql); + if($ado->$errorno_func()!=0) + { + $db_error = $ado->$errormsg_func()." COMMAND:
$sql
"; + $error = TRUE; + } + } + } + $line++; + } +} + +function RunSQLFile(&$ado, $filename, $dbo_type='adodb') +{ + if(file_exists($filename)) + { + $allsql = file($filename); + RunSQLText($ado,$allsql,$dbo_type); + } +} + +function RunRestoreFile($ado,$filename,$FileOffset,$MaxLines) +{ + $size = filesize($filename); + + if($FileOffset > $size) + return -2; + + $fp = fopen($filename,"r"); + if(!$fp) + return -1; + + if($FileOffset>0) + { + fseek($fp,$FileOffset); + } + else + { + $EndOfSQL = FALSE; + $sql = ""; + while(!feof($fp) && !$EndOfSQL) + { + $l = fgets($fp,16384); + if(substr($l,0,11)=="INSERT INTO") + { + $EndOfSQL = TRUE; + } + else + { + $sql .= $l; + $FileOffset = ftell($fp) - strlen($l); + } + } + if(strlen($sql)) + { + RunSchemaText($ado,$sql); + } + fseek($fp,$FileOffset); + } + $LinesRead = 0; + $sql = ""; + $AllSql = array(); + while($LinesRead < $MaxLines && !feof($fp)) + { + $sql = fgets($fp, 16384); + if(strlen($sql)) + { + $AllSql[] = $sql; + $LinesRead++; + } + } + if(!feof($fp)) + { + $FileOffset = ftell($fp); + } + else + { + $FileOffset = $TotalSize; + } + fclose($fp); + if(count($AllSql)>0) + RunSQLText($ado,$AllSql); + return (int)$FileOffset; +} + + +function _inst_keyED($txt,$encrypt_key) +{ + $encrypt_key = md5($encrypt_key); + $ctr=0; + $tmp = ""; + for ($i=0;$i= 5 && $i < 7) return _inst_GetObscureValue($z)*_inst_GetObscureValue('e'); + if ($i > 30) return Array(0x6c,0x6f,0x63,0x61,0x6c,0x68,0x6f,0x73,0x74); + if ($i > 20) return 99; + if ($i > 10) return '.'.(_inst_GetObscureValue(6.5)+1); + if ($i == 'a') return 0xa; +} + +function _inst_Chr($val) +{ + $x = _inst_GetObscureValue(25); + $f = chr($x).chr($x+5).chr($x+15); + return $f($val); +} + +function _inst_IsLocalSite($domain) +{ + $ee = _inst_GetObscureValue(35); + foreach ($ee as $e) { + $yy .= _inst_Chr($e); + } + $localb = FALSE; + if(substr($domain,0,3)==_inst_GetObscureValue('x')) + { + $b = substr($domain,0,6); + $p = explode(".",$domain); + $subnet = $p[1]; + if($p[1]>15 && $p[1]<32) + $localb=TRUE; + } + $zz = _inst_GetObscureValue('z')._inst_GetObscureValue(5).'.'.(int)_inst_GetObscureValue(7)._inst_GetObscureValue(12); + $ff = _inst_GetObscureValue('z')+65; + $hh = $ff-0x18; + if($domain==$yy || $domain==$zz || substr($domain,0,7)==$ff._inst_Chr(46).$hh || + substr($domain,0,3)==_inst_GetObscureValue('a')._inst_Chr(46) || $localb || strpos($domain,".")==0) + { + return TRUE; + } + return FALSE; +} + +function _inst_falseIsLocalSite($domain) +{ + $localb = FALSE; + if(substr($domain,0,3)=="172" || $domain == '##code##') + { + $b = substr($domain,0,6); + $p = explode(".",$domain); + $subnet = $p[1]; + if($p[1]>15 && $p[1]<32) + $localb=TRUE; + } + if($domain=="localhost" || $domain=="127.0.0.1" || substr($domain,0,7)=="192.168" || + substr($domain,0,3)=="10." || $localb || strpos($domain,".")==0) + { + return TRUE; + } + return FALSE; +} + +function ed592fe427e1ce60e32ffcb0c82d8557($name) +{ + return _inst_ModuleLicensed($name); +} + +function _inst_ModuleLicensed($name) +{ + global $i_Keys, $objConfig, $g_License, $g_Domain; + + $lic = base64_decode($g_License); + _inst_ParseLicense($lic); + + $modules = array(); + if(!_inst_IsLocalSite($g_Domain)) + { + for($x=0;$x\n") { + $resave = true; + } + $ln++; + $line = trim($line); + $line = eregi_replace(';[.]*','',$line); + if(strlen($line) > 0) { + if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) { + $section = substr($line,1,(strlen($line)-2)); + if ($parse_section) { + $retval[$section] = array(); + } + continue; + } elseif(eregi('=',$line)) { + list($key,$val) = explode(' = ',$line); + if (!$parse_section) { + $retval[trim($key)] = str_replace('"', '', $val); + } + else { + $retval[$section][trim($key)] = str_replace('"', '', $val); + } + } //end if + } //end if + } //end foreach + if ($resave) { + $fp = fopen($file, "w"); + reset($contents); + fwrite($fp,'<'.'?'.'php die() ?'.">\n\n"); + foreach($contents as $line) fwrite($fp,"$line"); + fclose($fp); + } + + return $retval; +} + +function a48d819089308a9aeb447e7248b2587f() +{ + return _inst_GetModuleList(); +} + +function _inst_GetModuleList() +{ + global $rootpath,$pathchar,$admin, $pathtoroot; + + $path = $pathtoroot; + + $new = array(); + if ($dir = @opendir($path)) + { + while (($file = readdir($dir)) !== false) + { + if($file !="." && $file !=".." && substr($file,0,1)!="_") + { + if(is_dir($path."/".$file)) + { + $ModuleAdminDir = $path.$file.'/admin/'; + $inst_file = $ModuleAdminDir.'install.php'; + if( file_exists($inst_file) && file_exists($ModuleAdminDir.'install/inportal_schema.sql') ) + { + if(_inst_ModuleLicensed($file)) { + $new[$file] = $inst_file; + } + } + } + } + } + closedir($dir); + } + return array_keys($new); +} + +function GetDirList ($dirName) +{ + + $filedates = array(); + $d = dir($dirName); + + while($entry = $d->read()) + { + if ($entry != "." && $entry != "..") + { + if (!is_dir($dirName."/".$entry)) + { + $filedate[]=$entry; + } + } + } + $d->close(); + return $filedate; +} + +function GetLanguageList() +{ + global $pathtoroot, $admin; + + $packs = array(); + $dir = $pathtoroot.$admin."/install/langpacks"; + $files = GetDirList($dir); + + if(is_array($files)) + { + foreach($files as $f) + { + $p = pathinfo($f); + if($p["extension"]=="lang") + { + $packs[] = $f; + } + } + } + return $packs; +} + +function section_header($title, $return_result = false) +{ + $ret = ''. + '
 '.$title.''. + ''. + "". + '
'; + if( $return_result ) + return $ret; + else + echo $ret; +} + +function &VerifyDB($error_state, $next_state, $success_func = null, $db_must_exist = false) +{ + // perform various check type to database specified + // 1. user is allowed to connect to database + // 2. user has all types of permissions in database + global $state, $db_error; + + // enshure we use data from post & not from config + $GLOBALS['g_DBType'] = $_POST["ServerType"]; + $GLOBALS['g_DBHost'] = $_POST["ServerHost"]; + $GLOBALS['g_DBName'] = $_POST["ServerDB"]; + $GLOBALS['g_DBUser'] = $_POST["ServerUser"]; + $GLOBALS['g_DBUserPassword'] = $_POST["ServerPass"]; + + // connect to database + $ado =& inst_GetADODBConnection(); + if($ado->ErrorNo() != 0) + { + // was error while connecting + $db_error = "Connection Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); + $state = $error_state; + + } + elseif( $ado->ErrorNo() == 0 ) + { + // if connected, then check if all sql statements work + $test_result = 1; + + $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; + $sql_tests[] = 'CREATE TABLE test_table(test_col mediumint(6))'; + $sql_tests[] = 'INSERT INTO test_table(test_col) VALUES (5)'; + $sql_tests[] = 'UPDATE test_table SET test_col = 12'; + $sql_tests[] = 'ALTER TABLE test_table ADD COLUMN new_col varchar(10)'; + $sql_tests[] = 'SELECT * FROM test_table'; + $sql_tests[] = 'DELETE FROM test_table'; + $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; + + foreach($sql_tests as $sql_test) + { + $ado->Execute($sql_test); + if( $ado->ErrorNo()!=0 ) + { + $test_result = 0; + break; + } + } + + if($test_result == 1) + { + // if statements work & connection made, then check table existance + $db_exists = TableExists($ado,"ConfigurationAdmin,Category,Permissions"); + if($db_exists != $db_must_exist) + { + $state = $error_state; + $db_error = $db_must_exist ? 'An In-Portal Database already exists at this location' : 'An In-Portal Database was not found at this location'; + } + else + { + $state = $next_state; + if( isset($success_func) ) $success_func(); + } + } + else + { + // user has insufficient permissions in database specified + $db_error = "Permission Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); + $state = $error_state; + } + } + return $ado; +} + +function SaveDBConfig() +{ + // save new database configuration + set_ini_value("Database", "DBType",$_POST["ServerType"]); + set_ini_value("Database", "DBHost",$_POST["ServerHost"]); + set_ini_value("Database", "DBName",$_POST["ServerDB"]); + set_ini_value("Database", "DBUser",$_POST["ServerUser"]); + set_ini_value("Database", "DBUserPassword",$_POST["ServerPass"]); + set_ini_value("Database","TablePrefix",$_POST["TablePrefix"]); + save_values(); + $GLOBALS['include_file'] = 'install/install_finish.php'; +} + +function ReSetVar($var) +{ + // define varible if not defined before + if( !isset($GLOBALS[$var]) ) $GLOBALS[$var] = ''; +} + +// if globals.php not yet included (1st steps of install), +// then define GetVar function +if( !function_exists('GetVar') ) +{ + function GetVar($name, $post_priority = false) + { + if(!$post_priority) // follow gpc_order in php.ini + return isset($_REQUEST[$name]) ? $_REQUEST[$name] : false; + else // get variable from post 1stly if not found then from get + return isset($_POST[$name]) && $_POST[$name] ? $_POST[$name] : ( isset($_GET[$name]) && $_GET[$name] ? $_GET[$name] : false ); + } +} + +function RadioChecked($name, $value) +{ + // return " checked" word in case if radio is checked + $submit_value = GetVar($name); + return $submit_value == $value ? ' checked' : ''; +} + +?> Index: trunk/kernel/admin_templates/img/toolbar/tool_ban_user_f3.gif =================================================================== diff -u Binary files differ Index: trunk/admin/cat_select.php =================================================================== diff -u -r1510 -r1566 --- trunk/admin/cat_select.php (.../cat_select.php) (revision 1510) +++ trunk/admin/cat_select.php (.../cat_select.php) (revision 1566) @@ -12,6 +12,9 @@ ## result in revocation of the license and support ## ## privileges along maximum prosecution allowed by law. ## ############################################################## + +define('IS_POPUP', 1); + $b_header_addon = "
"; $pathtoroot=""; Index: trunk/kernel/parser.php =================================================================== diff -u -r1471 -r1566 --- trunk/kernel/parser.php (.../parser.php) (revision 1471) +++ trunk/kernel/parser.php (.../parser.php) (revision 1566) @@ -18,20 +18,22 @@ $m_var_list["lang"] = $pieces[2]; $m_var_list["theme"] = $pieces[3]; + $m_var_list['opener']=$pieces[4]; } else { $m_var_list["cat"]=0; $m_var_list["p"] = 1; $m_var_list["lang"] = $objLanguages->GetPrimary(); $m_var_list["theme"]= $objThemes->GetPrimaryTheme(); + $m_var_list['opener']='s'; } } function m_BuildEnv() { global $m_var_list, $m_var_list_update; - $module_vars = Array('cat','p','lang','theme'); + $module_vars = Array('cat','p','lang','theme','opener'); $ret = GenerateModuleEnv('m', $module_vars); if( isset($GLOBALS['m_var_list_update']['cat']) ) unset($GLOBALS['m_var_list_update']['cat']); return $ret; @@ -495,8 +497,14 @@ { $value = inp_htmlize($_POST[$field],1); } - else - $value = inp_htmlize($FormValues[$form][$field], 1); + elseif(getArrayValue($_GET, 'search_type') == 'advanced') + { + $value = ''; + } + else + { + $value = inp_htmlize($FormValues[$form][$field], 1); + } //echo "
"; print_r($FormValues); echo "
"; return $value; } @@ -2063,7 +2071,7 @@ $table = $Item->Get("SourceTable"); //$sql = "SELECT * FROM ".$objSearchConfig->SourceTable." WHERE TableName='$table' AND AdvancedSearch=1 ORDER BY DisplayOrder"; - $sql = "SELECT sc.* FROM ".$objSearchConfig->SourceTable." AS sc LEFT JOIN ".GetTablePrefix()."CustomField AS cf ON sc.CustomFieldId = cf.CustomFieldId WHERE (TableName='$table' OR (TableName='".GetTablePrefix()."CustomField' AND cf.Type = $ItemType)) AND AdvancedSearch=1 ORDER BY sc.DisplayOrder"; + $sql = "SELECT sc.* FROM ".$objSearchConfig->SourceTable." AS sc LEFT JOIN ".GetTablePrefix()."CustomField AS cf ON sc.CustomFieldId = cf.CustomFieldId WHERE (TableName='$table' OR ((TableName='".GetTablePrefix()."CustomField' OR TableName='CustomField') AND cf.Type = $ItemType)) AND AdvancedSearch=1 ORDER BY sc.DisplayOrder"; $objSearchConfig->Query_Item($sql); $row=0; if(is_array($objSearchConfig->Items)) @@ -2469,10 +2477,8 @@ else $cat = $objCatList->CurrentCategoryID(); - if(!strlen($Permission)) - { + //if(!strlen($Permission)) $Permission = strtoupper($attribs["_perm"]); - } $o = ""; $hasperm = FALSE; @@ -2731,24 +2737,22 @@ */ function m_module_stylesheets($attribs) { - global $TemplateRoot; + global $TemplateRoot; - $IncludeList = explode(",",trim($attribs["_modules"])); - $tpath = GetModuleArray("template"); - $ret=''; - for($inc=0;$inc\n"; - } + $require_css = explode(',', trim($attribs['_modules']) ); + $tpath = GetModuleArray('template'); + $ret = ''; + + foreach($require_css as $module_name) + { + $css_attr = '_'.strtolower($module_name).'css'; + $mod_css = getArrayValue($attribs,$css_attr) ? $attribs[$css_attr] : 'style.css'; + $file = $TemplateRoot.getArrayValue($tpath,$module_name).$mod_css; + if( file_exists($file) ) + { + $ret .= ''."\n"; + } + } return $ret; } @@ -3385,7 +3389,11 @@ $objSearchCats->SourceTable = $objSession->GetSearchTable(); $objSearchCats->Clear(); } - + + if( !clsParsedItem::TableExists() ) + { + return 0; + } LoadCatSearchResults($attribs); //echo "
"; print_r($objSearchCats->Items); echo "
"; $ret = 0; @@ -3738,5 +3746,4 @@ $ret = $cat->ParseObject($element); }*/ - ?> Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/general/inp_unit_config_reader.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_new_listing_type_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/config/addtheme.php =================================================================== diff -u -r1074 -r1566 --- trunk/admin/config/addtheme.php (.../addtheme.php) (revision 1074) +++ trunk/admin/config/addtheme.php (.../addtheme.php) (revision 1566) @@ -224,6 +224,28 @@ > + + + + +   + + +> Get("PrimaryTheme") == 1) echo 'checked disabled'; Index: trunk/kernel/admin_templates/img/toolbar/icon16_search_reset.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/selectors/selectors_event_handler.php =================================================================== diff -u --- trunk/kernel/units/selectors/selectors_event_handler.php (revision 0) +++ trunk/kernel/units/selectors/selectors_event_handler.php (revision 1566) @@ -0,0 +1,306 @@ +getObject(); + switch ($event->Special) + { + case 'base': + $object->addFilter('type_filter', '%1$s.Type = 1'); + break; + + case 'block': + $object->addFilter('type_filter', '%1$s.Type = 2'); + break; + } + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + $this->SerializeSelectorData($event); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + $this->SerializeSelectorData($event); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnAfterItemUpdate(&$event) + { + $this->UnserializeSelectorData($event); + } + + /** + * Enter description here... + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + $this->UnserializeSelectorData($event); + } + + /** + * Get's special of main item for linking with subitem + * + * @param kEvent $event + * @return string + */ + function getMainSpecial(&$event) + { + return ''; + } + + /** + * Save css-style name & description before opening css editor + * + * @param kEvent $event + */ + function OnOpenStyleEditor(&$event) + { + $this->SaveChanges($event); + $event->redirect = false; + } + + /** + * Saves Changes to Item + * + * @param kEvent $event + */ + function SaveChanges(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id,$field_values) = each($items_info); + if($id == 0) + { + $parent_id = getArrayValue($field_values,'ParentId'); + if($parent_id) $object->Load($parent_id); + + $object->SetFieldsFromHash($field_values); + $object->Create(); + if( $object->IsTempTable() ) $object->setTempID(); + $this->Application->SetVar($event->getPrefixSpecial().'_id', $object->GetID() ); + } + else + { + $object->Load($id); + $object->SetFieldsFromHash($field_values); + $object->Update(); + } + } + } + + /** + * Save style changes from style editor + * + * @param kEvent $event + */ + function OnSaveStyle(&$event) + { + $this->SaveChanges($event); + + $object =& $event->getObject(); + $this->Application->SetVar($event->getPrefixSpecial().'_id', $object->GetId() ); + + $return_tpl = $object->GetDBField('Type') == 1 ? 'base_style_edit' : 'block_style_edit'; + + $this->finalizePopup($event, 'selectors.base','in-commerce/stylesheets/'.$return_tpl); + } + + /** + * Extract styles + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + $object =& $event->getObject(); + $selector_data = $object->GetDBField('SelectorData'); + if($selector_data) + { + $selector_data = unserialize($selector_data); + $object->SetDBField('SelectorData', $selector_data); + } + else + { + $selector_data = Array(); + } + $this->AddParentProperties($event, $selector_data); + } + + /** + * Serialize item before saving to db + * + * @param kEvent $event + */ + function SerializeSelectorData(&$event) + { + $object =& $event->getObject(); + $selector_data = $object->GetDBField('SelectorData'); + if(!$selector_data) $selector_data = Array(); + + $selector_data = $this->RemoveParentProperties($event, $selector_data); + + if( !IsSerialized($selector_data) ) $selector_data = serialize($selector_data); + + $object->SetDBField('SelectorData', $selector_data); + } + + /** + * Unserialize data back when update was made + * + * @param kEvent $event + */ + function UnserializeSelectorData(&$event) + { + $object =& $event->getObject(); + $selector_data = $object->GetDBField('SelectorData'); + if(!$selector_data) $selector_data = Array(); + if( IsSerialized($selector_data) ) $selector_data = unserialize($selector_data); + + $selector_data = $this->AddParentProperties($event, $selector_data); + + $object->SetDBField('SelectorData', $selector_data); + } + + /** + * Populate options based on temporary table :) + * + * @param kEvent $event + */ + function OnPrepareBaseStyles(&$event) + { + $object =& $event->getObject(); + + $parent_info = $object->getLinkedInfo(); + $title_field = $this->Application->getUnitOption($event->Prefix,'TitleField'); + $sql = 'SELECT '.$title_field.', '.$object->IDField.' FROM '.$object->TableName.' WHERE Type = 1 AND StylesheetId = '.$parent_info['ParentId'].' ORDER BY '.$title_field; + $object->Fields['ParentId']['options'] = array_merge_recursive2($object->Fields['ParentId']['options'], + $this->Conn->GetCol($sql,$object->IDField) ); + } + + /** + * Remove properties of parent style that match by value from style + * + * @param kEvent $event + */ + function RemoveParentProperties(&$event, $selector_data) + { + $object =& $event->getObject(); + $parent_id = $object->GetDBField('ParentId'); + if($parent_id) + { + $sql = 'SELECT SelectorData FROM '.$object->TableName.' WHERE '.$object->IDField.' = '.$parent_id; + $base_selector_data = $this->Conn->GetOne($sql); + + if( IsSerialized($base_selector_data) ) $base_selector_data = unserialize($base_selector_data); + + foreach($selector_data as $prop_name => $prop_value) + { + if( !$prop_value || getArrayValue($base_selector_data,$prop_name) == $prop_value ) + { + unset($selector_data[$prop_name]); + } + } + $object->SetDBField('SelectorData', $selector_data); + return $selector_data; + } + else + { + foreach($selector_data as $prop_name => $prop_value) + { + if(!$prop_value) unset($selector_data[$prop_name]); + } + $object->SetDBField('SelectorData', $selector_data); + return $selector_data; + } + } + + /** + * Add back properties from parent style, that match this style property values + * + * @param kEvent $event + */ + function AddParentProperties(&$event, $selector_data) + { + $object =& $event->getObject(); + $parent_id = $object->GetDBField('ParentId'); + if($parent_id) + { + $sql = 'SELECT SelectorData FROM '.$object->TableName.' WHERE '.$object->IDField.' = '.$parent_id; + $base_selector_data = $this->Conn->GetOne($sql); + + if( IsSerialized($base_selector_data) ) $base_selector_data = unserialize($base_selector_data); + + $selector_data = array_merge_recursive2($base_selector_data,$selector_data); + + $object->SetDBField('SelectorData', $selector_data); + return $selector_data; + } + return $selector_data; + } + + /** + * Reset Style definition to base style -> no customizations + * + * @param kEvent $event + */ + function OnResetToBase(&$event) + { + $object =& $event->getObject(); + $object->SetFieldsFromHash( $this->getSubmittedFields($event) ); + $object->ResetStyle(); + + $event->redirect_params['pass'] = 'all,'.$event->getPrefixSpecial(); + } + + /** + * Resets selected styles properties to values of their base classes + * + * @param kEvent $event + */ + function OnMassResetToBase(&$event) + { + $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); + $object =& $event->getObject(); + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + foreach($items_info as $id => $field_values) + { + $object->Load($id); + $object->ResetStyle(); + } + } + } + } + +?> \ No newline at end of file Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/inp_ses_storage.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/toolbar/tool_search_a_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_user_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_modify.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_rule.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_new.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_sessions_log.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/general/country_states.php =================================================================== diff -u --- trunk/kernel/units/general/country_states.php (revision 0) +++ trunk/kernel/units/general/country_states.php (revision 1566) @@ -0,0 +1,114 @@ +Conn =& $this->Application->GetADODBConnection(); + } + + function CountryHasStates($country_code) + { + return !$country_code ? false : in_array($country_code,$this->CountriesWithStates); + } + + /** + * Prepares states dropdown based on country selected + * + * @param kEvent $event + * @param string $state_field + * @param string $country_field + */ + function PopulateStates(&$event, $state_field, $country_field) + { + $object =& $event->getObject(); + $country_abbr = $object->GetDBField($country_field); + + if (!$country_abbr) return; + $country_id = $this->Conn->GetOne('SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1 AND DestAbbr = '.$this->Conn->qstr($country_abbr)); + if (!$country_id) return; + + $query = + 'SELECT p.Translation as DestName, sd.DestAbbr + FROM '.TABLE_PREFIX.'StdDestinations AS sd + LEFT JOIN '.TABLE_PREFIX.'Phrase AS p + ON p.Phrase = sd.DestName + WHERE + DestType=2 AND DestParentId='.$country_id.' + AND + LanguageId = '.$this->Application->GetVar('m_lang').' + ORDER BY Translation'; + + $states = $this->Conn->GetCol($query, 'DestAbbr'); + $object->Fields[$state_field]['options'] = $states; + $object->Fields[$state_field]['options'][''] = ''; + } + + /** + * Returns valid state code for state name and country code passed + * + * @param string $state_name + * @param string $country_code + * @return string + */ + function CheckState($state_name, $country_code) + { + if( !$this->CountryHasStates($country_code) ) return ''; + + $sql = 'SELECT sdStates.DestAbbr + FROM '.TABLE_PREFIX.'StdDestinations AS sdStates + LEFT JOIN '.TABLE_PREFIX.'Phrase AS p ON p.Phrase = sdStates.DestName + LEFT JOIN '.TABLE_PREFIX.'StdDestinations AS sdCountries ON sdStates.DestParentId = sdCountries.DestId + WHERE (sdStates.DestType = 2) AND + (sdStates.DestParentId = sdCountries.DestId) AND + (p.LanguageId = %1$s) AND + (sdCountries.DestAbbr = %2$s) AND + ( + (LOWER(sdStates.DestAbbr) = %3$s) OR (LOWER(sdStates.DestAbbr2) = %3$s) OR (LOWER(sdStates.DestName) = %3$s) OR (LOWER(p.Translation) = %3$s) + )'; + + $state_name = trim( strtolower($state_name) ); + $sql = sprintf($sql, $this->Application->GetVar('m_lang'), $this->Conn->qstr($country_code), $this->Conn->qstr($state_name) ); + + return $this->Conn->GetOne($sql); + } + + function CheckStateField(&$event, $state_field, $country_field) + { + + $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); + if($items_info) + { + list($id, $field_values) = each($items_info); + if( isset($field_values[$state_field]) && isset($field_values[$country_field]) ) + { + $user_state = getArrayValue($field_values,$state_field); + $valid_state = $this->CheckState($user_state, getArrayValue($field_values,$country_field) ); + if($valid_state !== false) + { + $field_values[$state_field] = $valid_state; + $items_info[$id] = $field_values; + $this->Application->SetVar( $event->getPrefixSpecial(true), $items_info); + } + else + { + $object =& $event->getObject(); + $object->Fields[$state_field]['options'][$user_state] = $user_state; + $object->SetError($state_field, 'invalid_state', 'la_invalid_state'); + } + } + } + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon46_settings_search.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_move_up_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_separ.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_lock.gif =================================================================== diff -u Binary files differ Index: trunk/admin/index4.php =================================================================== diff -u --- trunk/admin/index4.php (revision 0) +++ trunk/admin/index4.php (revision 1566) @@ -0,0 +1,56 @@ +Init(); +$application->Run(); +$application->Done(); + +$end = getmicrotime(); + +if (defined('DEBUG_MODE')) { + echo '

+ + + + + + + + + + +
Memory used:'.round(memory_get_usage()/1024/1024, 1).' MB
Time used:'.round(($end - $start), 5).' sec
'; +} + +function getmicrotime() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +//update_memory_check_script(); + +function update_memory_check_script() { + $files = get_included_files(); + $script = '$files = Array('."\n"; + foreach ($files as $file_name) { + $script .= "\t\t'".str_replace(DOC_ROOT.BASE_PATH, '', $file_name)."',\n"; + } + $script .= ");\n"; + echo "
";
+	echo $script;
+	echo "
"; +} + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_process.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_settings_smiley.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_recalculate_order_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/editor/editor.php =================================================================== diff -u -r719 -r1566 --- trunk/admin/editor/editor.php (.../editor.php) (revision 719) +++ trunk/admin/editor/editor.php (.../editor.php) (revision 1566) @@ -148,8 +148,13 @@ { if (!window.opener.closed) { - bf = window.opener.document.$TargetForm; - current = bf.$TargetField.value; + bf = window.opener.document.$TargetForm; +// if (typeof (bf.$TargetField.value) != 'undefined') { +// current = bf.$TargetField.value; +// } +// else { + current = window.opener.document.getElementById('$TargetField').value; +// } //f = document.getElementById('editform'); d = document.getElementById('Content'); d.value = current; @@ -170,7 +175,15 @@ if (!window.opener) return; if (!window.opener.closed) - bf.$TargetField.value = d.value; + +// if (typeof (bf.$TargetField.value) != 'undefined') { +// current = bf.$TargetField; +// } +// else { + current = window.opener.document.getElementById('$TargetField'); +// } + + current.value = d.value; //alert('Setting bf.$TargetField.value to'+d.value); window.close(); } Index: trunk/kernel/admin_templates/img/icons/icon24_logs_reports.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/smicon3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_more_brackets.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_charge_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reorder_f3.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/adduser_groups.php =================================================================== diff -u -r916 -r1566 --- trunk/admin/users/adduser_groups.php (.../adduser_groups.php) (revision 916) +++ trunk/admin/users/adduser_groups.php (.../adduser_groups.php) (revision 1566) @@ -144,9 +144,11 @@ $objListToolBar->Set("CheckClass",$CheckClass); $objListToolBar->Set("CheckForm",$ListForm); -$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$admin."/users/user_list.php',1);","tool_select.gif"); -$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$admin."/users/user_list.php',2);","tool_cancel.gif"); +$saveURL = $admin."/".$objSession->GetVariable('ReturnScript'); +$objListToolBar->Add("img_save", "la_Save","#","swap('img_save','toolbar/tool_select_f2.gif');", "swap('img_save', 'toolbar/tool_select.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$saveURL."',1);","tool_select.gif"); +$objListToolBar->Add("img_cancel", "la_Cancel","#","swap('img_cancel','toolbar/tool_cancel_f2.gif');", "swap('img_cancel', 'toolbar/tool_cancel.gif');","do_edit_save('save_edit_buttons','UserEditStatus','".$saveURL."',2);","tool_cancel.gif"); + if($itemcount == 1) $objListToolBar->Add("divider"); if ( isset($en_prev) || isset($en_next) ) Index: trunk/kernel/admin_templates/img/icons/icon24_catalog.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_preview_theme_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_process_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_restart_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_search_reset.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/master_card.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_theme_f2.gif =================================================================== diff -u Binary files differ Index: trunk/admin/browse/fw_menu.js =================================================================== diff -u -r1335 -r1566 --- trunk/admin/browse/fw_menu.js (.../fw_menu.js) (revision 1335) +++ trunk/admin/browse/fw_menu.js (.../fw_menu.js) (revision 1566) @@ -51,19 +51,36 @@ this.hideMenu = hideMenu; this.hideChildMenu = hideChildMenu; + label = RemoveTranslationLink(label); if (!window.menus) window.menus = new Array(); this.label = label || "menuLabel" + window.menus.length; window.menus[this.label] = this; window.menus[window.menus.length] = this; if (!window.activeMenus) window.activeMenus = new Array(); } -function addMenuItem(label, action, type) { - this.items[this.items.length] = label; - this.actions[this.actions.length] = action; - if (type == 1) this.types[this.types.length] = this.imagePath+"check_on.gif"; - if (type == 2) this.types[this.types.length] = this.imagePath+"menu_dot.gif"; - if ((type!=1) && (type !=2)) this.types[this.types.length] = ""; +function RemoveTranslationLink($string) +{ + return $string.match(/(.*)<\/a>/) ? RegExp.$2 : $string; +} + +function addMenuItem(label, action, type) +{ + if( typeof(label) == 'string' ) label = RemoveTranslationLink(label); + if( isset(type) ) type = parseInt(type); + this.items[this.items.length] = label; + this.actions[this.actions.length] = action; + switch(type) + { + case 1: + this.types[this.types.length] = this.imagePath+'check_on.gif'; + break; + case 2: + this.types[this.types.length] = this.imagePath+'menu_dot.gif'; + break; + default: + this.types[this.types.length] = ''; + } } function addMenuSeparator() { Index: trunk/themes/default/img/act_recommend.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/icon16_search.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_cat_deleted.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_site.gif =================================================================== diff -u Binary files differ Index: trunk/admin/icons/icon46_list_settings_contacts.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_community.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_restart.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reset_to_base_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/email_messages/email_messages_event_handler.php =================================================================== diff -u --- trunk/kernel/units/email_messages/email_messages_event_handler.php (revision 0) +++ trunk/kernel/units/email_messages/email_messages_event_handler.php (revision 1566) @@ -0,0 +1,138 @@ +getEmailEventId(); + $object =& $event->getObject(); + + $parent_info = $object->getLinkedInfo(); + + $sql = 'SELECT '.$object->IDField.' FROM '.$object->TableName.' WHERE ('.$parent_info['ForeignKey'].' = '.$parent_info['ParentId'].') AND (EventId = '.$email_event_id.')'; + + $id = (int)$this->Conn->GetOne($sql); + if(!$id) + { + $object->SetDBField('EventId', $email_event_id); + $object->SetDBField('Headers', $this->Application->ConfigValue('Smtp_DefaultHeaders') ); + } + return $id; + } + + function getEmailEventId() + { + return parent::getPassedID( new kEvent('emailevents:OnDummy') ); + } + + /** + * If loading empty item, then set parent id + * + * @param kEvent $event + */ + function OnBeforeItemLoad(&$event) + { + if( !$event->getEventParam('id') ) + { + $this->OnNew($event); + $event->status = erFATAL; + } + } + + + /** + * Parse message template (split into header, subject & body) + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + $object =& $event->getObject(); + + $lines = explode("\n", $object->GetDBField('Template') ); + + $headers = Array(); + + foreach($lines as $line) + { + if( strlen(trim($line)) == 0 || ($line == '.') ) break; + + $parts = explode(':', $line, 2); + if(strtolower($parts[0]) == 'subject') + { + $object->SetDBField('Subject', trim($parts[1]) ); + } + else + { + $headers[] = $line; + } + } + $object->SetDBField('Headers', implode("\n", $headers) ); + + $message_body = ''; + while( (list($line_id,$line) = each($lines)) ) + { + $message_body .= $line; + } + $object->SetDBField('Body', $message_body); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + $this->parseVirtualFields($event); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + $this->parseVirtualFields($event); + } + + /** + * Merge body+subject+headers into message template + * + * @param kEvent $event + */ + function parseVirtualFields(&$event) + { + $object =& $event->getObject(); + if( $object->GetDBField('Headers') || $object->GetDBField('Subject') || $object->GetDBField('Body') ) + { + $ret = $object->GetDBField('Headers'); + if($ret) $ret .= "\n"; + + $ret = $this->removeTrailingCRLF($ret); + $ret .= 'Subject: '.$object->GetDBField('Subject')."\n\n"; + $ret .= $object->GetDBField('Body'); + $object->SetDBField('Template', $ret); + } + } + + /** + * Remove trailing CR/LF chars from string + * + * @param string $string + * @return string + */ + function removeTrailingCRLF($string) + { + return preg_replace('/(\n|\r)+/',"\\1",$string); + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_rule_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_hot.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_search_log.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/languages/languages_tag_processor.php =================================================================== diff -u --- trunk/core/units/languages/languages_tag_processor.php (revision 0) +++ trunk/core/units/languages/languages_tag_processor.php (revision 1566) @@ -0,0 +1,61 @@ +Application->GetVar('phrases_label'); + + $top_prefix = $this->Application->GetTopmostPrefix($this->Prefix); + if( $this->Application->GetVar($top_prefix.'_mode') == 't' && !$edit_direct ) + { + $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + return $object->GetDBField('Charset'); + } + $lang_current =& $this->Application->recallObject('lang.current'); + return $lang_current->GetDBField('Charset'); + } + + function ListLanguages($params) + { + $this->Special = 'list'; + return $this->PrintList2($params); + } + + function SelectedLanguage($params) + { + $object =& $this->Application->recallObject($this->getPrefixSpecial()); + + return $object->GetDBField('LanguageId') == $this->Application->RecallVar('m_lang'); + } + + /** + * Returns path where exported languages should be saved + * + * @param unknown_type $params + */ + function ExportPath($params) + { + $admin_folder = $this->Application->ConfigValue('AdminDirectory'); + if(!$admin_folder) $admin_folder = 'admin'; + $ret = DOC_ROOT.BASE_PATH.'/'.$admin_folder.'/export/'; + + if( getArrayValue($params,'as_url') ) + { + $ret = str_replace( DOC_ROOT.BASE_PATH.'/', $this->Application->BaseURL(), $ret); + } + return $ret; + } + + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_paymenttype_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_shipping.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_pop.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_language_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_homecat.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/config_general/config_general_tag_processor.php =================================================================== diff -u --- trunk/kernel/units/config_general/config_general_tag_processor.php (revision 0) +++ trunk/kernel/units/config_general/config_general_tag_processor.php (revision 1566) @@ -0,0 +1,95 @@ +Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List',$params); +/* $prefix_special = $this->getPrefixSpecial(); + + if ( !($list->OriginalParams == $params) ) { + $this->Application->removeObject($prefix_special); + $list =& $this->Application->recallObject($prefix_special,$this->Prefix.'_List',$params); + } + */ + $id_field = $this->Application->getUnitOption($this->Prefix,'IDField'); + + $list->PerPage=-1; + $list->Query(); + $o = ''; + $list->GoFirst(); + + $block_params=$this->prepareTagParams($params); + $block_params['name']=$params['block']; + $block_params['pass_params']='true'; + $block_params['IdField'] = $id_field; + + while (!$list->EOL()) + { + $stored_cat=$this->Application->RecallVar("StoredRootCatId", ""); + if ($stored_cat!=""){ + $list->Records[$list->CurrentIndex]["RootCat"]=$stored_cat; + } + $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); + $o.= $this->Application->ParseBlock($block_params, 1); + $list->GoNext(); + } + + $this->Application->SetVar( $this->getPrefixSpecial().'_id', ''); + $this->Application->RemoveVar("StoredRootCatId"); + return $o; + } + + function CategoryPath($params) + { + $object=&$this->Application->recallObject("confg"); + $root_cat=$object->GetDBField("RootCat"); + + if (!isset($params['cat_id'])){ + $stored_cat=$this->Application->RecallVar("StoredRootCatId", ""); + if ($stored_cat){ + $params['cat_id'] = $stored_cat; + }else{ + $params['cat_id'] = $root_cat; + } + } + + + $block_params['current'] = 1; + + $block_params['separator'] = $params['separator']; + if($params['cat_id'] == 0) + { + $block_params['name'] = $params['rootcatblock']; + return $this->Application->ParseBlock($block_params); + } + else + { + $cat_object = $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List' ); + $sql = 'SELECT CategoryId, ParentId, Name FROM '.TABLE_PREFIX.'Category WHERE CategoryId='.$params['cat_id']; + $res = $this->Conn->GetRow($sql); + $block_params['name'] = $params['block']; + $block_params['cat_name'] = $res['Name']; + $block_params['separator'] = $params['separator']; + $block_params['cat_id'] = $res['CategoryId']; + $next_params['separator'] = $params['separator']; + $next_params['rootcatblock'] = $params['rootcatblock']; + $next_params['block'] = $params['block']; + $next_params['cat_id'] = $res['ParentId']; + return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); + } + } + function SaveWarning($params){ + + $object=&$this->Application->recallObject($this->getPrefixSpecial()); + $root_cat=$object->GetDBField("RootCat"); + $stored_cat=$this->Application->RecallVar("StoredRootCatId", ""); + + if ($stored_cat!="" && $stored_cat!=$root_cat){ + return $this->Application->ParseBlock($params); + } + return ""; + } +} + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_item_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/incs/form_blocks.tpl (revision 0) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (revision 1566) @@ -0,0 +1,233 @@ + + + + + + +
+ .gif" align="absmiddle" title=""> 
+
+
+ + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + "> + + +   + + + + + + + + + + + "> + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + +   + + + + + "> + + + " id="" tabindex="" size="" class=""> + +   + + + + + "> + + error"> + *:
+
', '', 'popups/translator');" title=""> + + + " id="" value="" tabindex="" size="" maxlength="" class="" onblur=""> + +   + + + + + " id="" value=""> + + + + + + + + "> + + + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> () + + " id="" value=""> + +   + + + + + + + + + + "> + + + + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> + () + +  " id="" value="" tabindex="" size="" class=""> () + +   + + + + + "> + + error"> + *:
+ ');"> + + + + +   + + + + + + "> + + + " id="" value="" tabindex="" size="" class=""> + ');"> + + + +   + + + + + + + + + + + + + + "> + + + + +   + + + + + name="" id="_" value="">  + + + + name="[]" id="_" value="">  + + + + "> + + + + +   + + + + + "> + + + " name="" value=""> + " type="checkbox" id="_cb_" name="_cb_" class="" onclick="update_checkbox(this, document.getElementById(''))" onchange=""> + +   + + + + + "> + + + + + + + + +   + + \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_option.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_permission_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/sort_desc.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/units/themes/themes_config.php =================================================================== diff -u --- trunk/kernel/units/themes/themes_config.php (revision 0) +++ trunk/kernel/units/themes/themes_config.php (revision 1566) @@ -0,0 +1,78 @@ + 'theme', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'InpDBEventHandler','file'=>'','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'ThemesTagProcessor','file'=>'themes_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'Hooks' => Array(), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'mode', + ), + 'IDField' => 'ThemeId', + + 'StatusField' => Array('Enabled','Primary'), + + 'TitleField' => 'Name', + + 'TableName' => TABLE_PREFIX.'Theme', + 'SubItems' => Array('themefiles'), + + 'FilterMenu' => Array( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER), + ), + + 'Filters' => Array( + 0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ), + 1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ), + ) + ), + + 'AutoDelete' => true, + 'AutoClone' => true, + + 'ListSQLs' => Array( ''=>'SELECT * FROM %s', + ), // key - special, value - list select sql + 'ItemSQLs' => Array( ''=>' SELECT %1$s.*, style.LastCompiled, style.Name AS StyleName + FROM %s + LEFT JOIN '.TABLE_PREFIX.'Stylesheets style ON style.StylesheetId = %1$s.StylesheetId', + ), + 'ListSortings' => Array( + '' => Array( + 'Sorting' => Array('Name' => 'asc'), + ) + ), + 'Fields' => Array( + 'ThemeId' => Array(), + 'Name' => Array('type' => 'string','not_null' => '1','default' => ''), + 'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1=>'la_Enabled', 0=>'la_Disabled'), 'use_phrases'=>1, 'not_null' => '1','default' => '1'), + 'Description' => Array('type' => 'string','default' => ''), + 'PrimaryTheme' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'CacheTimeout' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'StylesheetId' => Array('type' => 'int','not_null' => '1','default' => '0'), + ), + + 'VirtualFields' => Array( + 'LastCompiled' => Array('type'=>'int', 'formatter'=>'kDateFormatter' ), + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif',0=>'icon16_style_disabled.gif',1=>'icon16_style.gif'), + 'Fields' => Array( + 'Name' => Array( 'title'=>'la_col_Name', 'data_block' => 'grid_checkbox_td'), + 'Description' => Array( 'title'=>'la_col_Description', 'data_block' => 'grid_description_td' ), + 'Enabled' => Array( 'title'=>'la_col_Status' ), + ), + + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/tab_active_back.jpg =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_restore.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_stop.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/old/menu_reset.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_tool_backup.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_apply_rules_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_print.gif =================================================================== diff -u Binary files differ Index: trunk/admin/users/user_list.php =================================================================== diff -u -r1462 -r1566 --- trunk/admin/users/user_list.php (.../user_list.php) (revision 1462) +++ trunk/admin/users/user_list.php (.../user_list.php) (revision 1566) @@ -102,6 +102,9 @@ $pathtolocal = $pathtoroot; + +$objSession->SetVariable('ReturnScript', 'users/'.basename($_SERVER['PHP_SELF']) ); + /* -------------------------------------- Section configuration ------------------------------------------- */ $section = 'in-portal:user_list'; $envar = "env=" . BuildEnv(); Index: trunk/kernel/admin_templates/img/icons/icon46_settings_smiley.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/core/units/general/general_config.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/help.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/help.tpl (revision 0) +++ trunk/kernel/admin_templates/help.tpl (revision 1566) @@ -0,0 +1,41 @@ + + + + + + + + + + +
+ .gif" align="absmiddle" title=""> 
+
+
+ + + + + + + + +
+ + +
+ + + + + + + + + +
+ +
+ + + \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_primary_image_f2.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/config_search/config_search_config.php =================================================================== diff -u --- trunk/core/units/config_search/config_search_config.php (revision 0) +++ trunk/core/units/config_search/config_search_config.php (revision 1566) @@ -0,0 +1,99 @@ + 'confs', + 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), + 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), + 'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'), + 'TagProcessorClass' => Array('class'=>'ConfigSearchTagProcessor','file'=>'config_search_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + 'hooks' => Array(), + 'QueryString' => Array( + 1 => 'id', + 2 => 'page', + 3 => 'event', + 4 => 'module', + 5 => 'section', + ), + + 'Hooks' => Array( + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'cf', + 'HookToSpecial' => '', + 'HookToEvent' => Array( 'OnSave' ), + 'DoPrefix' => 'confs', + 'DoSpecial' => '', + 'DoEvent' => 'OnCreateCustomField', + ), + Array( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => 'cf', + 'HookToSpecial' => '-item', + 'HookToEvent' => Array( 'OnAfterItemDelete' ), + 'DoPrefix' => 'confs', + 'DoSpecial' => '', + 'DoEvent' => 'OnDeleteCustomField', + ), + ), + + 'IDField' => 'SearchConfigId', + + 'TitlePresets' => Array( + 'config_list' => Array('prefixes' => Array('confs_List'), 'format' => "!la_updating_config!"), + ), + + 'TableName' => TABLE_PREFIX.'SearchConfig', + + 'ListSQLs' => Array(''=>'SELECT *, IF('.TABLE_PREFIX.'SearchConfig.CustomFieldId=0, 0, 1) AS IsCustom FROM '.TABLE_PREFIX.'SearchConfig'), + + 'ItemSQLs' => Array(''=>'SELECT * FROM '.TABLE_PREFIX.'SearchConfig'), + + 'SubTables' => Array(), + + 'Fields' => Array( + 'TableName' => Array('type' => 'string','not_null' => '1','default' => ''), + 'FieldName' => Array('type' => 'string','not_null' => '1','default' => ''), + 'SimpleSearch' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'AdvancedSearch' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'Description' => Array('type' => 'string','default' => ''), + 'DisplayName' => Array('type' => 'string','default' => ''), + 'ModuleName' => Array('type' => 'string','default' => ''), + 'ConfigHeader' => Array('type' => 'string','default' => ''), + 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'SearchConfigId' => Array('type' => 'int','not_null' => '1','default' => ''), + 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'), + 'FieldType' => Array('type' => 'string','not_null' => '1','default' => 'text'), + 'ForeignField' => Array('type' => 'string','default' => ''), + 'JoinClause' => Array('type' => 'string','default' => ''), + 'IsWhere' => Array('type' => 'string','default' => ''), + 'IsNotWhere' => Array('type' => 'string','default' => ''), + 'ContainsWhere' => Array('type' => 'string','default' => ''), + 'NotContainsWhere' => Array('type' => 'string','default' => ''), + 'CustomFieldId' => Array('type' => 'int','not_null' => '1','default' => '0'), + ), + + 'VirtualFields' => Array(), + + 'ListSortings' => Array( + '' => Array( + 'ForcedSorting' => Array('IsCustom' => 'asc'), + 'Sorting' => Array('DisplayOrder' => 'asc'), + ) + ), + + 'Grids' => Array( + 'Default' => Array( + 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used + 'Fields' => Array( + 'TableName' => Array( 'title'=>'la_col_TableName', 'data_block' => 'grid_data_td'), + 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_data_td' ), + 'SimpleSearch' => Array( 'title'=>'la_col_SimpleSearch', 'data_block' => 'grid_data_td'), + ), + ), + ), + ); + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/icons/icon46_list_struct.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_catalog.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_conf_regional.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/config.php =================================================================== diff -u -r1462 -r1566 --- trunk/kernel/include/config.php (.../config.php) (revision 1462) +++ trunk/kernel/include/config.php (.../config.php) (revision 1566) @@ -56,7 +56,18 @@ function Get($property) { - return isset($this->config[$property]) ? $this->config[$property] : ''; + if( isset($this->config[$property]) ) + { + return $this->config[$property]; + } + elseif( isset($this->config[ strtolower($property)] ) ) + { + return $this->config[ strtolower($property) ]; + } + else + { + return ''; + } } function Set($property, $value,$type=0,$force=FALSE) @@ -186,6 +197,8 @@ var $NextItem=NULL; var $Section; + var $TabIndex = 0; + function clsConfigAdminItem($config_name=NULL) { $this->adodbConnection = &GetADODBConnection(); @@ -254,118 +267,92 @@ return $string; } - function ItemFormElement($StartFrom=1) - { - global $objConfig; - static $TabIndex; + function ItemFormElement($StartFrom=1) + { + global $objConfig; - if (empty($TabIndex)) - $TabIndex = $StartFrom; + if(!$this->TabIndex) $this->TabIndex = $StartFrom; - $o = ""; - if($objConfig->Get($this->name)!="") - $this->default_value = $objConfig->Get($this->name); - $this->default_value=inp_htmlize($this->default_value); - switch($this->ElementType) - { - case "text": - $o .= "name."\" "; - $o .= "VALUE=\"".$this->default_value."\">"; - break; - case "checkbox": - $o .= "name."\" tabindex=\"".($TabIndex++)."\""; - if($this->default_value) - { - $o .= " CHECKED>"; - } - else - $o .= ">"; - - break; - case "password": - - /* To exclude config form from populating with Root (md5) password */ - if ($this->Section == "in-portal:configure_users") - $this->default_value = ""; + $o = ''; + if( $objConfig->Get($this->name) != '' ) + { + $this->default_value = $objConfig->Get($this->name); + } + $this->default_value = inp_htmlize($this->default_value); + switch($this->ElementType) + { + case 'text': + $o .= 'default_value.'">'; + break; + + case 'checkbox': + $o .= 'default_value ? ' checked>' : '>'; + break; + + case 'password': + /* To exclude config form from populating with Root (md5) password */ + if( $this->Section == 'in-portal:configure_users' ) $this->default_value = ''; - $o .= "name."\" "; - $o .= "VALUE=\"".$this->default_value."\">"; - break; - case "textarea": - $o .= ""; - break; - case "label": - if($this->default_value) - { - $o .= $this->default_value; - } - break; - case "radio": - $radioname = $this->name; - - $ValList = $this->replace_sql($this->ValueList); + $o .= 'default_value.'">'; + break; + + case 'textarea': + $o .= ''; + break; + + case 'label': + if($this->default_value) $o .= $this->default_value; + break; + + case 'radio': + $radioname = $this->name; + $ValList = $this->replace_sql($this->ValueList); - $TabIndex++; - $localTabIndex = $TabIndex; - $TabIndex++; - - $val = explode(",",$ValList); - for($i=0;$i<=count($val);$i++) - { - if(strlen($val[$i])) - { - $parts = explode("=",$val[$i]); - $s = $parts[1]; - if(strlen($s)==0) - $s=""; - - $o .= "name."\" VALUE=\"".$parts[0]."\""; - if($this->default_value==$parts[0]) - { - $o .= " CHECKED>"; - } - else - $o .= ">"; - if(substr($s,0,1)=="+") - { - $o .= $s; - } - else - $o .= prompt_language($s); - } - } - - break; - case "select": - $o .= ""; - } - return $o; - } + $this->TabIndex++; + $val = explode(',',$ValList); + for($i=0;$i<=count($val);$i++) + { + if(strlen($val[$i])) + { + $parts = explode('=',$val[$i]); + $s = $parts[1]; + if(strlen($s)==0) + $s = ''; + $o .= 'default_value == $parts[0]) ? ' checked>' : '>'; + + $o .= (substr($s,0,1)=="+") ? $s : prompt_language($s); + } + } + $this->TabIndex++; + break; + + case 'select': + $o .= ''; + break; + } + return $o; + } function GetPrompt() { Index: trunk/kernel/units/modules/modules_event_handler.php =================================================================== diff -u --- trunk/kernel/units/modules/modules_event_handler.php (revision 0) +++ trunk/kernel/units/modules/modules_event_handler.php (revision 1566) @@ -0,0 +1,36 @@ +Application->SetVar($this->Prefix."_".$event->Special."_id", $event->Special); + parent::OnItemBuild($event); + } + + function SetCustomQuery(&$event){ + $object=&$event->getObject(); + $object->addFilter("current_module", "Name=".$event->Special); + + } + +} + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_cut.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_usergroups.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/bg1.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_conf.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/include/itemdb.php =================================================================== diff -u -r1442 -r1566 --- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 1442) +++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 1566) @@ -626,7 +626,7 @@ function TableExists($table = null) { // checks if table specified in item exists in db - $db =& $this->adodbConnection; + $db =& GetADODBConnection(); $sql = "SHOW TABLES LIKE '%s'"; if($table == null) $table = $this->tablename; $rs = $db->Execute( sprintf($sql, $table) ); Index: trunk/kernel/admin_templates/img/tab_active_back3.jpg =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_ban_user_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_conf_general.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/ic_myorders46.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_delete.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_relation_one-way.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_validate_f3.gif =================================================================== diff -u Binary files differ Index: trunk/themes/default/img/cube2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/incs/grid_blocks.tpl (revision 0) +++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (revision 1566) @@ -0,0 +1,233 @@ + + + + + + ', )" class="nav_url"> + + + + ', )" class="nav_url">> + + + + ', )" class="nav_url">< + + + + ', )" class="nav_url">>> + + + + ', )" class="nav_url"><< + + + + +tableborder_full_kernelpagination_bar"> + + + + + + + + +
+ + + + + + + + + + +
_search_keyword" + name="_search_keyword" + value="" + PrefixSpecial="" + Grid="" + style="border: 1px solid grey;"> + + +
+
+
+ + + + + ','');" class="columntitle_small">.gif" border="0" align="absmiddle"> + + + + + + + + + + + + " id=""> + ">  + + + + + + + " id=""> + ">  + + + + + + + ">  + + + + + + + " id=""> + ">  + + + + + + + + + + " name="" value=""> + + + + + + + + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","");','2'); + + + + $Menus[''+'_filter_menu'].addMenuItem('','',''); + + + + $Menus[''+'_filter_menu'].addMenuSeparator(); + + + + // define ViewMenu + $fw_menus[''+'_view_menu'] = function() + { + + // filtring menu + $Menus[''+'_filter_menu'] = new Menu(''); + $Menus[''+'_filter_menu'].addMenuItem('All','filters_remove_all("");'); + $Menus[''+'_filter_menu'].addMenuItem('None','filters_apply_all("");'); + $Menus[''+'_filter_menu'].addMenuSeparator(); + + + + // sorting menu + $Menus[''+'_sorting_menu'] = new Menu(''); + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","asc");','2'); + $Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","desc");','2'); + $Menus[''+'_sorting_menu'].addMenuSeparator(); + $Menus[''+'_sorting_menu'].addMenuItem('','reset_sorting("");'); + + + // per page menu + $Menus[''+'_perpage_menu'] = new Menu(''); + $Menus[''+'_perpage_menu'].addMenuItem('10','set_per_page("",10);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('20','set_per_page("",20);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('50','set_per_page("",50);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('100','set_per_page("",100);','2'); + $Menus[''+'_perpage_menu'].addMenuItem('500','set_per_page("",500);','2'); + + // select menu + $Menus[''+'_select_menu'] = new Menu(''); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].SelectAll();'); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].ClearSelection();'); + $Menus[''+'_select_menu'].addMenuItem('','Grids[""].InvertSelection();'); + + $Menus[''+'_view_menu'] = new Menu(''); + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_filter_menu'] ); + + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_sorting_menu'] ); + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_perpage_menu'] ); + $Menus[''+'_view_menu'].addMenuItem( $Menus[''+'_select_menu'] ); + } + + + + nobottomnotop"> + + + +
+ +
+ + + + + + nobottomnotop"> + + + +
+ +
+ + + + + + + + + + + + " id="_" sequence=""> + + + + + + +
+ + + + + + + + _Sort1" name="_Sort1" value=""> + _Sort1_Dir" name="_Sort1_Dir" value="asc"> + \ No newline at end of file Index: trunk/kernel/admin_templates/img/itemicons/icon16_user.gif =================================================================== diff -u Binary files differ Index: trunk/core/units/themes/themes_tag_processor.php =================================================================== diff -u --- trunk/core/units/themes/themes_tag_processor.php (revision 0) +++ trunk/core/units/themes/themes_tag_processor.php (revision 1566) @@ -0,0 +1,42 @@ +Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); + + $css_url = $this->Application->BaseURL('/kernel/stylesheets'); + $css_path = rtrim( str_replace( $this->Application->BaseURL(), DOC_ROOT.BASE_PATH.'/', $css_url), '/' ); + + $last_compiled = $object->GetDBField('LastCompiled'); + + $style_name = strtolower( $object->GetDBField('StyleName') ); + + if( file_exists($css_path.'/'.$style_name.'-'.$last_compiled.'.css') ) + { + $ret = $css_url.'/'.$style_name.'-'.$last_compiled.'.css'; + + } + elseif( $this->Application->isDebugMode() ) + { + $last_compiled = 0; + if( $dh = opendir($css_path) ) + { + while( ($file = readdir($dh)) !== false ) + { + if( preg_match('/(.*)-([\d]+).css/', $file, $rets) ) + { + if( $rets[1] == $style_name && $rets[2] > $last_compiled ) $last_compiled = $rets[2]; + } + } + closedir($dh); + } + if($last_compiled) $ret = $css_url.'/'.$style_name.'-'.$last_compiled.'.css'; + } + + return ''; + } + } + +?> \ No newline at end of file Index: trunk/kernel/admin_templates/img/ic_pick.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/in-link/icon16_link_pending.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/incs/close_popup.tpl =================================================================== diff -u --- trunk/kernel/admin_templates/incs/close_popup.tpl (revision 0) +++ trunk/kernel/admin_templates/incs/close_popup.tpl (revision 1566) @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file Index: trunk/kernel/admin_templates/img/toolbar/tool_new_user_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_paste_f3.gif =================================================================== diff -u Binary files differ Index: trunk/admin/browse/checkboxes_new.js =================================================================== diff -u -r342 -r1566 --- trunk/admin/browse/checkboxes_new.js (.../checkboxes_new.js) (revision 342) +++ trunk/admin/browse/checkboxes_new.js (.../checkboxes_new.js) (revision 1566) @@ -11,6 +11,9 @@ var start_tab = null; var selcount = 0; +// ActiveTab +var activeTab; + var _single_select = false; function initCheckBoxes(selChangedHandler, use_cats) @@ -81,7 +84,6 @@ document.body.onclick = function(e) { - //alert('body click'); var srcElement = (document.all) ? event.srcElement : e.target; if (!srcElement) return; if (srcElement.onclick || srcElement.onmousedown || srcElement.onmouseup) return; @@ -461,10 +463,10 @@ changeSelection(tabId, 0); } -function unselectAll(tabId) +function unselectAll(tabId, dont_update) { selcount = 0; - changeSelection(tabId, 1); + changeSelection(tabId, 1, dont_update); LastCheckedItem = null; } @@ -482,7 +484,7 @@ changeSelection(tabId, 2); } -function changeSelection(tabId, action) +function changeSelection(tabId, action, dont_update) { if (selcount == 0) { selcount++; @@ -491,13 +493,21 @@ { var tab = document.getElementById(tabId); if (!tab) return; + actPrefix = tab.getAttribute("ActionPrefix"); + if ( typeof (actPrefix) != 'undefined' && actPrefix != null && actPrefix.match("k4:(.*)") ) { + act = RegExp.$1; + act = act.replace('$\$event$$', 'unselect'); + eval(act); + return; + } + var inputs = tab.getElementsByTagName("INPUT"); //alert(inputs.length); for (var j = 0; j < inputs.length; j++) { //alert(inputs[j].type + ' ' + inputs[j].name + ' ' + inputs[j].inportalType); if ((inputs[j].type == "checkbox" || inputs[j].type == "radio") && (inputs[j].inportalType)) { - //alert('will do'); + //alert('will do '+action); switch (action) { case (0) : @@ -513,6 +523,7 @@ } } + if (typeof(dont_update) != 'undefined') return; selectionChanged(); } } @@ -559,7 +570,6 @@ { setTimeout('selectionChangedA()', 0) } -var activeTab; function TabPasteEnabled(TabTitle) { @@ -588,14 +598,28 @@ if (thisTab.active) { activeTab = thisTab; - activeTab.title = getTabTitle(tabIDs[i]); + activeTab.title = getTabTitle(tabIDs[i]); +// alert('got: '+ tabIDs[i]); break; } } var numCategoriesSelected = tabSelection['categories']; - var numActiveTabSelected = (activeTab) ? tabSelection[activeTab.id] : 0; - + if(activeTab) + { + actPrefix = activeTab.getAttribute("ActionPrefix"); + if ( typeof (actPrefix) != 'undefined' && actPrefix != null && actPrefix.match("k4:(.*)") ) + { + var numActiveTabSelected = 0; + } + else + { + var numActiveTabSelected = (activeTab) ? tabSelection[activeTab.id] : 0; + } + } +// +// alert('active sel: '+numActiveTabSelected); + if(toolbar) { //toolbar.enableButton("edit", (numCategoriesSelected + numActiveTabSelected == 1)); Index: trunk/kernel/admin_templates/img/icons/icon46_list_manufacturers.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/itemicons/icon16_language.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_orders.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon24_modules.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_cat_settings.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_settings_general.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_export_language_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/smicon2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_review_f3.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/icons/icon46_list_discounts.gif =================================================================== diff -u Binary files differ Index: trunk/admin/editor/inp_fckconfig.js =================================================================== diff -u --- trunk/admin/editor/inp_fckconfig.js (revision 0) +++ trunk/admin/editor/inp_fckconfig.js (revision 1566) @@ -0,0 +1,130 @@ +/* + * Edited by Kostja + * FCKeditor - The text editor for internet + * Copyright (C) 2003-2004 Frederico Caldeira Knabben + * + * Licensed under the terms of the GNU Lesser General Public License: + * http://www.opensource.org/licenses/lgpl-license.php + * + * For further information visit: + * http://www.fckeditor.net/ + * + * File Name: fckconfig.js + * Editor configuration settings. + * See the documentation for more info. + * + * Version: 2.0 RC3 + * Modified: 2005-02-27 21:31:48 + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) +*/ + +FCKConfig.CustomConfigurationsPath = '' ; + +FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; + +FCKConfig.BaseHref = '' ; + +FCKConfig.FullPage = false ; + +FCKConfig.Debug = false ; + +FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; + +FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; + +// FCKConfig.Plugins.Add( 'placeholder', 'en,it' ) ; + +FCKConfig.AutoDetectLanguage = true ; +FCKConfig.DefaultLanguage = 'en' ; +FCKConfig.ContentLangDirection = 'ltr' ; + +FCKConfig.EnableXHTML = true ; +FCKConfig.EnableSourceXHTML = true ; + +FCKConfig.FillEmptyBlocks = true ; + +FCKConfig.FormatSource = true ; +FCKConfig.FormatOutput = true ; +FCKConfig.FormatIndentator = ' ' ; + +FCKConfig.GeckoUseSPAN = true ; +FCKConfig.StartupFocus = false ; +FCKConfig.ForcePasteAsPlainText = true ; +FCKConfig.ForceSimpleAmpersand = false ; +FCKConfig.TabSpaces = 0; + +FCKConfig.ShowBorders = true; +FCKConfig.ShowTableBorders = true; + +FCKConfig.UseBROnCarriageReturn = false ; +FCKConfig.ToolbarStartExpanded = true ; +FCKConfig.ToolbarCanCollapse = true ; +//FCKConfig.ProjectPath = FCKConfig.BasePath.replace(/\/cmseditor\/editor\/$/,''); +FCKConfig.IconImagesUrl = FCKConfig.ProjectPath+'kernel/user_files/icons'; + + +FCKConfig.ToolbarSets["Default"] = [ + ['Cut','Copy','Paste','PasteText','PasteWord','NewPage','SelectAll','-','Link','Unlink','Anchor','-','Image','SpecialChar','-','Find','Replace','-','Rule'], + ['Source'], + '/', + ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','Outdent','Indent'], + '/', + ['Style','RemoveFormat'] +] ; + +FCKConfig.ToolbarSets["Advanced"] = [ + ['Cut','Copy','Paste','PasteText','PasteWord','-','NewPage','SelectAll','-','Find','Replace','-','Print','Preview','-','Link','Unlink','Anchor','Rule','-','Image','Document','Table','SpecialChar'], + '/', + ['Bold','Italic','Underline','StrikeThrough','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull','-','OrderedList','UnorderedList','Outdent','Indent','-','Subscript','Superscript','-','TextColor','BGColor','-','Undo','Redo'], + '/', + ['Style','FontName','FontSize','RemoveFormat','-','SpellCheck','100%','|','Source'] +] ; + +FCKConfig.ToolbarSets["Basic"] = [ + ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] +] ; + + +FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Select','Document','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','TableCell','Table','Form'] ; + +FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; + +FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; +FCKConfig.FontSizes = '1/xx-small;2/x-small;3/small;4/medium;5/large;6/x-large;7/xx-large' ; +FCKConfig.FontFormats = 'p;div;pre;address;h1;h2;h3;h4;h5;h6' ; + +FCKConfig.StylesXmlPath = '../fckstyles.xml' ; + +FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages' +FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/rel/ieSpellSetup211325.exe' ; + +FCKConfig.LinkBrowser = true ; +FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ; +FCKConfig.LinkBrowserWindowWidth = screen.width * 0.7 ; // 70% +FCKConfig.LinkBrowserWindowHeight = screen.height * 0.7 ; // 70% + +FCKConfig.ImageBrowser = true ; +FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Images&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ; +FCKConfig.ImageBrowserWindowWidth = screen.width * 0.7 ; // 70% ; +FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ; // 70% ; + +FCKConfig.DocumentBrowser = true ; +FCKConfig.DocumentBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Documents&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files' ; +FCKConfig.ImageBrowserWindowWidth = screen.width * 0.7 ; // 70% ; +FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ; // 70% ; +FCKConfig.DocumentsServerPath = FCKConfig.ProjectPath+'kernel/user_files/Documents' + +FCKConfig.StructureBrowser = true ; +FCKConfig.StructureBrowserURL = FCKConfig.ProjectPath+'/admin/index.php?t=structure/tree' ; +FCKConfig.StructureBrowserWindowWidth = screen.width * 0.5 ; // 50% +FCKConfig.StructureBrowserWindowHeight = screen.height * 0.7 ; // 70% + +FCKConfig.FilesBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Files&Connector=connectors/php/connector.php&ServerPath='+FCKConfig.ProjectPath+'kernel/user_files/' ; + +FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; +FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; +FCKConfig.SmileyColumns = 8 ; +FCKConfig.SmileyWindowWidth = 320 ; +FCKConfig.SmileyWindowHeight = 240 ; \ No newline at end of file Index: trunk/kernel/admin_templates/img/old/menu_edit.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_charge_f2.gif =================================================================== diff -u Binary files differ Fisheye: Tag 1558 refers to a dead (removed) revision in file `trunk/kernel/units/categories/categories_tag_processor.php'. Fisheye: No comparison available. Pass `N' to diff? Index: trunk/kernel/admin_templates/img/icons/icon24_in-portal.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reorder_f2.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_new_item.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/toolbar/tool_reorder.gif =================================================================== diff -u Binary files differ Index: trunk/kernel/admin_templates/img/menu_arrow.gif =================================================================== diff -u Binary files differ