mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
Working on load order simplification. It still needs ALOT of work
This commit is contained in:
parent
9b8a1cd8f7
commit
d3ed4a59ae
@ -115,8 +115,11 @@
|
||||
// If there is something wrong with this code TELL ME!
|
||||
// Commenting out the code will not fix it. (jengo)
|
||||
if (isset($last_loginid)) {
|
||||
$pref = new preferences($last_loginid);
|
||||
$phpgw_info["user"]["preferences"] = $pref;
|
||||
//echo "check point 1 - $last_loginid<br>\n";
|
||||
$prefs = CreateObject("phpgwapi.preferences", $last_loginid);
|
||||
//echo "check point 2<br>\n";
|
||||
$phpgw_info["user"]["preferences"] = $prefs->get_saved_preferences();
|
||||
//echo "check point 3<br>\n";
|
||||
#print "LANG:".$phpgw_info["user"]["preferences"]["common"]["lang"]."<br>";
|
||||
$phpgw->translation->add_app("login");
|
||||
$phpgw->translation->add_app("loginscreen");
|
||||
|
@ -26,20 +26,12 @@
|
||||
class accounts extends accounts_
|
||||
{
|
||||
|
||||
function accounts_const($line,$file)
|
||||
function accounts_const()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
//echo "accounts_const called<br>line: $line<br>$file";
|
||||
|
||||
$phpgw->accounts->phpgw_fillarray();
|
||||
if(!$phpgw->preferences->account_id) {
|
||||
$phpgw->preferences = CreateObject('phpgwapi.preferences',$phpgw_info["user"]["account_id"]);
|
||||
}
|
||||
$phpgw_info["user"]["preferences"] = $phpgw->preferences->get_preferences();
|
||||
|
||||
$phpgw->accounts->fill_user_array();
|
||||
$this->groups = $this->read_groups($phpgw_info["user"]["userid"]);
|
||||
$apps = CreateObject('phpgwapi.applications');
|
||||
$phpgw_info["user"]["apps"] = $apps->users_enabled_apps();
|
||||
}
|
||||
|
||||
// use this if you make any changes to phpgw_info, including preferences, config table changes, etc
|
||||
@ -55,7 +47,7 @@
|
||||
while($db->next_record()) {
|
||||
$phpgw_info["server"][$db->f("config_name")] = $db->f("config_value");
|
||||
}
|
||||
$phpgw->accounts->accounts_const(__LINE__,__FILE__);
|
||||
$phpgw->accounts->accounts_const();
|
||||
|
||||
$phpgw_info_temp["user"] = $phpgw_info["user"];
|
||||
$phpgw_info_temp["apps"] = $phpgw_info["apps"];
|
||||
|
@ -30,7 +30,7 @@
|
||||
var $group_names;
|
||||
var $apps;
|
||||
|
||||
function phpgw_fillarray()
|
||||
function fill_user_array()
|
||||
{
|
||||
global $phpgw_info, $phpgw;
|
||||
|
||||
@ -46,8 +46,13 @@
|
||||
$phpgw_info["user"]["fullname"] = $db2->f("account_firstname") . " "
|
||||
. $db2->f("account_lastname");
|
||||
$phpgw_info["user"]["groups"] = explode (",", $db2->f("account_groups"));
|
||||
|
||||
$apps = CreateObject('phpgwapi.applications',intval($phpgw_info["user"]["account_id"]));
|
||||
$phpgw_info["user"]["app_perms"] = $apps->app_perms;
|
||||
$prefs = CreateObject('phpgwapi.preferences',intval($phpgw_info["user"]["account_id"]));
|
||||
$phpgw_info["user"]["preferences"] = $prefs->get_saved_preferences();
|
||||
$phpgw_info["user"]["app_perms"] = $apps->app_perms();
|
||||
$phpgw_info["user"]["apps"] = $apps->enabled_apps();
|
||||
|
||||
$phpgw_info["user"]["lastlogin"] = $db2->f("account_lastlogin");
|
||||
$phpgw_info["user"]["lastloginfrom"] = $db2->f("account_lastloginfrom");
|
||||
$phpgw_info["user"]["lastpasswd_change"] = $db2->f("account_lastpwd_change");
|
||||
@ -72,7 +77,11 @@
|
||||
. $db2->f("account_lastname");
|
||||
$userData["groups"] = explode(",", $db2->f("account_groups"));
|
||||
$apps = CreateObject('phpgwapi.applications',intval($phpgw_info["user"]["account_id"]));
|
||||
$userData["app_perms"] = $apps->app_perms;
|
||||
$prefs = CreateObject('phpgwapi.preferences',intval($phpgw_info["user"]["account_id"]));
|
||||
$userData["preferences"] = $prefs->get_saved_preferences();
|
||||
$userData["app_perms"] = $apps->app_perms();
|
||||
$userData["apps"] = $apps->enabled_apps();
|
||||
|
||||
$userData["lastlogin"] = $db2->f("account_lastlogin");
|
||||
$userData["lastloginfrom"] = $db2->f("account_lastloginfrom");
|
||||
$userData["lastpasswd_change"] = $db2->f("account_lastpwd_change");
|
||||
@ -235,4 +244,56 @@
|
||||
return $accounts;
|
||||
}
|
||||
|
||||
}
|
||||
function username2userid($user_name)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$db2 = $phpgw->db;
|
||||
$db2->query("SELECT account_id FROM accounts WHERE account_lid='".$user_name."'",__LINE__,__FILE__);
|
||||
if($db2->num_rows()) {
|
||||
$db2->next_record();
|
||||
return $db2->f("account_id");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function userid2username($user_id)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$db2 = $phpgw->db;
|
||||
$db2->query("SELECT account_lid FROM accounts WHERE account_id='".$user_id."'",__LINE__,__FILE__);
|
||||
if($db2->num_rows()) {
|
||||
$db2->next_record();
|
||||
return $db2->f("account_lid");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function groupname2groupid($group_name)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$db2 = $phpgw->db;
|
||||
$db2->query("SELECT group_id FROM groups WHERE group_name='".$group_name."'",__LINE__,__FILE__);
|
||||
if($db2->num_rows()) {
|
||||
$db2->next_record();
|
||||
return $db2->f("group_id");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function groupid2groupname($group_id)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$db2 = $phpgw->db;
|
||||
$db2->query("SELECT group_name FROM groups WHERE group_id='".$group_id."'",__LINE__,__FILE__);
|
||||
if($db2->num_rows()) {
|
||||
$db2->next_record();
|
||||
return $db2->f("group_name");
|
||||
}else{
|
||||
return False;
|
||||
}
|
||||
}
|
||||
}//end of class
|
||||
?>
|
@ -25,13 +25,13 @@
|
||||
|
||||
class acl
|
||||
{
|
||||
var $db;
|
||||
var $db;
|
||||
|
||||
function acl()
|
||||
{
|
||||
global $phpgw;
|
||||
$this->db = $phpgw->db;
|
||||
}
|
||||
function acl()
|
||||
{
|
||||
global $phpgw;
|
||||
$this->db = $phpgw->db;
|
||||
}
|
||||
|
||||
/* This is a new class. These are sample table entries
|
||||
insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)
|
||||
@ -43,17 +43,19 @@
|
||||
insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)
|
||||
values('filemanager', 'create', 2, 'g', 2);
|
||||
*/
|
||||
|
||||
function get_rights($location,$appname = False){
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
function get_rights($location,$appname = False, $user_id = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($appname == False){
|
||||
$appname = $phpgw_info["flags"]["currentapp"];
|
||||
}
|
||||
if($user_id == "") {
|
||||
$user_id = $phpgw_info["user"]["account_id"];
|
||||
}
|
||||
// User piece
|
||||
$sql = "select acl_rights from phpgw_acl where acl_appname='$appname'";
|
||||
$sql .= " and (acl_location in ('$location','everywhere')) and ";
|
||||
$sql .= "((acl_account_type = 'u' and acl_account = ".$phpgw_info["user"]["account_id"].")";
|
||||
$sql .= "((acl_account_type = 'u' and acl_account = ".$user_id.")";
|
||||
|
||||
// Group piece
|
||||
$sql .= " or (acl_account_type='g' and acl_account in (0"; // group 0 covers all users
|
||||
@ -74,13 +76,42 @@
|
||||
return $rights;
|
||||
}
|
||||
|
||||
function check($location, $required, $appname = False){
|
||||
function check($location, $required, $appname = False, $user_id = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
$rights = $this->get_rights($location,$appname);
|
||||
$rights = $this->get_rights($location,$appname, $user_id);
|
||||
|
||||
return !!($rights & $required);
|
||||
}
|
||||
|
||||
function get_specific_rights($location, $appname = False, $id = "", $id_type = "u"){
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
if ($appname == False){
|
||||
$appname = $phpgw_info["flags"]["currentapp"];
|
||||
}
|
||||
if($id == "") {
|
||||
$id = $phpgw_info["user"]["account_id"];
|
||||
}
|
||||
// User piece
|
||||
$sql = "select acl_rights from phpgw_acl where acl_appname='$appname'";
|
||||
$sql .= " and acl_location = '$location' and ";
|
||||
$sql .= "acl_account_type = ".$id_type." and acl_account = ".$id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
$rights = 0;
|
||||
if ($this->db->num_rows() == 0 && $phpgw_info["server"]["acl_default"] != "deny"){ return True; }
|
||||
while ($this->db->next_record()) {
|
||||
if ($this->db->f("acl_rights") == 0){ return False; }
|
||||
$rights |= $this->db->f("acl_rights");
|
||||
}
|
||||
return $rights;
|
||||
}
|
||||
|
||||
function check_specific($location, $required, $appname = False, $id = "", $id_type = "u"){
|
||||
global $phpgw, $phpgw_info;
|
||||
$rights = $this->get_specific_rights($location,$appname, $id, $id_type);
|
||||
return !!($rights & $required);
|
||||
}
|
||||
|
||||
function add($app, $location, $id, $id_type, $rights){
|
||||
$sql = "insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_account_type, acl_rights)";
|
||||
$sql .= " values('".$app."', '".$location."', ".$id.", '".$id_type."', ".$rights.")";
|
||||
@ -102,10 +133,9 @@
|
||||
return True;
|
||||
}
|
||||
|
||||
function get_app_list_for_id($location, $required, $id_type = "", $id = ""){
|
||||
function get_app_list_for_id($location, $required, $id = "", $id_type = "u"){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($id == ""){ $id = $phpgw_info["user"]["account_id"]; }
|
||||
if ($id_type == ""){ $id_type = "u"; }
|
||||
$sql = "select acl_appname, acl_rights from phpgw_acl where acl_location = '$location' and ";
|
||||
$sql .= "acl_account_type = '".$id_type."' and acl_account = ".$id;
|
||||
$this->db->query($sql ,__LINE__,__FILE__);
|
||||
|
@ -25,121 +25,113 @@
|
||||
class applications
|
||||
{
|
||||
var $account_id;
|
||||
var $user_apps = Array();
|
||||
var $group_apps = Array();
|
||||
var $account_type;
|
||||
var $account_apps = Array();
|
||||
var $db;
|
||||
|
||||
function applications($var="")
|
||||
function applications($account_id = "", $account_type = "u")
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$this->db = $phpgw->db;
|
||||
if ($account_id == ""){
|
||||
$this->account_id = $phpgw_info["user"]["account_id"];
|
||||
}elseif (is_long($account_id)) {
|
||||
$this->account_id = $account_id;
|
||||
} elseif(is_string($account_id)) {
|
||||
$this->account_id = $phpgw->accounts->username2userid($account_id);
|
||||
}
|
||||
$this->account_type = $account_type;
|
||||
//echo "Account ID (Initializing applications) = ".$this->account_id."<br>\n";
|
||||
}
|
||||
|
||||
function users_enabled_apps()
|
||||
function enabled_apps()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
global $phpgw, $phpgw_info;
|
||||
if (gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
}
|
||||
while (list($app) = each($phpgw_info["apps"])) {
|
||||
if ($this->account_type == "g") {
|
||||
$check = $phpgw->acl->check_specific("run",1,$app, $this->account_id, "g");
|
||||
}else{
|
||||
$check = $phpgw->acl->check("run",1,$app, $this->account_id);
|
||||
}
|
||||
if ($check) {
|
||||
$this->account_apps[$app] = array("title" => $phpgw_info["apps"][$app]["title"], "name" => $app, "enabled" => True, "status" => $phpgw_info["apps"][$app]["status"]);
|
||||
}
|
||||
return $this->account_apps;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
if (gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
}
|
||||
while (list($app) = each($phpgw_info["apps"])) {
|
||||
if ($phpgw->acl->check("run",1,$app)) {
|
||||
$phpgw_info["user"]["apps"][$app] = array("title" => $phpgw_info["apps"][$app]["title"], "name" => $app, "enabled" => True, "status" => $phpgw_info["apps"][$app]["status"]);
|
||||
}
|
||||
}
|
||||
function app_perms()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
if (count($this->account_apps) == 0) {
|
||||
$this->enabled_apps();
|
||||
}
|
||||
while (list ($key) = each ($this->account_apps)) {
|
||||
$app[] = $this->account_apps[$key]["name"];
|
||||
}
|
||||
return $app;
|
||||
}
|
||||
|
||||
function read_account_specific() {
|
||||
global $phpgw, $phpgw_info;
|
||||
if (gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
}
|
||||
while (list($app) = each($phpgw_info["apps"])) {
|
||||
if ($phpgw->acl->check_specific("run",1,$app, $this->account_id, $this->account_type)) {
|
||||
$this->account_apps[$app] = array("title" => $phpgw_info["apps"][$app]["title"], "name" => $app, "enabled" => True, "status" => $phpgw_info["apps"][$app]["status"]);
|
||||
}
|
||||
return $this->account_apps;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
function add_app($apps) {
|
||||
if(gettype($appname) == "array") {
|
||||
while($app = each($appname)) {
|
||||
$this->account_apps[] = $app[0];
|
||||
}
|
||||
} elseif(gettype($appname) == "string") {
|
||||
$this->account_apps[] = $appname;
|
||||
}
|
||||
reset($this->account_apps);
|
||||
return $this->account_apps;
|
||||
}
|
||||
|
||||
function delete_app($appname) {
|
||||
unset($this->account_apps[$appname]);
|
||||
reset($this->account_apps);
|
||||
return $this->account_apps;
|
||||
}
|
||||
|
||||
function save_apps(){
|
||||
global $phpgw, $phpgw_info;
|
||||
$phpgw->acl->delete("%", "run", $this->account_id, $this->account_type);
|
||||
reset($this->account_apps[$group_id]);
|
||||
while($app = each($this->account_apps)) {
|
||||
$phpgw->acl->add($app["name"],'run',$this->account_id,$this->account_type,1);
|
||||
}
|
||||
reset($this->account_apps);
|
||||
return $this->account_apps;
|
||||
}
|
||||
|
||||
function read_installed_apps(){
|
||||
global $phpgw, $phpgw_info;
|
||||
$phpgw->db->query("select * from applications where app_enabled != '0' order by app_order asc",__LINE__,__FILE__);
|
||||
if($phpgw->db->num_rows()) {
|
||||
while ($phpgw->db->next_record()) {
|
||||
// echo "<br>TEST: " . $phpgw->db->f("app_order") . " - " . $phpgw->db->f("app_name");
|
||||
$name = $phpgw->db->f("app_name");
|
||||
$title = $phpgw->db->f("app_title");
|
||||
$status = $phpgw->db->f("app_enabled");
|
||||
$this->db->query("select * from applications where app_enabled != '0' order by app_order asc",__LINE__,__FILE__);
|
||||
if($this->db->num_rows()) {
|
||||
while ($this->db->next_record()) {
|
||||
$name = $this->db->f("app_name");
|
||||
$title = $this->db->f("app_title");
|
||||
$status = $this->db->f("app_enabled");
|
||||
$phpgw_info["apps"][$name] = array("title" => $title, "enabled" => True, "status" => $status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function read_user_apps($lid ="") {
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($lid == ""){$lid = $phpgw_info["user"]["account_id"];}
|
||||
$owner_found = False;
|
||||
if(gettype($lid) == "string" && $lid == $phpgw_info["user"]["user_id"]) {
|
||||
$owner_id = $phpgw_info["user"]["account_id"];
|
||||
$owner_found = True;
|
||||
}
|
||||
if($owner_found == False && gettype($lid) == "integer") {
|
||||
$owner_id = $lid;
|
||||
$owner_found = True;
|
||||
} elseif($owner_found == False && gettype($lid) == "string") {
|
||||
$phpgw->db->query("SELECT account_id FROM accounts WHERE account_lid='".$lid."'",__LINE__,__FILE__);
|
||||
if($phpgw->db->num_rows()) {
|
||||
$phpgw->db->next_record();
|
||||
$owner_id = $phpgw->db->f("account_id");
|
||||
$owner_found = True;
|
||||
}
|
||||
}
|
||||
if($owner_found) {
|
||||
$acl_apps = $phpgw->acl->get_app_list_for_id('run', 1, 'u', $owner_id);
|
||||
if ($acl_apps != False){
|
||||
reset ($acl_apps);
|
||||
while (list(,$value) = each($acl_apps)){
|
||||
$apps[] = $value;
|
||||
}
|
||||
}
|
||||
if(gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
}
|
||||
if(count($apps)) {
|
||||
for ($i=0; $i<count($apps); $i++) {
|
||||
if ($phpgw_info["apps"][$apps[$i]]["enabled"] == True) {
|
||||
$this->user_apps[$owner_id][] = $apps[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->user_apps[$owner_id];
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
function read_group_apps($group_id) {
|
||||
global $phpgw, $phpgw_info;
|
||||
$group_found = False;
|
||||
if(gettype($group_id) == "integer") {
|
||||
$group_found = True;
|
||||
} elseif(gettype($group_id) == "string") {
|
||||
$phpgw->db->query("SELECT group_id FROM groups WHERE group_name='".$group_id."'",__LINE__,__FILE__);
|
||||
if($phpgw->db->num_rows()) {
|
||||
settype($group_id,"integer");
|
||||
$phpgw->db->next_record();
|
||||
$group_id = $phpgw->db->f("group_id");
|
||||
$group_found = True;
|
||||
}
|
||||
}
|
||||
|
||||
if($group_found) {
|
||||
$acl_apps = $phpgw->acl->get_app_list_for_id('run', 1, 'g', $group_id);
|
||||
if ($acl_apps != False){
|
||||
reset ($acl_apps);
|
||||
while (list(,$value) = each($acl_apps)){
|
||||
$apps[] = $value;
|
||||
}
|
||||
}
|
||||
if(gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
}
|
||||
if(count($apps)) {
|
||||
for ($i=0;$i<count($apps);$i++) {
|
||||
if ($phpgw_info["apps"][$apps[$i]]["enabled"] == True) {
|
||||
$this->group_apps[$group_id][] = $apps[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->group_apps[$group_id];
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
function is_system_enabled($appname){
|
||||
if(gettype($phpgw_info["apps"]) != "array") {
|
||||
$this->read_installed_apps();
|
||||
@ -150,61 +142,5 @@
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function add_group_app($apps, $group_id) {
|
||||
if(gettype($appname) == "array") {
|
||||
while($app = each($appname)) {
|
||||
$this->group_apps[$group_id][] = $app[0];
|
||||
}
|
||||
} elseif(gettype($appname) == "string") {
|
||||
$this->group_apps[$group_id][] = $appname;
|
||||
}
|
||||
}
|
||||
|
||||
function add_user_app($appname, $user_id = "") {
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($user_id == ""){$user_id = $phpgw_info["user"]["account_id"];}
|
||||
if(gettype($appname) == "array") {
|
||||
while($app = each($appname)) {
|
||||
$this->user_apps[$user_id][] = $app[0];
|
||||
}
|
||||
} elseif(gettype($appname) == "string") {
|
||||
$this->user_apps[$user_id][] = $appname;
|
||||
}
|
||||
}
|
||||
|
||||
function delete_group_app($appname, $group_id) {
|
||||
unset($this->group_apps[$group_id][$appname]);
|
||||
}
|
||||
|
||||
function delete_user_app($appname, $user_id = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($user_id == ""){$user_id = $phpgw_info["user"]["account_id"];}
|
||||
unset($this->group_apps[$user_id][$appname]);
|
||||
}
|
||||
|
||||
function save_group_apps($group_id){
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
if($group_id) {
|
||||
$phpgw->acl->delete("%", "run", "g", $group_id);
|
||||
reset($this->group_apps[$group_id]);
|
||||
while($app = each($this->group_apps[$group_id])) {
|
||||
$phpgw->acl->add($app[1],'run',$group_id,'g',1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function save_user_apps($user_id = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
if ($user_id == ""){$user_id = $phpgw_info["user"]["account_id"];}
|
||||
if($user_id) {
|
||||
$phpgw->acl->delete("%", "run", "u", $user_id);
|
||||
reset($this->user_apps);
|
||||
while($app = each($this->user_apps[$user_id])) {
|
||||
$phpgw->acl->add($app[1],'run',$user_id,'u',1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
@ -32,45 +32,6 @@
|
||||
echo "Failed attempt to break in via an old Security Hole!<br>\n";
|
||||
exit;
|
||||
} unset($d1);unset($d2);unset($d3);
|
||||
//incase we are dealing with a fresh login
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["template_set"])){
|
||||
$phpgw_info["user"]["preferences"]["common"]["template_set"] = "default";
|
||||
}
|
||||
// Since LDAP will return system accounts, there are a few we don't want to login.
|
||||
$phpgw_info["server"]["global_denied_users"] = array('root' => True,
|
||||
'bin' => True,
|
||||
'daemon' => True,
|
||||
'adm' => True,
|
||||
'lp' => True,
|
||||
'sync' => True,
|
||||
'shutdown' => True,
|
||||
'halt' => True,
|
||||
'mail' => True,
|
||||
'news' => True,
|
||||
'uucp' => True,
|
||||
'operator' => True,
|
||||
'games' => True,
|
||||
'gopher' => True,
|
||||
'nobody' => True,
|
||||
'xfs' => True,
|
||||
'pgsql' => True,
|
||||
'mysql' => True,
|
||||
'postgres' => True,
|
||||
'ftp' => True,
|
||||
'gdm' => True,
|
||||
'named' => True);
|
||||
|
||||
|
||||
// I had to create this has a wrapper, becuase the phpgw.inc.php files needs it before the classes
|
||||
// are finished loading (jengo)
|
||||
function filesystem_separator()
|
||||
{
|
||||
if (PHP_OS == "Windows" || PHP_OS == "OS/2") {
|
||||
return "\\";
|
||||
} else {
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
|
||||
class common
|
||||
{
|
||||
@ -455,6 +416,7 @@
|
||||
$phpgw_info["navbar"]["home"]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/index.php");
|
||||
$phpgw_info["navbar"]["home"]["icon"] = $phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/"
|
||||
. $phpgw_info["server"]["template_set"] . "/images/home.gif";
|
||||
|
||||
while ($permission = each($phpgw_info["user"]["apps"])) {
|
||||
if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
|
||||
$phpgw_info["navbar"][$permission[0]]["title"] = $phpgw_info["apps"][$permission[0]]["title"];
|
||||
@ -601,10 +563,9 @@
|
||||
}
|
||||
/* Then add the rest */
|
||||
reset ($phpgw_info["user"]["apps"]);
|
||||
asort ($phpgw_info["user"]["apps"]);
|
||||
while (list (, $appname) = each ($phpgw_info["user"]["apps"])){
|
||||
if (gettype($appname) != "array" && $appname != "" && $completed_hooks[$appname] != True){
|
||||
$f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"];
|
||||
while ($permission = each($phpgw_info["user"]["apps"])) {
|
||||
if ($completed_hooks[$permission[0]] != True){
|
||||
$f = $phpgw_info["server"]["server_root"] . "/" . $permission[0] . "/inc/hook_".$phpgw_info["flags"]["currentapp"];
|
||||
if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; }
|
||||
if (file_exists($f)) {include($f);}
|
||||
}
|
||||
@ -635,10 +596,9 @@
|
||||
|
||||
function hook_count($location = ""){
|
||||
global $phpgw, $phpgw_info;
|
||||
reset ($phpgw_info["user"]["app_perms"]);
|
||||
$count = 0;
|
||||
while (list (, $appname) = each ($phpgw_info["user"]["app_perms"])){
|
||||
$f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/hook_".$phpgw_info["flags"]["currentapp"];
|
||||
while ($permission = each($phpgw_info["user"]["apps"])) {
|
||||
$f = $phpgw_info["server"]["server_root"] . "/" . $permission[0] . "/inc/hook_".$phpgw_info["flags"]["currentapp"];
|
||||
if ($location != ""){$f .= "_".$location.".inc.php";}else{$f .= ".inc.php"; }
|
||||
if (file_exists($f)) {++$count;}
|
||||
}
|
||||
@ -912,11 +872,4 @@
|
||||
system("grep -r '^[ \t]*function' *");
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
function common_()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$phpgw_info["server"]["dir_separator"] = $this->filesystem_separator();
|
||||
}
|
||||
|
||||
}
|
||||
}//end common class
|
||||
|
@ -111,30 +111,35 @@
|
||||
|
||||
/* Load selected accounts class */
|
||||
if (empty($phpgw_info["server"]["account_repository"])){$phpgw_info["server"]["account_repository"] = $phpgw_info["server"]["auth_type"];}
|
||||
$this->accounts = CreateObject("phpgwapi.accounts");
|
||||
$this->preferences = CreateObject("phpgwapi.preferences");
|
||||
$this->session = CreateObject("phpgwapi.sessions");
|
||||
$this->acl = CreateObject("phpgwapi.acl");
|
||||
$this->applications = CreateObject("phpgwapi.applications");
|
||||
$this->accounts = CreateObject("phpgwapi.accounts");
|
||||
$this->session = CreateObject("phpgwapi.sessions");
|
||||
// $this->applications = CreateObject("phpgwapi.applications");
|
||||
// $this->preferences = CreateObject("phpgwapi.preferences");
|
||||
//echo "check point 1<br>\n";
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
||||
$log = explode("@",$login);
|
||||
$this->preferences = CreateObject("phpgwapi.preferences", $log[0]);
|
||||
$this->applications = CreateObject("phpgwapi.applications");
|
||||
//echo "check point 2<br>\n";
|
||||
if ($login != ""){
|
||||
$log = explode("@",$login);
|
||||
$this->preferences = CreateObject("phpgwapi.preferences", $log[0]);
|
||||
// $this->applications = CreateObject("phpgwapi.applications", $log[0]);
|
||||
}
|
||||
}else{
|
||||
//echo "check point 3<br>\n";
|
||||
if (! $this->session->verify()) {
|
||||
//echo "check point 4<br>\n";
|
||||
$this->db->query("select config_value from config where config_name='webserver_url'",__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
Header("Location: " . $this->redirect($this->link($this->db->f("config_value")."/login.php","cd=10")));
|
||||
exit;
|
||||
}
|
||||
//echo "check point 5<br>\n";
|
||||
$this->preferences = CreateObject("phpgwapi.preferences", intval($phpgw_info["user"]["account_id"]));
|
||||
$this->applications = CreateObject("phpgwapi.applications");
|
||||
$this->applications->users_enabled_apps();
|
||||
$this->applications = CreateObject("phpgwapi.applications", intval($phpgw_info["user"]["account_id"]));
|
||||
}
|
||||
|
||||
$this->translation = CreateObject("phpgwapi.translation");
|
||||
|
||||
$sep = filesystem_separator();
|
||||
$sep = $phpgw_info["server"]["dir_separator"];
|
||||
$template_root = $this->common->get_tpl_dir();
|
||||
|
||||
if (is_dir($template_root)) {
|
||||
@ -157,11 +162,11 @@
|
||||
// please let us know if this doesn't work for you!
|
||||
if (! $url && (PHP_OS == "Windows" || PHP_OS == "OS/2" || PHP_OS == "WIN32" || PHP_OS == "WIN16")) {
|
||||
$exe = strpos($PHP_SELF,"php.exe");
|
||||
if ($exe != false) {
|
||||
if ($exe != false) {
|
||||
$exe += 7; // strlen("php.exe")
|
||||
$url_root = split ("/", $phpgw_info["server"]["webserver_url"]);
|
||||
$url = (strlen($url_root[0])? $url_root[0].'//':'') . $url_root[2];
|
||||
$url .= substr($PHP_SELF,$exe,strlen($PHP_SELF)-$exe);
|
||||
$url .= substr($PHP_SELF,$exe,strlen($PHP_SELF)-$exe);
|
||||
}
|
||||
}
|
||||
if (! $url) {
|
||||
@ -251,5 +256,4 @@
|
||||
|
||||
return $phpgw->translation->translate($key);
|
||||
}
|
||||
}
|
||||
|
||||
}//end phpgw class
|
||||
|
@ -1,258 +0,0 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare *
|
||||
* http://www.phpgroupware.org *
|
||||
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/****************************************************************************\
|
||||
* Required classes *
|
||||
\****************************************************************************/
|
||||
/* Load selected database class */
|
||||
if (empty($phpgw_info["server"]["db_type"])){$phpgw_info["server"]["db_type"] = "mysql";}
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
|
||||
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_session.inc.php");
|
||||
|
||||
/* Load selected translation class */
|
||||
if (empty($phpgw_info["server"]["translation_system"])){$phpgw_info["server"]["translation_system"] = "sql";}
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_lang_".$phpgw_info["server"]["translation_system"].".inc.php");
|
||||
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_crypto.inc.php");
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_template.inc.php");
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_common.inc.php");
|
||||
|
||||
/****************************************************************************\
|
||||
* Our API class starts here *
|
||||
\****************************************************************************/
|
||||
class phpgw
|
||||
{
|
||||
var $accounts;
|
||||
var $acl;
|
||||
var $auth;
|
||||
var $db;
|
||||
var $debug = 0; // This will turn on debugging information.
|
||||
// (Not fully working)
|
||||
var $crypto;
|
||||
var $categories;
|
||||
var $common;
|
||||
var $hooks;
|
||||
var $network;
|
||||
var $nextmatchs;
|
||||
var $preferences;
|
||||
var $session;
|
||||
var $send;
|
||||
var $template;
|
||||
var $translation;
|
||||
var $utilities;
|
||||
var $vfs;
|
||||
|
||||
var $calendar;
|
||||
var $msg;
|
||||
|
||||
var $addressbook;
|
||||
var $todo;
|
||||
|
||||
// This is here so you can decied what the best way to handle bad sessions
|
||||
// You could redirect them to login.php with code 2 or use the default
|
||||
// I recommend using the default until all of the bugs are worked out.
|
||||
|
||||
function phpgw_()
|
||||
{
|
||||
global $phpgw_info, $sessionid, $login;
|
||||
/************************************************************************\
|
||||
* Required classes *
|
||||
\************************************************************************/
|
||||
$this->db = new db;
|
||||
$this->db->Host = $phpgw_info["server"]["db_host"];
|
||||
$this->db->Type = $phpgw_info["server"]["db_type"];
|
||||
$this->db->Database = $phpgw_info["server"]["db_name"];
|
||||
$this->db->User = $phpgw_info["server"]["db_user"];
|
||||
$this->db->Password = $phpgw_info["server"]["db_pass"];
|
||||
|
||||
if ($this->debug) {
|
||||
$this->db->Debug = 1;
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
||||
$this->db->query("select * from config",__LINE__,__FILE__);
|
||||
while($this->db->next_record()) {
|
||||
$phpgw_info["server"][$this->db->f("config_name")] = $this->db->f("config_value");
|
||||
}
|
||||
} else {
|
||||
$config_var = array("encryptkey","auth_type","account_repository");
|
||||
$c= "";
|
||||
for ($i=0;$i<count($config_var);$i++) {
|
||||
if($i) $c .= " OR ";
|
||||
$c .= "config_name='".$config_var[$i]."'";
|
||||
}
|
||||
$this->db->query("select * from config where $c",__LINE__,__FILE__);
|
||||
while($this->db->next_record()) {
|
||||
$phpgw_info["server"][$this->db->f("config_name")] = $this->db->f("config_value");
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************\
|
||||
* Continue adding the classes *
|
||||
\************************************************************************/
|
||||
$this->common = new common;
|
||||
$this->hooks = new hooks;
|
||||
|
||||
/* Load selected authentication class */
|
||||
if (empty($phpgw_info["server"]["auth_type"])){$phpgw_info["server"]["auth_type"] = "sql";}
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_auth_".$phpgw_info["server"]["auth_type"].".inc.php");
|
||||
|
||||
$this->auth = new auth;
|
||||
|
||||
/* Load selected accounts class */
|
||||
if (empty($phpgw_info["server"]["account_repository"])){$phpgw_info["server"]["account_repository"] = $phpgw_info["server"]["auth_type"];}
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
||||
include($phpgw_info["server"]["api_inc"] . "/phpgw_accounts_shared.inc.php");
|
||||
|
||||
$this->accounts = new accounts;
|
||||
$this->preferences = new preferences(0);
|
||||
|
||||
$this->session = new sessions;
|
||||
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
||||
$log = explode("@",$login);
|
||||
$this->preferences = new preferences($log[0]);
|
||||
}else{
|
||||
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->redirect($this->link($this->db->f("config_value")."/login.php","cd=10")));
|
||||
exit;
|
||||
}
|
||||
$this->preferences = new preferences(intval($phpgw_info["user"]["account_id"]));
|
||||
}
|
||||
|
||||
$this->translation = new translation;
|
||||
$this->acl = new acl;
|
||||
|
||||
$sep = filesystem_separator();
|
||||
$template_root = $this->common->get_tpl_dir();
|
||||
|
||||
if (is_dir($template_root)) {
|
||||
$this->template = new Template($template_root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************\
|
||||
* Core functions *
|
||||
\**************************************************************************/
|
||||
|
||||
/* A function to handle session support via url session id, or cookies */
|
||||
function link($url = "", $extravars = "")
|
||||
{
|
||||
global $phpgw, $phpgw_info, $usercookie, $kp3, $PHP_SELF;
|
||||
if (! $kp3)
|
||||
$kp3 = $phpgw_info["user"]["kp3"];
|
||||
|
||||
// PHP won't allow you to set a var to a var
|
||||
// or function for default values
|
||||
if (! $url) {
|
||||
$url_root = split ("/", $phpgw_info["server"]["webserver_url"]);
|
||||
$url = $url_root[0]."//".$url_root[2].$PHP_SELF;
|
||||
/* Some hosting providers have their paths screwy.
|
||||
If the value from $PHP_SELF is not what you expect, you can use this to patch it
|
||||
It will need to be adjusted to your specific problem tho.
|
||||
*/
|
||||
//$patched_php_self = str_replace("/php4/php/phpgroupware", "/phpgroupware", $PHP_SELF);
|
||||
$patched_php_self = $PHP_SELF;
|
||||
$url = $url_root[0]."//".$url_root[2].$patched_php_self;
|
||||
}
|
||||
|
||||
if (isset($phpgw_info["server"]["usecookies"]) &&
|
||||
$phpgw_info["server"]["usecookies"]) {
|
||||
if ($extravars) {
|
||||
$url .= "?$extravars";
|
||||
}
|
||||
} else {
|
||||
$url .= "?sessionid=" . $phpgw_info["user"]["sessionid"];
|
||||
$url .= "&kp3=" . $kp3;
|
||||
$url .= "&domain=" . $phpgw_info["user"]["domain"];
|
||||
// This doesn't belong in the API.
|
||||
// Its up to the app to pass this value. (jengo)
|
||||
// Putting it into the app requires a massive number of updates in email app.
|
||||
// Until that happens this needs to stay here (seek3r)
|
||||
if ($phpgw_info["flags"]["newsmode"]) {
|
||||
$url .= "&newsmode=on";
|
||||
}
|
||||
|
||||
if ($extravars) {
|
||||
$url .= "&$extravars";
|
||||
}
|
||||
}
|
||||
|
||||
$url = str_replace("/?", "/index.php?", $url);
|
||||
$webserver_url_count = strlen($phpgw_info["server"]["webserver_url"]);
|
||||
$slash_check = strtolower(substr($url ,0,1));
|
||||
if(substr($url ,0,$webserver_url_count) != $phpgw_info["server"]["webserver_url"]) {
|
||||
$app = $phpgw_info["flags"]["currentapp"];
|
||||
if($slash_check == "/") {
|
||||
$url = $phpgw_info["server"]["webserver_url"].$url;
|
||||
} elseif ($app == "home" || $app == "logout" || $app == "login"){
|
||||
$url = $phpgw_info["server"]["webserver_url"]."/".$url;
|
||||
}else{
|
||||
$url = $phpgw_info["server"]["webserver_url"]."/".$app."/".$url;
|
||||
}
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
function strip_html($s)
|
||||
{
|
||||
return htmlspecialchars(stripslashes($s));
|
||||
}
|
||||
|
||||
function redirect($url = "")
|
||||
{
|
||||
// This function handles redirects under iis and apache
|
||||
// it assumes that $phpgw->link() has already been called
|
||||
|
||||
global $HTTP_ENV_VARS;
|
||||
|
||||
$iis = strpos($HTTP_ENV_VARS["SERVER_SOFTWARE"], "IIS", 0);
|
||||
|
||||
if ( !$url ) {
|
||||
$url = $PHP_SELF;
|
||||
}
|
||||
if ( $iis ) {
|
||||
echo "\n<HTML>\n<HEAD>\n<TITLE>Redirecting to $url</TITLE>";
|
||||
echo "\n<META HTTP-EQUIV=REFRESH CONTENT=\"0; URL=$url\">";
|
||||
echo "\n</HEAD><BODY>";
|
||||
echo "<H3>Please continue to <a href=\"$url\">this page</a></H3>";
|
||||
echo "\n</BODY></HTML>";
|
||||
exit;
|
||||
} else {
|
||||
Header("Location: $url");
|
||||
print("\n\n");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function lang($key, $m1 = "", $m2 = "", $m3 = "", $m4 = "")
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
return $phpgw->translation->translate($key);
|
||||
}
|
||||
|
||||
// Some people might prefear to use this one
|
||||
function _L($key, $m1 = "", $m2 = "", $m3 = "", $m4 = "")
|
||||
{
|
||||
global $phpgw;
|
||||
|
||||
return $phpgw->translation->translate($key);
|
||||
}
|
||||
}
|
||||
|
@ -27,42 +27,46 @@
|
||||
class preferences
|
||||
{
|
||||
var $account_id;
|
||||
var $preference;
|
||||
var $preference = Array();
|
||||
var $db;
|
||||
|
||||
function preferences($account_id = 0)
|
||||
function preferences($account_id = "")
|
||||
{
|
||||
global $phpgw;
|
||||
// echo "Account ID (Initializing) = ".$account_id."<br>\n";
|
||||
|
||||
|
||||
$db2 = $phpgw->db;
|
||||
$load_pref = True;
|
||||
if (is_long($account_id) && $account_id) {
|
||||
//echo "Account_id = ".$account_id."<br>\n";
|
||||
global $phpgw, $phpgw_info;
|
||||
$this->db = $phpgw->db;
|
||||
if ($account_id == ""){
|
||||
$this->account_id = $phpgw_info["user"]["account_id"];
|
||||
}elseif (is_long($account_id)) {
|
||||
$this->account_id = $account_id;
|
||||
} elseif(is_string($account_id)) {
|
||||
$db2->query("SELECT account_id FROM accounts WHERE account_lid='".$account_id."'",__LINE__,__FILE__);
|
||||
if($db2->num_rows()) {
|
||||
$db2->next_record();
|
||||
$this->account_id = $db2->f("account_id");
|
||||
} else {
|
||||
$load_pref = False;
|
||||
}
|
||||
} else {
|
||||
$load_pref = False;
|
||||
$this->account_id = $phpgw->accounts->username2userid($account_id);
|
||||
}
|
||||
//echo "Account ID (Initializing prefs) = ".$this->account_id."<br>\n";
|
||||
}
|
||||
|
||||
function get_saved_preferences()
|
||||
{
|
||||
global $phpgw;
|
||||
$this->db->lock("preferences");
|
||||
$this->db->query("SELECT preference_value FROM preferences WHERE preference_owner=".$this->account_id,__LINE__,__FILE__);
|
||||
$this->db->next_record();
|
||||
$pref_info = $this->db->f("preference_value");
|
||||
$this->preference = Array();
|
||||
$this->preference = unserialize($pref_info);
|
||||
$this->db->unlock();
|
||||
//echo "Account ID (get_saved_pref) = ".$this->account_id."<br>\n";
|
||||
//echo "Preferences = ".$this->preference."<br>\n";
|
||||
return $this->preference;
|
||||
}
|
||||
|
||||
//echo "Load Pref = $load_pref<br>\n";
|
||||
//echo "Account ID (After Initializing) = ".$this->account_id."<br>\n";
|
||||
|
||||
if ($load_pref) {
|
||||
$db2->lock("preferences");
|
||||
$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";
|
||||
$db2->unlock();
|
||||
}
|
||||
function get_preferences()
|
||||
{
|
||||
global $phpgw;
|
||||
//echo "Account ID (get_pref) = ".$this->account_id."<br>\n";
|
||||
//echo "Preferences = ".$this->preference."<br>\n";
|
||||
return $this->preference;
|
||||
}
|
||||
|
||||
// This should be called when you are done makeing changes to the preferences
|
||||
@ -72,11 +76,8 @@
|
||||
|
||||
//echo "<br>commit called<br>Line: $line<br>File: $file".$phpgw_info["user"]["account_id"]."<br>";
|
||||
if ($this->account_id) {
|
||||
$db = $phpgw->db;
|
||||
|
||||
$db->lock("preferences");
|
||||
|
||||
$db->query("delete from preferences where preference_owner=" . $this->account_id,__LINE__,__FILE__);
|
||||
$this->db->lock("preferences");
|
||||
$this->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));
|
||||
@ -84,14 +85,13 @@
|
||||
$pref_info = serialize($this->preference);
|
||||
}
|
||||
|
||||
$db->query("insert into preferences (preference_owner,preference_value) values ("
|
||||
$this->db->query("insert into preferences (preference_owner,preference_value) values ("
|
||||
. $this->account_id . ",'" . $pref_info . "')",__LINE__,__FILE__);
|
||||
|
||||
$db->unlock();
|
||||
|
||||
$this->db->unlock();
|
||||
|
||||
if ($phpgw_info["user"]["account_id"] == $this->account_id) {
|
||||
$phpgw->preferences->preference = $this->get_preferences();
|
||||
$this->get_saved_preferences();
|
||||
$phpgw->accounts->sync(__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
@ -125,9 +125,5 @@
|
||||
$this->preference["$app_name"] = array();
|
||||
}
|
||||
|
||||
function get_preferences()
|
||||
{
|
||||
return $this->preference;
|
||||
}
|
||||
} //end of preferences class
|
||||
?>
|
||||
?>
|
@ -74,7 +74,6 @@
|
||||
|
||||
$phpgw_info_flags = $phpgw_info["flags"];
|
||||
$phpgw_info = $phpgw->crypto->decrypt($db->f("session_info"));
|
||||
|
||||
$phpgw_info["flags"] = $phpgw_info_flags;
|
||||
|
||||
$userid_array = explode("@",$db->f("session_lid"));
|
||||
@ -155,7 +154,7 @@
|
||||
unset ($phpgw_info["server"]["default_domain"]); // we kill this for security reasons
|
||||
}
|
||||
|
||||
//$phpgw->accounts->accounts_const();
|
||||
$phpgw->accounts->accounts_const();
|
||||
|
||||
$phpgw_info["user"]["session_ip"] = $this->getuser_ip();
|
||||
|
||||
|
@ -67,6 +67,16 @@
|
||||
return $phpgw->common->check_code($code);
|
||||
}
|
||||
|
||||
function filesystem_separator()
|
||||
{
|
||||
if (PHP_OS == "Windows" || PHP_OS == "OS/2") {
|
||||
return "\\";
|
||||
} else {
|
||||
return "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************\
|
||||
* Optional classes, which can be disabled for performance increases *
|
||||
* - they are loaded after pulling in the config from the DB *
|
||||
@ -167,12 +177,28 @@
|
||||
}
|
||||
unset ($domain); // we kill this to save memory
|
||||
|
||||
$phpgw_info["server"]["dir_separator"] = filesystem_separator();
|
||||
$phpgw_info["server"]["sep"] = $phpgw_info["server"]["dir_separator"];
|
||||
|
||||
// some constants which can be used in setting user acl rights.
|
||||
define("PHPGW_ACL_READ",1);
|
||||
define("PHPGW_ACL_ADD",2);
|
||||
define("PHPGW_ACL_EDIT",4);
|
||||
define("PHPGW_ACL_DELETE",8);
|
||||
|
||||
//incase we are dealing with a fresh login
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["template_set"])){
|
||||
$phpgw_info["user"]["preferences"]["common"]["template_set"] = "default";
|
||||
}
|
||||
|
||||
// Since LDAP will return system accounts, there are a few we don't want to login.
|
||||
$phpgw_info["server"]["global_denied_users"] = array(
|
||||
'root'=>True,'bin'=>True,'daemon'=>True,'adm'=>True,'lp'=>True,'sync'=>True,
|
||||
'shutdown' => True,'halt'=>True,'mail'=>True,'news'=>True,'uucp'=>True,
|
||||
'operator' => True,'games'=>True,'gopher'=>True,'nobody'=>True,'xfs'=>True,
|
||||
'pgsql'=>True,'mysql'=>True,'postgres'=>True,'ftp'=>True,'gdm'=>True,'named'=>True
|
||||
);
|
||||
|
||||
// This function needs to be optimized, its reading duplicate information.
|
||||
function phpgw_fillarray()
|
||||
{
|
||||
@ -210,7 +236,6 @@
|
||||
load_optional();
|
||||
|
||||
phpgw_fillarray();
|
||||
$phpgw->common->common_();
|
||||
|
||||
if ($phpgw_info["flags"]["enable_utilities_class"]){
|
||||
$phpgw->utilities->utilities_();
|
||||
|
Loading…
Reference in New Issue
Block a user