]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/vars.php
Wordpress 2.0.4
[autoinstalls/wordpress.git] / wp-includes / vars.php
1 <?php
2
3 // On which page are we ?
4 if (preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches)) {
5         $pagenow = $self_matches[1];
6 } else if (strstr($PHP_SELF, '?')) {
7         $pagenow = explode('/', $PHP_SELF);
8         $pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
9         $pagenow = explode('?', $pagenow);
10         $pagenow = $pagenow[0];
11 } else {
12         $pagenow = 'index.php';
13 }
14
15 // Simple browser detection
16 $is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0;
17
18 if (preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT'])) {
19         $is_lynx = 1;
20 } elseif (preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT'])) {
21         $is_gecko = 1;
22 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']))) {
23         $is_winIE = 1;
24 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']))) {
25         $is_macIE = 1;
26 } elseif (preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT'])) {
27         $is_opera = 1;
28 } elseif ((preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) ) || (preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']))) {
29         $is_NS4 = 1;
30 }
31 $is_IE    = (($is_macIE) || ($is_winIE));
32
33 // Server detection
34 $is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;
35 $is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
36
37 // On OS X Server, $_SERVER['REMOTE_ADDR'] is the server's address. Workaround this 
38 // by using $_SERVER['HTTP_PC_REMOTE_ADDR'], which *is* the remote address.
39 if ( isset($_SERVER['HTTP_PC_REMOTE_ADDR']) )
40         $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_PC_REMOTE_ADDR'];
41
42 // if the config file does not provide the smilies array, let's define it here
43 if (!isset($wpsmiliestrans)) {
44         $wpsmiliestrans = array(
45         ':mrgreen:'     => 'icon_mrgreen.gif',
46         ':neutral:'     => 'icon_neutral.gif',
47         ':twisted:'     => 'icon_twisted.gif',
48         ':arrow:'       => 'icon_arrow.gif',
49         ':shock:'       => 'icon_eek.gif',
50         ':smile:'       => 'icon_smile.gif',
51         ' :???:'        => 'icon_confused.gif',
52         ':cool:'        => 'icon_cool.gif',
53         ':evil:'        => 'icon_evil.gif',
54         ':grin:'        => 'icon_biggrin.gif',
55         ':idea:'        => 'icon_idea.gif',
56         ':oops:'        => 'icon_redface.gif',
57         ':razz:'        => 'icon_razz.gif',
58         ':roll:'        => 'icon_rolleyes.gif',
59         ':wink:'        => 'icon_wink.gif',
60         ':cry:'         => 'icon_cry.gif',
61         ':eek:'         => 'icon_surprised.gif',
62         ':lol:'         => 'icon_lol.gif',
63         ':mad:'         => 'icon_mad.gif',
64         ':sad:'         => 'icon_sad.gif',
65         ' 8-)'          => 'icon_cool.gif',
66         ' 8-O'          => 'icon_eek.gif',
67         ' :-('          => 'icon_sad.gif',
68         ' :-)'          => 'icon_smile.gif',
69         ' :-?'          => 'icon_confused.gif',
70         ' :-D'          => 'icon_biggrin.gif',
71         ' :-P'          => 'icon_razz.gif',
72         ' :-o'          => 'icon_surprised.gif',
73         ' :-x'          => 'icon_mad.gif',
74         ' :-|'          => 'icon_neutral.gif',
75         ' ;-)'          => 'icon_wink.gif',
76         ' 8)'           => 'icon_cool.gif',
77         ' 8O'           => 'icon_eek.gif',
78         ' :('           => 'icon_sad.gif',
79         ' :)'           => 'icon_smile.gif',
80         ' :?'           => 'icon_confused.gif',
81         ' :D'           => 'icon_biggrin.gif',
82         ' :P'           => 'icon_razz.gif',
83         ' :o'           => 'icon_surprised.gif',
84         ' :x'           => 'icon_mad.gif',
85         ' :|'           => 'icon_neutral.gif',
86         ' ;)'           => 'icon_wink.gif',
87         ':!:'           => 'icon_exclaim.gif',
88         ':?:'           => 'icon_question.gif',
89         );
90 }
91
92
93 // generates smilies' search & replace arrays
94 foreach($wpsmiliestrans as $smiley => $img) {
95         $wp_smiliessearch[] = $smiley;
96         $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
97         $wp_smiliesreplace[] = " <img src='" . get_settings('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
98 }
99
100 ?>