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,7 +1,8 @@
<h1>{locale:dashboard}</h1>
<ul>
<li><a href='/admin/entry'>{locale:entry_editor}</a></li>
<li><a href='/admin/plugins'>{locale:plugin_manager}</a></li>
<li><a href='/admin/page'>{locale:page_editor}</a></li>
<h1>{locale:dashboard}</h1>
<ul>
<li><a href='/admin/entry'>{locale:entry_editor}</a></li>
<li><a href='/admin/plugins'>{locale:plugin_manager}</a></li>
<li><a href='/admin/page'>{locale:page_editor}</a></li>
<li><a href='/admin/settings'>{locale:site_settings}</a></li>
</ul>

View File

@ -1,149 +1,149 @@
<?php
if (isset($_GET['status']))
switch ($_GET['status'])
{
case 'added':
array_push($info, $_locale['entry_added']);
break;
case 'updated':
array_push($info, $_locale['entry_updated']);
break;
}
if (isset($_POST['entryContent']) && $user['userLevel'] > 2)
{
if (isset($_POST['entryAdd']))
{
if (blog::add($_POST['entryHeader'], $_POST['entryTitle'], $_POST['entrySlug'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_entry_link($_POST['entrySlug']), 'added');
else
array_push($error, $_locale['entry_not_added']);
} elseif (isset($_POST['entryUpdate']))
{
if (blog::update($_POST['entryUpdate'], $_POST['entryHeader'], $_POST['entryTitle'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_current_link(), 'updated');
else
array_push($error, $_locale['entry_not_updated']);
}
}
if (isset($_POST['entryTag']) && $user['userLevel'] > 2)
{
if (isset($_POST['tagIdRemove']))
{
if (blog::tagRemove($_POST['tagIdRemove'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_removed']);
else
array_push($error, $_locale['entry_tag_not_removed']);
} elseif (blog::tag($_POST['tagId'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_added']);
else
array_push($error, $_locale['entry_tag_not_added']);
}
if (isset($seo[2]) && $user['userLevel'] > 2)
{
$entry = new blog($seo[2]);
if ($entry->entries)
{
$entryData = $entry->entry();
if (isset($seo[3]) && $user['userLevel'] > 3)
switch ($seo[3])
{
case 'delete':
if ($entry->delete($entryData['entryId']))
redirect('/admin/entry');
else
array_push($error, $_locale['entry_not_deleted']);
break;
case 'pin':
if ($entry->pin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_pinned']);
break;
case 'unpin':
if ($entry->unpin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_unpinned']);
break;
}
}
} else
{
$timedQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryPublished > ".time()."");
if ($timedQuery->num_rows)
{
echo "<h1>{locale:timed_entries}</h1>";
echo "<table class='designed timed'><tr><td>{locale:entry_title}</td><td>{locale:created_on}</td><td>{locale:timed_pub_date}</td></tr>";
while ($data = $timedQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'])."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</table>";
}
$hiddenQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryHidden IS NOT NULL");
if ($hiddenQuery->num_rows)
{
echo "<h1>{locale:hidden_entries}</h1>";
echo "<table class='designed timed'><tr><td>{locale:entry_title}</td><td>{locale:created_on}</td><td>{locale:timed_pub_date}</td></tr>";
while ($data = $hiddenQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'], null, true)."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</table>";
}
}
?>
<h1>{locale:entry_editor}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<?php if (isset($entryData)) : addTitle($entryData['entryTitle']); headerImage($entryData['entryHeader']); ?>
<input type="text" name="entryHeader" value="<?=htmlentities($entryData['entryHeader'])?>" placeholder="{locale:entry_header}" maxlength="255" />
<input type="text" name="entryTitle" value="<?=htmlentities($entryData['entryTitle'])?>" placeholder="{locale:entry_title}" maxlength="250" />
<textarea id="entry-textarea" name="entryContent" rows="30"><?=htmlspecialchars($entryData['entryContent'])?></textarea>
<input id="entry-date" type="text" name="entryPublished" value="<?=date(DATE_FORMAT_DEFAULT, $entryData['entryPublished'])?>" placeholder="{locale:entry_pub_date}" maxlength="50" />
<label><input type="checkbox" name="entryHidden" value="1" <?=($entryData['entryHidden'] ? 'checked ' : '')?> /> {locale:entry_hide}</label>
<input type="text" name="entryPIN" value="<?=htmlentities($entryData['entryPIN'])?>" placeholder="{locale:entry_pin}" maxlength="6" />
<input type="hidden" name="entryUpdate" value="<?=$entryData['entryId']?>" />
<?php else: ?>
<input type="text" name="entryHeader" id="entryHeader" placeholder="{locale:entry_header}" maxlength="255" />
<input type="text" name="entryTitle" id="entryTitle" placeholder="{locale:entry_title}" maxlength="250" />
<textarea id="entry-textarea" name="entryContent" rows="30"></textarea>
<input id="entry-date" type="text" name="entryPublished" placeholder="{locale:entry_pub_date}" maxlength="50" />
<input type="text" name="entrySlug" id="entrySlug" placeholder="{locale:entry_slug}" maxlength="100" />
<label><input type="checkbox" name="entryHidden" value="1" /> {locale:entry_hide}</label>
<input type="text" name="entryPIN" placeholder="{locale:entry_pin}" maxlength="6" />
<input type="hidden" name="entryAdd" value="true" />
<?php endif ?>
<button type="submit">{locale:save}</button>
</form>
<?php
if (isset($entryData))
{
$tags = $_sql->query("SELECT * FROM tags");
if ($tags->num_rows)
{
echo "<h3>{locale:tags}</h3>";
echo "<table class='designed'><tr><td>{locale:tag_name}</td><td>{locale:add}</td></tr>"
."<form action='".get_current_link()."' method='post' name='tagentry'>"
."<input type='hidden' name='entryId' value='$entryData[entryId]' />"
."<input type='hidden' name='entryTag' value='true' />";
while ($tag = $tags->fetch_assoc())
echo "<tr><td>$tag[tagName]</td><td>".($_sql->query("SELECT taggedId FROM tagged WHERE taggedEntry = $entryData[entryId] AND taggedTag = $tag[tagId]")->num_rows ? "<button type='submit' name='tagIdRemove' value='$tag[tagId]'>{locale:remove}</button>":"<button type='submit' name='tagId' value='$tag[tagId]'>{locale:add}</button>")."</td></tr>";
echo "</form>"
."</table>";
}
}
?>
<script>$("#entry-date").datepicker({ minDate: 0, maxDate: "+48M" });</script>
<?php
if (isset($_GET['status']))
switch ($_GET['status'])
{
case 'added':
array_push($info, $_locale['entry_added']);
break;
case 'updated':
array_push($info, $_locale['entry_updated']);
break;
}
if (isset($_POST['entryContent']) && $user['userLevel'] > 2)
{
if (isset($_POST['entryAdd']))
{
if (blog::add($_POST['entryHeader'], $_POST['entryTitle'], $_POST['entrySlug'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_entry_link($_POST['entrySlug']), 'added');
else
array_push($error, $_locale['entry_not_added']);
} elseif (isset($_POST['entryUpdate']))
{
if (blog::update($_POST['entryUpdate'], $_POST['entryHeader'], $_POST['entryTitle'], $_POST['entryContent'], $_POST['entryPublished'], (isset($_POST['entryHidden']) ? true : false), $_POST['entryPIN']))
redirect(get_current_link(), 'updated');
else
array_push($error, $_locale['entry_not_updated']);
}
}
if (isset($_POST['entryTag']) && $user['userLevel'] > 2)
{
if (isset($_POST['tagIdRemove']))
{
if (blog::tagRemove($_POST['tagIdRemove'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_removed']);
else
array_push($error, $_locale['entry_tag_not_removed']);
} elseif (blog::tag($_POST['tagId'], $_POST['entryId']))
array_push($info, $_locale['entry_tag_added']);
else
array_push($error, $_locale['entry_tag_not_added']);
}
if (isset($seo[2]) && $user['userLevel'] > 2)
{
$entry = new blog($seo[2]);
if ($entry->entries)
{
$entryData = $entry->entry();
if (isset($seo[3]) && $user['userLevel'] > 3)
switch ($seo[3])
{
case 'delete':
if ($entry->delete($entryData['entryId']))
redirect('/admin/entry');
else
array_push($error, $_locale['entry_not_deleted']);
break;
case 'pin':
if ($entry->pin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_pinned']);
break;
case 'unpin':
if ($entry->unpin($entryData['entryId']))
redirect();
else
array_push($error, $_locale['entry_not_unpinned']);
break;
}
}
} else
{
$timedQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryPublished > ".time()."");
if ($timedQuery->num_rows)
{
echo "<h1>{locale:timed_entries}</h1>";
echo "<table class='designed timed'><thead><tr><th>{locale:entry_title}</th><th>{locale:created_on}</th><th>{locale:timed_pub_date}</th></tr></thead><tbody>";
while ($data = $timedQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'])."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</tbody></table>";
}
$hiddenQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryHidden IS NOT NULL");
if ($hiddenQuery->num_rows)
{
echo "<h1>{locale:hidden_entries}</h1>";
echo "<table class='designed timed'><thead><tr><th>{locale:entry_title}</th><th>{locale:created_on}</th><th>{locale:timed_pub_date}</th></tr></thead><tbody>";
while ($data = $hiddenQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'], null, true)."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</tbody></table>";
}
}
?>
<h1>{locale:entry_editor}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<?php if (isset($entryData)) : addTitle($entryData['entryTitle']); headerImage($entryData['entryHeader']); ?>
<input type="text" name="entryHeader" value="<?=htmlentities($entryData['entryHeader'])?>" placeholder="{locale:entry_header}" maxlength="255" />
<input type="text" name="entryTitle" value="<?=htmlentities($entryData['entryTitle'])?>" placeholder="{locale:entry_title}" maxlength="250" />
<textarea id="entry-textarea" name="entryContent" rows="30"><?=htmlspecialchars($entryData['entryContent'])?></textarea>
<input id="entry-date" type="text" name="entryPublished" value="<?=date(DATE_FORMAT_DEFAULT, $entryData['entryPublished'])?>" placeholder="{locale:entry_pub_date}" maxlength="50" />
<label><input type="checkbox" name="entryHidden" value="1" <?=($entryData['entryHidden'] ? 'checked ' : '')?> /> {locale:entry_hide}</label>
<input type="text" name="entryPIN" value="<?=htmlentities($entryData['entryPIN'])?>" placeholder="{locale:entry_pin}" maxlength="6" />
<input type="hidden" name="entryUpdate" value="<?=$entryData['entryId']?>" />
<?php else: ?>
<input type="text" name="entryHeader" id="entryHeader" placeholder="{locale:entry_header}" maxlength="255" />
<input type="text" name="entryTitle" id="entryTitle" placeholder="{locale:entry_title}" maxlength="250" />
<textarea id="entry-textarea" name="entryContent" rows="30"></textarea>
<input id="entry-date" type="text" name="entryPublished" placeholder="{locale:entry_pub_date}" maxlength="50" />
<input type="text" name="entrySlug" id="entrySlug" placeholder="{locale:entry_slug}" maxlength="100" />
<label><input type="checkbox" name="entryHidden" value="1" /> {locale:entry_hide}</label>
<input type="text" name="entryPIN" placeholder="{locale:entry_pin}" maxlength="6" />
<input type="hidden" name="entryAdd" value="true" />
<?php endif ?>
<button type="submit">{locale:save}</button>
</form>
<?php
if (isset($entryData))
{
$tags = $_sql->query("SELECT * FROM tags");
if ($tags->num_rows)
{
echo "<h3>{locale:tags}</h3>";
echo "<table class='designed'><thead><tr><th>{locale:tag_name}</th><th>{locale:add}</th></tr></thead><tbody>"
."<form action='".get_current_link()."' method='post' name='tagentry'>"
."<input type='hidden' name='entryId' value='$entryData[entryId]' />"
."<input type='hidden' name='entryTag' value='true' />";
while ($tag = $tags->fetch_assoc())
echo "<tr><td>$tag[tagName]</td><td>".($_sql->query("SELECT taggedId FROM tagged WHERE taggedEntry = $entryData[entryId] AND taggedTag = $tag[tagId]")->num_rows ? "<button type='submit' name='tagIdRemove' value='$tag[tagId]'>{locale:remove}</button>":"<button type='submit' name='tagId' value='$tag[tagId]'>{locale:add}</button>")."</td></tr>";
echo "</form>"
."</tbody></table>";
}
}
?>
<script>$("#entry-date").datepicker({ minDate: 0, maxDate: "+48M" });</script>

View File

@ -1,36 +1,42 @@
<?php
addTitle($_locale['admin']);
if (!isset($seo[1])) $seo[1] = '';
switch ($seo[1])
{
case 'upload':
include 'data/upload.php';
exit;
break;
case 'plugins':
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['plugin_manager']);
include 'includes/admin/plugins.php';
break;
case $_set['subEntry']:
if ($user['userLevel'] < 2) redirect();
addTitle($_locale['entry_editor']);
include 'includes/admin/entry.php';
break;
case $_set['subPage']:
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['page_editor']);
include 'includes/admin/page.php';
break;
default:
include 'includes/admin/dashboard.php';
break;
<?php
addTitle($_locale['admin']);
if (!isset($seo[1])) $seo[1] = '';
switch ($seo[1])
{
case 'upload':
include 'data/upload.php';
exit;
break;
case 'settings':
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['site_settings']);
include 'includes/admin/settings.php';
break;
case 'plugins':
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['plugin_manager']);
include 'includes/admin/plugins.php';
break;
case $_set['subEntry']:
if ($user['userLevel'] < 2) redirect();
addTitle($_locale['entry_editor']);
include 'includes/admin/entry.php';
break;
case $_set['subPage']:
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['page_editor']);
include 'includes/admin/page.php';
break;
default:
include 'includes/admin/dashboard.php';
break;
}

View File

@ -1,55 +1,64 @@
<?php
if (isset($_POST['pageContent']) && isset($_POST['pageSlug']) && $user['userLevel'] > 3)
{
$page = new page($_POST['pageSlug']);
if (isset($_POST['pageAdd']))
{
if ($page->create($_POST['pageTitle'], $_POST['pageContent']))
array_push($info, $_locale['page_added']);
else
array_push($error, $_locale['page_not_added']);
} elseif (isset($_POST['pageUpdate']))
{
if ($page->update($_POST['pageTitle'], $_POST['pageContent']))
array_push($info, $_locale['page_updated']);
else
array_push($error, $_locale['page_not_updated']);
}
}
if (isset($seo[2]))
$page = new page($seo[2]);
else
{
$pagesQuery = $_sql->query("SELECT pageSlug, pageTitle FROM pages");
if ($pagesQuery->num_rows)
{
echo "<h1>{locale:pages}</h1>";
echo "<table class='designed pages'><tr><td>{locale:page_title}</td></tr>";
while ($data = $pagesQuery->fetch_assoc())
echo "<tr><td><a href='/admin/page/$data[pageSlug]'>$data[pageTitle]</a></td></tr>";
echo "</table>";
}
}
?>
<h1>{locale:page_editor}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<?php if (isset($page->data)) : addTitle($page->data['pageTitle']); ?>
<input type="text" name="pageTitle" value="<?=$page->data['pageTitle']?>" placeholder="{locale:page_title}" maxlength="250" />
<textarea name="pageContent"><?=htmlspecialchars($page->data['pageContent'])?></textarea>
<input type="hidden" name="pageSlug" value="<?=$page->data['pageSlug']?>" />
<input type="hidden" name="pageUpdate" value="true" />
<button type="button" onclick="window.location.href='/admin/page'">{locale:cancel}</button>
<?php else: ?>
<input type="text" id="pageTitle" name="pageTitle" value="" placeholder="{locale:page_title}" maxlength="250" />
<textarea name="pageContent"></textarea>
<input type="text" id="pageSlug" name="pageSlug" value="" placeholder="{locale:page_slug}" />
<input type="hidden" name="pageAdd" value="true" />
<?php endif ?>
<button type="submit">{locale:save}</button>
<?php
if (isset($_POST['pageContent']) && isset($_POST['pageSlug']) && $user['userLevel'] > 3)
{
$page = new page($_POST['pageSlug']);
if (isset($_POST['pageAdd']))
{
if ($page->create($_POST['pageTitle'], $_POST['pageContent']))
array_push($info, $_locale['page_added']);
else
array_push($error, $_locale['page_not_added']);
} elseif (isset($_POST['pageUpdate']))
{
if ($page->update($_POST['pageTitle'], $_POST['pageContent']))
array_push($info, $_locale['page_updated']);
else
array_push($error, $_locale['page_not_updated']);
}
}
if (isset($_POST['page_delete']))
{
$page = new page($_POST['page_delete']);
if ($page -> delete()) array_push($info, $_locale['page_deleted']);
else array_push($error, $_locale['page_delete_failed']);
}
if (isset($seo[2]))
$page = new page($seo[2]);
else
{
$pagesQuery = $_sql->query("SELECT pageSlug, pageTitle, pageCreated, pageModified, pageDeleted FROM pages ORDER BY pageDeleted ASC, pageTitle ASC");
if ($pagesQuery->num_rows)
{
echo "<h1>{locale:pages}</h1>";
echo "<form action='".get_current_link()."' method='post' name='page-delete'>";
echo "<table class='designed pages'><thead><tr><th>{locale:page_title}</th><th>{locale:page_modified}</th><th>{locale:page_delete}</th></tr></thead><tbody>";
while ($data = $pagesQuery->fetch_assoc())
echo "<tr><td><a href='/admin/page/$data[pageSlug]'>$data[pageTitle]</a></td><td>".date($_set['dateformat'], $data['pageModified'] > $data['pageCreated'] ? $data['pageModified'] : $data['pageCreated'])."</td><td>".($data['pageDeleted'] ? date($_set['dateformat'], $data['pageDeleted']) : "<button type='submit' name='page_delete' value='$data[pageSlug]'>{locale:delete}</button>")."</td></tr>";
echo "</tbody></table>";
echo "</form>";
}
}
?>
<h1>{locale:page_editor}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<?php if (isset($page->data)) : addTitle($page->data['pageTitle']); ?>
<input type="text" name="pageTitle" value="<?=$page->data['pageTitle']?>" placeholder="{locale:page_title}" maxlength="250" />
<textarea name="pageContent"><?=htmlspecialchars($page->data['pageContent'])?></textarea>
<input type="hidden" name="pageSlug" value="<?=$page->data['pageSlug']?>" />
<input type="hidden" name="pageUpdate" value="true" />
<button type="button" onclick="window.location.href='/admin/page'">{locale:cancel}</button>
<?php else: ?>
<input type="text" id="pageTitle" name="pageTitle" value="" placeholder="{locale:page_title}" maxlength="250" />
<textarea name="pageContent"></textarea>
<input type="text" id="pageSlug" name="pageSlug" value="" placeholder="{locale:page_slug}" />
<input type="hidden" name="pageAdd" value="true" />
<?php endif ?>
<button type="submit">{locale:save}</button>
</form>

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);
}

View File

@ -0,0 +1,47 @@
<?php
if (isset($_POST['save_settings']))
{
$fail = false;
$settings = new settings();
foreach ($_POST AS $var => $val)
if (substr($var, 0, 13) == 'settings_var_')
{
$var = substr($var, 13, strlen($var) - 13);
if (isset($_set[$var]) && $_set[$var] != $val)
if (!$settings -> update($var, $val))
$fail = true;
}
if ($fail) array_push($error, $_locale['settings_update_failed']);
else array_push($info, $_locale['settings_updated']);
unset($fail);
unset($var);
unset($settings);
}
$_set_settings = settings::getdata();
?>
<h1>{locale:site_settings}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<table class="designed settings">
<thead>
<tr>
<th>{locale:settings_variable}</th>
<th>{locale:settings_value}</th>
</tr>
</thead>
<tbody>
<?php foreach ($_set_settings AS $var => $val): ?>
<tr>
<td>{locale:settings_var_<?=$var?>}</td>
<td><input type="text" name="settings_var_<?=$var?>" value="<?=htmlentities($val)?>" /></td>
</tr>
<?php endforeach; unset($_set_settings); ?>
</tbody>
</table>
<button type="submit" name="save_settings" value="1">{locale:settings_save}</button>
</form>