b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 2.4) [ class tree: main ] [ index: main ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php
  2. /**
  3.  * This is the main public interface file.
  4.  *
  5.  * IF YOU ARE READING THIS IN YOUR WEB BROWSER, IT MEANS THAT PHP IS NOT PROPERLY INSTALLED
  6.  * ON YOUR WEB SERVER. IF YOU DON'T KNOW WHAT THIS MEANS, CONTACT YOUR SERVER ADMINISTRATOR
  7.  * OR YOUR HOSTING COMPANY.
  8.  *
  9.  * This file is NOT mandatory. You can delete it if you want.
  10.  * You can also replace the contents of this file with contents similar to the contents
  11.  * of a_stub.php, a_noskin.php, multiblogs.php, etc.
  12.  *
  13.  * b2evolution - {@link http://b2evolution.net/}
  14.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  15.  * @copyright (c)2003-2008 by Francois PLANQUE - {@link http://fplanque.net/}
  16.  *
  17.  *  {@internal Note: we need at least one file in the main package}}
  18.  *
  19.  * @package main
  20.  */
  21.  
  22. /**
  23.  * First thing: Do the minimal initializations required for b2evo:
  24.  */
  25. require_once dirname(__FILE__).'/conf/_config.php';
  26.  
  27. require_once $inc_path.'_main.inc.php';
  28.  
  29. // Check if a specific blog has been requested in the URL:
  30. param'blog''integer'''true );
  31.  
  32. ifempty($blog) )
  33. // No blog requested by URL param, let's try to match something in the URL
  34.     $Debuglog->add'No blog param received, checking extra path...''detectblog' );
  35.  
  36.     $BlogCache get_Cache'BlogCache' );
  37.  
  38.     ifpreg_match'#^(.+?)index.php/([^/]+)#'$ReqHost.$ReqPath$matches ) )
  39.     // We have an URL blog name:
  40.         $Debuglog->add'Found a potential URL blog name: '.$matches[2]'detectblog' );
  41.         if( (($Blog $BlogCache->get_by_urlname$matches[2]false )) !== false) )
  42.         // We found a matching blog:
  43.             $blog $Blog->ID;
  44.         }
  45.     }
  46.  
  47.     ifempty($blog) )
  48.     // No blog identified by URL name, let's try to match the absolute URL
  49.         ifpreg_match'#^(.+?)index.php#'$ReqHost.$ReqPath$matches ) )
  50.         // Remove what's not part of the absolute URL
  51.             $ReqAbsUrl $matches[1];
  52.         }
  53.         else
  54.         {
  55.             $ReqAbsUrl $ReqHost.$ReqPath;
  56.         }
  57.         $Debuglog->add'Looking up absolute url : '.$ReqAbsUrl'detectblog' );
  58.  
  59.         if( (($Blog $BlogCache->get_by_url$ReqAbsUrlfalse )) !== false) )
  60.         // We found a matching blog:
  61.             $blog $Blog->ID;
  62.             $Debuglog->add'Found matching blog: '.$blog'detectblog' );
  63.         }
  64.     }
  65.  
  66.     ifempty($blog) )
  67.     // Still no blog requested, use default
  68.         $blog $Settings->get('default_blog_ID');
  69.         if( (($Blog $BlogCache->get_by_ID$blogfalsefalse )) !== false) )
  70.         // We found a matching blog:
  71.             $Debuglog->add'Using default blog '.$blog'detectblog' );
  72.         }
  73.         else
  74.         {
  75.             $blog NULL;
  76.         }
  77.     }
  78.  
  79.     ifempty($blog) )
  80.     // No specific blog to be displayed:
  81.         // we are going to display the default page:
  82.         require dirname(__FILE__).'/default.php';
  83.         exit();
  84.     }
  85. }
  86.  
  87. // A blog has been requested... Let's set a few default params:
  88.  
  89. # You could *force* a specific skin here with this setting:
  90. # $skin = 'basic';
  91.  
  92. # This setting retricts posts to those published, thus hiding drafts.
  93. # You should not have to change this.
  94. $show_statuses array();
  95.  
  96. # Here you can set a limit before which posts will be ignored
  97. # You can use a unix timestamp value or 'now' which will hide all posts in the past
  98. $timestamp_min '';
  99.  
  100. # Here you can set a limit after which posts will be ignored
  101. # You can use a unix timestamp value or 'now' which will hide all posts in the future
  102. $timestamp_max 'now';
  103.  
  104. # Additionnaly, you can set other values (see URL params in the manual)...
  105. # $order = 'ASC'; // This for example would display the blog in chronological order...
  106.  
  107. // That's it, now let b2evolution do the rest! :)
  108. require $inc_path.'_blog_main.inc.php';
  109.  
  110. ?>

Documentation generated on Sat, 06 Mar 2010 03:24:14 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).