Changeset 11864
- Timestamp:
- 08/30/07 13:08:43 (1 year ago)
- Files:
-
- trunk/midcom/midcom.core/midcom/application.php (modified) (26 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/application.php
r11858 r11864 107 107 class midcom_application 108 108 { 109 110 /**111 * The URL parser.112 *113 * @var midcom_helper_urlparser114 * @access private115 */116 private $_parser;117 118 109 /** 119 110 * Holds the component context information. This is an array of arrays, the outer … … 132 123 * @access private 133 124 */ 134 private $_currentcontext ;125 private $_currentcontext = null; 135 126 136 127 /** … … 140 131 * @access private 141 132 */ 142 private $_currentcomponent ;133 private $_currentcomponent = ''; 143 134 144 135 /** … … 148 139 * @access private 149 140 */ 150 private $_client ;141 private $_client = array(); 151 142 152 143 /** … … 158 149 * @access private 159 150 */ 160 private $_prefix ;151 private $_prefix = ''; 161 152 162 153 /** … … 168 159 * @access private 169 160 */ 170 private $_status ;161 private $_status = null; 171 162 172 163 /** … … 177 168 * @access private 178 169 */ 179 private $_services; 170 private $_services = array(); 171 172 /** 173 * The URL parser. 174 * 175 * @var midcom_helper_urlparser 176 * @access private 177 */ 178 private $_parser = null; 180 179 181 180 /** … … 272 271 273 272 /** 274 * String with all JavaScript declarations for the page's head. 273 * Array with all JavaScript declarations for the page's head. 274 * 275 * @var Array 276 * @access private 277 */ 278 private $_jshead = array(); 279 280 /** 281 * String with all prepend JavaScript declarations for the page's head. 275 282 * 276 283 * @var string 277 284 * @access private 278 285 */ 279 private $_jshead; 280 281 /** 282 * String with all prepend JavaScript declarations for the page's head. 283 * 284 * @var string 285 * @access private 286 */ 287 private $_prepend_jshead; 286 private $_prepend_jshead = ''; 288 287 289 288 /** … … 304 303 305 304 /** 306 * Array with all methods for the BODY's onload event.305 * Array with all linked URLs for HEAD. 307 306 * 308 307 * @var Array 309 308 * @access private 310 309 */ 311 private $_jsonload; 310 private $_linkhrefs = array(); 311 312 /** 313 * Array with all methods for the BODY's onload event. 314 * 315 * @var Array 316 * @access private 317 */ 318 private $_jsonload = array(); 312 319 313 320 /** … … 316 323 * @access private 317 324 */ 318 private $_meta_head = "";325 private $_meta_head = ''; 319 326 320 327 /** … … 323 330 * @access private 324 331 */ 325 private $_object_head = "";332 private $_object_head = ''; 326 333 327 334 /** … … 331 338 * @access private 332 339 */ 333 private $_style_head = "";340 private $_style_head = ''; 334 341 335 342 /** … … 339 346 * @access private 340 347 */ 341 private $_link_head = "";348 private $_link_head = ''; 342 349 343 350 /** … … 348 355 * @see midcom_application::get_host_prefix(); 349 356 */ 350 private $_cached_host_prefix ;357 private $_cached_host_prefix = ''; 351 358 352 359 /** … … 357 364 * @see midcom_application::get_page_prefix(); 358 365 */ 359 private $_cached_page_prefix ;366 private $_cached_page_prefix = ''; 360 367 361 368 /** … … 396 403 public function initialize() 397 404 { 398 debug_push_class(__CLASS__, __FUNCTION__);399 400 // MidCOM System Data401 $this->_parser = false;402 $this->_services = Array();403 $this->_jsfiles = Array();404 $this->_jshead = Array();405 $this->_jsonload = Array();406 $this->_linkhrefs = Array();407 408 405 // set prefix for "new" midgard->self 409 406 $this->_prefix = $GLOBALS['midcom_config']['midcom_prefix']; … … 412 409 413 410 $this->_status = MIDCOM_STATUS_PREPARE; 414 415 // Service startup 411 412 // Load the services that are always needed, including the serviceloader 413 $this->_load_core_services(); 414 415 $this->componentloader->load_all_manifests(); 416 417 $this->_load_core_dba_classes(); 418 419 // Initialize Root Topic 420 $root_topic = new midcom_db_topic($GLOBALS['midcom_config']['midcom_root_topic_guid']); 421 if ( ! $root_topic 422 || !$root_topic->guid) 423 { 424 if (mgd_errno() == MGD_ERR_ACCESS_DENIED) 425 { 426 $this->generate_error(MIDCOM_ERRFORBIDDEN, 427 $this->i18n->get_string('access denied', 'midcom')); 428 } 429 else 430 { 431 $this->generate_error(MIDCOM_ERRCRIT, 432 "Unable to load root topic with GUID='{$GLOBALS['midcom_config']['midcom_root_topic_guid']}'.<br />" . 433 "This is fatal, aborting. See the MidCOM log file for details.<br />" . 434 'Last Midgard Error was: ' . mgd_errstr()); 435 } 436 // This will exit. 437 } 438 439 // Initialize Context Storage 440 $this->_context = Array(); 441 $this->_create_context(0); 442 $this->_currentcontext = 0; 443 $this->_context[0][MIDCOM_CONTEXT_ROOTTOPIC] = $root_topic; 444 445 // Populate browser information 446 $this->_populate_client(); 447 448 // Check the midcom_config site prefix for absolute local urls 449 if ($GLOBALS['midcom_config']['midcom_site_url'][0] == '/') 450 { 451 $GLOBALS['midcom_config']['midcom_site_url'] = 452 $this->get_host_prefix() 453 . substr($GLOBALS['midcom_config']['midcom_site_url'], 1); 454 } 455 } 456 457 /** 458 * Load all services MidCOM needs to keep always available 459 * 460 * @todo: move those that aren't always needed behind serviceloader 461 */ 462 private function _load_core_services() 463 { 464 // These are core functionality 465 $this->serviceloader = new midcom_helper_serviceloader(); 416 466 $this->cache =& $GLOBALS['midcom_cache']; 417 467 $this->i18n = new midcom_services_i18n(); … … 419 469 $this->dbclassloader = new midcom_services_dbclassloader(); 420 470 $this->dbclassloader->load_classes('midcom', 'legacy_classes.inc'); 421 // 2007-03-27 rambo422 471 $this->dbclassloader->load_classes('midcom', 'core_classes.inc'); 423 472 $this->dbfactory = new midcom_helper__dbfactory(); … … 425 474 $this->auth = new midcom_services_auth(); 426 475 $this->auth->initialize(); 427 $this->permalinks = new midcom_services_permalinks(); 428 $this->serviceloader = new midcom_helper_serviceloader(); 476 477 // These can be refactored behind serviceloader 478 $this->permalinks = new midcom_services_permalinks(); 429 479 $this->tmp = new midcom_services_tmp(); 430 480 $this->toolbars = new midcom_services_toolbars(); 431 481 $this->uimessages = new midcom_services_uimessages(); 432 482 $this->metadata = new midcom_services_metadata(); 433 434 483 $this->_services['rcs'] = new midcom_services_rcs($GLOBALS['midcom_config']); 435 436 $this->componentloader->load_all_manifests(); 437 484 } 485 486 /** 487 * Load core DBA classes 488 * 489 * @todo: move behind autoload 490 */ 491 private function _load_core_dba_classes() 492 { 438 493 // Load DBA legacy classes required for core operation 439 494 require('db/article.php'); … … 462 517 require('db/sitegroup.php'); 463 518 */ 464 465 // Initialize Root Topic466 $root_topic = new midcom_db_topic($GLOBALS['midcom_config']['midcom_root_topic_guid']);467 if ( ! $root_topic468 || !$root_topic->guid)469 {470 if (mgd_errno() == MGD_ERR_ACCESS_DENIED)471 {472 $this->generate_error(MIDCOM_ERRFORBIDDEN,473 $this->i18n->get_string('access denied', 'midcom'));474 }475 else476 {477 $this->generate_error(MIDCOM_ERRCRIT,478 "Unable to load root topic with GUID='{$GLOBALS['midcom_config']['midcom_root_topic_guid']}'.<br />" .479 "This is fatal, aborting. See the MidCOM log file for details.<br />" .480 'Last Midgard Error was: ' . mgd_errstr());481 }482 // This will exit.483 }484 485 // Initialize Context Storage486 $this->_context = Array();487 $this->_create_context(0);488 $this->_currentcontext = 0;489 $this->_context[0][MIDCOM_CONTEXT_ROOTTOPIC] = $root_topic;490 491 $this->_populate_client();492 493 // Check the midcom_config ais/site prefixes for absolute local urls494 if ($GLOBALS['midcom_config']['midcom_ais_url'][0] == '/')495 {496 $GLOBALS['midcom_config']['midcom_ais_url'] =497 $this->get_host_prefix()498 . substr($GLOBALS['midcom_config']['midcom_ais_url'], 1);499 }500 if ($GLOBALS['midcom_config']['midcom_site_url'][0] == '/')501 {502 $GLOBALS['midcom_config']['midcom_site_url'] =503 $this->get_host_prefix()504 . substr($GLOBALS['midcom_config']['midcom_site_url'], 1);505 }506 507 debug_pop();508 519 } 509 520 … … 623 634 * $newsticker = '/newsticker/latest/3.html'; 624 635 * $substyle = 'homepage'; 625 * $ GLOBALS['midcom']->dynamic_load("/midcom-substyle-{$substyle}/{$newsticker}");636 * $_MIDCOM->dynamic_load("/midcom-substyle-{$substyle}/{$newsticker}"); 626 637 * ?> 627 638 * </code> … … 635 646 * <?php 636 647 * global $view; 637 * $ GLOBALS['midcom']->dynamic_load($view['url1']);648 * $_MIDCOM->dynamic_load($view['url1']); 638 649 * // You will most probably fail, could even loop infinitly! 639 * $ GLOBALS['midcom']->dynamic_load($view['url2']);650 * $_MIDCOM->dynamic_load($view['url2']); 640 651 * ?> 641 652 * </code> … … 652 663 * <?php 653 664 * $view = $GLOBALS['view']; 654 * $ GLOBALS['midcom']->dynamic_load($view['url1']);655 * $ GLOBALS['midcom']->dynamic_load($view['url2']);665 * $_MIDCOM->dynamic_load($view['url1']); 666 * $_MIDCOM->dynamic_load($view['url2']); 656 667 * ?> 657 668 * </code> … … 1778 1789 * <code> 1779 1790 * <?php 1780 * $ GLOBALS['midcom']->load_library('midcom.helper.datamanager');1791 * $_MIDCOM->load_library('midcom.helper.datamanager'); 1781 1792 * ?> 1782 1793 * </code> … … 2696 2707 * <HEAD> 2697 2708 * <!-- Further HEAD Tags --> 2698 * <?php echo $ GLOBALS['midcom']->print_jscripts(); ?>2709 * <?php echo $_MIDCOM->print_jscripts(); ?> 2699 2710 * </HEAD> 2700 2711 * </HTML> … … 2738 2749 * <code> 2739 2750 * <HTML> 2740 * <BODY <?php echo $ GLOBALS['midcom']->print_jsonload();?>>2751 * <BODY <?php echo $_MIDCOM->print_jsonload();?>> 2741 2752 * <!-- your actual body --> 2742 2753 * </BODY>
