Changeset 11850

Show
Ignore:
Timestamp:
08/30/07 11:32:35 (1 year ago)
Author:
bergie
Message:

Remove some unnecessary logging and legacy AIS code, refs #102

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.core/midcom/application.php

    r11816 r11850  
    464464        // Initialize Root Topic 
    465465        $root_topic = new midcom_db_topic($GLOBALS['midcom_config']['midcom_root_topic_guid']); 
    466         if (! $root_topic) 
     466        if (   ! $root_topic 
     467            || !$root_topic->guid) 
    467468        { 
    468469            if (mgd_errno() == MGD_ERR_ACCESS_DENIED) 
     
    522523     * @see midcom_application::_process() 
    523524     */ 
    524     function codeinit() { 
    525         debug_push("midcom_application::codeinit"); 
    526  
     525    function codeinit()  
     526    { 
    527527        $oldcontext = $this->_currentcontext; 
    528528        $this->_currentcontext = 0; 
     
    531531        $this->uimessages->initialize(); 
    532532 
    533         debug_add("Creating URL Parser with argc/v from global Environment", MIDCOM_LOG_DEBUG); 
    534533        $topic = $this->get_context_data(MIDCOM_CONTEXT_ROOTTOPIC); 
    535534        $this->_parser = new midcom_helper_urlparser($topic->id); 
    536535 
    537         if (!$this->_parser) { 
    538             debug_add("URL Parser is not instantinated, Bailing out.", MIDCOM_LOG_ERROR); 
     536        if (!$this->_parser)  
     537        { 
     538            debug_push_class(__CLASS__, __FUNCTION__); 
     539            debug_add('URL Parser is not instantinated, bailing out.', MIDCOM_LOG_ERROR); 
    539540            debug_pop(); 
    540             $this->generate_error(MIDCOM_ERRCRIT,$GLOBALS["midcom_errstr"]); 
    541         } 
    542  
    543         debug_print_r ("ARGC = {$GLOBALS['argc']}; ARGV =", $GLOBALS["argv"]); 
     541            $this->generate_error(MIDCOM_ERRCRIT, $GLOBALS['midcom_errstr']); 
     542        } 
    544543 
    545544        $this->_process(); 
     
    551550        // Let metadata service add its meta tags 
    552551        $this->metadata->populate_meta_head(); 
    553  
    554         debug_add("code-init finished", MIDCOM_LOG_INFO); 
    555         debug_pop(); 
    556552    } 
    557553 
     
    562558     * Style template, usually <(content)>. 
    563559     */ 
    564     function content() { 
    565         debug_push("midcom_application::content"); 
     560    function content()  
     561    { 
     562        debug_push_class(__CLASS__, __FUNCTION__);     
    566563 
    567564        // Enter Context 
    568         debug_add("Entering Context 0 (old Context: $this->_currentcontext)", MIDCOM_LOG_DEBUG); 
     565        debug_add("Entering Context 0 (old Context: {$this->_currentcontext})", MIDCOM_LOG_DEBUG); 
    569566        $oldcontext = $this->_currentcontext; 
    570567        $this->_currentcontext = 0; 
     
    574571 
    575572        // Leave Context 
    576         debug_add("Leaving Context 0 (new Context: $oldcontext)", MIDCOM_LOG_DEBUG); 
     573        debug_add("Leaving Context 0 (new Context: {$oldcontext})", MIDCOM_LOG_DEBUG); 
    577574        $this->style->leave_context(); 
    578575        $this->_currentcontext = $oldcontext; 
     
    661658     * @param string $url                The URL, relative to the Midgard Page, that is to be requested. 
    662659     * @param Array $config                A key=>value array with any configuration overrides. 
    663      * @param int $type                    Any one of the MIDCOM_REQUEST_* constants (used for AIS only). 
    664      * @param int $topicid                The ID of the content root topic (used for AIS only). 
    665      * @param string $urlparser_prefix    The Prefix for the URL parser to use (used for AIS only). 
    666660     * @return int                        The ID of the newly created context. 
    667661     */ 
    668     function dynamic_load($url, $config = array(), $type = MIDCOM_REQUEST_CONTENT, $topicid = null, $urlparser_prefix = null) { 
    669         global $midcom_errstr; 
    670  
     662    function dynamic_load($url, $config = array(), $type = MIDCOM_REQUEST_CONTENT)  
     663    { 
    671664        debug_push_class(__CLASS__, __FUNCTION__); 
    672665 
    673666        debug_add("Dynamic load of URL {$url}", MIDCOM_LOG_INFO); 
    674         debug_add("Request Type is {$type}, optional Root Topic ID is {$topicid}"); 
    675667 
    676668        if (substr($url, -5) == '.html') 
     
    683675        { 
    684676            debug_add("dynamic_load content request called before content output phase. Aborting.", MIDCOM_LOG_ERROR); 
     677            debug_pop(); 
    685678            $this->generate_error(MIDCOM_ERRCRIT, "dynamic_load content request called before content output phase."); 
    686         } 
    687  
    688         if (!is_null($topicid) && is_null($urlparser_prefix)) 
    689         { 
    690             $urlparser_prefix = $this->get_component_context(MIDCOM_CONTEXT_ANCHORPREFIX); 
     679            // This will exit 
    691680        } 
    692681 
    693682        // Determine new Context ID and set $this->_currentcontext, 
    694683        // enter that context and prepare its data structure. 
    695  
    696684        $context = $this->_create_context(); 
    697685        $oldcontext = $this->_currentcontext; 
     
    701689        $this->_context[$context][MIDCOM_CONTEXT_CONTENTTOPIC] = null; 
    702690        $this->_context[$context][MIDCOM_CONTEXT_COMPONENT] = null; 
    703         if (is_null($topicid)) 
    704         { 
    705             $this->_context[$context][MIDCOM_CONTEXT_ROOTTOPIC] = $this->_context[0][MIDCOM_CONTEXT_ROOTTOPIC]; 
    706         } 
    707         else 
    708         { 
    709             $this->_context[$context][MIDCOM_CONTEXT_ROOTTOPIC] = new midcom_db_topic($topicid); 
    710         } 
     691        $this->_context[$context][MIDCOM_CONTEXT_ROOTTOPIC] = $this->_context[0][MIDCOM_CONTEXT_ROOTTOPIC]; 
    711692        $this->_context[$context][MIDCOM_CONTEXT_OUTPUT] = null; 
    712693        $this->_context[$context][MIDCOM_CONTEXT_NAP] = null; 
     
    734715        } 
    735716 
    736         if (is_null($topicid)) 
    737         { 
    738             $topic = $this->get_context_data(MIDCOM_CONTEXT_ROOTTOPIC); 
    739             $this->_parser = new midcom_helper_urlparser($topic->id, $argv); 
    740         } 
    741         else 
    742         { 
    743             $this->_parser = new midcom_helper_urlparser($topicid, $argv, $urlparser_prefix); 
    744         } 
    745  
     717        $topic = $this->get_context_data(MIDCOM_CONTEXT_ROOTTOPIC); 
     718        $this->_parser = new midcom_helper_urlparser($topic->id, $argv); 
    746719 
    747720        if (!$this->_parser) 
     
    749722            debug_add("URL Parser could not be instantinated: $midcom_errstr", MIDCOM_LOG_ERROR); 
    750723            debug_pop(); 
    751             $this->generate_error(MIDCOM_ERRCRIT, "URL Parser could not be instantinated: $midcom_errstr"); 
     724            $this->generate_error(MIDCOM_ERRCRIT, "URL Parser could not be instantinated: {$GLOBALS['midcom_errstr']}"); 
    752725        } 
    753726 
  • trunk/midcom/midcom.core/midcom/services/auth/backend/simple.php

    r3766 r11850  
    4040    function midcom_services_auth_backend_simple () 
    4141    { 
    42         debug_push_class(__CLASS__, __FUNCTION__)
     42        $this->_cookie_id .= $GLOBALS['midcom_config']['auth_backend_simple_cookie_id']
    4343 
    44         $this->_cookie_id .= $GLOBALS['midcom_config']['auth_backend_simple_cookie_id']; 
    45         debug_add("We have to use this cookie id: {$this->_cookie_id}"); 
    46  
    47         debug_pop(); 
    4844        return parent::midcom_services_auth_backend(); 
    4945    } 
     
    5147    function read_login_session() 
    5248    { 
    53         debug_push_class(__CLASS__, __FUNCTION__); 
    54  
    55         debug_print_r('Checking this Cookie Array:', $_COOKIE); 
    56  
    5749        if (! array_key_exists($this->_cookie_id, $_COOKIE)) 
    5850        { 
     51            debug_push_class(__CLASS__, __FUNCTION__); 
    5952            debug_add('There is no cookie, we cannot read the login session.'); 
    6053            debug_pop(); 
     
    6558        if (count($data) != 2) 
    6659        { 
     60            debug_push_class(__CLASS__, __FUNCTION__);         
    6761            debug_add("The cookie data could not be parsed, assuming tampered session.", 
    6862                MIDCOM_LOG_ERROR); 
    69             debug_add('Killing the cookie...'); 
     63            debug_add('Killing the cookie...', MIDCOM_LOG_INFO); 
    7064            $this->_delete_cookie(); 
    7165            debug_pop(); 
     
    7670        $user_id = $data[1]; 
    7771 
    78         debug_add("Extracted the user ID {$user_id} and the session ID {$session_id}."); 
    7972        $this->user =& $_MIDCOM->auth->get_user($user_id); 
    8073 
    8174        if (! $this->user) 
    8275        { 
     76            debug_push_class(__CLASS__, __FUNCTION__);         
    8377            debug_add("The user ID {$user_id} is invalid, could not load the user from the database, assuming tampered session.", 
    8478                MIDCOM_LOG_ERROR); 
     
    9387        if (! $this->session_id) 
    9488        { 
     89            debug_push_class(__CLASS__, __FUNCTION__);         
    9590            debug_add("The session {$this->session_id} is invalid (usually this means an expired session).", 
    9691                MIDCOM_LOG_ERROR); 
     
    10196        } 
    10297 
    103         debug_pop(); 
    10498        return true; 
    10599    } 
  • trunk/midcom/midcom.core/midcom/services/cache.php

    r11359 r11850  
    8080        foreach ($GLOBALS['midcom_config']['cache_autoload_queue'] as $name) 
    8181        { 
    82             debug_add("Auto-Loading module {$name}", MIDCOM_LOG_INFO); 
     82            debug_add("Auto-Loading module {$name}", MIDCOM_LOG_DEBUG); 
    8383            $this->load_module($name); 
    8484        } 
  • trunk/midcom/midcom.core/midcom/services/i18n.php

    r6090 r11850  
    505505     */ 
    506506    function _set_startup_langs() 
    507     { 
    508         debug_push("midcom_services_i18n::_set_startup_langs"); 
    509          
     507    {         
    510508        $this->_current_content_language_midgard = $_MIDGARD['lang']; 
    511509 
     
    513511        if (!is_null ($this->_cookie_data)) 
    514512        { 
    515             $this->_current_language = $this->_cookie_data["language"]; 
    516             $this->_current_charset = $this->_cookie_data["charset"]; 
    517             debug_add("Set current language to " . $this->_current_language . " with charset " . $this->_current_charset . " (cookie)", MIDCOM_LOG_INFO); 
     513            $this->_current_language = $this->_cookie_data['language']; 
     514            $this->_current_charset = $this->_cookie_data['charset']; 
     515            debug_push_class(__CLASS__, __FUNCTION__); 
     516            debug_add("Set current language to {$this->_current_language} with charset {$this->_current_charset} (source: cookie)", MIDCOM_LOG_INFO); 
    518517            debug_pop(); 
    519518            return; 
     
    525524        { 
    526525            $this->_current_language = $content_language; 
    527             debug_add("Set current language to " . $this->_current_language . " with charset (Midgard host language)", MIDCOM_LOG_INFO); 
     526            debug_push_class(__CLASS__, __FUNCTION__); 
     527            debug_add("Set current language to {$this->_current_language} (source: Midgard host language)", MIDCOM_LOG_INFO); 
    528528            debug_pop(); 
    529529            return;   
     
    542542            } 
    543543        } 
    544         debug_add("Set current language to " . $this->_current_language . " with charset " . $this->_current_charset. " (HTTP)", MIDCOM_LOG_INFO); 
     544        debug_push_class(__CLASS__, __FUNCTION__); 
     545        debug_add("Set current language to {$this->_current_language} with charset {$this->_current_charset} (Source: HTTP)", MIDCOM_LOG_INFO); 
    545546        debug_pop(); 
    546547    } 
     
    552553    function _read_cookie () 
    553554    { 
    554         debug_push("midcom_services_i18n::_read_cookie"); 
    555  
    556555        if (!isset ($_COOKIE)) 
    557556        { 
    558             debug_add("No Cookies found at all.", MIDCOM_LOG_DEBUG); 
    559             debug_pop(); 
    560557            return; 
    561558        } 
     
    563560        if (!array_key_exists("midcom_services_i18n",$_COOKIE)) 
    564561        { 
    565             debug_add("No midcom_services_i18n Cookie on this site", MIDCOM_LOG_DEBUG); 
    566             debug_pop(); 
    567562            return; 
    568563        } 
    569564 
    570         $rawdata = base64_decode($_COOKIE["midcom_services_i18n"]); 
     565        $rawdata = base64_decode($_COOKIE['midcom_services_i18n']); 
    571566        $array = unserialize($rawdata); 
    572567 
    573         if (! array_key_exists("language",$array) || ! array_key_exists("charset",$array)) 
    574         { 
     568        if (   ! array_key_exists('language', $array)  
     569            || ! array_key_exists('charset', $array)) 
     570        { 
     571            debug_push_class(__CLASS__, __FUNCTION__);         
    575572            debug_add("Rejecting cookie, it seems invalid.", MIDCOM_LOG_DEBUG); 
    576573            debug_pop(); 
     
    590587    function _read_http_negotiation () 
    591588    { 
    592         debug_push("midcom_services_i18n::_read_http_negotiation"); 
    593  
    594589        $headers = getallheaders(); 
    595590 
     
    632627            } 
    633628            arsort($this->_http_lang, SORT_NUMERIC); 
    634             debug_print_r("Language preference array:", $this->_http_lang, MIDCOM_LOG_DEBUG); 
    635629        } 
    636630 
     
    673667            } 
    674668            arsort ($this->_http_charset, SORT_NUMERIC); 
    675             debug_print_r("Charset preference array:", $this->_http_charset); 
    676         } 
    677  
    678         debug_pop(); 
     669        } 
    679670    } 
    680671