mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* reverted removing base href in html head
* added anonymous usage statistics reporting * (fix) don't show templates that doesn't exist in Menus option in Admin Panel * (fix) menu ordering by category * (fix) showing changelog with urls in Admin Panel * (internal) moved uninstall logic to Plugins class
This commit is contained in:
@@ -138,6 +138,52 @@ class Plugins {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function uninstall($plugin_name) {
|
||||
global $cache;
|
||||
|
||||
$filename = BASE . 'plugins/' . $plugin_name . '.json';
|
||||
if(!file_exists($filename)) {
|
||||
self::$error = 'Plugin ' . $plugin_name . ' does not exist.';
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$string = file_get_contents($filename);
|
||||
$plugin_info = json_decode($string, true);
|
||||
if($plugin_info == false) {
|
||||
self::$error = 'Cannot load plugin info ' . $plugin_name . '.json';
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(!isset($plugin_info['uninstall'])) {
|
||||
self::$error = "Plugin doesn't have uninstall options defined. Skipping...";
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$success = true;
|
||||
foreach($plugin_info['uninstall'] as $file) {
|
||||
$file = BASE . $file;
|
||||
if(!deleteDirectory($file)) {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($success) {
|
||||
if($cache->enabled()) {
|
||||
$cache->delete('templates');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
self::$error = error_get_last();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getWarnings() {
|
||||
return self::$warnings;
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
class Usage_Statistics {
|
||||
private static $report_url = 'http://my-aac.org/report_usage.php';
|
||||
private static $report_url = 'https://my-aac.org/report_usage.php';
|
||||
|
||||
public static function report() {
|
||||
$data = json_encode(self::getStats());
|
||||
@@ -20,7 +20,6 @@ class Usage_Statistics {
|
||||
'http' => array(
|
||||
'header' => 'Content-type: application/json' . "\r\n"
|
||||
. 'Content-Length: ' . strlen($data) . "\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => $data
|
||||
)
|
||||
);
|
||||
@@ -28,7 +27,6 @@ class Usage_Statistics {
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents(self::$report_url, false, $context);
|
||||
|
||||
//var_dump($result);
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user