b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.9) [ 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.16.2.2 2006/11/04 19:54:50 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. // log the hit on this page (according to settings) if the admin_skin hasn't already done so:
  125. $Hit->log();
  126.  
  127. /*
  128.  * $Log: admin.php,v $
  129.  * Revision 1.16.2.2  2006/11/04 19:54:50  fplanque
  130.  * Reinjected old Log blocks. Removing them from CVS was a bad idea -- especially since Daniel has decided branch 1.9 was his HEAD...
  131.  *
  132.  * Revision 1.16  2006/08/05 23:37:03  fplanque
  133.  * no message
  134.  *
  135.  * Revision 1.14  2006/07/06 19:56:29  fplanque
  136.  * no message
  137.  *
  138.  * Revision 1.13  2006/06/13 21:49:14  blueyed
  139.  * Merged from 1.8 branch
  140.  *
  141.  * Revision 1.12.2.1  2006/06/12 20:00:29  fplanque
  142.  * one too many massive syncs...
  143.  *
  144.  * Revision 1.12  2006/04/19 22:26:24  blueyed
  145.  * cleanup/polish
  146.  *
  147.  * Revision 1.11  2006/04/19 20:13:48  fplanque
  148.  * do not restrict to :// (does not catch subdomains, not even www.)
  149.  *
  150.  * Revision 1.10  2006/04/14 19:25:31  fplanque
  151.  * evocore merge with work app
  152.  *
  153.  * Revision 1.9  2006/04/11 21:22:25  fplanque
  154.  * partial cleanup
  155.  *
  156.  */
  157. ?>

Documentation generated on Tue, 18 Dec 2007 19:05:17 +0100 by phpDocumentor 1.4.0