Example #1
0
/**
 * @param App $a
 */
function admin_post(&$a)
{
    if (!is_site_admin()) {
        return;
    }
    // do not allow a page manager to access the admin panel at all.
    if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
        return;
    }
    // urls
    if ($a->argc > 1) {
        switch ($a->argv[1]) {
            case 'site':
                admin_page_site_post($a);
                break;
            case 'users':
                admin_page_users_post($a);
                break;
            case 'plugins':
                if ($a->argc > 2 && is_file("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php")) {
                    @(include_once "addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php");
                    if (function_exists($a->argv[2] . '_plugin_admin_post')) {
                        $func = $a->argv[2] . '_plugin_admin_post';
                        $func($a);
                    }
                }
                goaway($a->get_baseurl(true) . '/admin/plugins/' . $a->argv[2]);
                return;
                // NOTREACHED
                break;
            case 'themes':
                $theme = $a->argv[2];
                if (is_file("view/theme/{$theme}/config.php")) {
                    require_once "view/theme/{$theme}/config.php";
                    if (function_exists("theme_admin_post")) {
                        theme_admin_post($a);
                    }
                }
                info(t('Theme settings updated.'));
                if (is_ajax()) {
                    return;
                }
                goaway($a->get_baseurl(true) . '/admin/themes/' . $theme);
                return;
                break;
            case 'logs':
                admin_page_logs_post($a);
                break;
            case 'dbsync':
                admin_page_dbsync_post($a);
                break;
            case 'update':
                admin_page_remoteupdate_post($a);
                break;
        }
    }
    goaway($a->get_baseurl(true) . '/admin');
    return;
    // NOTREACHED
}
Example #2
0
/**
 * @param App &$a
 */
function admin_post(&$a)
{
    logger('admin_post', LOGGER_DEBUG);
    if (!is_site_admin()) {
        return;
    }
    // urls
    if (argc() > 1) {
        switch (argv(1)) {
            case 'site':
                admin_page_site_post($a);
                break;
            case 'users':
                admin_page_users_post($a);
                break;
            case 'channels':
                admin_page_channels_post($a);
                break;
            case 'plugins':
                if (argc() > 2 && is_file("addon/" . argv(2) . "/" . argv(2) . ".php")) {
                    @(include_once "addon/" . argv(2) . "/" . argv(2) . ".php");
                    if (function_exists(argv(2) . '_plugin_admin_post')) {
                        $func = argv(2) . '_plugin_admin_post';
                        $func($a);
                    }
                }
                goaway($a->get_baseurl(true) . '/admin/plugins/' . argv(2));
                break;
            case 'themes':
                $theme = argv(2);
                if (is_file("view/theme/{$theme}/php/config.php")) {
                    require_once "view/theme/{$theme}/php/config.php";
                    // fixme add parent theme if derived
                    if (function_exists("theme_admin_post")) {
                        theme_admin_post($a);
                    }
                }
                info(t('Theme settings updated.'));
                if (is_ajax()) {
                    return;
                }
                goaway($a->get_baseurl(true) . '/admin/themes/' . $theme);
                break;
            case 'logs':
                admin_page_logs_post($a);
                break;
            case 'hubloc':
                admin_page_hubloc_post($a);
                break;
            case 'dbsync':
                admin_page_dbsync_post($a);
                break;
            case 'profs':
                admin_page_profs_post($a);
                break;
        }
    }
    goaway($a->get_baseurl(true) . '/admin');
}
Example #3
0
 function post()
 {
     $theme = argv(2);
     if (is_file("view/theme/{$theme}/php/config.php")) {
         require_once "view/theme/{$theme}/php/config.php";
         // fixme add parent theme if derived
         if (function_exists("theme_admin_post")) {
             theme_admin_post($a);
         }
     }
     info(t('Theme settings updated.'));
     if (is_ajax()) {
         return;
     }
     goaway(z_root() . '/admin/themes/' . $theme);
 }
Example #4
0
 function __call_theme_admin_post(&$a, $theme)
 {
     $orig_theme = $a->theme;
     $orig_page = $a->page;
     $orig_session_theme = $_SESSION['theme'];
     require_once "view/theme/{$theme}/theme.php";
     require_once "view/theme/{$theme}/config.php";
     $_SESSION['theme'] = $theme;
     $init = $theme . "_init";
     if (function_exists($init)) {
         $init($a);
     }
     if (function_exists("theme_admin_post")) {
         $admin_form = theme_admin_post($a);
     }
     $_SESSION['theme'] = $orig_session_theme;
     $a->theme = $orig_theme;
     $a->page = $orig_page;
     return $admin_form;
 }
Example #5
0
 function post()
 {
     logger('admin_post', LOGGER_DEBUG);
     if (!is_site_admin()) {
         return;
     }
     // urls
     if (argc() > 1) {
         switch (argv(1)) {
             case 'site':
                 $this->admin_page_site_post($a);
                 break;
             case 'users':
                 $this->admin_page_users_post($a);
                 break;
             case 'channels':
                 $this->admin_page_channels_post($a);
                 break;
             case 'plugins':
                 if (argc() > 2 && argv(2) === 'addrepo') {
                     $this->admin_page_plugins_post('addrepo');
                     break;
                 }
                 if (argc() > 2 && argv(2) === 'installrepo') {
                     $this->admin_page_plugins_post('installrepo');
                     break;
                 }
                 if (argc() > 2 && argv(2) === 'removerepo') {
                     $this->admin_page_plugins_post('removerepo');
                     break;
                 }
                 if (argc() > 2 && argv(2) === 'updaterepo') {
                     $this->admin_page_plugins_post('updaterepo');
                     break;
                 }
                 if (argc() > 2 && is_file("addon/" . argv(2) . "/" . argv(2) . ".php")) {
                     @(include_once "addon/" . argv(2) . "/" . argv(2) . ".php");
                     if (function_exists(argv(2) . '_plugin_admin_post')) {
                         $func = argv(2) . '_plugin_admin_post';
                         $func($a);
                     }
                 }
                 goaway(z_root() . '/admin/plugins/' . argv(2));
                 break;
             case 'themes':
                 $theme = argv(2);
                 if (is_file("view/theme/{$theme}/php/config.php")) {
                     require_once "view/theme/{$theme}/php/config.php";
                     // fixme add parent theme if derived
                     if (function_exists("theme_admin_post")) {
                         theme_admin_post($a);
                     }
                 }
                 info(t('Theme settings updated.'));
                 if (is_ajax()) {
                     return;
                 }
                 goaway(z_root() . '/admin/themes/' . $theme);
                 break;
             case 'logs':
                 $this->admin_page_logs_post($a);
                 break;
             case 'hubloc':
                 $this->admin_page_hubloc_post($a);
                 break;
             case 'security':
                 $this->admin_page_security_post($a);
                 break;
             case 'features':
                 $this->admin_page_features_post($a);
                 break;
             case 'dbsync':
                 $this->admin_page_dbsync_post($a);
                 break;
             case 'profs':
                 $this->admin_page_profs_post($a);
                 break;
         }
     }
     goaway(z_root() . '/admin');
 }