Index: trunk/themes/default/advsearch/advsearch_type.tpl
===================================================================
diff -u -r13 -r1004
--- trunk/themes/default/advsearch/advsearch_type.tpl (.../advsearch_type.tpl) (revision 13)
+++ trunk/themes/default/advsearch/advsearch_type.tpl (.../advsearch_type.tpl) (revision 1004)
@@ -21,7 +21,7 @@
|

" class="button">
- " class="button">
+ " class="button">
|
Index: trunk/kernel/include/itemdb.php
===================================================================
diff -u -r900 -r1004
--- trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 900)
+++ trunk/kernel/include/itemdb.php (.../itemdb.php) (revision 1004)
@@ -449,11 +449,32 @@
return true;
}
- function Increment($field)
+ function Increment($field, $calculate_hot = false)
{
global $Errors;
-
- $sql = "Update ".$this->tablename." set $field=$field+1 where ".$this->IdField()."=" . $this->UniqueId();
+
+ if ($calculate_hot) {
+ $sql = "SELECT $field FROM ".$this->tablename." WHERE ".$this->IdField()." = ".$this->UniqueId();
+ $rs = $this->adodbConnection->Execute($sql);
+
+ $sql = "SELECT MAX($field) AS max_value FROM ".$this->tablename." WHERE ROUND($field) = ".round($rs->fields[$field]);
+ $rs = $this->adodbConnection->Execute($sql);
+ //echo "MAX VALUE: ".$rs->fields['max_value']."
";
+ //echo "MAX SQL: $sql
";
+ $new_val = $rs->fields['max_value'] + 1;
+
+ $sql = "SELECT count($field) AS count FROM ".$this->tablename." WHERE $field = $new_val";
+ $rsc = $this->adodbConnection->Execute($sql);
+ //echo "New Value:$new_val
";
+ if ($rsc->fields['count'] > 0) {
+ $new_val = $new_val + 0.000001;
+ }
+
+ $sql = "Update ".$this->tablename." set $field=$new_val where ".$this->IdField()."=" . $this->UniqueId();
+ }
+ else {
+ $sql = "Update ".$this->tablename." set $field=$field+1 where ".$this->IdField()."=" . $this->UniqueId();
+ }
if($this->debuglevel>0)
echo $sql."
";
$result = $this->adodbConnection->Execute($sql);
@@ -462,7 +483,13 @@
$Errors->AddError("error.DatabaseError",NULL,$this->adodbConnection->ErrorMsg(),"",get_class($this),"Increment");
return false;
}
- $this->Set($field,$this->Get($field)+1);
+
+ if ($calculate_hot) {
+ $this->Set($field,$new_val);
+ }
+ else {
+ $this->Set($field, $this->Get($field) + 1);
+ }
}
function Decrement($field)