b2evolution

Multilingual multiuser multiblog engine

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

Source for file admin.php

Documentation is available at admin.php

  1. <?php
  2. /**
  3.  * This is the main dispatcher for the admin interface.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10.  *  Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.
  11.  *
  12.  *  {@internal License choice
  13.  *  - If you have received this file as part of a package, please find the license.txt file in
  14.  *    the same folder or the closest folder above for complete license terms.
  15.  *  - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)
  16.  *    then you must choose one of the following licenses before using the file:
  17.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  18.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  19.  *  }}}
  20.  *
  21.  *  {@internal Open Source relicensing agreement:
  22.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  23.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  24.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  25.  *
  26.  *  PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license
  27.  *  PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project
  28.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  29.  *  }}}
  30.  *
  31.  * @package main
  32.  *
  33.  * @version $Id: admin.php,v 1.12.2.4 2006/08/05 18:49:39 fplanque Exp $
  34.  */
  35.  
  36.  
  37. /**
  38.  * Do the MAIN initializations:
  39.  */
  40. require_once dirname(__FILE__).'/conf/_config.php';
  41.  
  42.  
  43. /**
  44.  * @global boolean Is this an admin page? Use {@link is_admin_page()} to query it, because it may change.
  45.  */
  46. $is_admin_page true;
  47.  
  48.  
  49. $login_required true;
  50. require_once $inc_path.'_main.inc.php';
  51.  
  52.  
  53. // Check global permission:
  54. if$current_User->check_perm'admin''any' ) )
  55. {    // No permission to access admin...
  56.     require $view_path.'errors/_access_denied.inc.php';
  57. }
  58.  
  59.  
  60. /*
  61.  * Asynchronous processing options that may be required on any page
  62.  */
  63. require_once $inc_path.'_async.inc.php';
  64.  
  65.  
  66. /*
  67.  * Note: The header file will me merged into admin.php:
  68.  */
  69. require_once dirname(__FILE__).'/_header.php';
  70.  
  71.  
  72. /*
  73.  * Pass over to controller...
  74.  */
  75.  
  76. // Get requested controller and memorize it:
  77. param'ctrl''/^[a-z0-9_]+$/'$default_ctrltrue );
  78.  
  79.  
  80. // Redirect old-style URLs (e.g. /admin/plugins.php), if they come here because the webserver maps "/admin/" to "/admin.php"
  81. // NOTE: this is just meant as a transformation from pre-1.8 to 1.8!
  82. ifempty$_SERVER['PATH_INFO'&& $_SERVER['PATH_INFO'!= $_SERVER['PHP_SELF'// the "!= PHP_SELF" check seems needed by IIS..
  83. {
  84.     // Try to find the appropriate controller (ctrl) setting
  85.     foreach$ctrl_mappings as $k => $v )
  86.     {
  87.         ifpreg_match'~'.preg_quote$_SERVER['PATH_INFO']'~' ).'$~'$v ) )
  88.         {
  89.             $ctrl $k;
  90.             break;
  91.         }
  92.     }
  93.  
  94.     // Sanitize QUERY_STRING
  95.     ifempty$_SERVER['QUERY_STRING') )
  96.     {
  97.         $query_string explode'&'$_SERVER['QUERY_STRING');
  98.         foreach$query_string as $k => $v )
  99.         {
  100.             $query_string[$kstrip_tags($v);
  101.         }
  102.         $query_string '&'.implode'&'$query_string );
  103.     }
  104.     else
  105.     {
  106.         $query_string '';
  107.     }
  108.  
  109.     header'HTTP/1.1 301 Moved Permanently' );
  110.     header'Location: '.url_add_param$admin_url'ctrl='.$ctrl.$query_string'&' ) );
  111.     exit;
  112. }
  113.  
  114.  
  115. // Check matching controller file:
  116. if!isset($ctrl_mappings[$ctrl]) )
  117. {
  118.     debug_die'The requested controller ['.$ctrl.'] does not exist.' );
  119. }
  120.  
  121. // Call the requested controller:
  122. require $control_path.$ctrl_mappings[$ctrl];
  123.  
  124.  
  125. /*
  126.  nolog */
  127. ?>

Documentation generated on Tue, 18 Dec 2007 23:03:34 +0100 by phpDocumentor 1.4.0