Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, Feb 2, 4:00 AM

in-portal

Index: trunk/admin/category/category_maint.php
===================================================================
--- trunk/admin/category/category_maint.php (revision 617)
+++ trunk/admin/category/category_maint.php (revision 618)
@@ -1,165 +1,166 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
## ##
## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
if(!defined('CACHE_PERM_CHUNK_SIZE'))define('CACHE_PERM_CHUNK_SIZE',30);
if(!strlen($pathtoroot))
{
$path = dirname(realpath(__FILE__));
if( strlen($path) )
{
// determine the OS type for path parsing
$pos = strpos($path, ':');
$gOS_TYPE = ($pos === false) ? 'unix' : 'win';
$pathchar = ($gOS_TYPE == 'unix') ? '/' : "\\";
$p = $path.$pathchar;
// Start looking for the root flag file
while( !strlen($pathtoroot) && strlen($p) )
{
$sub = substr($p, strlen($pathchar) * -1);
$filename = $p.( ($sub == $pathchar) ? '' : $pathchar).'root.flg';
if( !file_exists($filename) )
{
$parent = realpath($p.$pathchar."..".$pathchar);
$p = ($parent != $p) ? $parent : '';
}
else
$pathtoroot = $p;
}
if( !strlen($pathtoroot) ) $pathtoroot = '.'.$pathchar;
}
else
$pathtoroot = '.'.$pathchar;
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if( $sub != $pathchar) $pathtoroot = $pathtoroot.$pathchar;
//echo $pathtoroot;
//$FrontEnd=2;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
$imagesURL = $adminURL."/images";
$pathtolocal = $pathtoroot."in-news/";
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$section = "in-portal:category_maint";
require_once($pathtoroot.$admin."/category/permcacheupdate.php");
if(!$objSession->GetVariable('PermCache_UpdateRequired'))
die(header('Location: '.$adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv()));
if(isset($_GET['continue']))
{
$updater =& new clsCacheUpdater(1);
if(!intval($_GET['continue']))
{
$updater->clearData();
die(header('Location: '.$adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv()));
}
}
else
{
$updater =& new clsCacheUpdater();
$no_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&continue=0';
$yes_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&continue=1';
$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
int_header(NULL,NULL,$title);
flush();
-
+
+ if(!isset($_GET['force']))
if($updater->totalCats > CACHE_PERM_CHUNK_SIZE)
{
$updater->setData();
?>
<script language="javascript">
function goto_url(url)
{
document.location = url;
}
</script>
<table cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder">
<tr>
<td align="center" colspan="3" bgcolor="#FFFFFF"><?php echo prompt_language('la_confirm_maintenance'); ?></td>
</tr>
<tr>
<td align="center" colspan="3" bgcolor="#FFFFFF"><?php echo prompt_language('la_prompt_perform_now'); ?></td>
</tr>
<tr>
<td align="right" width="50%">
<input type="button" name="yes_btn" value="<?php echo admin_language("lu_yes"); ?>" onclick="javascript:goto_url('<?php echo $yes_url; ?>');" class="button">
</td>
<td><img src="<?php echo $imagesURL; ?>/spacer.gif" width="10"></td>
<td align="left" width="50%">
<input type="button" name="yes_btn" value="<?php echo admin_language("lu_no"); ?>" onclick="javascript:goto_url('<?php echo $no_url; ?>');" class="button">
</td>
</tr>
</table>
<?php
int_footer();
die();
}
}
$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
int_header(NULL,NULL,$title);
flush();
$percent=$updater->getDonePercent();
echo '<TABLE cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder">';
if ($percent == 0)
echo '<TR><TD BGCOLOR="#FFFFFF" width="100%" >'.$percent.'%</td></TR>';
else if ($percent < 60)
echo '<TR><TD BGCOLOR="#4682B2" width="'.$percent.'%"></td><TD BGCOLOR="#FFFFFF" width="'.(100-$percent).'%">'.$percent.'%</td></TR>';
else if ($percent == 100)
echo '<TR><TD BGCOLOR="#4682B2" align="right" width="100%"><FONT COLOR="#FFFFFF">'.$percent.'%</FONT></td>';
else
echo '<TR><TD BGCOLOR="#4682B2" align="right" width="'.$percent.'%"><FONT COLOR="#FFFFFF">'.$percent.'%</FONT></td><TD BGCOLOR="#FFFFFF" width="'.(100-$percent).'%"></td></TR>';
echo '</TABLE>';
flush();
$needs_more = TRUE;
while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) {
$needs_more = $updater->DoTheJob();
}
if ($needs_more)
{
$updater->setData();
$url=$adminURL.'/category/category_maint.php?env='.BuildEnv().'&continue=1';
}
else
{
$updater->clearData();
$url = $adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv();
$objSession->SetVariable('PermCache_UpdateRequired', 0);
}
print "<script language=\"javascript\">" ;
print "setTimeout(\"document.location='$url';\",40);";
print "</script>";
int_footer();
exit;
?>
Property changes on: trunk/admin/category/category_maint.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.15
\ No newline at end of property
+1.16
\ No newline at end of property
Index: trunk/admin/import/import_funcs.php
===================================================================
--- trunk/admin/import/import_funcs.php (revision 617)
+++ trunk/admin/import/import_funcs.php (revision 618)
@@ -1,197 +1,197 @@
<?php
// Import script common functions
// ========================================================================================================
/**
* @return void
* @param Array $import_steps
* @desc Prints out step status information table
*/
function DrawScreen($import_steps)
{
global $objSession, $current_step;
$title = admin_language('la_performing_import').' - '.admin_language('la_Step').' 4';
int_header(null,NULL,$title);
$inner_table = '';
foreach($import_steps as $import_step) $inner_table .= PrintStep($import_step);
$is_count = count($import_steps);
int_table_color(1);
$RowColor = int_table_color(0, true);
echo <<<SCREEN_END
<form id="import_form" action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tableborder">
<tr $RowColor>
<td width="1000000">&nbsp;</td>
<td rowspan="$is_count" align="center">
<img src="img/s.gif" height="0" width="500">
<table width="100%" border="0" cellspacing="0">
$inner_table
</table>
</td>
<td width="1000000">&nbsp;</td>
</tr>
SCREEN_END;
$i = 1;
while($i < $is_count)
{
echo PrintDummy();
$i++;
}
$run_time = GetMC() - $objSession->GetVariable('import_begins');
$run_time .= 's';
int_subsection_title( admin_language("la_performing_import").' - '.$current_step['caption'].'...', 3);
$RowColor = int_table_color(0, true);
echo <<<SCREEN_END
<tr $RowColor>
<td colspan="3">Script Running: $run_time</td>
</tr>
</table>
</form>
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 '
<tr '.int_table_color(0, true).'>
<td width="50%" valign="top"><span class="text">'.$step_rec['caption'].'</span></td>
<td width="50%">
<span class="text">'.$step_rec['percent'].'</span>%&nbsp;'.$step_rec['details'].'</span>
</td>
</tr>';
}
/**
* @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();
- echo '<script>window.location = "'.$adminURL.'/category/category_maint.php?env='.BuildEnv().'";</script>';
+ echo '<script>window.location = "'.$adminURL.'/category/category_maint.php?env='.BuildEnv().'&force=1";</script>';
}
}
DumpStepsInfo($import_steps);
echo '<script>window.location = "'.$rootURL.'in-bulletin/'.$admin.'/import/phpbb_import.php?env='.BuildEnv().'";</script>';
}
// ========================================================================================================
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 '<tr '.int_table_color(0, true).'>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>';
}
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'];
}
?>
\ No newline at end of file
Property changes on: trunk/admin/import/import_funcs.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property

Event Timeline