b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: main ] [ index: main ] [ all elements ]

Source for file index_multi.php

Documentation is available at index_multi.php

  1. <?php
  2. /**
  3.  * This is an alternative index.php file.
  4.  * This one is optimized for a multiblog setup where each blog can be identified by its URL.
  5.  * This file will ignore any ?blog= parameter.
  6.  *
  7.  * b2evolution - {@link http://b2evolution.net/}
  8.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  9.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  10.  *
  11.  *  {@internal Note: we need at least one file in the main package}}
  12.  *
  13.  * @package main
  14.  */
  15.  
  16. /**
  17.  * First thing: Do the minimal initializations required for b2evo:
  18.  */
  19. require_once dirname(__FILE__).'/conf/_config.php';
  20.  
  21. require_once $inc_path.'_main.inc.php';
  22.  
  23. $BlogCache get_BlogCache();
  24.  
  25. ifpreg_match'#^(.+?)index.php/([^/]+)#'$ReqHost.$ReqPath$matches ) )
  26. // We have an URL blog name:
  27.     $Debuglog->add'Found a potential URL blog name: '.$matches[2]'detectblog' );
  28.     if( (($Blog $BlogCache->get_by_urlname$matches[2]false )) !== false) )
  29.     // We found a matching blog:
  30.         $blog $Blog->ID;
  31.     }
  32. }
  33.  
  34. ifempty($blog) )
  35. // No blog identified by URL name, let's try to match the absolute URL
  36.     ifpreg_match'#^(.+?)index.php#'$ReqHost.$ReqPath$matches ) )
  37.     // Remove what's not part of the absolute URL
  38.         $ReqAbsUrl $matches[1];
  39.     }
  40.     else
  41.     {
  42.         $ReqAbsUrl $ReqHost.$ReqPath;
  43.     }
  44.     $Debuglog->add'Looking up absolute url : '.$ReqAbsUrl'detectblog' );
  45.  
  46.     if( (($Blog $BlogCache->get_by_url$ReqAbsUrlfalse )) !== false) )
  47.     // We found a matching blog:
  48.         $blog $Blog->ID;
  49.         $Debuglog->add'Found matching blog: '.$blog'detectblog' );
  50.     }
  51. }
  52.  
  53. ifempty($blog) )
  54. // Still no blog requested, use default
  55.     $blog $Settings->get('default_blog_ID');
  56.     $Debuglog->add'Using default blog '.$blog'detectblog' );
  57. }
  58.  
  59. ifempty($blog) )
  60. // No specific blog to be displayed:
  61.     echo 'No default blog is set.';
  62.     exit();
  63. }
  64.  
  65. // Memorize that blog param as DEFAULT so that it doesn't get passed in regenerate_url()
  66. memorize_param'blog''integer'$blog );
  67.  
  68. // A blog has been requested... Let's set a few default params:
  69.  
  70. # You could *force* a specific skin here with this setting:
  71. # $skin = 'basic';
  72.  
  73. # This setting retricts posts to those published, thus hiding drafts.
  74. # You should not have to change this.
  75. $show_statuses array();
  76.  
  77. # Here you can set a limit before which posts will be ignored
  78. # You can use a unix timestamp value or 'now' which will hide all posts in the past
  79. $timestamp_min '';
  80.  
  81. # Here you can set a limit after which posts will be ignored
  82. # You can use a unix timestamp value or 'now' which will hide all posts in the future
  83. $timestamp_max 'now';
  84.  
  85. # Additionnaly, you can set other values (see URL params in the manual)...
  86. # $order = 'ASC'; // This for example would display the blog in chronological order...
  87.  
  88. // That's it, now let b2evolution do the rest! :)
  89. require $inc_path.'_blog_main.inc.php';
  90.  
  91. ?>

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