diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-02-03 22:57:45 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-02-03 22:57:45 +0100 |
commit | 3da7921f08ecdda929466921ecc50698f1adf99e (patch) | |
tree | 0e179e504399e874bfd785d0a95eec44b76d5952 /lib/plugins/plugin/classes/ap_download.class.php | |
parent | 6cf2bbfa12b776cf47cb69ae40fb8862f715ad01 (diff) | |
parent | cc4bb766fdac23358d7b586aa3830b9650eed7a8 (diff) | |
download | rpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.gz rpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.bz2 |
Merge branch 'master' into future
* master: (162 commits)
fixed revision JS for images
upgraded SimplePie to 1.3.1 FS#2708
removed obsolete browser plugin (migrate does it)
adjust spacing to match standard 1.4em grid
added comment on use of whitelist vs blacklist
Updated idfilter() function for IIS
use var and remove suggestions when needed Use variable for maximum number of suggestions for quicksearch. And hide suggestions when search field is emptied, or when no suggestion are found.
added 'home' class to first link in hierarchical breadcrumbs
reduced required max width to go into tablet mode
re-added linear gradients for firefox
added missing styling for disabled form elements (FS#2705)
fixed acronyms in italics (FS#2684)
improved print styles (includes fixes for FS#2645 and FS#2707)
basic styles improvements
Greek language update
Use list in acl help text, for more structure
Galician language update
touch the config on save, even if no changes were made
unwind the width narrowing commit
put some whitespace between form submit button and fieldset bottom border
...
Conflicts:
lib/plugins/config/admin.php
lib/plugins/config/settings/config.class.php
Diffstat (limited to 'lib/plugins/plugin/classes/ap_download.class.php')
-rw-r--r-- | lib/plugins/plugin/classes/ap_download.class.php | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php index d1b518d9d..3cc455867 100644 --- a/lib/plugins/plugin/classes/ap_download.class.php +++ b/lib/plugins/plugin/classes/ap_download.class.php @@ -7,7 +7,6 @@ class ap_download extends ap_manage { * Initiate the plugin download */ function process() { - global $lang; global $INPUT; $plugin_url = $INPUT->str('url'); @@ -45,7 +44,6 @@ class ap_download extends ap_manage { * Process the downloaded file */ function download($url, $overwrite=false) { - global $lang; // check the url $matches = array(); if (!preg_match("/[^\/]*$/", $url, $matches) || !$matches[0]) { @@ -200,31 +198,26 @@ class ap_download extends ap_manage { if (in_array($ext, array('tar','bz','gz'))) { switch($ext){ case 'bz': - $compress_type = TarLib::COMPRESS_BZIP; + $compress_type = Tar::COMPRESS_BZIP; break; case 'gz': - $compress_type = TarLib::COMPRESS_GZIP; + $compress_type = Tar::COMPRESS_GZIP; break; default: - $compress_type = TarLib::COMPRESS_NONE; + $compress_type = Tar::COMPRESS_NONE; } - $tar = new TarLib($file, $compress_type); - if($tar->_initerror < 0){ + $tar = new Tar(); + try { + $tar->open($file, $compress_type); + $tar->extract($target); + return true; + }catch(Exception $e){ if($conf['allowdebug']){ - msg('TarLib Error: '.$tar->TarErrorStr($tar->_initerror),-1); + msg('Tar Error: '.$e->getMessage().' ['.$e->getFile().':'.$e->getLine().']',-1); } return false; } - $ok = $tar->Extract(TarLib::FULL_ARCHIVE, $target, '', 0777); - - if($ok<1){ - if($conf['allowdebug']){ - msg('TarLib Error: '.$tar->TarErrorStr($ok),-1); - } - return false; - } - return true; } else if ($ext == 'zip') { $zip = new ZipLib(); @@ -246,7 +239,7 @@ class ap_download extends ap_manage { * if neither bz, gz or zip are recognized, tar is assumed. * * @author Andreas Gohr <andi@splitbrain.org> - * @returns false if the file can't be read, otherwise an "extension" + * @returns boolean|string false if the file can't be read, otherwise an "extension" */ function guess_archive($file){ $fh = fopen($file,'rb'); |