Changeset 11850
- Timestamp:
- 08/30/07 11:32:35 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/application.php
r11816 r11850 464 464 // Initialize Root Topic 465 465 $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) 467 468 { 468 469 if (mgd_errno() == MGD_ERR_ACCESS_DENIED) … … 522 523 * @see midcom_application::_process() 523 524 */ 524 function codeinit() { 525 debug_push("midcom_application::codeinit"); 526 525 function codeinit() 526 { 527 527 $oldcontext = $this->_currentcontext; 528 528 $this->_currentcontext = 0; … … 531 531 $this->uimessages->initialize(); 532 532 533 debug_add("Creating URL Parser with argc/v from global Environment", MIDCOM_LOG_DEBUG);534 533 $topic = $this->get_context_data(MIDCOM_CONTEXT_ROOTTOPIC); 535 534 $this->_parser = new midcom_helper_urlparser($topic->id); 536 535 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); 539 540 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 } 544 543 545 544 $this->_process(); … … 551 550 // Let metadata service add its meta tags 552 551 $this->metadata->populate_meta_head(); 553 554 debug_add("code-init finished", MIDCOM_LOG_INFO);555 debug_pop();556 552 } 557 553 … … 562 558 * Style template, usually <(content)>. 563 559 */ 564 function content() { 565 debug_push("midcom_application::content"); 560 function content() 561 { 562 debug_push_class(__CLASS__, __FUNCTION__); 566 563 567 564 // 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); 569 566 $oldcontext = $this->_currentcontext; 570 567 $this->_currentcontext = 0; … … 574 571 575 572 // 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); 577 574 $this->style->leave_context(); 578 575 $this->_currentcontext = $oldcontext; … … 661 658 * @param string $url The URL, relative to the Midgard Page, that is to be requested. 662 659 * @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).666 660 * @return int The ID of the newly created context. 667 661 */ 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 { 671 664 debug_push_class(__CLASS__, __FUNCTION__); 672 665 673 666 debug_add("Dynamic load of URL {$url}", MIDCOM_LOG_INFO); 674 debug_add("Request Type is {$type}, optional Root Topic ID is {$topicid}");675 667 676 668 if (substr($url, -5) == '.html') … … 683 675 { 684 676 debug_add("dynamic_load content request called before content output phase. Aborting.", MIDCOM_LOG_ERROR); 677 debug_pop(); 685 678 $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 691 680 } 692 681 693 682 // Determine new Context ID and set $this->_currentcontext, 694 683 // enter that context and prepare its data structure. 695 696 684 $context = $this->_create_context(); 697 685 $oldcontext = $this->_currentcontext; … … 701 689 $this->_context[$context][MIDCOM_CONTEXT_CONTENTTOPIC] = null; 702 690 $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]; 711 692 $this->_context[$context][MIDCOM_CONTEXT_OUTPUT] = null; 712 693 $this->_context[$context][MIDCOM_CONTEXT_NAP] = null; … … 734 715 } 735 716 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); 746 719 747 720 if (!$this->_parser) … … 749 722 debug_add("URL Parser could not be instantinated: $midcom_errstr", MIDCOM_LOG_ERROR); 750 723 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']}"); 752 725 } 753 726 trunk/midcom/midcom.core/midcom/services/auth/backend/simple.php
r3766 r11850 40 40 function midcom_services_auth_backend_simple () 41 41 { 42 debug_push_class(__CLASS__, __FUNCTION__);42 $this->_cookie_id .= $GLOBALS['midcom_config']['auth_backend_simple_cookie_id']; 43 43 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();48 44 return parent::midcom_services_auth_backend(); 49 45 } … … 51 47 function read_login_session() 52 48 { 53 debug_push_class(__CLASS__, __FUNCTION__);54 55 debug_print_r('Checking this Cookie Array:', $_COOKIE);56 57 49 if (! array_key_exists($this->_cookie_id, $_COOKIE)) 58 50 { 51 debug_push_class(__CLASS__, __FUNCTION__); 59 52 debug_add('There is no cookie, we cannot read the login session.'); 60 53 debug_pop(); … … 65 58 if (count($data) != 2) 66 59 { 60 debug_push_class(__CLASS__, __FUNCTION__); 67 61 debug_add("The cookie data could not be parsed, assuming tampered session.", 68 62 MIDCOM_LOG_ERROR); 69 debug_add('Killing the cookie...' );63 debug_add('Killing the cookie...', MIDCOM_LOG_INFO); 70 64 $this->_delete_cookie(); 71 65 debug_pop(); … … 76 70 $user_id = $data[1]; 77 71 78 debug_add("Extracted the user ID {$user_id} and the session ID {$session_id}.");79 72 $this->user =& $_MIDCOM->auth->get_user($user_id); 80 73 81 74 if (! $this->user) 82 75 { 76 debug_push_class(__CLASS__, __FUNCTION__); 83 77 debug_add("The user ID {$user_id} is invalid, could not load the user from the database, assuming tampered session.", 84 78 MIDCOM_LOG_ERROR); … … 93 87 if (! $this->session_id) 94 88 { 89 debug_push_class(__CLASS__, __FUNCTION__); 95 90 debug_add("The session {$this->session_id} is invalid (usually this means an expired session).", 96 91 MIDCOM_LOG_ERROR); … … 101 96 } 102 97 103 debug_pop();104 98 return true; 105 99 } trunk/midcom/midcom.core/midcom/services/cache.php
r11359 r11850 80 80 foreach ($GLOBALS['midcom_config']['cache_autoload_queue'] as $name) 81 81 { 82 debug_add("Auto-Loading module {$name}", MIDCOM_LOG_ INFO);82 debug_add("Auto-Loading module {$name}", MIDCOM_LOG_DEBUG); 83 83 $this->load_module($name); 84 84 } trunk/midcom/midcom.core/midcom/services/i18n.php
r6090 r11850 505 505 */ 506 506 function _set_startup_langs() 507 { 508 debug_push("midcom_services_i18n::_set_startup_langs"); 509 507 { 510 508 $this->_current_content_language_midgard = $_MIDGARD['lang']; 511 509 … … 513 511 if (!is_null ($this->_cookie_data)) 514 512 { 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); 518 517 debug_pop(); 519 518 return; … … 525 524 { 526 525 $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); 528 528 debug_pop(); 529 529 return; … … 542 542 } 543 543 } 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); 545 546 debug_pop(); 546 547 } … … 552 553 function _read_cookie () 553 554 { 554 debug_push("midcom_services_i18n::_read_cookie");555 556 555 if (!isset ($_COOKIE)) 557 556 { 558 debug_add("No Cookies found at all.", MIDCOM_LOG_DEBUG);559 debug_pop();560 557 return; 561 558 } … … 563 560 if (!array_key_exists("midcom_services_i18n",$_COOKIE)) 564 561 { 565 debug_add("No midcom_services_i18n Cookie on this site", MIDCOM_LOG_DEBUG);566 debug_pop();567 562 return; 568 563 } 569 564 570 $rawdata = base64_decode($_COOKIE[ "midcom_services_i18n"]);565 $rawdata = base64_decode($_COOKIE['midcom_services_i18n']); 571 566 $array = unserialize($rawdata); 572 567 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__); 575 572 debug_add("Rejecting cookie, it seems invalid.", MIDCOM_LOG_DEBUG); 576 573 debug_pop(); … … 590 587 function _read_http_negotiation () 591 588 { 592 debug_push("midcom_services_i18n::_read_http_negotiation");593 594 589 $headers = getallheaders(); 595 590 … … 632 627 } 633 628 arsort($this->_http_lang, SORT_NUMERIC); 634 debug_print_r("Language preference array:", $this->_http_lang, MIDCOM_LOG_DEBUG);635 629 } 636 630 … … 673 667 } 674 668 arsort ($this->_http_charset, SORT_NUMERIC); 675 debug_print_r("Charset preference array:", $this->_http_charset); 676 } 677 678 debug_pop(); 669 } 679 670 } 680 671
