Esempio n. 1
0
 /**
  * Get current session infos
  * 
  * @return array : the user session infos
  * @access public
  * @static
  */
 public static function getSessionInfos()
 {
     $sessionInfos = array();
     $user = CMS_session::getUser();
     if (!$user) {
         return array();
     }
     $sessionInfos['fullname'] = $user->getFullName();
     $sessionInfos['userId'] = $user->getUserId();
     $sessionInfos['language'] = $user->getLanguage()->getCode();
     $sessionInfos['scriptsInProgress'] = CMS_scriptsManager::getScriptsNumberLeft();
     $sessionInfos['hasValidations'] = $user->hasValidationClearance();
     $sessionInfos['awaitingValidation'] = CMS_modulesCatalog::getValidationsCount($user);
     $sessionInfos['applicationLabel'] = APPLICATION_LABEL;
     $sessionInfos['applicationVersion'] = AUTOMNE_VERSION;
     $sessionInfos['systemLabel'] = CMS_grandFather::SYSTEM_LABEL;
     $sessionInfos['token'] = CMS_session::getToken('admin');
     $sessionInfos['sessionDuration'] = APPLICATION_SESSION_TIMEOUT;
     $sessionInfos['permanent'] = CMS_session::getPermanent();
     $sessionInfos['path'] = PATH_REALROOT_WR;
     $sessionInfos['debug'] = '';
     $sessionInfos['debug'] += SYSTEM_DEBUG ? 1 : 0;
     $sessionInfos['debug'] += STATS_DEBUG ? 2 : 0;
     $sessionInfos['debug'] += POLYMOD_DEBUG ? 4 : 0;
     $sessionInfos['debug'] += VIEW_SQL ? 8 : 0;
     return $sessionInfos;
 }
Esempio n. 2
0
    /**
     * Writes html header
     *
     * @return void
     * @access private
     */
    private function _showHead($returnValue = false)
    {
        switch ($this->_displayMode) {
            case self::SHOW_JSON:
            case self::SHOW_RAW:
            case self::SHOW_XML:
                $return = '';
                if ($this->hasErrors()) {
                    $return .= '	<error>1</error>' . "\n" . '	<errormessage><![CDATA[' . $this->_espaceCdata($this->getErrors(true)) . ']]></errormessage>' . "\n";
                } else {
                    $return .= '	<error>0</error>' . "\n";
                }
                if ($this->_secure && CMS_session::tokenIsExpired('admin')) {
                    $token = CMS_session::getToken('admin');
                    //pr('new token : '.$token);
                    $return .= '	<token><![CDATA[' . $token . ']]></token>' . "\n";
                }
                if ($this->hasRawDatas()) {
                    $return .= '	<rawdatas><![CDATA[' . $this->_espaceCdata($this->getRawDatas(true)) . ']]></rawdatas>' . "\n";
                }
                if ($this->_actionmessage) {
                    $return .= '	<message><![CDATA[' . $this->_espaceCdata($this->_actionmessage) . ']]></message>' . "\n";
                }
                if ($this->_title) {
                    $return .= '	<title><![CDATA[' . $this->_espaceCdata($this->_title) . ']]></title>' . "\n";
                }
                if ($this->_disconnected) {
                    $return .= '	<disconnected>1</disconnected>' . "\n";
                }
                $scripts = CMS_scriptsManager::getScriptsNumberLeft();
                if ($scripts) {
                    $return .= '	<scripts>' . $scripts . '</scripts>' . "\n";
                }
                if (SYSTEM_DEBUG && STATS_DEBUG) {
                    $return .= '	<stats><![CDATA[' . $this->_espaceCdata(CMS_stats::view(true)) . ']]></stats>' . "\n";
                }
                $jsfiles = CMS_view::getJavascript(array(), 'screen', true);
                if ($jsfiles) {
                    $files = array('files' => $jsfiles, 'manager' => CMS_view::getJSManagerURL());
                    $return .= '	<jsfiles><![CDATA[' . $this->_espaceCdata(sensitiveIO::jsonEncode($files)) . ']]></jsfiles>' . "\n";
                }
                $cssfiles = CMS_view::getCSS(array(), 'screen', true);
                if ($cssfiles) {
                    $files = array('files' => $cssfiles, 'manager' => CMS_view::getCSSManagerURL());
                    $return .= '	<cssfiles><![CDATA[' . $this->_espaceCdata(sensitiveIO::jsonEncode($files)) . ']]></cssfiles>' . "\n";
                }
                if (!$returnValue) {
                    echo $return;
                } else {
                    return $return;
                }
                break;
            case self::SHOW_HTML:
            default:
                $title = $this->_title ? '<title>' . APPLICATION_LABEL . ' :: ' . $this->_title . '</title>' : '';
                echo '<head>
						<meta http-equiv="Content-Type" content="text/html; charset=' . APPLICATION_DEFAULT_ENCODING . '" />
						' . $title . '
						' . $this->_copyright() . '
						<meta name="generator" content="' . CMS_grandFather::SYSTEM_LABEL . '" />
						' . CMS_view::getCSS() . '
						' . CMS_view::getJavascript();
                if (APPLICATION_GCF_SUPPORT) {
                    echo '<meta http-equiv="X-UA-Compatible" content="chrome=1">';
                }
                echo '</head>';
                break;
        }
    }