mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 17:18:54 +01:00
Fixed problem with saving of user preferences
This commit is contained in:
parent
d674b1e46b
commit
abe2072c1a
@ -192,7 +192,7 @@
|
|||||||
Header("Location: " . $this->redirect($this->link($this->db->f("config_value")."/login.php","cd=10")));
|
Header("Location: " . $this->redirect($this->link($this->db->f("config_value")."/login.php","cd=10")));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$this->preferences = new preferences($phpgw_info["user"]["account_id"]);
|
$this->preferences = new preferences(intval($phpgw_info["user"]["account_id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->translation = new translation;
|
$this->translation = new translation;
|
||||||
@ -339,10 +339,10 @@
|
|||||||
$phpgw->phpgw_();
|
$phpgw->phpgw_();
|
||||||
if ($phpgw_info["flags"]["currentapp"] != "login" &&
|
if ($phpgw_info["flags"]["currentapp"] != "login" &&
|
||||||
$phpgw_info["flags"]["currentapp"] != "logout") {
|
$phpgw_info["flags"]["currentapp"] != "logout") {
|
||||||
if (! $phpgw->session->verify()) {
|
// if (! $phpgw->session->verify()) {
|
||||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
|
// Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
|
||||||
exit;
|
// exit;
|
||||||
}
|
// }
|
||||||
load_optional();
|
load_optional();
|
||||||
|
|
||||||
phpgw_fillarray();
|
phpgw_fillarray();
|
||||||
@ -380,6 +380,7 @@
|
|||||||
$preferences_update = True;
|
$preferences_update = True;
|
||||||
}
|
}
|
||||||
if ($preferences_update) {
|
if ($preferences_update) {
|
||||||
|
echo "Committing new preferences<br>\n";
|
||||||
$phpgw->preferences->commit(__LINE__,__FILE__);
|
$phpgw->preferences->commit(__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
unset($preferences_update);
|
unset($preferences_update);
|
||||||
|
@ -197,34 +197,40 @@
|
|||||||
|
|
||||||
class preferences
|
class preferences
|
||||||
{
|
{
|
||||||
var $account_id = 0;
|
var $account_id;
|
||||||
var $preference;
|
var $preference;
|
||||||
|
|
||||||
function preferences($account_id)
|
function preferences($account_id)
|
||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
// echo "Account ID (Initializing) = ".$account_id."<br>\n";
|
||||||
|
|
||||||
|
|
||||||
$db2 = $phpgw->db;
|
$db2 = $phpgw->db;
|
||||||
$load_pref = True;
|
$load_pref = True;
|
||||||
if (is_long($account_id) && $account_id) {
|
if (is_long($account_id) && $account_id) {
|
||||||
$this->account_id = $account_id;
|
$this->account_id = $account_id;
|
||||||
} elseif(is_string($account_id)) {
|
} elseif(is_string($account_id)) {
|
||||||
$db2->query("SELECT account_id FROM accounts WHERE account_lid='".$account_id."'",__LINE__,__FILE__);
|
$db2->query("SELECT account_id FROM accounts WHERE account_lid='".$account_id."'",__LINE__,__FILE__);
|
||||||
if($db2->num_rows()) {
|
if($db2->num_rows()) {
|
||||||
$db2->next_record();
|
$db2->next_record();
|
||||||
$this->account_id = $db2->f("account_id");
|
$this->account_id = $db2->f("account_id");
|
||||||
} else {
|
} else {
|
||||||
$load_pref = False;
|
$load_pref = False;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$load_pref = False;
|
$load_pref = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//echo "Load Pref = $load_pref<br>\n";
|
||||||
|
//echo "Account ID (After Initializing) = ".$this->account_id."<br>\n";
|
||||||
|
|
||||||
if ($load_pref) {
|
if ($load_pref) {
|
||||||
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
|
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
|
||||||
$db2->next_record();
|
$db2->next_record();
|
||||||
$pref_info = $db2->f("preference_value");
|
$pref_info = $db2->f("preference_value");
|
||||||
$this->preference = unserialize($pref_info);
|
$this->preference = unserialize($pref_info);
|
||||||
|
// echo "Preferences = ".$this->get_preferences()."<br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,23 +240,22 @@
|
|||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
//echo "<br>commit called<br>Line: $line<br>File: $file".$phpgw_info["user"]["account_id"]."<br>";
|
//echo "<br>commit called<br>Line: $line<br>File: $file".$phpgw_info["user"]["account_id"]."<br>";
|
||||||
|
|
||||||
if ($this->account_id) {
|
if ($this->account_id) {
|
||||||
$db = $phpgw->db;
|
$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") {
|
if ($PHP_VERSION < "4.0.0") {
|
||||||
$pref_info = addslashes(serialize($this->preference));
|
$pref_info = addslashes(serialize($this->preference));
|
||||||
} else {
|
} else {
|
||||||
$pref_info = serialize($this->preference);
|
$pref_info = serialize($this->preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->query("insert into preferences (preference_owner,preference_value) values ("
|
$db->query("insert into preferences (preference_owner,preference_value) values ("
|
||||||
. $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__);
|
. $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__);
|
||||||
|
|
||||||
if ($phpgw_info["user"]["account_id"] == $this->account_id) {
|
if ($phpgw_info["user"]["account_id"] == $this->account_id) {
|
||||||
$phpgw->preferences->preference = $this->get_preferences();
|
$phpgw->preferences->preference = $this->get_preferences();
|
||||||
$phpgw->accounts->sync(__LINE__,__FILE__);
|
$phpgw->accounts->sync(__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user