mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +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
|
<?php
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* phpGroupWare API - Preferences *
|
* phpGroupWare API - Preferences *
|
||||||
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
* This file written by Joseph Engo <jengo@phpgroupware.org> *
|
||||||
* and Mark Peters <skeeter@phpgroupware.org> *
|
* and Mark Peters <skeeter@phpgroupware.org> *
|
||||||
* Manages user preferences *
|
* Manages user preferences *
|
||||||
* Copyright (C) 2000, 2001 Joseph Engo *
|
* Copyright (C) 2000, 2001 Joseph Engo *
|
||||||
* -------------------------------------------------------------------------*
|
* -------------------------------------------------------------------------*
|
||||||
* This library is part of the phpGroupWare API *
|
* This library is part of the phpGroupWare API *
|
||||||
* http://www.phpgroupware.org/api *
|
* http://www.phpgroupware.org/api *
|
||||||
* ------------------------------------------------------------------------ *
|
* ------------------------------------------------------------------------ *
|
||||||
* This library is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms of the GNU Lesser General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2.1 of the License, *
|
* the Free Software Foundation; either version 2.1 of the License, *
|
||||||
* or any later version. *
|
* or any later version. *
|
||||||
* This library is distributed in the hope that it will be useful, but *
|
* This library is distributed in the hope that it will be useful, but *
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Lesser General Public License for more details. *
|
* See the GNU Lesser General Public License for more details. *
|
||||||
* You should have received a copy of the GNU Lesser General Public License *
|
* 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, *
|
* along with this library; if not, write to the Free Software Foundation, *
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
class preferences
|
class preferences
|
||||||
{
|
{
|
||||||
var $account_id;
|
var $account_id;
|
||||||
var $account_type;
|
var $account_type;
|
||||||
var $data = Array();
|
var $data = Array();
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* Standard constructor for setting $this->account_id *
|
* Standard constructor for setting $this->account_id *
|
||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
function preferences($account_id = False)
|
function preferences($account_id = False)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
$this->db = $phpgw->db;
|
$this->db = $phpgw->db;
|
||||||
if ($account_id != False){ $this->account_id = $account_id; }
|
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()
|
function read_repository()
|
||||||
{
|
{
|
||||||
$this->db->lock("preferences");
|
$this->db->lock("preferences");
|
||||||
$this->db->query("SELECT preference_value FROM preferences WHERE preference_owner='".$this->account_id."'",__LINE__,__FILE__);
|
$this->db->query("SELECT preference_value FROM preferences WHERE preference_owner='".$this->account_id."'",__LINE__,__FILE__);
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
$pref_info = $this->db->f("preference_value");
|
$pref_info = $this->db->f("preference_value");
|
||||||
$this->data = Array();
|
$this->data = Array();
|
||||||
$this->data = unserialize($pref_info);
|
$this->data = unserialize($pref_info);
|
||||||
$this->db->unlock();
|
$this->db->unlock();
|
||||||
// This is to supress warnings durring login
|
// This is to supress warnings durring login
|
||||||
if (gettype($this->data) == "array") {
|
if (gettype($this->data) == "array") {
|
||||||
reset ($this->data);
|
reset ($this->data);
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function read()
|
function read()
|
||||||
{
|
{
|
||||||
if (count($this->data) == 0){ $this->read_repository(); }
|
if (count($this->data) == 0){ $this->read_repository(); }
|
||||||
reset ($this->data);
|
reset ($this->data);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add($app_name,$var,$value = "")
|
function add($app_name,$var,$value = "")
|
||||||
{
|
{
|
||||||
if (! $value) {
|
if (! $value) {
|
||||||
global $$var;
|
global $$var;
|
||||||
$value = $$var;
|
$value = $$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data[$app_name][$var] = $value;
|
$this->data[$app_name][$var] = $value;
|
||||||
reset($this->data);
|
reset($this->data);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete($app_name, $var = "")
|
function delete($app_name, $var = "")
|
||||||
{
|
{
|
||||||
if ($var == "") {
|
if ($var == "") {
|
||||||
$this->data[$app_name] = array();
|
$this->data[$app_name] = array();
|
||||||
} else {
|
} else {
|
||||||
unset($this->data[$app_name][$var]);
|
unset($this->data[$app_name][$var]);
|
||||||
}
|
}
|
||||||
reset ($this->data);
|
reset ($this->data);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_repository($update_session_info = False)
|
function save_repository($update_session_info = False)
|
||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
if (! $phpgw->acl->check("session_only_preferences",1,"preferences")) {
|
if (! $phpgw->acl->check("session_only_preferences",1,"preferences")) {
|
||||||
$this->db->lock("preferences");
|
$this->db->lock("preferences");
|
||||||
$this->db->query("delete from preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__);
|
$this->db->query("delete from preferences where preference_owner='" . $this->account_id . "'",__LINE__,__FILE__);
|
||||||
|
|
||||||
if ($PHP_VERSION < "4.0.0") {
|
if ($PHP_VERSION < "4.0.0") {
|
||||||
$pref_info = addslashes(serialize($this->data));
|
$pref_info = addslashes(serialize($this->data));
|
||||||
} else {
|
} else {
|
||||||
$pref_info = serialize($this->data);
|
$pref_info = serialize($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->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__);
|
. $this->account_id . "','" . $pref_info . "')",__LINE__,__FILE__);
|
||||||
|
|
||||||
$this->db->unlock();
|
$this->db->unlock();
|
||||||
}
|
}
|
||||||
if ($update_session_info) {
|
if ($update_session_info) {
|
||||||
$phpgw_info["user"]["preferences"] = $this->data;
|
$phpgw_info["user"]["preferences"] = $this->data;
|
||||||
$phpgw->session->update_session_info();
|
$phpgw->session->update_session_info();
|
||||||
}
|
}
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_data($data) {
|
function update_data($data) {
|
||||||
reset($data);
|
reset($data);
|
||||||
$this->data = Array();
|
$this->data = Array();
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
reset($this->data);
|
reset($this->data);
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacy support
|
/* legacy support */
|
||||||
function change($app_name,$var,$value = "")
|
function change($app_name,$var,$value = "")
|
||||||
{
|
{
|
||||||
return $this->add($app_name,$var,$value);
|
return $this->add($app_name,$var,$value);
|
||||||
}
|
}
|
||||||
function commit($update_session_info = False)
|
function commit($update_session_info = False)
|
||||||
{
|
{
|
||||||
return $this->save_repository($update_session_info);
|
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
|
<?php
|
||||||
|
$debugme = "on";
|
||||||
/**************************************************************************\
|
/**************************************************************************\
|
||||||
* phpGroupWare API - phpgwapi loader *
|
* phpGroupWare API - phpgwapi loader *
|
||||||
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
|
* This file written by Dan Kuykendall <seek3r@phpgroupware.org> *
|
||||||
@ -65,112 +66,53 @@
|
|||||||
|
|
||||||
function filesystem_separator()
|
function filesystem_separator()
|
||||||
{
|
{
|
||||||
if (PHP_OS == "Windows" || PHP_OS == "OS/2") {
|
if (PHP_OS == 'Windows' || PHP_OS == 'OS/2') {
|
||||||
return "\\";
|
return '\\';
|
||||||
} else {
|
} else {
|
||||||
return "/";
|
return '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************\
|
function print_debug($text)
|
||||||
* Optional classes, which can be disabled for performance increases *
|
|
||||||
* - they are loaded after pulling in the config from the DB *
|
|
||||||
\****************************************************************************/
|
|
||||||
function load_optional()
|
|
||||||
{
|
{
|
||||||
global $phpgw,$phpgw_info;
|
global $debugme;
|
||||||
|
if ($debugme == "on") { echo 'debug: '.$text.'<br>'; }
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
print_debug('core functions are done');
|
||||||
|
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* Quick verification of updated header.inc.php *
|
* Quick verification of sane environment *
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
error_reporting(7);
|
error_reporting(7);
|
||||||
|
/* Make sure the header.inc.php is current. */
|
||||||
if ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"]){
|
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>";
|
echo "<center><b>You need to port your settings to the new header.inc.php version.</b></center>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************\
|
|
||||||
* Load up all the base values *
|
|
||||||
\****************************************************************************/
|
|
||||||
magic_quotes_runtime(false);
|
|
||||||
|
|
||||||
/* Make sure the developer is following the rules. */
|
/* Make sure the developer is following the rules. */
|
||||||
if (!isset($phpgw_info["flags"]["currentapp"])) {
|
if (!isset($phpgw_info["flags"]["currentapp"])) {
|
||||||
echo "<b>!!! YOU DO NOT HAVE YOUR \$phpgw_info[\"flags\"][\"currentapp\"] SET !!!";
|
echo "<b>!!! YOU DO NOT HAVE YOUR \$phpgw_info[\"flags\"][\"currentapp\"] SET !!!";
|
||||||
echo "<br>!!! PLEASE CORRECT THIS SITUATION !!!</b>";
|
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>";
|
echo "<center><b>The administration is required to upgrade the header.inc.php file before you can continue.</b></center>";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
reset($phpgw_domain);
|
reset($phpgw_domain);
|
||||||
$default_domain = each($phpgw_domain);
|
$default_domain = each($phpgw_domain);
|
||||||
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
$phpgw_info["server"]["default_domain"] = $default_domain[0];
|
||||||
unset ($default_domain); // we kill this for security reasons
|
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)){
|
if (isset($domain)){
|
||||||
$phpgw_info["user"]["domain"] = $domain;
|
$phpgw_info["user"]["domain"] = $domain;
|
||||||
} elseif (isset($login) && isset($logindomain)) {
|
} elseif (isset($login) && isset($logindomain)) {
|
||||||
@ -208,13 +150,10 @@
|
|||||||
}
|
}
|
||||||
unset ($domain); // we kill this to save memory
|
unset ($domain); // we kill this to save memory
|
||||||
|
|
||||||
// some constants which can be used in setting user acl rights.
|
print_debug('sane environment');
|
||||||
define("PHPGW_ACL_READ",1);
|
|
||||||
define("PHPGW_ACL_ADD",2);
|
|
||||||
define("PHPGW_ACL_EDIT",4);
|
|
||||||
define("PHPGW_ACL_DELETE",8);
|
|
||||||
|
|
||||||
// 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,
|
$phpgw_info["server"]["global_denied_users"] = array('root' => True,
|
||||||
'bin' => True,
|
'bin' => True,
|
||||||
'daemon' => True,
|
'daemon' => True,
|
||||||
@ -239,14 +178,14 @@
|
|||||||
'named' => True
|
'named' => True
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************\
|
/****************************************************************************\
|
||||||
* These lines load up the API, fill up the $phpgw_info array, etc *
|
* These lines load up the API, fill up the $phpgw_info array, etc *
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
/* Load main class */
|
/* Load main class */
|
||||||
$phpgw = CreateObject("phpgwapi.phpgw");
|
$phpgw = CreateObject("phpgwapi.phpgw");
|
||||||
|
|
||||||
|
print_debug('main class loaded');
|
||||||
|
|
||||||
/* Fill phpgw_info["server"] array */
|
/* Fill phpgw_info["server"] array */
|
||||||
$phpgw->db->query("select * from config",__LINE__,__FILE__);
|
$phpgw->db->query("select * from config",__LINE__,__FILE__);
|
||||||
while ($phpgw->db->next_record()) {
|
while ($phpgw->db->next_record()) {
|
||||||
@ -255,76 +194,101 @@
|
|||||||
// Handy little shortcut
|
// Handy little shortcut
|
||||||
$sep = $phpgw_info["server"]["dir_separator"];
|
$sep = $phpgw_info["server"]["dir_separator"];
|
||||||
|
|
||||||
if ($phpgw_info["flags"]["currentapp"] == "login") {
|
if ($phpgw_info["flags"]["currentapp"] == "login" || $phpgw_info["flags"]["currentapp"] == "logout") {
|
||||||
if ($login != ""){
|
/****************************************************************************\
|
||||||
$login_array = explode("@",$login);
|
* Stuff to use if logging in or logging out *
|
||||||
$login_id = $this->accounts->name2id($login_array[0]);
|
\****************************************************************************/
|
||||||
$this->accounts->accounts($login_id);
|
|
||||||
$this->preferences->preferences($login_id);
|
/* 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 *
|
* Everything from this point on will ONLY happen if *
|
||||||
* the currentapp is not login or logout *
|
* the currentapp is not login or logout *
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
if ($phpgw_info["flags"]["currentapp"] != "login" && $phpgw_info["flags"]["currentapp"] != "logout") {
|
} else {
|
||||||
if (! $phpgw->session->verify()) {
|
if (! $phpgw->session->verify()) {
|
||||||
Header("Location: " . $phpgw->redirect($phpgw->session->link($phpgw_info["server"]["webserver_url"]."/login.php","cd=10")));
|
Header("Location: " . $phpgw->redirect($phpgw->session->link($phpgw_info["server"]["webserver_url"]."/login.php","cd=10")));
|
||||||
exit;
|
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_();
|
$phpgw->utilities->utilities_();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($phpgw_info["flags"]["nocommon_preferences"]) || ! $phpgw_info["flags"]["nocommon_preferences"]) {
|
if ($phpgw_info["flags"]["enable_vfs_class"]) {
|
||||||
if (! isset($phpgw_info["user"]["preferences"]["common"]["maxmatchs"]) ||
|
$phpgw->vfs = CreateObject("phpgwapi.vfs");
|
||||||
!$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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************************************\
|
||||||
|
* These lines load up the templates class *
|
||||||
|
\*************************************************************************/
|
||||||
|
$phpgw->template = CreateObject("phpgwapi.Template", PHPGW_TEMPLATE_DIR);
|
||||||
|
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
* These lines load up the themes *
|
* These lines load up the themes *
|
||||||
\*************************************************************************/
|
\*************************************************************************/
|
||||||
@ -336,12 +300,13 @@
|
|||||||
echo "Warning: error locating selected theme";
|
echo "Warning: error locating selected theme";
|
||||||
include (PHPGW_SERVER_ROOT . "/phpgwapi/themes/default.theme");
|
include (PHPGW_SERVER_ROOT . "/phpgwapi/themes/default.theme");
|
||||||
if ($phpgw_info["theme"]["bg_color"] == "") {
|
if ($phpgw_info["theme"]["bg_color"] == "") {
|
||||||
// Hope we don't get to this point. Better then the user seeing a
|
/* Hope we don't get to this point. Better then the user seeing a */
|
||||||
// complety back screen and not know whats going on
|
/* complety back screen and not know whats going on */
|
||||||
echo "<body bgcolor=FFFFFF>Fatal error: no themes found";
|
echo "<body bgcolor=FFFFFF>Fatal error: no themes found";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
* If they are using frames, we need to set some variables *
|
* If they are using frames, we need to set some variables *
|
||||||
\*************************************************************************/
|
\*************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user