Index: trunk/globals.php
===================================================================
diff -u -N -r1434 -r1442
--- trunk/globals.php (.../globals.php) (revision 1434)
+++ trunk/globals.php (.../globals.php) (revision 1442)
@@ -124,43 +124,58 @@
function GetNextResourceId($Increment=1)
{
- global $objModules;
+ global $objModules, $pathtoroot;
$table_name = GetTablePrefix().'IdGenerator';
+
+ $db = &GetADODBConnection();
+
+ // dummy protection: get maximal resource id used actually and fix last_id used
+ $max_resourceid = 0;
- $db = &GetADODBConnection();
-
- // dummy protection: get maximal resource id used actually and fix last_id used
- $max_resourceid = 0;
- $table_info = $objModules->ExecuteFunction('GetModuleInfo', 'dupe_resourceids');
- $sql_template = 'SELECT MAX(ResourceId) FROM '.GetTablePrefix().'%s';
-
- foreach($table_info as $module_name => $module_info)
- {
- foreach($module_info as $module_sub_info)
- {
- $sql = sprintf($sql_template,$module_sub_info['Table']);
- $tmp_resourceid = $db->GetOne($sql);
- if($tmp_resourceid > $max_resourceid) $max_resourceid = $tmp_resourceid;
- }
- }
-
- // update lastid to be next resourceid available
- $db->Execute('LOCK TABLES '.$table_name.' WRITE');
- $id_diff = $db->GetOne('SELECT '.$max_resourceid.' + 1 - lastid FROM '.$table_name);
- if($id_diff) $Increment += $id_diff;
-
+ $m = GetModuleArray();
+ foreach($m as $key=>$value)
+ {
+ $path = $pathtoroot. $value."admin/include/parser.php";
+ if(file_exists($path))
+ {
+ include_once($path);
+ }
+ }
+
+ $table_info = $objModules->ExecuteFunction('GetModuleInfo', 'dupe_resourceids');
+ $sql_template = 'SELECT MAX(ResourceId) FROM '.GetTablePrefix().'%s';
+
+ foreach($table_info as $module_name => $module_info)
+ {
+ foreach($module_info as $module_sub_info)
+ {
+ $sql = sprintf($sql_template,$module_sub_info['Table']);
+ $tmp_resourceid = $db->GetOne($sql);
+ if($tmp_resourceid > $max_resourceid) $max_resourceid = $tmp_resourceid;
+ }
+ }
+
+ // update lastid to be next resourceid available
+ $db->Execute('LOCK TABLES '.$table_name.' WRITE');
+
+ $last_id = $db->GetOne('SELECT lastid FROM '.$table_name);
+ if ($last_id - 1 > $max_resourceid) $max_resourceid = $last_id - 1;
+
+ $id_diff = $db->GetOne('SELECT '.$max_resourceid.' + 1 - lastid FROM '.$table_name);
+ if($id_diff) $Increment += $id_diff;
+
$sql = 'UPDATE '.$table_name.' SET lastid = lastid + '.$Increment; // set new id in db
- $db->Execute($sql);
-
- $val = $db->GetOne('SELECT lastid FROM '.$table_name);
- if($val === false)
- {
- $db->Execute('INSERT INTO '.$table_name.' (lastid) VALUES ('.$Increment.')');
- $val = $Increment;
- }
- $db->Execute('UNLOCK TABLES');
-
- return $val - $Increment + $id_diff; // return previous free id (-1) ?
+ $db->Execute($sql);
+
+ $val = $db->GetOne('SELECT lastid FROM '.$table_name);
+ if($val === false)
+ {
+ $db->Execute('INSERT INTO '.$table_name.' (lastid) VALUES ('.$Increment.')');
+ $val = $Increment;
+ }
+ $db->Execute('UNLOCK TABLES');
+
+ return $val - $Increment + $id_diff; // return previous free id (-1) ?
}
function AddSlash($s)
Index: trunk/kernel/include/modlist.php
===================================================================
diff -u -N -r437 -r1442
--- trunk/kernel/include/modlist.php (.../modlist.php) (revision 437)
+++ trunk/kernel/include/modlist.php (.../modlist.php) (revision 1442)
@@ -17,10 +17,12 @@
function ExecuteFunction($function_name, $params)
{
$function_name = $this->Get('Var').'_'.$function_name;
- if( function_exists($function_name) )
+ if( function_exists($function_name) ) {
return $function_name($params);
- else
+ }
+ else {
return false;
+ }
}
}
@@ -68,8 +70,9 @@
// call specified function for each module
// and returns result as array (key = module name)
$result = Array();
- foreach($this->Items as $module)
+ foreach($this->Items as $module) {
$result[ $module->Get('Name') ] = $module->ExecuteFunction($function, $params);
+ }
return $result;
}
Index: trunk/admin/install/langpacks/english.lang
===================================================================
diff -u -N -r1441 -r1442
--- trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 1441)
+++ trunk/admin/install/langpacks/english.lang (.../english.lang) (revision 1442)
@@ -1765,6 +1765,7 @@
UGxlYXNlIGNvb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/head.tpl
===================================================================
diff -u -N -r898 -r1442
--- trunk/themes/default/common/head.tpl (.../head.tpl) (revision 898)
+++ trunk/themes/default/common/head.tpl (.../head.tpl) (revision 1442)
@@ -4,8 +4,8 @@
" />
-
-
+
+
Index: trunk/admin/install/upgrades/changelog_1_0_12.txt
===================================================================
diff -u -N -r1440 -r1442
--- trunk/admin/install/upgrades/changelog_1_0_12.txt (.../changelog_1_0_12.txt) (revision 1440)
+++ trunk/admin/install/upgrades/changelog_1_0_12.txt (.../changelog_1_0_12.txt) (revision 1442)
@@ -28,13 +28,16 @@
File in-portal/kernel/include/debugger.php changed
File in-portal/kernel/include/emailmessage.php changed
File in-portal/kernel/include/item.php changed
+File in-portal/kernel/include/itemdb.php changed
File in-portal/kernel/include/language.php changed
+File in-portal/kernel/include/modlist.php changed
File in-portal/kernel/include/parseditem.php changed
File in-portal/kernel/include/portaluser.php changed
File in-portal/kernel/include/smtp.php changed
File in-portal/kernel/include/usersession.php changed
File in-portal/themes/default/sitemap.tpl is new
File in-portal/themes/default/common/footer.tpl changed
+File in-portal/themes/default/common/head.tpl changed
File in-portal/themes/default/index/sitemap_cat_element.tpl is new
File in-portal/themes/default/index/sitemap_subcat_element.tpl is new
File in-portal/themes/default/register/register_form.tpl changed
@@ -85,6 +88,5 @@
Changed label "la_topic_poststopop_prompt" of type "1"
Changed label "la_news_newstopminrating_prompt" of type "1"
Changed label "la_news_newstopminrating_prompt" of type "1"
-Changed label "lu_ferror_reset_denied" of type "0"
-Changed label "lu_ferror_reset_denied" of type "0"
Added label "lu_fieldcustom__drop_down" of type "2"
+Added label "lu_site_map" of type "0"
Index: trunk/kernel/include/category.php
===================================================================
diff -u -N -r1348 -r1442
--- trunk/kernel/include/category.php (.../category.php) (revision 1348)
+++ trunk/kernel/include/category.php (.../category.php) (revision 1442)
@@ -100,11 +100,13 @@
function Create()
{
- if((int)$this->Get("CreatedOn")==0)
- $this->Set("CreatedOn",date("U"));
- parent::Create();
- if($this->tablename==GetTablePrefix()."Category")
- $this->ClearCacheData();
+ if( (int) $this->Get("CreatedOn") == 0) {
+ $this->Set("CreatedOn",date("U"));
+ }
+ parent::Create();
+ if($this->tablename == GetTablePrefix()."Category") {
+ $this->ClearCacheData();
+ }
}
function SetParentId($value)
Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -N -r1072 -r1442
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 1072)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 1442)
@@ -418,35 +418,35 @@
function Create()
{
- global $Errors, $objSession;
-
- if($this->debuglevel) echo "Creating Item: ".get_class($this)."
";
- if($this->NoResourceId!=1 && (int)$this->Get("ResourceId")==0)
- {
- $this->Set("ResourceId", GetNextResourceId());
- }
- $sql = $this->CreateSql();
-
- if($this->debuglevel>0)
- echo $sql."
\n";
+ global $Errors, $objSession;
- if ($this->adodbConnection->Execute($sql) === false)
- {
- $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Create");
- return false;
- }
+ if($this->debuglevel) echo "Creating Item: ".get_class($this)."
";
+ if($this->NoResourceId!=1 && (int)$this->Get("ResourceId")==0)
+ {
+ $this->Set("ResourceId", GetNextResourceId());
+ }
+ $sql = $this->CreateSql();
- $this->SetUniqueId($this->adodbConnection->Insert_ID());
-
- if ($objSession->GetVariable("HasChanges") == 2) {
- $objSession->SetVariable("HasChanges", 1);
- }
-
- /*if ($this->adodbConnection->Affected_Rows() > 0) {
- $objSession->SetVariable("HasChanges", 1);
- } */
-
- return true;
+ if($this->debuglevel>0)
+ echo $sql."
\n";
+
+ if ($this->adodbConnection->Execute($sql) === false)
+ {
+ $Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Create");
+ return false;
+ }
+
+ $this->SetUniqueId($this->adodbConnection->Insert_ID());
+
+ if ($objSession->GetVariable("HasChanges") == 2) {
+ $objSession->SetVariable("HasChanges", 1);
+ }
+
+ /*if ($this->adodbConnection->Affected_Rows() > 0) {
+ $objSession->SetVariable("HasChanges", 1);
+ } */
+
+ return true;
}
function Increment($field, $calculate_hot = false)