Fixed problem with saving of user preferences

This commit is contained in:
skeeter 2001-01-08 03:41:34 +00:00
parent d674b1e46b
commit abe2072c1a
2 changed files with 32 additions and 26 deletions

View File

@ -192,7 +192,7 @@
Header("Location: " . $this->redirect($this->link($this->db->f("config_value")."/login.php","cd=10")));
exit;
}
$this->preferences = new preferences($phpgw_info["user"]["account_id"]);
$this->preferences = new preferences(intval($phpgw_info["user"]["account_id"]));
}
$this->translation = new translation;
@ -339,10 +339,10 @@
$phpgw->phpgw_();
if ($phpgw_info["flags"]["currentapp"] != "login" &&
$phpgw_info["flags"]["currentapp"] != "logout") {
if (! $phpgw->session->verify()) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
exit;
}
// if (! $phpgw->session->verify()) {
// Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
// exit;
// }
load_optional();
phpgw_fillarray();
@ -380,6 +380,7 @@
$preferences_update = True;
}
if ($preferences_update) {
echo "Committing new preferences<br>\n";
$phpgw->preferences->commit(__LINE__,__FILE__);
}
unset($preferences_update);

View File

@ -197,12 +197,14 @@
class preferences
{
var $account_id = 0;
var $account_id;
var $preference;
function preferences($account_id)
{
global $phpgw;
// echo "Account ID (Initializing) = ".$account_id."<br>\n";
$db2 = $phpgw->db;
$load_pref = True;
@ -220,11 +222,15 @@
$load_pref = False;
}
//echo "Load Pref = $load_pref<br>\n";
//echo "Account ID (After Initializing) = ".$this->account_id."<br>\n";
if ($load_pref) {
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
$db2->next_record();
$pref_info = $db2->f("preference_value");
$this->preference = unserialize($pref_info);
// echo "Preferences = ".$this->get_preferences()."<br>\n";
}
}
@ -234,11 +240,10 @@
global $phpgw, $phpgw_info;
//echo "<br>commit called<br>Line: $line<br>File: $file".$phpgw_info["user"]["account_id"]."<br>";
if ($this->account_id) {
$db = $phpgw->db;
$db->query("delete from preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__);
$db->query("delete from preferences where preference_owner=" . $this->account_id,__LINE__,__FILE__);
if ($PHP_VERSION < "4.0.0") {
$pref_info = addslashes(serialize($this->preference));