[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc xml_functions.inc.php,1.24,1.25 cla
From: |
Mark A Peters <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc xml_functions.inc.php,1.24,1.25 class.app_registry.inc.php,1.1,1.2 |
Date: |
Tue, 19 Feb 2002 22:46:30 -0500 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv20781/phpgwapi/inc
Modified Files:
xml_functions.inc.php class.app_registry.inc.php
Log Message:
Adding new functionality. Can now request an app to be delivered to your
system from a host server via XML-RPC. The app is passed via an associated
array of [] = base64_encoded();. Using base64 to maintain binary file types
(images/foreign lang files).
Index: xml_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/xml_functions.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** xml_functions.inc.php 15 Feb 2002 19:05:40 -0000 1.24
--- xml_functions.inc.php 20 Feb 2002 03:46:27 -0000 1.25
***************
*** 710,713 ****
--- 710,721 ----
}
+ $GLOBALS['_xmlrpcs_package_app_byid_sig'] =
array(array(xmlrpcStruct,xmlrpcString));
+ $GLOBALS['_xmlrpcs_package_app_byid_doc'] = 'Package an application for
transport back to the calling client';
+ function _xmlrpcs_package_app_byid($server,$m)
+ {
+ $app = $m->getParam(0);
+ return
ExecMethod('phpgwapi.app_registry.package_app_byid',$app->scalarval());
+ }
+
$GLOBALS['_xmlrpcs_login_sig'] =
array(array(xmlrpcStruct,xmlrpcStruct));
$GLOBALS['_xmlrpcs_login_doc'] = 'phpGroupWare client or server login
via XML-RPC';
***************
*** 821,824 ****
--- 829,837 ----
'signature' => $GLOBALS['_xmlrpcs_find_new_app_sig'],
'docstring' => $GLOBALS['_xmlrpcs_find_new_app_doc']
+ ),
+ 'system.package_app_byid' => array(
+ 'function' => '_xmlrpcs_package_app_byid',
+ 'signature' =>
$GLOBALS['_xmlrpcs_package_app_byid_sig'],
+ 'docstring' => $GLOBALS['_xmlrpcs_package_app_byid_doc']
),
'system.login' => array(
Index: class.app_registry.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.app_registry.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.app_registry.inc.php 15 Feb 2002 19:05:40 -0000 1.1
--- class.app_registry.inc.php 20 Feb 2002 03:46:27 -0000 1.2
***************
*** 34,37 ****
--- 34,38 ----
'request_appbyname' => True,
'request_newer_applist' => True,
+ 'request_packaged_app' => True,
'get_appbyid' => True,
'get_appbyname' => True,
***************
*** 46,49 ****
--- 47,52 ----
var $server;
+ var $dir_file = Array();
+
// var $target_page = '/cvsdemo/xmlrpc.php';
// var $target_site = 'www.phpgroupware.org';
***************
*** 126,129 ****
--- 129,142 ----
),
'docstring' =>
lang('compare an array of apps/versions against the repository and return
new/updated list of apps.')
+ ),
+ 'package_app_byid' => Array(
+ 'function' =>
'package_app_byid',
+ 'signature' => Array(
+ Array(
+
xmlrpcStruct,
+
xmlrpcString
+ )
+ ),
+ 'docstring' =>
lang('Package an application for transport back to the calling client.')
)
);
***************
*** 202,205 ****
--- 215,230 ----
}
+ function request_packaged_app($app_id)
+ {
+ if(is_object($this->is))
+ {
+ return
$this->is->send('system.package_app_byid',$app_id,$this->is->server['server_url']);
+ }
+ else
+ {
+ return
$this->request('phpgwapi.app_registry.get_appbyname',$app_name);
+ }
+ }
+
function get_result()
{
***************
*** 207,281 ****
{
case 0:
! $app[] =
CreateObject('phpgwapi.xmlrpcval',CreateObject('phpgwapi.xmlrpcval',False,'boolean'),'boolean');
! break;
! case 1:
! $this->db->next_record();
! $app[] =
CreateObject('phpgwapi.xmlrpcval',
! Array(
! 'id' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_id'),'int'),
! 'name' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_name'),'string'),
! 'title' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_title'),'string'),
! 'version' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_version'),'string'),
! 'tables' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_tables'),'string')
! ),
! 'struct'
! );
break;
default:
while($this->db->next_record())
{
! $app[] =
CreateObject('phpgwapi.xmlrpcval',
! Array(
! 'id'
=> CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_id'),'int'),
! 'name'
=> CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_name'),'string'),
! 'title'
=> CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_title'),'string'),
!
'version' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_version'),'string'),
!
'tables' =>
CreateObject('phpgwapi.xmlrpcval',$this->db->f('app_tables'),'string')
! ),
! 'struct'
);
}
break;
}
! return
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$app,
'struct'));
}
! // function get_result()
! // {
! // switch($this->db->num_rows())
! // {
! // case 0:
! // $app = False;
! // break;
! // case 1:
! // $this->db->next_record();
! // $app = Array(
! // 'id' =>
$this->db->f('app_id'),
! // 'name' =>
$this->db->f('app_name'),
! // 'title' =>
$this->db->f('app_title'),
! // 'version' =>
$this->db->f('app_version'),
! // 'tables' =>
$this->db->f('app_tables')
! // );
! // break;
! // default:
! // while($this->db->next_record())
! // {
! // $app[] = Array(
! // 'id' =>
$this->db->f('app_id'),
! // 'name' =>
$this->db->f('app_name'),
! // 'title' =>
$this->db->f('app_title'),
! // 'version' =>
$this->db->f('app_version'),
! // 'tables' =>
$this->db->f('app_tables')
! // );
! // }
! // break;
! // }
! // return $app;
! // }
function get_appbyid($app_id)
{
$this->db->query('SELECT * FROM phpgw_applications
WHERE app_id='.$app_id,__LINE__,__FILE__);
! return $this->get_result();
}
--- 232,284 ----
{
case 0:
! $app = False;
break;
default:
while($this->db->next_record())
{
! $app[$this->db->f('app_id')] =
Array(
! 'id' =>
$this->db->f('app_id'),
! 'name' =>
$this->db->f('app_name'),
! 'title' =>
$this->db->f('app_title'),
! 'version' =>
$this->db->f('app_version'),
! 'tables' =>
$this->db->f('app_tables')
);
}
break;
}
! return $app;
}
! function xml_response($app)
! {
! switch(gettype($app))
! {
! case 'boolean':
! return
CreateObject('phpgwapi.xmlrpcval',CreateObject('phpgwapi.xmlrpcval',False,'boolean'),'boolean');
! break;
! case 'array':
! @reset($app);
! while($app && list($id,$application) =
each($app))
! {
! $updated_app[$id] =
CreateObject('phpgwapi.xmlrpcval',
! Array(
! 'id' =>
CreateObject('phpgwapi.xmlrpcval',$id,'int'),
! 'name' =>
CreateObject('phpgwapi.xmlrpcval',$application['name'],'string'),
! 'title' =>
CreateObject('phpgwapi.xmlrpcval',$application['title'],'string'),
! 'version' =>
CreateObject('phpgwapi.xmlrpcval',$application['version'],'string'),
! 'tables' =>
CreateObject('phpgwapi.xmlrpcval',$application['tables'],'string')
! ),
! 'struct'
! );
! }
! return
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$updated_app,
'struct'));
! break;
! }
! }
function get_appbyid($app_id)
{
$this->db->query('SELECT * FROM phpgw_applications
WHERE app_id='.$app_id,__LINE__,__FILE__);
! return $this->xml_response($this->get_result());
}
***************
*** 283,287 ****
{
$this->db->query("SELECT * FROM phpgw_applications
WHERE app_name='".$app_name."'",__LINE__,__FILE__);
! return $this->get_result();
}
--- 286,290 ----
{
$this->db->query("SELECT * FROM phpgw_applications
WHERE app_name='".$app_name."'",__LINE__,__FILE__);
! return $this->xml_response($this->get_result());
}
***************
*** 289,293 ****
{
$this->db->query('SELECT * FROM
phpgw_applications',__LINE__,__FILE__);
! return $this->get_result();
}
--- 292,296 ----
{
$this->db->query('SELECT * FROM
phpgw_applications',__LINE__,__FILE__);
! return $this->xml_response($this->get_result());
}
***************
*** 295,308 ****
{
$this->db->query('SELECT * FROM
phpgw_applications',__LINE__,__FILE__);
! while($this->db->next_record())
! {
! $app[$this->db->f('app_id')] = Array(
! 'id' => $this->db->f('app_id'),
! 'name' => $this->db->f('app_name'),
! 'title' => $this->db->f('app_title'),
! 'version' =>
$this->db->f('app_version'),
! 'tables' => $this->db->f('app_tables')
! );
! }
@reset($apps);
while($apps && list($id,$application) = each($apps))
--- 298,302 ----
{
$this->db->query('SELECT * FROM
phpgw_applications',__LINE__,__FILE__);
! $app = $this->get_result();
@reset($apps);
while($apps && list($id,$application) = each($apps))
***************
*** 310,314 ****
if($app[$id])
{
! if($app[$id]->version ==
$application->version)
{
unset($app[$id]);
--- 304,308 ----
if($app[$id])
{
! if($app[$id]['version'] ==
$application['version'])
{
unset($app[$id]);
***************
*** 316,335 ****
}
}
! @reset($app);
! while($app && list($id,$application) = each($app))
{
! $updated_app[$id] =
CreateObject('phpgwapi.xmlrpcval',
! Array(
! 'id' =>
CreateObject('phpgwapi.xmlrpcval',$id,'int'),
! 'name' =>
CreateObject('phpgwapi.xmlrpcval',$application->name,'string'),
! 'title' =>
CreateObject('phpgwapi.xmlrpcval',$application->title,'string'),
! 'version' =>
CreateObject('phpgwapi.xmlrpcval',$application->version,'string'),
! 'tables' =>
CreateObject('phpgwapi.xmlrpcval',$application->tables,'string')
! ),
! 'struct'
! );
}
- return
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$updated_app,
'struct'));
}
}
?>
--- 310,370 ----
}
}
! return $this->xml_response($app);
! }
!
! function package_file($filename)
! {
! $fp=fopen($filename,'rt');
! $packed_file =
CreateObject('phpgwapi.xmlrpcval',fread($fp,filesize($filename)),'base64');
! fclose($fp);
! return $packed_file;
! }
!
! function pack_dir($directory,$app,$dir_prefix='')
! {
! $sep = filesystem_separator();
! if($dir_prefix)
{
! $dir_prefix .= $sep;
! }
! $d = dir($directory);
! while($entry = $d->read())
! {
! $new_filename = $directory.$sep.$entry;
! if(is_file($new_filename))
! {
! $this->dir_file[$dir_prefix.$entry] =
$this->package_file($new_filename);
! }
! elseif(is_dir($new_filename))
! {
! if($entry != '.' && $entry != '..' &&
$entry != 'CVS')
! {
! //
$this->dir_file[$dir_prefix.$entry] =
CreateObject('phpgwapi.xmlrpcval',$new_filename,'string');
! $dir_path[$dir_prefix.$entry] =
$new_filename;
! }
! }
! }
! $d->close();
! @reset($dir_path);
! while($dir_path && list($dir_prefix,$filename) =
each($dir_path))
! {
! $this->pack_dir($filename,$app,$dir_prefix);
}
}
+
+ function package_app_byid($appid)
+ {
+ $this->db->query('SELECT app_name FROM
phpgw_applications WHERE app_id='.$appid,__LINE__,__FILE__);
+ if(!$this->db->num_rows())
+ {
+ return
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',False,'boolean'),'boolean');
+ }
+ $this->db->next_record();
+ $path_prefix =
PHPGW_SERVER_ROOT.filesystem_separator().$this->db->f('app_name');
+ $this->dir_file = Array();
+ $this->pack_dir($path_prefix,$this->db->f('app_name'));
+ return
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->dir_file,'struct'));
+ }
+
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc xml_functions.inc.php,1.24,1.25 class.app_registry.inc.php,1.1,1.2,
Mark A Peters <address@hidden> <=