diff --git a/admin/check_acl.php b/admin/check_acl.php index 63301608e4..c487180e1c 100644 --- a/admin/check_acl.php +++ b/admin/check_acl.php @@ -38,7 +38,7 @@ else if (($all_accounts = $GLOBALS['egw']->accounts->search(array('type'=>'both')))) { $all_accounts = array_keys($all_accounts); - $GLOBALS['egw']->db->query("DELETE FROM phpgw_acl WHERE acl_account NOT IN (".implode(',',$all_accounts).") OR acl_appname='phpgw_group' AND acl_location NOT IN ('".implode("','",$all_accounts)."')",__LINE__,__FILE__); + $GLOBALS['egw']->db->query("DELETE FROM egw_acl WHERE acl_account NOT IN (".implode(',',$all_accounts).") OR acl_appname='phpgw_group' AND acl_location NOT IN ('".implode("','",$all_accounts)."')",__LINE__,__FILE__); $deleted = $GLOBALS['egw']->db->affected_rows(); } echo '
'.lang('%1 ACL records of not (longer) existing accounts deleted.',$deleted)."
\n"; diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php index 76591734fb..9fda826417 100755 --- a/admin/inc/class.boaccounts.inc.php +++ b/admin/inc/class.boaccounts.inc.php @@ -85,14 +85,6 @@ $account_id = (int)$_POST['account_id']; - $GLOBALS['egw']->db->lock( - Array( - 'phpgw_accounts', - 'phpgw_app_sessions', - 'phpgw_acl' - ) - ); - $old_group_list = $GLOBALS['egw']->acl->get_ids_for_location($account_id,1,'phpgw_group'); @reset($old_group_list); @@ -115,8 +107,6 @@ $GLOBALS['egw']->accounts->delete($account_id); - $GLOBALS['egw']->db->unlock(); - Header('Location: '.$GLOBALS['egw']->link('/index.php','menuaction=admin.uiaccounts.list_groups')); $GLOBALS['egw']->common->egw_exit(); } @@ -141,18 +131,11 @@ $singleHookValues = $GLOBALS['hook_values']+array('location' => 'deleteaccount'); - $db = clone($GLOBALS['egw']->db); - $db->query('SELECT app_name,app_order FROM phpgw_applications WHERE app_enabled!=0 ORDER BY app_order',__LINE__,__FILE__); - if($db->num_rows()) + foreach($GLOBALS['egw_info']['apps'] as $appname => $data) { - while($db->next_record()) + if($appname != 'admin' && $appname != 'preferences') { - $appname = $db->f('app_name'); - - if($appname <> 'admin' || $appname <> 'preferences') - { - $GLOBALS['egw']->hooks->single($singleHookValues, $appname); - } + $GLOBALS['egw']->hooks->single($singleHookValues,$appname); } } @@ -213,19 +196,6 @@ $this->validate_group($group_info); - $GLOBALS['egw']->db->lock( - Array( - 'phpgw_accounts', - 'phpgw_nextid', - 'phpgw_preferences', - 'phpgw_sessions', - 'phpgw_acl', - 'phpgw_applications', - 'phpgw_app_sessions', - 'phpgw_hooks' - ) - ); - $group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); $group->acct_type = 'g'; $account_info = array( @@ -291,8 +261,6 @@ { $cd = 37; } - - $GLOBALS['egw']->db->unlock(); } ExecMethod('admin.uiaccounts.list_groups'); @@ -430,20 +398,6 @@ $this->validate_group($group_info); - // Lock tables - $GLOBALS['egw']->db->lock( - Array( - 'phpgw_accounts', - 'phpgw_preferences', - 'phpgw_config', - 'phpgw_applications', - 'phpgw_hooks', - 'phpgw_sessions', - 'phpgw_acl', - 'phpgw_app_sessions' - ) - ); - $group =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g'); $old_group_info = $group->read_repository(); @@ -547,8 +501,6 @@ // for LDAP to update the memberuid attribute $group->save_repository(); - $GLOBALS['egw']->db->unlock(); - ExecMethod('admin.uiaccounts.list_groups'); return False; } diff --git a/admin/inc/class.soaccounts.inc.php b/admin/inc/class.soaccounts.inc.php index 121fab15d3..61a9bc658e 100755 --- a/admin/inc/class.soaccounts.inc.php +++ b/admin/inc/class.soaccounts.inc.php @@ -27,19 +27,6 @@ $userData['account_email'] = $userData['email']; } - $GLOBALS['egw']->db->lock( - Array( - 'phpgw_accounts', - 'phpgw_nextid', - 'phpgw_preferences', - 'phpgw_sessions', - 'phpgw_acl', - 'phpgw_applications', - 'phpgw_app_sessions', - 'phpgw_hooks' - ) - ); - $GLOBALS['egw']->accounts->create($userData); $userData['account_id'] = $GLOBALS['egw']->accounts->name2id($userData['account_lid']); @@ -104,8 +91,6 @@ $apps->account_apps = array(array()); $apps_after = array(array()); - $GLOBALS['egw']->db->unlock(); - return $userData['account_id']; } } diff --git a/admin/inc/class.soapplications.inc.php b/admin/inc/class.soapplications.inc.php index 8b0e6f220f..ed54af9ad8 100644 --- a/admin/inc/class.soapplications.inc.php +++ b/admin/inc/class.soapplications.inc.php @@ -14,6 +14,8 @@ class soapplications { var $db; + var $applications_table = 'egw_applications'; + var $hooks_table = 'phpgw_hooks'; function soapplications() { @@ -22,7 +24,7 @@ function read($app_name) { - $sql = "SELECT * FROM phpgw_applications WHERE app_name='$app_name'"; + $sql = "SELECT * FROM $this->applications_table WHERE app_name='$app_name'"; $this->db->query($sql,__LINE__,__FILE__); $this->db->next_record(); @@ -38,7 +40,7 @@ function get_list() { - $this->db->query('SELECT * FROM phpgw_applications WHERE app_enabled!=3',__LINE__,__FILE__); + $this->db->query("SELECT * FROM $this->applications_table WHERE app_enabled != 3",__LINE__,__FILE__); if($this->db->num_rows()) { while ($this->db->next_record()) @@ -64,11 +66,11 @@ /* Yes, the sequence should work, but after a mass import in setup (new install) it does not work on pg */ - $sql = 'SELECT MAX(app_id) from phpgw_applications'; + $sql = "SELECT MAX(app_id) from $this->applications_table"; $this->db->query($sql,__LINE__,__FILE__); $this->db->next_record(); $app_id = $this->db->f(0) + 1; - $sql = 'INSERT INTO phpgw_applications (app_id,app_name,app_enabled,app_order) VALUES(' + $sql = "INSERT INTO $this->applications_table (app_id,app_name,app_enabled,app_order) VALUES(" . $app_id . ",'" . addslashes($data['n_app_name']) . "','" . $data['n_app_status'] . "','" . $data['app_order'] . "')"; @@ -78,7 +80,7 @@ function save($data) { - $sql = "UPDATE phpgw_applications SET " + $sql = "UPDATE $this->applications_table SET " . "app_enabled='" . $data['n_app_status'] . "',app_order='" . $data['app_order'] . "' WHERE app_name='" . $data['app_name'] . "'"; @@ -88,7 +90,7 @@ function exists($app_name) { - $this->db->query("SELECT COUNT(app_name) FROM phpgw_applications WHERE app_name='" . addslashes($app_name) . "'",__LINE__,__FILE__); + $this->db->query("SELECT COUNT(app_name) FROM $this->applications_table WHERE app_name='" . addslashes($app_name) . "'",__LINE__,__FILE__); $this->db->next_record(); if ($this->db->f(0) != 0) @@ -100,19 +102,19 @@ function app_order() { - $this->db->query('SELECT (MAX(app_order)+1) FROM phpgw_applications',__LINE__,__FILE__); + $this->db->query("SELECT MAX(app_order)+1 FROM $this->applications_table",__LINE__,__FILE__); $this->db->next_record(); return $this->db->f(0); } function delete($app_name) { - $this->db->query("DELETE FROM phpgw_applications WHERE app_name='$app_name'",__LINE__,__FILE__); + $this->db->query("DELETE FROM $this->applications_table WHERE app_name='$app_name'",__LINE__,__FILE__); } function register_hook($app) { - $this->db->query("INSERT INTO phpgw_hooks(hook_appname,hook_location,hook_filename) " + $this->db->query("INSERT INTO $this->hooks_table (hook_appname,hook_location,hook_filename) " . "VALUES ('".$app['app_name']."','".$app['hook']."','hook_".$app['hook'].".inc.php')",__LINE__,__FILE__ ); } diff --git a/admin/inc/class.soldap_mgr.inc.php b/admin/inc/class.soldap_mgr.inc.php index 4c91e8ca36..bdb1bf0cb8 100644 --- a/admin/inc/class.soldap_mgr.inc.php +++ b/admin/inc/class.soldap_mgr.inc.php @@ -156,11 +156,11 @@ #print "There is a new version of eGroupWare available. http://www.egroupware.org
'; + $updates['egroupware'] = ''.lang('There is a new version of eGroupWare available'). + ' www.egroupware.org
'; } $_found = False; - $GLOBALS['egw']->db->query("select app_name,app_version from phpgw_applications",__LINE__,__FILE__); - while($GLOBALS['egw']->db->next_record()) + foreach($GLOBALS['egw_info']['apps'] as $_app_name => $data) { - $_db_version = $GLOBALS['egw']->db->f('app_version'); - $_app_name = $GLOBALS['egw']->db->f('app_name'); + $_db_version = $data['version']; $_app_dir = $GLOBALS['egw']->common->get_app_dir($_app_name); $_versionfile = $_app_dir . '/setup/setup.inc.php'; if($_app_dir && file_exists($_versionfile)) @@ -102,7 +98,4 @@ class updates { } return $updates; } - } - -?> diff --git a/phpgwapi/inc/class.accounts.inc.php b/phpgwapi/inc/class.accounts.inc.php index 3f606857a1..32e5a7e934 100644 --- a/phpgwapi/inc/class.accounts.inc.php +++ b/phpgwapi/inc/class.accounts.inc.php @@ -40,10 +40,10 @@ include_once(EGW_API_INC . '/class.accounts_' . $GLOBALS['egw_info']['server']['account_repository'] . '.inc.php'); /* - Dont know where to put this (seek3r) - This is where it belongs (jengo) - This is where it ended up (milosch) - Moved again at least temporarily since sql and ldap use it. + Dont know where to put this (seek3r) + This is where it belongs (jengo) + This is where it ended up (milosch) + Moved again at least temporarily since sql and ldap use it. */ $GLOBALS['egw_info']['server']['global_denied_users'] = array( 'root' => True, 'bin' => True, 'daemon' => True, diff --git a/phpgwapi/inc/class.accounts_contacts.inc.php b/phpgwapi/inc/class.accounts_contacts.inc.php index 3ec4509a60..1667f4ebde 100644 --- a/phpgwapi/inc/class.accounts_contacts.inc.php +++ b/phpgwapi/inc/class.accounts_contacts.inc.php @@ -1,27 +1,27 @@ * - * View and manipulate account records using the contacts class * - * Copyright (C) 2000, 2001 Miles Lott * - * -------------------------------------------------------------------------* - * This library is part of the eGroupWare API * - * http://www.egroupware.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 * - \**************************************************************************/ + /**************************************************************************\ + * eGroupWare API - Accounts manager for the contacts class * + * This file written by Miles Lottlang()
for you), 'link'
- which is the uri, 'target', the frame name or '_blank' to show
- page in a new browser window.
- @param mixed $selected the tab whos key is $selected will be displayed as current tab
- @param $fontsize optional
- @return string return html that displays the tabs
- */
+ /**
+ * create tabs
+ *
+ * @param array $tabs an array repersenting the tabs you wish to display, each element
+ * * * in the array is an array of 3 elements, 'label' which is the
+ * * * text displaed on the tab (you should pass translated string,
+ * * * create_tabs will not do lang()
for you), 'link'
+ * * * which is the uri, 'target', the frame name or '_blank' to show
+ * * * page in a new browser window.
+ * @param mixed $selected the tab whos key is $selected will be displayed as current tab
+ * @param $fontsize optional
+ * @return string return html that displays the tabs
+ */
function create_tabs($tabs, $selected, $fontsize = '')
{
$output_text = '".$i." | \n"; - $html .= "\t\t".$GLOBALS['phpgw']->common->show_date($err->timestamp)." | \n"; + $html .= "\t\t".$GLOBALS['egw']->common->show_date($err->timestamp)." | \n"; $html .= "\t\t".$err->app."  | \n"; $html .= "\t\t".$err->severity." | \n"; $html .= "\t\t".$err->code." | \n"; diff --git a/phpgwapi/inc/class.log.inc.php b/phpgwapi/inc/class.log.inc.php index 88611c4b47..5a6f8a661b 100644 --- a/phpgwapi/inc/class.log.inc.php +++ b/phpgwapi/inc/class.log.inc.php @@ -27,6 +27,8 @@ 'clearstack', 'astable' ); + var $log_table = 'egw_log'; + var $msg_table = 'egw_log_msg'; function message($etext,$p0='',$p1='',$p2='',$p3='',$p4='',$p5='',$p6='',$p7='',$p8='',$p9='') { @@ -82,11 +84,11 @@ function commit() { - $db = $GLOBALS['phpgw']->db; - $db->query("insert into phpgw_log (log_date, log_user, log_app, log_severity) values " - ."('". $GLOBALS['phpgw']->db->to_timestamp(time()) - ."','".$GLOBALS['phpgw']->session->account_id - ."','".$GLOBALS['phpgw_info']['flags']['currentapp']."'" + $db = clone($GLOBALS['egw']->db); + $db->query("insert into $this->log_table (log_date, log_user, log_app, log_severity) values " + ."('". $GLOBALS['egw']->db->to_timestamp(time()) + ."','".$GLOBALS['egw']->session->account_id + ."','".$GLOBALS['egw_info']['flags']['currentapp']."'" .",'".$this->severity()."'" .")" ,__LINE__,__FILE__); @@ -95,11 +97,11 @@ for ($i = 0; $i < count($errorstack); $i++) { $err = $errorstack[$i]; - $db->query("insert into phpgw_log_msg " + $db->query("insert into $this->msg_table " . "(log_msg_seq_no, log_msg_date, " . "log_msg_severity, log_msg_code, log_msg_msg, log_msg_parms) values " . "(" . $i - . ", '" . $GLOBALS['phpgw']->db->to_timestamp($err->timestamp) + . ", '" . $GLOBALS['egw']->db->to_timestamp($err->timestamp) . "', '". $err->severity . "'" . ", '". $err->code . "'" . ", '". $err->msg . "'" @@ -162,8 +164,8 @@ $html .= "\t||
".$i." | \n"; - $html .= "\t\t".$GLOBALS['phpgw']->common->show_date($err->timestamp)." | \n"; - $html .= "\t\t".$GLOBALS['phpgw_info']['flags']['currentapp']."  | \n"; + $html .= "\t\t".$GLOBALS['egw']->common->show_date($err->timestamp)." | \n"; + $html .= "\t\t".$GLOBALS['egw_info']['flags']['currentapp']."  | \n"; $html .= "\t\t".$err->severity." | \n"; $html .= "\t\t".$err->code." | \n"; $html .= "\t\t".$err->langmsg()." | \n"; diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index b5c69f2540..bcb71799f3 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -580,7 +580,7 @@ $this->log_access($this->sessionid,$login,$user_ip,$this->account_id); } $this->appsession('account_previous_login','phpgwapi',$GLOBALS['egw']->auth->previous_login); - $GLOBALS['egw']->auth->update_lastlogin($this->account_id,$user_ip); + $GLOBALS['egw']->accounts->update_lastlogin($this->account_id,$user_ip); $GLOBALS['egw']->db->transaction_commit(); //if (!$this->sessionid) echo "