mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
cleaned up functions.inc.php
There are still problems to resolve, but might need help resolving them. I can basicly login now
This commit is contained in:
parent
948e27a129
commit
ff2eb0bb36
@ -1,140 +1,181 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare API - Preferences *
|
||||
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* and Mark Peters <skeeter@phpgroupware.org> *
|
||||
* Manages user preferences *
|
||||
* Copyright (C) 2000, 2001 Joseph Engo *
|
||||
* -------------------------------------------------------------------------*
|
||||
* This library is part of the phpGroupWare API *
|
||||
* http://www.phpgroupware.org/api *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as published by *
|
||||
* the Free Software Foundation; either version 2.1 of the License, *
|
||||
* or any later version. *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Lesser General Public License for more details. *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this library; if not, write to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
\**************************************************************************/
|
||||
/**************************************************************************\
|
||||
* phpGroupWare API - Preferences *
|
||||
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* and Mark Peters <skeeter@phpgroupware.org> *
|
||||
* Manages user preferences *
|
||||
* Copyright (C) 2000, 2001 Joseph Engo *
|
||||
* -------------------------------------------------------------------------*
|
||||
* This library is part of the phpGroupWare API *
|
||||
* http://www.phpgroupware.org/api *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as published by *
|
||||
* the Free Software Foundation; either version 2.1 of the License, *
|
||||
* or any later version. *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Lesser General Public License for more details. *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with this library; if not, write to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
class preferences
|
||||
{
|
||||
var $account_id;
|
||||
var $account_type;
|
||||
var $data = Array();
|
||||
var $db;
|
||||
/* $Id$ */
|
||||
|
||||
class preferences
|
||||
{
|
||||
var $account_id;
|
||||
var $account_type;
|
||||
var $data = Array();
|
||||
var $db;
|
||||
|
||||
/**************************************************************************\
|
||||
* Standard constructor for setting $this->account_id *
|
||||
\**************************************************************************/
|
||||
/**************************************************************************\
|
||||
* Standard constructor for setting $this->account_id *
|
||||
\**************************************************************************/
|
||||
|
||||
function preferences($account_id = False)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$this->db = $phpgw->db;
|
||||
if ($account_id != False){ $this->account_id = $account_id; }
|
||||
}
|
||||
function preferences($account_id = False)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
$this->db = $phpgw->db;
|
||||
if ($account_id != False){ $this->account_id = $account_id; }
|
||||
}
|
||||
|
||||
/**************************************************************************\
|
||||
* These are the standard $this->account_id specific functions *
|
||||
\**************************************************************************/
|
||||
/**************************************************************************\
|
||||
* These are the standard $this->account_id specific functions *
|
||||
\**************************************************************************/
|
||||
|
||||
function read_repository()
|
||||
{
|
||||
$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->data = Array();
|
||||
$this->data = unserialize($pref_info);
|
||||
$this->db->unlock();
|
||||
// This is to supress warnings durring login
|
||||
if (gettype($this->data) == "array") {
|
||||
reset ($this->data);
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
function read_repository()
|
||||
{
|
||||
$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->data = Array();
|
||||
$this->data = unserialize($pref_info);
|
||||
$this->db->unlock();
|
||||
// This is to supress warnings durring login
|
||||
if (gettype($this->data) == "array") {
|
||||
reset ($this->data);
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function read()
|
||||
{
|
||||
if (count($this->data) == 0){ $this->read_repository(); }
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
function read()
|
||||
{
|
||||
if (count($this->data) == 0){ $this->read_repository(); }
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function add($app_name,$var,$value = "")
|
||||
{
|
||||
if (! $value) {
|
||||
global $$var;
|
||||
$value = $$var;
|
||||
}
|
||||
function add($app_name,$var,$value = "")
|
||||
{
|
||||
if (! $value) {
|
||||
global $$var;
|
||||
$value = $$var;
|
||||
}
|
||||
|
||||
$this->data[$app_name][$var] = $value;
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function delete($app_name, $var = "")
|
||||
{
|
||||
if ($var == "") {
|
||||
$this->data[$app_name] = array();
|
||||
} else {
|
||||
unset($this->data[$app_name][$var]);
|
||||
}
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
$this->data[$app_name][$var] = $value;
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function delete($app_name, $var = "")
|
||||
{
|
||||
if ($var == "") {
|
||||
$this->data[$app_name] = array();
|
||||
} else {
|
||||
unset($this->data[$app_name][$var]);
|
||||
}
|
||||
reset ($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function save_repository($update_session_info = False)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
function save_repository($update_session_info = False)
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
|
||||
if (! $phpgw->acl->check("session_only_preferences",1,"preferences")) {
|
||||
$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->data));
|
||||
} else {
|
||||
$pref_info = serialize($this->data);
|
||||
}
|
||||
|
||||
$this->db->query("insert into preferences (preference_owner,preference_value) values ('"
|
||||
. $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__);
|
||||
|
||||
$this->db->unlock();
|
||||
}
|
||||
if ($update_session_info) {
|
||||
$phpgw_info["user"]["preferences"] = $this->data;
|
||||
$phpgw->session->update_session_info();
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
if (! $phpgw->acl->check("session_only_preferences",1,"preferences")) {
|
||||
$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->data));
|
||||
} else {
|
||||
$pref_info = serialize($this->data);
|
||||
}
|
||||
|
||||
$this->db->query("insert into preferences (preference_owner,preference_value) values ('"
|
||||
. $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__);
|
||||
|
||||
$this->db->unlock();
|
||||
}
|
||||
if ($update_session_info) {
|
||||
$phpgw_info["user"]["preferences"] = $this->data;
|
||||
$phpgw->session->update_session_info();
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
function update_data($data) {
|
||||
reset($data);
|
||||
$this->data = Array();
|
||||
$this->data = $data;
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
function update_data($data) {
|
||||
reset($data);
|
||||
$this->data = Array();
|
||||
$this->data = $data;
|
||||
reset($this->data);
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
// legacy support
|
||||
function change($app_name,$var,$value = "")
|
||||
{
|
||||
return $this->add($app_name,$var,$value);
|
||||
}
|
||||
function commit($update_session_info = False)
|
||||
{
|
||||
return $this->save_repository($update_session_info);
|
||||
}
|
||||
/* legacy support */
|
||||
function change($app_name,$var,$value = "")
|
||||
{
|
||||
return $this->add($app_name,$var,$value);
|
||||
}
|
||||
function commit($update_session_info = False)
|
||||
{
|
||||
return $this->save_repository($update_session_info);
|
||||
}
|
||||
|
||||
} //end of preferences class
|
||||
?>
|
||||
/**************************************************************************\
|
||||
* These are the non-standard $this->account_id specific functions *
|
||||
\**************************************************************************/
|
||||
function verify_basic_settings()
|
||||
{
|
||||
global $phpgw, $phpgw_info;
|
||||
if (gettype($phpgw_info["user"]["preferences"]) != "array") {
|
||||
$phpgw_info["user"]["preferences"] = array();
|
||||
}
|
||||
/* This takes care of new users who dont have proper default prefs setup */
|
||||
if (! $phpgw_info["flags"]["nocommon_preferences"]) {
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) {
|
||||
$this->add("common","maxmatchs",15);
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["theme"]) {
|
||||
$this->add("common","theme","default");
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["template_set"]) {
|
||||
$this->add("common","template_set","default");
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["dateformat"]) {
|
||||
$this->add("common","dateformat","m/d/Y");
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["timeformat"]) {
|
||||
$this->add("common","timeformat",12);
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (! $phpgw_info["user"]["preferences"]["common"]["lang"]) {
|
||||
$this->add("common","lang",$phpgw->common->getPreferredLanguage());
|
||||
$preferences_update = True;
|
||||
}
|
||||
if ($preferences_update) {
|
||||
$this->save_repository();
|
||||
}
|
||||
unset($preferences_update);
|
||||
}
|
||||
}
|
||||
} //end of preferences class
|
||||
?>
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
$debugme = "on";
|
||||
/**************************************************************************\
|
||||
* phpGroupWare API - phpgwapi loader *
|
||||
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
|
||||
@ -65,112 +66,53 @@
|
||||
|
||||
function filesystem_separator()
|
||||
{
|
||||
if (PHP_OS == "Windows" || PHP_OS == "OS/2") {
|
||||
return "\\";
|
||||
if (PHP_OS == 'Windows' || PHP_OS == 'OS/2') {
|
||||
return '\\';
|
||||
} else {
|
||||
return "/";
|
||||
return '/';
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
* Optional classes, which can be disabled for performance increases *
|
||||
* - they are loaded after pulling in the config from the DB *
|
||||
\****************************************************************************/
|
||||
function load_optional()
|
||||
function print_debug($text)
|
||||
{
|
||||
global $phpgw,$phpgw_info;
|
||||
|
||||
if ($phpgw_info["flags"]["enable_categories_class"]) {
|
||||
$phpgw->categories = CreateObject("phpgwapi.categories");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_network_class"]) {
|
||||
$phpgw->network = CreateObject("phpgwapi.network");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_send_class"]) {
|
||||
$phpgw->send = CreateObject("phpgwapi.send");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_nextmatchs_class"]) {
|
||||
$phpgw->nextmatchs = CreateObject("phpgwapi.nextmatchs");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_utilities_class"]) {
|
||||
$phpgw->utilities = CreateObject("phpgwapi.utilities");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_vfs_class"]) {
|
||||
$phpgw->vfs = CreateObject("phpgwapi.vfs");
|
||||
}
|
||||
}
|
||||
|
||||
// This function needs to be optimized, its reading duplicate information.
|
||||
function phpgw_fillarray()
|
||||
{
|
||||
global $phpgw, $phpgw_info, $cd, $colspan;
|
||||
|
||||
define("PHPGW_TEMPLATE_DIR",$phpgw->common->get_tpl_dir("phpgwapi"));
|
||||
define("PHPGW_IMAGES_DIR", $phpgw->common->get_image_path("phpgwapi"));
|
||||
define("PHPGW_IMAGES_FILEDIR", $phpgw->common->get_image_dir("phpgwapi"));
|
||||
define("PHPGW_APP_ROOT", $phpgw->common->get_app_dir());
|
||||
define("PHPGW_APP_INC", $phpgw->common->get_inc_dir());
|
||||
define("PHPGW_APP_TPL", $phpgw->common->get_tpl_dir());
|
||||
define("PHPGW_IMAGES", $phpgw->common->get_image_path());
|
||||
define("PHPGW_IMAGES_DIR", $phpgw->common->get_image_dir());
|
||||
|
||||
/* LEGACY SUPPORT!!! WILL BE DELETED AFTER 0.9.11 IS RELEASED !!! */
|
||||
$phpgw_info["server"]["template_dir"] = PHPGW_TEMPLATE_DIR;
|
||||
$phpgw_info["server"]["images_dir"] = PHPGW_IMAGES_DIR;
|
||||
$phpgw_info["server"]["images_filedir"] = PHPGW_IMAGES_FILEDIR;
|
||||
$phpgw_info["server"]["app_root"] = PHPGW_APP_ROOT;
|
||||
$phpgw_info["server"]["app_inc"] = PHPGW_APP_INC;
|
||||
$phpgw_info["server"]["app_tpl"] = PHPGW_APP_TPL;
|
||||
$phpgw_info["server"]["app_images"] = PHPGW_IMAGES;
|
||||
$phpgw_info["server"]["app_images_dir"] = PHPGW_IMAGES_DIR;
|
||||
|
||||
/* ********This sets the user variables******** */
|
||||
$phpgw_info["user"]["private_dir"] = $phpgw_info["server"]["files_dir"] . "/users/"
|
||||
. $phpgw_info["user"]["userid"];
|
||||
|
||||
// This shouldn't happen, but if it does get ride of the warnings it will spit out
|
||||
if (gettype($phpgw_info["user"]["preferences"]) != "array") {
|
||||
$phpgw_info["user"]["preferences"] = array();
|
||||
}
|
||||
global $debugme;
|
||||
if ($debugme == "on") { echo 'debug: '.$text.'<br>'; }
|
||||
}
|
||||
|
||||
|
||||
print_debug('core functions are done');
|
||||
/****************************************************************************\
|
||||
* Quick verification of updated header.inc.php *
|
||||
* Quick verification of sane environment *
|
||||
\****************************************************************************/
|
||||
error_reporting(7);
|
||||
/* Make sure the header.inc.php is current. */
|
||||
if ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"]){
|
||||
echo "<center><b>You need to port your settings to the new header.inc.php version.</b></center>";
|
||||
exit;
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
* Load up all the base values *
|
||||
\****************************************************************************/
|
||||
magic_quotes_runtime(false);
|
||||
|
||||
/* Make sure the developer is following the rules. */
|
||||
if (!isset($phpgw_info["flags"]["currentapp"])) {
|
||||
echo "<b>!!! YOU DO NOT HAVE YOUR \$phpgw_info[\"flags\"][\"currentapp\"] SET !!!";
|
||||
echo "<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>";
|
||||
}
|
||||
|
||||
if (!isset($phpgw_domain)) { // make them fix their header
|
||||
magic_quotes_runtime(false);
|
||||
print_debug('sane environment');
|
||||
|
||||
/****************************************************************************\
|
||||
* Multi-Domain support *
|
||||
\****************************************************************************/
|
||||
|
||||
/* make them fix their header */
|
||||
if (!isset($phpgw_domain)) {
|
||||
echo "<center><b>The administration is required to upgrade the header.inc.php file before you can continue.</b></center>";
|
||||
exit;
|
||||
}
|
||||
|
||||
reset($phpgw_domain);
|
||||
$default_domain = each($phpgw_domain);
|
||||
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
||||
unset ($default_domain); // we kill this for security reasons
|
||||
|
||||
// This code will handle virtdomains so that is a user logins with user@domain.com, it will switch into virtualization mode.
|
||||
/* This code will handle virtdomains so that is a user logins with user@domain.com, it will switch into virtualization mode. */
|
||||
if (isset($domain)){
|
||||
$phpgw_info["user"]["domain"] = $domain;
|
||||
} elseif (isset($login) && isset($logindomain)) {
|
||||
@ -208,13 +150,10 @@
|
||||
}
|
||||
unset ($domain); // we kill this to save memory
|
||||
|
||||
// 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);
|
||||
print_debug('sane environment');
|
||||
|
||||
// Since LDAP will return system accounts, there are a few we don't want to login.
|
||||
//dont know where to put this (seek3r)
|
||||
/* 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,
|
||||
@ -239,14 +178,14 @@
|
||||
'named' => True
|
||||
);
|
||||
|
||||
|
||||
|
||||
/****************************************************************************\
|
||||
* These lines load up the API, fill up the $phpgw_info array, etc *
|
||||
\****************************************************************************/
|
||||
/* Load main class */
|
||||
$phpgw = CreateObject("phpgwapi.phpgw");
|
||||
|
||||
print_debug('main class loaded');
|
||||
|
||||
/* Fill phpgw_info["server"] array */
|
||||
$phpgw->db->query("select * from config",__LINE__,__FILE__);
|
||||
while ($phpgw->db->next_record()) {
|
||||
@ -255,76 +194,101 @@
|
||||
// Handy little shortcut
|
||||
$sep = $phpgw_info["server"]["dir_separator"];
|
||||
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
||||
if ($login != ""){
|
||||
$login_array = explode("@",$login);
|
||||
$login_id = $this->accounts->name2id($login_array[0]);
|
||||
$this->accounts->accounts($login_id);
|
||||
$this->preferences->preferences($login_id);
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login" || $phpgw_info["flags"]["currentapp"] == "logout") {
|
||||
/****************************************************************************\
|
||||
* Stuff to use if logging in or logging out *
|
||||
\****************************************************************************/
|
||||
|
||||
/* incase we are dealing with a fresh login */
|
||||
// not sure these lines are needed anymore (seek3r)
|
||||
// if (! isset($phpgw_info["user"]["preferences"]["common"]["template_set"])) {
|
||||
// $phpgw_info["user"]["preferences"]["common"]["template_set"] = "default";
|
||||
// }
|
||||
|
||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
||||
if ($login != ""){
|
||||
$login_array = explode("@",$login);
|
||||
$login_id = $phpgw->accounts->name2id($login_array[0]);
|
||||
$phpgw->accounts->accounts($login_id);
|
||||
$phpgw->preferences->preferences($login_id);
|
||||
}
|
||||
}
|
||||
} elseif (! $this->session->verify()) {
|
||||
Header("Location: " . $phpgw->redirect($phpgw->session->link($phpgw_info["server"]["webserver_url"]."/login.php","cd=10")));
|
||||
exit;
|
||||
}
|
||||
|
||||
$template_root = $this->common->get_tpl_dir();
|
||||
if (is_dir($template_root)) {
|
||||
$this->template = CreateObject("phpgwapi.Template", $template_root);
|
||||
}
|
||||
|
||||
//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";
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
* Everything from this point on will ONLY happen if *
|
||||
* the currentapp is not login or logout *
|
||||
\****************************************************************************/
|
||||
if ($phpgw_info["flags"]["currentapp"] != "login" && $phpgw_info["flags"]["currentapp"] != "logout") {
|
||||
} else {
|
||||
if (! $phpgw->session->verify()) {
|
||||
Header("Location: " . $phpgw->redirect($phpgw->session->link($phpgw_info["server"]["webserver_url"]."/login.php","cd=10")));
|
||||
exit;
|
||||
}
|
||||
load_optional();
|
||||
|
||||
phpgw_fillarray();
|
||||
/* A few hacker proof constants that will be used throught the program */
|
||||
|
||||
if ($phpgw_info["flags"]["enable_utilities_class"]){
|
||||
define("PHPGW_TEMPLATE_DIR",$phpgw->common->get_tpl_dir("phpgwapi"));
|
||||
define("PHPGW_IMAGES_DIR", $phpgw->common->get_image_path("phpgwapi"));
|
||||
define("PHPGW_IMAGES_FILEDIR", $phpgw->common->get_image_dir("phpgwapi"));
|
||||
define("PHPGW_APP_ROOT", $phpgw->common->get_app_dir());
|
||||
define("PHPGW_APP_INC", $phpgw->common->get_inc_dir());
|
||||
define("PHPGW_APP_TPL", $phpgw->common->get_tpl_dir());
|
||||
define("PHPGW_IMAGES", $phpgw->common->get_image_path());
|
||||
define("PHPGW_IMAGES_DIR", $phpgw->common->get_image_dir());
|
||||
define("PHPGW_ACL_READ",1);
|
||||
define("PHPGW_ACL_ADD",2);
|
||||
define("PHPGW_ACL_EDIT",4);
|
||||
define("PHPGW_ACL_DELETE",8);
|
||||
|
||||
/********* Load up additional phpgw_info["server"] values *********/
|
||||
/* LEGACY SUPPORT!!! WILL BE DELETED AFTER 0.9.11 IS RELEASED !!! */
|
||||
$phpgw_info["server"]["template_dir"] = PHPGW_TEMPLATE_DIR;
|
||||
$phpgw_info["server"]["images_dir"] = PHPGW_IMAGES_DIR;
|
||||
$phpgw_info["server"]["images_filedir"] = PHPGW_IMAGES_FILEDIR;
|
||||
$phpgw_info["server"]["app_root"] = PHPGW_APP_ROOT;
|
||||
$phpgw_info["server"]["app_inc"] = PHPGW_APP_INC;
|
||||
$phpgw_info["server"]["app_tpl"] = PHPGW_APP_TPL;
|
||||
$phpgw_info["server"]["app_images"] = PHPGW_IMAGES;
|
||||
$phpgw_info["server"]["app_images_dir"] = PHPGW_IMAGES_DIR;
|
||||
/* END LEGACY SUPPORT!!!*/
|
||||
|
||||
/********* This sets the user variables *********/
|
||||
$phpgw_info["user"]["private_dir"] = $phpgw_info["server"]["files_dir"]
|
||||
. "/users/".$phpgw_info["user"]["userid"];
|
||||
|
||||
/* This will make sure that a user has the basic default prefs. If not it will add them */
|
||||
$phpgw->preferences->verify_basic_settings();
|
||||
|
||||
/********* Optional classes, which can be disabled for performance increases *********/
|
||||
if ($phpgw_info["flags"]["enable_categories_class"]) {
|
||||
$phpgw->categories = CreateObject("phpgwapi.categories");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_network_class"]) {
|
||||
$phpgw->network = CreateObject("phpgwapi.network");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_send_class"]) {
|
||||
$phpgw->send = CreateObject("phpgwapi.send");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_nextmatchs_class"]) {
|
||||
$phpgw->nextmatchs = CreateObject("phpgwapi.nextmatchs");
|
||||
}
|
||||
|
||||
if ($phpgw_info["flags"]["enable_utilities_class"]) {
|
||||
$phpgw->utilities = CreateObject("phpgwapi.utilities");
|
||||
$phpgw->utilities->utilities_();
|
||||
}
|
||||
|
||||
if (! isset($phpgw_info["flags"]["nocommon_preferences"]) || ! $phpgw_info["flags"]["nocommon_preferences"]) {
|
||||
if (! isset($phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) ||
|
||||
!$phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) {
|
||||
$phpgw->preferences->add("common","maxmatchs",15);
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["theme"]) ||
|
||||
!$phpgw_info["user"]["preferences"]["common"]["theme"]) {
|
||||
$phpgw->preferences->add("common","theme","default");
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["dateformat"]) ||
|
||||
!$phpgw_info["user"]["preferences"]["common"]["dateformat"]) {
|
||||
$phpgw->preferences->add("common","dateformat","m/d/Y");
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["timeformat"]) ||
|
||||
!$phpgw_info["user"]["preferences"]["common"]["timeformat"]) {
|
||||
$phpgw->preferences->add("common","timeformat",12);
|
||||
$preferences_update = True;
|
||||
}
|
||||
if (!isset($phpgw_info["user"]["preferences"]["common"]["lang"]) ||
|
||||
!$phpgw_info["user"]["preferences"]["common"]["lang"]) {
|
||||
$phpgw->preferences->add("common","lang",$phpgw->common->getPreferredLanguage());
|
||||
$preferences_update = True;
|
||||
}
|
||||
if ($preferences_update) {
|
||||
$phpgw->preferences->save_repository();
|
||||
}
|
||||
unset($preferences_update);
|
||||
|
||||
if ($phpgw_info["flags"]["enable_vfs_class"]) {
|
||||
$phpgw->vfs = CreateObject("phpgwapi.vfs");
|
||||
}
|
||||
|
||||
/*************************************************************************\
|
||||
* These lines load up the templates class *
|
||||
\*************************************************************************/
|
||||
$phpgw->template = CreateObject("phpgwapi.Template", PHPGW_TEMPLATE_DIR);
|
||||
|
||||
/*************************************************************************\
|
||||
* These lines load up the themes *
|
||||
\*************************************************************************/
|
||||
@ -336,12 +300,13 @@
|
||||
echo "Warning: error locating selected theme";
|
||||
include (PHPGW_SERVER_ROOT . "/phpgwapi/themes/default.theme");
|
||||
if ($phpgw_info["theme"]["bg_color"] == "") {
|
||||
// Hope we don't get to this point. Better then the user seeing a
|
||||
// complety back screen and not know whats going on
|
||||
/* Hope we don't get to this point. Better then the user seeing a */
|
||||
/* complety back screen and not know whats going on */
|
||||
echo "<body bgcolor=FFFFFF>Fatal error: no themes found";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************\
|
||||
* If they are using frames, we need to set some variables *
|
||||
\*************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user