phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.app_registry.inc.php,1.2,1.3


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.app_registry.inc.php,1.2,1.3
Date: Sat, 23 Feb 2002 08:23:01 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv28816/phpgwapi/inc

Modified Files:
        class.app_registry.inc.php 
Log Message:
This will now create the files after d/l'ing them.  This could be dangerous as 
it actually overwrites any files that are in your apps directory.  Remember, 
overwrites, it does not delete the app directory and reinstalls.  Maybe it 
should as it would need to be allowed to remove old unused files.

Index: class.app_registry.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.app_registry.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.app_registry.inc.php  20 Feb 2002 03:46:27 -0000      1.2
--- class.app_registry.inc.php  23 Feb 2002 13:22:59 -0000      1.3
***************
*** 219,223 ****
                        if(is_object($this->is))
                        {
!                               return 
$this->is->send('system.package_app_byid',$app_id,$this->is->server['server_url']);
                        }
                        else
--- 219,258 ----
                        if(is_object($this->is))
                        {
!                               $application = 
$this->is->send('system.package_app_byid',$app_id,$this->is->server['server_url']);
! 
! // comment from here down to stop the actual install
!                               // This is where I need to install the 
application
!                               $sep = filesystem_separator();
!                               @reset($application);
!                               list($appid,$app_info) = each($application);
!                               $app_name = $app_info['name'];
! 
!                               $basedir = PHPGW_SERVER_ROOT.$sep.$app_name;
!                               @mkdir($basedir);
! 
!                               while($application && 
list($filename,$file_content) = each($application))
!                               {
!                                       $long_filename = 
$basedir.$sep.$filename;
!                                       // This will be dangerous to do
!                                       $directory = dirname($long_filename);
!                                       if(!is_dir($directory))
!                                       {
!                                               $long_dir = $long_filename;
!                                               $pos_slash = pos(' 
'.$long_dir,$sep)
!                                               while($pos_slash)
!                                               {
!                                                       $short_dir = 
substr($long_dir,0,$pos_slash - 1);
!                                                       $long_dir = 
str_replace($short_dir.$sep,'',$long_dir);
!                                                       @mkdir($short_dir,770);
!                                                       $pos_slash = pos(' 
'.$long_dir,$sep)
!                                               }
!                                       }
!                                       $fp=fopen($long_filename,'wb');
!                                       
fwrite($fp,base64_decode($file_content));
!                                       fclose($fp);
!                               }
! // Comment above to stop the actual install
!                               @reset($application);
!                               return $application;
                        }
                        else
***************
*** 315,320 ****
                function package_file($filename)
                {
!                       $fp=fopen($filename,'rt');
!                       $packed_file = 
CreateObject('phpgwapi.xmlrpcval',fread($fp,filesize($filename)),'base64');
                        fclose($fp);
                        return $packed_file;
--- 350,355 ----
                function package_file($filename)
                {
!                       $fp=fopen($filename,'rb');
!                       $packed_file = 
CreateObject('phpgwapi.xmlrpcval',base64_encode(fread($fp,filesize($filename))),'base64');
                        fclose($fp);
                        return $packed_file;
***************
*** 355,366 ****
                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'));
--- 390,416 ----
                function package_app_byid($appid)
                {
!                       // Need to find a way to validate that the value in 
this string is an
!                       // app_id, if not, then it is an app_name
!                       if(is_int($appid) && $appid)
!                       {
!                       }
!                       $this->db->query('SELECT * 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->dir_file = Array();
                        $this->db->next_record();
+                       $this->dir_file[$appid] = 
CreateObject('phpgwapi.xmlrpcval',
+                               Array(
+                                       'id'      => 
CreateObject('phpgwapi.xmlrpcval',$appid,'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'
+                       );
                        $path_prefix = 
PHPGW_SERVER_ROOT.filesystem_separator().$this->db->f('app_name');
                        $this->pack_dir($path_prefix,$this->db->f('app_name'));
                        return 
CreateObject('phpgwapi.xmlrpcresp',CreateObject('phpgwapi.xmlrpcval',$this->dir_file,'struct'));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]