Index: trunk/core/units/general/cat_dbitem_export.php =================================================================== diff -u -N -r3642 -r3648 --- trunk/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 3642) +++ trunk/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 3648) @@ -266,6 +266,12 @@ else { $this->filePointer = fopen($this->getImportFilename(), 'r'); } + + // skip UTF-8 BOM Modifier + $first_chars = fread($this->filePointer, 3); + if (bin2hex($first_chars) != 'efbbbf') { + fseek($this->filePointer, 0); + } } /** Index: trunk/globals.php =================================================================== diff -u -N -r3534 -r3648 --- trunk/globals.php (.../globals.php) (revision 3534) +++ trunk/globals.php (.../globals.php) (revision 3648) @@ -1611,23 +1611,25 @@ static $import_scripts = Array(); if( count($import_scripts) == 0 ) { - $sql = 'SELECT * FROM '.GetTablePrefix().'ImportScripts ORDER BY is_id'; - $db =&GetADODBConnection(); + + $sql = 'SELECT imp.* , m.LoadOrder + FROM '.TABLE_PREFIX.'ImportScripts imp + LEFT JOIN '.TABLE_PREFIX.'Modules m ON m.Name = imp.is_Module + ORDER BY m.LoadOrder'; + + $db =& GetADODBConnection(); $rs = $db->Execute($sql); - if( $rs && $rs->RecordCount() > 0 ) - { - while(!$rs->EOF) - { + if ($rs && $rs->RecordCount() > 0) { + while (!$rs->EOF) { $rec =& $rs->fields; - $import_scripts[] = Array( 'label' => $rec['is_label'], 'url' => $rec['is_script'], + $import_scripts[ $rec['is_id'] ] = Array( 'label' => $rec['is_label'], 'url' => $rec['is_script'], 'enabled' => $rec['is_enabled'], 'field_prefix' => $rec['is_field_prefix'], 'id' => $rec['is_string_id'], 'required_fields' => $rec['is_requred_fields'], 'module' => strtolower($rec['is_Module']) ); $rs->MoveNext(); } } - else - { + else { $import_scripts = Array(); } } Index: trunk/core/kernel/utility/debugger.php =================================================================== diff -u -N -r3527 -r3648 --- trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3527) +++ trunk/core/kernel/utility/debugger.php (.../debugger.php) (revision 3648) @@ -393,7 +393,13 @@ function appendRequest() { - $script = $_SERVER['PHP_SELF']; + if (isset($_SERVER['SCRIPT_FILENAME'])) { + $script = $_SERVER['SCRIPT_FILENAME']; + } + else { + $script = $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']; + } + $this->appendHTML('ScriptName: '.$this->getFileLink($script,1,basename($script)).' ('.dirname($script).')'); $this->appendHTML('DomViewer:  '); Index: trunk/admin/install/inportal_schema.sql =================================================================== diff -u -N -r3635 -r3648 --- trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 3635) +++ trunk/admin/install/inportal_schema.sql (.../inportal_schema.sql) (revision 3648) @@ -640,6 +640,7 @@ is_field_prefix varchar(50) NOT NULL default '', is_requred_fields varchar(255) NOT NULL default '', is_enabled tinyint(1) unsigned NOT NULL default '0', + is_type varchar(10) NOT NULL default '', PRIMARY KEY (is_id) ) Index: trunk/admin/install/upgrades/inportal_upgrade_v1.1.6.sql =================================================================== diff -u -N -r3635 -r3648 --- trunk/admin/install/upgrades/inportal_upgrade_v1.1.6.sql (.../inportal_upgrade_v1.1.6.sql) (revision 3635) +++ trunk/admin/install/upgrades/inportal_upgrade_v1.1.6.sql (.../inportal_upgrade_v1.1.6.sql) (revision 3648) @@ -7,4 +7,7 @@ UPDATE ItemTypes SET Prefix = 'c' WHERE SourceTable = 'Category'; UPDATE ItemTypes SET Prefix = 'u' WHERE SourceTable = 'PortalUser'; +ALTER TABLE ImportScripts ADD is_type VARCHAR(10) NOT NULL; +UPDATE ImportScripts SET is_type = 'db'; + UPDATE Modules SET Version = '1.1.6' WHERE Name = 'In-Portal'; \ No newline at end of file Index: trunk/admin/browse.php =================================================================== diff -u -N -r3617 -r3648 --- trunk/admin/browse.php (.../browse.php) (revision 3617) +++ trunk/admin/browse.php (.../browse.php) (revision 3648) @@ -219,7 +219,6 @@ " ImagePath=""> "> - " ImagePath=""> " ImagePath=""> "> Index: trunk/admin/import/step2.php =================================================================== diff -u -N -r2853 -r3648 --- trunk/admin/import/step2.php (.../step2.php) (revision 2853) +++ trunk/admin/import/step2.php (.../step2.php) (revision 3648) @@ -39,15 +39,18 @@ } else { - $click_url = $adminURL."/import/step3.php".$var; + $application =& kApplication::Instance(); + $click_url = $application->HREF('import_redirect', '', null, 'index4.php'); // $adminURL."/import/step3.php".$var; $onClick = "ImportRedirect('import_form', ChoiseMade('import_form','choose'), '$click_url');"; } $objCatToolBar->Add("moveright",'la_ToolTip_NextStep','#',$MouseOver,$MouseOut,$onClick,"tool_next_f3.gif"); // header $title = admin_language("la_performing_import")." - ".admin_language("la_Step")." 2"; int_header($objCatToolBar,NULL,$title); - + + $objSession->SetVariable("ReturnScript", 'browse.php'); // return to catalog if import is made + ?>
Index: trunk/kernel/admin/include/toolbar/browse.php =================================================================== diff -u -N -r3642 -r3648 --- trunk/kernel/admin/include/toolbar/browse.php (.../browse.php) (revision 3642) +++ trunk/kernel/admin/include/toolbar/browse.php (.../browse.php) (revision 3648) @@ -278,9 +278,9 @@ k4_action = 'rebuild_cache("c")'; break; - case 'import': - k4_action = 'import_items("'+prefix_special+'")'; - break; +// case 'import': +// k4_action = 'import_items("'+prefix_special+'")'; +// break; case 'export': k4_action = 'export_items("'+prefix_special+'")'; @@ -322,11 +322,11 @@ submit_event(prefix_special,'OnMassDecline','') } - function import_items(prefix_special) - { - set_hidden_field('remove_specials['+prefix_special+']',1); - submit_event(prefix_special,'OnImport','') - } +// function import_items(prefix_special) +// { +// set_hidden_field('remove_specials['+prefix_special+']',1); +// submit_event(prefix_special,'OnImport','') +// } function export_items(prefix_special) { @@ -425,7 +425,7 @@ AddButtonAction('approve',"check_submit('$admin/browse','approve');"); //approve AddButtonAction('decline',"check_submit('$admin/browse','decline');"); //decline - AddButtonAction('import',"check_submit('$admin/browse','import');"); // import +// AddButtonAction('import',"check_submit('$admin/browse','import');"); // import AddButtonAction('export',"check_submit('$admin/browse','export');"); // export AddButtonAction('rebuild_cache',"check_submit('$admin/category/category_maint', 'm_rebuild_cache');"); // rebuild_cache @@ -544,7 +544,10 @@ var isCatImportExport = activeTab && isAnyChecked('categories') && (actionValue == 'import' || actionValue == 'export'); - if (activeTab && (!isAnyChecked('categories') || isCatImportExport)) + // skip news & topics for export operations (not to raise js errors) + var allowProcessing = (activeTab.getAttribute("PrefixSpecial") != 'n' && activeTab.getAttribute("PrefixSpecial") != 'bb'); + + if (allowProcessing && activeTab && (!isAnyChecked('categories') || isCatImportExport)) { form_name = activeTab.id; action_prefix = activeTab.getAttribute("ActionPrefix"); @@ -562,7 +565,7 @@ eval(act); return; } - else if(actionValue == 'export' || actionValue == 'import') + else if(actionValue == 'export') // || actionValue == 'import' { return k4_actionHandler(actionValue, activeTab.getAttribute("PrefixSpecial")); } Index: trunk/admin/import/step3.php =================================================================== diff -u -N -r2853 -r3648 --- trunk/admin/import/step3.php (.../step3.php) (revision 2853) +++ trunk/admin/import/step3.php (.../step3.php) (revision 3648) @@ -20,8 +20,7 @@ $envar = "env=" . BuildEnv(); $var = "?env=".BuildEnv(); - - if( isset($_POST['import_id']) ) $objSession->SetVariable('ImportScriptID', $_POST['import_id']); +// if( isset($_POST['import_id']) ) $objSession->SetVariable('ImportScriptID', $_POST['import_id']); $import_script = GetImportScript( $objSession->GetVariable('ImportScriptID') ); Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r3635 -r3648 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 3635) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 3648) @@ -784,6 +784,40 @@ $module =& $this->Application->recallObject('mod.'.$module_name); $this->Application->SetVar('m_cat_id', $module->GetDBField('RootCat') ); } + + function ImportRedirect($params) + { + $import_id = $this->Application->GetVar('import_id'); + if ($import_id) { + // redirect forward to step3 (import parameters coosing) + $this->Application->StoreVar('ImportScriptID', $import_id); + + $sql = 'SELECT * + FROM '.TABLE_PREFIX.'ImportScripts + WHERE is_id = '.$import_id; + + $db =& $this->Application->GetADODBConnection(); + $is_params = $db->GetRow($sql); + + if ($is_params['is_type'] == 'db') { + $this->Application->Redirect('', null, '', 'import/step3.php'); + } + elseif ($is_params['is_type'] == 'csv') { + $module = strtolower($is_params['is_Module']); + $template = $module.'/import'; + $sql = 'SELECT Var + FROM '.TABLE_PREFIX.'Modules + WHERE LOWER(Name) = '.$db->qstr($module); + $item_prefix = $db->GetOne($sql); + $pass_params = Array('m_opener' => 'd', $item_prefix.'.import_id' => 0, $item_prefix.'.import_event' => 'OnNew', 'pass' => 'm,'.$item_prefix.'.import'); + $this->Application->Redirect($template, $pass_params); + } + } + else { + // redirect back to step2 (import type choosing) + $this->Application->Redirect('', null, '', 'import/step2.php'); + } + } /* function Login($params) Index: trunk/kernel/include/debugger.php =================================================================== diff -u -N -r3066 -r3648 --- trunk/kernel/include/debugger.php (.../debugger.php) (revision 3066) +++ trunk/kernel/include/debugger.php (.../debugger.php) (revision 3648) @@ -12,7 +12,7 @@ if(!defined($const_name)) define($const_name,$const_value); } - unset($_REQUEST['debug_host']); // this var messed up whole detection stuff :( + unset($_REQUEST['debug_host'], $_REQUEST['debug_fastfile']); // this var messed up whole detection stuff :( // Detect fact, that this session beeing debugged by Zend Studio foreach($_REQUEST as $rq_name=>$rq_value) @@ -61,6 +61,7 @@ var $Data = Array(); var $ProfilerData = Array(); var $ProfilerTotals = Array(); + var $ProfilerTotalCount = Array(); var $RecursionStack = Array(); // prevent recursion when processing debug_backtrace() function results var $TraceNextError=false; @@ -392,7 +393,13 @@ function appendRequest() { - $script = $_SERVER['SCRIPT_FILENAME']; + if (isset($_SERVER['SCRIPT_FILENAME'])) { + $script = $_SERVER['SCRIPT_FILENAME']; + } + else { + $script = $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']; + } + $this->appendHTML('ScriptName: '.$this->getFileLink($script,1,basename($script)).' ('.dirname($script).')'); $this->appendHTML('DomViewer:  '); @@ -452,11 +459,13 @@ { if (!isset($this->ProfilerTotals[$total_key])) { $this->ProfilerTotals[$total_key] = 0; + $this->ProfilerTotalCount[$total_key] = 0; } if (!isset($value)) { $value = $this->ProfilerData[$key]['ends'] - $this->ProfilerData[$key]['begins']; } $this->ProfilerTotals[$total_key] += $value; + $this->ProfilerTotalCount[$total_key]++; } function getMoment() @@ -537,7 +546,7 @@ if( dbg_ConstOn('DBG_SQL_PROFILE') && isset($this->ProfilerTotals['sql']) ) { - $this->appendHTML('SQL Total time: '.$this->ProfilerTotals['sql']); + $this->appendHTML('SQL Total time: '.$this->ProfilerTotals['sql'].' Number of queries: '.$this->ProfilerTotalCount['sql']); } if( dbg_ConstOn('DBG_PROFILE_MEMORY') ) @@ -996,7 +1005,10 @@ function memory_get_usage(){ return -1; } } + if( !dbg_ConstOn('DBG_ZEND_PRESENT') ) + { $debugger = new Debugger(); + } if( dbg_ConstOn('DBG_HANDLE_ERRORS') ) { Index: trunk/kernel/units/general/cat_dbitem_export.php =================================================================== diff -u -N -r3642 -r3648 --- trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 3642) +++ trunk/kernel/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 3648) @@ -266,6 +266,12 @@ else { $this->filePointer = fopen($this->getImportFilename(), 'r'); } + + // skip UTF-8 BOM Modifier + $first_chars = fread($this->filePointer, 3); + if (bin2hex($first_chars) != 'efbbbf') { + fseek($this->filePointer, 0); + } } /**