SCREEN_END; $i = 1; while($i < $is_count) { echo PrintDummy(); $i++; } int_subsection_title( admin_language("la_performing_import").' - Initializing ...', 3); $RowColor = int_table_color(0, true); echo <<
  $inner_table
 
Script Running: 0s
SCREEN_END; int_footer(); flush(); } /** * @return string * @param Array $step_rec * @desc Returns one row of step-info table */ function PrintStep($step_rec) { $step_rec['percent'] = round( ($step_rec['rec_no'] / $step_rec['recs_count']) * 100, 2); $step_rec['details'] = '('.$step_rec['rec_no'].' of '.$step_rec['recs_count'].')'; return ' '.$step_rec['caption'].' '.$step_rec['percent'].'% '.$step_rec['details'].' '; } /** * @return void * @param Array $import_steps * @desc Save step info to database */ function DumpStepsInfo($import_steps) { global $dst_db, $ImportTable, $cache; $sql = 'UPDATE '.$ImportTable.' SET bbi_rec_no = %s, bbi_recs_count = %s, bbi_current = %s, bbi_cache = %s WHERE bbi_step = \'%s\''; foreach ($import_steps as $istep) { $sc = serialize( $cache[ $istep['id'] ] ); $tmp = sprintf($sql, $istep['rec_no'], $istep['recs_count'], $istep['current'], $dst_db->qstr($sc), $istep['id']); $dst_db->Execute($tmp); } } /** * @return void * @param Array $step_info * @param Array $import_steps * @desc Redirects to next step or continues this step */ function StepRedirect($step_info) { global $rootURL, $admin, $StepIndex, $import_steps, $dst_db, $db, $ImportTable, $objCatList; if($step_info['rec_no'] == $step_info['recs_count']) { $import_steps[ $step_info['id'] ]['current'] = 0; $NewCurrent = array_search( $step_info['id'], $StepIndex) + 1; if( array_key_exists($NewCurrent, $StepIndex) ) { $import_steps[ $StepIndex[$NewCurrent] ]['current'] = 1; } else { global $objSession, $adminURL; $objSession->SetVariable('PermCache_UpdateRequired', 1); $objSession->SetVariable('ReturnScript', 'browse.php'); // redirect to catalog when finished $NumCats = TableCount($objCatList->SourceTable,'',0); $dst_db->Execute('DROP TABLE IF EXISTS '.$ImportTable); $db->Close(); $dst_db->Close(); echo ''; } } DumpStepsInfo($import_steps); echo ''; } // ======================================================================================================== function GetStepName($step_id) { global $import_steps; $ret = ''; foreach($import_steps as $istep) if($istep['id'] == $step_id) { $ret = $istep['caption']; break; } return $ret; } function PrintDummy() { return '     '; } function GetMC() { $tmp = explode(' ', microtime() ); return $tmp[1]; } function SetPersistantVariable($user_id, $var_name, $var_value) { global $dst_db; $sql_template = "REPLACE INTO ".GetTablePrefix()."PersistantSessionData (PortalUserId, VariableName, VariableValue) VALUES (%s,'%s','%s')"; $dst_db->Execute( sprintf($sql_template, $user_id, $var_name, $var_value) ); } function DecodeIP($ip) { $i = 0; $ip_len = strlen($ip); $ip_parts = Array(); while($i < $ip_len) { $ip_parts[] = hexdec( substr($ip, $i, 2) ); $i += 2; } return implode('.', $ip_parts); } function GetUserID($old_user_id) { global $cache; return $cache['users'][ $old_user_id ]['new_id']; } function GetUserName($old_user_id) { global $cache; return $cache['users'][ $old_user_id ]['username']; } function SetTotals($step_name) { global $objSession; $run_time = GetMC() - $objSession->GetVariable('import_begins'); echo ''; } ?>