Example #1
0
/**
 * main function. checks for authorization and renders the
 * required admin section.
 */
function admin_main($authorised)
{
    echo "\n<div id=\"channel_admin\" class=\"frame\">";
    if ($authorised) {
        admin_menu();
        if (array_key_exists(CST_ADMIN_DOMAIN, $_REQUEST)) {
            switch ($_REQUEST[CST_ADMIN_DOMAIN]) {
                case CST_ADMIN_DOMAIN_FOLDER:
                    $show = folder_admin();
                    break;
                case CST_ADMIN_DOMAIN_CHANNEL:
                    $show = channel_admin();
                    break;
                case CST_ADMIN_DOMAIN_CONFIG:
                    $show = config_admin();
                    break;
                case CST_ADMIN_DOMAIN_ITEM:
                    $show = item_admin();
                    break;
                case CST_ADMIN_DOMAIN_PLUGINS:
                    $show = plugins_admin();
                    break;
                case CST_ADMIN_DOMAIN_THEMES:
                    $show = themes_admin();
                    break;
                case CST_ADMIN_DOMAIN_TAGS:
                    $show = tags_admin();
                    break;
                case CST_ADMIN_DOMAIN_PLUGIN_OPTIONS:
                    $show = plugin_options_admin();
                    break;
                case CST_ADMIN_DOMAIN_THEME_OPTIONS:
                    $show = theme_options_admin();
                    break;
                default:
                    break;
            }
        }
        if (array_key_exists(CST_ADMIN_VIEW, $_REQUEST) || isset($show)) {
            if (!isset($show)) {
                $show = $_REQUEST[CST_ADMIN_VIEW];
            }
            switch ($show) {
                case CST_ADMIN_DOMAIN_CONFIG:
                    config();
                    break;
                case CST_ADMIN_DOMAIN_CHANNEL:
                    channels();
                    break;
                case CST_ADMIN_DOMAIN_FOLDER:
                    folders();
                    break;
                case CST_ADMIN_DOMAIN_OPML:
                    opml();
                    break;
                case CST_ADMIN_DOMAIN_NONE:
                    break;
                case CST_ADMIN_DOMAIN_ITEM:
                    items();
                    break;
                case CST_ADMIN_DOMAIN_SYSINFO:
                    sysinfo();
                    break;
                case CST_ADMIN_DOMAIN_DASHBOARD:
                    dashboard();
                    break;
                case CST_ADMIN_DOMAIN_PLUGINS:
                    plugins();
                    break;
                case CST_ADMIN_DOMAIN_THEMES:
                    themes();
                    break;
                case CST_ADMIN_DOMAIN_TAGS:
                    tags();
                    break;
                case CST_ADMIN_DOMAIN_PLUGIN_OPTIONS:
                    plugin_options();
                    break;
                case CST_ADMIN_DOMAIN_THEME_OPTIONS:
                    theme_options();
                    break;
                default:
            }
        } else {
            if (true == getConfig('rss.config.defaultdashboard')) {
                dashboard();
            } else {
                channels();
            }
        }
        echo "\n<div class=\"clearer\"></div>\n";
    } else {
        rss_error(sprintf(__('<h1>Not Authorized!</h1>You are not authorized to access the administration interface. Please follow <a href="%s">this link</a> back to the main page. Have  a nice day!'), getPath()), RSS_ERROR_ERROR, true);
    }
    echo "</div>\n";
}
Example #2
0
         json($episode[0], true);
     }
 });
 $app->get('/episodes/label/:label', function ($label) use($app) {
     $exclude = $app->request->params('exclude');
     if ($exclude != null) {
         json($app->db->get_episodes(null, $label, null, null, $exclude), true);
     } else {
         json($app->db->get_episodes(null, $label), true);
     }
 });
 $app->get('/casts', function () use($app) {
     json($app->db->get_casts(), true);
 });
 $app->get('/casts.opml', function () use($app) {
     opml($app->db->get_label(), $app->db->get_casts());
 });
 $app->post('/casts.opml', function () use($app) {
     set_time_limit(0);
     $opml = $app->request->params('opml');
     $opml = simplexml_load_string($opml);
     $app->db->import_opml($opml->body);
 });
 $app->post('/casts', function () use($app) {
     $feedurl = $app->request->params('feedurl');
     $name = $app->request->params('name');
     json($app->db->subscribe_to($feedurl, $name, null, true));
 });
 $app->put('/casts/:id', function ($id) use($app) {
     $name = $app->request->params('name');
     $dbh = $GLOBALS['dbh'];