mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-23 11:21:42 +02:00
fixes for new preferences class
This commit is contained in:
parent
1f29754cc0
commit
f3abbd9ae4
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
$phpgw->preferences->add_newuser("addressbook","company","addressbook_True");
|
global $pref;
|
||||||
$phpgw->preferences->add_newuser("addressbook","lastname","addressbook_True");
|
$pref->change("addressbook","company","addressbook_True");
|
||||||
$phpgw->preferences->add_newuser("addressbook","firstname","addressbook_True");
|
$pref->change("addressbook","lastname","addressbook_True");
|
||||||
|
$pref->change("addressbook","firstname","addressbook_True");
|
||||||
?>
|
?>
|
||||||
|
@ -97,30 +97,18 @@
|
|||||||
if (count($new_apps)) {
|
if (count($new_apps)) {
|
||||||
$phpgw->db->query("select account_id from accounts where account_lid='$new_loginid'",__LINE__,__FILE__);
|
$phpgw->db->query("select account_id from accounts where account_lid='$new_loginid'",__LINE__,__FILE__);
|
||||||
$phpgw->db->next_record();
|
$phpgw->db->next_record();
|
||||||
$users_account_id = $phpgw->db->f("account_id");
|
|
||||||
|
|
||||||
if ($account_id <> $phpgw_info["user"]["account_id"]) {
|
$pref = new preferences($phpgw->db->f("account_id"));
|
||||||
$phpgw->db->query("SELECT preference_value FROM preferences WHERE preference_owner='$users_account_id'",__FILE__,__LINE__);
|
|
||||||
$phpgw->db->next_record();
|
|
||||||
$phpgw_newuser["user"]["preferences"] = unserialize($phpgw->db->f("preference_value"));
|
|
||||||
} else {
|
|
||||||
$phpgw_newuser["user"]["preferences"] = $phpgw_info["user"]["preferences"];
|
|
||||||
}
|
|
||||||
$docommit = False;
|
$docommit = False;
|
||||||
for ($j=0;$j<count($new_apps);$j++) {
|
for ($j=0;$j<count($new_apps);$j++) {
|
||||||
if (! @$phpgw_newuser["user"]["preferences"][$new_apps[$j]]) {
|
if (! @$pref->preferences[$new_apps[$j]]) {
|
||||||
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
||||||
$docommit = True;
|
$docommit = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($docommit) {
|
if ($docommit) {
|
||||||
if ($account_id <> $phpgw_info["user"]["account_id"]) {
|
$pref->commit();
|
||||||
// $phpgw->preferences->commit_user($users_account_id);
|
|
||||||
} else {
|
|
||||||
$phpgw_info["user"]["preferences"] = $phpgw_newuser["user"]["preferences"];
|
|
||||||
unset($phpgw_newuser);
|
|
||||||
$phpgw->preferences->commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
$after_apps = explode(":",$apps_after);
|
$after_apps = explode(":",$apps_after);
|
||||||
for ($i=1;$i<=count($after_apps);$i++) {
|
for ($i=1;$i<=count($after_apps);$i++) {
|
||||||
if (!strpos(" ".$apps_before." ",$after_apps)) {
|
if (!strpos(" ".$apps_before." ",$after_apps)) {
|
||||||
$new_apps[] = $after_apps;
|
$new_apps[] = $after_apps[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,37 +63,25 @@
|
|||||||
for ($i=0; $i<count($n_users);$i++) {
|
for ($i=0; $i<count($n_users);$i++) {
|
||||||
$phpgw->db->query("SELECT account_groups FROM accounts WHERE account_id=".$n_users[$i]);
|
$phpgw->db->query("SELECT account_groups FROM accounts WHERE account_id=".$n_users[$i]);
|
||||||
$phpgw->db->next_record();
|
$phpgw->db->next_record();
|
||||||
|
if(strpos($phpgw->db->f("account_groups"),$group_con.":0,") == 0) {
|
||||||
$user_groups = $phpgw->db->f("account_groups") . ",$group_con:0,";
|
$user_groups = $phpgw->db->f("account_groups") . ",$group_con:0,";
|
||||||
|
|
||||||
$user_groups = ereg_replace(",,",",",$user_groups);
|
$user_groups = ereg_replace(",,",",",$user_groups);
|
||||||
$phpgw->db->query("UPDATE accounts SET account_groups='$user_groups' WHERE account_id=".$n_users[$i]);
|
$phpgw->db->query("UPDATE accounts SET account_groups='$user_groups' WHERE account_id=".$n_users[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
// The following sets any default preferences needed for new applications..
|
// The following sets any default preferences needed for new applications..
|
||||||
// This is smart enough to know if previous preferences were selected, use them.
|
// This is smart enough to know if previous preferences were selected, use them.
|
||||||
if (count($new_apps)) {
|
if (count($new_apps)) {
|
||||||
if ($n_users[$i] <> $phpgw_info["user"]["account_id"]) {
|
$pref = new preferences($n_users[$i]);
|
||||||
if(is_array($phpgw_newuser)) unset($phpgw_newuser);
|
|
||||||
$phpgw->db->query("SELECT preference_value FROM preferences WHERE preference_owner=".$n_users[$i],__FILE__,__LINE__);
|
|
||||||
$phpgw->db->next_record();
|
|
||||||
$phpgw_newuser["user"]["preferences"] = unserialize($phpgw->db->f("preference_value"));
|
|
||||||
} else {
|
|
||||||
$phpgw_newuser["user"]["preferences"] = $phpgw_info["user"]["preferences"];
|
|
||||||
}
|
|
||||||
$docommit = False;
|
$docommit = False;
|
||||||
for ($j=0;$j<count($new_apps);$j++) {
|
for ($j=0;$j<count($new_apps);$j++) {
|
||||||
if (!$phpgw_newuser["user"]["preferences"][$new_apps[$j]]) {
|
if (!$pref->preferences[$new_apps[$j]]) {
|
||||||
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
||||||
$docommit = True;
|
$docommit = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($docommit) {
|
if ($docommit) {
|
||||||
if ($n_users[$i] <> $phpgw_info["user"]["account_id"]) {
|
$pref->commit();
|
||||||
$phpgw->preferences->commit_user($n_users[$i]);
|
|
||||||
} else {
|
|
||||||
$phpgw_info["user"]["preferences"] = $phpgw_newuser["user"]["preferences"];
|
|
||||||
unset($phpgw_newuser);
|
|
||||||
$phpgw->preferences->commit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
// $phpgw->preferences->add_newuser("common","maxmatchs","15");
|
global $pref;
|
||||||
// $phpgw->preferences->add_newuser("common","theme","default");
|
$pref->change("common","maxmatchs","15");
|
||||||
// $phpgw->preferences->add_newuser("common","tz_offset","0");
|
$pref->change("common","theme","default");
|
||||||
// $phpgw->preferences->add_newuser("common","dateformat","m/d/Y");
|
$pref->change("common","tz_offset","0");
|
||||||
// $phpgw->preferences->add_newuser("common","timeformat","12");
|
$pref->change("common","dateformat","m/d/Y");
|
||||||
// $phpgw->preferences->add_newuser("common","lang","en");
|
$pref->change("common","timeformat","12");
|
||||||
|
$pref->change("common","lang","en");
|
||||||
?>
|
?>
|
||||||
|
@ -66,11 +66,14 @@
|
|||||||
$phpgw->db->query("SELECT account_permissions FROM accounts WHERE account_lid='$n_loginid'",__LINE__,__FILE__);
|
$phpgw->db->query("SELECT account_permissions FROM accounts WHERE account_lid='$n_loginid'",__LINE__,__FILE__);
|
||||||
$phpgw->db->next_record();
|
$phpgw->db->next_record();
|
||||||
$apps = explode(":",$phpgw->db->f("account_permissions"));
|
$apps = explode(":",$phpgw->db->f("account_permissions"));
|
||||||
|
$phpgw->db->query("SELECT account_id FROM accounts WHERE account_lid='".$n_loginid."'");
|
||||||
|
$phpgw->db->next_record();
|
||||||
|
$pref = new preferences($phpgw->db->f("account_id"));
|
||||||
$phpgw->common->hook_single("add_def_pref", "admin");
|
$phpgw->common->hook_single("add_def_pref", "admin");
|
||||||
for ($i=1;$i<sizeof($apps) - 1;$i++) {
|
for ($i=1;$i<sizeof($apps) - 1;$i++) {
|
||||||
$phpgw->common->hook_single("add_def_pref", $apps[$i]);
|
$phpgw->common->hook_single("add_def_pref", $apps[$i]);
|
||||||
}
|
}
|
||||||
$phpgw->preferences->commit_newuser($n_loginid);
|
$pref->commit();
|
||||||
Header("Location: " . $phpgw->link("accounts.php","cd=$cd"));
|
Header("Location: " . $phpgw->link("accounts.php","cd=$cd"));
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
}
|
}
|
||||||
|
@ -60,23 +60,6 @@
|
|||||||
. addslashes($n_app_name) . "','" . addslashes($n_app_title) . "','"
|
. addslashes($n_app_name) . "','" . addslashes($n_app_title) . "','"
|
||||||
. "$n_app_status','$app_order')",__LINE__,__FILE__);
|
. "$n_app_status','$app_order')",__LINE__,__FILE__);
|
||||||
|
|
||||||
$phpgw->db->query("SELECT preference_owner, preference_value FROM preferences");
|
|
||||||
if ($phpgw->db->num_rows()) {
|
|
||||||
while ($phpgw->db->next_record()) {
|
|
||||||
if ($phpgw->db->f("preference_owner") != $phpgw_info["user"]["account_id"]) {
|
|
||||||
$phpgw_newuser["user"]["preferences"] = unserialize($phpgw->db->f("preference_value"));
|
|
||||||
if (!$phpgw_newuser["user"]["preferences"][$n_app_name]) {
|
|
||||||
$phpgw->common->hook_single("add_def_pref", $n_app_name);
|
|
||||||
$phpgw->preferences->commit_user($phpgw->db->f("preference_owner"));
|
|
||||||
}
|
|
||||||
} elseif(!$phpgw_info["user"]["preferences"][$n_app_name]) {
|
|
||||||
$phpgw->common->hook_single("add_def_pref", $n_app_name);
|
|
||||||
$phpgw_info["user"]["preferences"][$n_app_name] = $phpgw_newuser["user"]["preferences"][$n_app_name];
|
|
||||||
unset($phpgw_newuser);
|
|
||||||
$phpgw->preferences->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Header("Location: " . $phpgw->link("applications.php"));
|
Header("Location: " . $phpgw->link("applications.php"));
|
||||||
$phpgw->common->phpgw_exit();
|
$phpgw->common->phpgw_exit();
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,12 +36,17 @@
|
|||||||
$phpgw->db->lock(array("accounts","groups"));
|
$phpgw->db->lock(array("accounts","groups"));
|
||||||
|
|
||||||
$phpgw->accounts->add_app($n_group_permissions);
|
$phpgw->accounts->add_app($n_group_permissions);
|
||||||
|
$apps = $phpgw->accounts->add_app("",True)
|
||||||
$phpgw->db->query("INSERT INTO groups (group_name,group_apps) VALUES "
|
$phpgw->db->query("INSERT INTO groups (group_name,group_apps) VALUES "
|
||||||
. "('$n_group','"
|
. "('$n_group','"
|
||||||
. $phpgw->accounts->add_app("",True) . "')");
|
. $apps . "')");
|
||||||
$phpgw->db->query("SELECT group_id FROM groups WHERE group_name='$n_group'");
|
$phpgw->db->query("SELECT group_id FROM groups WHERE group_name='$n_group'");
|
||||||
$phpgw->db->next_record();
|
$phpgw->db->next_record();
|
||||||
$group_con = $phpgw->db->f("group_id");
|
$group_con = $phpgw->db->f("group_id");
|
||||||
|
$after_apps = explode(":",$apps);
|
||||||
|
for ($i=1;$i<=count($after_apps);$i++) {
|
||||||
|
$new_apps[] = $after_apps[$i];
|
||||||
|
}
|
||||||
|
|
||||||
for ($i=0; $i<count($n_users);$i++) {
|
for ($i=0; $i<count($n_users);$i++) {
|
||||||
$phpgw->db->query("SELECT account_groups FROM accounts WHERE account_id=".$n_users[$i]);
|
$phpgw->db->query("SELECT account_groups FROM accounts WHERE account_id=".$n_users[$i]);
|
||||||
@ -50,6 +55,18 @@
|
|||||||
|
|
||||||
$user_groups = ereg_replace(",,",",",$user_groups);
|
$user_groups = ereg_replace(",,",",",$user_groups);
|
||||||
$phpgw->db->query("UPDATE accounts SET account_groups='$user_groups' WHERE account_id=".$n_users[$i]);
|
$phpgw->db->query("UPDATE accounts SET account_groups='$user_groups' WHERE account_id=".$n_users[$i]);
|
||||||
|
|
||||||
|
$pref = new preferences($n_users[$i]);
|
||||||
|
$docommit = False;
|
||||||
|
for ($j=0;$j<count($new_apps);$j++) {
|
||||||
|
if (!$pref->preferences[$new_apps[$j]]) {
|
||||||
|
$phpgw->common->hook_single("add_def_pref", $new_apps[$j]);
|
||||||
|
$docommit = True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($docommit) {
|
||||||
|
$pref->commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sep = $phpgw->common->filesystem_separator();
|
$sep = $phpgw->common->filesystem_separator();
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
$phpgw->preferences->add_newuser("calendar","weekstarts","Monday");
|
global $pref;
|
||||||
$phpgw->preferences->add_newuser("calendar","workdaystarts","9");
|
$pref->change("calendar","weekstarts","Monday");
|
||||||
$phpgw->preferences->add_newuser("calendar","workdayends","17");
|
$pref->change("calendar","workdaystarts","9");
|
||||||
$phpgw->preferences->add_newuser("calendar","defaultcalendar","index.php");
|
$pref->change("calendar","workdayends","17");
|
||||||
$phpgw->preferences->add_newuser("calendar","defaultfilter","all");
|
$pref->change("calendar","defaultcalendar","index.php");
|
||||||
$phpgw->preferences->add_newuser("calendar","mainscreen_showevents","Y");
|
$pref->change("calendar","defaultfilter","all");
|
||||||
|
$pref->change("calendar","mainscreen_showevents","Y");
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user