Added dual pass preferences

This commit is contained in:
jengo 2001-08-25 20:26:22 +00:00
parent 54f7afb947
commit 4fe20e1152
2 changed files with 33 additions and 9 deletions

View File

@ -11,6 +11,11 @@
behind load balanced proxys. behind load balanced proxys.
- Merged patch for eventlog, this will show debugging info and warnings to admins. - Merged patch for eventlog, this will show debugging info and warnings to admins.
Thanks j3rry Thanks j3rry
- Created dual pass preferences, this allows admins to force any preference option
on users. (eg, templates, themes, max matchs, etc)
- Created generic preferneces/preferences.php app, which uses hooks to
set user preferences, admins can force preference, or set the defaults
for new accounts.
[0.9.12] [0.9.12]
- Note: These changelogs will only contain changes in the API (preferences, admin, etc) - Note: These changelogs will only contain changes in the API (preferences, admin, etc)

View File

@ -35,7 +35,7 @@
/*! @var account_type */ /*! @var account_type */
var $account_type; var $account_type;
/*! @var data */ /*! @var data */
var $data = Array(); var $data = array();
/*! @var db */ /*! @var db */
var $db; var $db;
@ -50,7 +50,7 @@
function preferences($account_id = '') function preferences($account_id = '')
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$this->db = $phpgw->db; $this->db = $phpgw->db;
$this->account_id = get_account_id($account_id); $this->account_id = get_account_id($account_id);
} }
@ -65,19 +65,38 @@
*/ */
function read_repository() function read_repository()
{ {
$this->db->lock('phpgw_preferences'); $this->db->query("SELECT * FROM phpgw_preferences WHERE "
$this->db->query("SELECT preference_value FROM phpgw_preferences WHERE preference_owner='".$this->account_id."'",__LINE__,__FILE__); . "preference_owner='" . $this->account_id . "' or "
. "preference_owner='-1' order by preference_owner desc",__LINE__,__FILE__);
$this->db->next_record(); $this->db->next_record();
$pref_info = $this->db->f("preference_value");
/* echo "Pref_Info = ".$pref_info."<br>\n"; */ $pref_info = $this->db->f('preference_value');
$this->data = Array();
$this->data = unserialize($pref_info); $this->data = unserialize($pref_info);
$this->db->unlock();
if ($this->db->next_record())
{
$global_defaults = unserialize($this->db->f('preference_value'));
while (is_array($global_defaults) && list($appname,$values) = each($global_defaults))
{
while (is_array($values) && list($var,$value) = each($values))
{
$this->data[$appname][$var] = $value;
}
}
}
/* This is to supress warnings during login */ /* This is to supress warnings during login */
if (gettype($this->data) == 'array') if (is_array($this->data))
{ {
reset ($this->data); reset ($this->data);
} }
// This is to supress warnings durring login
if (is_array($this->data))
{
reset($this->data);
}
return $this->data; return $this->data;
} }