summaryrefslogtreecommitdiff
path: root/lib/plugins/plugin/classes
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/plugin/classes')
-rw-r--r--lib/plugins/plugin/classes/ap_download.class.php32
-rw-r--r--lib/plugins/plugin/classes/ap_enable.class.php4
-rw-r--r--lib/plugins/plugin/classes/ap_manage.class.php19
-rw-r--r--lib/plugins/plugin/classes/ap_update.class.php2
4 files changed, 28 insertions, 29 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');
diff --git a/lib/plugins/plugin/classes/ap_enable.class.php b/lib/plugins/plugin/classes/ap_enable.class.php
index 35450a907..a25c7ede8 100644
--- a/lib/plugins/plugin/classes/ap_enable.class.php
+++ b/lib/plugins/plugin/classes/ap_enable.class.php
@@ -6,9 +6,11 @@ class ap_enable extends ap_manage {
function process() {
global $plugin_protected;
+ global $INPUT;
+
$count_enabled = $count_disabled = 0;
- $this->enabled = isset($_REQUEST['enabled']) ? $_REQUEST['enabled'] : array();
+ $this->enabled = $INPUT->arr('enabled');
foreach ($this->manager->plugin_list as $plugin) {
if (in_array($plugin, $plugin_protected)) continue;
diff --git a/lib/plugins/plugin/classes/ap_manage.class.php b/lib/plugins/plugin/classes/ap_manage.class.php
index 12480e922..3ec740dae 100644
--- a/lib/plugins/plugin/classes/ap_manage.class.php
+++ b/lib/plugins/plugin/classes/ap_manage.class.php
@@ -69,7 +69,6 @@ class ap_manage {
}
function html_pluginlist() {
- global $ID;
global $plugin_protected;
foreach ($this->manager->plugin_list as $plugin) {
@@ -141,9 +140,18 @@ class ap_manage {
break;
case 'update' :
+ $url = $data[0];
$date = date('r');
- if (!$fp = @fopen($file, 'a')) return;
- fwrite($fp, "updated=$date\n");
+ if (!$fp = @fopen($file, 'r+')) return;
+ $buffer = "";
+ while (($line = fgets($fp)) !== false) {
+ $urlFound = strpos($line,"url");
+ if($urlFound !== false) $line="url=$url\n";
+ $buffer .= $line;
+ }
+ $buffer .= "updated=$date\n";
+ fseek($fp, 0);
+ fwrite($fp, $buffer);
fclose($fp);
break;
}
@@ -186,11 +194,8 @@ class ap_manage {
closedir($dh);
return @rmdir($path);
- } else {
- return @unlink($path);
}
-
- return false;
+ return @unlink($path);
}
diff --git a/lib/plugins/plugin/classes/ap_update.class.php b/lib/plugins/plugin/classes/ap_update.class.php
index c43429a1b..5d7f6cb08 100644
--- a/lib/plugins/plugin/classes/ap_update.class.php
+++ b/lib/plugins/plugin/classes/ap_update.class.php
@@ -5,8 +5,6 @@ class ap_update extends ap_download {
var $overwrite = true;
function process() {
- global $lang;
-
$plugin_url = $this->plugin_readlog($this->plugin, 'url');
$this->download($plugin_url, $this->overwrite);
return '';