summaryrefslogtreecommitdiff
path: root/lib/plugins/plugin/classes/ap_download.class.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-11-30 12:30:40 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-11-30 12:30:40 +0100
commitd14415e37072dbe16077efd700aee5bd33707b54 (patch)
tree062c3c190039ac9490f56598b0ee116de18c2480 /lib/plugins/plugin/classes/ap_download.class.php
parent2ed38036a53a489d2fcadc46ce601f8c876fca31 (diff)
parent38479cbba628ee76a92ff5f3c974cfa8e6ce9e61 (diff)
downloadrpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.gz
rpg-d14415e37072dbe16077efd700aee5bd33707b54.tar.bz2
Merge branch 'master' into subscription
* master: (175 commits) some coding style improvements added .idea project folder to gitignore use correct setUp method and parent calls. Correct German plugin manager translation (download != install) correct return in sendDigest() Fix case-insensitive match in ACL checking GeSHi update to 1.0.8.11 ignore empty header on mail sending remove empty BCC/CC mail headers Galician language update some welcome page changes Combine subsequent calls to strtr into a single transformation changed semicolon to colon in link to welcome page to make it less confusing fixed wrong sidebar showing in namespaces when sidebar is disabled Typo fix for TL;DR removed a bunch of outdated and irrelevant networking acronyms added another place to look for logo to make it more consistent (FS#2656) French language update Czech language update compat js findPosX/y more closely mimic historical function ... Conflicts: inc/auth.php inc/common.php inc/subscription.php lib/exe/indexer.php
Diffstat (limited to 'lib/plugins/plugin/classes/ap_download.class.php')
-rw-r--r--lib/plugins/plugin/classes/ap_download.class.php32
1 files changed, 13 insertions, 19 deletions
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php
index 2d5ead400..3cc455867 100644
--- a/lib/plugins/plugin/classes/ap_download.class.php
+++ b/lib/plugins/plugin/classes/ap_download.class.php
@@ -7,9 +7,9 @@ class ap_download extends ap_manage {
* Initiate the plugin download
*/
function process() {
- global $lang;
+ global $INPUT;
- $plugin_url = $_REQUEST['url'];
+ $plugin_url = $INPUT->str('url');
$this->download($plugin_url, $this->overwrite);
return '';
}
@@ -44,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]) {
@@ -199,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();
@@ -245,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');