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.php36
-rw-r--r--lib/plugins/plugin/classes/ap_enable.class.php4
-rw-r--r--lib/plugins/plugin/classes/ap_manage.class.php13
3 files changed, 30 insertions, 23 deletions
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php
index b2571f632..0eb567c80 100644
--- a/lib/plugins/plugin/classes/ap_download.class.php
+++ b/lib/plugins/plugin/classes/ap_download.class.php
@@ -8,8 +8,9 @@ class ap_download extends ap_manage {
*/
function process() {
global $lang;
+ global $INPUT;
- $plugin_url = $_REQUEST['url'];
+ $plugin_url = $INPUT->str('url');
$this->download($plugin_url, $this->overwrite);
return '';
}
@@ -155,16 +156,16 @@ class ap_download extends ap_manage {
$info['type'] = 'plugin';
$info['tmp'] = "$base/$dir";
$conf = confToHash("$base/$dir/$f");
- $info['base'] = basename($conf['base']);
- if(!$info['base']) $info['base'] = basename("$base/$dir");
+ $info['base'] = utf8_basename($conf['base']);
+ if(!$info['base']) $info['base'] = utf8_basename("$base/$dir");
$result['new'][] = $info;
}elseif($f == 'template.info.txt'){
$info = array();
$info['type'] = 'template';
$info['tmp'] = "$base/$dir";
$conf = confToHash("$base/$dir/$f");
- $info['base'] = basename($conf['base']);
- if(!$info['base']) $info['base'] = basename("$base/$dir");
+ $info['base'] = utf8_basename($conf['base']);
+ if(!$info['base']) $info['base'] = utf8_basename("$base/$dir");
$result['new'][] = $info;
}
}else{
@@ -199,31 +200,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();
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..28579cbe9 100644
--- a/lib/plugins/plugin/classes/ap_manage.class.php
+++ b/lib/plugins/plugin/classes/ap_manage.class.php
@@ -141,9 +141,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;
}