insanelyBlog/index.php

102 lines
1.9 KiB
PHP

<?php
require_once 'core.php';
ob_start();
switch ($seo[0])
{
case 'rss':
include 'includes/rss.php';
exit;
break;
case $_set['subEntry']:
if (isset($_POST['read_entry_pin']) && is_numeric($_POST['read_entry_pin'])) set_pin($_POST['read_entry_pin']);
include 'includes/main/entry.php';
break;
case $_set['subPage']:
include 'includes/main/page.php';
break;
case $_set['subProfile']:
if (!isset($seo[1])) redirect();
include 'includes/main/profile.php';
break;
case 'tag':
include 'includes/main/tag.php';
break;
case 'login':
include 'includes/main/login.php';
break;
case 'admin':
if (LOGGEDIN && $user['userLevel'] > 1)
include 'includes/admin/main.php';
else
redirect();
break;
case 'p':
include 'includes/main/entries.php';
break;
case 'filtrToken':
if (isset($seo[1]))
setcookie('filtr_token', $seo[1], time()+3600*24*31, '/');
redirect();
break;
default:
include 'includes/main/entries.php';
break;
}
// COLLECT OUTPUT
$output = ob_get_contents();
ob_end_clean();
// PLUGINS
$pluginsQuery = $_sql->query("SELECT pluginLib, pluginStatus FROM plugins WHERE pluginStatus = 1");
while ($data = $pluginsQuery->fetch_assoc())
{
$pinfo = 'plugins/'.$data['pluginLib'].'/info.json';
$pexec = 'plugins/'.$data['pluginLib'].'/_plugin.php';
if (file_exists($pinfo) && file_exists($pexec))
{
$pinfo = (array)json_decode(file_get_contents($pinfo));
$cpath = explode(',', $pinfo['paths']);
for ($a = 0; $a < sizeof($cpath); $a++)
{
$ppath = explode('/', ltrim($cpath[$a], '/'));
$load = true;
for ($i = 0; $i < sizeof($ppath); $i++)
if (isset($seo[$i]) && $seo[$i] == $ppath[$i] && $load)
$load = true;
else
$load = false;
if ($load)
include $pexec;
}
unset($i);
unset($a);
unset($pinfo);
unset($load);
unset($pexec);
unset($ppath);
unset($cpath);
}
}
// LOAD THEME
if (get_theme())
include get_theme();
else
nice_error('The theme is not complete.');