[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/ -> index.php (source)

   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-2007 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  if( empty($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      if( preg_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      if( empty($blog) )
  48      { // No blog identified by URL name, let's try to match the absolute URL
  49          if( preg_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( $ReqAbsUrl, false )) !== false) )
  60          { // We found a matching blog:
  61              $blog = $Blog->ID;
  62              $Debuglog->add( 'Found matching blog: '.$blog, 'detectblog' );
  63          }
  64      }
  65  
  66      if( empty($blog) )
  67      { // Still no blog requested, use default
  68          $blog = $Settings->get('default_blog_ID');
  69          $Debuglog->add( 'Using default blog '.$blog, 'detectblog' );
  70      }
  71  
  72      if( empty($blog) )
  73      { // No specific blog to be displayed:
  74          // we are going to display the default page:

  75          require dirname(__FILE__).'/default.php';
  76          exit();
  77      }
  78  }
  79  
  80  // A blog has been requested... Let's set a few default params:

  81  
  82  # You could *force* a specific skin here with this setting:

  83  # $skin = 'basic';

  84  
  85  # This setting retricts posts to those published, thus hiding drafts.

  86  # You should not have to change this.

  87  $show_statuses = array();
  88  
  89  # Here you can set a limit before which posts will be ignored

  90  # You can use a unix timestamp value or 'now' which will hide all posts in the past

  91  $timestamp_min = '';
  92  
  93  # Here you can set a limit after which posts will be ignored

  94  # You can use a unix timestamp value or 'now' which will hide all posts in the future

  95  $timestamp_max = 'now';
  96  
  97  # Additionnaly, you can set other values (see URL params in the manual)...

  98  # $order = 'ASC'; // This for example would display the blog in chronological order...

  99  
 100  // That's it, now let b2evolution do the rest! :)

 101  require $inc_path.'_blog_main.inc.php';
 102  
 103  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics