Example #1
0
    unset($_SESSION['cms_admin_user_id']);
    unset($_SESSION[CMS_USER_KEY]);
    cms_cookies::erase('cms_admin_user_id');
    cms_cookies::erase('cms_passhash');
    cms_cookies::erase(CMS_SECURE_PARAM_NAME);
} else {
    if (isset($_SESSION['redirect_url'])) {
        $_SESSION["t_redirect_url"] = $_SESSION["redirect_url"];
        $no_redirect = true;
        $is_logged_in = check_login($no_redirect);
        $_SESSION["redirect_url"] = $_SESSION["t_redirect_url"];
        unset($_SESSION["t_redirect_url"]);
        if (true == $is_logged_in) {
            $userid = get_userid();
            $homepage = get_preference($userid, 'homepage' . 'index.php');
            $homepage = CmsAdminUtils::get_session_url($homepage);
            $homepage = str_replace('&', '&', $homepage);
            $tmp = explode('?', $homepage);
            if (!file_exists($tmp[0])) {
                $tmp[0] = 'index.php';
            }
            $tmp2 = array();
            if (isset($tmp[1])) {
                parse_str($tmp[1], $tmp2);
                if (in_array('_s_', array_keys($tmp2))) {
                    unset($tmp2['_s_']);
                }
                if (in_array('sp_', array_keys($tmp2))) {
                    unset($tmp2['sp_']);
                }
            }
 /**
  * Return an array of admin pages, suitable for use in a dropdown.
  *
  * @internal
  * @since 1.12
  * @param bool $none A flag indicating wether 'none' should be the first option.
  * @return array The keys of the array are langified strings to display to the user.  The values are URLS.
  */
 public function GetAdminPages($none = TRUE)
 {
     $opts = array();
     if ($none) {
         $opts[ucfirst(lang('none'))] = '';
     }
     $depth = 0;
     $menuItems = $this->get_admin_navigation();
     foreach ($menuItems as $sectionKey => $menuItem) {
         if ($menuItem['parent'] != -1) {
             continue;
         }
         // only parent pages
         if (!$menuItem['show_in_menu'] || strlen($menuItem['url']) < 1) {
             continue;
         }
         // only visible stuff
         $opts[$menuItem['title']] = CmsAdminUtils::get_generic_url($menuItem['url']);
         if (is_array($menuItem['children']) && count($menuItem['children'])) {
             foreach ($menuItem['children'] as $thisChild) {
                 if ($thisChild == 'home' || $thisChild == 'logout' || $thisChild == 'viewsite') {
                     continue;
                 }
                 $menuChild = $menuItems[$thisChild];
                 if (!$menuChild['show_in_menu'] || strlen($menuChild['url']) < 1) {
                     continue;
                 }
                 //$opts['&nbsp;&nbsp;'.$menuChild['title']] = cms_htmlentities($menuChild['url']);
                 $url = $menuChild['url'];
                 $url = CmsAdminUtils::get_generic_url($url);
                 $opts['&nbsp;&nbsp;' . $menuChild['title']] = $url;
             }
         }
     }
     return $opts;
 }