forked from extern/egroupware
now php3 compatible
This commit is contained in:
parent
61be9586c4
commit
fe8d288061
@ -64,10 +64,11 @@
|
||||
}
|
||||
|
||||
if (! $totalerrors) {
|
||||
$phpgw->db->query("SELECT account_permissions FROM accounts WHERE account_lid='" . $old_loginid . "'",__LINE__,__FILE__);
|
||||
$phpgw->db->query("SELECT account_permissions, account_id FROM accounts WHERE account_lid='" . $old_loginid . "'",__LINE__,__FILE__);
|
||||
$phpgw->db->next_record();
|
||||
$apps_before = $phpgw->db->f("account_permissions");
|
||||
|
||||
$account_id = $phpgw->db->f("account_id");
|
||||
|
||||
while ($permission = each($new_permissions)) {
|
||||
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
|
||||
$phpgw->accounts->add_app($permission[0]);
|
||||
@ -95,7 +96,9 @@
|
||||
// The following sets any default preferences needed for new applications..
|
||||
// This is smart enough to know if previous preferences were selected, use them.
|
||||
if (count($new_apps)) {
|
||||
$pref = new preferences($n_loginid);
|
||||
|
||||
$pref = new preferences($account_id);
|
||||
$t = $pref->get_preferences();
|
||||
|
||||
$docommit = False;
|
||||
for ($j=0;$j<count($new_apps);$j++) {
|
||||
@ -103,7 +106,7 @@
|
||||
$check = "common";
|
||||
else
|
||||
$check = $new_apps[$j];
|
||||
if (!$pref->preferences[$check]) {
|
||||
if (!count($t["$check"])) {
|
||||
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
||||
$docommit = True;
|
||||
}
|
||||
|
@ -63,13 +63,15 @@
|
||||
// The following sets any default preferences needed for new applications..
|
||||
// This is smart enough to know if previous preferences were selected, use them.
|
||||
$pref = new preferences(intval($n_users[$i]));
|
||||
$t = $pref->get_preferences();
|
||||
|
||||
$docommit = False;
|
||||
for ($j=1;$j<=count($apps_after);$j++) {
|
||||
if($apps_after[$j]=="admin")
|
||||
$check = "common";
|
||||
else
|
||||
$check = $apps_after[$j];
|
||||
if (!$pref->preferences[$check]) {
|
||||
if (!count($t["$check"])) {
|
||||
$phpgw->common->hook_single("add_def_pref", $apps_after[$j]);
|
||||
$docommit = True;
|
||||
}
|
||||
|
@ -63,10 +63,10 @@
|
||||
"firstname" => $n_firstname, "lastname" => $n_lastname,
|
||||
"passwd" => $n_passwd,
|
||||
"groups" => $phpgw->accounts->groups_array_to_string($n_groups)));
|
||||
$phpgw->db->query("SELECT account_permissions FROM accounts WHERE account_lid='$n_loginid'",__LINE__,__FILE__);
|
||||
$phpgw->db->query("SELECT account_permissions, account_id FROM accounts WHERE account_lid='$n_loginid'",__LINE__,__FILE__);
|
||||
$phpgw->db->next_record();
|
||||
$apps = explode(":",$phpgw->db->f("account_permissions"));
|
||||
$pref = new preferences($n_loginid);
|
||||
$pref = new preferences($phpgw->db->f("account_id"));
|
||||
$phpgw->common->hook_single("add_def_pref", "admin");
|
||||
for ($i=1;$i<sizeof($apps) - 1;$i++) {
|
||||
if($apps[$i]<>"admin")
|
||||
|
@ -57,13 +57,15 @@
|
||||
$phpgw->db->query("UPDATE accounts SET account_groups='$user_groups' WHERE account_id=".$n_users[$i]);
|
||||
|
||||
$pref = new preferences($n_users[$i]);
|
||||
$t = $pref->get_preferences();
|
||||
|
||||
$docommit = False;
|
||||
for ($j=0;$j<count($new_apps);$j++) {
|
||||
if($new_apps[$j]=="admin")
|
||||
$check = "common";
|
||||
else
|
||||
$check = $new_apps[$j];
|
||||
if (!$pref->preferences[$check]) {
|
||||
if (!count($t["$check"])) {
|
||||
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
||||
$docommit = True;
|
||||
}
|
||||
|
@ -188,10 +188,10 @@
|
||||
if (! $this->session->verify()) {
|
||||
$this->db->query("select config_value from config where config_name='webserver_url'",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
Header("Location: " . $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;
|
||||
}
|
||||
$this->preferences->preferences = $phpgw_info["user"]["preferences"];
|
||||
$this->preferences->preference = $phpgw_info["user"]["preferences"];
|
||||
$this->preferences->account_id = $phpgw_info["user"]["account_id"];
|
||||
|
||||
}
|
||||
|
@ -121,10 +121,12 @@
|
||||
|
||||
function read_groups($lid) {
|
||||
global $phpgw_info, $phpgw;
|
||||
$phpgw->db->query("select account_groups from accounts where account_lid='$lid'",__LINE__,__FILE__);
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$gl = explode(",",$phpgw->db->f("account_groups"));
|
||||
$db = $phpgw->db;
|
||||
$db->query("select account_groups from accounts where account_lid='$lid'",__LINE__,__FILE__);
|
||||
$db->next_record();
|
||||
|
||||
$gl = explode(",",$db->f("account_groups"));
|
||||
for ($i=1; $i<(count($gl)-1); $i++) {
|
||||
$ga = explode(":",$gl[$i]);
|
||||
$groups[$ga[0]] = $ga[1];
|
||||
@ -141,12 +143,13 @@
|
||||
}
|
||||
$groups = $this->read_groups($lid);
|
||||
|
||||
$db = $phpgw->db;
|
||||
$i = 0;
|
||||
while ($groups && $group = each($groups)) {
|
||||
$phpgw->db->query("select group_name from groups where group_id=".$group[0],__LINE__,__FILE__);
|
||||
$phpgw->db->next_record();
|
||||
$db->query("select group_name from groups where group_id=".$group[0],__LINE__,__FILE__);
|
||||
$db->next_record();
|
||||
$group_names[$i][0] = $group[0];
|
||||
$group_names[$i][1] = $phpgw->db->f("group_name");
|
||||
$group_names[$i][1] = $db->f("group_name");
|
||||
$group_names[$i++][2] = $group[1];
|
||||
}
|
||||
if (! $lid)
|
||||
@ -162,10 +165,11 @@
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
$db = $phpgw->db;
|
||||
// fing enabled apps in this system
|
||||
$phpgw->db->query("select app_name from applications where app_enabled != 0 order by app_order",__LINE__,__FILE__);
|
||||
$db->query("select app_name from applications where app_enabled != 0 order by app_order",__LINE__,__FILE__);
|
||||
while ($phpgw->db->next_record()) {
|
||||
$enabled_apps[$phpgw->db->f("app_name")] = 1;
|
||||
$enabled_apps[$db->f("app_name")] = 1;
|
||||
}
|
||||
|
||||
// get a ldap connection handle
|
||||
@ -192,10 +196,10 @@
|
||||
}
|
||||
|
||||
while ($group_list && $group = each($group_list)) {
|
||||
$phpgw->db->query("select group_apps from groups where group_id=".$group[0]);
|
||||
$phpgw->db->next_record();
|
||||
$db->query("select group_apps from groups where group_id=".$group[0]);
|
||||
$db->next_record();
|
||||
|
||||
$gp = explode(":",$phpgw->db->f("group_apps"));
|
||||
$gp = explode(":",$db->f("group_apps"));
|
||||
for ($i=1,$j=0;$i<count($gp)-1;$i++,$j++) {
|
||||
$enabled_apps[$gp[$i]] = 2;
|
||||
}
|
||||
@ -271,10 +275,11 @@
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
$phpgw->db->query("select group_apps from groups where group_id=".$group_id,__LINE__,__FILE__);
|
||||
$phpgw->db->next_record();
|
||||
$db = $phpgw->db;
|
||||
$db->query("select group_apps from groups where group_id=".$group_id,__LINE__,__FILE__);
|
||||
$db->next_record();
|
||||
|
||||
$gp = explode(":",$phpgw->db->f("group_apps"));
|
||||
$gp = explode(":",$db->f("group_apps"));
|
||||
for ($i=1,$j=0;$i<count($gp)-1;$i++,$j++) {
|
||||
$apps_array[$j] = $gp[$i];
|
||||
}
|
||||
@ -286,17 +291,19 @@
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
$db = $phpgw->db;
|
||||
|
||||
if ($groups) {
|
||||
$phpgw->db->query("select account_lid,account_firstname,account_lastname from accounts where account_groups"
|
||||
$db->query("select account_lid,account_firstname,account_lastname from accounts where account_groups"
|
||||
. "like '%,$groups,%'",__LINE__,__FILE__);
|
||||
} else {
|
||||
$phpgw->db->query("select account_lid,account_firstname,account_lastname from accounts",__LINE__,__FILE__);
|
||||
$db->query("select account_lid,account_firstname,account_lastname from accounts",__LINE__,__FILE__);
|
||||
}
|
||||
$i = 0;
|
||||
while ($phpgw->db->next_record()) {
|
||||
$accounts["account_lid"][$i] = $phpgw->db->f("account_lid");
|
||||
$accounts["account_firstname"][$i] = $phpgw->db->f("account_firstname");
|
||||
$accounts["account_lastname"][$i] = $phpgw->db->f("account_lastname");
|
||||
while ($db->next_record()) {
|
||||
$accounts["account_lid"][$i] = $db->f("account_lid");
|
||||
$accounts["account_firstname"][$i] = $db->f("account_firstname");
|
||||
$accounts["account_lastname"][$i] = $db->f("account_lastname");
|
||||
$i++;
|
||||
}
|
||||
return $accounts;
|
||||
|
@ -198,7 +198,7 @@
|
||||
class preferences
|
||||
{
|
||||
var $account_id = 0;
|
||||
var $preferences;
|
||||
var $preference;
|
||||
|
||||
function preferences($account_id)
|
||||
{
|
||||
@ -224,10 +224,7 @@
|
||||
$db2->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
|
||||
$db2->next_record();
|
||||
$pref_info = $db2->f("preference_value");
|
||||
// if ($PHP_VERSION < "4.0.0") {
|
||||
// $pref_info = stripslashes($pref_info)
|
||||
// }
|
||||
$this->preferences = unserialize($pref_info);
|
||||
$this->preference = unserialize($pref_info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,16 +241,16 @@
|
||||
$db->query("delete from preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__);
|
||||
|
||||
if ($PHP_VERSION < "4.0.0") {
|
||||
$pref_info = addslashes(serialize($this->preferences));
|
||||
$pref_info = addslashes(serialize($this->preference));
|
||||
} else {
|
||||
$pref_info = serialize($this->preferences);
|
||||
$pref_info = serialize($this->preference);
|
||||
}
|
||||
|
||||
$db->query("insert into preferences (preference_owner,preference_value) values ("
|
||||
. $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__);
|
||||
|
||||
if ($phpgw_info["user"]["account_id"] == $this->account_id) {
|
||||
$phpgw->preferences->preferences = $this->get_preferences();
|
||||
$phpgw->preferences->preference = $this->get_preferences();
|
||||
$phpgw->accounts->sync(__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
@ -269,7 +266,7 @@
|
||||
$value = $$var;
|
||||
}
|
||||
|
||||
$this->preferences[$app_name][$var] = $value;
|
||||
$this->preference["$app_name"]["$var"] = $value;
|
||||
}
|
||||
|
||||
function delete($app_name,$var)
|
||||
@ -277,19 +274,19 @@
|
||||
if (! $var) {
|
||||
$this->reset($app_name);
|
||||
} else {
|
||||
unset($this->preferences[$app_name][$var]);
|
||||
unset($this->preference["$app_name"]["$var"]);
|
||||
}
|
||||
}
|
||||
|
||||
// This will kill all preferences within a certain app
|
||||
function reset($app_name)
|
||||
{
|
||||
$this->preferences[$app_name] = array();
|
||||
$this->preference["$app_name"] = array();
|
||||
}
|
||||
|
||||
function get_preferences()
|
||||
{
|
||||
return $this->preferences;
|
||||
return $this->preference;
|
||||
}
|
||||
} //end of preferences class
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user