[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6  
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11  
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15  
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19  
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // set page processiong start time
  24  list($usec, $sec) = explode(' ', microtime());
  25  $phpwcms_rendering_start = $usec + $sec;
  26  
  27  // define some general vars
  28  $content             = array();
  29  $phpwcms             = array();
  30  $BL                    = array();
  31  $template_default    = array();
  32  $indexpage            = array();
  33  
  34  // load general configuration
  35  $basepath            = str_replace('\\', '/', dirname(__FILE__));
  36  if(!is_file($basepath.'/config/phpwcms/conf.inc.php')) {
  37      if(is_file($basepath.'/setup/index.php')) {
  38          header('Location: setup/index.php');
  39          exit();
  40      }
  41      die('Error: Config file missing. Check your setup!');
  42  }
  43  require_once $basepath.'/config/phpwcms/conf.inc.php';
  44  require_once $basepath.'/include/inc_lib/default.inc.php';
  45  require_once  PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php';
  46  
  47  // Get user Agent BOT check
  48  $IS_A_BOT = $phpwcms['USER_AGENT']['bot'];
  49  
  50  // start session - neccessary if frontend users are available
  51  // but neccessary also to check if a bot is visiting the site
  52  // -> if so then do not initialize session for larger search engines
  53  if(!$IS_A_BOT && !empty($phpwcms['SESSION_FEinit'])) {
  54      _initSession();
  55  }
  56  
  57  // some initial actions
  58  cleanupPOSTandGET();
  59  buildGlobalGET();
  60  define('FE_CURRENT_URL', abs_url(array(),array('phpwcms_output_action')) );
  61  
  62  // init some special rights and also frontend edit
  63  init_frontend_edit();
  64  
  65  // buffer everything
  66  ob_start();
  67  
  68  $content['page_end'] = '';
  69  
  70  require_once  PHPWCMS_ROOT.'/config/phpwcms/conf.template_default.inc.php';
  71  require_once  PHPWCMS_ROOT.'/config/phpwcms/conf.indexpage.inc.php';
  72  require_once  PHPWCMS_ROOT.'/include/inc_lib/general.inc.php';
  73  require_once  PHPWCMS_ROOT.'/include/inc_front/cnt.lang.inc.php';
  74  require_once  PHPWCMS_ROOT.'/include/inc_lib/modules.check.inc.php';
  75  require_once  PHPWCMS_ROOT.'/include/inc_lib/article.contenttype.inc.php';
  76  require  PHPWCMS_ROOT.'/include/inc_lib/imagick.convert.inc.php';
  77  require  PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php';
  78  require  PHPWCMS_ROOT.'/include/inc_front/ext.func.inc.php';
  79  require  PHPWCMS_ROOT.'/include/inc_front/content.func.inc.php';
  80  
  81  
  82  // SEO logging
  83  if(!empty($phpwcms['enable_seolog']) && !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false) {
  84      $phpwcms['seo_referrer_data'] = seReferrer( $_SERVER['HTTP_REFERER'] );
  85      if( is_array( $phpwcms['seo_referrer_data'] ) ) {
  86          @_dbInsert('phpwcms_log_seo', $phpwcms['seo_referrer_data'], 'DELAYED');
  87      }
  88  }
  89  
  90  $phpwcms["templates"]    = TEMPLATE_PATH;
  91  $content['page_start']   = sprintf(PHPWCMS_DOCTYPE, str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE_LANG ) . ' id="'.str_replace(array('.','/'), '-', PHPWCMS_HOST).'"');
  92  $content['page_start']  .= '<!--
  93      phpwcms | free open source content management system
  94      created by Oliver Georgi (oliver at phpwcms dot de) and licensed under GNU/GPL.
  95      phpwcms is copyright 2002-'.date('Y').' of Oliver Georgi. Extensions are copyright of
  96      their respective owners. Visit project page for details: http://www.phpwcms.org/'.LF.'-->'.LF;
  97  $content['page_start']  .= '  <title>'.html_specialchars($content["pagetitle"]).'</title>'.LF;
  98  $content['page_start']  .= '  <meta http-equiv="content-type" content="'.$_use_content_type.'; charset='.PHPWCMS_CHARSET.'"'.HTML_TAG_CLOSE.LF;
  99  
 100  // HTML5 does not like content-style-type
 101  if($phpwcms['mode_XHTML'] != 3) {
 102      $content['page_start']  .= '  <meta http-equiv="content-style-type" content="text/css"'.HTML_TAG_CLOSE.LF;
 103  }
 104  
 105  // Deprecated custom page CSS
 106  $content['page_start']  .= get_body_attributes($pagelayout);
 107  
 108  // Add all CSS files here
 109  if(count($block['css'])) {
 110      foreach($block['css'] as $value) {
 111          $content['page_start'] .= '  <link rel="stylesheet" type="text/css" href="'.TEMPLATE_PATH.'inc_css/';
 112          $content['page_start'] .= str_replace(' ', '%20', $value);
 113          $content['page_start'] .= '"'.HTML_TAG_CLOSE.LF;
 114      }
 115  }
 116  
 117  $content['page_start'] .= $block["htmlhead"];
 118  
 119  if($phpwcms['USER_AGENT']['agent'] == 'IE' && !empty($phpwcms['IE7-js']) && version_compare($phpwcms['USER_AGENT']['version'], '9.0', '<')) {
 120      $content['page_start'] .= '  <!--[if lt IE 9]><script type="text/javascript" src="'.TEMPLATE_PATH.'lib/ie7-js/IE9.js"></script><![endif]-->'.LF;
 121  }
 122  
 123  $content['page_start'] .= '</head>'.LF;
 124  
 125  // inject body tag in case of class or id attribute
 126  $body_inject = '<body';
 127  if($content['body_id'] !== false) {
 128      if(!empty($template_default['body']['id'])) {
 129          $body_inject .= ' id="'.$template_default['body']['id'].$content['body_id'].'"';
 130      }
 131      if(!empty($template_default['body']['class'])) {
 132          $body_inject .= ' class="'.$template_default['body']['class'].$content['body_id'].'"';
 133      }
 134  }
 135  $content['page_start'] .= $body_inject.'>'.LF;
 136  
 137  //  this regex's inits rewrite
 138  if($phpwcms["rewrite_url"]) {
 139      $content["all"] = preg_replace("/( href=\"index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\")/e", "url_search('$2')", $content["all"]);
 140      $content["all"] = preg_replace("/(onclick=\"location.href='index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\')/e", "js_url_search('$2')", $content["all"]);
 141  }
 142  
 143  // real page ending
 144  $content['page_end'] .= LF.'</body>'.LF.'</html>';
 145  
 146  // return rendered content
 147  echo $content['page_start'];
 148  echo $content["all"];
 149  echo $content['page_end'];
 150  
 151  // phpwcms Default header settings
 152  if($phpwcms['cache_timeout']) {
 153      header('Expires: '.gmdate('D, d M Y H:i:s', time() + $phpwcms['cache_timeout']) .' GMT');
 154      header('Last-Modified: '.gmdate('D, d M Y H:i:s', empty($row['article_date']) ? time() : $row['article_date']) .' GMT');
 155      header('Cache-Control: public, max-age='.$phpwcms['cache_timeout']);
 156      header('Pragma: public');
 157  }
 158  
 159  // write phpwcms release information in a custom HTTP header
 160  header('X-phpwcms-Release: ' . $phpwcms["generator"]);
 161  
 162  // retrieve complete processing time
 163  list($usec, $sec) = explode(' ', microtime());
 164  header('X-phpwcms-Page-Processed-In: ' . number_format(1000*($usec + $sec - $phpwcms_rendering_start), 3) .' ms');
 165  
 166  // print PDF
 167  if($aktion[2] === 1 && defined('PRINT_PDF') && PRINT_PDF) {
 168      require_once  (PHPWCMS_ROOT.'/include/inc_front/pdf.inc.php');
 169  
 170  // handle output action and section
 171  } elseif($phpwcms['output_action']) {
 172      
 173      if(empty($phpwcms['output_function_filter']) || !is_array($phpwcms['output_function_filter'])) {
 174          $phpwcms['output_function_filter'] = array('trim', 'strip_tags');
 175      }
 176      
 177      $phpwcms['output_function'] = array_intersect($phpwcms['output_function_filter'], $phpwcms['output_function']);
 178  
 179      $content = ob_get_clean();
 180  
 181      $sections = '';
 182  
 183      foreach($phpwcms['output_section'] as $section) {
 184      
 185          $section = get_tmpl_section($section, $content);
 186          
 187          foreach($phpwcms['output_function'] as $function) {
 188      
 189              $section = $function($section);
 190      
 191          }
 192          
 193          $sections .= $section;
 194      }
 195      
 196      // return preg_replace('/<!--(.|\s)*?-->/', '', $buffer);
 197      echo trim($sections) == '' ? $content : $sections;
 198      
 199      exit();
 200  }
 201  
 202  // send buffer to browser
 203  ob_end_flush();
 204  
 205  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1