* more fixes to plugin dot

This commit is contained in:
slawkens1 2017-10-11 22:26:16 +02:00
parent 6ec829e47f
commit 22cf7f5d4f

View File

@ -229,11 +229,13 @@ $rows = array();
$path = PLUGINS; $path = PLUGINS;
foreach(scandir($path) as $file) foreach(scandir($path) as $file)
{ {
$file_info = explode('.', $file); $file_ext = pathinfo($file, PATHINFO_EXTENSION);
if($file == '.' || $file == '..' || $file == 'disabled' || $file == 'example.json' || is_dir($path . $file) || !$file_info[1] || $file_info[1] != 'json') $file_name = pathinfo($file, PATHINFO_FILENAME);
if($file == '.' || $file == '..' || $file == 'disabled' || $file == 'example.json' || is_dir($path . $file) || $file_ext != 'json')
continue; continue;
$string = file_get_contents(BASE . 'plugins/' . $file_info[0] . '.json'); $file_info = str_replace('.json', '', $file_name);
$string = file_get_contents(BASE . 'plugins/' . $file_info . '.json');
$plugin_info = json_decode($string, true); $plugin_info = json_decode($string, true);
if($plugin_info == false) { if($plugin_info == false) {
warning('Cannot load plugin info ' . $file); warning('Cannot load plugin info ' . $file);
@ -245,7 +247,7 @@ foreach(scandir($path) as $file)
'version' => $plugin_info['version'], 'version' => $plugin_info['version'],
'author' => $plugin_info['author'], 'author' => $plugin_info['author'],
'contact' => $plugin_info['contact'], 'contact' => $plugin_info['contact'],
'file' => $file_info[0], 'file' => $file_info,
'uninstall' => isset($plugin_info['uninstall']) 'uninstall' => isset($plugin_info['uninstall'])
); );
} }