b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ 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-2010 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. $Timer->resume('index.php');
  30.  
  31. ifisset($collections_Module) )
  32. {    // The evocore framework is not used as a blog app here / we don't know how to display a public interface...
  33.     header_redirect'admin.php'302 );
  34.     exit(0);
  35. }
  36.  
  37. // Check if a specific blog has been requested in the URL:
  38. param'blog''integer'''true );
  39.  
  40. ifempty($blog) )
  41. // No blog requested by URL param, let's try to match something in the URL
  42.     $Debuglog->add'No blog param received, checking extra path...''detectblog' );
  43.  
  44.     $BlogCache get_BlogCache();
  45.  
  46.     ifpreg_match'#^(.+?)index.php/([^/]+)#'$ReqHost.$ReqPath$matches ) )
  47.     // We have an URL blog name:
  48.         $Debuglog->add'Found a potential URL blog name: '.$matches[2]'detectblog' );
  49.         if( (($Blog $BlogCache->get_by_urlname$matches[2]false )) !== false) )
  50.         // We found a matching blog:
  51.             $blog $Blog->ID;
  52.         }
  53.     }
  54.  
  55.     ifempty($blog) )
  56.     // No blog identified by URL name, let's try to match the absolute URL
  57.         ifpreg_match'#^(.+?)index.php#'$ReqHost.$ReqPath$matches ) )
  58.         // Remove what's not part of the absolute URL
  59.             $ReqAbsUrl $matches[1];
  60.         }
  61.         else
  62.         {
  63.             $ReqAbsUrl $ReqHost.$ReqPath;
  64.         }
  65.         $Debuglog->add'Looking up absolute url : '.$ReqAbsUrl'detectblog' );
  66.  
  67.         if( (($Blog $BlogCache->get_by_url$ReqAbsUrlfalse )) !== false) )
  68.         // We found a matching blog:
  69.             $blog $Blog->ID;
  70.             $Debuglog->add'Found matching blog: '.$blog'detectblog' );
  71.         }
  72.     }
  73.  
  74.     ifempty($blog) )
  75.     // Still no blog requested, use default
  76.         $blog $Settings->get('default_blog_ID');
  77.         if( (($Blog $BlogCache->get_by_ID$blogfalsefalse )) !== false) )
  78.         // We found a matching blog:
  79.             $Debuglog->add'Using default blog '.$blog'detectblog' );
  80.         }
  81.         else
  82.         {
  83.             $blog NULL;
  84.         }
  85.     }
  86.  
  87.     ifempty($blog) )
  88.     // No specific blog to be displayed:
  89.         // we are going to display the default page:
  90.         require dirname(__FILE__).'/default.php';
  91.         exit();
  92.     }
  93. }
  94.  
  95. // A blog has been requested... Let's set a few default params:
  96.  
  97. # You could *force* a specific skin here with this setting:
  98. # $skin = 'basic';
  99.  
  100. # This setting retricts posts to those published, thus hiding drafts.
  101. # You should not have to change this.
  102. $show_statuses array();
  103.  
  104. # Here you can set a limit before which posts will be ignored
  105. # You can use a unix timestamp value or 'now' which will hide all posts in the past
  106. $timestamp_min '';
  107.  
  108. # Here you can set a limit after which posts will be ignored
  109. # You can use a unix timestamp value or 'now' which will hide all posts in the future
  110. $timestamp_max 'now';
  111.  
  112. # Additionnaly, you can set other values (see URL params in the manual)...
  113. # $order = 'ASC'; // This for example would display the blog in chronological order...
  114.  
  115. $Timer->pause('index.php');
  116.  
  117. // That's it, now let b2evolution do the rest! :)
  118. require $inc_path.'_blog_main.inc.php';
  119.  
  120. ?>

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