[feladat @ 121]
authorpeter
Mon, 11 Feb 2008 19:52:20 +0000
changeset 74 43c31dc98305
parent 73 8a239565e9b3
child 75 a53200a76f9d
[feladat @ 121] Moved the constants down, so the ROWAMOUNT can be defined in the config.inc.php file. This to solve ticket:20. Fixed a bug which was introduced in r112. The used arguments in the setLimit function where in the wrong order.
inc/config-me.inc.php
inc/record.inc.php
inc/toolkit.inc.php
inc/users.inc.php
--- a/inc/config-me.inc.php	Mon Feb 11 18:42:04 2008 +0000
+++ b/inc/config-me.inc.php	Mon Feb 11 19:52:20 2008 +0000
@@ -64,6 +64,10 @@
 // will be included, it will be used like: "style/$STYLE.css.php".
 $STYLE = "example";
 
+// $ROWAMOUNT
+// Define which rowamount should be used in the listing of records.
+$ROWAMOUNT = 50;
+
 /* DNS Record information */
 
 
--- a/inc/record.inc.php	Mon Feb 11 18:42:04 2008 +0000
+++ b/inc/record.inc.php	Mon Feb 11 19:52:20 2008 +0000
@@ -984,10 +984,10 @@
 	$sqlq.=" GROUP BY domainname, domains.id
 	ORDER BY domainname";
 
-	$db->setLimit($rowstart, $rowamount);
+	$db->setLimit($rowamount, $rowstart);
 	$result = $db->query($sqlq);
 	// Set limit needs to be called before each query
-	$db->setLimit($rowstart, $rowamount);
+	$db->setLimit($rowamount, $rowstart);
 	$result2 = $db->query($sqlq); 
 	
 	$numrows = $result2->numRows();
@@ -1201,7 +1201,7 @@
 	if (is_numeric($id))
 	{
 		if ($_SESSION[$id."_ispartial"] == 1) {
-		$db->setLimit($rowstart, $rowamount);
+		$db->setLimit($rowamount, $rowstart);
 		$result = $db->query("SELECT record_owners.record_id as id
 		FROM record_owners,domains,records
 		WHERE record_owners.user_id = ".$db->quote($_SESSION["userid"])."
@@ -1228,7 +1228,7 @@
 		}
 
 		} else {
-		$db->setLimit($rowstart, $rowamount);
+		$db->setLimit($rowamount, $rowstart);
 		$result = $db->query("SELECT id FROM records WHERE domain_id=".$db->quote($id));
 		$ret = array();
 		if($result->numRows() == 0)
--- a/inc/toolkit.inc.php	Mon Feb 11 18:42:04 2008 +0000
+++ b/inc/toolkit.inc.php	Mon Feb 11 19:52:20 2008 +0000
@@ -21,11 +21,27 @@
 
 session_start();
 
+
+
+if(!@include_once("config.inc.php"))
+{
+	error( _('You have to create a config.inc.php!') );
+}
+
+if(is_file( dirname(__FILE__) . '/../install.php'))
+{
+	error( _('You have to remove install.php before this program will run') );
+}
+
+if(is_file( dirname(__FILE__) . '/../migrator.php'))
+{
+        error( _('You have to remove migrator.php before this program will run') );
+}
+
 /*************
- * Constants  *
-  *************/
-
-define(ROWAMOUNT, 50);
+ * Constants *
+ *************/
+define(ROWAMOUNT, $ROWAMOUNT);
 
 if (isset($_GET["start"])) {
    define(ROWSTART, (($_GET["start"] - 1) * ROWAMOUNT));
@@ -42,21 +58,6 @@
    define(LETTERSTART, "a");
 }
 
-if(!@include_once("config.inc.php"))
-{
-	error( _('You have to create a config.inc.php!') );
-}
-
-if(is_file( dirname(__FILE__) . '/../install.php'))
-{
-	error( _('You have to remove install.php before this program will run') );
-}
-
-if(is_file( dirname(__FILE__) . '/../migrator.php'))
-{
-        error( _('You have to remove migrator.php before this program will run') );
-}
-
 /* Database connection */
 
 require_once("database.inc.php");
--- a/inc/users.inc.php	Mon Feb 11 18:42:04 2008 +0000
+++ b/inc/users.inc.php	Mon Feb 11 19:52:20 2008 +0000
@@ -58,7 +58,7 @@
 			users.fullname";
 
 	// Execute the huge query.
-	$db->setLimit($rowstart, $rowamount);
+	$db->setLimit($rowamount, $rowstart);
 	$result = $db->query($sqlq);
 	$ret = array();
 	$retcount = 0;