diff --git a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php index 39bc62d31c..9ff7597596 100644 --- a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php +++ b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php @@ -60,12 +60,6 @@ class admin_prefs_sidebox_hooks $file['Site Configuration'] = egw::link('/index.php','menuaction=admin.uiconfig.index&appname=admin'); } - /* disabled it, til it does something useful - if (! $GLOBALS['egw']->acl->check('peer_server_access',1,'admin')) - { - $file['Peer Servers'] = egw::link('/index.php','menuaction=admin.uiserver.list_servers'); - } - */ if (! $GLOBALS['egw']->acl->check('account_access',1,'admin')) { $file['User Accounts'] = array( diff --git a/admin/inc/class.boserver.inc.php b/admin/inc/class.boserver.inc.php deleted file mode 100644 index 074b38e2f1..0000000000 --- a/admin/inc/class.boserver.inc.php +++ /dev/null @@ -1,130 +0,0 @@ - * - * -------------------------------------------- * - * 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$ */ - - class boserver - { - var $public_functions = array( - 'list_servers' => True, - 'read' => True, - 'edit' => True, - 'delete' => True - ); - - var $xml_functions = array(); - var $soap_functions = array(); - - var $debug = False; - - var $so = ''; - var $start = 0; - var $limit = 0; - var $query = ''; - var $sort = ''; - var $order = ''; - var $total = 0; - - var $use_session = False; - - function boserver($session=False) - { - $this->so =& CreateObject('admin.soserver'); - - if($session) - { - $this->read_sessiondata(); - $this->use_session = True; - } - - $start = $GLOBALS['start']; - $query = $GLOBALS['query']; - $sort = $GLOBALS['sort']; - $order = $GLOBALS['order']; - - if(!empty($start) || ($start == '0') || ($start == 0)) - { - if($this->debug) { echo '
overriding start: "' . $this->start . '" now "' . $start . '"'; } - $this->start = $start; - } - - if((empty($query) && !empty($this->query)) || !empty($query)) - { - $this->query = $query; - } - - if($limit) { $this->limit = $limit; } - if(isset($sort)) { $this->sort = $sort; } - if(isset($order)) { $this->order = $order; } - } - - function save_sessiondata($data) - { - if ($this->use_session) - { - if($this->debug) { echo '
Save:'; _debug_array($data); } - $GLOBALS['egw']->session->appsession('session_data','admin_servers',$data); - } - } - - function read_sessiondata() - { - $data = $GLOBALS['egw']->session->appsession('session_data','admin_servers'); - if($this->debug) { echo '
Read:'; _debug_array($data); } - - $this->start = $data['start']; - $this->limit = $data['limit']; - $this->query = $data['query']; - $this->sort = $data['sort']; - $this->order = $data['order']; - } - - function list_servers() - { - return $this->so->list_servers(array($this->start,$this->sort,$this->order,$this->query,$this->limit),$this->total); - } - - function read($id) - { - if(is_array($id)) - { - $id = $id['server_id']; - } - return $this->so->read($id); - } - - function edit($server_info) - { - if(!is_array($server_info)) - { - return False; - } - - if($server_info['server_id']) - { - return $this->so->update($server_info); - } - else - { - return $this->so->add($server_info); - } - } - - function delete($id) - { - if(is_array($id)) - { - $id = $id['server_id']; - } - return $this->so->delete($id); - } - } diff --git a/admin/inc/class.soserver.inc.php b/admin/inc/class.soserver.inc.php deleted file mode 100644 index dd8838373e..0000000000 --- a/admin/inc/class.soserver.inc.php +++ /dev/null @@ -1,57 +0,0 @@ - * - * -------------------------------------------- * - * 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$ */ - - class soserver - { - var $is = ''; - var $debug = False; - - function soserver() - { - $this->is =& CreateObject('phpgwapi.interserver'); - } - - function list_servers($data='',&$total) - { - if(@is_array($data)) - { - if($this->debug) { _debug_array($data); } - list($start,$sort,$order,$query,$limit) = $data; - } - return $this->is->get_list($start,$sort,$order,$query,$limit,$total); - } - - function read($id) - { - return $this->is->read_repository($id); - } - - function add($server_info) - { - return $this->is->create($server_info); - } - - function update($server_info) - { - $this->is->server = $server_info; - $this->is->save_repository($server_info['server_id']); - return $this->is->read_repository($server_info['server_id']); - } - - function delete($id) - { - return $this->is->delete($id); - } - } -?> diff --git a/admin/inc/class.uiserver.inc.php b/admin/inc/class.uiserver.inc.php deleted file mode 100644 index 2f5e04427a..0000000000 --- a/admin/inc/class.uiserver.inc.php +++ /dev/null @@ -1,365 +0,0 @@ - True, - 'edit' => True, - 'add' => True, - 'delete' => True - ); - - var $start = 0; - var $limit = 0; - var $query = ''; - var $sort = ''; - var $order = ''; - - var $debug = False; - - var $bo = ''; - var $nextmatchs = ''; - - function uiserver() - { - if ($GLOBALS['egw']->acl->check('peer_server_access',1,'admin')) - { - $GLOBALS['egw']->redirect_link('/index.php'); - } - $this->acl_search = !$GLOBALS['egw']->acl->check('peer_server_access',2,'admin'); - $this->acl_add = !$GLOBALS['egw']->acl->check('peer_server_access',4,'admin'); - $this->acl_view = !$GLOBALS['egw']->acl->check('peer_server_access',8,'admin'); - $this->acl_edit = !$GLOBALS['egw']->acl->check('peer_server_access',16,'admin'); - $this->acl_delete = !$GLOBALS['egw']->acl->check('peer_server_access',32,'admin'); - - $this->bo =& CreateObject('admin.boserver',True); - $this->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); - - $this->start = $this->bo->start; - $this->limit = $this->bo->limit; - $this->query = $this->bo->query; - $this->sort = $this->bo->sort; - $this->order = $this->bo->order; - if($this->debug) { $this->_debug_sqsof(); } - /* _debug_array($this); */ - } - - function _debug_sqsof() - { - $data = array( - 'start' => $this->start, - 'limit' => $this->limit, - 'query' => $this->query, - 'sort' => $this->sort, - 'order' => $this->order - ); - echo '
UI:'; - _debug_array($data); - } - - function save_sessiondata() - { - $data = array( - 'start' => $this->start, - 'limit' => $this->limit, - 'query' => $this->query, - 'sort' => $this->sort, - 'order' => $this->order - ); - $this->bo->save_sessiondata($data); - } - - function formatted_list($name,$list,$id='',$default=False) - { - $select = "\n" .''."\n"; - - return $select; - } - - function list_servers() - { - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Peer Servers'); - $GLOBALS['egw']->common->egw_header(); - echo parse_navbar(); - - $GLOBALS['egw']->template->set_file(array('server_list_t' => 'listservers.tpl')); - $GLOBALS['egw']->template->set_block('server_list_t','server_list','list'); - if (!$this->acl_search) - { - $GLOBALS['egw']->template->set_block('server_list_t','search','searchhandle'); - } - if (!$this->acl_add) - { - $GLOBALS['egw']->template->set_block('server_list_t','add','addhandle'); - } - - $GLOBALS['egw']->template->set_var('lang_action',lang('Server List')); - $GLOBALS['egw']->template->set_var('add_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiserver.edit')); - $GLOBALS['egw']->template->set_var('lang_add',lang('Add')); - $GLOBALS['egw']->template->set_var('lang_search',lang('Search')); - $GLOBALS['egw']->template->set_var('actionurl',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiserver.list_servers')); - $GLOBALS['egw']->template->set_var('lang_done',lang('Cancel')); - $GLOBALS['egw']->template->set_var('doneurl',$GLOBALS['egw']->link('/admin/index.php')); - - if(!$this->start) - { - $this->start = 0; - } - - if($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] && - $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 0) - { - $this->limit = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']; - } - else - { - $this->limit = 15; - } - - $this->save_sessiondata(); - $servers = $this->bo->list_servers(); - - $left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->total,'menuaction=admin.uiserver.list_servers'); - $right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->total,'menuaction=admin.uiserver.list_servers'); - $GLOBALS['egw']->template->set_var('left',$left); - $GLOBALS['egw']->template->set_var('right',$right); - - $GLOBALS['egw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->total,$this->start)); - $GLOBALS['egw']->template->set_var('th_bg',$GLOBALS['egw_info']['theme']['th_bg']); - - $GLOBALS['egw']->template->set_var('sort_name', - $this->nextmatchs->show_sort_order($this->sort,'server_name',$this->order,'/index.php',lang('Name'),'&menuaction=admin.uiserver.list_servers')); - $GLOBALS['egw']->template->set_var('sort_url', - $this->nextmatchs->show_sort_order($this->sort,'server_url',$this->order,'/index.php',lang('URL'),'&menuaction=admin.uiserver.list_servers')); - $GLOBALS['egw']->template->set_var('sort_mode', - $this->nextmatchs->show_sort_order($this->sort,'server_mode',$this->order,'/index.php',lang('Mode'),'&menuaction=admin.uiserver.list_servers')); - $GLOBALS['egw']->template->set_var('sort_security', - $this->nextmatchs->show_sort_order($this->sort,'server_security',$this->order,'/index.php',lang('Security'),'&menuaction=admin.uiserver.list_servers')); - $GLOBALS['egw']->template->set_var('lang_default',lang('Default')); - $GLOBALS['egw']->template->set_var('lang_edit',lang('Edit')); - $GLOBALS['egw']->template->set_var('lang_delete',lang('Delete')); - - while(list($key,$server) = @each($servers)) - { - $tr_color = $this->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - $server_id = $server['server_id']; - - $GLOBALS['egw']->template->set_var(array( - 'server_name' => $GLOBALS['egw']->strip_html($server['server_name']), - 'server_url' => $GLOBALS['egw']->strip_html($server['server_url']), - 'server_security' => $server['server_security'] ? strtoupper($server['server_security']) : lang('none'), - 'server_mode' => strtoupper($server['server_mode']) - )); - - $GLOBALS['egw']->template->set_var('edit',''); - $GLOBALS['egw']->template->set_var('delete',''); - if ($this->acl_edit) - { - $GLOBALS['egw']->template->set_var('edit',''.lang('Edit').''); - } - if ($this->acl_delete) - { - $GLOBALS['egw']->template->set_var('delete',''.lang('Delete').''); - } - $GLOBALS['egw']->template->parse('list','server_list',True); - } - - $GLOBALS['egw']->template->parse('out','server_list_t',True); - $GLOBALS['egw']->template->p('out'); - } - - /* This function handles add or edit */ - function edit() - { - if ($_POST['done']) - { - return $this->list_servers(); - } - if ($_POST['delete']) - { - return $this->delete(); - - } - $server_id = get_var('server_id',array('POST','GET')); - - if (!$server_id && !$this->acl_add || $server_id && !$this->acl_edit) - { - $GLOBALS['egw']->redirect_link('/index.php'); - } - $is =& CreateObject('phpgwapi.interserver'); - - $GLOBALS['egw']->template->set_file(array('form' => 'server_form.tpl')); - - if (!$this->acl_delete || !$server_id) - { - $GLOBALS['egw']->template->set_block('form','delete','deletehandle'); - $GLOBALS['egw']->template->set_var('deletehandle',''); - } - $server = $this->bo->read($server_id); - - if ($_POST['save']) - { - $errorcount = 0; - - $tmp = $is->name2id($_POST['server_name']); - - if($tmp && $server_id != $tmp) - { - $error[$errorcount++] = lang('That server name has been used already !'); - } - - if (!$_POST['server_name']) - { - $error[$errorcount++] = lang('Please enter a name for that server !'); - } - - if (!$error) - { - $server_info = array( - 'server_name' => addslashes($_POST['server_name']), - 'server_url' => addslashes($_POST['server_url']), - 'trust_level' => (int)$_POST['trust_level'], - 'trust_rel' => (int)$_POST['trust_rel'], - 'username' => addslashes($_POST['server_username']), - 'password' => $_POST['server_password'] ? $_POST['server_password'] : $server['password'], - 'server_mode' => addslashes($_POST['server_mode']), - 'server_security' => addslashes($_POST['server_security']), - 'admin_name' => addslashes($_POST['admin_name']), - 'admin_email' => addslashes($_POST['admin_email']) - ); - if($server_id) - { - $server_info['server_id'] = $server_id; - } - $newid = $this->bo->edit($server_info); - $server = $this->bo->read($newid ? $newid : $server_info['server_id']); - } - } - - if ($errorcount) - { - $GLOBALS['egw']->template->set_var('message',$GLOBALS['egw']->common->error_list($error)); - } - if (($_POST['save']) && (!$error) && (!$errorcount)) - { - if($server_id) - { - $GLOBALS['egw']->template->set_var('message',lang('Server %1 has been updated',$_POST['server_name'])); - } - else - { - $GLOBALS['egw']->template->set_var('message',lang('Server %1 has been added',$_POST['server_name'])); - } - } - if ((!$_POST['save']) && (!$error) && (!$errorcount)) - { - $GLOBALS['egw']->template->set_var('message',''); - } - - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.($server_id ? lang('Edit Peer Server') : lang('Add Peer Server')); - $GLOBALS['egw']->common->egw_header(); - echo parse_navbar(); - - $GLOBALS['egw']->template->set_var('actionurl',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiserver.edit')); - - $GLOBALS['egw']->template->set_var('lang_name',lang('Server name')); - $GLOBALS['egw']->template->set_var('lang_url',lang('Server URL')); - $GLOBALS['egw']->template->set_var('lang_trust',lang('Trust Level')); - $GLOBALS['egw']->template->set_var('lang_relationship',lang('Trust Relationship')); - $GLOBALS['egw']->template->set_var('lang_username',lang('Server Username')); - $GLOBALS['egw']->template->set_var('lang_password',lang('Server Password')); - $GLOBALS['egw']->template->set_var('lang_mode',lang('Server Type(mode)')); - $GLOBALS['egw']->template->set_var('lang_security',lang('Security')); - $GLOBALS['egw']->template->set_var('lang_admin_name',lang('Admin Name')); - $GLOBALS['egw']->template->set_var('lang_admin_email',lang('Admin Email')); - $GLOBALS['egw']->template->set_var('lang_save',lang('Save')); - $GLOBALS['egw']->template->set_var('lang_add',lang('Add')); - $GLOBALS['egw']->template->set_var('lang_default',lang('Default')); - $GLOBALS['egw']->template->set_var('lang_reset',lang('Clear Form')); - $GLOBALS['egw']->template->set_var('lang_done',lang('Cancel')); - $GLOBALS['egw']->template->set_var('lang_delete',lang('Delete')); - - $GLOBALS['egw']->template->set_var('server_name',$server['server_name']); - $GLOBALS['egw']->template->set_var('server_url',$server['server_url']); - $GLOBALS['egw']->template->set_var('server_username',$server['username']); - $GLOBALS['egw']->template->set_var('server_mode',$this->formatted_list('server_mode',$is->server_modes,$server['server_mode'])); - $GLOBALS['egw']->template->set_var('server_security',$this->formatted_list('server_security',$is->security_types,$server['server_security'])); - $GLOBALS['egw']->template->set_var('ssl_note', function_exists('curl_init') ? ' ' : lang('Note: SSL available only if PHP is compiled with curl support')); - $GLOBALS['egw']->template->set_var('pass_note',$server_id ? '
'.lang('(Stored password will not be shown here)') : ''); - $GLOBALS['egw']->template->set_var('trust_level',$this->formatted_list('trust_level',$is->trust_levels,$server['trust_level'])); - $GLOBALS['egw']->template->set_var('trust_relationship',$this->formatted_list('trust_rel',$is->trust_relationships,$server['trust_rel'],True)); - $GLOBALS['egw']->template->set_var('admin_name',$GLOBALS['egw']->strip_html($server['admin_name'])); - $GLOBALS['egw']->template->set_var('admin_email',$GLOBALS['egw']->strip_html($server['admin_email'])); - $GLOBALS['egw']->template->set_var('server_id',$server_id); - - $GLOBALS['egw']->template->set_var(array( - 'th' => $GLOBALS['egw_info']['theme']['th_bg'], - 'row_on' => $GLOBALS['egw_info']['theme']['row_on'], - 'row_off' => $GLOBALS['egw_info']['theme']['row_off'] - )); - $GLOBALS['egw']->template->pparse('phpgw_body','form'); - } - - function delete() - { - if (!$this->acl_delete) - { - $GLOBALS['egw']->redirect_link('/index.php'); - } - $server_id = get_var('server_id',array('POST','GET')); - if ($_POST['yes'] || $_POST['no']) - { - if ($_POST['yes']) - { - $this->bo->delete($server_id); - } - $GLOBALS['egw']->redirect_link('/index.php','menuaction=admin.uiserver.list_servers'); - } - else - { - $GLOBALS['egw']->common->egw_header(); - echo parse_navbar(); - - $GLOBALS['egw']->template->set_file(array('server_delete' => 'delete_common.tpl')); - - $GLOBALS['egw']->template->set_var(array( - 'form_action' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiserver.delete'), - 'hidden_vars' => '', - 'messages' => lang('Are you sure you want to delete this server?'), - 'no' => lang('No'), - 'yes' => lang('Yes'), - )); - $GLOBALS['egw']->template->pparse('phpgw_body','server_delete'); - } - } - } -?> diff --git a/admin/inc/hook_acl_manager.inc.php b/admin/inc/hook_acl_manager.inc.php index 6a65ec446c..e40709cfbb 100644 --- a/admin/inc/hook_acl_manager.inc.php +++ b/admin/inc/hook_acl_manager.inc.php @@ -44,19 +44,6 @@ ) ); // was already there and seems to work ralfbecker -/* not usable at the moment - $GLOBALS['acl_manager']['admin']['peer_server_access'] = array( - 'name' => 'Deny access to peer servers', - 'rights' => array( - 'Peer server list' => 1, - 'Search peer servers' => 2, - 'Add peer server' => 4, -// 'View peer server' => 8, // there's no view-routine atm. - 'Edit peer server' => 16, - 'Delete peer server' => 32 - ) - ); -*/ $GLOBALS['acl_manager']['admin']['applications_access'] = array( 'name' => 'Deny access to applications', 'rights' => array( diff --git a/phpgwapi/inc/class.interserver.inc.php b/phpgwapi/inc/class.interserver.inc.php deleted file mode 100644 index 11704860c9..0000000000 --- a/phpgwapi/inc/class.interserver.inc.php +++ /dev/null @@ -1,655 +0,0 @@ - * - * Maintain list and provide send interface to remote phpgw servers * - * Copyright (C) 2001 Miles Lott * - * -------------------------------------------------------------------------* - * This library is part of the eGroupWare API * - * http://www.egroupware.org * - * ------------------------------------------------------------------------ * - * 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 interserver - { - var $db; - var $accounts; - var $table = 'egw_interserv'; - var $total = 0; - var $result = ''; - - var $servers = array(); - var $serverid = 0; - var $security = ''; - var $mode = ''; - var $authed = False; - var $sessionid = ''; - var $kp3 = ''; - - /* These are now entered as defaults if the admin forgot to enter the full URL */ - var $urlparts = array(); - - /* - 0/none == no access - 1/apps == read app data only - 99/all == read accounts and other api data - Two servers must have each other setup as 'all' for full coop - */ - var $trust_levels = array( - 'none' => 0, - 'apps' => 1, - 'all' => 99 - ); - - /* - 0 - No trust, but they may trust us - 1 - Trust to make requests of us - 2 - Trust remote server's trusts also - 3 - We both trust each other - 4 - We both trust each other, and we trust the remote server's trusts also - */ - var $trust_relationships = array( - 'outbound' => 0, - 'inbound' => 1, - 'passthrough' => 2, - 'bi-directional' => 3, - 'bi-dir passthrough' => 4 - ); - - var $security_types = array( - 'standard' => '', - 'ssl' => 'ssl' - ); - - var $server_modes = array( - 'XML-RPC' => 'xmlrpc', - 'SOAP' => 'soap' - ); - - function interserver($serverid='') - { - $url = preg_replace('/https*:\\/\\/[^\\/]*\\//i','',$GLOBALS['egw_info']['server']['webserver_url']); - $this->urlparts = array( - 'xmlrpc' => $url.'/xmlrpc.php', - 'soap' => $url.'/soap.php' - ); - - $this->db = clone($GLOBALS['egw']->db); - if($serverid) - { - $this->serverid = (int)$serverid; - $this->setup(); - } - } - - function debug($str,$debug=False) - { - if($debug) - { - $this->_debug($str); - } - } - - function _debug($err='') - { - if(!$err) - { - return; - } - echo $err . ' '; - } - - function setup() - { - $this->read_repository(); - if($this->server['trust_level']) - { - $this->accounts =& CreateObject('phpgwapi.accounts'); - $this->accounts->server = $this->serverid; - } - $this->security = $this->server['server_security']; - $this->mode = $this->server['server_mode']; - } - - /* send command to remote server */ - function send($method_name, $args, $url, $debug=False) - { - $cmd = '_send_' . ($this->mode ? $this->mode : 'xmlrpc') . '_' . $this->security; - $this->$cmd($method_name, $args, $url, $debug); - return $this->result; - } - - function _split_url($url) - { - preg_match('/^(.*?\/\/.*?)(\/.*)/',$url,$matches); - $hostpart = $matches[1]; - $hostpart = str_replace('https://','',$hostpart); - $hostpart = str_replace('http://','',$hostpart); - switch($this->mode) - { - case 'soap': - if(!strstr($matches[2],'soap.php')) - { - $matches[2] .= $this->urlparts['soap']; - } - break; - case 'xmlrpc': - if(!strstr($matches[2],'xmlrpc.php')) - { - $matches[2] .= $this->urlparts['xmlrpc']; - } - break; - default: - break; - } - $uri = $matches[2]; - return array($uri,$hostpart); - } - - function _send_xmlrpc_ssl($method_name, $args, $url, $debug=True) - { - list($uri,$hostpart) = $this->_split_url($url); - if(!@is_array($args)) - { - $arr[] = CreateObject('phpgwapi.xmlrpcval',$args,'string'); - $f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'string'); - } - else - { - foreach($args as $key => $val) - { - if(@is_array($val)) - { - foreach($val as $x => $y) - { - $tmp[$x] = CreateObject('phpgwapi.xmlrpcval',$y, 'string'); - } - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$tmp,'struct'); - } - else - { - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$val, 'string'); - } - } - $arr[] = CreateObject('phpgwapi.xmlrpcval',$ele,'struct'); - $f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'struct'); - } - - $this->debug('
' . htmlentities($f->serialize()) . "
\n",$debug); - $c = CreateObject('phpgwapi.xmlrpc_client',$uri, $hostpart, 443); - $c->setCredentials($this->sessionid,$this->kp3); - $c->setDebug($debug); - $r = $c->send($f,0,'https'); - if (!$r) - { - $this->debug('send failed'); - } - $v = $r->value(); - if (!$r->faultCode()) - { - $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); - $this->result = phpgw_xmlrpc_decode($v); - } - else - { - $this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"
',$debug); - $this->result = htmlentities($r->serialize()); - } - return $this->result; - } - - function _send_xmlrpc_($method_name, $args, $url, $debug=True) - { - list($uri,$hostpart) = $this->_split_url($url); - if(!@is_array($args)) - { - $arr[] = CreateObject('phpgwapi.xmlrpcval',$args,'string'); - $f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'string'); - } - else - { - foreach($args as $key => $val) - { - if(@is_array($val)) - { - foreach($val as $x => $y) - { - $tmp[$x] = CreateObject('phpgwapi.xmlrpcval',$y, 'string'); - } - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$tmp,'struct'); - } - else - { - $ele[$key] = CreateObject('phpgwapi.xmlrpcval',$val, 'string'); - } - } - $arr[] = CreateObject('phpgwapi.xmlrpcval',$ele,'struct'); - $f = CreateObject('phpgwapi.xmlrpcmsg', $method_name, $arr,'struct'); - } - - $this->debug('
' . htmlentities($f->serialize()) . '
' . "\n",$debug); - $c = CreateObject('phpgwapi.xmlrpc_client',$uri, $hostpart, 80); - $c->setCredentials($this->sessionid,$this->kp3); -// _debug_array($c); - $c->setDebug($debug); - $r = $c->send($f); - if (!$r) - { - $this->debug('send failed'); - } - $v = $r->value(); - if (!$r->faultCode()) - { - $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); - $this->result = phpgw_xmlrpc_decode($v); - } - else - { - $this->debug('Fault Code: ' . $r->faultCode() . ' Reason "' . $r->faultString() . '"
',$debug); - $this->result = htmlentities($r->serialize()); - } - return $this->result; - } - - function _send_soap_ssl($method_name, $args, $url, $debug=True) - { - $method_name = str_replace('.','_',$method_name); - list($uri,$hostpart) = $this->_split_url($url); - if(!@is_array($args)) - { - $arr[] = CreateObject('phpgwapi.soapval','','string',$args); - } - else - { - foreach($args as $key => $val) - { - if(@is_array($val)) - { - foreach($val as $x => $y) - { - $tmp[] = CreateObject('phpgwapi.soapval',$x,'string',$y); - } - $arr[] = CreateObject('phpgwapi.soapval',$key, 'array',$tmp); - } - else - { - $arr[] = CreateObject('phpgwapi.soapval',$key, 'string',$val); - } - } - } - - $soap_message = CreateObject('phpgwapi.soapmsg',$method_name,$arr); - /* print_r($soap_message);exit; */ - $soap = CreateObject('phpgwapi.soap_client',$uri,$hostpart); - $soap->username = $this->sessionid; - $soap->password = $this->kp3; - /* _debug_array($soap);exit; */ - if($r = $soap->send($soap_message,$method_name)) - { - $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); - $this->result = $r->decode(); - return $this->result; - } - else - { - $this->debug('Fault Code: ' . $r->ernno . ' Reason "' . $r->errstring . '"
',$debug); - } - } - - function _send_soap_($method_name, $args, $url, $debug=True) - { - $method_name = str_replace('.','_',$method_name); - list($uri,$hostpart) = $this->_split_url($url); - - if(!$args) - { - $arr = ''; - } - elseif(@is_array($args)) - { - foreach($args as $key => $val) - { - if(@is_array($val)) - { - foreach($val as $x => $y) - { - $tmp[] = CreateObject('phpgwapi.soapval',$x,'string',$y); - } - $ele[] = CreateObject('phpgwapi.soapval',$key, 'array',$tmp); - $complex = True; - } - else - { - $ele[] = CreateObject('phpgwapi.soapval',$key, 'string',$val); - } - } - $arr[] = CreateObject('phpgwapi.soapval','','struct',$ele); - } - else - { - $arr[] = CreateObject('phpgwapi.soapval','','string',$args); - } - $this->request = $arr; - - $soap_message = CreateObject('phpgwapi.soapmsg',$method_name,$this->request); - $soap = CreateObject('phpgwapi.soap_client',$uri,$hostpart); - $soap->username = $this->sessionid; - $soap->password = $this->kp3; - if($r = $soap->send($soap_message,$method_name)) - { - _debug_array(htmlentities($soap->outgoing_payload)); - _debug_array(htmlentities($soap->incoming_payload)); - $this->debug('
I got this value back
' . htmlentities($r->serialize()) . '

