New plugin loader, page features, API0.2b, Bugfixes

This commit is contained in:
2016-11-19 16:13:37 +01:00
parent 6d1eef25ca
commit b97faf21fd
230 changed files with 36532 additions and 36346 deletions

View File

@ -1,51 +1,52 @@
<?php
if (isset($_POST['pluginId']) && isnum($_POST['pluginId']))
{
if ($_sql->query("UPDATE plugins SET pluginStatus = ".(isset($_POST['pluginEnable']) ? 1 : 0)." WHERE pluginId = $_POST[pluginId]"))
redirect(get_current_link());
else
array_push($error, $_locale['plugin_not_updated']);
}
echo "<h1>$_locale[plugins]</h1>";
$pluginsQuery = $_sql->query("SELECT * FROM plugins ORDER BY pluginStatus DESC");
$plugins = array();
if ($pluginsQuery->num_rows)
{
echo "<table class='designed plugins'>";
echo "<tr><td>{locale:plugin_name}</td><td>{locale:description}</td><td>{locale:scope}</td><td>{locale:status}</td></tr>";
while ($data = $pluginsQuery->fetch_assoc())
{
$pinfo = './plugins/'.$data['pluginLib'].'/info.json';
if (file_exists($pinfo))
{
$pinfo = (array)json_decode(file_get_contents($pinfo));
if ($data['pluginStatus'])
$button = "<button name='pluginDisable' class='orange'>{locale:disable}</button>";
else $button = "<button name='pluginEnable'>{locale:enable}</button>";
echo "<tr><td>$pinfo[name]</td><td>$pinfo[description]<td>$pinfo[paths]</td><td><form action='".get_current_link()."' method='post'><input type='hidden' name='pluginId' value='$data[pluginId]'/>$button</form></td></tr>";
}
array_push($plugins, $data['pluginLib']);
}
echo "</table>";
} else
echo "<p>$_locale[plugins_empty]</p>";
if ($handle = opendir('./plugins')) {
while (false !== ($entry = readdir($handle)))
{
if (!in_array($entry, $plugins) && file_exists('./plugins/'.$entry.'/info.json'))
if ($_sql->query("INSERT INTO plugins (pluginLib, pluginStatus) VALUES ('$entry', 0)"))
array_push($info, $_locale['plugin_added'].$entry);
else
array_push($error, $_locale['plugin_not_added'].$entry);
}
closedir($handle);
<?php
if (isset($_POST['pluginId']) && is_numeric($_POST['pluginId']))
{
if ($_sql->query("UPDATE plugins SET pluginStatus = ".(isset($_POST['pluginEnable']) ? 1 : 0)." WHERE pluginId = $_POST[pluginId]"))
redirect(get_current_link());
else
array_push($error, $_locale['plugin_not_updated']);
}
echo "<h1>$_locale[plugins]</h1>";
$pluginsQuery = $_sql->query("SELECT * FROM plugins ORDER BY pluginStatus DESC");
$plugins = array();
if ($pluginsQuery->num_rows)
{
echo "<table class='designed plugins'>";
echo "<thead><tr><th>{locale:plugin_name}</th><th>{locale:description}</th><th>{locale:scope}</th><th>{locale:status}</th></tr></thead><tbody>";
while ($data = $pluginsQuery->fetch_assoc())
{
$pinfo = './plugins/'.$data['pluginLib'].'/info.json';
if (file_exists($pinfo))
{
$pinfo = (array)json_decode(file_get_contents($pinfo));
if (!isset($pinfo['enabler']) || (isset($pinfo['enabler']) && in_array($pinfo['enabler'], ['true', '1', 'yes', 'y'])))
if ($data['pluginStatus']) $button = "<button name='pluginDisable' class='orange'>{locale:disable}</button>";
else $button = "<button name='pluginEnable'>{locale:enable}</button>";
else $button = "{locale:plugin_noenable}";
echo "<tr><td>$pinfo[name]</td><td>$pinfo[description]<td>$pinfo[paths]</td><td><form action='".get_current_link()."' method='post'><input type='hidden' name='pluginId' value='$data[pluginId]'/>$button</form></td></tr>";
}
array_push($plugins, $data['pluginLib']);
}
echo "</tbody></table>";
} else
echo "<p>$_locale[plugins_empty]</p>";
if ($handle = opendir('./plugins')) {
while (false !== ($entry = readdir($handle)))
{
if (!in_array($entry, $plugins) && file_exists('./plugins/'.$entry.'/info.json'))
if ($_sql->query("INSERT INTO plugins (pluginLib, pluginStatus) VALUES ('$entry', 0)"))
array_push($info, $_locale['plugin_added'].$entry);
else
array_push($error, $_locale['plugin_not_added'].$entry);
}
closedir($handle);
}