b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _vars.php

Documentation is available at _vars.php

  1. <?php
  2. /**
  3.  * This file sets various arrays and variables for use in b2evolution
  4.  *
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  7.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @package evocore
  10.  * @author This file built upon code from original b2 - http://cafelog.com/
  11.  */
  12. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  13.  
  14. $b2_version '0.9.2';
  15. $new_db_version 8066;                // next time: 8070
  16.  
  17. // Activate gettext:
  18. if( ($use_l10n == 1&& function_exists'bindtextdomain' ) )
  19. // We are going to use GETTEXT
  20.     // Specify location of translation tables :
  21.     bindtextdomain'messages'dirname(__FILE__)'/../locales');
  22.     // Choose domain: (name of the .mo files)
  23.     textdomain'messages' );
  24. }
  25.  
  26. // Investigation for following code by Isaac - http://isaac.beigetower.org/
  27. // $debug = true;
  28. ifisset($_SERVER['REQUEST_URI']&& !empty($_SERVER['REQUEST_URI']) )
  29. // Warning: on some IIS installs it it set but empty!
  30.     // Besides, use of explode is not very efficient so other methods are preferred.
  31.     debug_log"Getting ReqURI from 'REQUEST_URI'" );
  32.     $ReqURI $_SERVER['REQUEST_URI'];
  33.     // Remove params from reqURI:
  34.     $ReqPath explode'?'$ReqURI);
  35.     $ReqPath $ReqPath[0];
  36. }
  37. elseifisset($_SERVER['URL']) )
  38. // ISAPI
  39.     debug_log"Getting ReqPath from 'URL'" );
  40.     $ReqPath $_SERVER['URL'];
  41.     $ReqURI = isset($_SERVER['QUERY_STRING']&& !empty$_SERVER['QUERY_STRING'($ReqPath.'?'.$_SERVER['QUERY_STRING']$ReqPath;
  42. }
  43. elseifisset($_SERVER['PATH_INFO']) )
  44. // CGI/FastCGI
  45.     debug_log"Getting ReqPath from 'PATH_INFO'" );
  46.     $ReqPath $_SERVER['PATH_INFO'];
  47.     $ReqURI = isset($_SERVER['QUERY_STRING']&& !empty$_SERVER['QUERY_STRING'($ReqPath.'?'.$_SERVER['QUERY_STRING']$ReqPath;
  48. }
  49. elseifisset($_SERVER['ORIG_PATH_INFO']) )
  50. // Tomcat 5.5.x with Herbelin PHP servlet and PHP 5.1
  51.     debug_log"Getting ReqPath from 'ORIG_PATH_INFO'" );
  52.     $ReqPath $_SERVER['ORIG_PATH_INFO'];
  53.     $ReqURI = isset($_SERVER['QUERY_STRING']&& !empty$_SERVER['QUERY_STRING'($ReqPath.'?'.$_SERVER['QUERY_STRING']$ReqPath;
  54. }
  55. elseifisset($_SERVER['SCRIPT_NAME']) )
  56. // Some Odd Win2k Stuff
  57.     debug_log"Getting ReqPath from 'SCRIPT_NAME'" );
  58.     $ReqPath $_SERVER['SCRIPT_NAME'];
  59.     $ReqURI = isset($_SERVER['QUERY_STRING']&& !empty$_SERVER['QUERY_STRING'($ReqPath.'?'.$_SERVER['QUERY_STRING']$ReqPath;
  60. }
  61. elseifisset($_SERVER['PHP_SELF']) )
  62. // The Old Stand-By
  63.     debug_log"Getting ReqPath from 'PHP_SELF'" );
  64.     $ReqPath $_SERVER['PHP_SELF'];
  65.     $ReqURI = isset($_SERVER['QUERY_STRING']&& !empty$_SERVER['QUERY_STRING'($ReqPath.'?'.$_SERVER['QUERY_STRING']$ReqPath;
  66. }
  67. else
  68. {
  69.     $ReqPath false;
  70.     $ReqURI false;
  71.     ?>
  72.     <p><span class="error">Warning: $ReqPath could not be set. Probably an odd IIS problem.</span><br />
  73.     Go to your <a href="<?php echo $baseurl.'/'.$install_subdir ?>/phpinfo.php">phpinfo page</a>,
  74.     look for occurences of <code><?php
  75.     // take the baseurlroot out..
  76.     echo preg_replace('#^'.$baseurlroot.'#'''$baseurl.'/'.$install_subdir )
  77.     ?>/phpinfo.php</code> and copy all lines
  78.     containing this to the <a href="http://forums.b2evolution.net">forum</a>. Also specify what webserver
  79.     you're running on.
  80.     <br />
  81.     (If you have deleted your install folder &ndash; what is recommened after successful setup &ndash;
  82.     you have to upload it again before doing this).
  83.     </p>
  84.     <?php
  85. }
  86.  
  87. debug_log'Request URI: '.$ReqURI );
  88. debug_log'Request Path: '.$ReqPath );
  89.  
  90.  
  91.  
  92. // on which page are we ?
  93. $pagenow explode'/'$_SERVER['PHP_SELF');
  94. $pagenow trim$pagenow[(sizeof($pagenow1));
  95. $pagenow explode'?'$pagenow );
  96. $pagenow $pagenow[0];
  97.  
  98. // So far, we did not include the javascript for popupups
  99. $b2commentsjavascript false;
  100.  
  101. // browser detection
  102. $is_lynx 0$is_gecko 0$is_winIE 0$is_macIE 0$is_opera 0$is_NS4 0;
  103. if!isset($HTTP_USER_AGENT) )
  104. {
  105.     ifisset($_SERVER['HTTP_USER_AGENT']) )
  106.         $HTTP_USER_AGENT $_SERVER['HTTP_USER_AGENT'];
  107.     else
  108.         $HTTP_USER_AGENT '';
  109. }
  110. if$HTTP_USER_AGENT != '' )
  111. {
  112.     if(strpos($HTTP_USER_AGENT'Lynx'!== false)
  113.     {
  114.         $is_lynx 1;
  115.     }
  116.     elseif(strpos($HTTP_USER_AGENT'Gecko'!== false)
  117.     {
  118.         $is_gecko 1;
  119.     }
  120.     elseif(strpos($HTTP_USER_AGENT'MSIE'!== false && strpos($HTTP_USER_AGENT'Win'!== false)
  121.     {
  122.         $is_winIE 1;
  123.     }
  124.     elseif(strpos($HTTP_USER_AGENT'MSIE'!== false && strpos($HTTP_USER_AGENT'Mac'!== false)
  125.     {
  126.         $is_macIE 1;
  127.     }
  128.     elseif(strpos($HTTP_USER_AGENT'Opera'!== false)
  129.     {
  130.         $is_opera 1;
  131.     }
  132.     elseif(strpos($HTTP_USER_AGENT'Nav'!== false || preg_match('/Mozilla\/4\./'$HTTP_USER_AGENT))
  133.     {
  134.         $is_NS4 1;
  135.     }
  136.  
  137.     if ($HTTP_USER_AGENT != strip_tags($HTTP_USER_AGENT))
  138.     // then they have tried something funky,
  139.         // putting HTML or PHP into the HTTP_USER_AGENT
  140.         debug_log'setting vars: '.T_('bad char in User Agent'));
  141.         $HTTP_USER_AGENT T_('bad char in User Agent');
  142.     }
  143.  
  144. }
  145. $is_IE (($is_macIE|| ($is_winIE));
  146. // debug_log( 'setting vars: '. "User Agent: ".$HTTP_USER_AGENT);
  147.  
  148.  
  149. // server detection
  150. $is_Apache strpos($_SERVER['SERVER_SOFTWARE']'Apache'!== false 0;
  151. $is_IIS    strpos($_SERVER['SERVER_SOFTWARE']'Microsoft-IIS'!== false 0;
  152.  
  153.  
  154. // the weekdays and the months..
  155. $weekday[0NT_('Sunday');
  156. $weekday[1NT_('Monday');
  157. $weekday[2NT_('Tuesday');
  158. $weekday[3NT_('Wednesday');
  159. $weekday[4NT_('Thursday');
  160. $weekday[5NT_('Friday');
  161. $weekday[6NT_('Saturday');
  162.  
  163. // the weekdays short form (typically 3 letters)
  164. // TRANS: abbrev. for Sunday
  165. $weekday_abbrev[0NT_('Sun');
  166. // TRANS: abbrev. for Monday
  167. $weekday_abbrev[1NT_('Mon');
  168. // TRANS: abbrev. for Tuesday
  169. $weekday_abbrev[2NT_('Tue');
  170. // TRANS: abbrev. for Wednesday
  171. $weekday_abbrev[3NT_('Wed');
  172. // TRANS: abbrev. for Thursday
  173. $weekday_abbrev[4NT_('Thu');
  174. // TRANS: abbrev. for Friday
  175. $weekday_abbrev[5NT_('Fri');
  176. // TRANS: abbrev. for Saturday
  177. $weekday_abbrev[6NT_('Sat');
  178.  
  179. // the weekdays even shorter form (typically 1 letter)
  180. // TRANS: abbrev. for Sunday
  181. $weekday_letter[0NT_(' S ');
  182. // TRANS: abbrev. for Monday
  183. $weekday_letter[1NT_(' M ');
  184. // TRANS: abbrev. for Tuesday
  185. $weekday_letter[2NT_(' T ');
  186. // TRANS: abbrev. for Wednesday
  187. $weekday_letter[3NT_(' W ');
  188. // TRANS: abbrev. for Thursday
  189. $weekday_letter[4NT_(' T  ');
  190. // TRANS: abbrev. for Friday
  191. $weekday_letter[5NT_(' F ');
  192. // TRANS: abbrev. for Saturday
  193. $weekday_letter[6NT_(' S  ');
  194.  
  195. // the months
  196. $month['01'NT_('January');
  197. $month['02'NT_('February');
  198. $month['03'NT_('March');
  199. $month['04'NT_('April');
  200. // TRANS: space at the end only to differentiate from short form. You don't need to keep it in the translation.
  201. $month['05'NT_('May ');
  202. $month['06'NT_('June');
  203. $month['07'NT_('July');
  204. $month['08'NT_('August');
  205. $month['09'NT_('September');
  206. $month['10'NT_('October');
  207. $month['11'NT_('November');
  208. $month['12'NT_('December');
  209.  
  210. // the months short form (typically 3 letters)
  211. // TRANS: abbrev. for January
  212. $month_abbrev['01'NT_('Jan');
  213. // TRANS: abbrev. for February
  214. $month_abbrev['02'NT_('Feb');
  215. // TRANS: abbrev. for March
  216. $month_abbrev['03'NT_('Mar');
  217. // TRANS: abbrev. for April
  218. $month_abbrev['04'NT_('Apr');
  219. // TRANS: abbrev. for May
  220. $month_abbrev['05'NT_('May');
  221. // TRANS: abbrev. for June
  222. $month_abbrev['06'NT_('Jun');
  223. // TRANS: abbrev. for July
  224. $month_abbrev['07'NT_('Jul');
  225. // TRANS: abbrev. for August
  226. $month_abbrev['08'NT_('Aug');
  227. // TRANS: abbrev. for September
  228. $month_abbrev['09'NT_('Sep');
  229. // TRANS: abbrev. for October
  230. $month_abbrev['10'NT_('Oct');
  231. // TRANS: abbrev. for November
  232. $month_abbrev['11'NT_('Nov');
  233. // TRANS: abbrev. for December
  234. $month_abbrev['12'NT_('Dec');
  235.  
  236. // the post statuses:
  237. $post_statuses array (
  238.     'published' => NT_('Published'),
  239.     'deprecated' => NT_('Deprecated'),
  240.     'protected' => NT_('Protected'),
  241.     'private' => NT_('Private'),
  242.     'draft' => NT_('Draft'),
  243. );
  244.  
  245. // the antispam sources:
  246. $aspm_sources array (
  247.     'local' => NT_('Local'),
  248.     'reported' => NT_('Reported'),
  249.     'central' => NT_('Central'),
  250. );
  251.  
  252. ?>

Documentation generated on Tue, 20 May 2008 01:55:59 +0200 by phpDocumentor 1.4.2