[ Index ]

PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10)

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2010 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  if(!empty($phpwcms['Bad_Behavior'])) {
  91      require  PHPWCMS_ROOT.'/include/inc_ext/bad-behavior/bad-behavior-phpwcms.php';
  92  }
  93  
  94  $phpwcms["templates"]    = TEMPLATE_PATH;
  95  
  96  $phpwcms['DOCTYPE_LANG'] = str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE_LANG );
  97  
  98  $content['page_start']   = str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE );
  99  $content['page_start']  .= '<!--
 100      phpwcms | free open source content management system
 101      created by Oliver Georgi (oliver at phpwcms dot de) and licensed under GNU/GPL.
 102      phpwcms is copyright 2003-'.date('Y').' of Oliver Georgi. Extensions are copyright of
 103      their respective owners. Visit project page for details: http://www.phpwcms.org/'.LF.'// -->'.LF;
 104  $content['page_start']  .= '  <title>'.html_specialchars($content["pagetitle"]).'</title>'.LF;
 105  $content['page_start']  .= '  <meta http-equiv="content-type" content="'.$_use_content_type.'; charset='.PHPWCMS_CHARSET.'"'.HTML_TAG_CLOSE.LF;
 106  $content['page_start']  .= '  <meta http-equiv="content-style-type" content="text/css"'.HTML_TAG_CLOSE.LF;
 107  $content['page_start']  .= get_body_attributes($pagelayout);
 108  
 109  // now add all CSS files here
 110  if(count($block['css'])) {
 111      foreach($block['css'] as $value) {
 112          $content['page_start'] .= '  <link rel="stylesheet" type="text/css" href="'.TEMPLATE_PATH.'inc_css/';
 113          $content['page_start'] .= str_replace(' ', '%20', $value);
 114          $content['page_start'] .= '"'.HTML_TAG_CLOSE.LF;
 115      }
 116  }
 117  
 118  $content['page_start'] .= $block["htmlhead"];
 119  
 120  if(empty($phpwcms['IE7-js'])) {
 121      if(!empty($phpwcms['IE_htc_hover'])) {
 122          $content['page_start'] .= '  <!--[if lte IE 7]><style type="text/css">body{behavior:url("'.TEMPLATE_PATH.'inc_css/specific/csshover3.htc");}</style><![endif]-->'.LF;
 123      }
 124      if(!empty($phpwcms['IE_htc_png'])) {
 125          $content['page_start'] .= '  <!--[if lt IE 7]>'.LF;
 126          $content['page_start'] .= '    <script type="text/javascript" src="'.TEMPLATE_PATH.'inc_css/specific/iepngfix_tilebg.js"></script>'.LF;
 127          $content['page_start'] .= '    <style type="text/css">img,a,div,input,.pngfix{behavior:url("'.TEMPLATE_PATH.'inc_css/specific/iepngfix.htc");}</style>'.LF;
 128          $content['page_start'] .= '  <![endif]-->'.LF;
 129      }
 130  } else {
 131      $content['page_start'] .= '  <!--[if lt IE 8]><script type="text/javascript" src="'.TEMPLATE_PATH.'lib/ie7-js/IE8.js"></script><![endif]-->'.LF;
 132  }
 133  
 134  $content['page_start'] .= '</head>'.LF;
 135  
 136  // inject body tag in case of class or id attribute
 137  $body_inject = '<body';
 138  if($content['body_id'] !== false) {
 139      if(!empty($template_default['body']['id'])) {
 140          $body_inject .= ' id="'.$template_default['body']['id'].$content['body_id'].'"';
 141      }
 142      if(!empty($template_default['body']['class'])) {
 143          $body_inject .= ' class="'.$template_default['body']['class'].$content['body_id'].'"';
 144      }
 145  }
 146  $content['page_start'] .= $body_inject.'>'.LF;
 147  
 148  //  this regex's inits rewrite
 149  if($phpwcms["rewrite_url"]) {
 150      $content["all"] = preg_replace("/( href=\"index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\")/e", "url_search('$2')", $content["all"]);
 151      $content["all"] = preg_replace("/(onclick=\"location.href='index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\')/e", "js_url_search('$2')", $content["all"]);
 152  }
 153  
 154  // real page ending
 155  $content['page_end'] .= LF.'</body>'.LF.'</html>';
 156  
 157  // return rendered content
 158  echo $content['page_start'];
 159  echo $content["all"];
 160  echo $content['page_end'];
 161  
 162  // phpwcms Default header settings
 163  if($phpwcms['cache_timeout']) {
 164      header('Expires: '.gmdate('D, d M Y H:i:s', time() + $phpwcms['cache_timeout']) .' GMT');
 165      header('Last-Modified: '.gmdate('D, d M Y H:i:s', empty($row['article_date']) ? time() : $row['article_date']) .' GMT');
 166      header('Cache-Control: public, max-age='.$phpwcms['cache_timeout']);
 167      header('Pragma: public');
 168  }
 169  
 170  // write phpwcms release information in a custom HTTP header
 171  header('X-phpwcms-Release: ' . $phpwcms["release"] . ' ('.$phpwcms["release_date"].')');
 172  
 173  // retrieve complete processing time
 174  list($usec, $sec) = explode(' ', microtime());
 175  header('X-phpwcms-Page-Processed-In: ' . number_format(1000*($usec + $sec - $phpwcms_rendering_start), 3) .' ms');
 176  
 177  // print PDF
 178  if($aktion[2] === 1 && defined('PRINT_PDF') && PRINT_PDF) {
 179      require_once  (PHPWCMS_ROOT.'/include/inc_front/pdf.inc.php');
 180  
 181  // handle output action and section
 182  } elseif($phpwcms['output_action']) {
 183      
 184      if(empty($phpwcms['output_function_filter']) || !is_array($phpwcms['output_function_filter'])) {
 185          $phpwcms['output_function_filter'] = array('trim', 'strip_tags');
 186      }
 187      
 188      $phpwcms['output_function'] = array_intersect($phpwcms['output_function_filter'], $phpwcms['output_function']);
 189  
 190      $content = ob_get_contents();
 191      ob_end_clean();
 192  
 193      $sections = '';
 194  
 195      foreach($phpwcms['output_section'] as $section) {
 196      
 197          $section = get_tmpl_section($section, $content);
 198          
 199          foreach($phpwcms['output_function'] as $function) {
 200      
 201              $section = $function($section);
 202      
 203          }
 204          
 205          $sections .= $section;
 206      }
 207      
 208      // return preg_replace('/<!--(.|\s)*?-->/', '', $buffer);
 209      echo trim($sections) == '' ? $content : $sections;
 210      
 211      exit();
 212  }
 213  
 214  // send buffer to browser
 215  ob_end_flush();
 216  
 217  ?>


Generated: Tue Nov 16 22:51:00 2010 Cross-referenced by PHPXref 0.7