routeSQL : add the cookie support to save the parameters by page

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2009 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-03-11 15:49:15 +00:00
parent f9ce6e2483
commit 284388dc61

View File

@@ -25,6 +25,9 @@ class routeSQL
public $textEdit = "";
/** enable internal CSS */
public $enableInternalCSS = true;
/** The cookie path used to determine the old parameters
It is automatically generated with the URL */
public $path = "";
/** The model file containing the database description */
private $model_file = "";
/** The model class included in the model file */
@@ -57,6 +60,11 @@ class routeSQL
$this->driver_options = $driver_options;
$this->textDelete = "❌";
$this->textEdit = "✎";
$pos = strpos ($_SERVER["REQUEST_URI"], "?");
if ($pos === false)
$this->path = $_SERVER["REQUEST_URI"];
else
$this->path = substr ($_SERVER["REQUEST_URI"], 0, $pos);
}
/** Connect to the database */
@@ -256,10 +264,9 @@ class routeSQL
$page = intval ($page);
$num = intval ($num);
$search = rawurldecode ($search);
$url = "/".$this->url_prefix;
setcookie ("page", "$page", time()+3600*24*30);
setcookie ("num", "$num", time()+3600*24*30);
setcookie ("search", "$search", time()+3600*24*30);
setcookie ("page", $page, time()+3600*24*30, $this->path);
setcookie ("num", $num, time()+3600*24*30, $this->path);
setcookie ("search", $search, time()+3600*24*30, $this->path);
//echo "PAGE=$page\n";
//echo "NUM=$num\n";
//echo "SEARCH=$search\n";
@@ -605,7 +612,5 @@ echo $content;
$_SESSION["domframework"]["routeSQL"]["values"] = $values;
$route->redirect ("/".$this->url_prefix."/$id", "");
});
echo "Route not found";
}
}