',$debug); - $this->result = $r->decode(); - return $this->result; - } - else - { - _debug_array($soap->outgoing_payload); - $this->debug('Fault Code: ' . $r->ernno . ' Reason "' . $r->errstring . '"
',$debug); - } - } - - function build_request($_req,$recursed=False,$ext='') - { - if(@is_array($_req)) - { - $ele = array(); - foreach($_req as $key => $val) - { - $ele[$key] = $this->build_request($val,True,$key); - } - $this->request[] = CreateObject('phpgwapi.soapval',$ext,'struct',$ele); - $ext = ''; - } - else - { - $_type = (is_long($_req) ? 'int' : gettype($_req)); - if($recursed) - { - return CreateObject('phpgwapi.soapval',$ext,$_type,$_req); - } - else - { - $this->request[$ext] = CreateObject('phpgwapi.soapval',$ext,$_type,$_req); - } - } - } - - /* Following are for server list management and query */ - function read_repository($serverid='') - { - if(!$serverid) - { - $serverid = $this->serverid; - } - $sql = "SELECT * FROM $this->table WHERE server_id=" . (int)$serverid; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - $this->server['server_name'] = $this->db->f('server_name'); - $this->server['server_url'] = $this->db->f('server_url'); - $this->server['server_mode'] = $this->db->f('server_mode'); - $this->server['server_security'] = $this->db->f('server_security'); - $this->server['trust_level'] = $this->db->f('trust_level'); - $this->server['trust_rel'] = $this->db->f('trust_rel'); - $this->server['username'] = $this->db->f('username'); - $this->server['password'] = $this->db->f('password'); - $this->server['admin_name'] = $this->db->f('admin_name'); - $this->server['admin_email'] = $this->db->f('admin_email'); - } - return $this->server; - } - - function save_repository($serverid='') - { - if(!$serverid) - { - $serverid = $this->serverid; - } - if((int)$serverid && @is_array($this->server)) - { - $sql = "UPDATE $this->table SET " - . "server_name='" . $this->server['server_name'] . "'," - . "server_url='" . $this->server['server_url'] . "'," - . "server_mode='" . $this->server['server_mode'] . "'," - . "server_security='" . $this->server['server_security'] . "'," - . "trust_level=" . (int)$this->server['trust_level'] . "," - . "trust_rel=" . (int)$this->server['trust_rel'] . "," - . "username='" . $this->server['username'] . "'," - . "password='" . $this->server['password'] . "'," - . "admin_name='" . $this->server['admin_name'] . "'," - . "admin_email='" . $this->server['admin_email'] . "' " - . "WHERE server_id=" . (int)$serverid; - $this->db->query($sql,__LINE__,__FILE__); - return True; - } - return False; - } - - function create($server_info='') - { - if(!@is_array($server_info)) - { - return False; - } - $sql = "INSERT INTO $this->table (server_name,server_url,server_mode,server_security," - . "trust_level,trust_rel,username,password,admin_name,admin_email) " - . "VALUES('" . $server_info['server_name'] . "','" . $server_info['server_url'] . "','" - . $server_info['server_mode'] . "','" . $server_info['server_security'] . "'," - . (int)$server_info['trust_level'] . "," . (int)$server_info['trust_rel'] . ",'" - . $server_info['username'] . "','" . $server_info['password'] . "','" - . $server_info['admin_name'] . "','" . $server_info['admin_email'] . "')"; - $this->db->query($sql,__LINE__,__FILE__); - - $sql = "SELECT server_id FROM $this->table WHERE server_name='" . $server_info['server_name'] . "'"; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - $server_info['server_id'] = $this->db->f(0); - $this->serverid = $server_info['server_id']; - $this->server = $server_info; - return $this->serverid; - } - return False; - } - - function delete($serverid='') - { - if(!$serverid) - { - $serverid = $this->serverid; - } - if($serverid) - { - $sql = "DELETE FROM $this->table WHERE server_id=$serverid"; - $this->db->query($sql,__LINE__,__FILE__); - return True; - } - return False; - } - - function get_list($start='',$sort='',$order='',$query='',$offset='',&$total) - { - if (!$sort) - { - $sort = 'DESC'; - } - if ($query) - { - $whereclause = "WHERE server_name LIKE '%$query%'" - . "OR server_url LIKE '%$query%'" - . "OR server_mode LIKE '%$query%'" - . "OR admin_name LIKE '%$query%'" - . "OR admin_email LIKE '%$query%'"; - } - if ($order) - { - $orderclause = 'ORDER BY ' . $order . ' ' . $sort; - } - else - { - $orderclause = 'ORDER BY server_name ASC'; - } - - $sql = "SELECT * FROM $this->table $whereclause $orderclause"; - $this->db->query($sql,__LINE__,__FILE__); - - while ($this->db->next_record()) - { - $this->servers[$this->db->f('server_name')]['server_id'] = $this->db->f('server_id'); - $this->servers[$this->db->f('server_name')]['server_name'] = $this->db->f('server_name'); - $this->servers[$this->db->f('server_name')]['server_url'] = $this->db->f('server_url'); - $this->servers[$this->db->f('server_name')]['server_mode'] = $this->db->f('server_mode'); - $this->servers[$this->db->f('server_name')]['server_security'] = $this->db->f('server_security'); - $this->servers[$this->db->f('server_name')]['trust_level'] = $this->db->f('trust_level'); - $this->servers[$this->db->f('server_name')]['trust_rel'] = $this->db->f('trust_rel'); - $this->servers[$this->db->f('server_name')]['admin_name'] = $this->db->f('admin_name'); - $this->servers[$this->db->f('server_name')]['admin_email'] = $this->db->f('admin_email'); - } - $this->total = $this->db->num_rows(); - $total = $this->total; - return $this->servers; - } - - function formatted_list($server_id=0,$java=False,$local=False) - { - if ($java) - { - $jselect = ' onChange="this.form.submit();"'; - } - $select = "\n" .''."\n"; - $select .= '' . "\n"; - if(!$foundservers) - { - $select = ''; - } - - return $select; - } - - function name2id($server_name='') - { - if(!$server_name) - { - $server_name = $this->server['server_name']; - } - if($server_name) - { - $sql = "SELECT server_id FROM $this->table WHERE server_name='$server_name'"; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - $serverid = $this->db->f(0); - return $serverid; - } - } - return False; - } - - function id2name($serverid='') - { - if(!$serverid) - { - $serverid = $this->serverid; - } - if($serverid) - { - $sql = "SELECT server_name FROM $this->table WHERE server_id=$serverid"; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - $server_name = $this->db->f(0); - return $server_name; - } - } - return False; - } - - function exists($serverdata='') - { - if(!$serverdata) - { - return False; - } - if(is_int($serverdata)) - { - $serverid = $serverdata; - settype($server_name,'string'); - $server_name = $this->id2name($serverid); - } - else - { - $server_name = $serverdata; - } - $sql = "SELECT server_id FROM $this->table WHERE server_name='$server_name'"; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - return True; - } - return False; - } - - /* TODO - Determine trust level here */ - function auth($serverdata='') - { - if(!$serverdata || !@is_array($serverdata)) - { - return False; - } - $server_name = $serverdata['server_name']; - $username = $serverdata['username']; - $password = $serverdata['password']; - - $sql = "SELECT server_id,trust_rel FROM $this->table WHERE server_name='$server_name'"; - $this->db->query($sql,__LINE__,__FILE__); - if($this->db->next_record()) - { - if ($username == $GLOBALS['egw_info']['server']['site_username'] && - $password == $GLOBALS['egw_info']['server']['site_password'] && - $this->db->f('trust_rel') >= 1) - { - $this->authed = True; - return True; - } - } - return False; - } - } -?> diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index e6a3ebb27d..8017957a16 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -12,7 +12,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'EGroupware API'; -$setup_info['phpgwapi']['version'] = '1.9.019'; +$setup_info['phpgwapi']['version'] = '1.9.020'; $setup_info['phpgwapi']['versions']['current_header'] = '1.29'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; @@ -36,7 +36,6 @@ $setup_info['phpgwapi']['tables'][] = 'egw_nextid'; $setup_info['phpgwapi']['tables'][] = 'egw_categories'; $setup_info['phpgwapi']['tables'][] = 'egw_log'; $setup_info['phpgwapi']['tables'][] = 'egw_log_msg'; -$setup_info['phpgwapi']['tables'][] = 'egw_interserv'; $setup_info['phpgwapi']['tables'][] = 'egw_history_log'; $setup_info['phpgwapi']['tables'][] = 'egw_async'; $setup_info['phpgwapi']['tables'][] = 'egw_api_content_history'; diff --git a/phpgwapi/setup/tables_current.inc.php b/phpgwapi/setup/tables_current.inc.php index 98ace0ae9b..0160eb1bdc 100644 --- a/phpgwapi/setup/tables_current.inc.php +++ b/phpgwapi/setup/tables_current.inc.php @@ -195,26 +195,6 @@ $phpgw_baseline = array( 'ix' => array(), 'uc' => array() ), - 'egw_interserv' => array( - 'fd' => array( - 'server_id' => array('type' => 'auto','nullable' => False), - 'server_name' => array('type' => 'varchar','precision' => '64','nullable' => True), - 'server_host' => array('type' => 'varchar','precision' => '255','nullable' => True), - 'server_url' => array('type' => 'varchar','precision' => '255','nullable' => True), - 'trust_level' => array('type' => 'int','precision' => '4'), - 'trust_rel' => array('type' => 'int','precision' => '4'), - 'username' => array('type' => 'varchar','precision' => '64','nullable' => True), - 'password' => array('type' => 'varchar','precision' => '255','nullable' => True), - 'admin_name' => array('type' => 'varchar','precision' => '255','nullable' => True), - 'admin_email' => array('type' => 'varchar','precision' => '255','nullable' => True), - 'server_mode' => array('type' => 'varchar','precision' => '16','nullable' => False,'default' => 'xmlrpc'), - 'server_security' => array('type' => 'varchar','precision' => '16','nullable' => True) - ), - 'pk' => array('server_id'), - 'fk' => array(), - 'ix' => array(), - 'uc' => array() - ), 'egw_history_log' => array( 'fd' => array( 'history_id' => array('type' => 'auto','precision' => '4','nullable' => False), diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index c276ed300d..b822a3c89f 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -475,3 +475,10 @@ function phpgwapi_upgrade1_9_018() return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.019'; } + +function phpgwapi_upgrade1_9_019() +{ + $GLOBALS['egw_setup']->oProc->DropTable('egw_interserv'); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.020'; +}