[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2009 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 // BOT check 48 $IS_A_BOT = false; 49 50 if( !empty($_SERVER['HTTP_USER_AGENT']) ) { 51 52 if(empty($phpwcms["BOTS"]) || !is_array($phpwcms["BOTS"])) { 53 $phpwcms["BOTS"] = array('googlebot', 'msnbot', 'bingbot', 'ia_archiver', 'altavista', 'slurp', 'yahoo', 'jeeves', 'teoma', 'lycos', 'crawler'); 54 } 55 56 $_HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']); 57 58 foreach($phpwcms["BOTS"] as $value) { 59 if(strpos($_HTTP_USER_AGENT, $value) !== FALSE) { 60 $IS_A_BOT = true; 61 break; 62 } 63 } 64 } 65 66 // start session - neccessary if frontend users are available 67 // but neccessary also to check if a bot is visiting the site 68 // -> if so then do not initialize session for larger search engines 69 if(!$IS_A_BOT && !empty($phpwcms['SESSION_FEinit'])) { 70 _initSession(); 71 } 72 73 // some initial actions 74 cleanupPOSTandGET(); 75 buildGlobalGET(); 76 define('FE_CURRENT_URL', abs_url(array(),array('phpwcms_output_action')) ); 77 78 // init some special rights and also frontend edit 79 init_frontend_edit(); 80 81 // buffer everything 82 ob_start(); 83 84 $content['page_end'] = ''; 85 86 require_once PHPWCMS_ROOT.'/config/phpwcms/conf.template_default.inc.php'; 87 require_once PHPWCMS_ROOT.'/config/phpwcms/conf.indexpage.inc.php'; 88 require_once PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'; 89 require_once PHPWCMS_ROOT.'/include/inc_front/cnt.lang.inc.php'; 90 require_once PHPWCMS_ROOT.'/include/inc_lib/modules.check.inc.php'; 91 require_once PHPWCMS_ROOT.'/include/inc_lib/article.contenttype.inc.php'; 92 require PHPWCMS_ROOT.'/include/inc_lib/imagick.convert.inc.php'; 93 require PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php'; 94 require PHPWCMS_ROOT.'/include/inc_front/ext.func.inc.php'; 95 require PHPWCMS_ROOT.'/include/inc_front/content.func.inc.php'; 96 97 98 // SEO logging 99 if(!empty($phpwcms['enable_seolog']) && !empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false) { 100 $phpwcms['seo_referrer_data'] = seReferrer( $_SERVER['HTTP_REFERER'] ); 101 if( is_array( $phpwcms['seo_referrer_data'] ) ) { 102 @_dbInsert('phpwcms_log_seo', $phpwcms['seo_referrer_data'], 'DELAYED'); 103 } 104 } 105 106 if(!empty($phpwcms['Bad_Behavior'])) { 107 require PHPWCMS_ROOT.'/include/inc_module/mod_bad-behavior/bad-behavior-phpwcms.php'; 108 } 109 110 $phpwcms["templates"] = TEMPLATE_PATH; 111 112 $phpwcms['DOCTYPE_LANG'] = str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE_LANG ); 113 114 $content['page_start'] = str_replace( '{DOCTYPE_LANG}', $phpwcms['DOCTYPE_LANG'], PHPWCMS_DOCTYPE ); 115 $content['page_start'] .= '<!-- 116 phpwcms | free open source content management system 117 created by Oliver Georgi (oliver at phpwcms dot de) and licensed under GNU/GPL. 118 phpwcms is copyright 2003-'.date('Y').' of Oliver Georgi. Extensions are copyright of 119 their respective owners. Visit project page for details: http://www.phpwcms.org/'.LF.'//-->'.LF; 120 $content['page_start'] .= '<title>'.html_specialchars($content["pagetitle"]).'</title>'.LF; 121 $content['page_start'] .= ' <meta http-equiv="content-type" content="'.$_use_content_type.'; charset='.PHPWCMS_CHARSET.'"'.HTML_TAG_CLOSE.LF; 122 $content['page_start'] .= ' <meta http-equiv="content-style-type" content="text/css"'.HTML_TAG_CLOSE.LF; 123 $content['page_start'] .= get_body_attributes($pagelayout); 124 125 // now add all CSS files here 126 if(count($block['css'])) { 127 foreach($block['css'] as $value) { 128 $content['page_start'] .= ' <link rel="stylesheet" type="text/css" href="'.TEMPLATE_PATH.'inc_css/'; 129 $content['page_start'] .= str_replace(' ', '%20', $value); 130 $content['page_start'] .= '"'.HTML_TAG_CLOSE.LF; 131 } 132 } 133 134 $content['page_start'] .= $block["htmlhead"]; 135 if(!empty($phpwcms['IE_htc_hover']) || !empty($phpwcms['IE_htc_png'])) { 136 $content['page_start'] .= ' <!--[if lt IE 7]>'.LF; 137 $content['page_start'] .= ' <style type="text/css">'.LF; 138 if(!empty($phpwcms['IE_htc_hover'])) { 139 $content['page_start'] .= ' body { behavior: url("'.TEMPLATE_PATH.'inc_css/specific/csshover2.htc"); }'.LF; 140 } 141 if(!empty($phpwcms['IE_htc_png'])) { 142 $content['page_start'] .= ' img { behavior: url("'.TEMPLATE_PATH.'inc_css/specific/'; 143 $content['page_start'] .= $phpwcms['IE_htc_png']==1 ? 'iepngfix' : 'pngbehavior'; 144 $content['page_start'] .= '.htc"); }'.LF; 145 } 146 $content['page_start'] .= ' </style>'.LF; 147 $content['page_start'] .= ' <![endif]-->'.LF; 148 } 149 150 $content['page_start'] .= '</head>'.LF; 151 152 // inject body tag in case of class or id attribute 153 $body_inject = '<body'; 154 if($content['body_id'] !== false) { 155 if(!empty($template_default['body']['id'])) { 156 $body_inject .= ' id="'.$template_default['body']['id'].$content['body_id'].'"'; 157 } 158 if(!empty($template_default['body']['class'])) { 159 $body_inject .= ' class="'.$template_default['body']['class'].$content['body_id'].'"'; 160 } 161 } 162 $content['page_start'] .= $body_inject.'>'.LF; 163 164 // this regex's inits rewrite 165 if($phpwcms["rewrite_url"]) { 166 $content["all"] = preg_replace("/( href=\"index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\")/e", "url_search('$2')", $content["all"]); 167 $content["all"] = preg_replace("/(onclick=\"location.href='index.php?)(([a-zA-Z0-9@,\.\+&\-_=\*#\/%\?])*)(\')/e", "js_url_search('$2')", $content["all"]); 168 } 169 170 if(FE_EDIT_LINK) { 171 172 $content['page_end'] .= '<div id="fe-link" class="disabled"></div> 173 <script type="text/javascript"> 174 <!-- 175 window.addEvent("domready", function(){ 176 var felink_status = 0; 177 $$("a.fe-link").each(function(r) { 178 r.setStyle("display", "none"); 179 }); 180 $("fe-link").addEvent("click", function() { 181 if(felink_status == 1) { 182 $$("a.fe-link").each(function(r) { 183 r.setStyle("display", "none"); 184 }); 185 $("fe-link").removeClass("enabled"); 186 $("fe-link").addClass("disabled"); 187 felink_status = 0; 188 } else { 189 $$("a.fe-link").each(function(r) { 190 r.setStyle("display", ""); 191 }); 192 $("fe-link").removeClass("disabled"); 193 $("fe-link").addClass("enabled"); 194 felink_status = 1; 195 } 196 }); 197 }); 198 //--> 199 </script>'; 200 } 201 202 // real page ending 203 $content['page_end'] .= LF.'</body>'.LF.'</html>'; 204 205 // return rendered content 206 echo $content['page_start']; 207 echo $content["all"]; 208 echo $content['page_end']; 209 210 // phpwcms Default header settings 211 if($phpwcms['cache_timeout']) { 212 header('Expires: '.gmdate('D, d M Y H:i:s', time() + $phpwcms['cache_timeout']) .' GMT'); 213 header('Last-Modified: '.gmdate('D, d M Y H:i:s', empty($row['article_date']) ? time() : $row['article_date']) .' GMT'); 214 header('Cache-Control: public, max-age='.$phpwcms['cache_timeout']); 215 header('Pragma: public'); 216 } 217 218 // write phpwcms release information in a custom HTTP header 219 header('X-phpwcms-Release: ' . $phpwcms["release"] . ' ('.$phpwcms["release_date"].')'); 220 221 // retrieve complete processing time 222 list($usec, $sec) = explode(' ', microtime()); 223 header('X-phpwcms-Page-Processed-In: ' . number_format(1000*($usec + $sec - $phpwcms_rendering_start), 3) .' ms'); 224 225 // print PDF 226 if($aktion[2] === 1 && defined('PRINT_PDF') && PRINT_PDF) { 227 require_once (PHPWCMS_ROOT.'/include/inc_front/pdf.inc.php'); 228 229 // handle output action and section 230 } elseif($phpwcms['output_action']) { 231 232 if(empty($phpwcms['output_function_filter']) || !is_array($phpwcms['output_function_filter'])) { 233 $phpwcms['output_function_filter'] = array('trim', 'strip_tags'); 234 } 235 236 $phpwcms['output_function'] = array_intersect($phpwcms['output_function_filter'], $phpwcms['output_function']); 237 238 $content = ob_get_contents(); 239 ob_end_clean(); 240 241 $sections = ''; 242 243 foreach($phpwcms['output_section'] as $section) { 244 245 $section = get_tmpl_section($section, $content); 246 247 foreach($phpwcms['output_function'] as $function) { 248 249 $section = $function($section); 250 251 } 252 253 $sections .= $section; 254 } 255 256 echo trim($sections) == '' ? $content : $sections; 257 258 exit(); 259 } 260 261 // send buffer to browser 262 ob_end_flush(); 263 264 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |