diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-11-19 17:27:03 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-11-19 17:27:03 -0500 |
commit | 24503e3abe705acde2df159aeae61be0d009f92e (patch) | |
tree | 8debbd53dcd0db2f5934c5e2af4e697e3787781d | |
download | fourisland-24503e3abe705acde2df159aeae61be0d009f92e.tar.gz fourisland-24503e3abe705acde2df159aeae61be0d009f92e.tar.bz2 fourisland-24503e3abe705acde2df159aeae61be0d009f92e.zip |
Imported sources
276 files changed, 18193 insertions, 0 deletions
diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..8738a13 --- /dev/null +++ b/.htaccess | |||
@@ -0,0 +1,37 @@ | |||
1 | RewriteEngine On | ||
2 | |||
3 | RewriteRule ^blog/$ /index.php?area=blog [QSA,L] | ||
4 | RewriteRule ^blog/author/(.+).php /index.php?area=blog&author=$1 [QSA,L] | ||
5 | RewriteRule ^blog/tag/(.+).php /index.php?area=blog&tag=$1 [QSA,L] | ||
6 | RewriteRule ^blog/(.+)/ /index.php?area=blog&post=$1 [QSA,L] | ||
7 | |||
8 | RewriteRule ^comments/(.+)/ /index.php?area=comment&id=$1 [QSA,L] | ||
9 | |||
10 | RewriteRule ^wiki/$ /wiki/Main_Page [QSA] | ||
11 | RewriteCond %{REQUEST_FILENAME} !-f | ||
12 | RewriteCond %{REQUEST_FILENAME} !-d | ||
13 | RewriteRule ^wiki/(.+) /w/index.php?title=$1 [QSA,L] | ||
14 | |||
15 | RewriteRule ^poll/$ /index.php?area=poll [QSA,L] | ||
16 | RewriteRule ^poll/(.+).php /index.php?area=poll&id=$1 [QSA,L] | ||
17 | |||
18 | RewriteRule ^quotes/$ /index.php?area=quotes [QSA,L] | ||
19 | RewriteRule ^quotes/(.+).php /index.php?area=quotes&act=$1 [QSA,L] | ||
20 | |||
21 | RewriteRule ^admin/$ /index.php?area=admin [QSA,L] | ||
22 | RewriteRule ^admin/(.+).php /index.php?area=admin&page=$1 [QSA,L] | ||
23 | |||
24 | RewriteRule ^error/$ /index.php?area=error [QSA,L] | ||
25 | RewriteRule ^error/(.+).php /index.php?area=error&id=$1 [QSA,L] | ||
26 | |||
27 | RewriteRule ^projects/ - [L] | ||
28 | |||
29 | RewriteRule ^comic/$ /index.php?area=comic [QSA,L] | ||
30 | RewriteRule ^comic/(.+)/ /index.php?area=comic&comic=$1 [QSA,L] | ||
31 | |||
32 | RewriteCond %{REQUEST_FILENAME} !-f | ||
33 | RewriteCond %{REQUEST_FILENAME} !-d | ||
34 | RewriteRule ^(.+).php /index.php?area=$1 [QSA,L] | ||
35 | |||
36 | RewriteCond %{HTTP_HOST} ^www.fourisland.com [NC] | ||
37 | RewriteRule ^(.*)$ http://fourisland.com/$1 [R=301,NC] | ||
diff --git a/favicon.ico b/favicon.ico new file mode 100755 index 0000000..2f6633c --- /dev/null +++ b/favicon.ico | |||
Binary files differ | |||
diff --git a/header.inc b/header.inc new file mode 100644 index 0000000..2d677f2 --- /dev/null +++ b/header.inc | |||
@@ -0,0 +1,25 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 header.inc | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | ?> | ||
diff --git a/headerproc.php b/headerproc.php new file mode 100644 index 0000000..80310ac --- /dev/null +++ b/headerproc.php | |||
@@ -0,0 +1,31 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 headerproc.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDED') && defined('S_INCLUDE_FILE')) | ||
22 | { | ||
23 | header('Location: /hackersdie.php'); | ||
24 | exit; | ||
25 | } | ||
26 | |||
27 | if (!defined('S_INCLUDED')) {define('S_INCLUDED',1);} | ||
28 | |||
29 | set_include_path(get_include_path() . ':' . $_SERVER['DOCUMENT_ROOT']); | ||
30 | |||
31 | ?> | ||
diff --git a/includes/bbcode.php b/includes/bbcode.php new file mode 100644 index 0000000..4a1870a --- /dev/null +++ b/includes/bbcode.php | |||
@@ -0,0 +1,151 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/bbcode.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $bbcode = bbcode_create(array('' => array('type' => BBCODE_TYPE_ROOT))); | ||
26 | |||
27 | // [b][/b] - Bold | ||
28 | bbcode_add_element($bbcode,'b',array( 'type' => BBCODE_TYPE_NOARG, | ||
29 | 'open_tag' => '<B>', | ||
30 | 'close_tag' => '</B>')); | ||
31 | |||
32 | // [i][/i] - Italic | ||
33 | bbcode_add_element($bbcode,'i',array( 'type' => BBCODE_TYPE_NOARG, | ||
34 | 'open_tag' => '<I>', | ||
35 | 'close_tag' => '</I>')); | ||
36 | |||
37 | // [url][/url] - [url=][/url] - Link | ||
38 | bbcode_add_element($bbcode,'url',array( 'type' => BBCODE_TYPE_OPTARG, | ||
39 | 'open_tag' => '<a href="{PARAM}">', | ||
40 | 'close_tag' => '</a>', | ||
41 | 'default_arg' => '{CONTENT}')); | ||
42 | |||
43 | // [img][/img] - [img=][/img] - Image | ||
44 | bbcode_add_element($bbcode,'img',array( 'type' => BBCODE_TYPE_OPTARG, | ||
45 | 'open_tag' => '<IMG SRC="', | ||
46 | 'close_tag' => '" ALT="{PARAM}" ALIGN="RIGHT"></IMG>', | ||
47 | 'default_tag' => '{CONTENT}')); | ||
48 | |||
49 | // [big][/big] - Big | ||
50 | bbcode_add_element($bbcode,'big',array( 'type' => BBCODE_TYPE_NOARG, | ||
51 | 'open_tag' => '<BIG>', | ||
52 | 'close_tag' => '</BIG>')); | ||
53 | |||
54 | // [small][/small] - Small | ||
55 | bbcode_add_element($bbcode,'small',array( 'type' => BBCODE_TYPE_NOARG, | ||
56 | 'open_tag' => '<SMALL>', | ||
57 | 'close_tag' => '</SMALL>')); | ||
58 | |||
59 | // [ul][/ul] - Unordered List | ||
60 | bbcode_add_element($bbcode,'ul',array( 'type' => BBCODE_TYPE_NOARG, | ||
61 | 'open_tag' => '<UL>', | ||
62 | 'close_tag' => '</UL>', | ||
63 | 'childs' => 'li')); | ||
64 | |||
65 | // [ol][/ol] - Ordered List | ||
66 | bbcode_add_element($bbcode,'ol',array( 'type' => BBCODE_TYPE_NOARG, | ||
67 | 'open_tag' => '<OL>', | ||
68 | 'close_tag' => '</OL>', | ||
69 | 'childs' => 'li')); | ||
70 | |||
71 | // [li][/li] - List Item | ||
72 | bbcode_add_element($bbcode,'li',array( 'type' => BBCODE_TYPE_NOARG, | ||
73 | 'open_tag' => '<LI>', | ||
74 | 'close_tag' => '</LI>')); | ||
75 | |||
76 | // [code][/code] - Code | ||
77 | bbcode_add_element($bbcode,'code',array( 'type' => BBCODE_TYPE_NOARG, | ||
78 | 'open_tag' => '<CODE>', | ||
79 | 'close_tag' => '</CODE>')); | ||
80 | |||
81 | // [pre][/pre] - Preformatted Code | ||
82 | bbcode_add_element($bbcode,'pre',array( 'type' => BBCODE_TYPE_NOARG, | ||
83 | 'open_tag' => '<P><DIV CLASS="autosize"><DIV CLASS="bubble"><DIV CLASS="bquote"><BLOCKQUOTE><DIV><PRE>', | ||
84 | 'close_tag' => '</PRE></DIV></BLOCKQUOTE></DIV></DIV></DIV><DIV CLASS="cleardiv"></DIV>')); | ||
85 | |||
86 | function bb_fixCode($string) | ||
87 | { | ||
88 | $he = htmlentities($string); | ||
89 | $br = nl2br($he); | ||
90 | $sp = str_replace(' ',' $nbsp;',$br); | ||
91 | $ta = str_replace(' ',' ',$sp); | ||
92 | return($ta); | ||
93 | } | ||
94 | |||
95 | // [blog][/blog] - Blog Link | ||
96 | bbcode_add_element($bbcode,'blog',array( 'type' => BBCODE_TYPE_OPTARG, | ||
97 | 'open_tag' => (isset($oldBlog) ? '<A HREF="/archives/{CONTENT}.php">' : '<A HREF="/blog/{PARAM}/">'), | ||
98 | 'close_tag' => '</A>', | ||
99 | 'default_arg' => '{CONTENT}')); | ||
100 | |||
101 | // [quote][/quote] - Quotes DB Link | ||
102 | bbcode_add_element($bbcode,'quote',array( 'type' => BBCODE_TYPE_NOARG, | ||
103 | 'open_tag' => (isset($oldBlog) ? '<A HREF="http://quotes.fourisland.com/?{CONTENT}">#' : '<A HREF="/quotes/{CONTENT}.php">#'), | ||
104 | 'close_tag' => '</A>')); | ||
105 | |||
106 | // [ins][/ins] - Insert | ||
107 | bbcode_add_element($bbcode,'ins',array( 'type' => BBCODE_TYPE_NOARG, | ||
108 | 'open_tag' => '<INS>', | ||
109 | 'close_tag' => '</INS>')); | ||
110 | |||
111 | // [del][/del] - Delete | ||
112 | bbcode_add_element($bbcode,'del',array( 'type' => BBCODE_TYPE_NOARG, | ||
113 | 'open_tag' => '<DEL>', | ||
114 | 'close_tag' => '</DEL>')); | ||
115 | |||
116 | // [bquote][/bquote] - Blockquote | ||
117 | bbcode_add_element($bbcode,'bquote',array( 'type' => BBCODE_TYPE_OPTARG, | ||
118 | 'open_tag' => '<P><DIV CLASS="autosize"><DIV CLASS="bubble"><DIV CLASS="bquote"><BLOCKQUOTE><DIV><NOBR>', | ||
119 | 'close_tag' => '</NOBR></DIV></BLOCKQUOTE></DIV><CITE><STRONG>{PARAM}</STRONG></CITE></DIV></DIV><DIV CLASS="cleardiv"></DIV>', | ||
120 | 'default_arg' => 'Anonymous')); | ||
121 | |||
122 | // [project][/project] - Project Link | ||
123 | bbcode_add_element($bbcode,'project',array( 'type' => BBCODE_TYPE_NOARG, | ||
124 | 'open_tag' => (isset($oldBlog) ? '<A HREF="http://projects.fourisland.com/{CONTENT}/">' : '<A HREF="/projects/{CONTENT}/">'), | ||
125 | 'close_tag' => '</A>')); | ||
126 | |||
127 | // [abbr][/abbr] - Abbreviation | ||
128 | bbcode_add_element($bbcode,'abbr',array( 'type' => BBCODE_TYPE_OPTARG, | ||
129 | 'open_tag' => '<ABBR TITLE="{PARAM}">', | ||
130 | 'close_tag' => '</ABBR>', | ||
131 | 'default_arg' => '')); | ||
132 | |||
133 | // [br] - Line Break | ||
134 | bbcode_add_element($bbcode,'br',array( 'type' => BBCODE_TYPE_SINGLE, | ||
135 | 'open_tag' => '<BR>')); | ||
136 | |||
137 | // [hidden][/hidden] - Hidden Text | ||
138 | bbcode_add_element($bbcode,'hidden',array( 'type' => BBCODE_TYPE_OPTARG, | ||
139 | 'open_tag' => '<DIV STYLE="display: none">', | ||
140 | 'close_tag' => '</DIV>', | ||
141 | 'default_arg' => '')); | ||
142 | |||
143 | function parseBBCode($text) | ||
144 | { | ||
145 | global $bbcode; | ||
146 | $to_parse = str_replace("\n",'[br]',htmlentities($text)); | ||
147 | $to_parse = bbcode_parse($bbcode,$to_parse); | ||
148 | return str_replace('[br]','',$to_parse); | ||
149 | } | ||
150 | |||
151 | ?> | ||
diff --git a/includes/comments.php b/includes/comments.php new file mode 100644 index 0000000..9cb8b18 --- /dev/null +++ b/includes/comments.php | |||
@@ -0,0 +1,97 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/comments.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | include('includes/recaptchalib.php'); | ||
26 | $publickey = "6LfgvgEAAAAAAG_BJMkWk8sNcT1nBaGoXKJYb-JT"; | ||
27 | $privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr"; | ||
28 | |||
29 | $curID = 0; | ||
30 | |||
31 | $template = new FITemplate('comments'); | ||
32 | $template->add('PAGEID',$page_id); | ||
33 | $template->add('CODEDDEF',urlencode('http://www.fourisland.com/images/error404.png')); | ||
34 | $template->add('USERNAME',(isLoggedIn() ? sess_get('uname') : 'Anonymous')); | ||
35 | |||
36 | if (!isLoggedIn()) | ||
37 | { | ||
38 | $template->add('RECAPTCHA',recaptcha_get_html($publickey)); | ||
39 | $template->adds_block('NOLOG',array('exi'=>1)); | ||
40 | } | ||
41 | |||
42 | $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; | ||
43 | $getcomments2 = mysql_query($getcomments) or die($getcomments); | ||
44 | $i=0; | ||
45 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
46 | { | ||
47 | $getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | ||
48 | $getuser2 = mysql_query($getuser); | ||
49 | $getuser3 = mysql_fetch_array($getuser2); | ||
50 | |||
51 | if ($getuser3['username'] == $getcomments3[$i]['username']) | ||
52 | { | ||
53 | $username = $getuser3['username']; | ||
54 | $email = $getuser3['user_email']; | ||
55 | $website = $getuser3['website']; | ||
56 | } else { | ||
57 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | ||
58 | $getanon2 = mysql_query($getanon); | ||
59 | $getanon3 = mysql_fetch_array($getanon2); | ||
60 | |||
61 | if ($getanon3['username'] == $getcomments3[$i]['username']) | ||
62 | { | ||
63 | $username = $getanon3['username'] . ' (Guest)'; | ||
64 | $email = $getanon3['email']; | ||
65 | $website = $getanon3['website']; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | if (isset($username)) | ||
70 | { | ||
71 | if ($getcomments3[$i]['rating'] > -2) | ||
72 | { | ||
73 | $text = parseBBCode($getcomments3[$i]['comment']); | ||
74 | } else { | ||
75 | $text = 'This comment has been rated down below the threshold for public viewing (-1), suggesting that it may contain inappropriate or off topic content. (Or it may have been flame bait, or simply bad!)'; | ||
76 | } | ||
77 | |||
78 | if ($getcomments3[$i]['title'] != '') | ||
79 | { | ||
80 | $title2 = $getcomments3[$i]['title']; | ||
81 | } else { | ||
82 | $title2 = 'Untitled'; | ||
83 | } | ||
84 | |||
85 | $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), | ||
86 | 'USERNAME' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username), | ||
87 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), | ||
88 | 'RATING' => $getcomments3[$i]['rating'], | ||
89 | 'ID' => $getcomments3[$i]['id'], | ||
90 | 'TEXT' => $text, | ||
91 | 'TITLE' => $title2)); | ||
92 | } | ||
93 | $i++; | ||
94 | } | ||
95 | $template->display(); | ||
96 | |||
97 | ?> | ||
diff --git a/includes/db.php b/includes/db.php new file mode 100755 index 0000000..8cc5449 --- /dev/null +++ b/includes/db.php | |||
@@ -0,0 +1,49 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/db.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | // Make the database connection. | ||
26 | mysql_connect($dbwebhost, $dbwebuser, $dbwebpasswd); | ||
27 | mysql_select_db($dbwebname); | ||
28 | |||
29 | function db_single_select($query) | ||
30 | { | ||
31 | $getitem1 = $query; | ||
32 | $getitem2 = mysql_query($getitem1) or die($getitem1); | ||
33 | $getitem3 = mysql_fetch_array($getitem2); | ||
34 | return $getitem3; | ||
35 | } | ||
36 | |||
37 | function db_multi_select($query, $callback) | ||
38 | { | ||
39 | $getitem1 = $query; | ||
40 | $getitem2 = mysql_query($getitem1) or die($getitem1); | ||
41 | $i=0; | ||
42 | while ($getitem3[$i] = mysql_fetch_array($getitem2)) | ||
43 | { | ||
44 | $callback($getitem3[$i]); | ||
45 | $i++; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | ?> | ||
diff --git a/includes/definitions.php b/includes/definitions.php new file mode 100644 index 0000000..581eb85 --- /dev/null +++ b/includes/definitions.php | |||
@@ -0,0 +1,52 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | *************************************************************************** | ||
4 | * Copyright (C) 2007-2008 by Sixdegrees * | ||
5 | * cesar@sixdegrees.com.br * | ||
6 | * "Working with freedom" * | ||
7 | * http://www.sixdegrees.com.br * | ||
8 | * * | ||
9 | * Permission is hereby granted, free of charge, to any person obtaining * | ||
10 | * a copy of this software and associated documentation files (the * | ||
11 | * "Software"), to deal in the Software without restriction, including * | ||
12 | * without limitation the rights to use, copy, modify, merge, publish, * | ||
13 | * distribute, sublicense, and/or sell copies of the Software, and to * | ||
14 | * permit persons to whom the Software is furnished to do so, subject to * | ||
15 | * the following conditions: * | ||
16 | * * | ||
17 | * The above copyright notice and this permission notice shall be * | ||
18 | * included in all copies or substantial portions of the Software. * | ||
19 | * * | ||
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * | ||
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * | ||
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.* | ||
23 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * | ||
24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * | ||
25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * | ||
26 | * OTHER DEALINGS IN THE SOFTWARE. * | ||
27 | *************************************************************************** | ||
28 | */ | ||
29 | define("PHPSVN_NORMAL_REQUEST",'<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"><prop> | ||
30 | <getlastmodified xmlns="DAV:"/><version-controlled-configuration xmlns="DAV:"/><resourcetype xmlns="DAV:"/><baseline-relative-path xmlns="http://subversion.tigris.org/xmlns/dav/"/><repository-uuid xmlns="http://subversion.tigris.org/xmlns/dav/"/></prop></propfind>'); | ||
31 | define("PHPSVN_VERSION_REQUEST",'<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"><prop><checked-in xmlns="DAV:"/></prop></propfind>'); | ||
32 | define("PHPSVN_LOGS_REQUEST",'<?xml version="1.0" encoding="utf-8"?> <S:log-report xmlns:S="svn:"> <S:start-revision>%d</S:start-revision><S:end-revision>%d</S:end-revision><S:path></S:path></S:log-report>'); | ||
33 | |||
34 | define("SVN_LAST_MODIFIED","lp1:getlastmodified"); | ||
35 | define("SVN_URL","D:href"); | ||
36 | define("SVN_RELATIVE_URL","lp3:baseline-relative-path"); | ||
37 | define("SVN_FILE_ID","lp3:repository-uuid"); | ||
38 | define("SVN_STATUS","D:status"); | ||
39 | define("SVN_IN_FILE","D:propstat"); | ||
40 | define("SVN_FILE","D:response"); | ||
41 | |||
42 | define("SVN_LOGS_BEGINGS","S:log-item"); | ||
43 | define("SVN_LOGS_VERSION","D:version-name"); | ||
44 | define("SVN_LOGS_AUTHOR","D:creator-displayname"); | ||
45 | define("SVN_LOGS_DATE","S:date"); | ||
46 | define("SVN_LOGS_COMMENT","D:comment"); | ||
47 | |||
48 | define("NOT_FOUND", 2); | ||
49 | define("AUTH_REQUIRED", 3); | ||
50 | define("UNKNOWN_ERROR",4); | ||
51 | define("NO_ERROR",1) | ||
52 | ?> | ||
diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..e4c88c8 --- /dev/null +++ b/includes/footer.php | |||
@@ -0,0 +1,198 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/footer.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $template = new FITemplate('footer'); | ||
26 | |||
27 | $template->add('EXTRASIDEBARS',(isset($extraSidebars) ? $extraSidebars : '')); | ||
28 | |||
29 | if (isset($onFourm)) | ||
30 | { | ||
31 | $template->adds_block('ONFOURM',array('exi'=>1)); | ||
32 | } | ||
33 | |||
34 | if (!isset($noRightbar)) | ||
35 | { | ||
36 | $template->adds_block('RIGHTBAR',array('exi'=>1)); | ||
37 | |||
38 | if (!isset($noHatNav)) | ||
39 | { | ||
40 | $template->adds_block('USEHATNAV', array('exi'=>1)); | ||
41 | if (!isset($genHatNav)) | ||
42 | { | ||
43 | $gethnis = 'SELECT * FROM hatnav WHERE category = "' . | ||
44 | $pageCategory . '"'; | ||
45 | $gethnis2 = mysql_query($gethnis); | ||
46 | $i=0; | ||
47 | while ($gethnis3[$i] = mysql_fetch_array($gethnis2)) | ||
48 | { | ||
49 | $template->adds_block('HATNAV', array( 'AID' => $gethnis3[$i]['AID'], | ||
50 | 'HREF' => $gethnis3[$i]['href'], | ||
51 | 'IMAGE' => '/theme/images/icons/' . $gethnis3[$i]['image'] . '.png', | ||
52 | 'TEXT' => $gethnis3[$i]['text'], | ||
53 | 'NEW' => dispIfNotOld($gethnis3[$i]['lastEdit']))); | ||
54 | $i++; | ||
55 | } | ||
56 | } else { | ||
57 | $i=0; | ||
58 | while ($i < $genHatNavNum) | ||
59 | { | ||
60 | $template->adds_block('HATNAV', array( 'AID' => 'post', | ||
61 | 'HREF' => $genHatNav[$i]['href'], | ||
62 | 'IMAGE' => '/theme/images/blue.PNG', | ||
63 | 'TEXT' => $genHatNav[$i]['text'], | ||
64 | 'NEW' => '')); | ||
65 | $i++; | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | |||
70 | include('pages/polloftheweek.php'); | ||
71 | |||
72 | $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; | ||
73 | $getpopular2 = mysql_query($getpopular); | ||
74 | $i=0; | ||
75 | while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) | ||
76 | { | ||
77 | $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], | ||
78 | 'TITLE' => stripslashes($getpopular3[$i]['title']))); | ||
79 | $i++; | ||
80 | } | ||
81 | |||
82 | $getcomments = "SELECT * FROM comments WHERE page_id LIKE \"updates-%\" ORDER BY id DESC LIMIT 0,5"; | ||
83 | $getcomments2 = mysql_query($getcomments); | ||
84 | $i=0; | ||
85 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
86 | { | ||
87 | $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
88 | $getpost2 = mysql_query($getpost); | ||
89 | $getpost3 = mysql_fetch_array($getpost2); | ||
90 | |||
91 | $getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | ||
92 | $getuser2 = mysql_query($getuser); | ||
93 | $getuser3 = mysql_fetch_array($getuser2); | ||
94 | |||
95 | if ($getuser3['username'] == $getcomments3[$i]['username']) | ||
96 | { | ||
97 | $username = $getuser3['username']; | ||
98 | $website = $getuser3['website']; | ||
99 | } else { | ||
100 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getcomments3[$i]['username'] . "\""; | ||
101 | $getanon2 = mysql_query($getanon); | ||
102 | $getanon3 = mysql_fetch_array($getanon2); | ||
103 | |||
104 | if ($getanon3['username'] == $getcomments3[$i]['username']) | ||
105 | { | ||
106 | $username = $getanon3['username'] . ' (Guest)'; | ||
107 | $website = $getanon3['website']; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | |||
112 | $template->adds_block('COMMENTS', array( 'CODED' => $getpost3['slug'], | ||
113 | 'TITLE' => stripslashes($getpost3['title']), | ||
114 | 'AUTHOR' => (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username))); | ||
115 | $i++; | ||
116 | } | ||
117 | |||
118 | $getusers = "SELECT DISTINCT username FROM comments"; | ||
119 | $getusers2 = mysql_query($getusers); | ||
120 | $i=0; | ||
121 | while ($getusers3[$i] = mysql_fetch_array($getusers2)) | ||
122 | { | ||
123 | $getcount = "SELECT COUNT(*) FROM comments WHERE username = \"" . $getusers3[$i]['username'] . "\""; | ||
124 | $getcount2 = mysql_query($getcount); | ||
125 | $getcount3 = mysql_fetch_array($getcount2); | ||
126 | |||
127 | $getuser = "SELECT * FROM users WHERE username = \"" . $getusers3[$i]['username'] . "\""; | ||
128 | $getuser2 = mysql_query($getuser); | ||
129 | $getuser3 = mysql_fetch_array($getuser2); | ||
130 | |||
131 | if ($getuser3['username'] == $getusers3[$i]['username']) | ||
132 | { | ||
133 | $username = $getuser3['username']; | ||
134 | $website = $getuser3['website']; | ||
135 | } else { | ||
136 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $getusers3[$i]['username'] . "\""; | ||
137 | $getanon2 = mysql_query($getanon); | ||
138 | $getanon3 = mysql_fetch_array($getanon2); | ||
139 | |||
140 | if ($getanon3['username'] == $getusers3[$i]['username']) | ||
141 | { | ||
142 | $username = $getanon3['username'] . ' (Guest)'; | ||
143 | $website = $getanon3['website']; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | $name = (($website != '') ? '<A HREF="http://' . $website . '">' . $username . '</A>' : $username); | ||
148 | $users[$name] = $getcount3[0]; | ||
149 | |||
150 | $i++; | ||
151 | } | ||
152 | |||
153 | arsort($users); | ||
154 | $i=0; | ||
155 | foreach ($users as $name => $count) | ||
156 | { | ||
157 | if ($i == 5) | ||
158 | { | ||
159 | break; | ||
160 | } | ||
161 | |||
162 | if ($name != 'Pingback') | ||
163 | { | ||
164 | $template->adds_block('TOP', array( 'USERNAME' => $name, | ||
165 | 'COUNT' => $count)); | ||
166 | $i++; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | ||
171 | $gethits2 = mysql_query($gethits); | ||
172 | $gethits3 = mysql_fetch_array($gethits2); | ||
173 | $template->add('HITS', $gethits3['value']); | ||
174 | |||
175 | $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; | ||
176 | $gethits2 = mysql_query($gethits); | ||
177 | $gethits3 = mysql_fetch_array($gethits2); | ||
178 | $template->add('TODAY', $gethits3['value']); | ||
179 | |||
180 | $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; | ||
181 | $getpost2 = mysql_query($getpost) or die($getpost); | ||
182 | $i=0; | ||
183 | while ($getpost3[$i] = mysql_fetch_array($getpost2)) | ||
184 | { | ||
185 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; | ||
186 | $getuser2 = mysql_query($getuser) or die($getuser); | ||
187 | $getuser3 = mysql_fetch_array($getuser2); | ||
188 | |||
189 | $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], | ||
190 | 'TOPIC' => $getpost3[$i]['topic_id'], | ||
191 | 'POST' => $getpost3[$i]['post_id'], | ||
192 | 'USERNAME' => $getuser3['username'])); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | $template->display(); | ||
197 | |||
198 | ?> | ||
diff --git a/includes/functions.php b/includes/functions.php new file mode 100644 index 0000000..c377c29 --- /dev/null +++ b/includes/functions.php | |||
@@ -0,0 +1,244 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/functions.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | function isLoggedIn() | ||
26 | { | ||
27 | return sess_exists('uname'); | ||
28 | } | ||
29 | |||
30 | function getUserlevel() | ||
31 | { | ||
32 | if (isLoggedIn()) | ||
33 | { | ||
34 | $getuser = "SELECT * FROM users WHERE username = \"" . sess_get('uname') . "\""; | ||
35 | $getuser2 = mysql_query($getuser); | ||
36 | $getuser3 = mysql_fetch_array($getuser2); | ||
37 | return $getuser3['user_group']; | ||
38 | } else { | ||
39 | return 4; | ||
40 | } | ||
41 | } | ||
42 | |||
43 | function countRows($table, $extra = '') | ||
44 | { | ||
45 | $cntrows = "SELECT * FROM " . $table . " " . $extra; | ||
46 | $cntrows2 = mysql_query($cntrows); | ||
47 | $i=0; | ||
48 | while ($cntrows3[$i] = mysql_fetch_array($cntrows2)) | ||
49 | { | ||
50 | $i++; | ||
51 | } | ||
52 | return $i; | ||
53 | } | ||
54 | |||
55 | function generateError($error) | ||
56 | { | ||
57 | ob_end_clean(); | ||
58 | ob_start(); | ||
59 | $errorid = $error; | ||
60 | include('pages/error.php'); | ||
61 | } | ||
62 | |||
63 | function echoLogData() | ||
64 | { | ||
65 | if (!isLoggedIn()) { | ||
66 | return('Login'); | ||
67 | } else { | ||
68 | return('Logout'); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | function dispIfNotOld($datTim) | ||
73 | { | ||
74 | if (($datTim+604800) >= time()) | ||
75 | { | ||
76 | return('<IMG SRC="/theme/images/icons/new.png" ALT="New!" BORDER="0" WIDTH=16 HEIGHT=16 STYLE="vertical-align: middle;">'); | ||
77 | } else { | ||
78 | return; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | function getpercent($getpoll3,$num) | ||
83 | { | ||
84 | $maxper = ($getpoll3['clicks1'] + $getpoll3['clicks2'] + $getpoll3['clicks3'] + $getpoll3['clicks4']); | ||
85 | $percent = round(($getpoll3['clicks' . $num] / $maxper) * 100); | ||
86 | return($percent); | ||
87 | } | ||
88 | |||
89 | function generateSlug($title,$table) | ||
90 | { | ||
91 | $title = preg_replace('/[^A-Za-z0-9]/','-',$title); | ||
92 | $title = preg_replace('/-{2,}/','-',$title); | ||
93 | if (substr($title,0,1) == '-') | ||
94 | { | ||
95 | $title = substr($title,1); | ||
96 | } | ||
97 | if (substr($title,strlen($title)-1,1) == '-') | ||
98 | { | ||
99 | $title = substr($title,0,strlen($title)-1); | ||
100 | } | ||
101 | $title = strtolower($title); | ||
102 | |||
103 | $getprevs = "SELECT COUNT(*) FROM " . $table . " WHERE slug = \"" . $title . "\" OR slug LIKE \"" . $title . "-%\""; | ||
104 | $getprevs2 = mysql_query($getprevs); | ||
105 | @$getprevs3 = mysql_fetch_array($getprevs2); | ||
106 | if ($getprevs3[0] > 0) | ||
107 | { | ||
108 | $title .= '-' . ($getprevs3[0]+1); | ||
109 | } | ||
110 | |||
111 | return($title); | ||
112 | } | ||
113 | |||
114 | function postBlogPost($title,$author,$tag1,$tag2,$tag3,$content) | ||
115 | { | ||
116 | $slug = generateSlug($title,'updates'); | ||
117 | |||
118 | $inspost = "INSERT INTO updates (title,slug,author,tag1,tag2,tag3,text) VALUES (\"" . $title . "\",\"" . $slug . "\",\"" . $author . "\",\"" . $tag1 . "\",\"" . $tag2 . "\",\"" . $tag3 . "\",\"" . addslashes($content) . "\")"; | ||
119 | $inspost2 = mysql_query($inspost); | ||
120 | |||
121 | $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; | ||
122 | $upconf2 = mysql_query($upconf); | ||
123 | |||
124 | preg_match_all('|<a\s[^>]*href="([^"]+)"|i', parseBBCode($content), $matches); | ||
125 | |||
126 | foreach ($matches[1] as $link) | ||
127 | { | ||
128 | if ($all_links[$link]) | ||
129 | { | ||
130 | continue; | ||
131 | } | ||
132 | |||
133 | $all_links[$link] = true; | ||
134 | |||
135 | if (preg_match('/^https{0,1}:/i', $link)) | ||
136 | { | ||
137 | $c = curl_init(); | ||
138 | curl_setopt($c, CURLOPT_URL, $link); | ||
139 | curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
140 | curl_setopt($c, CURLOPT_HEADER, false); | ||
141 | $page_data = curl_exec($c); | ||
142 | curl_close($c); | ||
143 | |||
144 | if (preg_match('/<LINK REL="pingback" HREF="([^"]+)"/i',$page_data,$server)) | ||
145 | { | ||
146 | $client = new xmlrpc_client($server[1]); | ||
147 | $msg = new xmlrpcmsg("pingback.ping", array( new xmlrpcval('http://www.fourisland.com/blog/' . $slug . '/', 'string'), | ||
148 | new xmlrpcval($link, 'string'))); | ||
149 | $client->send($msg); | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | |||
154 | $client = new xmlrpc_client('http://rpc.pingomatic.com'); | ||
155 | $msg = new xmlrpcmsg("weblogUpdates.ping", array( new xmlrpcval('Four Island', 'string'), | ||
156 | new xmlrpcval('http://www.fourisland.com/', 'string'))); | ||
157 | $client->send($msg); | ||
158 | } | ||
159 | |||
160 | function recalcPop($id) | ||
161 | { | ||
162 | $getpost = "SELECT * FROM updates WHERE id = " . $id; | ||
163 | $getpost2 = mysql_query($getpost); | ||
164 | $getpost3 = mysql_fetch_array($getpost2); | ||
165 | $popularity = $getpost3['home_views']; | ||
166 | $popularity += ($getpost3['views']*2); | ||
167 | $popularity += ($getpost3['rating']*5); | ||
168 | |||
169 | $getcomments = "SELECT COUNT(*) FROM comments WHERE page_id = \"updates-" . $id . "\" AND username <> \"Pingback\""; | ||
170 | $getcomments2 = mysql_query($getcomments); | ||
171 | $getcomments3 = mysql_fetch_array($getcomments2); | ||
172 | $popularity += ($getcomments3[0] * 10); | ||
173 | |||
174 | $getpings = "SELECT COUNT(*) FROM comments WHERE page_id = \"updates-" . $id . "\" AND username = \"Pingback\""; | ||
175 | $getpings2 = mysql_query($getpings); | ||
176 | $getpings3 = mysql_fetch_array($getpings2); | ||
177 | $popularity += ($getpings3[0] * 25); | ||
178 | |||
179 | $setpost = "UPDATE updates SET popularity = " . $popularity . " WHERE id = " . $id; | ||
180 | $setpost2 = mysql_query($setpost); | ||
181 | } | ||
182 | |||
183 | function updatePop($id, $area, $plus=1) | ||
184 | { | ||
185 | $gettrack = "SELECT * FROM tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
186 | $gettrack2 = mysql_query($gettrack); | ||
187 | $gettrack3 = mysql_fetch_array($gettrack2); | ||
188 | |||
189 | $trackArr = explode(',',$gettrack3[$area]); | ||
190 | |||
191 | if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($id,$trackArr) === FALSE)) | ||
192 | { | ||
193 | $setpost = "UPDATE updates SET " . $area . " = " . $area . "+" . $plus . " WHERE id = " . $id; | ||
194 | $setpost2 = mysql_query($setpost); | ||
195 | recalcPop($id); | ||
196 | |||
197 | if ($gettrack3['ip'] == $_SERVER['REMOTE_ADDR']) | ||
198 | { | ||
199 | $settrack = "UPDATE tracking SET " . $area . " = \"" . $gettrack3[$area] . "," . $id . "\" WHERE id = " . $gettrack3['id']; | ||
200 | } else { | ||
201 | $settrack = "INSERT INTO tracking (ip," . $area . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\",\"" . $id . "\")"; | ||
202 | } | ||
203 | $settrack2 = mysql_query($settrack) or die($settrack); | ||
204 | return 1; | ||
205 | } else { | ||
206 | return 0; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | function verifyUser($username, $password) | ||
211 | { | ||
212 | $getuser = 'SELECT * FROM users WHERE username = "' . $username . '" AND user_password = "' . md5($password) . '"'; | ||
213 | $getuser2 = mysql_query($getuser); | ||
214 | $getuser3 = mysql_fetch_array($getuser2); | ||
215 | return (($_POST['username'] != '') && ($getuser3['username'] == $_POST['username'])); | ||
216 | } | ||
217 | |||
218 | function updateCommentPop($id, $plus=1) | ||
219 | { | ||
220 | $gettrack = "SELECT * FROM tracking_comments WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
221 | $gettrack2 = mysql_query($gettrack); | ||
222 | $gettrack3 = mysql_fetch_array($gettrack2); | ||
223 | |||
224 | $trackArr = explode(',',$gettrack3['comment_id']); | ||
225 | |||
226 | if (($gettrack3['ip'] != $_SERVER['REMOTE_ADDR']) || (array_search($id,$trackArr) === FALSE)) | ||
227 | { | ||
228 | $setcomment = "UPDATE comments SET rating = rating+" . $plus . " WHERE id = " . $id; | ||
229 | $setcomment2 = mysql_query($setcomment); | ||
230 | |||
231 | if ($gettrack3['ip'] == $_SERVER['REMOTE_ADDR']) | ||
232 | { | ||
233 | $settrack = "UPDATE tracking SET rating = \"" . $gettrack3['comment_id'] . "," . $id . "\" WHERE id = " . $gettrack3['id']; | ||
234 | } else { | ||
235 | $settrack = "INSERT INTO tracking (ip,rating) VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\",\"" . $id . "\")"; | ||
236 | } | ||
237 | $settrack2 = mysql_query($settrack) or die($settrack); | ||
238 | return 1; | ||
239 | } else { | ||
240 | return 0; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | ?> | ||
diff --git a/includes/functions_quotes.php b/includes/functions_quotes.php new file mode 100644 index 0000000..e3ca2c0 --- /dev/null +++ b/includes/functions_quotes.php | |||
@@ -0,0 +1,195 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/functions_quotes.inc | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | function quote_generation($query, $origin, $page = 1, $quote_limit = 50, $page_limit = 10) | ||
26 | { | ||
27 | $template = new FITemplate('quotes/browse'); | ||
28 | if ($page != -1) | ||
29 | { | ||
30 | $template->adds_block('PAGENUMBERS',array('exi'=>1)); | ||
31 | page_numbers($template, $origin, $quote_limit, $page, $page_limit); | ||
32 | $up_lim = ($quote_limit * $page); | ||
33 | $low_lim = $up_lim - $quote_limit; | ||
34 | $query .= "LIMIT $low_lim,$quote_limit"; | ||
35 | } | ||
36 | $template->add('ORIGIN',$origin); | ||
37 | |||
38 | $getquotes2 = mysql_query($query); | ||
39 | $i=0; | ||
40 | while ($getquotes3[$i] = mysql_fetch_array($getquotes2)) | ||
41 | { | ||
42 | $template->adds_block('QUOTES',array( 'NUMBER' => $getquotes3[$i]['id'], | ||
43 | 'RATING' => $getquotes3[$i]['rating'], | ||
44 | 'QUOTE' => nl2br(stripslashes($getquotes3[$i]['quote'])))); | ||
45 | |||
46 | $i++; | ||
47 | } | ||
48 | |||
49 | $template->display(); | ||
50 | } | ||
51 | |||
52 | function page_numbers($template, $origin, $quote_limit, $page_default, $page_limit) | ||
53 | { | ||
54 | $numrows = countRows('rash_quotes'); | ||
55 | $testrows = $numrows; | ||
56 | $pagenum = (($testrows + 1) / ($quote_limit > 0 ? $quote_limit : 1)); | ||
57 | |||
58 | if (($page_limit % 2)) | ||
59 | { | ||
60 | $page_limit++; | ||
61 | } | ||
62 | if (($page_limit < 2) || (!$page_limit)) | ||
63 | { | ||
64 | $page_limit = 5; | ||
65 | } | ||
66 | |||
67 | $pagebase = 0; | ||
68 | do | ||
69 | { | ||
70 | $pagebase++; | ||
71 | $page_limit -= 2; | ||
72 | } while ($page_limit > 1); | ||
73 | |||
74 | $template->add('LORIGIN',strtolower($origin)); | ||
75 | $template->add('MINUSTEN',(($page_default - 10) > 1) ? ($page_default - 10) : 1); | ||
76 | |||
77 | if ($page_default - $pagebase > 1) | ||
78 | { | ||
79 | $template->add('BDDD','...'); | ||
80 | } | ||
81 | |||
82 | $i = $page_default - $pagebase; | ||
83 | do | ||
84 | { | ||
85 | if ($i > 0) | ||
86 | { | ||
87 | $template->adds_block('BPAGES',array('PAGENUM' => $i)); | ||
88 | } | ||
89 | $i++; | ||
90 | } while ($i < $page_default); | ||
91 | |||
92 | $template->add('CURPAGE',$page_default); | ||
93 | |||
94 | $i = $page_default + 1; | ||
95 | do | ||
96 | { | ||
97 | if ($i <= $pagenum) | ||
98 | { | ||
99 | $template->adds_block('APAGES',array('PAGENUM' => $i)); | ||
100 | } | ||
101 | $i++; | ||
102 | } while ($i < ($page_default + $pagebase + 1)); | ||
103 | |||
104 | if (($page_default + $pagebase) < $pagenum) | ||
105 | { | ||
106 | $template->add('ADDD','...'); | ||
107 | } | ||
108 | |||
109 | $template->add('PLUSTEN',(($page_default + 10) < $pagenum) ? ($page_default + 10) : $pagenum); | ||
110 | $template->add('LASTPAGE',$pagenum); | ||
111 | } | ||
112 | |||
113 | function user_quote_status($where, $quote_num, $template) | ||
114 | { | ||
115 | $tracking_verdict = ip_track($where, $quote_num); | ||
116 | if ($where != 'flag') | ||
117 | { | ||
118 | switch ($tracking_verdict) | ||
119 | { | ||
120 | case 1: | ||
121 | $template->add('TRACKING',"Quote has been modified, and data of your action has been recorded in the database."); | ||
122 | break; | ||
123 | case 2: | ||
124 | $template->add('TRACKING',"Quote has been modified, your IP has been logged, and data of your action has been recorded in the database."); | ||
125 | break; | ||
126 | case 3: | ||
127 | $template->add('TRACKING',"You have already voted on this quote, please try again later."); | ||
128 | break; | ||
129 | } | ||
130 | } | ||
131 | return $tracking_verdict; | ||
132 | } | ||
133 | |||
134 | function ip_track($where, $quote_num) | ||
135 | { | ||
136 | switch ($where) | ||
137 | { | ||
138 | case 'flag': | ||
139 | $where2 = 'vote'; | ||
140 | break; | ||
141 | case 'vote': | ||
142 | $where2 = 'flag'; | ||
143 | break; | ||
144 | } | ||
145 | |||
146 | $getip = "SELECT * FROM rash_tracking WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
147 | $getip2 = mysql_query($getip); | ||
148 | $getip3 = mysql_fetch_array($getip2); | ||
149 | |||
150 | if ($getip3['ip'] == $_SERVER['REMOTE_ADDR']) | ||
151 | { | ||
152 | $quote_array = explode(",", $getip3['quote_id']); | ||
153 | $quote_place = array_search($quote_num, $quote_array); | ||
154 | if (in_array($quote_num, $quote_array)) | ||
155 | { | ||
156 | $where_result = explode(",", $getip3[$where]); | ||
157 | if (!isset($where_result[$quote_place])) | ||
158 | { | ||
159 | $where_result[$quote_place] = 1; | ||
160 | $where_result = implode(",", $where_result); | ||
161 | $setip = "UPDATE rash_tracking SET " . $where . " = \"" . $where_result . "\" WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
162 | $setip2 = mysql_query($getip); | ||
163 | return 1; | ||
164 | } else { | ||
165 | return 3; | ||
166 | } | ||
167 | } else { | ||
168 | $setip = "UPDATE rash_tracking SET " . $where . " = CONCAT(" . $where . ",\",1\"), " . $where2 . " = CONCAT(" . $where2 . ",\",0\"), quote_id = CONCAT(quote_id,\"," . $quote_num . "\") WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
169 | $setip2 = mysql_query($setip); | ||
170 | return 1; | ||
171 | } | ||
172 | } else { | ||
173 | $insip = "INSERT INTO rash_tracking (ip, quote_id, " . $where . ", " . $where2 . ") VALUES (\"" . $_SERVER['REMOTE_ADDR'] . "\", \"" . $quote_num . "\", 1, 0)"; | ||
174 | $insip2 = mysql_query($insip); | ||
175 | return 2; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | function verify_int($subject) | ||
180 | { | ||
181 | $ymax = strlen($subject); | ||
182 | $y = 0; | ||
183 | while($y < $ymax) | ||
184 | { | ||
185 | if ((is_int((int)($subject{$y})) && (int)($subject{$y})) || (int)($subject{$y}) === 0 ) | ||
186 | { | ||
187 | $y++; | ||
188 | } else { | ||
189 | return false; | ||
190 | } | ||
191 | } | ||
192 | return true; | ||
193 | } | ||
194 | |||
195 | ?> | ||
diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..3bedbd7 --- /dev/null +++ b/includes/header.php | |||
@@ -0,0 +1,66 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/header.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $headerTemp = new FITemplate('header'); | ||
26 | |||
27 | if (!isset($_COOKIE['splashOnce'])) | ||
28 | { | ||
29 | setcookie('splashOnce', '1'); | ||
30 | |||
31 | $headerTemp->adds_block('SPLASH', array('exi'=>1)); | ||
32 | } | ||
33 | |||
34 | if ((date('G') >= 20) || (date('G') <= 6)) | ||
35 | { | ||
36 | $bodyID = 'night'; | ||
37 | } else { | ||
38 | $bodyID = 'day'; | ||
39 | } | ||
40 | $headerTemp->add('BODYID',$bodyID); | ||
41 | $headerTemp->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); | ||
42 | $headerTemp->add('AID',(isset($pageAID)) ? $pageAID : 'none'); | ||
43 | $headerTemp->add('BODYTAGS',(isset($bodyTags)) ? $bodyTags : ''); | ||
44 | $headerTemp->add('HEADTAGS',isset($headtags) ? $headtags : ''); | ||
45 | $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); | ||
46 | $headerTemp->add('PAGEID',(isset($pageID)) ? $pageID : 'none'); | ||
47 | |||
48 | if (!isset($noMembers)) | ||
49 | { | ||
50 | $headerTemp->add('LOWERLOGDATA',strtolower(echoLogData())); | ||
51 | $headerTemp->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); | ||
52 | $headerTemp->add('LOGDATA',echoLogData()); | ||
53 | if (getUserlevel() < 3) | ||
54 | { | ||
55 | $headerTemp->adds_block('PANEL',array('exi'=>1)); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | if (isset($_POST['message'])) | ||
60 | { | ||
61 | $headerTemp->adds_block('MESSAGE',array('MSG' => $_POST['message'])); | ||
62 | } | ||
63 | |||
64 | $headerTemp->display(); | ||
65 | |||
66 | ?> | ||
diff --git a/includes/hits.php b/includes/hits.php new file mode 100644 index 0000000..053c6b4 --- /dev/null +++ b/includes/hits.php | |||
@@ -0,0 +1,102 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/hits.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | /* Notice: | ||
26 | |||
27 | This is an old module for counting hits | ||
28 | taken directly from the old Four Island. | ||
29 | Because of this, it may contain unforseen | ||
30 | bugs. | ||
31 | */ | ||
32 | |||
33 | $getlreset = "SELECT * FROM config WHERE name = 'lastReset'"; | ||
34 | $getlreset2 = mysql_query($getlreset); | ||
35 | $getlreset3 = mysql_fetch_array($getlreset2); | ||
36 | if ((floor(time()/86400))>($getlreset3['value'])) | ||
37 | { | ||
38 | $sethits = "UPDATE config SET value = " . (floor(time()/86400)) . " WHERE name = 'lastReset'"; | ||
39 | $sethits2 = mysql_query($sethits); | ||
40 | $getips = "SELECT * FROM hits"; | ||
41 | $getips2 = mysql_query($getips); | ||
42 | $i=0; | ||
43 | while ($getips3[$i] = mysql_fetch_array($getips2)) | ||
44 | { | ||
45 | $ttime = strtotime($getips3[$i]['lasttime']); | ||
46 | $delip = "DELETE FROM hits WHERE id = " . $getips3[$i]['id']; | ||
47 | $delip2 = mysql_query($delip); | ||
48 | $i++; | ||
49 | } | ||
50 | $sethits6 = "UPDATE config SET value = 0 WHERE name = 'todayHits'"; | ||
51 | $sethits7 = mysql_query($sethits6); | ||
52 | } | ||
53 | $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') ); | ||
54 | $user_ip = $client_ip; | ||
55 | $getip = "SELECT * FROM hits WHERE ip = '" . $user_ip . "'"; | ||
56 | $getip2 = mysql_query($getip); | ||
57 | $getip3 = mysql_fetch_array($getip2); | ||
58 | if ($getip3['ip'] != $user_ip) | ||
59 | { | ||
60 | $gethits = "SELECT * FROM config WHERE name = 'hits'"; | ||
61 | $gethits2 = mysql_query($gethits); | ||
62 | $gethits3 = mysql_fetch_array($gethits2); | ||
63 | $sethits = "UPDATE config SET value = " . ($gethits3['value']+1) . " WHERE name = 'hits'"; | ||
64 | $sethits2 = mysql_query($sethits); | ||
65 | $gethits4 = "SELECT * FROM config WHERE name = 'todayHits'"; | ||
66 | $gethits5 = mysql_query($gethits4); | ||
67 | $gethits6 = mysql_fetch_array($gethits5); | ||
68 | $sethits4 = "UPDATE config SET value = " . ($gethits6['value']+1) . " WHERE name = 'todayHits'"; | ||
69 | $sethits5 = mysql_query($sethits4); | ||
70 | $gethits7 = "SELECT * FROM config WHERE name = 'imHits'"; | ||
71 | $gethits8 = mysql_query($gethits7); | ||
72 | $gethits9 = mysql_fetch_array($gethits8); | ||
73 | $setip = "INSERT INTO hits SET ip = '" . $user_ip . "'"; | ||
74 | $setip2 = mysql_query($setip); | ||
75 | if (isset($_SERVER['HTTP_REFERER'])) | ||
76 | { | ||
77 | $page = $_SERVER['HTTP_REFERER']; | ||
78 | } else { | ||
79 | $page = ''; | ||
80 | } | ||
81 | $ipdetails = str_pad($client_ip,15,' ') . ' - ' . str_pad($page,61,' ') . ' - ' . str_pad($_SERVER['REQUEST_URI'],27,' ') . ' - ' . time() . chr(13) . chr(10); | ||
82 | // file_put_contents('/var/www/fourisland/ipdetails.txt',$ipdetails,FILE_APPEND); | ||
83 | $milestones = array(100,500,1000,1337,4444,5000,10000,15000,50000,75000,100000,150000,250000,500000,750000,1000000); | ||
84 | $i=0; | ||
85 | for ($i=0; $i<15; $i++) { | ||
86 | if (($gethits3['value']+1)==$milestones[$i]) { | ||
87 | file_put_contents('/var/www/fourisland/tophits.txt',$ipdetails,FILE_APPEND); | ||
88 | $setmst = 'UPDATE config SET value = "' . time() . '" WHERE name = "milestonetime"'; | ||
89 | $setmst2 = mysql_query($setmst); | ||
90 | $setms = 'UPDATE config SET value = "' . ($gethits3['value']+1) . '" WHERE name = "milestone"'; | ||
91 | $setms2 = mysql_query($setms); | ||
92 | include('includes/header.php'); | ||
93 | ?> | ||
94 | <FONT SIZE="6" COLOR="RED">CONGRADULATIONS! You are the <?php echo($gethits3['value']+1); ?>th person to visit this site! Refresh the page to return to the page you were visiting.</FONT> | ||
95 | <?php | ||
96 | include('includes/footer.php'); | ||
97 | exit; | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | ?> | ||
diff --git a/includes/http.php b/includes/http.php new file mode 100644 index 0000000..d0e55d7 --- /dev/null +++ b/includes/http.php | |||
@@ -0,0 +1,1982 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | * http.php | ||
4 | * | ||
5 | * @(#) $Header: /home/mlemos/cvsroot/http/http.php,v 1.76 2008/03/18 07:59:05 mlemos Exp $ | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | class http_class | ||
10 | { | ||
11 | var $host_name=""; | ||
12 | var $host_port=0; | ||
13 | var $proxy_host_name=""; | ||
14 | var $proxy_host_port=80; | ||
15 | var $socks_host_name = ''; | ||
16 | var $socks_host_port = 1080; | ||
17 | var $socks_version = '5'; | ||
18 | |||
19 | var $protocol="http"; | ||
20 | var $request_method="GET"; | ||
21 | var $user_agent='httpclient (http://www.phpclasses.org/httpclient $Revision: 1.76 $)'; | ||
22 | var $authentication_mechanism=""; | ||
23 | var $user; | ||
24 | var $password; | ||
25 | var $realm; | ||
26 | var $workstation; | ||
27 | var $proxy_authentication_mechanism=""; | ||
28 | var $proxy_user; | ||
29 | var $proxy_password; | ||
30 | var $proxy_realm; | ||
31 | var $proxy_workstation; | ||
32 | var $request_uri=""; | ||
33 | var $request=""; | ||
34 | var $request_headers=array(); | ||
35 | var $request_user; | ||
36 | var $request_password; | ||
37 | var $request_realm; | ||
38 | var $request_workstation; | ||
39 | var $proxy_request_user; | ||
40 | var $proxy_request_password; | ||
41 | var $proxy_request_realm; | ||
42 | var $proxy_request_workstation; | ||
43 | var $request_body=""; | ||
44 | var $request_arguments=array(); | ||
45 | var $protocol_version="1.1"; | ||
46 | var $timeout=0; | ||
47 | var $data_timeout=0; | ||
48 | var $debug=0; | ||
49 | var $debug_response_body=1; | ||
50 | var $html_debug=0; | ||
51 | var $support_cookies=1; | ||
52 | var $cookies=array(); | ||
53 | var $error=""; | ||
54 | var $exclude_address=""; | ||
55 | var $follow_redirect=0; | ||
56 | var $redirection_limit=5; | ||
57 | var $response_status=""; | ||
58 | var $response_message=""; | ||
59 | var $file_buffer_length=8000; | ||
60 | var $force_multipart_form_post=0; | ||
61 | var $prefer_curl = 0; | ||
62 | |||
63 | /* private variables - DO NOT ACCESS */ | ||
64 | |||
65 | var $state="Disconnected"; | ||
66 | var $use_curl=0; | ||
67 | var $connection=0; | ||
68 | var $content_length=0; | ||
69 | var $response=""; | ||
70 | var $read_response=0; | ||
71 | var $read_length=0; | ||
72 | var $request_host=""; | ||
73 | var $next_token=""; | ||
74 | var $redirection_level=0; | ||
75 | var $chunked=0; | ||
76 | var $remaining_chunk=0; | ||
77 | var $last_chunk_read=0; | ||
78 | var $months=array( | ||
79 | "Jan"=>"01", | ||
80 | "Feb"=>"02", | ||
81 | "Mar"=>"03", | ||
82 | "Apr"=>"04", | ||
83 | "May"=>"05", | ||
84 | "Jun"=>"06", | ||
85 | "Jul"=>"07", | ||
86 | "Aug"=>"08", | ||
87 | "Sep"=>"09", | ||
88 | "Oct"=>"10", | ||
89 | "Nov"=>"11", | ||
90 | "Dec"=>"12"); | ||
91 | var $session=''; | ||
92 | var $connection_close=0; | ||
93 | |||
94 | /* Private methods - DO NOT CALL */ | ||
95 | |||
96 | Function Tokenize($string,$separator="") | ||
97 | { | ||
98 | if(!strcmp($separator,"")) | ||
99 | { | ||
100 | $separator=$string; | ||
101 | $string=$this->next_token; | ||
102 | } | ||
103 | for($character=0;$character<strlen($separator);$character++) | ||
104 | { | ||
105 | if(GetType($position=strpos($string,$separator[$character]))=="integer") | ||
106 | $found=(IsSet($found) ? min($found,$position) : $position); | ||
107 | } | ||
108 | if(IsSet($found)) | ||
109 | { | ||
110 | $this->next_token=substr($string,$found+1); | ||
111 | return(substr($string,0,$found)); | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | $this->next_token=""; | ||
116 | return($string); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | Function CookieEncode($value, $name) | ||
121 | { | ||
122 | return($name ? str_replace("=", "%25", $value) : str_replace(";", "%3B", $value)); | ||
123 | } | ||
124 | |||
125 | Function SetError($error) | ||
126 | { | ||
127 | return($this->error=$error); | ||
128 | } | ||
129 | |||
130 | Function SetPHPError($error, &$php_error_message) | ||
131 | { | ||
132 | if(IsSet($php_error_message) | ||
133 | && strlen($php_error_message)) | ||
134 | $error.=": ".$php_error_message; | ||
135 | return($this->SetError($error)); | ||
136 | } | ||
137 | |||
138 | Function SetDataAccessError($error,$check_connection=0) | ||
139 | { | ||
140 | $this->error=$error; | ||
141 | if(!$this->use_curl | ||
142 | && function_exists("socket_get_status")) | ||
143 | { | ||
144 | $status=socket_get_status($this->connection); | ||
145 | if($status["timed_out"]) | ||
146 | $this->error.=": data access time out"; | ||
147 | elseif($status["eof"]) | ||
148 | { | ||
149 | if($check_connection) | ||
150 | $this->error=""; | ||
151 | else | ||
152 | $this->error.=": the server disconnected"; | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | |||
157 | Function OutputDebug($message) | ||
158 | { | ||
159 | $message.="\n"; | ||
160 | if($this->html_debug) | ||
161 | $message=str_replace("\n","<br />\n",HtmlEntities($message)); | ||
162 | echo $message; | ||
163 | flush(); | ||
164 | } | ||
165 | |||
166 | Function GetLine() | ||
167 | { | ||
168 | for($line="";;) | ||
169 | { | ||
170 | if($this->use_curl) | ||
171 | { | ||
172 | $eol=strpos($this->response,"\n",$this->read_response); | ||
173 | $data=($eol ? substr($this->response,$this->read_response,$eol+1-$this->read_response) : ""); | ||
174 | $this->read_response+=strlen($data); | ||
175 | } | ||
176 | else | ||
177 | { | ||
178 | if(feof($this->connection)) | ||
179 | { | ||
180 | $this->SetDataAccessError("reached the end of data while reading from the HTTP server connection"); | ||
181 | return(0); | ||
182 | } | ||
183 | $data=fgets($this->connection,100); | ||
184 | } | ||
185 | if(GetType($data)!="string" | ||
186 | || strlen($data)==0) | ||
187 | { | ||
188 | $this->SetDataAccessError("it was not possible to read line from the HTTP server"); | ||
189 | return(0); | ||
190 | } | ||
191 | $line.=$data; | ||
192 | $length=strlen($line); | ||
193 | if($length | ||
194 | && !strcmp(substr($line,$length-1,1),"\n")) | ||
195 | { | ||
196 | $length-=(($length>=2 && !strcmp(substr($line,$length-2,1),"\r")) ? 2 : 1); | ||
197 | $line=substr($line,0,$length); | ||
198 | if($this->debug) | ||
199 | $this->OutputDebug("S $line"); | ||
200 | return($line); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | Function PutLine($line) | ||
206 | { | ||
207 | if($this->debug) | ||
208 | $this->OutputDebug("C $line"); | ||
209 | if(!fputs($this->connection,$line."\r\n")) | ||
210 | { | ||
211 | $this->SetDataAccessError("it was not possible to send a line to the HTTP server"); | ||
212 | return(0); | ||
213 | } | ||
214 | return(1); | ||
215 | } | ||
216 | |||
217 | Function PutData($data) | ||
218 | { | ||
219 | if(strlen($data)) | ||
220 | { | ||
221 | if($this->debug) | ||
222 | $this->OutputDebug('C '.$data); | ||
223 | if(!fputs($this->connection,$data)) | ||
224 | { | ||
225 | $this->SetDataAccessError("it was not possible to send data to the HTTP server"); | ||
226 | return(0); | ||
227 | } | ||
228 | } | ||
229 | return(1); | ||
230 | } | ||
231 | |||
232 | Function FlushData() | ||
233 | { | ||
234 | if(!fflush($this->connection)) | ||
235 | { | ||
236 | $this->SetDataAccessError("it was not possible to send data to the HTTP server"); | ||
237 | return(0); | ||
238 | } | ||
239 | return(1); | ||
240 | } | ||
241 | |||
242 | Function ReadChunkSize() | ||
243 | { | ||
244 | if($this->remaining_chunk==0) | ||
245 | { | ||
246 | $debug=$this->debug; | ||
247 | if(!$this->debug_response_body) | ||
248 | $this->debug=0; | ||
249 | $line=$this->GetLine(); | ||
250 | $this->debug=$debug; | ||
251 | if(GetType($line)!="string") | ||
252 | return($this->SetError("4 could not read chunk start: ".$this->error)); | ||
253 | $this->remaining_chunk=hexdec($line); | ||
254 | } | ||
255 | return(""); | ||
256 | } | ||
257 | |||
258 | Function ReadBytes($length) | ||
259 | { | ||
260 | if($this->use_curl) | ||
261 | { | ||
262 | $bytes=substr($this->response,$this->read_response,min($length,strlen($this->response)-$this->read_response)); | ||
263 | $this->read_response+=strlen($bytes); | ||
264 | if($this->debug | ||
265 | && $this->debug_response_body | ||
266 | && strlen($bytes)) | ||
267 | $this->OutputDebug("S ".$bytes); | ||
268 | } | ||
269 | else | ||
270 | { | ||
271 | if($this->chunked) | ||
272 | { | ||
273 | for($bytes="",$remaining=$length;$remaining;) | ||
274 | { | ||
275 | if(strlen($this->ReadChunkSize())) | ||
276 | return(""); | ||
277 | if($this->remaining_chunk==0) | ||
278 | { | ||
279 | $this->last_chunk_read=1; | ||
280 | break; | ||
281 | } | ||
282 | $ask=min($this->remaining_chunk,$remaining); | ||
283 | $chunk=@fread($this->connection,$ask); | ||
284 | $read=strlen($chunk); | ||
285 | if($read==0) | ||
286 | { | ||
287 | $this->SetDataAccessError("it was not possible to read data chunk from the HTTP server"); | ||
288 | return(""); | ||
289 | } | ||
290 | if($this->debug | ||
291 | && $this->debug_response_body) | ||
292 | $this->OutputDebug("S ".$chunk); | ||
293 | $bytes.=$chunk; | ||
294 | $this->remaining_chunk-=$read; | ||
295 | $remaining-=$read; | ||
296 | if($this->remaining_chunk==0) | ||
297 | { | ||
298 | if(feof($this->connection)) | ||
299 | return($this->SetError("reached the end of data while reading the end of data chunk mark from the HTTP server")); | ||
300 | $data=@fread($this->connection,2); | ||
301 | if(strcmp($data,"\r\n")) | ||
302 | { | ||
303 | $this->SetDataAccessError("it was not possible to read end of data chunk from the HTTP server"); | ||
304 | return(""); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | else | ||
310 | { | ||
311 | $bytes=@fread($this->connection,$length); | ||
312 | if(strlen($bytes)) | ||
313 | { | ||
314 | if($this->debug | ||
315 | && $this->debug_response_body) | ||
316 | $this->OutputDebug("S ".$bytes); | ||
317 | } | ||
318 | else | ||
319 | $this->SetDataAccessError("it was not possible to read data from the HTTP server", $this->connection_close); | ||
320 | } | ||
321 | } | ||
322 | return($bytes); | ||
323 | } | ||
324 | |||
325 | Function EndOfInput() | ||
326 | { | ||
327 | if($this->use_curl) | ||
328 | return($this->read_response>=strlen($this->response)); | ||
329 | if($this->chunked) | ||
330 | return($this->last_chunk_read); | ||
331 | return(feof($this->connection)); | ||
332 | } | ||
333 | |||
334 | Function Resolve($domain, &$ip, $server_type) | ||
335 | { | ||
336 | if(ereg('^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$',$domain)) | ||
337 | $ip=$domain; | ||
338 | else | ||
339 | { | ||
340 | if($this->debug) | ||
341 | $this->OutputDebug('Resolving '.$server_type.' server domain "'.$domain.'"...'); | ||
342 | if(!strcmp($ip=@gethostbyname($domain),$domain)) | ||
343 | $ip=""; | ||
344 | } | ||
345 | if(strlen($ip)==0 | ||
346 | || (strlen($this->exclude_address) | ||
347 | && !strcmp(@gethostbyname($this->exclude_address),$ip))) | ||
348 | return($this->SetError("could not resolve the host domain \"".$domain."\"")); | ||
349 | return(''); | ||
350 | } | ||
351 | |||
352 | Function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP') | ||
353 | { | ||
354 | $domain=$host_name; | ||
355 | $port = $host_port; | ||
356 | if(strlen($error = $this->Resolve($domain, $ip, $server_type))) | ||
357 | return($error); | ||
358 | if(strlen($this->socks_host_name)) | ||
359 | { | ||
360 | switch($this->socks_version) | ||
361 | { | ||
362 | case '4': | ||
363 | $version = 4; | ||
364 | break; | ||
365 | case '5': | ||
366 | $version = 5; | ||
367 | break; | ||
368 | default: | ||
369 | return('it was not specified a supported SOCKS protocol version'); | ||
370 | break; | ||
371 | } | ||
372 | $host_ip = $ip; | ||
373 | $port = $this->socks_host_port; | ||
374 | $host_server_type = $server_type; | ||
375 | $server_type = 'SOCKS'; | ||
376 | if(strlen($error = $this->Resolve($this->socks_host_name, $ip, $server_type))) | ||
377 | return($error); | ||
378 | } | ||
379 | if($this->debug) | ||
380 | $this->OutputDebug('Connecting to '.$server_type.' server IP '.$ip.' port '.$port.'...'); | ||
381 | if($ssl) | ||
382 | $ip="ssl://".$ip; | ||
383 | if(($this->connection=($this->timeout ? @fsockopen($ip, $port, $errno, $error, $this->timeout) : @fsockopen($ip, $port, $errno)))==0) | ||
384 | { | ||
385 | switch($errno) | ||
386 | { | ||
387 | case -3: | ||
388 | return($this->SetError("-3 socket could not be created")); | ||
389 | case -4: | ||
390 | return($this->SetError("-4 dns lookup on hostname \"".$host_name."\" failed")); | ||
391 | case -5: | ||
392 | return($this->SetError("-5 connection refused or timed out")); | ||
393 | case -6: | ||
394 | return($this->SetError("-6 fdopen() call failed")); | ||
395 | case -7: | ||
396 | return($this->SetError("-7 setvbuf() call failed")); | ||
397 | default: | ||
398 | return($this->SetPHPError($errno." could not connect to the host \"".$host_name."\"",$php_errormsg)); | ||
399 | } | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | if($this->data_timeout | ||
404 | && function_exists("socket_set_timeout")) | ||
405 | socket_set_timeout($this->connection,$this->data_timeout,0); | ||
406 | if(strlen($this->socks_host_name)) | ||
407 | { | ||
408 | if($this->debug) | ||
409 | $this->OutputDebug('Connected to the SOCKS server '.$this->socks_host_name); | ||
410 | $send_error = 'it was not possible to send data to the SOCKS server'; | ||
411 | $receive_error = 'it was not possible to receive data from the SOCKS server'; | ||
412 | switch($version) | ||
413 | { | ||
414 | case 4: | ||
415 | $command = 1; | ||
416 | if(!fputs($this->connection, chr($version).chr($command).pack('nN', $host_port, ip2long($host_ip)).$this->user.Chr(0))) | ||
417 | $error = $this->SetDataAccessError($send_error); | ||
418 | else | ||
419 | { | ||
420 | $response = fgets($this->connection, 9); | ||
421 | if(strlen($response) != 8) | ||
422 | $error = $this->SetDataAccessError($receive_error); | ||
423 | else | ||
424 | { | ||
425 | $socks_errors = array( | ||
426 | "\x5a"=>'', | ||
427 | "\x5b"=>'request rejected', | ||
428 | "\x5c"=>'request failed because client is not running identd (or not reachable from the server)', | ||
429 | "\x5d"=>'request failed because client\'s identd could not confirm the user ID string in the request', | ||
430 | ); | ||
431 | $error_code = $response[1]; | ||
432 | $error = (IsSet($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown'); | ||
433 | if(strlen($error)) | ||
434 | $error = 'SOCKS error: '.$error; | ||
435 | } | ||
436 | } | ||
437 | break; | ||
438 | case 5: | ||
439 | if($this->debug) | ||
440 | $this->OutputDebug('Negotiating the authentication method ...'); | ||
441 | $methods = 1; | ||
442 | $method = 0; | ||
443 | if(!fputs($this->connection, chr($version).chr($methods).chr($method))) | ||
444 | $error = $this->SetDataAccessError($send_error); | ||
445 | else | ||
446 | { | ||
447 | $response = fgets($this->connection, 3); | ||
448 | if(strlen($response) != 2) | ||
449 | $error = $this->SetDataAccessError($receive_error); | ||
450 | elseif(Ord($response[1]) != $method) | ||
451 | $error = 'the SOCKS server requires an authentication method that is not yet supported'; | ||
452 | else | ||
453 | { | ||
454 | if($this->debug) | ||
455 | $this->OutputDebug('Connecting to '.$host_server_type.' server IP '.$host_ip.' port '.$host_port.'...'); | ||
456 | $command = 1; | ||
457 | $address_type = 1; | ||
458 | if(!fputs($this->connection, chr($version).chr($command)."\x00".chr($address_type).pack('Nn', ip2long($host_ip), $host_port))) | ||
459 | $error = $this->SetDataAccessError($send_error); | ||
460 | else | ||
461 | { | ||
462 | $response = fgets($this->connection, 11); | ||
463 | if(strlen($response) != 10) | ||
464 | $error = $this->SetDataAccessError($receive_error); | ||
465 | else | ||
466 | { | ||
467 | $socks_errors = array( | ||
468 | "\x00"=>'', | ||
469 | "\x01"=>'general SOCKS server failure', | ||
470 | "\x02"=>'connection not allowed by ruleset', | ||
471 | "\x03"=>'Network unreachable', | ||
472 | "\x04"=>'Host unreachable', | ||
473 | "\x05"=>'Connection refused', | ||
474 | "\x06"=>'TTL expired', | ||
475 | "\x07"=>'Command not supported', | ||
476 | "\x08"=>'Address type not supported' | ||
477 | ); | ||
478 | $error_code = $response[1]; | ||
479 | $error = (IsSet($socks_errors[$error_code]) ? $socks_errors[$error_code] : 'unknown'); | ||
480 | if(strlen($error)) | ||
481 | $error = 'SOCKS error: '.$error; | ||
482 | } | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | break; | ||
487 | default: | ||
488 | $error = 'support for SOCKS protocol version '.$this->socks_version.' is not yet implemented'; | ||
489 | break; | ||
490 | } | ||
491 | if(strlen($error)) | ||
492 | { | ||
493 | fclose($this->connection); | ||
494 | return($error); | ||
495 | } | ||
496 | } | ||
497 | if($this->debug) | ||
498 | $this->OutputDebug("Connected to $host_name"); | ||
499 | if(strlen($this->proxy_host_name) | ||
500 | && !strcmp(strtolower($this->protocol), 'https')) | ||
501 | { | ||
502 | if(function_exists('stream_socket_enable_crypto') | ||
503 | && in_array('ssl', stream_get_transports())) | ||
504 | $this->state = "ConnectedToProxy"; | ||
505 | else | ||
506 | { | ||
507 | $this->OutputDebug("It is not possible to start SSL after connecting to the proxy server. If the proxy refuses to forward the SSL request, you may need to upgrade to PHP 5.1 or later with OpenSSL support enabled."); | ||
508 | $this->state="Connected"; | ||
509 | } | ||
510 | } | ||
511 | else | ||
512 | $this->state="Connected"; | ||
513 | return(""); | ||
514 | } | ||
515 | } | ||
516 | |||
517 | Function Disconnect() | ||
518 | { | ||
519 | if($this->debug) | ||
520 | $this->OutputDebug("Disconnected from ".$this->host_name); | ||
521 | if($this->use_curl) | ||
522 | { | ||
523 | curl_close($this->connection); | ||
524 | $this->response=""; | ||
525 | } | ||
526 | else | ||
527 | fclose($this->connection); | ||
528 | $this->state="Disconnected"; | ||
529 | return(""); | ||
530 | } | ||
531 | |||
532 | /* Public methods */ | ||
533 | |||
534 | Function GetRequestArguments($url, &$arguments) | ||
535 | { | ||
536 | if(strlen($this->error)) | ||
537 | return($this->error); | ||
538 | $arguments=array(); | ||
539 | $parameters=@parse_url($url); | ||
540 | if(!$parameters) | ||
541 | return($this->SetError("it was not specified a valid URL")); | ||
542 | if(!IsSet($parameters["scheme"])) | ||
543 | return($this->SetError("it was not specified the protocol type argument")); | ||
544 | switch(strtolower($parameters["scheme"])) | ||
545 | { | ||
546 | case "http": | ||
547 | case "https": | ||
548 | $arguments["Protocol"]=$parameters["scheme"]; | ||
549 | break; | ||
550 | default: | ||
551 | return($parameters["scheme"]." connection scheme is not yet supported"); | ||
552 | } | ||
553 | if(!IsSet($parameters["host"])) | ||
554 | return($this->SetError("it was not specified the connection host argument")); | ||
555 | $arguments["HostName"]=$parameters["host"]; | ||
556 | $arguments["Headers"]=array("Host"=>$parameters["host"].(IsSet($parameters["port"]) ? ":".$parameters["port"] : "")); | ||
557 | if(IsSet($parameters["user"])) | ||
558 | { | ||
559 | $arguments["AuthUser"]=UrlDecode($parameters["user"]); | ||
560 | if(!IsSet($parameters["pass"])) | ||
561 | $arguments["AuthPassword"]=""; | ||
562 | } | ||
563 | if(IsSet($parameters["pass"])) | ||
564 | { | ||
565 | if(!IsSet($parameters["user"])) | ||
566 | $arguments["AuthUser"]=""; | ||
567 | $arguments["AuthPassword"]=UrlDecode($parameters["pass"]); | ||
568 | } | ||
569 | if(IsSet($parameters["port"])) | ||
570 | { | ||
571 | if(strcmp($parameters["port"],strval(intval($parameters["port"])))) | ||
572 | return($this->SetError("it was not specified a valid connection host argument")); | ||
573 | $arguments["HostPort"]=intval($parameters["port"]); | ||
574 | } | ||
575 | else | ||
576 | $arguments["HostPort"]=0; | ||
577 | $arguments["RequestURI"]=(IsSet($parameters["path"]) ? $parameters["path"] : "/").(IsSet($parameters["query"]) ? "?".$parameters["query"] : ""); | ||
578 | if(strlen($this->user_agent)) | ||
579 | $arguments["Headers"]["User-Agent"]=$this->user_agent; | ||
580 | return(""); | ||
581 | } | ||
582 | |||
583 | Function Open($arguments) | ||
584 | { | ||
585 | if(strlen($this->error)) | ||
586 | return($this->error); | ||
587 | if($this->state!="Disconnected") | ||
588 | return("1 already connected"); | ||
589 | if(IsSet($arguments["HostName"])) | ||
590 | $this->host_name=$arguments["HostName"]; | ||
591 | if(IsSet($arguments["HostPort"])) | ||
592 | $this->host_port=$arguments["HostPort"]; | ||
593 | if(IsSet($arguments["ProxyHostName"])) | ||
594 | $this->proxy_host_name=$arguments["ProxyHostName"]; | ||
595 | if(IsSet($arguments["ProxyHostPort"])) | ||
596 | $this->proxy_host_port=$arguments["ProxyHostPort"]; | ||
597 | if(IsSet($arguments["SOCKSHostName"])) | ||
598 | $this->socks_host_name=$arguments["SOCKSHostName"]; | ||
599 | if(IsSet($arguments["SOCKSHostPort"])) | ||
600 | $this->socks_host_port=$arguments["SOCKSHostPort"]; | ||
601 | if(IsSet($arguments["SOCKSVersion"])) | ||
602 | $this->socks_version=$arguments["SOCKSVersion"]; | ||
603 | if(IsSet($arguments["Protocol"])) | ||
604 | $this->protocol=$arguments["Protocol"]; | ||
605 | switch(strtolower($this->protocol)) | ||
606 | { | ||
607 | case "http": | ||
608 | $default_port=80; | ||
609 | break; | ||
610 | case "https": | ||
611 | $default_port=443; | ||
612 | break; | ||
613 | default: | ||
614 | return($this->SetError("2 it was not specified a valid connection protocol")); | ||
615 | } | ||
616 | if(strlen($this->proxy_host_name)==0) | ||
617 | { | ||
618 | if(strlen($this->host_name)==0) | ||
619 | return($this->SetError("2 it was not specified a valid hostname")); | ||
620 | $host_name=$this->host_name; | ||
621 | $host_port=($this->host_port ? $this->host_port : $default_port); | ||
622 | $server_type = 'HTTP'; | ||
623 | } | ||
624 | else | ||
625 | { | ||
626 | $host_name=$this->proxy_host_name; | ||
627 | $host_port=$this->proxy_host_port; | ||
628 | $server_type = 'HTTP proxy'; | ||
629 | } | ||
630 | $ssl=(strtolower($this->protocol)=="https" && strlen($this->proxy_host_name)==0); | ||
631 | if($ssl | ||
632 | && strlen($this->socks_host_name)) | ||
633 | return($this->SetError('establishing SSL connections via a SOCKS server is not yet supported')); | ||
634 | $this->use_curl=($ssl && $this->prefer_curl && function_exists("curl_init")); | ||
635 | if($this->debug) | ||
636 | $this->OutputDebug("Connecting to ".$this->host_name); | ||
637 | if($this->use_curl) | ||
638 | { | ||
639 | $error=(($this->connection=curl_init($this->protocol."://".$this->host_name.($host_port==$default_port ? "" : ":".strval($host_port))."/")) ? "" : "Could not initialize a CURL session"); | ||
640 | if(strlen($error)==0) | ||
641 | { | ||
642 | if(IsSet($arguments["SSLCertificateFile"])) | ||
643 | curl_setopt($this->connection,CURLOPT_SSLCERT,$arguments["SSLCertificateFile"]); | ||
644 | if(IsSet($arguments["SSLCertificatePassword"])) | ||
645 | curl_setopt($this->connection,CURLOPT_SSLCERTPASSWD,$arguments["SSLCertificatePassword"]); | ||
646 | if(IsSet($arguments["SSLKeyFile"])) | ||
647 | curl_setopt($this->connection,CURLOPT_SSLKEY,$arguments["SSLKeyFile"]); | ||
648 | if(IsSet($arguments["SSLKeyPassword"])) | ||
649 | curl_setopt($this->connection,CURLOPT_SSLKEYPASSWD,$arguments["SSLKeyPassword"]); | ||
650 | } | ||
651 | $this->state="Connected"; | ||
652 | } | ||
653 | else | ||
654 | { | ||
655 | $error=""; | ||
656 | if(strlen($this->proxy_host_name) | ||
657 | && (IsSet($arguments["SSLCertificateFile"]) | ||
658 | || IsSet($arguments["SSLCertificateFile"]))) | ||
659 | $error="establishing SSL connections using certificates or private keys via non-SSL proxies is not supported"; | ||
660 | else | ||
661 | { | ||
662 | if($ssl) | ||
663 | { | ||
664 | if(IsSet($arguments["SSLCertificateFile"])) | ||
665 | $error="establishing SSL connections using certificates is only supported when the cURL extension is enabled"; | ||
666 | elseif(IsSet($arguments["SSLKeyFile"])) | ||
667 | $error="establishing SSL connections using a private key is only supported when the cURL extension is enabled"; | ||
668 | else | ||
669 | { | ||
670 | $version=explode(".",function_exists("phpversion") ? phpversion() : "3.0.7"); | ||
671 | $php_version=intval($version[0])*1000000+intval($version[1])*1000+intval($version[2]); | ||
672 | if($php_version<4003000) | ||
673 | $error="establishing SSL connections requires at least PHP version 4.3.0 or having the cURL extension enabled"; | ||
674 | elseif(!function_exists("extension_loaded") | ||
675 | || !extension_loaded("openssl")) | ||
676 | $error="establishing SSL connections requires the OpenSSL extension enabled"; | ||
677 | } | ||
678 | } | ||
679 | if(strlen($error)==0) | ||
680 | $error=$this->Connect($host_name, $host_port, $ssl, $server_type); | ||
681 | } | ||
682 | } | ||
683 | if(strlen($error)) | ||
684 | return($this->SetError($error)); | ||
685 | $this->session=md5(uniqid("")); | ||
686 | return(""); | ||
687 | } | ||
688 | |||
689 | Function Close() | ||
690 | { | ||
691 | if($this->state=="Disconnected") | ||
692 | return("1 already disconnected"); | ||
693 | $error=$this->Disconnect(); | ||
694 | if(strlen($error)==0) | ||
695 | $this->state="Disconnected"; | ||
696 | return($error); | ||
697 | } | ||
698 | |||
699 | Function PickCookies(&$cookies,$secure) | ||
700 | { | ||
701 | if(IsSet($this->cookies[$secure])) | ||
702 | { | ||
703 | $now=gmdate("Y-m-d H-i-s"); | ||
704 | for($domain=0,Reset($this->cookies[$secure]);$domain<count($this->cookies[$secure]);Next($this->cookies[$secure]),$domain++) | ||
705 | { | ||
706 | $domain_pattern=Key($this->cookies[$secure]); | ||
707 | $match=strlen($this->request_host)-strlen($domain_pattern); | ||
708 | if($match>=0 | ||
709 | && !strcmp($domain_pattern,substr($this->request_host,$match)) | ||
710 | && ($match==0 | ||
711 | || $domain_pattern[0]=="." | ||
712 | || $this->request_host[$match-1]==".")) | ||
713 | { | ||
714 | for(Reset($this->cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($this->cookies[$secure][$domain_pattern]);Next($this->cookies[$secure][$domain_pattern]),$path_part++) | ||
715 | { | ||
716 | $path=Key($this->cookies[$secure][$domain_pattern]); | ||
717 | if(strlen($this->request_uri)>=strlen($path) | ||
718 | && substr($this->request_uri,0,strlen($path))==$path) | ||
719 | { | ||
720 | for(Reset($this->cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($this->cookies[$secure][$domain_pattern][$path]);Next($this->cookies[$secure][$domain_pattern][$path]),$cookie++) | ||
721 | { | ||
722 | $cookie_name=Key($this->cookies[$secure][$domain_pattern][$path]); | ||
723 | $expires=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"]; | ||
724 | if($expires=="" | ||
725 | || strcmp($now,$expires)<0) | ||
726 | $cookies[$cookie_name]=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]; | ||
727 | } | ||
728 | } | ||
729 | } | ||
730 | } | ||
731 | } | ||
732 | } | ||
733 | } | ||
734 | |||
735 | Function GetFileDefinition($file, &$definition) | ||
736 | { | ||
737 | $name=""; | ||
738 | if(IsSet($file["FileName"])) | ||
739 | $name=basename($file["FileName"]); | ||
740 | if(IsSet($file["Name"])) | ||
741 | $name=$file["Name"]; | ||
742 | if(strlen($name)==0) | ||
743 | return("it was not specified the file part name"); | ||
744 | if(IsSet($file["Content-Type"])) | ||
745 | { | ||
746 | $content_type=$file["Content-Type"]; | ||
747 | $type=$this->Tokenize(strtolower($content_type),"/"); | ||
748 | $sub_type=$this->Tokenize(""); | ||
749 | switch($type) | ||
750 | { | ||
751 | case "text": | ||
752 | case "image": | ||
753 | case "audio": | ||
754 | case "video": | ||
755 | case "application": | ||
756 | case "message": | ||
757 | break; | ||
758 | case "automatic": | ||
759 | switch($sub_type) | ||
760 | { | ||
761 | case "name": | ||
762 | switch(GetType($dot=strrpos($name,"."))=="integer" ? strtolower(substr($name,$dot)) : "") | ||
763 | { | ||
764 | case ".xls": | ||
765 | $content_type="application/excel"; | ||
766 | break; | ||
767 | case ".hqx": | ||
768 | $content_type="application/macbinhex40"; | ||
769 | break; | ||
770 | case ".doc": | ||
771 | case ".dot": | ||
772 | case ".wrd": | ||
773 | $content_type="application/msword"; | ||
774 | break; | ||
775 | case ".pdf": | ||
776 | $content_type="application/pdf"; | ||
777 | break; | ||
778 | case ".pgp": | ||
779 | $content_type="application/pgp"; | ||
780 | break; | ||
781 | case ".ps": | ||
782 | case ".eps": | ||
783 | case ".ai": | ||
784 | $content_type="application/postscript"; | ||
785 | break; | ||
786 | case ".ppt": | ||
787 | $content_type="application/powerpoint"; | ||
788 | break; | ||
789 | case ".rtf": | ||
790 | $content_type="application/rtf"; | ||
791 | break; | ||
792 | case ".tgz": | ||
793 | case ".gtar": | ||
794 | $content_type="application/x-gtar"; | ||
795 | break; | ||
796 | case ".gz": | ||
797 | $content_type="application/x-gzip"; | ||
798 | break; | ||
799 | case ".php": | ||
800 | case ".php3": | ||
801 | $content_type="application/x-httpd-php"; | ||
802 | break; | ||
803 | case ".js": | ||
804 | $content_type="application/x-javascript"; | ||
805 | break; | ||
806 | case ".ppd": | ||
807 | case ".psd": | ||
808 | $content_type="application/x-photoshop"; | ||
809 | break; | ||
810 | case ".swf": | ||
811 | case ".swc": | ||
812 | case ".rf": | ||
813 | $content_type="application/x-shockwave-flash"; | ||
814 | break; | ||
815 | case ".tar": | ||
816 | $content_type="application/x-tar"; | ||
817 | break; | ||
818 | case ".zip": | ||
819 | $content_type="application/zip"; | ||
820 | break; | ||
821 | case ".mid": | ||
822 | case ".midi": | ||
823 | case ".kar": | ||
824 | $content_type="audio/midi"; | ||
825 | break; | ||
826 | case ".mp2": | ||
827 | case ".mp3": | ||
828 | case ".mpga": | ||
829 | $content_type="audio/mpeg"; | ||
830 | break; | ||
831 | case ".ra": | ||
832 | $content_type="audio/x-realaudio"; | ||
833 | break; | ||
834 | case ".wav": | ||
835 | $content_type="audio/wav"; | ||
836 | break; | ||
837 | case ".bmp": | ||
838 | $content_type="image/bitmap"; | ||
839 | break; | ||
840 | case ".gif": | ||
841 | $content_type="image/gif"; | ||
842 | break; | ||
843 | case ".iff": | ||
844 | $content_type="image/iff"; | ||
845 | break; | ||
846 | case ".jb2": | ||
847 | $content_type="image/jb2"; | ||
848 | break; | ||
849 | case ".jpg": | ||
850 | case ".jpe": | ||
851 | case ".jpeg": | ||
852 | $content_type="image/jpeg"; | ||
853 | break; | ||
854 | case ".jpx": | ||
855 | $content_type="image/jpx"; | ||
856 | break; | ||
857 | case ".png": | ||
858 | $content_type="image/png"; | ||
859 | break; | ||
860 | case ".tif": | ||
861 | case ".tiff": | ||
862 | $content_type="image/tiff"; | ||
863 | break; | ||
864 | case ".wbmp": | ||
865 | $content_type="image/vnd.wap.wbmp"; | ||
866 | break; | ||
867 | case ".xbm": | ||
868 | $content_type="image/xbm"; | ||
869 | break; | ||
870 | case ".css": | ||
871 | $content_type="text/css"; | ||
872 | break; | ||
873 | case ".txt": | ||
874 | $content_type="text/plain"; | ||
875 | break; | ||
876 | case ".htm": | ||
877 | case ".html": | ||
878 | $content_type="text/html"; | ||
879 | break; | ||
880 | case ".xml": | ||
881 | $content_type="text/xml"; | ||
882 | break; | ||
883 | case ".mpg": | ||
884 | case ".mpe": | ||
885 | case ".mpeg": | ||
886 | $content_type="video/mpeg"; | ||
887 | break; | ||
888 | case ".qt": | ||
889 | case ".mov": | ||
890 | $content_type="video/quicktime"; | ||
891 | break; | ||
892 | case ".avi": | ||
893 | $content_type="video/x-ms-video"; | ||
894 | break; | ||
895 | case ".eml": | ||
896 | $content_type="message/rfc822"; | ||
897 | break; | ||
898 | default: | ||
899 | $content_type="application/octet-stream"; | ||
900 | break; | ||
901 | } | ||
902 | break; | ||
903 | default: | ||
904 | return($content_type." is not a supported automatic content type detection method"); | ||
905 | } | ||
906 | break; | ||
907 | default: | ||
908 | return($content_type." is not a supported file content type"); | ||
909 | } | ||
910 | } | ||
911 | else | ||
912 | $content_type="application/octet-stream"; | ||
913 | $definition=array( | ||
914 | "Content-Type"=>$content_type, | ||
915 | "NAME"=>$name | ||
916 | ); | ||
917 | if(IsSet($file["FileName"])) | ||
918 | { | ||
919 | if(GetType($length=@filesize($file["FileName"]))!="integer") | ||
920 | { | ||
921 | $error="it was not possible to determine the length of the file ".$file["FileName"]; | ||
922 | if(IsSet($php_errormsg) | ||
923 | && strlen($php_errormsg)) | ||
924 | $error.=": ".$php_errormsg; | ||
925 | if(!file_exists($file["FileName"])) | ||
926 | $error="it was not possible to access the file ".$file["FileName"]; | ||
927 | return($error); | ||
928 | } | ||
929 | $definition["FILENAME"]=$file["FileName"]; | ||
930 | $definition["Content-Length"]=$length; | ||
931 | } | ||
932 | elseif(IsSet($file["Data"])) | ||
933 | $definition["Content-Length"]=strlen($definition["DATA"]=$file["Data"]); | ||
934 | else | ||
935 | return("it was not specified a valid file name"); | ||
936 | return(""); | ||
937 | } | ||
938 | |||
939 | Function ConnectFromProxy($arguments, &$headers) | ||
940 | { | ||
941 | if(!$this->PutLine('CONNECT '.$this->host_name.':'.($this->host_port ? $this->host_port : 443).' HTTP/1.0') | ||
942 | || (strlen($this->user_agent) | ||
943 | && !$this->PutLine('User-Agent: '.$this->user_agent)) | ||
944 | || (IsSet($arguments['Headers']['Proxy-Authorization']) | ||
945 | && !$this->PutLine('Proxy-Authorization: '.$arguments['Headers']['Proxy-Authorization'])) | ||
946 | || !$this->PutLine('')) | ||
947 | { | ||
948 | $this->Disconnect(); | ||
949 | return($this->error); | ||
950 | } | ||
951 | $this->state = "ConnectSent"; | ||
952 | if(strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
953 | return($error); | ||
954 | $proxy_authorization=""; | ||
955 | while(!strcmp($this->response_status, "100")) | ||
956 | { | ||
957 | $this->state="ConnectSent"; | ||
958 | if(strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
959 | return($error); | ||
960 | } | ||
961 | switch($this->response_status) | ||
962 | { | ||
963 | case "200": | ||
964 | if(!@stream_socket_enable_crypto($this->connection, 1, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)) | ||
965 | { | ||
966 | $this->SetPHPError('it was not possible to start a SSL encrypted connection via this proxy', $php_errormsg); | ||
967 | $this->Disconnect(); | ||
968 | return($this->error); | ||
969 | } | ||
970 | $this->state = "Connected"; | ||
971 | break; | ||
972 | case "407": | ||
973 | if(strlen($error=$this->Authenticate($headers, -1, $proxy_authorization, $this->proxy_request_user, $this->proxy_request_password, $this->proxy_request_realm, $this->proxy_request_workstation))) | ||
974 | return($error); | ||
975 | break; | ||
976 | default: | ||
977 | return($this->SetError("unable to send request via proxy")); | ||
978 | } | ||
979 | return(""); | ||
980 | } | ||
981 | |||
982 | Function SendRequest($arguments) | ||
983 | { | ||
984 | if(strlen($this->error)) | ||
985 | return($this->error); | ||
986 | if(IsSet($arguments["ProxyUser"])) | ||
987 | $this->proxy_request_user=$arguments["ProxyUser"]; | ||
988 | elseif(IsSet($this->proxy_user)) | ||
989 | $this->proxy_request_user=$this->proxy_user; | ||
990 | if(IsSet($arguments["ProxyPassword"])) | ||
991 | $this->proxy_request_password=$arguments["ProxyPassword"]; | ||
992 | elseif(IsSet($this->proxy_password)) | ||
993 | $this->proxy_request_password=$this->proxy_password; | ||
994 | if(IsSet($arguments["ProxyRealm"])) | ||
995 | $this->proxy_request_realm=$arguments["ProxyRealm"]; | ||
996 | elseif(IsSet($this->proxy_realm)) | ||
997 | $this->proxy_request_realm=$this->proxy_realm; | ||
998 | if(IsSet($arguments["ProxyWorkstation"])) | ||
999 | $this->proxy_request_workstation=$arguments["ProxyWorkstation"]; | ||
1000 | elseif(IsSet($this->proxy_workstation)) | ||
1001 | $this->proxy_request_workstation=$this->proxy_workstation; | ||
1002 | switch($this->state) | ||
1003 | { | ||
1004 | case "Disconnected": | ||
1005 | return($this->SetError("1 connection was not yet established")); | ||
1006 | case "Connected": | ||
1007 | $connect = 0; | ||
1008 | break; | ||
1009 | case "ConnectedToProxy": | ||
1010 | if(strlen($error = $this->ConnectFromProxy($arguments, $headers))) | ||
1011 | return($error); | ||
1012 | $connect = 1; | ||
1013 | break; | ||
1014 | default: | ||
1015 | return($this->SetError("2 can not send request in the current connection state")); | ||
1016 | } | ||
1017 | if(IsSet($arguments["RequestMethod"])) | ||
1018 | $this->request_method=$arguments["RequestMethod"]; | ||
1019 | if(IsSet($arguments["User-Agent"])) | ||
1020 | $this->user_agent=$arguments["User-Agent"]; | ||
1021 | if(!IsSet($arguments["Headers"]["User-Agent"]) | ||
1022 | && strlen($this->user_agent)) | ||
1023 | $arguments["Headers"]["User-Agent"]=$this->user_agent; | ||
1024 | if(strlen($this->request_method)==0) | ||
1025 | return($this->SetError("3 it was not specified a valid request method")); | ||
1026 | if(IsSet($arguments["RequestURI"])) | ||
1027 | $this->request_uri=$arguments["RequestURI"]; | ||
1028 | if(strlen($this->request_uri)==0 | ||
1029 | || substr($this->request_uri,0,1)!="/") | ||
1030 | return($this->SetError("4 it was not specified a valid request URI")); | ||
1031 | $this->request_arguments=$arguments; | ||
1032 | $this->request_headers=(IsSet($arguments["Headers"]) ? $arguments["Headers"] : array()); | ||
1033 | $body_length=0; | ||
1034 | $this->request_body=""; | ||
1035 | $get_body=1; | ||
1036 | if($this->request_method=="POST" | ||
1037 | || $this->request_method=="PUT") | ||
1038 | { | ||
1039 | if(IsSet($arguments['StreamRequest'])) | ||
1040 | { | ||
1041 | $get_body = 0; | ||
1042 | $this->request_headers["Transfer-Encoding"]="chunked"; | ||
1043 | } | ||
1044 | elseif(IsSet($arguments["PostFiles"]) | ||
1045 | || ($this->force_multipart_form_post | ||
1046 | && IsSet($arguments["PostValues"]))) | ||
1047 | { | ||
1048 | $boundary="--".md5(uniqid(time())); | ||
1049 | $this->request_headers["Content-Type"]="multipart/form-data; boundary=".$boundary.(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : ""); | ||
1050 | $post_parts=array(); | ||
1051 | if(IsSet($arguments["PostValues"])) | ||
1052 | { | ||
1053 | $values=$arguments["PostValues"]; | ||
1054 | if(GetType($values)!="array") | ||
1055 | return($this->SetError("5 it was not specified a valid POST method values array")); | ||
1056 | for(Reset($values),$value=0;$value<count($values);Next($values),$value++) | ||
1057 | { | ||
1058 | $input=Key($values); | ||
1059 | $headers="--".$boundary."\r\nContent-Disposition: form-data; name=\"".$input."\"\r\n\r\n"; | ||
1060 | $data=$values[$input]; | ||
1061 | $post_parts[]=array("HEADERS"=>$headers,"DATA"=>$data); | ||
1062 | $body_length+=strlen($headers)+strlen($data)+strlen("\r\n"); | ||
1063 | } | ||
1064 | } | ||
1065 | $body_length+=strlen("--".$boundary."--\r\n"); | ||
1066 | $files=(IsSet($arguments["PostFiles"]) ? $arguments["PostFiles"] : array()); | ||
1067 | Reset($files); | ||
1068 | $end=(GetType($input=Key($files))!="string"); | ||
1069 | for(;!$end;) | ||
1070 | { | ||
1071 | if(strlen($error=$this->GetFileDefinition($files[$input],$definition))) | ||
1072 | return("3 ".$error); | ||
1073 | $headers="--".$boundary."\r\nContent-Disposition: form-data; name=\"".$input."\"; filename=\"".$definition["NAME"]."\"\r\nContent-Type: ".$definition["Content-Type"]."\r\n\r\n"; | ||
1074 | $part=count($post_parts); | ||
1075 | $post_parts[$part]=array("HEADERS"=>$headers); | ||
1076 | if(IsSet($definition["FILENAME"])) | ||
1077 | { | ||
1078 | $post_parts[$part]["FILENAME"]=$definition["FILENAME"]; | ||
1079 | $data=""; | ||
1080 | } | ||
1081 | else | ||
1082 | $data=$definition["DATA"]; | ||
1083 | $post_parts[$part]["DATA"]=$data; | ||
1084 | $body_length+=strlen($headers)+$definition["Content-Length"]+strlen("\r\n"); | ||
1085 | Next($files); | ||
1086 | $end=(GetType($input=Key($files))!="string"); | ||
1087 | } | ||
1088 | $get_body=0; | ||
1089 | } | ||
1090 | elseif(IsSet($arguments["PostValues"])) | ||
1091 | { | ||
1092 | $values=$arguments["PostValues"]; | ||
1093 | if(GetType($values)!="array") | ||
1094 | return($this->SetError("5 it was not specified a valid POST method values array")); | ||
1095 | for(Reset($values),$value=0;$value<count($values);Next($values),$value++) | ||
1096 | { | ||
1097 | $k=Key($values); | ||
1098 | if(GetType($values[$k])=="array") | ||
1099 | { | ||
1100 | for($v = 0; $v < count($values[$k]); $v++) | ||
1101 | { | ||
1102 | if($value+$v>0) | ||
1103 | $this->request_body.="&"; | ||
1104 | $this->request_body.=UrlEncode($k)."=".UrlEncode($values[$k][$v]); | ||
1105 | } | ||
1106 | } | ||
1107 | else | ||
1108 | { | ||
1109 | if($value>0) | ||
1110 | $this->request_body.="&"; | ||
1111 | $this->request_body.=UrlEncode($k)."=".UrlEncode($values[$k]); | ||
1112 | } | ||
1113 | } | ||
1114 | $this->request_headers["Content-Type"]="application/x-www-form-urlencoded".(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : ""); | ||
1115 | $get_body=0; | ||
1116 | } | ||
1117 | } | ||
1118 | if($get_body | ||
1119 | && (IsSet($arguments["Body"]) | ||
1120 | || IsSet($arguments["BodyStream"]))) | ||
1121 | { | ||
1122 | if(IsSet($arguments["Body"])) | ||
1123 | $this->request_body=$arguments["Body"]; | ||
1124 | else | ||
1125 | { | ||
1126 | $stream=$arguments["BodyStream"]; | ||
1127 | $this->request_body=""; | ||
1128 | for($part=0; $part<count($stream); $part++) | ||
1129 | { | ||
1130 | if(IsSet($stream[$part]["Data"])) | ||
1131 | $this->request_body.=$stream[$part]["Data"]; | ||
1132 | elseif(IsSet($stream[$part]["File"])) | ||
1133 | { | ||
1134 | if(!($file=@fopen($stream[$part]["File"],"rb"))) | ||
1135 | return($this->SetPHPError("could not open upload file ".$stream[$part]["File"], $php_errormsg)); | ||
1136 | while(!feof($file)) | ||
1137 | { | ||
1138 | if(GetType($block=@fread($file,$this->file_buffer_length))!="string") | ||
1139 | { | ||
1140 | $error=$this->SetPHPError("could not read body stream file ".$stream[$part]["File"], $php_errormsg); | ||
1141 | fclose($file); | ||
1142 | return($error); | ||
1143 | } | ||
1144 | $this->request_body.=$block; | ||
1145 | } | ||
1146 | fclose($file); | ||
1147 | } | ||
1148 | else | ||
1149 | return("5 it was not specified a valid file or data body stream element at position ".$part); | ||
1150 | } | ||
1151 | } | ||
1152 | if(!IsSet($this->request_headers["Content-Type"])) | ||
1153 | $this->request_headers["Content-Type"]="application/octet-stream".(IsSet($arguments["CharSet"]) ? "; charset=".$arguments["CharSet"] : ""); | ||
1154 | } | ||
1155 | if(IsSet($arguments["AuthUser"])) | ||
1156 | $this->request_user=$arguments["AuthUser"]; | ||
1157 | elseif(IsSet($this->user)) | ||
1158 | $this->request_user=$this->user; | ||
1159 | if(IsSet($arguments["AuthPassword"])) | ||
1160 | $this->request_password=$arguments["AuthPassword"]; | ||
1161 | elseif(IsSet($this->password)) | ||
1162 | $this->request_password=$this->password; | ||
1163 | if(IsSet($arguments["AuthRealm"])) | ||
1164 | $this->request_realm=$arguments["AuthRealm"]; | ||
1165 | elseif(IsSet($this->realm)) | ||
1166 | $this->request_realm=$this->realm; | ||
1167 | if(IsSet($arguments["AuthWorkstation"])) | ||
1168 | $this->request_workstation=$arguments["AuthWorkstation"]; | ||
1169 | elseif(IsSet($this->workstation)) | ||
1170 | $this->request_workstation=$this->workstation; | ||
1171 | if(strlen($this->proxy_host_name)==0 | ||
1172 | || $connect) | ||
1173 | $request_uri=$this->request_uri; | ||
1174 | else | ||
1175 | { | ||
1176 | switch(strtolower($this->protocol)) | ||
1177 | { | ||
1178 | case "http": | ||
1179 | $default_port=80; | ||
1180 | break; | ||
1181 | case "https": | ||
1182 | $default_port=443; | ||
1183 | break; | ||
1184 | } | ||
1185 | $request_uri=strtolower($this->protocol)."://".$this->host_name.(($this->host_port==0 || $this->host_port==$default_port) ? "" : ":".$this->host_port).$this->request_uri; | ||
1186 | } | ||
1187 | if($this->use_curl) | ||
1188 | { | ||
1189 | $version=(GetType($v=curl_version())=="array" ? (IsSet($v["version"]) ? $v["version"] : "0.0.0") : (ereg("^libcurl/([0-9]+\\.[0-9]+\\.[0-9]+)",$v,$m) ? $m[1] : "0.0.0")); | ||
1190 | $curl_version=100000*intval($this->Tokenize($version,"."))+1000*intval($this->Tokenize("."))+intval($this->Tokenize("")); | ||
1191 | $protocol_version=($curl_version<713002 ? "1.0" : $this->protocol_version); | ||
1192 | } | ||
1193 | else | ||
1194 | $protocol_version=$this->protocol_version; | ||
1195 | $this->request=$this->request_method." ".$request_uri." HTTP/".$protocol_version; | ||
1196 | if($body_length | ||
1197 | || ($body_length=strlen($this->request_body))) | ||
1198 | $this->request_headers["Content-Length"]=$body_length; | ||
1199 | for($headers=array(),$host_set=0,Reset($this->request_headers),$header=0;$header<count($this->request_headers);Next($this->request_headers),$header++) | ||
1200 | { | ||
1201 | $header_name=Key($this->request_headers); | ||
1202 | $header_value=$this->request_headers[$header_name]; | ||
1203 | if(GetType($header_value)=="array") | ||
1204 | { | ||
1205 | for(Reset($header_value),$value=0;$value<count($header_value);Next($header_value),$value++) | ||
1206 | $headers[]=$header_name.": ".$header_value[Key($header_value)]; | ||
1207 | } | ||
1208 | else | ||
1209 | $headers[]=$header_name.": ".$header_value; | ||
1210 | if(strtolower(Key($this->request_headers))=="host") | ||
1211 | { | ||
1212 | $this->request_host=strtolower($header_value); | ||
1213 | $host_set=1; | ||
1214 | } | ||
1215 | } | ||
1216 | if(!$host_set) | ||
1217 | { | ||
1218 | $headers[]="Host: ".$this->host_name; | ||
1219 | $this->request_host=strtolower($this->host_name); | ||
1220 | } | ||
1221 | if(count($this->cookies)) | ||
1222 | { | ||
1223 | $cookies=array(); | ||
1224 | $this->PickCookies($cookies,0); | ||
1225 | if(strtolower($this->protocol)=="https") | ||
1226 | $this->PickCookies($cookies,1); | ||
1227 | if(count($cookies)) | ||
1228 | { | ||
1229 | $h=count($headers); | ||
1230 | $headers[$h]="Cookie:"; | ||
1231 | for(Reset($cookies),$cookie=0;$cookie<count($cookies);Next($cookies),$cookie++) | ||
1232 | { | ||
1233 | $cookie_name=Key($cookies); | ||
1234 | $headers[$h].=" ".$cookie_name."=".$cookies[$cookie_name]["value"].";"; | ||
1235 | } | ||
1236 | } | ||
1237 | } | ||
1238 | $next_state = "RequestSent"; | ||
1239 | if($this->use_curl) | ||
1240 | { | ||
1241 | if(IsSet($arguments['StreamRequest'])) | ||
1242 | return($this->SetError("Streaming request data is not supported when using Curl")); | ||
1243 | if($body_length | ||
1244 | && strlen($this->request_body)==0) | ||
1245 | { | ||
1246 | for($request_body="",$success=1,$part=0;$part<count($post_parts);$part++) | ||
1247 | { | ||
1248 | $request_body.=$post_parts[$part]["HEADERS"].$post_parts[$part]["DATA"]; | ||
1249 | if(IsSet($post_parts[$part]["FILENAME"])) | ||
1250 | { | ||
1251 | if(!($file=@fopen($post_parts[$part]["FILENAME"],"rb"))) | ||
1252 | { | ||
1253 | $this->SetPHPError("could not open upload file ".$post_parts[$part]["FILENAME"], $php_errormsg); | ||
1254 | $success=0; | ||
1255 | break; | ||
1256 | } | ||
1257 | while(!feof($file)) | ||
1258 | { | ||
1259 | if(GetType($block=@fread($file,$this->file_buffer_length))!="string") | ||
1260 | { | ||
1261 | $this->SetPHPError("could not read upload file", $php_errormsg); | ||
1262 | $success=0; | ||
1263 | break; | ||
1264 | } | ||
1265 | $request_body.=$block; | ||
1266 | } | ||
1267 | fclose($file); | ||
1268 | if(!$success) | ||
1269 | break; | ||
1270 | } | ||
1271 | $request_body.="\r\n"; | ||
1272 | } | ||
1273 | $request_body.="--".$boundary."--\r\n"; | ||
1274 | } | ||
1275 | else | ||
1276 | $request_body=$this->request_body; | ||
1277 | curl_setopt($this->connection,CURLOPT_HEADER,1); | ||
1278 | curl_setopt($this->connection,CURLOPT_RETURNTRANSFER,1); | ||
1279 | if($this->timeout) | ||
1280 | curl_setopt($this->connection,CURLOPT_TIMEOUT,$this->timeout); | ||
1281 | curl_setopt($this->connection,CURLOPT_SSL_VERIFYPEER,0); | ||
1282 | curl_setopt($this->connection,CURLOPT_SSL_VERIFYHOST,0); | ||
1283 | $request=$this->request."\r\n".implode("\r\n",$headers)."\r\n\r\n".$request_body; | ||
1284 | curl_setopt($this->connection,CURLOPT_CUSTOMREQUEST,$request); | ||
1285 | if($this->debug) | ||
1286 | $this->OutputDebug("C ".$request); | ||
1287 | if(!($success=(strlen($this->response=curl_exec($this->connection))!=0))) | ||
1288 | { | ||
1289 | $error=curl_error($this->connection); | ||
1290 | $this->SetError("Could not execute the request".(strlen($error) ? ": ".$error : "")); | ||
1291 | } | ||
1292 | } | ||
1293 | else | ||
1294 | { | ||
1295 | if(($success=$this->PutLine($this->request))) | ||
1296 | { | ||
1297 | for($header=0;$header<count($headers);$header++) | ||
1298 | { | ||
1299 | if(!$success=$this->PutLine($headers[$header])) | ||
1300 | break; | ||
1301 | } | ||
1302 | if($success | ||
1303 | && ($success=$this->PutLine(""))) | ||
1304 | { | ||
1305 | if(IsSet($arguments['StreamRequest'])) | ||
1306 | $next_state = "SendingRequestBody"; | ||
1307 | elseif($body_length) | ||
1308 | { | ||
1309 | if(strlen($this->request_body)) | ||
1310 | $success=$this->PutData($this->request_body); | ||
1311 | else | ||
1312 | { | ||
1313 | for($part=0;$part<count($post_parts);$part++) | ||
1314 | { | ||
1315 | if(!($success=$this->PutData($post_parts[$part]["HEADERS"])) | ||
1316 | || !($success=$this->PutData($post_parts[$part]["DATA"]))) | ||
1317 | break; | ||
1318 | if(IsSet($post_parts[$part]["FILENAME"])) | ||
1319 | { | ||
1320 | if(!($file=@fopen($post_parts[$part]["FILENAME"],"rb"))) | ||
1321 | { | ||
1322 | $this->SetPHPError("could not open upload file ".$post_parts[$part]["FILENAME"], $php_errormsg); | ||
1323 | $success=0; | ||
1324 | break; | ||
1325 | } | ||
1326 | while(!feof($file)) | ||
1327 | { | ||
1328 | if(GetType($block=@fread($file,$this->file_buffer_length))!="string") | ||
1329 | { | ||
1330 | $this->SetPHPError("could not read upload file", $php_errormsg); | ||
1331 | $success=0; | ||
1332 | break; | ||
1333 | } | ||
1334 | if(!($success=$this->PutData($block))) | ||
1335 | break; | ||
1336 | } | ||
1337 | fclose($file); | ||
1338 | if(!$success) | ||
1339 | break; | ||
1340 | } | ||
1341 | if(!($success=$this->PutLine(""))) | ||
1342 | break; | ||
1343 | } | ||
1344 | if($success) | ||
1345 | $success=$this->PutLine("--".$boundary."--"); | ||
1346 | } | ||
1347 | if($success) | ||
1348 | $sucess=$this->FlushData(); | ||
1349 | } | ||
1350 | } | ||
1351 | } | ||
1352 | } | ||
1353 | if(!$success) | ||
1354 | return($this->SetError("5 could not send the HTTP request: ".$this->error)); | ||
1355 | $this->state=$next_state; | ||
1356 | return(""); | ||
1357 | } | ||
1358 | |||
1359 | Function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0) | ||
1360 | { | ||
1361 | if(strlen($this->error)) | ||
1362 | return($this->error); | ||
1363 | if(strlen($name)==0) | ||
1364 | return($this->SetError("it was not specified a valid cookie name")); | ||
1365 | if(strlen($path)==0 | ||
1366 | || strcmp($path[0],"/")) | ||
1367 | return($this->SetError($path." is not a valid path for setting cookie ".$name)); | ||
1368 | if($domain=="" | ||
1369 | || !strpos($domain,".",$domain[0]=="." ? 1 : 0)) | ||
1370 | return($this->SetError($domain." is not a valid domain for setting cookie ".$name)); | ||
1371 | $domain=strtolower($domain); | ||
1372 | if(!strcmp($domain[0],".")) | ||
1373 | $domain=substr($domain,1); | ||
1374 | if(!$verbatim) | ||
1375 | { | ||
1376 | $name=$this->CookieEncode($name,1); | ||
1377 | $value=$this->CookieEncode($value,0); | ||
1378 | } | ||
1379 | $secure=intval($secure); | ||
1380 | $this->cookies[$secure][$domain][$path][$name]=array( | ||
1381 | "name"=>$name, | ||
1382 | "value"=>$value, | ||
1383 | "domain"=>$domain, | ||
1384 | "path"=>$path, | ||
1385 | "expires"=>$expires, | ||
1386 | "secure"=>$secure | ||
1387 | ); | ||
1388 | return(""); | ||
1389 | } | ||
1390 | |||
1391 | Function SendRequestBody($data, $end_of_data) | ||
1392 | { | ||
1393 | if(strlen($this->error)) | ||
1394 | return($this->error); | ||
1395 | switch($this->state) | ||
1396 | { | ||
1397 | case "Disconnected": | ||
1398 | return($this->SetError("1 connection was not yet established")); | ||
1399 | case "Connected": | ||
1400 | case "ConnectedToProxy": | ||
1401 | return($this->SetError("2 request was not sent")); | ||
1402 | case "SendingRequestBody": | ||
1403 | break; | ||
1404 | case "RequestSent": | ||
1405 | return($this->SetError("3 request body was already sent")); | ||
1406 | default: | ||
1407 | return($this->SetError("4 can not send the request body in the current connection state")); | ||
1408 | } | ||
1409 | $length = strlen($data); | ||
1410 | if($length) | ||
1411 | { | ||
1412 | $size = dechex($length)."\r\n"; | ||
1413 | if(!$this->PutData($size) | ||
1414 | || !$this->PutData($data)) | ||
1415 | return($this->error); | ||
1416 | } | ||
1417 | if($end_of_data) | ||
1418 | { | ||
1419 | $size = "0\r\n"; | ||
1420 | if(!$this->PutData($size)) | ||
1421 | return($this->error); | ||
1422 | $this->state = "RequestSent"; | ||
1423 | } | ||
1424 | return(""); | ||
1425 | } | ||
1426 | |||
1427 | Function ReadReplyHeadersResponse(&$headers) | ||
1428 | { | ||
1429 | $headers=array(); | ||
1430 | if(strlen($this->error)) | ||
1431 | return($this->error); | ||
1432 | switch($this->state) | ||
1433 | { | ||
1434 | case "Disconnected": | ||
1435 | return($this->SetError("1 connection was not yet established")); | ||
1436 | case "Connected": | ||
1437 | return($this->SetError("2 request was not sent")); | ||
1438 | case "ConnectedToProxy": | ||
1439 | return($this->SetError("2 connection from the remote server from the proxy was not yet established")); | ||
1440 | case "SendingRequestBody": | ||
1441 | return($this->SetError("4 request body data was not completely sent")); | ||
1442 | case "ConnectSent": | ||
1443 | $connect = 1; | ||
1444 | break; | ||
1445 | case "RequestSent": | ||
1446 | $connect = 0; | ||
1447 | break; | ||
1448 | default: | ||
1449 | return($this->SetError("3 can not get request headers in the current connection state")); | ||
1450 | } | ||
1451 | $this->content_length=$this->read_length=$this->read_response=$this->remaining_chunk=0; | ||
1452 | $this->content_length_set=$this->chunked=$this->last_chunk_read=$chunked=0; | ||
1453 | $this->connection_close=0; | ||
1454 | for($this->response_status="";;) | ||
1455 | { | ||
1456 | $line=$this->GetLine(); | ||
1457 | if(GetType($line)!="string") | ||
1458 | return($this->SetError("4 could not read request reply: ".$this->error)); | ||
1459 | if(strlen($this->response_status)==0) | ||
1460 | { | ||
1461 | if(!eregi($match="^http/[0-9]+\\.[0-9]+[ \t]+([0-9]+)[ \t]*(.*)\$",$line,$matches)) | ||
1462 | return($this->SetError("3 it was received an unexpected HTTP response status")); | ||
1463 | $this->response_status=$matches[1]; | ||
1464 | $this->response_message=$matches[2]; | ||
1465 | } | ||
1466 | if($line=="") | ||
1467 | { | ||
1468 | if(strlen($this->response_status)==0) | ||
1469 | return($this->SetError("3 it was not received HTTP response status")); | ||
1470 | $this->state=($connect ? "GotConnectHeaders" : "GotReplyHeaders"); | ||
1471 | break; | ||
1472 | } | ||
1473 | $header_name=strtolower($this->Tokenize($line,":")); | ||
1474 | $header_value=Trim(Chop($this->Tokenize("\r\n"))); | ||
1475 | if(IsSet($headers[$header_name])) | ||
1476 | { | ||
1477 | if(GetType($headers[$header_name])=="string") | ||
1478 | $headers[$header_name]=array($headers[$header_name]); | ||
1479 | $headers[$header_name][]=$header_value; | ||
1480 | } | ||
1481 | else | ||
1482 | $headers[$header_name]=$header_value; | ||
1483 | if(!$connect) | ||
1484 | { | ||
1485 | switch($header_name) | ||
1486 | { | ||
1487 | case "content-length": | ||
1488 | $this->content_length=intval($headers[$header_name]); | ||
1489 | $this->content_length_set=1; | ||
1490 | break; | ||
1491 | case "transfer-encoding": | ||
1492 | $encoding=$this->Tokenize($header_value,"; \t"); | ||
1493 | if(!$this->use_curl | ||
1494 | && !strcmp($encoding,"chunked")) | ||
1495 | $chunked=1; | ||
1496 | break; | ||
1497 | case "set-cookie": | ||
1498 | if($this->support_cookies) | ||
1499 | { | ||
1500 | if(GetType($headers[$header_name])=="array") | ||
1501 | $cookie_headers=$headers[$header_name]; | ||
1502 | else | ||
1503 | $cookie_headers=array($headers[$header_name]); | ||
1504 | for($cookie=0;$cookie<count($cookie_headers);$cookie++) | ||
1505 | { | ||
1506 | $cookie_name=trim($this->Tokenize($cookie_headers[$cookie],"=")); | ||
1507 | $cookie_value=$this->Tokenize(";"); | ||
1508 | $domain=$this->request_host; | ||
1509 | $path="/"; | ||
1510 | $expires=""; | ||
1511 | $secure=0; | ||
1512 | while(($name=trim(UrlDecode($this->Tokenize("="))))!="") | ||
1513 | { | ||
1514 | $value=UrlDecode($this->Tokenize(";")); | ||
1515 | switch($name) | ||
1516 | { | ||
1517 | case "domain": | ||
1518 | $domain=$value; | ||
1519 | break; | ||
1520 | case "path": | ||
1521 | $path=$value; | ||
1522 | break; | ||
1523 | case "expires": | ||
1524 | if(ereg("^((Mon|Monday|Tue|Tuesday|Wed|Wednesday|Thu|Thursday|Fri|Friday|Sat|Saturday|Sun|Sunday), )?([0-9]{2})\\-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\-([0-9]{2,4}) ([0-9]{2})\\:([0-9]{2})\\:([0-9]{2}) GMT\$",$value,$matches)) | ||
1525 | { | ||
1526 | $year=intval($matches[5]); | ||
1527 | if($year<1900) | ||
1528 | $year+=($year<70 ? 2000 : 1900); | ||
1529 | $expires="$year-".$this->months[$matches[4]]."-".$matches[3]." ".$matches[6].":".$matches[7].":".$matches[8]; | ||
1530 | } | ||
1531 | break; | ||
1532 | case "secure": | ||
1533 | $secure=1; | ||
1534 | break; | ||
1535 | } | ||
1536 | } | ||
1537 | if(strlen($this->SetCookie($cookie_name, $cookie_value, $expires, $path , $domain, $secure, 1))) | ||
1538 | $this->error=""; | ||
1539 | } | ||
1540 | } | ||
1541 | break; | ||
1542 | case "connection": | ||
1543 | $this->connection_close=!strcmp(strtolower($header_value),"close"); | ||
1544 | break; | ||
1545 | } | ||
1546 | } | ||
1547 | } | ||
1548 | $this->chunked=$chunked; | ||
1549 | if($this->content_length_set) | ||
1550 | $this->connection_close=0; | ||
1551 | return(""); | ||
1552 | } | ||
1553 | |||
1554 | Function Redirect(&$headers) | ||
1555 | { | ||
1556 | if($this->follow_redirect) | ||
1557 | { | ||
1558 | if(!IsSet($headers["location"]) | ||
1559 | || (GetType($headers["location"])!="array" | ||
1560 | && strlen($location=$headers["location"])==0) | ||
1561 | || (GetType($headers["location"])=="array" | ||
1562 | && strlen($location=$headers["location"][0])==0)) | ||
1563 | return($this->SetError("3 it was received a redirect without location URL")); | ||
1564 | if(strcmp($location[0],"/")) | ||
1565 | { | ||
1566 | $location_arguments=parse_url($location); | ||
1567 | if(!IsSet($location_arguments["scheme"])) | ||
1568 | $location=((GetType($end=strrpos($this->request_uri,"/"))=="integer" && $end>1) ? substr($this->request_uri,0,$end) : "")."/".$location; | ||
1569 | } | ||
1570 | if(!strcmp($location[0],"/")) | ||
1571 | $location=$this->protocol."://".$this->host_name.($this->host_port ? ":".$this->host_port : "").$location; | ||
1572 | $error=$this->GetRequestArguments($location,$arguments); | ||
1573 | if(strlen($error)) | ||
1574 | return($this->SetError("could not process redirect url: ".$error)); | ||
1575 | $arguments["RequestMethod"]="GET"; | ||
1576 | if(strlen($error=$this->Close())==0 | ||
1577 | && strlen($error=$this->Open($arguments))==0 | ||
1578 | && strlen($error=$this->SendRequest($arguments))==0) | ||
1579 | { | ||
1580 | $this->redirection_level++; | ||
1581 | if($this->redirection_level>$this->redirection_limit) | ||
1582 | $error="it was exceeded the limit of request redirections"; | ||
1583 | else | ||
1584 | $error=$this->ReadReplyHeaders($headers); | ||
1585 | $this->redirection_level--; | ||
1586 | } | ||
1587 | if(strlen($error)) | ||
1588 | return($this->SetError($error)); | ||
1589 | } | ||
1590 | return(""); | ||
1591 | } | ||
1592 | |||
1593 | Function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation) | ||
1594 | { | ||
1595 | if($proxy) | ||
1596 | { | ||
1597 | $authenticate_header="proxy-authenticate"; | ||
1598 | $authorization_header="Proxy-Authorization"; | ||
1599 | $authenticate_status="407"; | ||
1600 | $authentication_mechanism=$this->proxy_authentication_mechanism; | ||
1601 | } | ||
1602 | else | ||
1603 | { | ||
1604 | $authenticate_header="www-authenticate"; | ||
1605 | $authorization_header="Authorization"; | ||
1606 | $authenticate_status="401"; | ||
1607 | $authentication_mechanism=$this->authentication_mechanism; | ||
1608 | } | ||
1609 | if(IsSet($headers[$authenticate_header])) | ||
1610 | { | ||
1611 | if(function_exists("class_exists") | ||
1612 | && !class_exists("sasl_client_class")) | ||
1613 | return($this->SetError("the SASL client class needs to be loaded to be able to authenticate".($proxy ? " with the proxy server" : "")." and access this site")); | ||
1614 | if(GetType($headers[$authenticate_header])=="array") | ||
1615 | $authenticate=$headers[$authenticate_header]; | ||
1616 | else | ||
1617 | $authenticate=array($headers[$authenticate_header]); | ||
1618 | for($response="", $mechanisms=array(),$m=0;$m<count($authenticate);$m++) | ||
1619 | { | ||
1620 | $mechanism=$this->Tokenize($authenticate[$m]," "); | ||
1621 | $response=$this->Tokenize(""); | ||
1622 | if(strlen($authentication_mechanism)) | ||
1623 | { | ||
1624 | if(!strcmp($authentication_mechanism,$mechanism)) | ||
1625 | { | ||
1626 | $mechanisms[]=$mechanism; | ||
1627 | break; | ||
1628 | } | ||
1629 | } | ||
1630 | else | ||
1631 | $mechanisms[]=$mechanism; | ||
1632 | } | ||
1633 | $sasl=new sasl_client_class; | ||
1634 | if(IsSet($user)) | ||
1635 | $sasl->SetCredential("user",$user); | ||
1636 | if(IsSet($password)) | ||
1637 | $sasl->SetCredential("password",$password); | ||
1638 | if(IsSet($realm)) | ||
1639 | $sasl->SetCredential("realm",$realm); | ||
1640 | if(IsSet($workstation)) | ||
1641 | $sasl->SetCredential("workstation",$workstation); | ||
1642 | $sasl->SetCredential("uri",$this->request_uri); | ||
1643 | $sasl->SetCredential("method",$this->request_method); | ||
1644 | $sasl->SetCredential("session",$this->session); | ||
1645 | do | ||
1646 | { | ||
1647 | $status=$sasl->Start($mechanisms,$message,$interactions); | ||
1648 | } | ||
1649 | while($status==SASL_INTERACT); | ||
1650 | switch($status) | ||
1651 | { | ||
1652 | case SASL_CONTINUE: | ||
1653 | break; | ||
1654 | case SASL_NOMECH: | ||
1655 | return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".(strlen($authentication_mechanism) ? "authentication mechanism ".$authentication_mechanism." may not be used: " : "").$sasl->error)); | ||
1656 | default: | ||
1657 | return($this->SetError("Could not start the SASL ".($proxy ? "proxy " : "")."authentication client: ".$sasl->error)); | ||
1658 | } | ||
1659 | if($proxy >= 0) | ||
1660 | { | ||
1661 | for(;;) | ||
1662 | { | ||
1663 | if(strlen($error=$this->ReadReplyBody($body,$this->file_buffer_length))) | ||
1664 | return($error); | ||
1665 | if(strlen($body)==0) | ||
1666 | break; | ||
1667 | } | ||
1668 | } | ||
1669 | $authorization_value=$sasl->mechanism.(IsSet($message) ? " ".($sasl->encode_response ? base64_encode($message) : $message) : ""); | ||
1670 | $request_arguments=$this->request_arguments; | ||
1671 | $arguments=$request_arguments; | ||
1672 | $arguments["Headers"][$authorization_header]=$authorization_value; | ||
1673 | if(!$proxy | ||
1674 | && strlen($proxy_authorization)) | ||
1675 | $arguments["Headers"]["Proxy-Authorization"]=$proxy_authorization; | ||
1676 | if(strlen($error=$this->Close()) | ||
1677 | || strlen($error=$this->Open($arguments))) | ||
1678 | return($this->SetError($error)); | ||
1679 | $authenticated=0; | ||
1680 | if(IsSet($message)) | ||
1681 | { | ||
1682 | if($proxy < 0) | ||
1683 | { | ||
1684 | if(strlen($error=$this->ConnectFromProxy($arguments, $headers))) | ||
1685 | return($this->SetError($error)); | ||
1686 | } | ||
1687 | else | ||
1688 | { | ||
1689 | if(strlen($error=$this->SendRequest($arguments)) | ||
1690 | || strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
1691 | return($this->SetError($error)); | ||
1692 | } | ||
1693 | if(!IsSet($headers[$authenticate_header])) | ||
1694 | $authenticate=array(); | ||
1695 | elseif(GetType($headers[$authenticate_header])=="array") | ||
1696 | $authenticate=$headers[$authenticate_header]; | ||
1697 | else | ||
1698 | $authenticate=array($headers[$authenticate_header]); | ||
1699 | for($mechanism=0;$mechanism<count($authenticate);$mechanism++) | ||
1700 | { | ||
1701 | if(!strcmp($this->Tokenize($authenticate[$mechanism]," "),$sasl->mechanism)) | ||
1702 | { | ||
1703 | $response=$this->Tokenize(""); | ||
1704 | break; | ||
1705 | } | ||
1706 | } | ||
1707 | switch($this->response_status) | ||
1708 | { | ||
1709 | case $authenticate_status: | ||
1710 | break; | ||
1711 | case "301": | ||
1712 | case "302": | ||
1713 | case "303": | ||
1714 | case "307": | ||
1715 | if($proxy >= 0) | ||
1716 | return($this->Redirect($headers)); | ||
1717 | default: | ||
1718 | if(intval($this->response_status/100)==2) | ||
1719 | { | ||
1720 | if($proxy) | ||
1721 | $proxy_authorization=$authorization_value; | ||
1722 | $authenticated=1; | ||
1723 | break; | ||
1724 | } | ||
1725 | if($proxy | ||
1726 | && !strcmp($this->response_status,"401")) | ||
1727 | { | ||
1728 | $proxy_authorization=$authorization_value; | ||
1729 | $authenticated=1; | ||
1730 | break; | ||
1731 | } | ||
1732 | return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".$this->response_status." ".$this->response_message)); | ||
1733 | } | ||
1734 | } | ||
1735 | for(;!$authenticated;) | ||
1736 | { | ||
1737 | do | ||
1738 | { | ||
1739 | $status=$sasl->Step($response,$message,$interactions); | ||
1740 | } | ||
1741 | while($status==SASL_INTERACT); | ||
1742 | switch($status) | ||
1743 | { | ||
1744 | case SASL_CONTINUE: | ||
1745 | $authorization_value=$sasl->mechanism.(IsSet($message) ? " ".($sasl->encode_response ? base64_encode($message) : $message) : ""); | ||
1746 | $arguments=$request_arguments; | ||
1747 | $arguments["Headers"][$authorization_header]=$authorization_value; | ||
1748 | if(!$proxy | ||
1749 | && strlen($proxy_authorization)) | ||
1750 | $arguments["Headers"]["Proxy-Authorization"]=$proxy_authorization; | ||
1751 | if($proxy < 0) | ||
1752 | { | ||
1753 | if(strlen($error=$this->ConnectFromProxy($arguments, $headers))) | ||
1754 | return($this->SetError($error)); | ||
1755 | } | ||
1756 | else | ||
1757 | { | ||
1758 | if(strlen($error=$this->SendRequest($arguments)) | ||
1759 | || strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
1760 | return($this->SetError($error)); | ||
1761 | } | ||
1762 | switch($this->response_status) | ||
1763 | { | ||
1764 | case $authenticate_status: | ||
1765 | if(GetType($headers[$authenticate_header])=="array") | ||
1766 | $authenticate=$headers[$authenticate_header]; | ||
1767 | else | ||
1768 | $authenticate=array($headers[$authenticate_header]); | ||
1769 | for($response="",$mechanism=0;$mechanism<count($authenticate);$mechanism++) | ||
1770 | { | ||
1771 | if(!strcmp($this->Tokenize($authenticate[$mechanism]," "),$sasl->mechanism)) | ||
1772 | { | ||
1773 | $response=$this->Tokenize(""); | ||
1774 | break; | ||
1775 | } | ||
1776 | } | ||
1777 | if($proxy >= 0) | ||
1778 | { | ||
1779 | for(;;) | ||
1780 | { | ||
1781 | if(strlen($error=$this->ReadReplyBody($body,$this->file_buffer_length))) | ||
1782 | return($error); | ||
1783 | if(strlen($body)==0) | ||
1784 | break; | ||
1785 | } | ||
1786 | } | ||
1787 | $this->state="Connected"; | ||
1788 | break; | ||
1789 | case "301": | ||
1790 | case "302": | ||
1791 | case "303": | ||
1792 | case "307": | ||
1793 | if($proxy >= 0) | ||
1794 | return($this->Redirect($headers)); | ||
1795 | default: | ||
1796 | if(intval($this->response_status/100)==2) | ||
1797 | { | ||
1798 | if($proxy) | ||
1799 | $proxy_authorization=$authorization_value; | ||
1800 | $authenticated=1; | ||
1801 | break; | ||
1802 | } | ||
1803 | if($proxy | ||
1804 | && !strcmp($this->response_status,"401")) | ||
1805 | { | ||
1806 | $proxy_authorization=$authorization_value; | ||
1807 | $authenticated=1; | ||
1808 | break; | ||
1809 | } | ||
1810 | return($this->SetError(($proxy ? "proxy " : "")."authentication error: ".$this->response_status." ".$this->response_message)); | ||
1811 | } | ||
1812 | break; | ||
1813 | default: | ||
1814 | return($this->SetError("Could not process the SASL ".($proxy ? "proxy " : "")."authentication step: ".$sasl->error)); | ||
1815 | } | ||
1816 | } | ||
1817 | } | ||
1818 | return(""); | ||
1819 | } | ||
1820 | |||
1821 | Function ReadReplyHeaders(&$headers) | ||
1822 | { | ||
1823 | if(strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
1824 | return($error); | ||
1825 | $proxy_authorization=""; | ||
1826 | while(!strcmp($this->response_status, "100")) | ||
1827 | { | ||
1828 | $this->state="RequestSent"; | ||
1829 | if(strlen($error=$this->ReadReplyHeadersResponse($headers))) | ||
1830 | return($error); | ||
1831 | } | ||
1832 | switch($this->response_status) | ||
1833 | { | ||
1834 | case "301": | ||
1835 | case "302": | ||
1836 | case "303": | ||
1837 | case "307": | ||
1838 | if(strlen($error=$this->Redirect($headers))) | ||
1839 | return($error); | ||
1840 | break; | ||
1841 | case "407": | ||
1842 | if(strlen($error=$this->Authenticate($headers, 1, $proxy_authorization, $this->proxy_request_user, $this->proxy_request_password, $this->proxy_request_realm, $this->proxy_request_workstation))) | ||
1843 | return($error); | ||
1844 | if(strcmp($this->response_status,"401")) | ||
1845 | return(""); | ||
1846 | case "401": | ||
1847 | return($this->Authenticate($headers, 0, $proxy_authorization, $this->request_user, $this->request_password, $this->request_realm, $this->request_workstation)); | ||
1848 | } | ||
1849 | return(""); | ||
1850 | } | ||
1851 | |||
1852 | Function ReadReplyBody(&$body,$length) | ||
1853 | { | ||
1854 | $body=""; | ||
1855 | if(strlen($this->error)) | ||
1856 | return($this->error); | ||
1857 | switch($this->state) | ||
1858 | { | ||
1859 | case "Disconnected": | ||
1860 | return($this->SetError("1 connection was not yet established")); | ||
1861 | case "Connected": | ||
1862 | case "ConnectedToProxy": | ||
1863 | return($this->SetError("2 request was not sent")); | ||
1864 | case "RequestSent": | ||
1865 | if(($error=$this->ReadReplyHeaders($headers))!="") | ||
1866 | return($error); | ||
1867 | break; | ||
1868 | case "GotReplyHeaders": | ||
1869 | break; | ||
1870 | default: | ||
1871 | return($this->SetError("3 can not get request headers in the current connection state")); | ||
1872 | } | ||
1873 | if($this->content_length_set) | ||
1874 | $length=min($this->content_length-$this->read_length,$length); | ||
1875 | if($length>0 | ||
1876 | && !$this->EndOfInput() | ||
1877 | && ($body=$this->ReadBytes($length))=="") | ||
1878 | { | ||
1879 | if(strlen($this->error)) | ||
1880 | return($this->SetError("4 could not get the request reply body: ".$this->error)); | ||
1881 | } | ||
1882 | $this->read_length+=strlen($body); | ||
1883 | return(""); | ||
1884 | } | ||
1885 | |||
1886 | Function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0) | ||
1887 | { | ||
1888 | $now=gmdate("Y-m-d H-i-s"); | ||
1889 | $cookies=array(); | ||
1890 | for($secure_cookies=0,Reset($this->cookies);$secure_cookies<count($this->cookies);Next($this->cookies),$secure_cookies++) | ||
1891 | { | ||
1892 | $secure=Key($this->cookies); | ||
1893 | if(!$secure_only | ||
1894 | || $secure) | ||
1895 | { | ||
1896 | for($cookie_domain=0,Reset($this->cookies[$secure]);$cookie_domain<count($this->cookies[$secure]);Next($this->cookies[$secure]),$cookie_domain++) | ||
1897 | { | ||
1898 | $domain_pattern=Key($this->cookies[$secure]); | ||
1899 | $match=strlen($domain)-strlen($domain_pattern); | ||
1900 | if(strlen($domain)==0 | ||
1901 | || ($match>=0 | ||
1902 | && !strcmp($domain_pattern,substr($domain,$match)) | ||
1903 | && ($match==0 | ||
1904 | || $domain_pattern[0]=="." | ||
1905 | || $domain[$match-1]=="."))) | ||
1906 | { | ||
1907 | for(Reset($this->cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($this->cookies[$secure][$domain_pattern]);Next($this->cookies[$secure][$domain_pattern]),$path_part++) | ||
1908 | { | ||
1909 | $path=Key($this->cookies[$secure][$domain_pattern]); | ||
1910 | for(Reset($this->cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($this->cookies[$secure][$domain_pattern][$path]);Next($this->cookies[$secure][$domain_pattern][$path]),$cookie++) | ||
1911 | { | ||
1912 | $cookie_name=Key($this->cookies[$secure][$domain_pattern][$path]); | ||
1913 | $expires=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"]; | ||
1914 | if((!$persistent_only | ||
1915 | && strlen($expires)==0) | ||
1916 | || (strlen($expires) | ||
1917 | && strcmp($now,$expires)<0)) | ||
1918 | $cookies[$secure][$domain_pattern][$path][$cookie_name]=$this->cookies[$secure][$domain_pattern][$path][$cookie_name]; | ||
1919 | } | ||
1920 | } | ||
1921 | } | ||
1922 | } | ||
1923 | } | ||
1924 | } | ||
1925 | } | ||
1926 | |||
1927 | Function SavePersistentCookies(&$cookies, $domain='', $secure_only=0) | ||
1928 | { | ||
1929 | $this->SaveCookies($cookies, $domain, $secure_only, 1); | ||
1930 | } | ||
1931 | |||
1932 | Function GetPersistentCookies(&$cookies, $domain='', $secure_only=0) | ||
1933 | { | ||
1934 | $this->SavePersistentCookies($cookies, $domain, $secure_only); | ||
1935 | } | ||
1936 | |||
1937 | Function RestoreCookies($cookies, $clear=1) | ||
1938 | { | ||
1939 | $new_cookies=($clear ? array() : $this->cookies); | ||
1940 | for($secure_cookies=0, Reset($cookies); $secure_cookies<count($cookies); Next($cookies), $secure_cookies++) | ||
1941 | { | ||
1942 | $secure=Key($cookies); | ||
1943 | if(GetType($secure)!="integer") | ||
1944 | return($this->SetError("invalid cookie secure value type (".serialize($secure).")")); | ||
1945 | for($cookie_domain=0,Reset($cookies[$secure]);$cookie_domain<count($cookies[$secure]);Next($cookies[$secure]),$cookie_domain++) | ||
1946 | { | ||
1947 | $domain_pattern=Key($cookies[$secure]); | ||
1948 | if(GetType($domain_pattern)!="string") | ||
1949 | return($this->SetError("invalid cookie domain value type (".serialize($domain_pattern).")")); | ||
1950 | for(Reset($cookies[$secure][$domain_pattern]),$path_part=0;$path_part<count($cookies[$secure][$domain_pattern]);Next($cookies[$secure][$domain_pattern]),$path_part++) | ||
1951 | { | ||
1952 | $path=Key($cookies[$secure][$domain_pattern]); | ||
1953 | if(GetType($path)!="string" | ||
1954 | || strcmp(substr($path, 0, 1), "/")) | ||
1955 | return($this->SetError("invalid cookie path value type (".serialize($path).")")); | ||
1956 | for(Reset($cookies[$secure][$domain_pattern][$path]),$cookie=0;$cookie<count($cookies[$secure][$domain_pattern][$path]);Next($cookies[$secure][$domain_pattern][$path]),$cookie++) | ||
1957 | { | ||
1958 | $cookie_name=Key($cookies[$secure][$domain_pattern][$path]); | ||
1959 | $expires=$cookies[$secure][$domain_pattern][$path][$cookie_name]["expires"]; | ||
1960 | $value=$cookies[$secure][$domain_pattern][$path][$cookie_name]["value"]; | ||
1961 | if(GetType($expires)!="string" | ||
1962 | || (strlen($expires) | ||
1963 | && !ereg("^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\$", $expires))) | ||
1964 | return($this->SetError("invalid cookie expiry value type (".serialize($expires).")")); | ||
1965 | $new_cookies[$secure][$domain_pattern][$path][$cookie_name]=array( | ||
1966 | "name"=>$cookie_name, | ||
1967 | "value"=>$value, | ||
1968 | "domain"=>$domain_pattern, | ||
1969 | "path"=>$path, | ||
1970 | "expires"=>$expires, | ||
1971 | "secure"=>$secure | ||
1972 | ); | ||
1973 | } | ||
1974 | } | ||
1975 | } | ||
1976 | } | ||
1977 | $this->cookies=$new_cookies; | ||
1978 | return(""); | ||
1979 | } | ||
1980 | }; | ||
1981 | |||
1982 | ?> \ No newline at end of file | ||
diff --git a/includes/index.php b/includes/index.php new file mode 100644 index 0000000..e6b9bab --- /dev/null +++ b/includes/index.php | |||
@@ -0,0 +1,5 @@ | |||
1 | <?php | ||
2 | |||
3 | header('Location: /index.php'); | ||
4 | |||
5 | ?> | ||
diff --git a/includes/phpsvnclient.php b/includes/phpsvnclient.php new file mode 100644 index 0000000..811c86d --- /dev/null +++ b/includes/phpsvnclient.php | |||
@@ -0,0 +1,420 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | *************************************************************************** | ||
4 | * Copyright (C) 2007-2008 by Sixdegrees * | ||
5 | * cesar@sixdegrees.com.br * | ||
6 | * "Working with freedom" * | ||
7 | * http://www.sixdegrees.com.br * | ||
8 | * * | ||
9 | * Permission is hereby granted, free of charge, to any person obtaining * | ||
10 | * a copy of this software and associated documentation files (the * | ||
11 | * "Software"), to deal in the Software without restriction, including * | ||
12 | * without limitation the rights to use, copy, modify, merge, publish, * | ||
13 | * distribute, sublicense, and/or sell copies of the Software, and to * | ||
14 | * permit persons to whom the Software is furnished to do so, subject to * | ||
15 | * the following conditions: * | ||
16 | * * | ||
17 | * The above copyright notice and this permission notice shall be * | ||
18 | * included in all copies or substantial portions of the Software. * | ||
19 | * * | ||
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * | ||
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * | ||
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.* | ||
23 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR * | ||
24 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * | ||
25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * | ||
26 | * OTHER DEALINGS IN THE SOFTWARE. * | ||
27 | *************************************************************************** | ||
28 | */ | ||
29 | define("PHPSVN_DIR",dirname(__FILE__) ); | ||
30 | |||
31 | require(PHPSVN_DIR."/http.php"); | ||
32 | require(PHPSVN_DIR."/xml_parser.php"); | ||
33 | require(PHPSVN_DIR."/definitions.php"); | ||
34 | |||
35 | |||
36 | /** | ||
37 | * PHP SVN CLIENT | ||
38 | * | ||
39 | * This class is a SVN client. It can perform read operations | ||
40 | * to a SVN server (over Web-DAV). | ||
41 | * It can get directory files, file contents, logs. All the operaration | ||
42 | * could be done for a specific version or for the last version. | ||
43 | * | ||
44 | * @author Cesar D. Rodas <cesar@sixdegrees.com.br> | ||
45 | * @license BSD License | ||
46 | */ | ||
47 | class phpSVNclient | ||
48 | { | ||
49 | /** | ||
50 | * SVN Repository URL | ||
51 | * | ||
52 | * @var string | ||
53 | * @access private | ||
54 | */ | ||
55 | var $_url; | ||
56 | /** | ||
57 | * Cache, for don't request the same thing in a | ||
58 | * short period of time. | ||
59 | * | ||
60 | * @var string | ||
61 | * @access private | ||
62 | */ | ||
63 | var $_cache; | ||
64 | /** | ||
65 | * HTTP Client object | ||
66 | * | ||
67 | * @var object | ||
68 | * @access private | ||
69 | */ | ||
70 | var $_http; | ||
71 | /** | ||
72 | * Respository Version. | ||
73 | * | ||
74 | * @access private | ||
75 | * @var interger | ||
76 | */ | ||
77 | var $_repVersion; | ||
78 | /** | ||
79 | * Password | ||
80 | * | ||
81 | * @access private | ||
82 | * @var string | ||
83 | */ | ||
84 | var $pass; | ||
85 | /** | ||
86 | * Password | ||
87 | * | ||
88 | * @access private | ||
89 | * @var string | ||
90 | */ | ||
91 | var $user; | ||
92 | /** | ||
93 | * Last error number | ||
94 | * | ||
95 | * Possible values are NOT_ERROR, NOT_FOUND, AUTH_REQUIRED, UNKOWN_ERROR | ||
96 | * | ||
97 | * @access public | ||
98 | * @var integer | ||
99 | */ | ||
100 | var $errNro; | ||
101 | |||
102 | function phpSVNclient() | ||
103 | { | ||
104 | $http = & $this->_http; | ||
105 | $http = new http_class; | ||
106 | $http->user_agent = "phpSVNclient (http://cesars.users.phpclasses.org/svnclient)"; | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * Set URL | ||
111 | * | ||
112 | * Set the project repository URL. | ||
113 | * | ||
114 | * @param string $url URL of the project. | ||
115 | * @access public | ||
116 | */ | ||
117 | function setRespository($url) | ||
118 | { | ||
119 | $this->_url = $url; | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * Add Authentication settings | ||
124 | * | ||
125 | * @param string $user Username | ||
126 | * @param string $pass Password | ||
127 | */ | ||
128 | function setAuth($user,$pass) { | ||
129 | $this->user = $user; | ||
130 | $this->pass = $pass; | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * Get Files | ||
135 | * | ||
136 | * This method returns all the files in $folder | ||
137 | * in the version $version of the repository. | ||
138 | * | ||
139 | * @param string $folder Folder to get files | ||
140 | * @param integer $version Repository version, -1 means actual | ||
141 | * @return array List of files. | ||
142 | */ | ||
143 | function getDirectoryFiles($folder='/',$version=-1) { | ||
144 | $actVersion = $this->getVersion(); | ||
145 | if ( $version == -1 || $version > $actVersion) { | ||
146 | $version = $actVersion; | ||
147 | } | ||
148 | $url = $this->cleanURL($this->_url."/!svn/bc/".$version."/".$folder."/"); | ||
149 | $this->initQuery($args,"PROPFIND",$url); | ||
150 | $args['Body'] = PHPSVN_NORMAL_REQUEST; | ||
151 | $args['Headers']['Content-Length'] = strlen(PHPSVN_NORMAL_REQUEST); | ||
152 | |||
153 | if ( ! $this->Request($args, $headers, $body) ) { | ||
154 | return false; | ||
155 | } | ||
156 | $parser=new xml_parser_class; | ||
157 | $parser->Parse( $body,true); | ||
158 | |||
159 | |||
160 | $fileinfo = array( | ||
161 | |||
162 | SVN_LAST_MODIFIED => "last-mod", | ||
163 | SVN_RELATIVE_URL => "path", | ||
164 | SVN_STATUS => "status" | ||
165 | ); | ||
166 | |||
167 | $start = false; | ||
168 | $last = ""; | ||
169 | $tmp = array(); | ||
170 | $files = array(); | ||
171 | $tmp1 = 0; | ||
172 | |||
173 | |||
174 | foreach($parser->structure as $key=>$value) { | ||
175 | if ( is_array($value) and $value["Tag"] == SVN_FILE) { | ||
176 | if ( count($tmp) > 0 && $tmp1++ > 0) { | ||
177 | $files[] = $tmp; | ||
178 | } | ||
179 | $start=true; | ||
180 | $last = ""; | ||
181 | $tmp = array(); | ||
182 | continue; | ||
183 | } | ||
184 | if (!$start) continue; | ||
185 | if ( $last != "") { | ||
186 | $tmp[ $fileinfo[$last] ] = $value; | ||
187 | $last = ""; | ||
188 | continue; | ||
189 | } | ||
190 | if ( is_array($value) && isset($value["Tag"]) && isset( $fileinfo[$value["Tag"]] ) ) { | ||
191 | $last = $value["Tag"]; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | return $files; | ||
196 | } | ||
197 | |||
198 | /** | ||
199 | * Returns file contents | ||
200 | * | ||
201 | * @param string $file File pathname | ||
202 | * @param integer $version File Version | ||
203 | * @return Array File content and information | ||
204 | */ | ||
205 | function getFile($file,$version=-1) { | ||
206 | $actVersion = $this->getVersion(); | ||
207 | if ( $version == -1 || $version > $actVersion) { | ||
208 | $version = $actVersion; | ||
209 | } | ||
210 | $url = $this->cleanURL($this->_url."/!svn/bc/".$version."/".$file."/"); | ||
211 | $this->initQuery($args,"GET",$url); | ||
212 | if ( ! $this->Request($args, $headers, $body) ) | ||
213 | return false; | ||
214 | return $body; | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * Get changes logs of a file. | ||
219 | * | ||
220 | * Get repository change logs between version | ||
221 | * $vini and $vend. | ||
222 | * | ||
223 | * @param integer $vini Initial Version | ||
224 | * @param integer $vend End Version | ||
225 | * @return Array Respository Logs | ||
226 | */ | ||
227 | function getRepositoryLogs($vini=0,$vend=-1) { | ||
228 | return $this->getFileLogs("/",$vini,$vend); | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * Get changes logs of a file. | ||
233 | * | ||
234 | * Get repository change of a file between version | ||
235 | * $vini and $vend. | ||
236 | * | ||
237 | * @param | ||
238 | * @param integer $vini Initial Version | ||
239 | * @param integer $vend End Version | ||
240 | * @return Array Respository Logs | ||
241 | */ | ||
242 | function getFileLogs($file, $vini=0,$vend=-1) { | ||
243 | $actVersion = $this->getVersion(); | ||
244 | if ( $vend == -1 || $vend > $actVersion) | ||
245 | $vend = $actVersion; | ||
246 | else | ||
247 | $vend++; | ||
248 | |||
249 | if ( $vini < 0) $vini=0; | ||
250 | if ( $vini > $vend) $vini = $vend; | ||
251 | |||
252 | $url = $this->cleanURL($this->_url."/!svn/bc/".$actVersion."/".$file."/"); | ||
253 | $this->initQuery($args,"REPORT",$url); | ||
254 | $args['Body'] = sprintf(PHPSVN_LOGS_REQUEST,$vini,$vend); | ||
255 | $args['Headers']['Content-Length'] = strlen($args['Body']); | ||
256 | $args['Headers']['Depth']=1; | ||
257 | |||
258 | if ( ! $this->Request($args, $headers, $body) ) | ||
259 | return false; | ||
260 | |||
261 | |||
262 | $parser=new xml_parser_class; | ||
263 | $parser->Parse( $body,true); | ||
264 | |||
265 | |||
266 | $fileinfo = array( | ||
267 | SVN_LOGS_VERSION=>"version", | ||
268 | SVN_LOGS_AUTHOR => "author", | ||
269 | SVN_LOGS_DATE => "date", | ||
270 | SVN_LOGS_COMMENT => "comment" | ||
271 | |||
272 | ); | ||
273 | |||
274 | $start = false; | ||
275 | $last = ""; | ||
276 | $tmp = array(); | ||
277 | $files = array(); | ||
278 | $tmp1 = 0; | ||
279 | |||
280 | |||
281 | foreach($parser->structure as $key=>$value) { | ||
282 | if ( is_array($value) and $value["Tag"] == SVN_LOGS_BEGINGS) { | ||
283 | if ( count($tmp) > 0 && $tmp1++ > 0) { | ||
284 | $logs[] = $tmp; | ||
285 | } | ||
286 | $start=true; | ||
287 | $last = ""; | ||
288 | $tmp = array(); | ||
289 | continue; | ||
290 | } | ||
291 | if (!$start) continue; | ||
292 | if ( $last != "") { | ||
293 | $tmp[ $fileinfo[$last] ] = $value; | ||
294 | $last = ""; | ||
295 | continue; | ||
296 | } | ||
297 | if ( is_array($value) && isset($value["Tag"]) && isset( $fileinfo[$value["Tag"]] ) ) { | ||
298 | $last = $value["Tag"]; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | return $logs; | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * Get the repository version | ||
307 | * | ||
308 | * @return integer Repository version | ||
309 | * @access public | ||
310 | */ | ||
311 | function getVersion() { | ||
312 | if ( $this->_repVersion < 0) return $this->_repVersion; | ||
313 | |||
314 | $this->_repVersion = -1; | ||
315 | |||
316 | $this->initQuery($args,"PROPFIND",$this->cleanURL($this->_url."/!svn/vcc/default") ); | ||
317 | $args['Body'] = PHPSVN_VERSION_REQUEST; | ||
318 | $args['Headers']['Content-Length'] = strlen(PHPSVN_NORMAL_REQUEST); | ||
319 | $args['Headers']['Depth']=0; | ||
320 | |||
321 | if ( !$this->Request($args, $tmp, $body) ) { | ||
322 | return $this->_repVersion; | ||
323 | } | ||
324 | |||
325 | $parser=new xml_parser_class; | ||
326 | $parser->Parse( $body,true); | ||
327 | $enable=false; | ||
328 | foreach($parser->structure as $value) { | ||
329 | if ( $enable ) { | ||
330 | $t = explode("/",$value); | ||
331 | if ( is_numeric($t[ count($t) -1 ]) ) { | ||
332 | $this->_repVersion = $t[ count($t) -1 ]; | ||
333 | break; | ||
334 | } | ||
335 | } | ||
336 | if ( is_array($value) && $value['Tag'] == 'D:href') $enable = true; | ||
337 | } | ||
338 | |||
339 | return $this->_repVersion; | ||
340 | } | ||
341 | |||
342 | /** | ||
343 | * Prepare HTTP CLIENT object | ||
344 | * | ||
345 | * @param array &$arguments Byreferences variable. | ||
346 | * @param string $method Method for the request (GET,POST,PROPFIND, REPORT,ETC). | ||
347 | * @param string $url URL for the action. | ||
348 | * @access private | ||
349 | */ | ||
350 | function initQuery(&$arguments,$method, $url) { | ||
351 | $http = & $this->_http; | ||
352 | $http->GetRequestArguments($url,$arguments); | ||
353 | if ( isset($this->user) && isset($this->pass)) { | ||
354 | $arguments["Headers"]["Authorization"] = " Basic ".base64_encode($this->user.":".$this->pass); | ||
355 | } | ||
356 | $arguments["RequestMethod"]=$method; | ||
357 | $arguments["Headers"]["Content-Type"] = "text/xml"; | ||
358 | $arguments["Headers"]["Depth"] = 1; | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * Open a connection, send request, read header | ||
363 | * and body. | ||
364 | * | ||
365 | * @param Array $args Connetion's argument | ||
366 | * @param Array &$headers Array with the header response. | ||
367 | * @param string &$body Body response. | ||
368 | * @return boolean True is query success | ||
369 | * @access private | ||
370 | */ | ||
371 | function Request($args, &$headers, &$body) { | ||
372 | $http = & $this->_http; | ||
373 | $http->Open($args); | ||
374 | $http->SendRequest($args); | ||
375 | $http->ReadReplyHeaders($headers); | ||
376 | if ($http->response_status[0] != 2) { | ||
377 | switch( $http->response_status ) { | ||
378 | case 404: | ||
379 | $this->errNro=NOT_FOUND; | ||
380 | break; | ||
381 | case 401: | ||
382 | $this->errNro=AUTH_REQUIRED; | ||
383 | break; | ||
384 | default: | ||
385 | $this->errNro=UNKNOWN_ERROR; | ||
386 | |||
387 | } | ||
388 | $http->close(); | ||
389 | return false; | ||
390 | } | ||
391 | $this->errNro = NO_ERROR; | ||
392 | $body=''; | ||
393 | $tbody=''; | ||
394 | for(;;) | ||
395 | { | ||
396 | $error=$http->ReadReplyBody($tbody,1000); | ||
397 | if($error!="" || strlen($tbody)==0) break; | ||
398 | $body.=($tbody); | ||
399 | } | ||
400 | $http->close(); | ||
401 | return true; | ||
402 | } | ||
403 | |||
404 | /** | ||
405 | * Clean URL | ||
406 | * | ||
407 | * Delete "//" on URL requests. | ||
408 | * | ||
409 | * @param string $url URL | ||
410 | * @return string New cleaned URL. | ||
411 | * @access private | ||
412 | */ | ||
413 | function cleanURL($url) { | ||
414 | $t = parse_url($url); | ||
415 | if ( isset($t['path']) ) | ||
416 | $t['path'] = str_replace("//","/",$t['path']); | ||
417 | return $t['scheme']."://".$t['host'].(isset($t['path']) ? $t['path'] : "/"); | ||
418 | } | ||
419 | } | ||
420 | ?> | ||
diff --git a/includes/recaptchalib.php b/includes/recaptchalib.php new file mode 100644 index 0000000..897c509 --- /dev/null +++ b/includes/recaptchalib.php | |||
@@ -0,0 +1,277 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | * This is a PHP library that handles calling reCAPTCHA. | ||
4 | * - Documentation and latest version | ||
5 | * http://recaptcha.net/plugins/php/ | ||
6 | * - Get a reCAPTCHA API Key | ||
7 | * http://recaptcha.net/api/getkey | ||
8 | * - Discussion group | ||
9 | * http://groups.google.com/group/recaptcha | ||
10 | * | ||
11 | * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net | ||
12 | * AUTHORS: | ||
13 | * Mike Crawford | ||
14 | * Ben Maurer | ||
15 | * | ||
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
17 | * of this software and associated documentation files (the "Software"), to deal | ||
18 | * in the Software without restriction, including without limitation the rights | ||
19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
20 | * copies of the Software, and to permit persons to whom the Software is | ||
21 | * furnished to do so, subject to the following conditions: | ||
22 | * | ||
23 | * The above copyright notice and this permission notice shall be included in | ||
24 | * all copies or substantial portions of the Software. | ||
25 | * | ||
26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
32 | * THE SOFTWARE. | ||
33 | */ | ||
34 | |||
35 | /** | ||
36 | * The reCAPTCHA server URL's | ||
37 | */ | ||
38 | define("RECAPTCHA_API_SERVER", "http://api.recaptcha.net"); | ||
39 | define("RECAPTCHA_API_SECURE_SERVER", "https://api-secure.recaptcha.net"); | ||
40 | define("RECAPTCHA_VERIFY_SERVER", "api-verify.recaptcha.net"); | ||
41 | |||
42 | /** | ||
43 | * Encodes the given data into a query string format | ||
44 | * @param $data - array of string elements to be encoded | ||
45 | * @return string - encoded request | ||
46 | */ | ||
47 | function _recaptcha_qsencode ($data) { | ||
48 | $req = ""; | ||
49 | foreach ( $data as $key => $value ) | ||
50 | $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; | ||
51 | |||
52 | // Cut the last '&' | ||
53 | $req=substr($req,0,strlen($req)-1); | ||
54 | return $req; | ||
55 | } | ||
56 | |||
57 | |||
58 | |||
59 | /** | ||
60 | * Submits an HTTP POST to a reCAPTCHA server | ||
61 | * @param string $host | ||
62 | * @param string $path | ||
63 | * @param array $data | ||
64 | * @param int port | ||
65 | * @return array response | ||
66 | */ | ||
67 | function _recaptcha_http_post($host, $path, $data, $port = 80) { | ||
68 | |||
69 | $req = _recaptcha_qsencode ($data); | ||
70 | |||
71 | $http_request = "POST $path HTTP/1.0\r\n"; | ||
72 | $http_request .= "Host: $host\r\n"; | ||
73 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; | ||
74 | $http_request .= "Content-Length: " . strlen($req) . "\r\n"; | ||
75 | $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; | ||
76 | $http_request .= "\r\n"; | ||
77 | $http_request .= $req; | ||
78 | |||
79 | $response = ''; | ||
80 | if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { | ||
81 | die ('Could not open socket'); | ||
82 | } | ||
83 | |||
84 | fwrite($fs, $http_request); | ||
85 | |||
86 | while ( !feof($fs) ) | ||
87 | $response .= fgets($fs, 1160); // One TCP-IP packet | ||
88 | fclose($fs); | ||
89 | $response = explode("\r\n\r\n", $response, 2); | ||
90 | |||
91 | return $response; | ||
92 | } | ||
93 | |||
94 | |||
95 | |||
96 | /** | ||
97 | * Gets the challenge HTML (javascript and non-javascript version). | ||
98 | * This is called from the browser, and the resulting reCAPTCHA HTML widget | ||
99 | * is embedded within the HTML form it was called from. | ||
100 | * @param string $pubkey A public key for reCAPTCHA | ||
101 | * @param string $error The error given by reCAPTCHA (optional, default is null) | ||
102 | * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) | ||
103 | |||
104 | * @return string - The HTML to be embedded in the user's form. | ||
105 | */ | ||
106 | function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) | ||
107 | { | ||
108 | if ($pubkey == null || $pubkey == '') { | ||
109 | die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>"); | ||
110 | } | ||
111 | |||
112 | if ($use_ssl) { | ||
113 | $server = RECAPTCHA_API_SECURE_SERVER; | ||
114 | } else { | ||
115 | $server = RECAPTCHA_API_SERVER; | ||
116 | } | ||
117 | |||
118 | $errorpart = ""; | ||
119 | if ($error) { | ||
120 | $errorpart = "&error=" . $error; | ||
121 | } | ||
122 | return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script> | ||
123 | |||
124 | <noscript> | ||
125 | <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/> | ||
126 | <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> | ||
127 | <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/> | ||
128 | </noscript>'; | ||
129 | } | ||
130 | |||
131 | |||
132 | |||
133 | |||
134 | /** | ||
135 | * A ReCaptchaResponse is returned from recaptcha_check_answer() | ||
136 | */ | ||
137 | class ReCaptchaResponse { | ||
138 | var $is_valid; | ||
139 | var $error; | ||
140 | } | ||
141 | |||
142 | |||
143 | /** | ||
144 | * Calls an HTTP POST function to verify if the user's guess was correct | ||
145 | * @param string $privkey | ||
146 | * @param string $remoteip | ||
147 | * @param string $challenge | ||
148 | * @param string $response | ||
149 | * @param array $extra_params an array of extra variables to post to the server | ||
150 | * @return ReCaptchaResponse | ||
151 | */ | ||
152 | function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) | ||
153 | { | ||
154 | if ($privkey == null || $privkey == '') { | ||
155 | die ("To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>"); | ||
156 | } | ||
157 | |||
158 | if ($remoteip == null || $remoteip == '') { | ||
159 | die ("For security reasons, you must pass the remote ip to reCAPTCHA"); | ||
160 | } | ||
161 | |||
162 | |||
163 | |||
164 | //discard spam submissions | ||
165 | if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { | ||
166 | $recaptcha_response = new ReCaptchaResponse(); | ||
167 | $recaptcha_response->is_valid = false; | ||
168 | $recaptcha_response->error = 'incorrect-captcha-sol'; | ||
169 | return $recaptcha_response; | ||
170 | } | ||
171 | |||
172 | $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/verify", | ||
173 | array ( | ||
174 | 'privatekey' => $privkey, | ||
175 | 'remoteip' => $remoteip, | ||
176 | 'challenge' => $challenge, | ||
177 | 'response' => $response | ||
178 | ) + $extra_params | ||
179 | ); | ||
180 | |||
181 | $answers = explode ("\n", $response [1]); | ||
182 | $recaptcha_response = new ReCaptchaResponse(); | ||
183 | |||
184 | if (trim ($answers [0]) == 'true') { | ||
185 | $recaptcha_response->is_valid = true; | ||
186 | } | ||
187 | else { | ||
188 | $recaptcha_response->is_valid = false; | ||
189 | $recaptcha_response->error = $answers [1]; | ||
190 | } | ||
191 | return $recaptcha_response; | ||
192 | |||
193 | } | ||
194 | |||
195 | /** | ||
196 | * gets a URL where the user can sign up for reCAPTCHA. If your application | ||
197 | * has a configuration page where you enter a key, you should provide a link | ||
198 | * using this function. | ||
199 | * @param string $domain The domain where the page is hosted | ||
200 | * @param string $appname The name of your application | ||
201 | */ | ||
202 | function recaptcha_get_signup_url ($domain = null, $appname = null) { | ||
203 | return "http://recaptcha.net/api/getkey?" . _recaptcha_qsencode (array ('domain' => $domain, 'app' => $appname)); | ||
204 | } | ||
205 | |||
206 | function _recaptcha_aes_pad($val) { | ||
207 | $block_size = 16; | ||
208 | $numpad = $block_size - (strlen ($val) % $block_size); | ||
209 | return str_pad($val, strlen ($val) + $numpad, chr($numpad)); | ||
210 | } | ||
211 | |||
212 | /* Mailhide related code */ | ||
213 | |||
214 | function _recaptcha_aes_encrypt($val,$ky) { | ||
215 | if (! function_exists ("mcrypt_encrypt")) { | ||
216 | die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); | ||
217 | } | ||
218 | $mode=MCRYPT_MODE_CBC; | ||
219 | $enc=MCRYPT_RIJNDAEL_128; | ||
220 | $val=_recaptcha_aes_pad($val); | ||
221 | return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); | ||
222 | } | ||
223 | |||
224 | |||
225 | function _recaptcha_mailhide_urlbase64 ($x) { | ||
226 | return strtr(base64_encode ($x), '+/', '-_'); | ||
227 | } | ||
228 | |||
229 | /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ | ||
230 | function recaptcha_mailhide_url($pubkey, $privkey, $email) { | ||
231 | if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { | ||
232 | die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . | ||
233 | "you can do so at <a href='http://mailhide.recaptcha.net/apikey'>http://mailhide.recaptcha.net/apikey</a>"); | ||
234 | } | ||
235 | |||
236 | |||
237 | $ky = pack('H*', $privkey); | ||
238 | $cryptmail = _recaptcha_aes_encrypt ($email, $ky); | ||
239 | |||
240 | return "http://mailhide.recaptcha.net/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * gets the parts of the email to expose to the user. | ||
245 | * eg, given johndoe@example,com return ["john", "example.com"]. | ||
246 | * the email is then displayed as john...@example.com | ||
247 | */ | ||
248 | function _recaptcha_mailhide_email_parts ($email) { | ||
249 | $arr = preg_split("/@/", $email ); | ||
250 | |||
251 | if (strlen ($arr[0]) <= 4) { | ||
252 | $arr[0] = substr ($arr[0], 0, 1); | ||
253 | } else if (strlen ($arr[0]) <= 6) { | ||
254 | $arr[0] = substr ($arr[0], 0, 3); | ||
255 | } else { | ||
256 | $arr[0] = substr ($arr[0], 0, 4); | ||
257 | } | ||
258 | return $arr; | ||
259 | } | ||
260 | |||
261 | /** | ||
262 | * Gets html to display an email address given a public an private key. | ||
263 | * to get a key, go to: | ||
264 | * | ||
265 | * http://mailhide.recaptcha.net/apikey | ||
266 | */ | ||
267 | function recaptcha_mailhide_html($pubkey, $privkey, $email) { | ||
268 | $emailparts = _recaptcha_mailhide_email_parts ($email); | ||
269 | $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); | ||
270 | |||
271 | return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) . | ||
272 | "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]); | ||
273 | |||
274 | } | ||
275 | |||
276 | |||
277 | ?> | ||
diff --git a/includes/session.php b/includes/session.php new file mode 100644 index 0000000..ff47e12 --- /dev/null +++ b/includes/session.php | |||
@@ -0,0 +1,61 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/session.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | session_start(); | ||
26 | |||
27 | function sess_exists($name) | ||
28 | { | ||
29 | return(isset($_SESSION[$name])); | ||
30 | } | ||
31 | |||
32 | function sess_set($name,$value) | ||
33 | { | ||
34 | $_SESSION[$name] = $value; | ||
35 | } | ||
36 | |||
37 | function sess_get($name) | ||
38 | { | ||
39 | return $_SESSION[$name]; | ||
40 | } | ||
41 | |||
42 | |||
43 | function sess_getifset($name) | ||
44 | { | ||
45 | if (sess_exists($name)) | ||
46 | { | ||
47 | return sess_get($name); | ||
48 | } else { | ||
49 | return false; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | function sess_delete($name) | ||
54 | { | ||
55 | if (sess_exists($name)) | ||
56 | { | ||
57 | unset($_SESSION[$name]); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | ?> | ||
diff --git a/includes/specialdates.php b/includes/specialdates.php new file mode 100755 index 0000000..91a356e --- /dev/null +++ b/includes/specialdates.php | |||
@@ -0,0 +1,314 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/specialdates.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | /* REMEMBER! | ||
26 | Months: Jan=1-Dec=12 | ||
27 | Dates: 1=1-...=... | ||
28 | Days: Mon=1-Sun=7 */ | ||
29 | |||
30 | $specialdates = array(); | ||
31 | |||
32 | $j=0; | ||
33 | for ($j=0;$j<(365+sd_isLeapYear());$j++) | ||
34 | { | ||
35 | $specialdates[$j] = ''; | ||
36 | } | ||
37 | |||
38 | sd_solar_annual('New Years Day',1,1); //BG Pic; DateFinder | ||
39 | sd_lunar_annual('Martin Luther King Day',1,1,3); //BG Pic; DateFinder | ||
40 | sd_solar_annual('Groundhog Day',2,2); //BG Pic; DateFinder | ||
41 | sd_lunar_annual('Presidents Day',2,1,3); //DateFinder | ||
42 | sd_solar_annual('Valentines Day',2,14); //BG Pic; DateFinder | ||
43 | sd_solar_multiannual('Leap Day',2,29,4,2004); //DateFinder | ||
44 | sd_solar_annual('St Patricks Day',3,17); //DateFinder | ||
45 | sd_solar_annual('Tris CIEday',4,22); //DateFinder | ||
46 | sd_solar_annual('Silence Day',4,25); //DateFinder | ||
47 | sd_solar_annual('WCA Day',5,5); //DateFinder | ||
48 | sd_lunar_annual('Mothers Day',5,7,2); //BG Pic; DateFinder; Header Pic | ||
49 | sd_lunar_annual('Memorial Day',5,1,4); //BG Pic; DateFinder; Header Pic | ||
50 | sd_easter(); //BG Pic; DateFinder | ||
51 | sd_solar_annual('Hatkirbys B-Day',6,7); //BG Pic; DateFinder; Header Pic | ||
52 | sd_solar_annual('Flag Day',6,14); //BG Pic; DateFinder | ||
53 | sd_lunar_annual('Fathers Day',6,7,3); //BG Pic; DateFinder | ||
54 | sd_solar_annual('CTNH',6,17); //Header Pic | ||
55 | sd_solar_annual('Independance Day',7,4); //BG Pic; DateFinder | ||
56 | sd_lunar_annual('SysAdminDay',7,5,4); //DateFinder | ||
57 | sd_lunar_annual('Labor Day',9,1,1); //Yet to be implemented | ||
58 | sd_solar_annual('Four Island A',9,22); //BG Pic; DateFinder; Header Pic | ||
59 | sd_lunar_annual('Columbus Day',10,1,2); //BG Pic; DateFinder | ||
60 | sd_solar_annual('Halloween',10,31); //BG Pic; DateFinder | ||
61 | sd_solar_annual('Veterans Day',11,11); //BG Pic; DateFinder | ||
62 | sd_lunar_annual('Thanksgiving',11,4,4); //DateFinder | ||
63 | sd_kirbyWeek(); //BG Pic; DateFinder | ||
64 | sd_solar_annual('Christmas Eve',12,24); //BG Pic; DateFinder | ||
65 | sd_solar_annual('Christmas Day',12,25); //BG Pic; DateFinder | ||
66 | sd_solar_annual('New Years Eve',12,31); //BG Pic; DateFinder | ||
67 | |||
68 | function sd_solar_annual($id,$month,$date) | ||
69 | { | ||
70 | $did = sd_getMonthStart($month-1); | ||
71 | $did += ($date-1); | ||
72 | sd_addDateIn($id,$did); | ||
73 | } | ||
74 | |||
75 | function sd_solar_monthly($id,$date) | ||
76 | { | ||
77 | $i=0; | ||
78 | for ($i=0;$i<12;$i++) | ||
79 | { | ||
80 | sd_solar_annual($id,$i+1,$date); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | function sd_lunar_annual($id,$month,$dotw,$wn) | ||
85 | { | ||
86 | $did = sd_getMonthStart($month-1); | ||
87 | $ys = sd_clearDate(); | ||
88 | $ys+=(60*60*24*$did); | ||
89 | if (sd_date('N',$ys)>$dotw) | ||
90 | { | ||
91 | $ys+=(((7-sd_date('N',$ys))+$dotw)*60*60*24); | ||
92 | } else { | ||
93 | $ys+=(($dotw-sd_date('N',$ys))*60*60*24); | ||
94 | } | ||
95 | $ys+=(($wn-1)*60*60*24*7); | ||
96 | $did = sd_getMonthStart(sd_date('m',$ys)-1); | ||
97 | $did += (sd_date('j',$ys)-1); | ||
98 | sd_addDateIn($id,$did); | ||
99 | } | ||
100 | |||
101 | function sd_getMonthStart($month) | ||
102 | { | ||
103 | if ($month==0) | ||
104 | { | ||
105 | return 0; | ||
106 | } else { | ||
107 | $c = sd_daysInMonth($month-1)+sd_getMonthStart($month-1); | ||
108 | if (date('F jS Y',sd_clearDate()+($c*60*60*24)) == 'March 31st 2008' || $month == 2) | ||
109 | { | ||
110 | // echo($month . ':' . sd_daysInMonth($month-1) . ':' . sd_getMonthStart($month-1) . "\n"); | ||
111 | } | ||
112 | return ($c); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | function sd_daysInMonth($month) | ||
117 | { | ||
118 | switch ($month) | ||
119 | { | ||
120 | case 0: return 31; | ||
121 | case 1: return (28+sd_isLeapYear()); | ||
122 | case 2: return 31; | ||
123 | case 3: return 30; | ||
124 | case 4: return 31; | ||
125 | case 5: return 30; | ||
126 | case 6: return 31; | ||
127 | case 7: return 31; | ||
128 | case 8: return 30; | ||
129 | case 9: return 31; | ||
130 | case 10: return 30; | ||
131 | case 11: return 31; | ||
132 | default: throw new Exception('Invalid month ID'); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | function sd_isLeapYear() | ||
137 | { | ||
138 | return sd_date('L'); | ||
139 | } | ||
140 | |||
141 | function sd_isSpecialDay($id) | ||
142 | { | ||
143 | global $specialdates; | ||
144 | $did = sd_getMonthStart(sd_date('n')-1); | ||
145 | $did += (sd_date('j')-1); | ||
146 | if ($specialdates[$did] == $id) | ||
147 | { | ||
148 | return 1; | ||
149 | } else { | ||
150 | return 0; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | function sd_ifNoSpecialDay() | ||
155 | { | ||
156 | global $specialdates; | ||
157 | $did = sd_getMonthStart(sd_date('n')-1); | ||
158 | $did += (sd_date('j')-1); | ||
159 | if ($specialdates[$did] == '') | ||
160 | { | ||
161 | return 1; | ||
162 | } else { | ||
163 | return 0; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | function sd_kirbyWeek() | ||
168 | { | ||
169 | $did = sd_getMonthStart(11); | ||
170 | $ys = sd_clearDate(); | ||
171 | $ys+=(60*60*24*24); | ||
172 | $ys+=(60*60*24*$did); | ||
173 | $tWD=sd_date('N',$ys); | ||
174 | if ($tWD==7) {$tWD=0;} | ||
175 | $ys-=($tWD*60*60*24); | ||
176 | $ys-=(60*60*24*7); | ||
177 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)); | ||
178 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+1); | ||
179 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+2); | ||
180 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+3); | ||
181 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+4); | ||
182 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+5); | ||
183 | sd_solar_annual('Kirby Week',12,sd_date('j',$ys)+6); | ||
184 | } | ||
185 | |||
186 | function sd_easter() | ||
187 | { | ||
188 | $nYear = sd_date('Y'); | ||
189 | $nCent = $nYear/100; | ||
190 | $nRemain19 = $nYear%19; | ||
191 | $n1 = ($nCent-15)/2+202-11*$nRemain19; | ||
192 | if ($nCent>20) | ||
193 | { | ||
194 | if ($nCent>26) {$n1--;} | ||
195 | if ($nCent>38) {$n1--;} | ||
196 | if ($nCent==21 || $nCent==24 || $nCent==25 || $nCent==33 || $nCent==36 || $nCent==37) {$n1--;} | ||
197 | } | ||
198 | $n1%=30; | ||
199 | if ($n1==29 || ($n1 && $nRemain19>10)) {$n1--;} | ||
200 | $ys = sd_clearDate(); | ||
201 | if ($n1>10) | ||
202 | { | ||
203 | $ys+=(60*60*24*sd_getMonthStart(3)); | ||
204 | $ys+=(60*60*24*($n1-10-1)); | ||
205 | } else { | ||
206 | $ys+=(60*60*24*sd_getMonthStart(2)); | ||
207 | $ys+=(60*60*24*($n1+21-1)); | ||
208 | } | ||
209 | $nWD = sd_date('N',$ys); | ||
210 | if ($nWD==7) {$nWD=0;} | ||
211 | $ys+=(60*60*24*(7-$nWD)); | ||
212 | sd_solar_annual('Easter',sd_date('m',$ys),sd_date('j',$ys)); | ||
213 | $ys-=(60*60*24*46); | ||
214 | sd_solar_annual('Mardi Gras',sd_date('m',$ys),sd_date('j',$ys)); | ||
215 | $ys+=(60*60*24); | ||
216 | sd_solar_annual('Ash Wednesday',sd_date('m',$ys),sd_date('j',$ys)); | ||
217 | $ys+=(60*60*24*38); | ||
218 | sd_solar_annual('Palm Sunday',sd_date('m',$ys),sd_date('j',$ys)); | ||
219 | $ys+=(60*60*24*5); | ||
220 | sd_solar_annual('Good Friday',sd_date('m',$ys),sd_date('j',$ys)); | ||
221 | } | ||
222 | |||
223 | function sd_findDay($id) | ||
224 | { | ||
225 | global $specialdates; | ||
226 | $i=0; | ||
227 | for ($i=0;$i<(365+sd_isLeapYear());$i++) | ||
228 | { | ||
229 | if ($specialdates[$i] == $id) | ||
230 | { | ||
231 | return $i; | ||
232 | } | ||
233 | } | ||
234 | throw new Exception('Specified holiday does not exist'); | ||
235 | } | ||
236 | |||
237 | function sd_findNextDay() | ||
238 | { | ||
239 | global $specialdates; | ||
240 | $did = sd_getMonthStart(sd_date('n')-1); | ||
241 | $did += (sd_date('j')-1); | ||
242 | $i=0; | ||
243 | for ($i=$did;$i<(365+sd_isLeapYear());$i++) | ||
244 | { | ||
245 | if ($specialdates[$i] != '') | ||
246 | { | ||
247 | return $i; | ||
248 | } | ||
249 | } | ||
250 | throw new Exception('No more holidays this year'); | ||
251 | } | ||
252 | |||
253 | function sd_getCurrentDay() | ||
254 | { | ||
255 | global $specialdates; | ||
256 | $did = sd_getMonthStart(sd_date('n')-1); | ||
257 | $did += (sd_date('j')-1); | ||
258 | return $specialdates[$did]; | ||
259 | } | ||
260 | |||
261 | function sd_solar_multiannual($id,$month,$date,$years,$sy) | ||
262 | { | ||
263 | global $specialdates; | ||
264 | $cy = sd_date('Y'); | ||
265 | $cy -= $sy; | ||
266 | if ($cy==0 || $cy%$years==0) | ||
267 | { | ||
268 | $did = sd_getMonthStart($month-1); | ||
269 | $did += ($date-1); | ||
270 | $specialdates[$did] = $id; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | function sd_solar_once($id,$month,$date,$year) | ||
275 | { | ||
276 | if ($year == sd_date('Y')) | ||
277 | { | ||
278 | sd_solar_annual($id,$month,$date); | ||
279 | } | ||
280 | } | ||
281 | |||
282 | function sd_getDay($id) | ||
283 | { | ||
284 | global $specialdates; | ||
285 | return $specialdates[$id]; | ||
286 | } | ||
287 | |||
288 | function sd_lunar_monthly($id,$dotw,$wn) | ||
289 | { | ||
290 | $i=1; | ||
291 | for ($i=1;$i<13;$i++) { | ||
292 | sd_lunar_annual($id,$i,$dotw,$wn); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | function sd_date($format,$timestamp = 0) | ||
297 | { | ||
298 | if ($timestamp == 0) {$timestamp = time();} | ||
299 | return date($format,$timestamp); | ||
300 | } | ||
301 | |||
302 | function sd_clearDate() | ||
303 | { | ||
304 | $ys = strtotime('January 1 ' . date('Y')); | ||
305 | return $ys; | ||
306 | } | ||
307 | |||
308 | function sd_addDateIn($id,$dateid) | ||
309 | { | ||
310 | global $specialdates; | ||
311 | $specialdates[$dateid] = $id; | ||
312 | } | ||
313 | |||
314 | ?> | ||
diff --git a/includes/template.php b/includes/template.php new file mode 100644 index 0000000..d777475 --- /dev/null +++ b/includes/template.php | |||
@@ -0,0 +1,164 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/template.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | class FITemplate | ||
26 | { | ||
27 | |||
28 | var $file; | ||
29 | var $tags; | ||
30 | var $blocks; | ||
31 | var $refs; | ||
32 | |||
33 | function FITemplate($filename) | ||
34 | { | ||
35 | $tfn = 'theme/' . $filename . '.tpl'; | ||
36 | if (file_exists($tfn)) | ||
37 | { | ||
38 | $this->file = $tfn; | ||
39 | } else { | ||
40 | throw new Exception($tfn . ' does not exist'); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | function add($name, $value) | ||
45 | { | ||
46 | $this->tags[$name] = $value; | ||
47 | } | ||
48 | |||
49 | function adds($tagarr) | ||
50 | { | ||
51 | foreach ($tagarr as $name => $value) | ||
52 | { | ||
53 | $this->add($name,$value); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | function adds_block($block, $tagarr) | ||
58 | { | ||
59 | if (!isset($this->blocks[$block])) | ||
60 | { | ||
61 | $this->blocks[$block] = array('count' => 1); | ||
62 | } | ||
63 | foreach ($tagarr as $name => $value) | ||
64 | { | ||
65 | $this->blocks[$block][$this->blocks[$block]['count']][$name] = $value; | ||
66 | } | ||
67 | $this->blocks[$block]['count']++; | ||
68 | } | ||
69 | |||
70 | function add_ref($id, $block, $tagarr) | ||
71 | { | ||
72 | $this->adds_block($block,$tagarr); | ||
73 | $this->refs[$id] = &$this->blocks[$block][$this->blocks[$block]['count']-1];//'$this->blocks[\'' . $block . '\'][' . ($this->blocks[$block]['count']-1) . ']'; | ||
74 | } | ||
75 | |||
76 | function adds_ref($id, $tagarr) | ||
77 | { | ||
78 | foreach ($tagarr as $name => $value) | ||
79 | { | ||
80 | $this->refs[$id][$name] = $value; | ||
81 | } | ||
82 | } | ||
83 | function adds_ref_sub($id, $block, $tagarr) | ||
84 | { | ||
85 | if (!isset($this->refs[$id][$block])) | ||
86 | { | ||
87 | $this->refs[$id][$block] = array('count' => 1); | ||
88 | } | ||
89 | foreach ($tagarr as $name => $value) | ||
90 | { | ||
91 | $this->refs[$id][$block][$this->refs[$id][$block]['count']][$name] = $value; | ||
92 | } | ||
93 | $this->refs[$id][$block]['count']++; | ||
94 | } | ||
95 | |||
96 | function display() | ||
97 | { | ||
98 | $template = file_get_contents($this->file); | ||
99 | while (preg_match('/<!--INCLUDE ([^>]*)-->/',$template) == 1) | ||
100 | { | ||
101 | preg_match('/<!--INCLUDE ([^>]*)-->/',$template,$mat); | ||
102 | $fname = $mat[1]; | ||
103 | $itmp = new FITemplate($fname); | ||
104 | $template = str_replace('<!--INCLUDE ' . $fname . '-->',file_get_contents($itmp->file),$template); | ||
105 | } | ||
106 | if (isset($this->tags)) | ||
107 | { | ||
108 | foreach ($this->tags as $name => $value) | ||
109 | { | ||
110 | $template = str_replace('<!--' . $name . '-->',$value,$template); | ||
111 | } | ||
112 | } | ||
113 | if (isset($this->blocks)) | ||
114 | { | ||
115 | foreach ($this->blocks as $bname => $block) | ||
116 | { | ||
117 | $this->parseBlock($template, $bname, $block); | ||
118 | } | ||
119 | } | ||
120 | while (preg_match('/<!--BEGIN ([^>]*)-->/',$template) == 1) | ||
121 | { | ||
122 | preg_match('/<!--BEGIN ([^>]*)-->/',$template,$mat); | ||
123 | $bname = $mat[1]; | ||
124 | $start = strpos($template,'<!--BEGIN ' . $bname . '-->'); | ||
125 | $end = strpos($template,'<!--END ' . $bname . '-->'); | ||
126 | $template = str_replace(substr($template,$start,$end-$start+strlen($bname)+11),'',$template); | ||
127 | } | ||
128 | $template = preg_replace('/<!--([^>]*)-->/','',$template); | ||
129 | |||
130 | echo($template); | ||
131 | } | ||
132 | |||
133 | function parseBlock(&$template, $bname, $block) | ||
134 | { | ||
135 | while (strpos($template,'<!--BEGIN ' . $bname . '-->') !== FALSE) | ||
136 | { | ||
137 | $start = strpos($template,'<!--BEGIN ' . $bname . '-->'); | ||
138 | $end = strpos($template,'<!--END ' . $bname . '-->'); | ||
139 | $gencont = substr($template,$start+strlen($bname)+13,$end-$start-strlen($bname)-13); | ||
140 | $blockcont = ''; | ||
141 | foreach ($block as $lname => $blocktags) | ||
142 | { | ||
143 | if ($lname != 'count') | ||
144 | { | ||
145 | $scrcont = $gencont; | ||
146 | foreach ($blocktags as $name => $value) | ||
147 | { | ||
148 | if (!is_array($value)) | ||
149 | { | ||
150 | $scrcont = str_replace('<!--' . $bname . '.' . $name . '-->',$value,$scrcont); | ||
151 | } else { | ||
152 | $this->parseBlock($scrcont, $bname . '.' . $name, $value); | ||
153 | } | ||
154 | } | ||
155 | $blockcont .= $scrcont; | ||
156 | } | ||
157 | } | ||
158 | $template = str_replace(substr($template,$start,$end-$start+strlen($bname)+11),$blockcont,$template); | ||
159 | } | ||
160 | } | ||
161 | |||
162 | } | ||
163 | |||
164 | ?> | ||
diff --git a/includes/updatePending.php b/includes/updatePending.php new file mode 100644 index 0000000..a96a2b6 --- /dev/null +++ b/includes/updatePending.php | |||
@@ -0,0 +1,51 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/updatePending.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | //$disablePendingQueue = 1; // Use this when Four Island goes down | ||
26 | |||
27 | if (!isset($disablePendingQueue)) | ||
28 | { | ||
29 | $gettime = "SELECT * FROM config WHERE name = \"lastUpdate\""; | ||
30 | $gettime2 = mysql_query($gettime); | ||
31 | $gettime3 = mysql_fetch_array($gettime2); | ||
32 | if (($gettime3['value'] != date('md')) && (time() > strtotime('12:30'))) | ||
33 | { | ||
34 | $cntpending = "SELECT COUNT(*) FROM pending"; | ||
35 | $cntpending2 = mysql_query($cntpending); | ||
36 | $cntpending3 = mysql_fetch_array($cntpending2); | ||
37 | if ($cntpending3[0] != 0) | ||
38 | { | ||
39 | $getpost = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | ||
40 | $getpost2 = mysql_query($getpost); | ||
41 | $getpost3 = mysql_fetch_array($getpost2); | ||
42 | |||
43 | postBlogPost($getpost3['title'], $getpost3['author'], $getpost3['tag1'], $getpost3['tag2'], $getpost3['tag3'], $getpost3['text']); | ||
44 | |||
45 | $delpost = "DELETE FROM pending WHERE id = " . $getpost3['id']; | ||
46 | $delpost2 = mysql_query($delpost); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | ?> | ||
diff --git a/includes/xml_parser.php b/includes/xml_parser.php new file mode 100644 index 0000000..15e02e0 --- /dev/null +++ b/includes/xml_parser.php | |||
@@ -0,0 +1,427 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | * xml_parser.php | ||
4 | * | ||
5 | * @(#) $Header: /home/mlemos/cvsroot/xmlparser/xml_parser.php,v 1.19 2006/11/22 01:25:05 mlemos Exp $ | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * Parser error numbers: | ||
11 | * | ||
12 | * 1 - Could not create the XML parser | ||
13 | * 2 - Could not parse data | ||
14 | * 3 - Could not read from input stream | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | $xml_parser_handlers=array(); | ||
19 | |||
20 | Function xml_parser_start_element_handler($parser,$name,$attrs) | ||
21 | { | ||
22 | global $xml_parser_handlers; | ||
23 | |||
24 | if(!strcmp($xml_parser_handlers[$parser]->error,"")) | ||
25 | $xml_parser_handlers[$parser]->StartElement($xml_parser_handlers[$parser],$name,$attrs); | ||
26 | } | ||
27 | |||
28 | Function xml_parser_end_element_handler($parser,$name) | ||
29 | { | ||
30 | global $xml_parser_handlers; | ||
31 | |||
32 | if(!strcmp($xml_parser_handlers[$parser]->error,"")) | ||
33 | $xml_parser_handlers[$parser]->EndElement($xml_parser_handlers[$parser],$name); | ||
34 | } | ||
35 | |||
36 | Function xml_parser_character_data_handler($parser,$data) | ||
37 | { | ||
38 | global $xml_parser_handlers; | ||
39 | |||
40 | if(!strcmp($xml_parser_handlers[$parser]->error,"")) | ||
41 | $xml_parser_handlers[$parser]->CharacterData($xml_parser_handlers[$parser],$data); | ||
42 | } | ||
43 | |||
44 | class xml_parser_handler_class | ||
45 | { | ||
46 | var $xml_parser; | ||
47 | var $error_number=0; | ||
48 | var $error=""; | ||
49 | var $error_code=0; | ||
50 | var $error_line,$error_column,$error_byte_index; | ||
51 | var $structure=array(); | ||
52 | var $positions=array(); | ||
53 | var $path=""; | ||
54 | var $store_positions=0; | ||
55 | var $simplified_xml=0; | ||
56 | var $fail_on_non_simplified_xml=0; | ||
57 | |||
58 | Function SetError(&$object,$error_number,$error) | ||
59 | { | ||
60 | $object->error_number=$error_number; | ||
61 | $object->error=$error; | ||
62 | $object->error_line=xml_get_current_line_number($object->xml_parser); | ||
63 | $object->error_column=xml_get_current_column_number($object->xml_parser); | ||
64 | $object->error_byte_index=xml_get_current_byte_index($object->xml_parser); | ||
65 | } | ||
66 | |||
67 | Function SetElementData(&$object,$path,&$data) | ||
68 | { | ||
69 | $object->structure[$path]=$data; | ||
70 | if($object->store_positions) | ||
71 | { | ||
72 | $object->positions[$path]=array( | ||
73 | "Line"=>xml_get_current_line_number($object->xml_parser), | ||
74 | "Column"=>xml_get_current_column_number($object->xml_parser), | ||
75 | "Byte"=>xml_get_current_byte_index($object->xml_parser) | ||
76 | ); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | Function StartElement(&$object,$name,&$attrs) | ||
81 | { | ||
82 | if(strcmp($this->path,"")) | ||
83 | { | ||
84 | $element=$object->structure[$this->path]["Elements"]; | ||
85 | $object->structure[$this->path]["Elements"]++; | ||
86 | $this->path.=",$element"; | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | $element=0; | ||
91 | $this->path="0"; | ||
92 | } | ||
93 | $data=array( | ||
94 | "Tag"=>$name, | ||
95 | "Elements"=>0 | ||
96 | ); | ||
97 | if($object->simplified_xml) | ||
98 | { | ||
99 | if($object->fail_on_non_simplified_xml | ||
100 | && count($attrs)>0) | ||
101 | { | ||
102 | $this->SetError($object,2,"Simplified XML can not have attributes in tags"); | ||
103 | return; | ||
104 | } | ||
105 | } | ||
106 | else | ||
107 | $data["Attributes"]=$attrs; | ||
108 | $this->SetElementData($object,$this->path,$data); | ||
109 | } | ||
110 | |||
111 | Function EndElement(&$object,$name) | ||
112 | { | ||
113 | $this->path=(($position=strrpos($this->path,",")) ? substr($this->path,0,$position) : ""); | ||
114 | } | ||
115 | |||
116 | Function CharacterData(&$object,$data) | ||
117 | { | ||
118 | $element=$object->structure[$this->path]["Elements"]; | ||
119 | $previous=$this->path.",".strval($element-1); | ||
120 | if($element>0 | ||
121 | && GetType($object->structure[$previous])=="string") | ||
122 | $object->structure[$previous].=$data; | ||
123 | else | ||
124 | { | ||
125 | $this->SetElementData($object,$this->path.",$element",$data); | ||
126 | $object->structure[$this->path]["Elements"]++; | ||
127 | } | ||
128 | } | ||
129 | }; | ||
130 | |||
131 | class xml_parser_class | ||
132 | { | ||
133 | var $xml_parser=0; | ||
134 | var $parser_handler; | ||
135 | var $error=""; | ||
136 | var $error_number=0; | ||
137 | var $error_line=0; | ||
138 | var $error_column=0; | ||
139 | var $error_byte_index=0; | ||
140 | var $error_code=0; | ||
141 | var $stream_buffer_size=4096; | ||
142 | var $structure=array(); | ||
143 | var $positions=array(); | ||
144 | var $store_positions=0; | ||
145 | var $case_folding=0; | ||
146 | var $target_encoding="ISO-8859-1"; | ||
147 | var $simplified_xml=0; | ||
148 | var $fail_on_non_simplified_xml=0; | ||
149 | |||
150 | Function xml_parser_start_element_handler($parser,$name,$attrs) | ||
151 | { | ||
152 | if(!strcmp($this->error,"")) | ||
153 | $this->parser_handler->StartElement($this,$name,$attrs); | ||
154 | } | ||
155 | |||
156 | Function xml_parser_end_element_handler($parser,$name) | ||
157 | { | ||
158 | if(!strcmp($this->error,"")) | ||
159 | $this->parser_handler->EndElement($this,$name); | ||
160 | } | ||
161 | |||
162 | Function xml_parser_character_data_handler($parser,$data) | ||
163 | { | ||
164 | if(!strcmp($this->error,"")) | ||
165 | $this->parser_handler->CharacterData($this,$data); | ||
166 | } | ||
167 | |||
168 | Function SetErrorPosition($error_number,$error,$line,$column,$byte_index) | ||
169 | { | ||
170 | $this->error_number=$error_number; | ||
171 | $this->error=$error; | ||
172 | $this->error_line=$line; | ||
173 | $this->error_column=$column; | ||
174 | $this->error_byte_index=$byte_index; | ||
175 | } | ||
176 | |||
177 | Function SetError($error_number,$error) | ||
178 | { | ||
179 | $this->error_number=$error_number; | ||
180 | $this->error=$error; | ||
181 | if($this->xml_parser) | ||
182 | { | ||
183 | $line=xml_get_current_line_number($this->xml_parser); | ||
184 | $column=xml_get_current_column_number($this->xml_parser); | ||
185 | $byte_index=xml_get_current_byte_index($this->xml_parser); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | $line=$column=1; | ||
190 | $byte_index=0; | ||
191 | } | ||
192 | $this->SetErrorPosition($error_number,$error,$line,$column,$byte_index); | ||
193 | } | ||
194 | |||
195 | Function Parse($data,$end_of_data) | ||
196 | { | ||
197 | global $xml_parser_handlers; | ||
198 | |||
199 | if(strcmp($this->error,"")) | ||
200 | return($this->error); | ||
201 | if(!$this->xml_parser) | ||
202 | { | ||
203 | if(!function_exists("xml_parser_create")) | ||
204 | { | ||
205 | $this->SetError(1,"XML support is not available in this PHP configuration"); | ||
206 | return($this->error); | ||
207 | } | ||
208 | if(!($this->xml_parser=xml_parser_create())) | ||
209 | { | ||
210 | $this->SetError(1,"Could not create the XML parser"); | ||
211 | return($this->error); | ||
212 | } | ||
213 | xml_parser_set_option($this->xml_parser,XML_OPTION_CASE_FOLDING,$this->case_folding); | ||
214 | xml_parser_set_option($this->xml_parser,XML_OPTION_TARGET_ENCODING,$this->target_encoding); | ||
215 | if(function_exists("xml_set_object")) | ||
216 | { | ||
217 | xml_set_object($this->xml_parser,$this); | ||
218 | $this->parser_handler=new xml_parser_handler_class; | ||
219 | $this->structure=array(); | ||
220 | $this->positions=array(); | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | $xml_parser_handlers[$this->xml_parser]=new xml_parser_handler_class; | ||
225 | $xml_parser_handlers[$this->xml_parser]->xml_parser=$this->xml_parser; | ||
226 | $xml_parser_handlers[$this->xml_parser]->store_positions=$this->store_positions; | ||
227 | $xml_parser_handlers[$this->xml_parser]->simplified_xml=$this->simplified_xml; | ||
228 | $xml_parser_handlers[$this->xml_parser]->fail_on_non_simplified_xml=$this->fail_on_non_simplified_xml; | ||
229 | } | ||
230 | xml_set_element_handler($this->xml_parser,"xml_parser_start_element_handler","xml_parser_end_element_handler"); | ||
231 | xml_set_character_data_handler($this->xml_parser,"xml_parser_character_data_handler"); | ||
232 | } | ||
233 | $parser_ok=xml_parse($this->xml_parser,$data,$end_of_data); | ||
234 | if(!function_exists("xml_set_object")) | ||
235 | $this->error=$xml_parser_handlers[$this->xml_parser]->error; | ||
236 | if(!strcmp($this->error,"")) | ||
237 | { | ||
238 | if($parser_ok) | ||
239 | { | ||
240 | if($end_of_data) | ||
241 | { | ||
242 | if(function_exists("xml_set_object")) | ||
243 | Unset($this->parser_handler); | ||
244 | else | ||
245 | { | ||
246 | $this->structure=$xml_parser_handlers[$this->xml_parser]->structure; | ||
247 | $this->positions=$xml_parser_handlers[$this->xml_parser]->positions; | ||
248 | Unset($xml_parser_handlers[$this->xml_parser]); | ||
249 | } | ||
250 | xml_parser_free($this->xml_parser); | ||
251 | $this->xml_parser=0; | ||
252 | } | ||
253 | } | ||
254 | else | ||
255 | $this->SetError(2,"Could not parse data: ".xml_error_string($this->error_code=xml_get_error_code($this->xml_parser))); | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | if(!function_exists("xml_set_object")) | ||
260 | { | ||
261 | $this->error_number=$xml_parser_handlers[$this->xml_parser]->error_number; | ||
262 | $this->error_code=$xml_parser_handlers[$this->xml_parser]->error_code; | ||
263 | $this->error_line=$xml_parser_handlers[$this->xml_parser]->error_line; | ||
264 | $this->error_column=$xml_parser_handlers[$this->xml_parser]->error_column; | ||
265 | $this->error_byte_index=$xml_parser_handlers[$this->xml_parser]->error_byte_index; | ||
266 | } | ||
267 | } | ||
268 | return($this->error); | ||
269 | } | ||
270 | |||
271 | Function VerifyWhiteSpace($path) | ||
272 | { | ||
273 | if($this->store_positions) | ||
274 | { | ||
275 | $line=$parser->positions[$path]["Line"]; | ||
276 | $column=$parser->positions[$path]["Column"]; | ||
277 | $byte_index=$parser->positions[$path]["Byte"]; | ||
278 | } | ||
279 | else | ||
280 | { | ||
281 | $line=$column=1; | ||
282 | $byte_index=0; | ||
283 | } | ||
284 | if(!IsSet($this->structure[$path])) | ||
285 | { | ||
286 | $this->SetErrorPosition(2,"element path does not exist",$line,$column,$byte_index); | ||
287 | return($this->error); | ||
288 | } | ||
289 | if(GetType($this->structure[$path])!="string") | ||
290 | { | ||
291 | $this->SetErrorPosition(2,"element is not data",$line,$column,$byte_index); | ||
292 | return($this->error); | ||
293 | } | ||
294 | $data=$this->structure[$path]; | ||
295 | for($previous_return=0,$position=0;$position<strlen($data);$position++) | ||
296 | { | ||
297 | switch($data[$position]) | ||
298 | { | ||
299 | case " ": | ||
300 | case "\t": | ||
301 | $column++; | ||
302 | $byte_index++; | ||
303 | $previous_return=0; | ||
304 | break; | ||
305 | case "\n": | ||
306 | if(!$previous_return) | ||
307 | $line++; | ||
308 | $column=1; | ||
309 | $byte_index++; | ||
310 | $previous_return=0; | ||
311 | break; | ||
312 | case "\r": | ||
313 | $line++; | ||
314 | $column=1; | ||
315 | $byte_index++; | ||
316 | $previous_return=1; | ||
317 | break; | ||
318 | default: | ||
319 | $this->SetErrorPosition(2,"data is not white space",$line,$column,$byte_index); | ||
320 | return($this->error); | ||
321 | } | ||
322 | } | ||
323 | return(""); | ||
324 | } | ||
325 | |||
326 | Function ParseStream($stream) | ||
327 | { | ||
328 | if(strcmp($this->error,"")) | ||
329 | return($this->error); | ||
330 | do | ||
331 | { | ||
332 | if(!($data=@fread($stream,$this->stream_buffer_size))) | ||
333 | { | ||
334 | if(!feof($stream)) | ||
335 | { | ||
336 | $this->SetError(3,"Could not read from input stream".(IsSet($php_errormsg) ? ': '.$php_errormsg : '')); | ||
337 | break; | ||
338 | } | ||
339 | } | ||
340 | if(strcmp($error=$this->Parse($data,feof($stream)),"")) | ||
341 | break; | ||
342 | } | ||
343 | while(!feof($stream)); | ||
344 | return($this->error); | ||
345 | } | ||
346 | |||
347 | Function ParseFile($file) | ||
348 | { | ||
349 | if(!file_exists($file)) | ||
350 | return("the XML file to parse ($file) does not exist"); | ||
351 | if(!($definition=@fopen($file,"r"))) | ||
352 | return("could not open the XML file ($file)".(IsSet($php_errormsg) ? ': '.$php_errormsg : '')); | ||
353 | $error=$this->ParseStream($definition); | ||
354 | fclose($definition); | ||
355 | return($error); | ||
356 | } | ||
357 | }; | ||
358 | |||
359 | Function XMLParseFile(&$parser,$file,$store_positions,$cache="",$case_folding=0,$target_encoding="ISO-8859-1",$simplified_xml=0,$fail_on_non_simplified_xml=0) | ||
360 | { | ||
361 | if(!file_exists($file)) | ||
362 | return("the XML file to parse ($file) does not exist"); | ||
363 | if(strcmp($cache,"")) | ||
364 | { | ||
365 | if(file_exists($cache) | ||
366 | && filemtime($file)<=filemtime($cache)) | ||
367 | { | ||
368 | if(($cache_file=@fopen($cache,"r"))) | ||
369 | { | ||
370 | if(function_exists("set_file_buffer")) | ||
371 | set_file_buffer($cache_file,0); | ||
372 | if(!($cache_contents=@fread($cache_file,filesize($cache)))) | ||
373 | $error="could not read from the XML cache file $cache".(IsSet($php_errormsg) ? ': '.$php_errormsg : ''); | ||
374 | else | ||
375 | $error=""; | ||
376 | fclose($cache_file); | ||
377 | if(!strcmp($error,"")) | ||
378 | { | ||
379 | if(GetType($parser=unserialize($cache_contents))=="object" | ||
380 | && IsSet($parser->structure)) | ||
381 | { | ||
382 | if(!IsSet($parser->simplified_xml)) | ||
383 | $parser->simplified_xml=0; | ||
384 | if(($simplified_xml | ||
385 | || !$parser->simplified_xml) | ||
386 | && (!$store_positions | ||
387 | || $parser->store_positions)) | ||
388 | { | ||
389 | return(""); | ||
390 | } | ||
391 | } | ||
392 | else | ||
393 | $error="it was not specified a valid cache object in XML file ($cache)"; | ||
394 | } | ||
395 | } | ||
396 | else | ||
397 | $error="could not open cache XML file ($cache)".(IsSet($php_errormsg) ? ': '.$php_errormsg : ''); | ||
398 | if(strcmp($error,"")) | ||
399 | return($error); | ||
400 | } | ||
401 | } | ||
402 | $parser=new xml_parser_class; | ||
403 | $parser->store_positions=$store_positions; | ||
404 | $parser->case_folding=$case_folding; | ||
405 | $parser->target_encoding=$target_encoding; | ||
406 | $parser->simplified_xml=$simplified_xml; | ||
407 | $parser->fail_on_non_simplified_xml=$fail_on_non_simplified_xml; | ||
408 | if(!strcmp($error=$parser->ParseFile($file),"") | ||
409 | && strcmp($cache,"")) | ||
410 | { | ||
411 | if(($cache_file=@fopen($cache,"w"))) | ||
412 | { | ||
413 | if(function_exists("set_file_buffer")) | ||
414 | set_file_buffer($cache_file,0); | ||
415 | if(!@fwrite($cache_file,serialize($parser)) | ||
416 | || !@fclose($cache_file)) | ||
417 | $error="could to write to the XML cache file ($cache)".(IsSet($php_errormsg) ? ': '.$php_errormsg : ''); | ||
418 | if(strcmp($error,"")) | ||
419 | unlink($cache); | ||
420 | } | ||
421 | else | ||
422 | $error="could not open for writing to the cache file ($cache)".(IsSet($php_errormsg) ? ': '.$php_errormsg : ''); | ||
423 | } | ||
424 | return($error); | ||
425 | } | ||
426 | |||
427 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/array_key_exists.php b/includes/xmlrpc/array_key_exists.php new file mode 100644 index 0000000..c5ae519 --- /dev/null +++ b/includes/xmlrpc/array_key_exists.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: array_key_exists.php,v 1.1 2005/07/11 16:34:35 ggiunta Exp $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace array_key_exists() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.array_key_exists | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.1 $ | ||
29 | * @since PHP 4.1.0 | ||
30 | * @require PHP 4.0.0 (user_error) | ||
31 | */ | ||
32 | if (!function_exists('array_key_exists')) { | ||
33 | function array_key_exists($key, $search) | ||
34 | { | ||
35 | if (!is_scalar($key)) { | ||
36 | user_error('array_key_exists() The first argument should be either a string or an integer', | ||
37 | E_USER_WARNING); | ||
38 | return false; | ||
39 | } | ||
40 | |||
41 | if (is_object($search)) { | ||
42 | $search = get_object_vars($search); | ||
43 | } | ||
44 | |||
45 | if (!is_array($search)) { | ||
46 | user_error('array_key_exists() The second argument should be either an array or an object', | ||
47 | E_USER_WARNING); | ||
48 | return false; | ||
49 | } | ||
50 | |||
51 | return in_array($key, array_keys($search)); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/is_a.php b/includes/xmlrpc/is_a.php new file mode 100644 index 0000000..d98db1f --- /dev/null +++ b/includes/xmlrpc/is_a.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: is_a.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace function is_a() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.is_a | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.2 $ | ||
29 | * @since PHP 4.2.0 | ||
30 | * @require PHP 4.0.0 (user_error) (is_subclass_of) | ||
31 | */ | ||
32 | if (!function_exists('is_a')) { | ||
33 | function is_a($object, $class) | ||
34 | { | ||
35 | if (!is_object($object)) { | ||
36 | return false; | ||
37 | } | ||
38 | |||
39 | if (get_class($object) == strtolower($class)) { | ||
40 | return true; | ||
41 | } else { | ||
42 | return is_subclass_of($object, $class); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | |||
47 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/is_callable.php b/includes/xmlrpc/is_callable.php new file mode 100644 index 0000000..b769c41 --- /dev/null +++ b/includes/xmlrpc/is_callable.php | |||
@@ -0,0 +1,53 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * Replace function is_callable() | ||
4 | * | ||
5 | * @category PHP | ||
6 | * @package PHP_Compat | ||
7 | * @link http://php.net/function.is_callable | ||
8 | * @author Gaetano Giunta <giunta.gaetano@sea-aeroportimilano.it> | ||
9 | * @version $Id: is_callable.php,v 1.3 2006/08/21 14:03:15 ggiunta Exp $ | ||
10 | * @since PHP 4.0.6 | ||
11 | * @require PHP 4.0.0 (true, false, etc...) | ||
12 | * @todo add the 3rd parameter syntax... | ||
13 | */ | ||
14 | if (!function_exists('is_callable')) { | ||
15 | function is_callable($var, $syntax_only=false) | ||
16 | { | ||
17 | if ($syntax_only) | ||
18 | { | ||
19 | /* from The Manual: | ||
20 | * If the syntax_only argument is TRUE the function only verifies | ||
21 | * that var might be a function or method. It will only reject simple | ||
22 | * variables that are not strings, or an array that does not have a | ||
23 | * valid structure to be used as a callback. The valid ones are | ||
24 | * supposed to have only 2 entries, the first of which is an object | ||
25 | * or a string, and the second a string | ||
26 | */ | ||
27 | return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); | ||
28 | } | ||
29 | else | ||
30 | { | ||
31 | if (is_string($var)) | ||
32 | { | ||
33 | return function_exists($var); | ||
34 | } | ||
35 | else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) | ||
36 | { | ||
37 | $obj = reset($var); | ||
38 | if (is_string($obj)) | ||
39 | { | ||
40 | $methods = get_class_methods($obj); | ||
41 | return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); | ||
42 | } | ||
43 | else if (is_object($obj)) | ||
44 | { | ||
45 | return method_exists($obj, $method); | ||
46 | } | ||
47 | } | ||
48 | return false; | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/is_scalar.php b/includes/xmlrpc/is_scalar.php new file mode 100644 index 0000000..c8f2bfc --- /dev/null +++ b/includes/xmlrpc/is_scalar.php | |||
@@ -0,0 +1,38 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | ||
16 | // $Id: is_scalar.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $ | ||
17 | |||
18 | |||
19 | /** | ||
20 | * Replace is_scalar() | ||
21 | * | ||
22 | * @category PHP | ||
23 | * @package PHP_Compat | ||
24 | * @link http://php.net/function.is_scalar | ||
25 | * @author Gaetano Giunta | ||
26 | * @version $Revision: 1.2 $ | ||
27 | * @since PHP 4.0.5 | ||
28 | * @require PHP 4 (is_bool) | ||
29 | */ | ||
30 | if (!function_exists('is_scalar')) { | ||
31 | function is_scalar($val) | ||
32 | { | ||
33 | // Check input | ||
34 | return (is_bool($val) || is_int($val) || is_float($val) || is_string($val)); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/var_export.php b/includes/xmlrpc/var_export.php new file mode 100644 index 0000000..3a5ac3f --- /dev/null +++ b/includes/xmlrpc/var_export.php | |||
@@ -0,0 +1,105 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Aidan Lister <aidan@php.net> | | ||
16 | // +----------------------------------------------------------------------+ | ||
17 | // | ||
18 | // $Id: var_export.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $ | ||
19 | |||
20 | |||
21 | /** | ||
22 | * Replace var_export() | ||
23 | * | ||
24 | * @category PHP | ||
25 | * @package PHP_Compat | ||
26 | * @link http://php.net/function.var_export | ||
27 | * @author Aidan Lister <aidan@php.net> | ||
28 | * @version $Revision: 1.2 $ | ||
29 | * @since PHP 4.2.0 | ||
30 | * @require PHP 4.0.0 (user_error) | ||
31 | */ | ||
32 | if (!function_exists('var_export')) { | ||
33 | function var_export($array, $return = false, $lvl=0) | ||
34 | { | ||
35 | // Common output variables | ||
36 | $indent = ' '; | ||
37 | $doublearrow = ' => '; | ||
38 | $lineend = ",\n"; | ||
39 | $stringdelim = '\''; | ||
40 | |||
41 | // Check the export isn't a simple string / int | ||
42 | if (is_string($array)) { | ||
43 | $out = $stringdelim . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $array)) . $stringdelim; | ||
44 | } elseif (is_int($array) || is_float($array)) { | ||
45 | $out = (string)$array; | ||
46 | } elseif (is_bool($array)) { | ||
47 | $out = $array ? 'true' : 'false'; | ||
48 | } elseif (is_null($array)) { | ||
49 | $out = 'NULL'; | ||
50 | } elseif (is_resource($array)) { | ||
51 | $out = 'resource'; | ||
52 | } else { | ||
53 | // Begin the array export | ||
54 | // Start the string | ||
55 | $out = "array (\n"; | ||
56 | |||
57 | // Loop through each value in array | ||
58 | foreach ($array as $key => $value) { | ||
59 | // If the key is a string, delimit it | ||
60 | if (is_string($key)) { | ||
61 | $key = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $key)); | ||
62 | $key = $stringdelim . $key . $stringdelim; | ||
63 | } | ||
64 | |||
65 | $val = var_export($value, true, $lvl+1); | ||
66 | // Delimit value | ||
67 | /*if (is_array($value)) { | ||
68 | // We have an array, so do some recursion | ||
69 | // Do some basic recursion while increasing the indent | ||
70 | $recur_array = explode($newline, var_export($value, true)); | ||
71 | $temp_array = array(); | ||
72 | foreach ($recur_array as $recur_line) { | ||
73 | $temp_array[] = $indent . $recur_line; | ||
74 | } | ||
75 | $recur_array = implode($newline, $temp_array); | ||
76 | $value = $newline . $recur_array; | ||
77 | } elseif (is_null($value)) { | ||
78 | $value = 'NULL'; | ||
79 | } else { | ||
80 | $value = str_replace($find, $replace, $value); | ||
81 | $value = $stringdelim . $value . $stringdelim; | ||
82 | }*/ | ||
83 | |||
84 | // Piece together the line | ||
85 | for ($i = 0; $i < $lvl; $i++) | ||
86 | $out .= $indent; | ||
87 | $out .= $key . $doublearrow . $val . $lineend; | ||
88 | } | ||
89 | |||
90 | // End our string | ||
91 | for ($i = 0; $i < $lvl; $i++) | ||
92 | $out .= $indent; | ||
93 | $out .= ")"; | ||
94 | } | ||
95 | |||
96 | // Decide method of output | ||
97 | if ($return === true) { | ||
98 | return $out; | ||
99 | } else { | ||
100 | echo $out; | ||
101 | return; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/version_compare.php b/includes/xmlrpc/version_compare.php new file mode 100644 index 0000000..fc3abac --- /dev/null +++ b/includes/xmlrpc/version_compare.php | |||
@@ -0,0 +1,179 @@ | |||
1 | <?php | ||
2 | // +----------------------------------------------------------------------+ | ||
3 | // | PHP Version 4 | | ||
4 | // +----------------------------------------------------------------------+ | ||
5 | // | Copyright (c) 1997-2004 The PHP Group | | ||
6 | // +----------------------------------------------------------------------+ | ||
7 | // | This source file is subject to version 3.0 of the PHP license, | | ||
8 | // | that is bundled with this package in the file LICENSE, and is | | ||
9 | // | available at through the world-wide-web at | | ||
10 | // | http://www.php.net/license/3_0.txt. | | ||
11 | // | If you did not receive a copy of the PHP license and are unable to | | ||
12 | // | obtain it through the world-wide-web, please send a note to | | ||
13 | // | license@php.net so we can mail you a copy immediately. | | ||
14 | // +----------------------------------------------------------------------+ | ||
15 | // | Authors: Philippe Jausions <Philippe.Jausions@11abacus.com> | | ||
16 | // | Aidan Lister <aidan@php.net> | | ||
17 | // +----------------------------------------------------------------------+ | ||
18 | // | ||
19 | // $Id: version_compare.php,v 1.1 2005/07/11 16:34:36 ggiunta Exp $ | ||
20 | |||
21 | |||
22 | /** | ||
23 | * Replace version_compare() | ||
24 | * | ||
25 | * @category PHP | ||
26 | * @package PHP_Compat | ||
27 | * @link http://php.net/function.version_compare | ||
28 | * @author Philippe Jausions <Philippe.Jausions@11abacus.com> | ||
29 | * @author Aidan Lister <aidan@php.net> | ||
30 | * @version $Revision: 1.1 $ | ||
31 | * @since PHP 4.1.0 | ||
32 | * @require PHP 4.0.0 (user_error) | ||
33 | */ | ||
34 | if (!function_exists('version_compare')) { | ||
35 | function version_compare($version1, $version2, $operator = '<') | ||
36 | { | ||
37 | // Check input | ||
38 | if (!is_scalar($version1)) { | ||
39 | user_error('version_compare() expects parameter 1 to be string, ' . | ||
40 | gettype($version1) . ' given', E_USER_WARNING); | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | if (!is_scalar($version2)) { | ||
45 | user_error('version_compare() expects parameter 2 to be string, ' . | ||
46 | gettype($version2) . ' given', E_USER_WARNING); | ||
47 | return; | ||
48 | } | ||
49 | |||
50 | if (!is_scalar($operator)) { | ||
51 | user_error('version_compare() expects parameter 3 to be string, ' . | ||
52 | gettype($operator) . ' given', E_USER_WARNING); | ||
53 | return; | ||
54 | } | ||
55 | |||
56 | // Standardise versions | ||
57 | $v1 = explode('.', | ||
58 | str_replace('..', '.', | ||
59 | preg_replace('/([^0-9\.]+)/', '.$1.', | ||
60 | str_replace(array('-', '_', '+'), '.', | ||
61 | trim($version1))))); | ||
62 | |||
63 | $v2 = explode('.', | ||
64 | str_replace('..', '.', | ||
65 | preg_replace('/([^0-9\.]+)/', '.$1.', | ||
66 | str_replace(array('-', '_', '+'), '.', | ||
67 | trim($version2))))); | ||
68 | |||
69 | // Replace empty entries at the start of the array | ||
70 | while (empty($v1[0]) && array_shift($v1)) {} | ||
71 | while (empty($v2[0]) && array_shift($v2)) {} | ||
72 | |||
73 | // Release state order | ||
74 | // '#' stands for any number | ||
75 | $versions = array( | ||
76 | 'dev' => 0, | ||
77 | 'alpha' => 1, | ||
78 | 'a' => 1, | ||
79 | 'beta' => 2, | ||
80 | 'b' => 2, | ||
81 | 'RC' => 3, | ||
82 | '#' => 4, | ||
83 | 'p' => 5, | ||
84 | 'pl' => 5); | ||
85 | |||
86 | // Loop through each segment in the version string | ||
87 | $compare = 0; | ||
88 | for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { | ||
89 | if ($v1[$i] == $v2[$i]) { | ||
90 | continue; | ||
91 | } | ||
92 | $i1 = $v1[$i]; | ||
93 | $i2 = $v2[$i]; | ||
94 | if (is_numeric($i1) && is_numeric($i2)) { | ||
95 | $compare = ($i1 < $i2) ? -1 : 1; | ||
96 | break; | ||
97 | } | ||
98 | // We use the position of '#' in the versions list | ||
99 | // for numbers... (so take care of # in original string) | ||
100 | if ($i1 == '#') { | ||
101 | $i1 = ''; | ||
102 | } elseif (is_numeric($i1)) { | ||
103 | $i1 = '#'; | ||
104 | } | ||
105 | if ($i2 == '#') { | ||
106 | $i2 = ''; | ||
107 | } elseif (is_numeric($i2)) { | ||
108 | $i2 = '#'; | ||
109 | } | ||
110 | if (isset($versions[$i1]) && isset($versions[$i2])) { | ||
111 | $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; | ||
112 | } elseif (isset($versions[$i1])) { | ||
113 | $compare = 1; | ||
114 | } elseif (isset($versions[$i2])) { | ||
115 | $compare = -1; | ||
116 | } else { | ||
117 | $compare = 0; | ||
118 | } | ||
119 | |||
120 | break; | ||
121 | } | ||
122 | |||
123 | // If previous loop didn't find anything, compare the "extra" segments | ||
124 | if ($compare == 0) { | ||
125 | if (count($v2) > count($v1)) { | ||
126 | if (isset($versions[$v2[$i]])) { | ||
127 | $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; | ||
128 | } else { | ||
129 | $compare = -1; | ||
130 | } | ||
131 | } elseif (count($v2) < count($v1)) { | ||
132 | if (isset($versions[$v1[$i]])) { | ||
133 | $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; | ||
134 | } else { | ||
135 | $compare = 1; | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | |||
140 | // Compare the versions | ||
141 | if (func_num_args() > 2) { | ||
142 | switch ($operator) { | ||
143 | case '>': | ||
144 | case 'gt': | ||
145 | return (bool) ($compare > 0); | ||
146 | break; | ||
147 | case '>=': | ||
148 | case 'ge': | ||
149 | return (bool) ($compare >= 0); | ||
150 | break; | ||
151 | case '<=': | ||
152 | case 'le': | ||
153 | return (bool) ($compare <= 0); | ||
154 | break; | ||
155 | case '==': | ||
156 | case '=': | ||
157 | case 'eq': | ||
158 | return (bool) ($compare == 0); | ||
159 | break; | ||
160 | case '<>': | ||
161 | case '!=': | ||
162 | case 'ne': | ||
163 | return (bool) ($compare != 0); | ||
164 | break; | ||
165 | case '': | ||
166 | case '<': | ||
167 | case 'lt': | ||
168 | return (bool) ($compare < 0); | ||
169 | break; | ||
170 | default: | ||
171 | return; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | return $compare; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/xmlrpc.inc b/includes/xmlrpc/xmlrpc.inc new file mode 100644 index 0000000..06c6e44 --- /dev/null +++ b/includes/xmlrpc/xmlrpc.inc | |||
@@ -0,0 +1,3705 @@ | |||
1 | <?php | ||
2 | // by Edd Dumbill (C) 1999-2002 | ||
3 | // <edd@usefulinc.com> | ||
4 | // $Id: xmlrpc.inc,v 1.169 2008/03/06 18:47:24 ggiunta Exp $ | ||
5 | |||
6 | // Copyright (c) 1999,2000,2002 Edd Dumbill. | ||
7 | // All rights reserved. | ||
8 | // | ||
9 | // Redistribution and use in source and binary forms, with or without | ||
10 | // modification, are permitted provided that the following conditions | ||
11 | // are met: | ||
12 | // | ||
13 | // * Redistributions of source code must retain the above copyright | ||
14 | // notice, this list of conditions and the following disclaimer. | ||
15 | // | ||
16 | // * Redistributions in binary form must reproduce the above | ||
17 | // copyright notice, this list of conditions and the following | ||
18 | // disclaimer in the documentation and/or other materials provided | ||
19 | // with the distribution. | ||
20 | // | ||
21 | // * Neither the name of the "XML-RPC for PHP" nor the names of its | ||
22 | // contributors may be used to endorse or promote products derived | ||
23 | // from this software without specific prior written permission. | ||
24 | // | ||
25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
28 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
29 | // REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
30 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
31 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
32 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
33 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
34 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
35 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
36 | // OF THE POSSIBILITY OF SUCH DAMAGE. | ||
37 | |||
38 | if(!function_exists('xml_parser_create')) | ||
39 | { | ||
40 | // For PHP 4 onward, XML functionality is always compiled-in on windows: | ||
41 | // no more need to dl-open it. It might have been compiled out on *nix... | ||
42 | if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN')) | ||
43 | { | ||
44 | dl('xml.so'); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // Try to be backward compat with php < 4.2 (are we not being nice ?) | ||
49 | $phpversion = phpversion(); | ||
50 | if($phpversion[0] == '4' && $phpversion[2] < 2) | ||
51 | { | ||
52 | // give an opportunity to user to specify where to include other files from | ||
53 | if(!defined('PHP_XMLRPC_COMPAT_DIR')) | ||
54 | { | ||
55 | define('PHP_XMLRPC_COMPAT_DIR',dirname(__FILE__).'/compat/'); | ||
56 | } | ||
57 | if($phpversion[2] == '0') | ||
58 | { | ||
59 | if($phpversion[4] < 6) | ||
60 | { | ||
61 | include(PHP_XMLRPC_COMPAT_DIR.'is_callable.php'); | ||
62 | } | ||
63 | include(PHP_XMLRPC_COMPAT_DIR.'is_scalar.php'); | ||
64 | include(PHP_XMLRPC_COMPAT_DIR.'array_key_exists.php'); | ||
65 | include(PHP_XMLRPC_COMPAT_DIR.'version_compare.php'); | ||
66 | } | ||
67 | include(PHP_XMLRPC_COMPAT_DIR.'var_export.php'); | ||
68 | include(PHP_XMLRPC_COMPAT_DIR.'is_a.php'); | ||
69 | } | ||
70 | |||
71 | // G. Giunta 2005/01/29: declare global these variables, | ||
72 | // so that xmlrpc.inc will work even if included from within a function | ||
73 | // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used. | ||
74 | $GLOBALS['xmlrpcI4']='i4'; | ||
75 | $GLOBALS['xmlrpcInt']='int'; | ||
76 | $GLOBALS['xmlrpcBoolean']='boolean'; | ||
77 | $GLOBALS['xmlrpcDouble']='double'; | ||
78 | $GLOBALS['xmlrpcString']='string'; | ||
79 | $GLOBALS['xmlrpcDateTime']='dateTime.iso8601'; | ||
80 | $GLOBALS['xmlrpcBase64']='base64'; | ||
81 | $GLOBALS['xmlrpcArray']='array'; | ||
82 | $GLOBALS['xmlrpcStruct']='struct'; | ||
83 | $GLOBALS['xmlrpcValue']='undefined'; | ||
84 | |||
85 | $GLOBALS['xmlrpcTypes']=array( | ||
86 | $GLOBALS['xmlrpcI4'] => 1, | ||
87 | $GLOBALS['xmlrpcInt'] => 1, | ||
88 | $GLOBALS['xmlrpcBoolean'] => 1, | ||
89 | $GLOBALS['xmlrpcString'] => 1, | ||
90 | $GLOBALS['xmlrpcDouble'] => 1, | ||
91 | $GLOBALS['xmlrpcDateTime'] => 1, | ||
92 | $GLOBALS['xmlrpcBase64'] => 1, | ||
93 | $GLOBALS['xmlrpcArray'] => 2, | ||
94 | $GLOBALS['xmlrpcStruct'] => 3 | ||
95 | ); | ||
96 | |||
97 | $GLOBALS['xmlrpc_valid_parents'] = array( | ||
98 | 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'), | ||
99 | 'BOOLEAN' => array('VALUE'), | ||
100 | 'I4' => array('VALUE'), | ||
101 | 'INT' => array('VALUE'), | ||
102 | 'STRING' => array('VALUE'), | ||
103 | 'DOUBLE' => array('VALUE'), | ||
104 | 'DATETIME.ISO8601' => array('VALUE'), | ||
105 | 'BASE64' => array('VALUE'), | ||
106 | 'MEMBER' => array('STRUCT'), | ||
107 | 'NAME' => array('MEMBER'), | ||
108 | 'DATA' => array('ARRAY'), | ||
109 | 'ARRAY' => array('VALUE'), | ||
110 | 'STRUCT' => array('VALUE'), | ||
111 | 'PARAM' => array('PARAMS'), | ||
112 | 'METHODNAME' => array('METHODCALL'), | ||
113 | 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), | ||
114 | 'FAULT' => array('METHODRESPONSE'), | ||
115 | 'NIL' => array('VALUE') // only used when extension activated | ||
116 | ); | ||
117 | |||
118 | // define extra types for supporting NULL (useful for json or <NIL/>) | ||
119 | $GLOBALS['xmlrpcNull']='null'; | ||
120 | $GLOBALS['xmlrpcTypes']['null']=1; | ||
121 | |||
122 | // Not in use anymore since 2.0. Shall we remove it? | ||
123 | /// @deprecated | ||
124 | $GLOBALS['xmlEntities']=array( | ||
125 | 'amp' => '&', | ||
126 | 'quot' => '"', | ||
127 | 'lt' => '<', | ||
128 | 'gt' => '>', | ||
129 | 'apos' => "'" | ||
130 | ); | ||
131 | |||
132 | // tables used for transcoding different charsets into us-ascii xml | ||
133 | |||
134 | $GLOBALS['xml_iso88591_Entities']=array(); | ||
135 | $GLOBALS['xml_iso88591_Entities']['in'] = array(); | ||
136 | $GLOBALS['xml_iso88591_Entities']['out'] = array(); | ||
137 | for ($i = 0; $i < 32; $i++) | ||
138 | { | ||
139 | $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i); | ||
140 | $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';'; | ||
141 | } | ||
142 | for ($i = 160; $i < 256; $i++) | ||
143 | { | ||
144 | $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i); | ||
145 | $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';'; | ||
146 | } | ||
147 | |||
148 | /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159? | ||
149 | /// These will NOT be present in true ISO-8859-1, but will save the unwary | ||
150 | /// windows user from sending junk (though no luck when reciving them...) | ||
151 | /* | ||
152 | $GLOBALS['xml_cp1252_Entities']=array(); | ||
153 | for ($i = 128; $i < 160; $i++) | ||
154 | { | ||
155 | $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i); | ||
156 | } | ||
157 | $GLOBALS['xml_cp1252_Entities']['out'] = array( | ||
158 | '€', '?', '‚', 'ƒ', | ||
159 | '„', '…', '†', '‡', | ||
160 | 'ˆ', '‰', 'Š', '‹', | ||
161 | 'Œ', '?', 'Ž', '?', | ||
162 | '?', '‘', '’', '“', | ||
163 | '”', '•', '–', '—', | ||
164 | '˜', '™', 'š', '›', | ||
165 | 'œ', '?', 'ž', 'Ÿ' | ||
166 | ); | ||
167 | */ | ||
168 | |||
169 | $GLOBALS['xmlrpcerr'] = array( | ||
170 | 'unknown_method'=>1, | ||
171 | 'invalid_return'=>2, | ||
172 | 'incorrect_params'=>3, | ||
173 | 'introspect_unknown'=>4, | ||
174 | 'http_error'=>5, | ||
175 | 'no_data'=>6, | ||
176 | 'no_ssl'=>7, | ||
177 | 'curl_fail'=>8, | ||
178 | 'invalid_request'=>15, | ||
179 | 'no_curl'=>16, | ||
180 | 'server_error'=>17, | ||
181 | 'multicall_error'=>18, | ||
182 | 'multicall_notstruct'=>9, | ||
183 | 'multicall_nomethod'=>10, | ||
184 | 'multicall_notstring'=>11, | ||
185 | 'multicall_recursion'=>12, | ||
186 | 'multicall_noparams'=>13, | ||
187 | 'multicall_notarray'=>14, | ||
188 | |||
189 | 'cannot_decompress'=>103, | ||
190 | 'decompress_fail'=>104, | ||
191 | 'dechunk_fail'=>105, | ||
192 | 'server_cannot_decompress'=>106, | ||
193 | 'server_decompress_fail'=>107 | ||
194 | ); | ||
195 | |||
196 | $GLOBALS['xmlrpcstr'] = array( | ||
197 | 'unknown_method'=>'Unknown method', | ||
198 | 'invalid_return'=>'Invalid return payload: enable debugging to examine incoming payload', | ||
199 | 'incorrect_params'=>'Incorrect parameters passed to method', | ||
200 | 'introspect_unknown'=>"Can't introspect: method unknown", | ||
201 | 'http_error'=>"Didn't receive 200 OK from remote server.", | ||
202 | 'no_data'=>'No data received from server.', | ||
203 | 'no_ssl'=>'No SSL support compiled in.', | ||
204 | 'curl_fail'=>'CURL error', | ||
205 | 'invalid_request'=>'Invalid request payload', | ||
206 | 'no_curl'=>'No CURL support compiled in.', | ||
207 | 'server_error'=>'Internal server error', | ||
208 | 'multicall_error'=>'Received from server invalid multicall response', | ||
209 | 'multicall_notstruct'=>'system.multicall expected struct', | ||
210 | 'multicall_nomethod'=>'missing methodName', | ||
211 | 'multicall_notstring'=>'methodName is not a string', | ||
212 | 'multicall_recursion'=>'recursive system.multicall forbidden', | ||
213 | 'multicall_noparams'=>'missing params', | ||
214 | 'multicall_notarray'=>'params is not an array', | ||
215 | |||
216 | 'cannot_decompress'=>'Received from server compressed HTTP and cannot decompress', | ||
217 | 'decompress_fail'=>'Received from server invalid compressed HTTP', | ||
218 | 'dechunk_fail'=>'Received from server invalid chunked HTTP', | ||
219 | 'server_cannot_decompress'=>'Received from client compressed HTTP request and cannot decompress', | ||
220 | 'server_decompress_fail'=>'Received from client invalid compressed HTTP request' | ||
221 | ); | ||
222 | |||
223 | // The charset encoding used by the server for received messages and | ||
224 | // by the client for received responses when received charset cannot be determined | ||
225 | // or is not supported | ||
226 | $GLOBALS['xmlrpc_defencoding']='UTF-8'; | ||
227 | |||
228 | // The encoding used internally by PHP. | ||
229 | // String values received as xml will be converted to this, and php strings will be converted to xml | ||
230 | // as if having been coded with this | ||
231 | $GLOBALS['xmlrpc_internalencoding']='ISO-8859-1'; | ||
232 | |||
233 | $GLOBALS['xmlrpcName']='XML-RPC for PHP'; | ||
234 | $GLOBALS['xmlrpcVersion']='2.2.1'; | ||
235 | |||
236 | // let user errors start at 800 | ||
237 | $GLOBALS['xmlrpcerruser']=800; | ||
238 | // let XML parse errors start at 100 | ||
239 | $GLOBALS['xmlrpcerrxml']=100; | ||
240 | |||
241 | // formulate backslashes for escaping regexp | ||
242 | // Not in use anymore since 2.0. Shall we remove it? | ||
243 | /// @deprecated | ||
244 | $GLOBALS['xmlrpc_backslash']=chr(92).chr(92); | ||
245 | |||
246 | // set to TRUE to enable correct decoding of <NIL/> values | ||
247 | $GLOBALS['xmlrpc_null_extension']=false; | ||
248 | |||
249 | // used to store state during parsing | ||
250 | // quick explanation of components: | ||
251 | // ac - used to accumulate values | ||
252 | // isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1) | ||
253 | // isf_reason - used for storing xmlrpcresp fault string | ||
254 | // lv - used to indicate "looking for a value": implements | ||
255 | // the logic to allow values with no types to be strings | ||
256 | // params - used to store parameters in method calls | ||
257 | // method - used to store method name | ||
258 | // stack - array with genealogy of xml elements names: | ||
259 | // used to validate nesting of xmlrpc elements | ||
260 | $GLOBALS['_xh']=null; | ||
261 | |||
262 | /** | ||
263 | * Convert a string to the correct XML representation in a target charset | ||
264 | * To help correct communication of non-ascii chars inside strings, regardless | ||
265 | * of the charset used when sending requests, parsing them, sending responses | ||
266 | * and parsing responses, an option is to convert all non-ascii chars present in the message | ||
267 | * into their equivalent 'charset entity'. Charset entities enumerated this way | ||
268 | * are independent of the charset encoding used to transmit them, and all XML | ||
269 | * parsers are bound to understand them. | ||
270 | * Note that in the std case we are not sending a charset encoding mime type | ||
271 | * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii. | ||
272 | * | ||
273 | * @todo do a bit of basic benchmarking (strtr vs. str_replace) | ||
274 | * @todo make usage of iconv() or recode_string() or mb_string() where available | ||
275 | */ | ||
276 | function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='') | ||
277 | { | ||
278 | if ($src_encoding == '') | ||
279 | { | ||
280 | // lame, but we know no better... | ||
281 | $src_encoding = $GLOBALS['xmlrpc_internalencoding']; | ||
282 | } | ||
283 | |||
284 | switch(strtoupper($src_encoding.'_'.$dest_encoding)) | ||
285 | { | ||
286 | case 'ISO-8859-1_': | ||
287 | case 'ISO-8859-1_US-ASCII': | ||
288 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
289 | $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data); | ||
290 | break; | ||
291 | case 'ISO-8859-1_UTF-8': | ||
292 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
293 | $escaped_data = utf8_encode($escaped_data); | ||
294 | break; | ||
295 | case 'ISO-8859-1_ISO-8859-1': | ||
296 | case 'US-ASCII_US-ASCII': | ||
297 | case 'US-ASCII_UTF-8': | ||
298 | case 'US-ASCII_': | ||
299 | case 'US-ASCII_ISO-8859-1': | ||
300 | case 'UTF-8_UTF-8': | ||
301 | //case 'CP1252_CP1252': | ||
302 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
303 | break; | ||
304 | case 'UTF-8_': | ||
305 | case 'UTF-8_US-ASCII': | ||
306 | case 'UTF-8_ISO-8859-1': | ||
307 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF | ||
308 | $escaped_data = ''; | ||
309 | // be kind to users creating string xmlrpcvals out of different php types | ||
310 | $data = (string) $data; | ||
311 | $ns = strlen ($data); | ||
312 | for ($nn = 0; $nn < $ns; $nn++) | ||
313 | { | ||
314 | $ch = $data[$nn]; | ||
315 | $ii = ord($ch); | ||
316 | //1 7 0bbbbbbb (127) | ||
317 | if ($ii < 128) | ||
318 | { | ||
319 | /// @todo shall we replace this with a (supposedly) faster str_replace? | ||
320 | switch($ii){ | ||
321 | case 34: | ||
322 | $escaped_data .= '"'; | ||
323 | break; | ||
324 | case 38: | ||
325 | $escaped_data .= '&'; | ||
326 | break; | ||
327 | case 39: | ||
328 | $escaped_data .= '''; | ||
329 | break; | ||
330 | case 60: | ||
331 | $escaped_data .= '<'; | ||
332 | break; | ||
333 | case 62: | ||
334 | $escaped_data .= '>'; | ||
335 | break; | ||
336 | default: | ||
337 | $escaped_data .= $ch; | ||
338 | } // switch | ||
339 | } | ||
340 | //2 11 110bbbbb 10bbbbbb (2047) | ||
341 | else if ($ii>>5 == 6) | ||
342 | { | ||
343 | $b1 = ($ii & 31); | ||
344 | $ii = ord($data[$nn+1]); | ||
345 | $b2 = ($ii & 63); | ||
346 | $ii = ($b1 * 64) + $b2; | ||
347 | $ent = sprintf ('&#%d;', $ii); | ||
348 | $escaped_data .= $ent; | ||
349 | $nn += 1; | ||
350 | } | ||
351 | //3 16 1110bbbb 10bbbbbb 10bbbbbb | ||
352 | else if ($ii>>4 == 14) | ||
353 | { | ||
354 | $b1 = ($ii & 31); | ||
355 | $ii = ord($data[$nn+1]); | ||
356 | $b2 = ($ii & 63); | ||
357 | $ii = ord($data[$nn+2]); | ||
358 | $b3 = ($ii & 63); | ||
359 | $ii = ((($b1 * 64) + $b2) * 64) + $b3; | ||
360 | $ent = sprintf ('&#%d;', $ii); | ||
361 | $escaped_data .= $ent; | ||
362 | $nn += 2; | ||
363 | } | ||
364 | //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb | ||
365 | else if ($ii>>3 == 30) | ||
366 | { | ||
367 | $b1 = ($ii & 31); | ||
368 | $ii = ord($data[$nn+1]); | ||
369 | $b2 = ($ii & 63); | ||
370 | $ii = ord($data[$nn+2]); | ||
371 | $b3 = ($ii & 63); | ||
372 | $ii = ord($data[$nn+3]); | ||
373 | $b4 = ($ii & 63); | ||
374 | $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; | ||
375 | $ent = sprintf ('&#%d;', $ii); | ||
376 | $escaped_data .= $ent; | ||
377 | $nn += 3; | ||
378 | } | ||
379 | } | ||
380 | break; | ||
381 | /* | ||
382 | case 'CP1252_': | ||
383 | case 'CP1252_US-ASCII': | ||
384 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
385 | $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data); | ||
386 | $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); | ||
387 | break; | ||
388 | case 'CP1252_UTF-8': | ||
389 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
390 | /// @todo we could use real UTF8 chars here instead of xml entities... (note that utf_8 encode all allone will NOT convert them) | ||
391 | $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); | ||
392 | $escaped_data = utf8_encode($escaped_data); | ||
393 | break; | ||
394 | case 'CP1252_ISO-8859-1': | ||
395 | $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $data); | ||
396 | // we might as well replave all funky chars with a '?' here, but we are kind and leave it to the receiving application layer to decide what to do with these weird entities... | ||
397 | $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data); | ||
398 | break; | ||
399 | */ | ||
400 | default: | ||
401 | $escaped_data = ''; | ||
402 | error_log("Converting from $src_encoding to $dest_encoding: not supported..."); | ||
403 | } | ||
404 | return $escaped_data; | ||
405 | } | ||
406 | |||
407 | /// xml parser handler function for opening element tags | ||
408 | function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false) | ||
409 | { | ||
410 | // if invalid xmlrpc already detected, skip all processing | ||
411 | if ($GLOBALS['_xh']['isf'] < 2) | ||
412 | { | ||
413 | // check for correct element nesting | ||
414 | // top level element can only be of 2 types | ||
415 | /// @todo optimization creep: save this check into a bool variable, instead of using count() every time: | ||
416 | /// there is only a single top level element in xml anyway | ||
417 | if (count($GLOBALS['_xh']['stack']) == 0) | ||
418 | { | ||
419 | if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && ( | ||
420 | $name != 'VALUE' && !$accept_single_vals)) | ||
421 | { | ||
422 | $GLOBALS['_xh']['isf'] = 2; | ||
423 | $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element'; | ||
424 | return; | ||
425 | } | ||
426 | else | ||
427 | { | ||
428 | $GLOBALS['_xh']['rt'] = strtolower($name); | ||
429 | } | ||
430 | } | ||
431 | else | ||
432 | { | ||
433 | // not top level element: see if parent is OK | ||
434 | $parent = end($GLOBALS['_xh']['stack']); | ||
435 | if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name])) | ||
436 | { | ||
437 | $GLOBALS['_xh']['isf'] = 2; | ||
438 | $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent"; | ||
439 | return; | ||
440 | } | ||
441 | } | ||
442 | |||
443 | switch($name) | ||
444 | { | ||
445 | // optimize for speed switch cases: most common cases first | ||
446 | case 'VALUE': | ||
447 | /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element | ||
448 | $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet | ||
449 | $GLOBALS['_xh']['ac']=''; | ||
450 | $GLOBALS['_xh']['lv']=1; | ||
451 | $GLOBALS['_xh']['php_class']=null; | ||
452 | break; | ||
453 | case 'I4': | ||
454 | case 'INT': | ||
455 | case 'STRING': | ||
456 | case 'BOOLEAN': | ||
457 | case 'DOUBLE': | ||
458 | case 'DATETIME.ISO8601': | ||
459 | case 'BASE64': | ||
460 | if ($GLOBALS['_xh']['vt']!='value') | ||
461 | { | ||
462 | //two data elements inside a value: an error occurred! | ||
463 | $GLOBALS['_xh']['isf'] = 2; | ||
464 | $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; | ||
465 | return; | ||
466 | } | ||
467 | $GLOBALS['_xh']['ac']=''; // reset the accumulator | ||
468 | break; | ||
469 | case 'STRUCT': | ||
470 | case 'ARRAY': | ||
471 | if ($GLOBALS['_xh']['vt']!='value') | ||
472 | { | ||
473 | //two data elements inside a value: an error occurred! | ||
474 | $GLOBALS['_xh']['isf'] = 2; | ||
475 | $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; | ||
476 | return; | ||
477 | } | ||
478 | // create an empty array to hold child values, and push it onto appropriate stack | ||
479 | $cur_val = array(); | ||
480 | $cur_val['values'] = array(); | ||
481 | $cur_val['type'] = $name; | ||
482 | // check for out-of-band information to rebuild php objs | ||
483 | // and in case it is found, save it | ||
484 | if (@isset($attrs['PHP_CLASS'])) | ||
485 | { | ||
486 | $cur_val['php_class'] = $attrs['PHP_CLASS']; | ||
487 | } | ||
488 | $GLOBALS['_xh']['valuestack'][] = $cur_val; | ||
489 | $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next | ||
490 | break; | ||
491 | case 'DATA': | ||
492 | if ($GLOBALS['_xh']['vt']!='data') | ||
493 | { | ||
494 | //two data elements inside a value: an error occurred! | ||
495 | $GLOBALS['_xh']['isf'] = 2; | ||
496 | $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element"; | ||
497 | return; | ||
498 | } | ||
499 | case 'METHODCALL': | ||
500 | case 'METHODRESPONSE': | ||
501 | case 'PARAMS': | ||
502 | // valid elements that add little to processing | ||
503 | break; | ||
504 | case 'METHODNAME': | ||
505 | case 'NAME': | ||
506 | /// @todo we could check for 2 NAME elements inside a MEMBER element | ||
507 | $GLOBALS['_xh']['ac']=''; | ||
508 | break; | ||
509 | case 'FAULT': | ||
510 | $GLOBALS['_xh']['isf']=1; | ||
511 | break; | ||
512 | case 'MEMBER': | ||
513 | $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on | ||
514 | //$GLOBALS['_xh']['ac']=''; | ||
515 | // Drop trough intentionally | ||
516 | case 'PARAM': | ||
517 | // clear value type, so we can check later if no value has been passed for this param/member | ||
518 | $GLOBALS['_xh']['vt']=null; | ||
519 | break; | ||
520 | case 'NIL': | ||
521 | if ($GLOBALS['xmlrpc_null_extension']) | ||
522 | { | ||
523 | if ($GLOBALS['_xh']['vt']!='value') | ||
524 | { | ||
525 | //two data elements inside a value: an error occurred! | ||
526 | $GLOBALS['_xh']['isf'] = 2; | ||
527 | $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value"; | ||
528 | return; | ||
529 | } | ||
530 | $GLOBALS['_xh']['ac']=''; // reset the accumulator | ||
531 | break; | ||
532 | } | ||
533 | // we do not support the <NIL/> extension, so | ||
534 | // drop through intentionally | ||
535 | default: | ||
536 | /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!! | ||
537 | $GLOBALS['_xh']['isf'] = 2; | ||
538 | $GLOBALS['_xh']['isf_reason'] = "found not-xmlrpc xml element $name"; | ||
539 | break; | ||
540 | } | ||
541 | |||
542 | // Save current element name to stack, to validate nesting | ||
543 | $GLOBALS['_xh']['stack'][] = $name; | ||
544 | |||
545 | /// @todo optimization creep: move this inside the big switch() above | ||
546 | if($name!='VALUE') | ||
547 | { | ||
548 | $GLOBALS['_xh']['lv']=0; | ||
549 | } | ||
550 | } | ||
551 | } | ||
552 | |||
553 | /// Used in decoding xml chunks that might represent single xmlrpc values | ||
554 | function xmlrpc_se_any($parser, $name, $attrs) | ||
555 | { | ||
556 | xmlrpc_se($parser, $name, $attrs, true); | ||
557 | } | ||
558 | |||
559 | /// xml parser handler function for close element tags | ||
560 | function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true) | ||
561 | { | ||
562 | if ($GLOBALS['_xh']['isf'] < 2) | ||
563 | { | ||
564 | // push this element name from stack | ||
565 | // NB: if XML validates, correct opening/closing is guaranteed and | ||
566 | // we do not have to check for $name == $curr_elem. | ||
567 | // we also checked for proper nesting at start of elements... | ||
568 | $curr_elem = array_pop($GLOBALS['_xh']['stack']); | ||
569 | |||
570 | switch($name) | ||
571 | { | ||
572 | case 'VALUE': | ||
573 | // This if() detects if no scalar was inside <VALUE></VALUE> | ||
574 | if ($GLOBALS['_xh']['vt']=='value') | ||
575 | { | ||
576 | $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; | ||
577 | $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString']; | ||
578 | } | ||
579 | |||
580 | if ($rebuild_xmlrpcvals) | ||
581 | { | ||
582 | // build the xmlrpc val out of the data received, and substitute it | ||
583 | $temp =& new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']); | ||
584 | // in case we got info about underlying php class, save it | ||
585 | // in the object we're rebuilding | ||
586 | if (isset($GLOBALS['_xh']['php_class'])) | ||
587 | $temp->_php_class = $GLOBALS['_xh']['php_class']; | ||
588 | // check if we are inside an array or struct: | ||
589 | // if value just built is inside an array, let's move it into array on the stack | ||
590 | $vscount = count($GLOBALS['_xh']['valuestack']); | ||
591 | if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY') | ||
592 | { | ||
593 | $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp; | ||
594 | } | ||
595 | else | ||
596 | { | ||
597 | $GLOBALS['_xh']['value'] = $temp; | ||
598 | } | ||
599 | } | ||
600 | else | ||
601 | { | ||
602 | /// @todo this needs to treat correctly php-serialized objects, | ||
603 | /// since std deserializing is done by php_xmlrpc_decode, | ||
604 | /// which we will not be calling... | ||
605 | if (isset($GLOBALS['_xh']['php_class'])) | ||
606 | { | ||
607 | } | ||
608 | |||
609 | // check if we are inside an array or struct: | ||
610 | // if value just built is inside an array, let's move it into array on the stack | ||
611 | $vscount = count($GLOBALS['_xh']['valuestack']); | ||
612 | if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY') | ||
613 | { | ||
614 | $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value']; | ||
615 | } | ||
616 | } | ||
617 | break; | ||
618 | case 'BOOLEAN': | ||
619 | case 'I4': | ||
620 | case 'INT': | ||
621 | case 'STRING': | ||
622 | case 'DOUBLE': | ||
623 | case 'DATETIME.ISO8601': | ||
624 | case 'BASE64': | ||
625 | $GLOBALS['_xh']['vt']=strtolower($name); | ||
626 | /// @todo: optimization creep - remove the if/elseif cycle below | ||
627 | /// since the case() in which we are already did that | ||
628 | if ($name=='STRING') | ||
629 | { | ||
630 | $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; | ||
631 | } | ||
632 | elseif ($name=='DATETIME.ISO8601') | ||
633 | { | ||
634 | if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac'])) | ||
635 | { | ||
636 | error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']); | ||
637 | } | ||
638 | $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime']; | ||
639 | $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; | ||
640 | } | ||
641 | elseif ($name=='BASE64') | ||
642 | { | ||
643 | /// @todo check for failure of base64 decoding / catch warnings | ||
644 | $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']); | ||
645 | } | ||
646 | elseif ($name=='BOOLEAN') | ||
647 | { | ||
648 | // special case here: we translate boolean 1 or 0 into PHP | ||
649 | // constants true or false. | ||
650 | // Strings 'true' and 'false' are accepted, even though the | ||
651 | // spec never mentions them (see eg. Blogger api docs) | ||
652 | // NB: this simple checks helps a lot sanitizing input, ie no | ||
653 | // security problems around here | ||
654 | if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0) | ||
655 | { | ||
656 | $GLOBALS['_xh']['value']=true; | ||
657 | } | ||
658 | else | ||
659 | { | ||
660 | // log if receiveing something strange, even though we set the value to false anyway | ||
661 | if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($_xh[$parser]['ac'], 'false') != 0) | ||
662 | error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']); | ||
663 | $GLOBALS['_xh']['value']=false; | ||
664 | } | ||
665 | } | ||
666 | elseif ($name=='DOUBLE') | ||
667 | { | ||
668 | // we have a DOUBLE | ||
669 | // we must check that only 0123456789-.<space> are characters here | ||
670 | // NOTE: regexp could be much stricter than this... | ||
671 | if (!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac'])) | ||
672 | { | ||
673 | /// @todo: find a better way of throwing an error than this! | ||
674 | error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']); | ||
675 | $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND'; | ||
676 | } | ||
677 | else | ||
678 | { | ||
679 | // it's ok, add it on | ||
680 | $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac']; | ||
681 | } | ||
682 | } | ||
683 | else | ||
684 | { | ||
685 | // we have an I4/INT | ||
686 | // we must check that only 0123456789-<space> are characters here | ||
687 | if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac'])) | ||
688 | { | ||
689 | /// @todo find a better way of throwing an error than this! | ||
690 | error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']); | ||
691 | $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND'; | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | // it's ok, add it on | ||
696 | $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac']; | ||
697 | } | ||
698 | } | ||
699 | //$GLOBALS['_xh']['ac']=''; // is this necessary? | ||
700 | $GLOBALS['_xh']['lv']=3; // indicate we've found a value | ||
701 | break; | ||
702 | case 'NAME': | ||
703 | $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac']; | ||
704 | break; | ||
705 | case 'MEMBER': | ||
706 | //$GLOBALS['_xh']['ac']=''; // is this necessary? | ||
707 | // add to array in the stack the last element built, | ||
708 | // unless no VALUE was found | ||
709 | if ($GLOBALS['_xh']['vt']) | ||
710 | { | ||
711 | $vscount = count($GLOBALS['_xh']['valuestack']); | ||
712 | $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value']; | ||
713 | } else | ||
714 | error_log('XML-RPC: missing VALUE inside STRUCT in received xml'); | ||
715 | break; | ||
716 | case 'DATA': | ||
717 | //$GLOBALS['_xh']['ac']=''; // is this necessary? | ||
718 | $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty | ||
719 | break; | ||
720 | case 'STRUCT': | ||
721 | case 'ARRAY': | ||
722 | // fetch out of stack array of values, and promote it to current value | ||
723 | $curr_val = array_pop($GLOBALS['_xh']['valuestack']); | ||
724 | $GLOBALS['_xh']['value'] = $curr_val['values']; | ||
725 | $GLOBALS['_xh']['vt']=strtolower($name); | ||
726 | if (isset($curr_val['php_class'])) | ||
727 | { | ||
728 | $GLOBALS['_xh']['php_class'] = $curr_val['php_class']; | ||
729 | } | ||
730 | break; | ||
731 | case 'PARAM': | ||
732 | // add to array of params the current value, | ||
733 | // unless no VALUE was found | ||
734 | if ($GLOBALS['_xh']['vt']) | ||
735 | { | ||
736 | $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value']; | ||
737 | $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt']; | ||
738 | } | ||
739 | else | ||
740 | error_log('XML-RPC: missing VALUE inside PARAM in received xml'); | ||
741 | break; | ||
742 | case 'METHODNAME': | ||
743 | $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']); | ||
744 | break; | ||
745 | case 'NIL': | ||
746 | if ($GLOBALS['xmlrpc_null_extension']) | ||
747 | { | ||
748 | $GLOBALS['_xh']['vt']='null'; | ||
749 | $GLOBALS['_xh']['value']=null; | ||
750 | $GLOBALS['_xh']['lv']=3; | ||
751 | break; | ||
752 | } | ||
753 | // drop through intentionally if nil extension not enabled | ||
754 | case 'PARAMS': | ||
755 | case 'FAULT': | ||
756 | case 'METHODCALL': | ||
757 | case 'METHORESPONSE': | ||
758 | break; | ||
759 | default: | ||
760 | // End of INVALID ELEMENT! | ||
761 | // shall we add an assert here for unreachable code??? | ||
762 | break; | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | |||
767 | /// Used in decoding xmlrpc requests/responses without rebuilding xmlrpc values | ||
768 | function xmlrpc_ee_fast($parser, $name) | ||
769 | { | ||
770 | xmlrpc_ee($parser, $name, false); | ||
771 | } | ||
772 | |||
773 | /// xml parser handler function for character data | ||
774 | function xmlrpc_cd($parser, $data) | ||
775 | { | ||
776 | // skip processing if xml fault already detected | ||
777 | if ($GLOBALS['_xh']['isf'] < 2) | ||
778 | { | ||
779 | // "lookforvalue==3" means that we've found an entire value | ||
780 | // and should discard any further character data | ||
781 | if($GLOBALS['_xh']['lv']!=3) | ||
782 | { | ||
783 | // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2 | ||
784 | //if($GLOBALS['_xh']['lv']==1) | ||
785 | //{ | ||
786 | // if we've found text and we're just in a <value> then | ||
787 | // say we've found a value | ||
788 | //$GLOBALS['_xh']['lv']=2; | ||
789 | //} | ||
790 | // we always initialize the accumulator before starting parsing, anyway... | ||
791 | //if(!@isset($GLOBALS['_xh']['ac'])) | ||
792 | //{ | ||
793 | // $GLOBALS['_xh']['ac'] = ''; | ||
794 | //} | ||
795 | $GLOBALS['_xh']['ac'].=$data; | ||
796 | } | ||
797 | } | ||
798 | } | ||
799 | |||
800 | /// xml parser handler function for 'other stuff', ie. not char data or | ||
801 | /// element start/end tag. In fact it only gets called on unknown entities... | ||
802 | function xmlrpc_dh($parser, $data) | ||
803 | { | ||
804 | // skip processing if xml fault already detected | ||
805 | if ($GLOBALS['_xh']['isf'] < 2) | ||
806 | { | ||
807 | if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') | ||
808 | { | ||
809 | // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2 | ||
810 | //if($GLOBALS['_xh']['lv']==1) | ||
811 | //{ | ||
812 | // $GLOBALS['_xh']['lv']=2; | ||
813 | //} | ||
814 | $GLOBALS['_xh']['ac'].=$data; | ||
815 | } | ||
816 | } | ||
817 | return true; | ||
818 | } | ||
819 | |||
820 | class xmlrpc_client | ||
821 | { | ||
822 | var $path; | ||
823 | var $server; | ||
824 | var $port=0; | ||
825 | var $method='http'; | ||
826 | var $errno; | ||
827 | var $errstr; | ||
828 | var $debug=0; | ||
829 | var $username=''; | ||
830 | var $password=''; | ||
831 | var $authtype=1; | ||
832 | var $cert=''; | ||
833 | var $certpass=''; | ||
834 | var $cacert=''; | ||
835 | var $cacertdir=''; | ||
836 | var $key=''; | ||
837 | var $keypass=''; | ||
838 | var $verifypeer=true; | ||
839 | var $verifyhost=1; | ||
840 | var $no_multicall=false; | ||
841 | var $proxy=''; | ||
842 | var $proxyport=0; | ||
843 | var $proxy_user=''; | ||
844 | var $proxy_pass=''; | ||
845 | var $proxy_authtype=1; | ||
846 | var $cookies=array(); | ||
847 | /** | ||
848 | * List of http compression methods accepted by the client for responses. | ||
849 | * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib | ||
850 | * | ||
851 | * NNB: you can set it to any non-empty array for HTTP11 and HTTPS, since | ||
852 | * in those cases it will be up to CURL to decide the compression methods | ||
853 | * it supports. You might check for the presence of 'zlib' in the output of | ||
854 | * curl_version() to determine wheter compression is supported or not | ||
855 | */ | ||
856 | var $accepted_compression = array(); | ||
857 | /** | ||
858 | * Name of compression scheme to be used for sending requests. | ||
859 | * Either null, gzip or deflate | ||
860 | */ | ||
861 | var $request_compression = ''; | ||
862 | /** | ||
863 | * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see: | ||
864 | * http://curl.haxx.se/docs/faq.html#7.3) | ||
865 | */ | ||
866 | var $xmlrpc_curl_handle = null; | ||
867 | /// Wheter to use persistent connections for http 1.1 and https | ||
868 | var $keepalive = false; | ||
869 | /// Charset encodings that can be decoded without problems by the client | ||
870 | var $accepted_charset_encodings = array(); | ||
871 | /// Charset encoding to be used in serializing request. NULL = use ASCII | ||
872 | var $request_charset_encoding = ''; | ||
873 | /** | ||
874 | * Decides the content of xmlrpcresp objects returned by calls to send() | ||
875 | * valid strings are 'xmlrpcvals', 'phpvals' or 'xml' | ||
876 | */ | ||
877 | var $return_type = 'xmlrpcvals'; | ||
878 | |||
879 | /** | ||
880 | * @param string $path either the complete server URL or the PATH part of the xmlrc server URL, e.g. /xmlrpc/server.php | ||
881 | * @param string $server the server name / ip address | ||
882 | * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used | ||
883 | * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed | ||
884 | */ | ||
885 | function xmlrpc_client($path, $server='', $port='', $method='') | ||
886 | { | ||
887 | // allow user to specify all params in $path | ||
888 | if($server == '' and $port == '' and $method == '') | ||
889 | { | ||
890 | $parts = parse_url($path); | ||
891 | $server = $parts['host']; | ||
892 | $path = isset($parts['path']) ? $parts['path'] : ''; | ||
893 | if(isset($parts['query'])) | ||
894 | { | ||
895 | $path .= '?'.$parts['query']; | ||
896 | } | ||
897 | if(isset($parts['fragment'])) | ||
898 | { | ||
899 | $path .= '#'.$parts['fragment']; | ||
900 | } | ||
901 | if(isset($parts['port'])) | ||
902 | { | ||
903 | $port = $parts['port']; | ||
904 | } | ||
905 | if(isset($parts['scheme'])) | ||
906 | { | ||
907 | $method = $parts['scheme']; | ||
908 | } | ||
909 | if(isset($parts['user'])) | ||
910 | { | ||
911 | $this->username = $parts['user']; | ||
912 | } | ||
913 | if(isset($parts['pass'])) | ||
914 | { | ||
915 | $this->password = $parts['pass']; | ||
916 | } | ||
917 | } | ||
918 | if($path == '' || $path[0] != '/') | ||
919 | { | ||
920 | $this->path='/'.$path; | ||
921 | } | ||
922 | else | ||
923 | { | ||
924 | $this->path=$path; | ||
925 | } | ||
926 | $this->server=$server; | ||
927 | if($port != '') | ||
928 | { | ||
929 | $this->port=$port; | ||
930 | } | ||
931 | if($method != '') | ||
932 | { | ||
933 | $this->method=$method; | ||
934 | } | ||
935 | |||
936 | // if ZLIB is enabled, let the client by default accept compressed responses | ||
937 | if(function_exists('gzinflate') || ( | ||
938 | function_exists('curl_init') && (($info = curl_version()) && | ||
939 | ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version']))) | ||
940 | )) | ||
941 | { | ||
942 | $this->accepted_compression = array('gzip', 'deflate'); | ||
943 | } | ||
944 | |||
945 | // keepalives: enabled by default ONLY for PHP >= 4.3.8 | ||
946 | // (see http://curl.haxx.se/docs/faq.html#7.3) | ||
947 | if(version_compare(phpversion(), '4.3.8') >= 0) | ||
948 | { | ||
949 | $this->keepalive = true; | ||
950 | } | ||
951 | |||
952 | // by default the xml parser can support these 3 charset encodings | ||
953 | $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII'); | ||
954 | } | ||
955 | |||
956 | /** | ||
957 | * Enables/disables the echoing to screen of the xmlrpc responses received | ||
958 | * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response) | ||
959 | * @access public | ||
960 | */ | ||
961 | function setDebug($in) | ||
962 | { | ||
963 | $this->debug=$in; | ||
964 | } | ||
965 | |||
966 | /** | ||
967 | * Add some http BASIC AUTH credentials, used by the client to authenticate | ||
968 | * @param string $u username | ||
969 | * @param string $p password | ||
970 | * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth) | ||
971 | * @access public | ||
972 | */ | ||
973 | function setCredentials($u, $p, $t=1) | ||
974 | { | ||
975 | $this->username=$u; | ||
976 | $this->password=$p; | ||
977 | $this->authtype=$t; | ||
978 | } | ||
979 | |||
980 | /** | ||
981 | * Add a client-side https certificate | ||
982 | * @param string $cert | ||
983 | * @param string $certpass | ||
984 | * @access public | ||
985 | */ | ||
986 | function setCertificate($cert, $certpass) | ||
987 | { | ||
988 | $this->cert = $cert; | ||
989 | $this->certpass = $certpass; | ||
990 | } | ||
991 | |||
992 | /** | ||
993 | * Add a CA certificate to verify server with (see man page about | ||
994 | * CURLOPT_CAINFO for more details | ||
995 | * @param string $cacert certificate file name (or dir holding certificates) | ||
996 | * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false | ||
997 | * @access public | ||
998 | */ | ||
999 | function setCaCertificate($cacert, $is_dir=false) | ||
1000 | { | ||
1001 | if ($is_dir) | ||
1002 | { | ||
1003 | $this->cacertdir = $cacert; | ||
1004 | } | ||
1005 | else | ||
1006 | { | ||
1007 | $this->cacert = $cacert; | ||
1008 | } | ||
1009 | } | ||
1010 | |||
1011 | /** | ||
1012 | * Set attributes for SSL communication: private SSL key | ||
1013 | * NB: does not work in older php/curl installs | ||
1014 | * Thanks to Daniel Convissor | ||
1015 | * @param string $key The name of a file containing a private SSL key | ||
1016 | * @param string $keypass The secret password needed to use the private SSL key | ||
1017 | * @access public | ||
1018 | */ | ||
1019 | function setKey($key, $keypass) | ||
1020 | { | ||
1021 | $this->key = $key; | ||
1022 | $this->keypass = $keypass; | ||
1023 | } | ||
1024 | |||
1025 | /** | ||
1026 | * Set attributes for SSL communication: verify server certificate | ||
1027 | * @param bool $i enable/disable verification of peer certificate | ||
1028 | * @access public | ||
1029 | */ | ||
1030 | function setSSLVerifyPeer($i) | ||
1031 | { | ||
1032 | $this->verifypeer = $i; | ||
1033 | } | ||
1034 | |||
1035 | /** | ||
1036 | * Set attributes for SSL communication: verify match of server cert w. hostname | ||
1037 | * @param int $i | ||
1038 | * @access public | ||
1039 | */ | ||
1040 | function setSSLVerifyHost($i) | ||
1041 | { | ||
1042 | $this->verifyhost = $i; | ||
1043 | } | ||
1044 | |||
1045 | /** | ||
1046 | * Set proxy info | ||
1047 | * @param string $proxyhost | ||
1048 | * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS | ||
1049 | * @param string $proxyusername Leave blank if proxy has public access | ||
1050 | * @param string $proxypassword Leave blank if proxy has public access | ||
1051 | * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy | ||
1052 | * @access public | ||
1053 | */ | ||
1054 | function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1) | ||
1055 | { | ||
1056 | $this->proxy = $proxyhost; | ||
1057 | $this->proxyport = $proxyport; | ||
1058 | $this->proxy_user = $proxyusername; | ||
1059 | $this->proxy_pass = $proxypassword; | ||
1060 | $this->proxy_authtype = $proxyauthtype; | ||
1061 | } | ||
1062 | |||
1063 | /** | ||
1064 | * Enables/disables reception of compressed xmlrpc responses. | ||
1065 | * Note that enabling reception of compressed responses merely adds some standard | ||
1066 | * http headers to xmlrpc requests. It is up to the xmlrpc server to return | ||
1067 | * compressed responses when receiving such requests. | ||
1068 | * @param string $compmethod either 'gzip', 'deflate', 'any' or '' | ||
1069 | * @access public | ||
1070 | */ | ||
1071 | function setAcceptedCompression($compmethod) | ||
1072 | { | ||
1073 | if ($compmethod == 'any') | ||
1074 | $this->accepted_compression = array('gzip', 'deflate'); | ||
1075 | else | ||
1076 | $this->accepted_compression = array($compmethod); | ||
1077 | } | ||
1078 | |||
1079 | /** | ||
1080 | * Enables/disables http compression of xmlrpc request. | ||
1081 | * Take care when sending compressed requests: servers might not support them | ||
1082 | * (and automatic fallback to uncompressed requests is not yet implemented) | ||
1083 | * @param string $compmethod either 'gzip', 'deflate' or '' | ||
1084 | * @access public | ||
1085 | */ | ||
1086 | function setRequestCompression($compmethod) | ||
1087 | { | ||
1088 | $this->request_compression = $compmethod; | ||
1089 | } | ||
1090 | |||
1091 | /** | ||
1092 | * Adds a cookie to list of cookies that will be sent to server. | ||
1093 | * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie: | ||
1094 | * do not do it unless you know what you are doing | ||
1095 | * @param string $name | ||
1096 | * @param string $value | ||
1097 | * @param string $path | ||
1098 | * @param string $domain | ||
1099 | * @param int $port | ||
1100 | * @access public | ||
1101 | * | ||
1102 | * @todo check correctness of urlencoding cookie value (copied from php way of doing it...) | ||
1103 | */ | ||
1104 | function setCookie($name, $value='', $path='', $domain='', $port=null) | ||
1105 | { | ||
1106 | $this->cookies[$name]['value'] = urlencode($value); | ||
1107 | if ($path || $domain || $port) | ||
1108 | { | ||
1109 | $this->cookies[$name]['path'] = $path; | ||
1110 | $this->cookies[$name]['domain'] = $domain; | ||
1111 | $this->cookies[$name]['port'] = $port; | ||
1112 | $this->cookies[$name]['version'] = 1; | ||
1113 | } | ||
1114 | else | ||
1115 | { | ||
1116 | $this->cookies[$name]['version'] = 0; | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1120 | /** | ||
1121 | * Send an xmlrpc request | ||
1122 | * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request | ||
1123 | * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply | ||
1124 | * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used | ||
1125 | * @return xmlrpcresp | ||
1126 | * @access public | ||
1127 | */ | ||
1128 | function& send($msg, $timeout=0, $method='') | ||
1129 | { | ||
1130 | // if user deos not specify http protocol, use native method of this client | ||
1131 | // (i.e. method set during call to constructor) | ||
1132 | if($method == '') | ||
1133 | { | ||
1134 | $method = $this->method; | ||
1135 | } | ||
1136 | |||
1137 | if(is_array($msg)) | ||
1138 | { | ||
1139 | // $msg is an array of xmlrpcmsg's | ||
1140 | $r = $this->multicall($msg, $timeout, $method); | ||
1141 | return $r; | ||
1142 | } | ||
1143 | elseif(is_string($msg)) | ||
1144 | { | ||
1145 | $n =& new xmlrpcmsg(''); | ||
1146 | $n->payload = $msg; | ||
1147 | $msg = $n; | ||
1148 | } | ||
1149 | |||
1150 | // where msg is an xmlrpcmsg | ||
1151 | $msg->debug=$this->debug; | ||
1152 | |||
1153 | if($method == 'https') | ||
1154 | { | ||
1155 | $r =& $this->sendPayloadHTTPS( | ||
1156 | $msg, | ||
1157 | $this->server, | ||
1158 | $this->port, | ||
1159 | $timeout, | ||
1160 | $this->username, | ||
1161 | $this->password, | ||
1162 | $this->authtype, | ||
1163 | $this->cert, | ||
1164 | $this->certpass, | ||
1165 | $this->cacert, | ||
1166 | $this->cacertdir, | ||
1167 | $this->proxy, | ||
1168 | $this->proxyport, | ||
1169 | $this->proxy_user, | ||
1170 | $this->proxy_pass, | ||
1171 | $this->proxy_authtype, | ||
1172 | $this->keepalive, | ||
1173 | $this->key, | ||
1174 | $this->keypass | ||
1175 | ); | ||
1176 | } | ||
1177 | elseif($method == 'http11') | ||
1178 | { | ||
1179 | $r =& $this->sendPayloadCURL( | ||
1180 | $msg, | ||
1181 | $this->server, | ||
1182 | $this->port, | ||
1183 | $timeout, | ||
1184 | $this->username, | ||
1185 | $this->password, | ||
1186 | $this->authtype, | ||
1187 | null, | ||
1188 | null, | ||
1189 | null, | ||
1190 | null, | ||
1191 | $this->proxy, | ||
1192 | $this->proxyport, | ||
1193 | $this->proxy_user, | ||
1194 | $this->proxy_pass, | ||
1195 | $this->proxy_authtype, | ||
1196 | 'http', | ||
1197 | $this->keepalive | ||
1198 | ); | ||
1199 | } | ||
1200 | else | ||
1201 | { | ||
1202 | $r =& $this->sendPayloadHTTP10( | ||
1203 | $msg, | ||
1204 | $this->server, | ||
1205 | $this->port, | ||
1206 | $timeout, | ||
1207 | $this->username, | ||
1208 | $this->password, | ||
1209 | $this->authtype, | ||
1210 | $this->proxy, | ||
1211 | $this->proxyport, | ||
1212 | $this->proxy_user, | ||
1213 | $this->proxy_pass, | ||
1214 | $this->proxy_authtype | ||
1215 | ); | ||
1216 | } | ||
1217 | |||
1218 | return $r; | ||
1219 | } | ||
1220 | |||
1221 | /** | ||
1222 | * @access private | ||
1223 | */ | ||
1224 | function &sendPayloadHTTP10($msg, $server, $port, $timeout=0, | ||
1225 | $username='', $password='', $authtype=1, $proxyhost='', | ||
1226 | $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1) | ||
1227 | { | ||
1228 | if($port==0) | ||
1229 | { | ||
1230 | $port=80; | ||
1231 | } | ||
1232 | |||
1233 | // Only create the payload if it was not created previously | ||
1234 | if(empty($msg->payload)) | ||
1235 | { | ||
1236 | $msg->createPayload($this->request_charset_encoding); | ||
1237 | } | ||
1238 | |||
1239 | $payload = $msg->payload; | ||
1240 | // Deflate request body and set appropriate request headers | ||
1241 | if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) | ||
1242 | { | ||
1243 | if($this->request_compression == 'gzip') | ||
1244 | { | ||
1245 | $a = @gzencode($payload); | ||
1246 | if($a) | ||
1247 | { | ||
1248 | $payload = $a; | ||
1249 | $encoding_hdr = "Content-Encoding: gzip\r\n"; | ||
1250 | } | ||
1251 | } | ||
1252 | else | ||
1253 | { | ||
1254 | $a = @gzcompress($payload); | ||
1255 | if($a) | ||
1256 | { | ||
1257 | $payload = $a; | ||
1258 | $encoding_hdr = "Content-Encoding: deflate\r\n"; | ||
1259 | } | ||
1260 | } | ||
1261 | } | ||
1262 | else | ||
1263 | { | ||
1264 | $encoding_hdr = ''; | ||
1265 | } | ||
1266 | |||
1267 | // thanks to Grant Rauscher <grant7@firstworld.net> for this | ||
1268 | $credentials=''; | ||
1269 | if($username!='') | ||
1270 | { | ||
1271 | $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; | ||
1272 | if ($authtype != 1) | ||
1273 | { | ||
1274 | error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported with HTTP 1.0'); | ||
1275 | } | ||
1276 | } | ||
1277 | |||
1278 | $accepted_encoding = ''; | ||
1279 | if(is_array($this->accepted_compression) && count($this->accepted_compression)) | ||
1280 | { | ||
1281 | $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; | ||
1282 | } | ||
1283 | |||
1284 | $proxy_credentials = ''; | ||
1285 | if($proxyhost) | ||
1286 | { | ||
1287 | if($proxyport == 0) | ||
1288 | { | ||
1289 | $proxyport = 8080; | ||
1290 | } | ||
1291 | $connectserver = $proxyhost; | ||
1292 | $connectport = $proxyport; | ||
1293 | $uri = 'http://'.$server.':'.$port.$this->path; | ||
1294 | if($proxyusername != '') | ||
1295 | { | ||
1296 | if ($proxyauthtype != 1) | ||
1297 | { | ||
1298 | error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported with HTTP 1.0'); | ||
1299 | } | ||
1300 | $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n"; | ||
1301 | } | ||
1302 | } | ||
1303 | else | ||
1304 | { | ||
1305 | $connectserver = $server; | ||
1306 | $connectport = $port; | ||
1307 | $uri = $this->path; | ||
1308 | } | ||
1309 | |||
1310 | // Cookie generation, as per rfc2965 (version 1 cookies) or | ||
1311 | // netscape's rules (version 0 cookies) | ||
1312 | $cookieheader=''; | ||
1313 | if (count($this->cookies)) | ||
1314 | { | ||
1315 | $version = ''; | ||
1316 | foreach ($this->cookies as $name => $cookie) | ||
1317 | { | ||
1318 | if ($cookie['version']) | ||
1319 | { | ||
1320 | $version = ' $Version="' . $cookie['version'] . '";'; | ||
1321 | $cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";'; | ||
1322 | if ($cookie['path']) | ||
1323 | $cookieheader .= ' $Path="' . $cookie['path'] . '";'; | ||
1324 | if ($cookie['domain']) | ||
1325 | $cookieheader .= ' $Domain="' . $cookie['domain'] . '";'; | ||
1326 | if ($cookie['port']) | ||
1327 | $cookieheader .= ' $Port="' . $cookie['port'] . '";'; | ||
1328 | } | ||
1329 | else | ||
1330 | { | ||
1331 | $cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";"; | ||
1332 | } | ||
1333 | } | ||
1334 | $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n"; | ||
1335 | } | ||
1336 | |||
1337 | $op= 'POST ' . $uri. " HTTP/1.0\r\n" . | ||
1338 | 'User-Agent: ' . $GLOBALS['xmlrpcName'] . ' ' . $GLOBALS['xmlrpcVersion'] . "\r\n" . | ||
1339 | 'Host: '. $server . ':' . $port . "\r\n" . | ||
1340 | $credentials . | ||
1341 | $proxy_credentials . | ||
1342 | $accepted_encoding . | ||
1343 | $encoding_hdr . | ||
1344 | 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . | ||
1345 | $cookieheader . | ||
1346 | 'Content-Type: ' . $msg->content_type . "\r\nContent-Length: " . | ||
1347 | strlen($payload) . "\r\n\r\n" . | ||
1348 | $payload; | ||
1349 | |||
1350 | if($this->debug > 1) | ||
1351 | { | ||
1352 | print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>"; | ||
1353 | // let the client see this now in case http times out... | ||
1354 | flush(); | ||
1355 | } | ||
1356 | |||
1357 | if($timeout>0) | ||
1358 | { | ||
1359 | $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout); | ||
1360 | } | ||
1361 | else | ||
1362 | { | ||
1363 | $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr); | ||
1364 | } | ||
1365 | if($fp) | ||
1366 | { | ||
1367 | if($timeout>0 && function_exists('stream_set_timeout')) | ||
1368 | { | ||
1369 | stream_set_timeout($fp, $timeout); | ||
1370 | } | ||
1371 | } | ||
1372 | else | ||
1373 | { | ||
1374 | $this->errstr='Connect error: '.$this->errstr; | ||
1375 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')'); | ||
1376 | return $r; | ||
1377 | } | ||
1378 | |||
1379 | if(!fputs($fp, $op, strlen($op))) | ||
1380 | { | ||
1381 | $this->errstr='Write error'; | ||
1382 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr); | ||
1383 | return $r; | ||
1384 | } | ||
1385 | else | ||
1386 | { | ||
1387 | // reset errno and errstr on succesful socket connection | ||
1388 | $this->errstr = ''; | ||
1389 | } | ||
1390 | // G. Giunta 2005/10/24: close socket before parsing. | ||
1391 | // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects) | ||
1392 | $ipd=''; | ||
1393 | while($data=fread($fp, 32768)) | ||
1394 | { | ||
1395 | // shall we check for $data === FALSE? | ||
1396 | // as per the manual, it signals an error | ||
1397 | $ipd.=$data; | ||
1398 | } | ||
1399 | fclose($fp); | ||
1400 | $r =& $msg->parseResponse($ipd, false, $this->return_type); | ||
1401 | return $r; | ||
1402 | |||
1403 | } | ||
1404 | |||
1405 | /** | ||
1406 | * @access private | ||
1407 | */ | ||
1408 | function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='', | ||
1409 | $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='', | ||
1410 | $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, | ||
1411 | $keepalive=false, $key='', $keypass='') | ||
1412 | { | ||
1413 | $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username, | ||
1414 | $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport, | ||
1415 | $proxyusername, $proxypassword, $proxyauthtype, 'https', $keepalive, $key, $keypass); | ||
1416 | return $r; | ||
1417 | } | ||
1418 | |||
1419 | /** | ||
1420 | * Contributed by Justin Miller <justin@voxel.net> | ||
1421 | * Requires curl to be built into PHP | ||
1422 | * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers! | ||
1423 | * @access private | ||
1424 | */ | ||
1425 | function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', | ||
1426 | $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='', | ||
1427 | $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https', | ||
1428 | $keepalive=false, $key='', $keypass='') | ||
1429 | { | ||
1430 | if(!function_exists('curl_init')) | ||
1431 | { | ||
1432 | $this->errstr='CURL unavailable on this install'; | ||
1433 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']); | ||
1434 | return $r; | ||
1435 | } | ||
1436 | if($method == 'https') | ||
1437 | { | ||
1438 | if(($info = curl_version()) && | ||
1439 | ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version'])))) | ||
1440 | { | ||
1441 | $this->errstr='SSL unavailable on this install'; | ||
1442 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']); | ||
1443 | return $r; | ||
1444 | } | ||
1445 | } | ||
1446 | |||
1447 | if($port == 0) | ||
1448 | { | ||
1449 | if($method == 'http') | ||
1450 | { | ||
1451 | $port = 80; | ||
1452 | } | ||
1453 | else | ||
1454 | { | ||
1455 | $port = 443; | ||
1456 | } | ||
1457 | } | ||
1458 | |||
1459 | // Only create the payload if it was not created previously | ||
1460 | if(empty($msg->payload)) | ||
1461 | { | ||
1462 | $msg->createPayload($this->request_charset_encoding); | ||
1463 | } | ||
1464 | |||
1465 | // Deflate request body and set appropriate request headers | ||
1466 | $payload = $msg->payload; | ||
1467 | if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) | ||
1468 | { | ||
1469 | if($this->request_compression == 'gzip') | ||
1470 | { | ||
1471 | $a = @gzencode($payload); | ||
1472 | if($a) | ||
1473 | { | ||
1474 | $payload = $a; | ||
1475 | $encoding_hdr = 'Content-Encoding: gzip'; | ||
1476 | } | ||
1477 | } | ||
1478 | else | ||
1479 | { | ||
1480 | $a = @gzcompress($payload); | ||
1481 | if($a) | ||
1482 | { | ||
1483 | $payload = $a; | ||
1484 | $encoding_hdr = 'Content-Encoding: deflate'; | ||
1485 | } | ||
1486 | } | ||
1487 | } | ||
1488 | else | ||
1489 | { | ||
1490 | $encoding_hdr = ''; | ||
1491 | } | ||
1492 | |||
1493 | if($this->debug > 1) | ||
1494 | { | ||
1495 | print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>"; | ||
1496 | // let the client see this now in case http times out... | ||
1497 | flush(); | ||
1498 | } | ||
1499 | |||
1500 | if(!$keepalive || !$this->xmlrpc_curl_handle) | ||
1501 | { | ||
1502 | $curl = curl_init($method . '://' . $server . ':' . $port . $this->path); | ||
1503 | if($keepalive) | ||
1504 | { | ||
1505 | $this->xmlrpc_curl_handle = $curl; | ||
1506 | } | ||
1507 | } | ||
1508 | else | ||
1509 | { | ||
1510 | $curl = $this->xmlrpc_curl_handle; | ||
1511 | } | ||
1512 | |||
1513 | // results into variable | ||
1514 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | ||
1515 | |||
1516 | if($this->debug) | ||
1517 | { | ||
1518 | curl_setopt($curl, CURLOPT_VERBOSE, 1); | ||
1519 | } | ||
1520 | curl_setopt($curl, CURLOPT_USERAGENT, $GLOBALS['xmlrpcName'].' '.$GLOBALS['xmlrpcVersion']); | ||
1521 | // required for XMLRPC: post the data | ||
1522 | curl_setopt($curl, CURLOPT_POST, 1); | ||
1523 | // the data | ||
1524 | curl_setopt($curl, CURLOPT_POSTFIELDS, $payload); | ||
1525 | |||
1526 | // return the header too | ||
1527 | curl_setopt($curl, CURLOPT_HEADER, 1); | ||
1528 | |||
1529 | // will only work with PHP >= 5.0 | ||
1530 | // NB: if we set an empty string, CURL will add http header indicating | ||
1531 | // ALL methods it is supporting. This is possibly a better option than | ||
1532 | // letting the user tell what curl can / cannot do... | ||
1533 | if(is_array($this->accepted_compression) && count($this->accepted_compression)) | ||
1534 | { | ||
1535 | //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression)); | ||
1536 | // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?) | ||
1537 | if (count($this->accepted_compression) == 1) | ||
1538 | { | ||
1539 | curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]); | ||
1540 | } | ||
1541 | else | ||
1542 | curl_setopt($curl, CURLOPT_ENCODING, ''); | ||
1543 | } | ||
1544 | // extra headers | ||
1545 | $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); | ||
1546 | // if no keepalive is wanted, let the server know it in advance | ||
1547 | if(!$keepalive) | ||
1548 | { | ||
1549 | $headers[] = 'Connection: close'; | ||
1550 | } | ||
1551 | // request compression header | ||
1552 | if($encoding_hdr) | ||
1553 | { | ||
1554 | $headers[] = $encoding_hdr; | ||
1555 | } | ||
1556 | |||
1557 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); | ||
1558 | // timeout is borked | ||
1559 | if($timeout) | ||
1560 | { | ||
1561 | curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); | ||
1562 | } | ||
1563 | |||
1564 | if($username && $password) | ||
1565 | { | ||
1566 | curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); | ||
1567 | if (defined('CURLOPT_HTTPAUTH')) | ||
1568 | { | ||
1569 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype); | ||
1570 | } | ||
1571 | else if ($authtype != 1) | ||
1572 | { | ||
1573 | error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth is supported by the current PHP/curl install'); | ||
1574 | } | ||
1575 | } | ||
1576 | |||
1577 | if($method == 'https') | ||
1578 | { | ||
1579 | // set cert file | ||
1580 | if($cert) | ||
1581 | { | ||
1582 | curl_setopt($curl, CURLOPT_SSLCERT, $cert); | ||
1583 | } | ||
1584 | // set cert password | ||
1585 | if($certpass) | ||
1586 | { | ||
1587 | curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass); | ||
1588 | } | ||
1589 | // whether to verify remote host's cert | ||
1590 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer); | ||
1591 | // set ca certificates file/dir | ||
1592 | if($cacert) | ||
1593 | { | ||
1594 | curl_setopt($curl, CURLOPT_CAINFO, $cacert); | ||
1595 | } | ||
1596 | if($cacertdir) | ||
1597 | { | ||
1598 | curl_setopt($curl, CURLOPT_CAPATH, $cacertdir); | ||
1599 | } | ||
1600 | // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?) | ||
1601 | if($key) | ||
1602 | { | ||
1603 | curl_setopt($curl, CURLOPT_SSLKEY, $key); | ||
1604 | } | ||
1605 | // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?) | ||
1606 | if($keypass) | ||
1607 | { | ||
1608 | curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass); | ||
1609 | } | ||
1610 | // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used | ||
1611 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, $this->verifyhost); | ||
1612 | } | ||
1613 | |||
1614 | // proxy info | ||
1615 | if($proxyhost) | ||
1616 | { | ||
1617 | if($proxyport == 0) | ||
1618 | { | ||
1619 | $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080 | ||
1620 | } | ||
1621 | curl_setopt($curl, CURLOPT_PROXY, $proxyhost.':'.$proxyport); | ||
1622 | //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport); | ||
1623 | if($proxyusername) | ||
1624 | { | ||
1625 | curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword); | ||
1626 | if (defined('CURLOPT_PROXYAUTH')) | ||
1627 | { | ||
1628 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype); | ||
1629 | } | ||
1630 | else if ($proxyauthtype != 1) | ||
1631 | { | ||
1632 | error_log('XML-RPC: xmlrpc_client::send: warning. Only Basic auth to proxy is supported by the current PHP/curl install'); | ||
1633 | } | ||
1634 | } | ||
1635 | } | ||
1636 | |||
1637 | // NB: should we build cookie http headers by hand rather than let CURL do it? | ||
1638 | // the following code does not honour 'expires', 'path' and 'domain' cookie attributes | ||
1639 | // set to client obj the the user... | ||
1640 | if (count($this->cookies)) | ||
1641 | { | ||
1642 | $cookieheader = ''; | ||
1643 | foreach ($this->cookies as $name => $cookie) | ||
1644 | { | ||
1645 | $cookieheader .= $name . '=' . $cookie['value'] . '; '; | ||
1646 | } | ||
1647 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2)); | ||
1648 | } | ||
1649 | |||
1650 | $result = curl_exec($curl); | ||
1651 | |||
1652 | if ($this->debug > 1) | ||
1653 | { | ||
1654 | print "<PRE>\n---CURL INFO---\n"; | ||
1655 | foreach(curl_getinfo($curl) as $name => $val) | ||
1656 | print $name . ': ' . htmlentities($val). "\n"; | ||
1657 | print "---END---\n</PRE>"; | ||
1658 | } | ||
1659 | |||
1660 | if(!$result) /// @todo we should use a better check here - what if we get back '' or '0'? | ||
1661 | { | ||
1662 | $this->errstr='no response'; | ||
1663 | $resp=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl)); | ||
1664 | curl_close($curl); | ||
1665 | if($keepalive) | ||
1666 | { | ||
1667 | $this->xmlrpc_curl_handle = null; | ||
1668 | } | ||
1669 | } | ||
1670 | else | ||
1671 | { | ||
1672 | if(!$keepalive) | ||
1673 | { | ||
1674 | curl_close($curl); | ||
1675 | } | ||
1676 | $resp =& $msg->parseResponse($result, true, $this->return_type); | ||
1677 | } | ||
1678 | return $resp; | ||
1679 | } | ||
1680 | |||
1681 | /** | ||
1682 | * Send an array of request messages and return an array of responses. | ||
1683 | * Unless $this->no_multicall has been set to true, it will try first | ||
1684 | * to use one single xmlrpc call to server method system.multicall, and | ||
1685 | * revert to sending many successive calls in case of failure. | ||
1686 | * This failure is also stored in $this->no_multicall for subsequent calls. | ||
1687 | * Unfortunately, there is no server error code universally used to denote | ||
1688 | * the fact that multicall is unsupported, so there is no way to reliably | ||
1689 | * distinguish between that and a temporary failure. | ||
1690 | * If you are sure that server supports multicall and do not want to | ||
1691 | * fallback to using many single calls, set the fourth parameter to FALSE. | ||
1692 | * | ||
1693 | * NB: trying to shoehorn extra functionality into existing syntax has resulted | ||
1694 | * in pretty much convoluted code... | ||
1695 | * | ||
1696 | * @param array $msgs an array of xmlrpcmsg objects | ||
1697 | * @param integer $timeout connection timeout (in seconds) | ||
1698 | * @param string $method the http protocol variant to be used | ||
1699 | * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted | ||
1700 | * @return array | ||
1701 | * @access public | ||
1702 | */ | ||
1703 | function multicall($msgs, $timeout=0, $method='', $fallback=true) | ||
1704 | { | ||
1705 | if ($method == '') | ||
1706 | { | ||
1707 | $method = $this->method; | ||
1708 | } | ||
1709 | if(!$this->no_multicall) | ||
1710 | { | ||
1711 | $results = $this->_try_multicall($msgs, $timeout, $method); | ||
1712 | if(is_array($results)) | ||
1713 | { | ||
1714 | // System.multicall succeeded | ||
1715 | return $results; | ||
1716 | } | ||
1717 | else | ||
1718 | { | ||
1719 | // either system.multicall is unsupported by server, | ||
1720 | // or call failed for some other reason. | ||
1721 | if ($fallback) | ||
1722 | { | ||
1723 | // Don't try it next time... | ||
1724 | $this->no_multicall = true; | ||
1725 | } | ||
1726 | else | ||
1727 | { | ||
1728 | if (is_a($results, 'xmlrpcresp')) | ||
1729 | { | ||
1730 | $result = $results; | ||
1731 | } | ||
1732 | else | ||
1733 | { | ||
1734 | $result =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']); | ||
1735 | } | ||
1736 | } | ||
1737 | } | ||
1738 | } | ||
1739 | else | ||
1740 | { | ||
1741 | // override fallback, in case careless user tries to do two | ||
1742 | // opposite things at the same time | ||
1743 | $fallback = true; | ||
1744 | } | ||
1745 | |||
1746 | $results = array(); | ||
1747 | if ($fallback) | ||
1748 | { | ||
1749 | // system.multicall is (probably) unsupported by server: | ||
1750 | // emulate multicall via multiple requests | ||
1751 | foreach($msgs as $msg) | ||
1752 | { | ||
1753 | $results[] =& $this->send($msg, $timeout, $method); | ||
1754 | } | ||
1755 | } | ||
1756 | else | ||
1757 | { | ||
1758 | // user does NOT want to fallback on many single calls: | ||
1759 | // since we should always return an array of responses, | ||
1760 | // return an array with the same error repeated n times | ||
1761 | foreach($msgs as $msg) | ||
1762 | { | ||
1763 | $results[] = $result; | ||
1764 | } | ||
1765 | } | ||
1766 | return $results; | ||
1767 | } | ||
1768 | |||
1769 | /** | ||
1770 | * Attempt to boxcar $msgs via system.multicall. | ||
1771 | * Returns either an array of xmlrpcreponses, an xmlrpc error response | ||
1772 | * or false (when received response does not respect valid multicall syntax) | ||
1773 | * @access private | ||
1774 | */ | ||
1775 | function _try_multicall($msgs, $timeout, $method) | ||
1776 | { | ||
1777 | // Construct multicall message | ||
1778 | $calls = array(); | ||
1779 | foreach($msgs as $msg) | ||
1780 | { | ||
1781 | $call['methodName'] =& new xmlrpcval($msg->method(),'string'); | ||
1782 | $numParams = $msg->getNumParams(); | ||
1783 | $params = array(); | ||
1784 | for($i = 0; $i < $numParams; $i++) | ||
1785 | { | ||
1786 | $params[$i] = $msg->getParam($i); | ||
1787 | } | ||
1788 | $call['params'] =& new xmlrpcval($params, 'array'); | ||
1789 | $calls[] =& new xmlrpcval($call, 'struct'); | ||
1790 | } | ||
1791 | $multicall =& new xmlrpcmsg('system.multicall'); | ||
1792 | $multicall->addParam(new xmlrpcval($calls, 'array')); | ||
1793 | |||
1794 | // Attempt RPC call | ||
1795 | $result =& $this->send($multicall, $timeout, $method); | ||
1796 | |||
1797 | if($result->faultCode() != 0) | ||
1798 | { | ||
1799 | // call to system.multicall failed | ||
1800 | return $result; | ||
1801 | } | ||
1802 | |||
1803 | // Unpack responses. | ||
1804 | $rets = $result->value(); | ||
1805 | |||
1806 | if ($this->return_type == 'xml') | ||
1807 | { | ||
1808 | return $rets; | ||
1809 | } | ||
1810 | else if ($this->return_type == 'phpvals') | ||
1811 | { | ||
1812 | ///@todo test this code branch... | ||
1813 | $rets = $result->value(); | ||
1814 | if(!is_array($rets)) | ||
1815 | { | ||
1816 | return false; // bad return type from system.multicall | ||
1817 | } | ||
1818 | $numRets = count($rets); | ||
1819 | if($numRets != count($msgs)) | ||
1820 | { | ||
1821 | return false; // wrong number of return values. | ||
1822 | } | ||
1823 | |||
1824 | $response = array(); | ||
1825 | for($i = 0; $i < $numRets; $i++) | ||
1826 | { | ||
1827 | $val = $rets[$i]; | ||
1828 | if (!is_array($val)) { | ||
1829 | return false; | ||
1830 | } | ||
1831 | switch(count($val)) | ||
1832 | { | ||
1833 | case 1: | ||
1834 | if(!isset($val[0])) | ||
1835 | { | ||
1836 | return false; // Bad value | ||
1837 | } | ||
1838 | // Normal return value | ||
1839 | $response[$i] =& new xmlrpcresp($val[0], 0, '', 'phpvals'); | ||
1840 | break; | ||
1841 | case 2: | ||
1842 | /// @todo remove usage of @: it is apparently quite slow | ||
1843 | $code = @$val['faultCode']; | ||
1844 | if(!is_int($code)) | ||
1845 | { | ||
1846 | return false; | ||
1847 | } | ||
1848 | $str = @$val['faultString']; | ||
1849 | if(!is_string($str)) | ||
1850 | { | ||
1851 | return false; | ||
1852 | } | ||
1853 | $response[$i] =& new xmlrpcresp(0, $code, $str); | ||
1854 | break; | ||
1855 | default: | ||
1856 | return false; | ||
1857 | } | ||
1858 | } | ||
1859 | return $response; | ||
1860 | } | ||
1861 | else // return type == 'xmlrpcvals' | ||
1862 | { | ||
1863 | $rets = $result->value(); | ||
1864 | if($rets->kindOf() != 'array') | ||
1865 | { | ||
1866 | return false; // bad return type from system.multicall | ||
1867 | } | ||
1868 | $numRets = $rets->arraysize(); | ||
1869 | if($numRets != count($msgs)) | ||
1870 | { | ||
1871 | return false; // wrong number of return values. | ||
1872 | } | ||
1873 | |||
1874 | $response = array(); | ||
1875 | for($i = 0; $i < $numRets; $i++) | ||
1876 | { | ||
1877 | $val = $rets->arraymem($i); | ||
1878 | switch($val->kindOf()) | ||
1879 | { | ||
1880 | case 'array': | ||
1881 | if($val->arraysize() != 1) | ||
1882 | { | ||
1883 | return false; // Bad value | ||
1884 | } | ||
1885 | // Normal return value | ||
1886 | $response[$i] =& new xmlrpcresp($val->arraymem(0)); | ||
1887 | break; | ||
1888 | case 'struct': | ||
1889 | $code = $val->structmem('faultCode'); | ||
1890 | if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') | ||
1891 | { | ||
1892 | return false; | ||
1893 | } | ||
1894 | $str = $val->structmem('faultString'); | ||
1895 | if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') | ||
1896 | { | ||
1897 | return false; | ||
1898 | } | ||
1899 | $response[$i] =& new xmlrpcresp(0, $code->scalarval(), $str->scalarval()); | ||
1900 | break; | ||
1901 | default: | ||
1902 | return false; | ||
1903 | } | ||
1904 | } | ||
1905 | return $response; | ||
1906 | } | ||
1907 | } | ||
1908 | } // end class xmlrpc_client | ||
1909 | |||
1910 | class xmlrpcresp | ||
1911 | { | ||
1912 | var $val = 0; | ||
1913 | var $valtyp; | ||
1914 | var $errno = 0; | ||
1915 | var $errstr = ''; | ||
1916 | var $payload; | ||
1917 | var $hdrs = array(); | ||
1918 | var $_cookies = array(); | ||
1919 | var $content_type = 'text/xml'; | ||
1920 | var $raw_data = ''; | ||
1921 | |||
1922 | /** | ||
1923 | * @param mixed $val either an xmlrpcval obj, a php value or the xml serialization of an xmlrpcval (a string) | ||
1924 | * @param integer $fcode set it to anything but 0 to create an error response | ||
1925 | * @param string $fstr the error string, in case of an error response | ||
1926 | * @param string $valtyp either 'xmlrpcvals', 'phpvals' or 'xml' | ||
1927 | * | ||
1928 | * @todo add check that $val / $fcode / $fstr is of correct type??? | ||
1929 | * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain | ||
1930 | * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called... | ||
1931 | */ | ||
1932 | function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp='') | ||
1933 | { | ||
1934 | if($fcode != 0) | ||
1935 | { | ||
1936 | // error response | ||
1937 | $this->errno = $fcode; | ||
1938 | $this->errstr = $fstr; | ||
1939 | //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later. | ||
1940 | } | ||
1941 | else | ||
1942 | { | ||
1943 | // successful response | ||
1944 | $this->val = $val; | ||
1945 | if ($valtyp == '') | ||
1946 | { | ||
1947 | // user did not declare type of response value: try to guess it | ||
1948 | if (is_object($this->val) && is_a($this->val, 'xmlrpcval')) | ||
1949 | { | ||
1950 | $this->valtyp = 'xmlrpcvals'; | ||
1951 | } | ||
1952 | else if (is_string($this->val)) | ||
1953 | { | ||
1954 | $this->valtyp = 'xml'; | ||
1955 | |||
1956 | } | ||
1957 | else | ||
1958 | { | ||
1959 | $this->valtyp = 'phpvals'; | ||
1960 | } | ||
1961 | } | ||
1962 | else | ||
1963 | { | ||
1964 | // user declares type of resp value: believe him | ||
1965 | $this->valtyp = $valtyp; | ||
1966 | } | ||
1967 | } | ||
1968 | } | ||
1969 | |||
1970 | /** | ||
1971 | * Returns the error code of the response. | ||
1972 | * @return integer the error code of this response (0 for not-error responses) | ||
1973 | * @access public | ||
1974 | */ | ||
1975 | function faultCode() | ||
1976 | { | ||
1977 | return $this->errno; | ||
1978 | } | ||
1979 | |||
1980 | /** | ||
1981 | * Returns the error code of the response. | ||
1982 | * @return string the error string of this response ('' for not-error responses) | ||
1983 | * @access public | ||
1984 | */ | ||
1985 | function faultString() | ||
1986 | { | ||
1987 | return $this->errstr; | ||
1988 | } | ||
1989 | |||
1990 | /** | ||
1991 | * Returns the value received by the server. | ||
1992 | * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects | ||
1993 | * @access public | ||
1994 | */ | ||
1995 | function value() | ||
1996 | { | ||
1997 | return $this->val; | ||
1998 | } | ||
1999 | |||
2000 | /** | ||
2001 | * Returns an array with the cookies received from the server. | ||
2002 | * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...) | ||
2003 | * with attributes being e.g. 'expires', 'path', domain'. | ||
2004 | * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past) | ||
2005 | * are still present in the array. It is up to the user-defined code to decide | ||
2006 | * how to use the received cookies, and wheter they have to be sent back with the next | ||
2007 | * request to the server (using xmlrpc_client::setCookie) or not | ||
2008 | * @return array array of cookies received from the server | ||
2009 | * @access public | ||
2010 | */ | ||
2011 | function cookies() | ||
2012 | { | ||
2013 | return $this->_cookies; | ||
2014 | } | ||
2015 | |||
2016 | /** | ||
2017 | * Returns xml representation of the response. XML prologue not included | ||
2018 | * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed | ||
2019 | * @return string the xml representation of the response | ||
2020 | * @access public | ||
2021 | */ | ||
2022 | function serialize($charset_encoding='') | ||
2023 | { | ||
2024 | if ($charset_encoding != '') | ||
2025 | $this->content_type = 'text/xml; charset=' . $charset_encoding; | ||
2026 | else | ||
2027 | $this->content_type = 'text/xml'; | ||
2028 | $result = "<methodResponse>\n"; | ||
2029 | if($this->errno) | ||
2030 | { | ||
2031 | // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients | ||
2032 | // by xml-encoding non ascii chars | ||
2033 | $result .= "<fault>\n" . | ||
2034 | "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . | ||
2035 | "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . | ||
2036 | xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" . | ||
2037 | "</struct>\n</value>\n</fault>"; | ||
2038 | } | ||
2039 | else | ||
2040 | { | ||
2041 | if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval')) | ||
2042 | { | ||
2043 | if (is_string($this->val) && $this->valtyp == 'xml') | ||
2044 | { | ||
2045 | $result .= "<params>\n<param>\n" . | ||
2046 | $this->val . | ||
2047 | "</param>\n</params>"; | ||
2048 | } | ||
2049 | else | ||
2050 | { | ||
2051 | /// @todo try to build something serializable? | ||
2052 | die('cannot serialize xmlrpcresp objects whose content is native php values'); | ||
2053 | } | ||
2054 | } | ||
2055 | else | ||
2056 | { | ||
2057 | $result .= "<params>\n<param>\n" . | ||
2058 | $this->val->serialize($charset_encoding) . | ||
2059 | "</param>\n</params>"; | ||
2060 | } | ||
2061 | } | ||
2062 | $result .= "\n</methodResponse>"; | ||
2063 | $this->payload = $result; | ||
2064 | return $result; | ||
2065 | } | ||
2066 | } | ||
2067 | |||
2068 | class xmlrpcmsg | ||
2069 | { | ||
2070 | var $payload; | ||
2071 | var $methodname; | ||
2072 | var $params=array(); | ||
2073 | var $debug=0; | ||
2074 | var $content_type = 'text/xml'; | ||
2075 | |||
2076 | /** | ||
2077 | * @param string $meth the name of the method to invoke | ||
2078 | * @param array $pars array of parameters to be paased to the method (xmlrpcval objects) | ||
2079 | */ | ||
2080 | function xmlrpcmsg($meth, $pars=0) | ||
2081 | { | ||
2082 | $this->methodname=$meth; | ||
2083 | if(is_array($pars) && count($pars)>0) | ||
2084 | { | ||
2085 | for($i=0; $i<count($pars); $i++) | ||
2086 | { | ||
2087 | $this->addParam($pars[$i]); | ||
2088 | } | ||
2089 | } | ||
2090 | } | ||
2091 | |||
2092 | /** | ||
2093 | * @access private | ||
2094 | */ | ||
2095 | function xml_header($charset_encoding='') | ||
2096 | { | ||
2097 | if ($charset_encoding != '') | ||
2098 | { | ||
2099 | return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n"; | ||
2100 | } | ||
2101 | else | ||
2102 | { | ||
2103 | return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n"; | ||
2104 | } | ||
2105 | } | ||
2106 | |||
2107 | /** | ||
2108 | * @access private | ||
2109 | */ | ||
2110 | function xml_footer() | ||
2111 | { | ||
2112 | return '</methodCall>'; | ||
2113 | } | ||
2114 | |||
2115 | /** | ||
2116 | * @access private | ||
2117 | */ | ||
2118 | function kindOf() | ||
2119 | { | ||
2120 | return 'msg'; | ||
2121 | } | ||
2122 | |||
2123 | /** | ||
2124 | * @access private | ||
2125 | */ | ||
2126 | function createPayload($charset_encoding='') | ||
2127 | { | ||
2128 | if ($charset_encoding != '') | ||
2129 | $this->content_type = 'text/xml; charset=' . $charset_encoding; | ||
2130 | else | ||
2131 | $this->content_type = 'text/xml'; | ||
2132 | $this->payload=$this->xml_header($charset_encoding); | ||
2133 | $this->payload.='<methodName>' . $this->methodname . "</methodName>\n"; | ||
2134 | $this->payload.="<params>\n"; | ||
2135 | for($i=0; $i<count($this->params); $i++) | ||
2136 | { | ||
2137 | $p=$this->params[$i]; | ||
2138 | $this->payload.="<param>\n" . $p->serialize($charset_encoding) . | ||
2139 | "</param>\n"; | ||
2140 | } | ||
2141 | $this->payload.="</params>\n"; | ||
2142 | $this->payload.=$this->xml_footer(); | ||
2143 | } | ||
2144 | |||
2145 | /** | ||
2146 | * Gets/sets the xmlrpc method to be invoked | ||
2147 | * @param string $meth the method to be set (leave empty not to set it) | ||
2148 | * @return string the method that will be invoked | ||
2149 | * @access public | ||
2150 | */ | ||
2151 | function method($meth='') | ||
2152 | { | ||
2153 | if($meth!='') | ||
2154 | { | ||
2155 | $this->methodname=$meth; | ||
2156 | } | ||
2157 | return $this->methodname; | ||
2158 | } | ||
2159 | |||
2160 | /** | ||
2161 | * Returns xml representation of the message. XML prologue included | ||
2162 | * @return string the xml representation of the message, xml prologue included | ||
2163 | * @access public | ||
2164 | */ | ||
2165 | function serialize($charset_encoding='') | ||
2166 | { | ||
2167 | $this->createPayload($charset_encoding); | ||
2168 | return $this->payload; | ||
2169 | } | ||
2170 | |||
2171 | /** | ||
2172 | * Add a parameter to the list of parameters to be used upon method invocation | ||
2173 | * @param xmlrpcval $par | ||
2174 | * @return boolean false on failure | ||
2175 | * @access public | ||
2176 | */ | ||
2177 | function addParam($par) | ||
2178 | { | ||
2179 | // add check: do not add to self params which are not xmlrpcvals | ||
2180 | if(is_object($par) && is_a($par, 'xmlrpcval')) | ||
2181 | { | ||
2182 | $this->params[]=$par; | ||
2183 | return true; | ||
2184 | } | ||
2185 | else | ||
2186 | { | ||
2187 | return false; | ||
2188 | } | ||
2189 | } | ||
2190 | |||
2191 | /** | ||
2192 | * Returns the nth parameter in the message. The index zero-based. | ||
2193 | * @param integer $i the index of the parameter to fetch (zero based) | ||
2194 | * @return xmlrpcval the i-th parameter | ||
2195 | * @access public | ||
2196 | */ | ||
2197 | function getParam($i) { return $this->params[$i]; } | ||
2198 | |||
2199 | /** | ||
2200 | * Returns the number of parameters in the messge. | ||
2201 | * @return integer the number of parameters currently set | ||
2202 | * @access public | ||
2203 | */ | ||
2204 | function getNumParams() { return count($this->params); } | ||
2205 | |||
2206 | /** | ||
2207 | * Given an open file handle, read all data available and parse it as axmlrpc response. | ||
2208 | * NB: the file handle is not closed by this function. | ||
2209 | * @access public | ||
2210 | * @return xmlrpcresp | ||
2211 | * @todo add 2nd & 3rd param to be passed to ParseResponse() ??? | ||
2212 | */ | ||
2213 | function &parseResponseFile($fp) | ||
2214 | { | ||
2215 | $ipd=''; | ||
2216 | while($data=fread($fp, 32768)) | ||
2217 | { | ||
2218 | $ipd.=$data; | ||
2219 | } | ||
2220 | //fclose($fp); | ||
2221 | $r =& $this->parseResponse($ipd); | ||
2222 | return $r; | ||
2223 | } | ||
2224 | |||
2225 | /** | ||
2226 | * Parses HTTP headers and separates them from data. | ||
2227 | * @access private | ||
2228 | */ | ||
2229 | function &parseResponseHeaders(&$data, $headers_processed=false) | ||
2230 | { | ||
2231 | // Support "web-proxy-tunelling" connections for https through proxies | ||
2232 | if(preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data)) | ||
2233 | { | ||
2234 | // Look for CR/LF or simple LF as line separator, | ||
2235 | // (even though it is not valid http) | ||
2236 | $pos = strpos($data,"\r\n\r\n"); | ||
2237 | if($pos || is_int($pos)) | ||
2238 | { | ||
2239 | $bd = $pos+4; | ||
2240 | } | ||
2241 | else | ||
2242 | { | ||
2243 | $pos = strpos($data,"\n\n"); | ||
2244 | if($pos || is_int($pos)) | ||
2245 | { | ||
2246 | $bd = $pos+2; | ||
2247 | } | ||
2248 | else | ||
2249 | { | ||
2250 | // No separation between response headers and body: fault? | ||
2251 | $bd = 0; | ||
2252 | } | ||
2253 | } | ||
2254 | if ($bd) | ||
2255 | { | ||
2256 | // this filters out all http headers from proxy. | ||
2257 | // maybe we could take them into account, too? | ||
2258 | $data = substr($data, $bd); | ||
2259 | } | ||
2260 | else | ||
2261 | { | ||
2262 | error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTPS via proxy error, tunnel connection possibly failed'); | ||
2263 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)'); | ||
2264 | return $r; | ||
2265 | } | ||
2266 | } | ||
2267 | |||
2268 | // Strip HTTP 1.1 100 Continue header if present | ||
2269 | while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data)) | ||
2270 | { | ||
2271 | $pos = strpos($data, 'HTTP', 12); | ||
2272 | // server sent a Continue header without any (valid) content following... | ||
2273 | // give the client a chance to know it | ||
2274 | if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5 | ||
2275 | { | ||
2276 | break; | ||
2277 | } | ||
2278 | $data = substr($data, $pos); | ||
2279 | } | ||
2280 | if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data)) | ||
2281 | { | ||
2282 | $errstr= substr($data, 0, strpos($data, "\n")-1); | ||
2283 | error_log('XML-RPC: xmlrpcmsg::parseResponse: HTTP error, got response: ' .$errstr); | ||
2284 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')'); | ||
2285 | return $r; | ||
2286 | } | ||
2287 | |||
2288 | $GLOBALS['_xh']['headers'] = array(); | ||
2289 | $GLOBALS['_xh']['cookies'] = array(); | ||
2290 | |||
2291 | // be tolerant to usage of \n instead of \r\n to separate headers and data | ||
2292 | // (even though it is not valid http) | ||
2293 | $pos = strpos($data,"\r\n\r\n"); | ||
2294 | if($pos || is_int($pos)) | ||
2295 | { | ||
2296 | $bd = $pos+4; | ||
2297 | } | ||
2298 | else | ||
2299 | { | ||
2300 | $pos = strpos($data,"\n\n"); | ||
2301 | if($pos || is_int($pos)) | ||
2302 | { | ||
2303 | $bd = $pos+2; | ||
2304 | } | ||
2305 | else | ||
2306 | { | ||
2307 | // No separation between response headers and body: fault? | ||
2308 | // we could take some action here instead of going on... | ||
2309 | $bd = 0; | ||
2310 | } | ||
2311 | } | ||
2312 | // be tolerant to line endings, and extra empty lines | ||
2313 | $ar = split("\r?\n", trim(substr($data, 0, $pos))); | ||
2314 | while(list(,$line) = @each($ar)) | ||
2315 | { | ||
2316 | // take care of multi-line headers and cookies | ||
2317 | $arr = explode(':',$line,2); | ||
2318 | if(count($arr) > 1) | ||
2319 | { | ||
2320 | $header_name = strtolower(trim($arr[0])); | ||
2321 | /// @todo some other headers (the ones that allow a CSV list of values) | ||
2322 | /// do allow many values to be passed using multiple header lines. | ||
2323 | /// We should add content to $GLOBALS['_xh']['headers'][$header_name] | ||
2324 | /// instead of replacing it for those... | ||
2325 | if ($header_name == 'set-cookie' || $header_name == 'set-cookie2') | ||
2326 | { | ||
2327 | if ($header_name == 'set-cookie2') | ||
2328 | { | ||
2329 | // version 2 cookies: | ||
2330 | // there could be many cookies on one line, comma separated | ||
2331 | $cookies = explode(',', $arr[1]); | ||
2332 | } | ||
2333 | else | ||
2334 | { | ||
2335 | $cookies = array($arr[1]); | ||
2336 | } | ||
2337 | foreach ($cookies as $cookie) | ||
2338 | { | ||
2339 | // glue together all received cookies, using a comma to separate them | ||
2340 | // (same as php does with getallheaders()) | ||
2341 | if (isset($GLOBALS['_xh']['headers'][$header_name])) | ||
2342 | $GLOBALS['_xh']['headers'][$header_name] .= ', ' . trim($cookie); | ||
2343 | else | ||
2344 | $GLOBALS['_xh']['headers'][$header_name] = trim($cookie); | ||
2345 | // parse cookie attributes, in case user wants to correctly honour them | ||
2346 | // feature creep: only allow rfc-compliant cookie attributes? | ||
2347 | // @todo support for server sending multiple time cookie with same name, but using different PATHs | ||
2348 | $cookie = explode(';', $cookie); | ||
2349 | foreach ($cookie as $pos => $val) | ||
2350 | { | ||
2351 | $val = explode('=', $val, 2); | ||
2352 | $tag = trim($val[0]); | ||
2353 | $val = trim(@$val[1]); | ||
2354 | /// @todo with version 1 cookies, we should strip leading and trailing " chars | ||
2355 | if ($pos == 0) | ||
2356 | { | ||
2357 | $cookiename = $tag; | ||
2358 | $GLOBALS['_xh']['cookies'][$tag] = array(); | ||
2359 | $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val); | ||
2360 | } | ||
2361 | else | ||
2362 | { | ||
2363 | if ($tag != 'value') | ||
2364 | { | ||
2365 | $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val; | ||
2366 | } | ||
2367 | } | ||
2368 | } | ||
2369 | } | ||
2370 | } | ||
2371 | else | ||
2372 | { | ||
2373 | $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]); | ||
2374 | } | ||
2375 | } | ||
2376 | elseif(isset($header_name)) | ||
2377 | { | ||
2378 | /// @todo version1 cookies might span multiple lines, thus breaking the parsing above | ||
2379 | $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line); | ||
2380 | } | ||
2381 | } | ||
2382 | |||
2383 | $data = substr($data, $bd); | ||
2384 | |||
2385 | if($this->debug && count($GLOBALS['_xh']['headers'])) | ||
2386 | { | ||
2387 | print '<PRE>'; | ||
2388 | foreach($GLOBALS['_xh']['headers'] as $header => $value) | ||
2389 | { | ||
2390 | print htmlentities("HEADER: $header: $value\n"); | ||
2391 | } | ||
2392 | foreach($GLOBALS['_xh']['cookies'] as $header => $value) | ||
2393 | { | ||
2394 | print htmlentities("COOKIE: $header={$value['value']}\n"); | ||
2395 | } | ||
2396 | print "</PRE>\n"; | ||
2397 | } | ||
2398 | |||
2399 | // if CURL was used for the call, http headers have been processed, | ||
2400 | // and dechunking + reinflating have been carried out | ||
2401 | if(!$headers_processed) | ||
2402 | { | ||
2403 | // Decode chunked encoding sent by http 1.1 servers | ||
2404 | if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked') | ||
2405 | { | ||
2406 | if(!$data = decode_chunked($data)) | ||
2407 | { | ||
2408 | error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to rebuild the chunked data received from server'); | ||
2409 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']); | ||
2410 | return $r; | ||
2411 | } | ||
2412 | } | ||
2413 | |||
2414 | // Decode gzip-compressed stuff | ||
2415 | // code shamelessly inspired from nusoap library by Dietrich Ayala | ||
2416 | if(isset($GLOBALS['_xh']['headers']['content-encoding'])) | ||
2417 | { | ||
2418 | $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']); | ||
2419 | if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip') | ||
2420 | { | ||
2421 | // if decoding works, use it. else assume data wasn't gzencoded | ||
2422 | if(function_exists('gzinflate')) | ||
2423 | { | ||
2424 | if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) | ||
2425 | { | ||
2426 | $data = $degzdata; | ||
2427 | if($this->debug) | ||
2428 | print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>"; | ||
2429 | } | ||
2430 | elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) | ||
2431 | { | ||
2432 | $data = $degzdata; | ||
2433 | if($this->debug) | ||
2434 | print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>"; | ||
2435 | } | ||
2436 | else | ||
2437 | { | ||
2438 | error_log('XML-RPC: xmlrpcmsg::parseResponse: errors occurred when trying to decode the deflated data received from server'); | ||
2439 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']); | ||
2440 | return $r; | ||
2441 | } | ||
2442 | } | ||
2443 | else | ||
2444 | { | ||
2445 | error_log('XML-RPC: xmlrpcmsg::parseResponse: the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); | ||
2446 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']); | ||
2447 | return $r; | ||
2448 | } | ||
2449 | } | ||
2450 | } | ||
2451 | } // end of 'if needed, de-chunk, re-inflate response' | ||
2452 | |||
2453 | // real stupid hack to avoid PHP 4 complaining about returning NULL by ref | ||
2454 | $r = null; | ||
2455 | $r =& $r; | ||
2456 | return $r; | ||
2457 | } | ||
2458 | |||
2459 | /** | ||
2460 | * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object. | ||
2461 | * @param string $data the xmlrpc response, eventually including http headers | ||
2462 | * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding | ||
2463 | * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals' | ||
2464 | * @return xmlrpcresp | ||
2465 | * @access public | ||
2466 | */ | ||
2467 | function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals') | ||
2468 | { | ||
2469 | if($this->debug) | ||
2470 | { | ||
2471 | //by maHo, replaced htmlspecialchars with htmlentities | ||
2472 | print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>"; | ||
2473 | } | ||
2474 | |||
2475 | if($data == '') | ||
2476 | { | ||
2477 | error_log('XML-RPC: xmlrpcmsg::parseResponse: no response received from server.'); | ||
2478 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']); | ||
2479 | return $r; | ||
2480 | } | ||
2481 | |||
2482 | $GLOBALS['_xh']=array(); | ||
2483 | |||
2484 | $raw_data = $data; | ||
2485 | // parse the HTTP headers of the response, if present, and separate them from data | ||
2486 | if(substr($data, 0, 4) == 'HTTP') | ||
2487 | { | ||
2488 | $r =& $this->parseResponseHeaders($data, $headers_processed); | ||
2489 | if ($r) | ||
2490 | { | ||
2491 | // failed processing of HTTP response headers | ||
2492 | // save into response obj the full payload received, for debugging | ||
2493 | $r->raw_data = $data; | ||
2494 | return $r; | ||
2495 | } | ||
2496 | } | ||
2497 | else | ||
2498 | { | ||
2499 | $GLOBALS['_xh']['headers'] = array(); | ||
2500 | $GLOBALS['_xh']['cookies'] = array(); | ||
2501 | } | ||
2502 | |||
2503 | if($this->debug) | ||
2504 | { | ||
2505 | $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); | ||
2506 | if ($start) | ||
2507 | { | ||
2508 | $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):'); | ||
2509 | $end = strpos($data, '-->', $start); | ||
2510 | $comments = substr($data, $start, $end-$start); | ||
2511 | print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>"; | ||
2512 | } | ||
2513 | } | ||
2514 | |||
2515 | // be tolerant of extra whitespace in response body | ||
2516 | $data = trim($data); | ||
2517 | |||
2518 | /// @todo return an error msg if $data=='' ? | ||
2519 | |||
2520 | // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts) | ||
2521 | // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib | ||
2522 | $bd = false; | ||
2523 | // Poor man's version of strrpos for php 4... | ||
2524 | $pos = strpos($data, '</methodResponse>'); | ||
2525 | while($pos || is_int($pos)) | ||
2526 | { | ||
2527 | $bd = $pos+17; | ||
2528 | $pos = strpos($data, '</methodResponse>', $bd); | ||
2529 | } | ||
2530 | if($bd) | ||
2531 | { | ||
2532 | $data = substr($data, 0, $bd); | ||
2533 | } | ||
2534 | |||
2535 | // if user wants back raw xml, give it to him | ||
2536 | if ($return_type == 'xml') | ||
2537 | { | ||
2538 | $r =& new xmlrpcresp($data, 0, '', 'xml'); | ||
2539 | $r->hdrs = $GLOBALS['_xh']['headers']; | ||
2540 | $r->_cookies = $GLOBALS['_xh']['cookies']; | ||
2541 | $r->raw_data = $raw_data; | ||
2542 | return $r; | ||
2543 | } | ||
2544 | |||
2545 | // try to 'guestimate' the character encoding of the received response | ||
2546 | $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data); | ||
2547 | |||
2548 | $GLOBALS['_xh']['ac']=''; | ||
2549 | //$GLOBALS['_xh']['qt']=''; //unused... | ||
2550 | $GLOBALS['_xh']['stack'] = array(); | ||
2551 | $GLOBALS['_xh']['valuestack'] = array(); | ||
2552 | $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc | ||
2553 | $GLOBALS['_xh']['isf_reason']=''; | ||
2554 | $GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse' | ||
2555 | |||
2556 | // if response charset encoding is not known / supported, try to use | ||
2557 | // the default encoding and parse the xml anyway, but log a warning... | ||
2558 | if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
2559 | // the following code might be better for mb_string enabled installs, but | ||
2560 | // makes the lib about 200% slower... | ||
2561 | //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
2562 | { | ||
2563 | error_log('XML-RPC: xmlrpcmsg::parseResponse: invalid charset encoding of received response: '.$resp_encoding); | ||
2564 | $resp_encoding = $GLOBALS['xmlrpc_defencoding']; | ||
2565 | } | ||
2566 | $parser = xml_parser_create($resp_encoding); | ||
2567 | xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); | ||
2568 | // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell | ||
2569 | // the xml parser to give us back data in the expected charset. | ||
2570 | // What if internal encoding is not in one of the 3 allowed? | ||
2571 | // we use the broadest one, ie. utf8 | ||
2572 | // This allows to send data which is native in various charset, | ||
2573 | // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding | ||
2574 | if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
2575 | { | ||
2576 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); | ||
2577 | } | ||
2578 | else | ||
2579 | { | ||
2580 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']); | ||
2581 | } | ||
2582 | |||
2583 | if ($return_type == 'phpvals') | ||
2584 | { | ||
2585 | xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast'); | ||
2586 | } | ||
2587 | else | ||
2588 | { | ||
2589 | xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee'); | ||
2590 | } | ||
2591 | |||
2592 | xml_set_character_data_handler($parser, 'xmlrpc_cd'); | ||
2593 | xml_set_default_handler($parser, 'xmlrpc_dh'); | ||
2594 | |||
2595 | // first error check: xml not well formed | ||
2596 | if(!xml_parse($parser, $data, count($data))) | ||
2597 | { | ||
2598 | // thanks to Peter Kocks <peter.kocks@baygate.com> | ||
2599 | if((xml_get_current_line_number($parser)) == 1) | ||
2600 | { | ||
2601 | $errstr = 'XML error at line 1, check URL'; | ||
2602 | } | ||
2603 | else | ||
2604 | { | ||
2605 | $errstr = sprintf('XML error: %s at line %d, column %d', | ||
2606 | xml_error_string(xml_get_error_code($parser)), | ||
2607 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); | ||
2608 | } | ||
2609 | error_log($errstr); | ||
2610 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')'); | ||
2611 | xml_parser_free($parser); | ||
2612 | if($this->debug) | ||
2613 | { | ||
2614 | print $errstr; | ||
2615 | } | ||
2616 | $r->hdrs = $GLOBALS['_xh']['headers']; | ||
2617 | $r->_cookies = $GLOBALS['_xh']['cookies']; | ||
2618 | $r->raw_data = $raw_data; | ||
2619 | return $r; | ||
2620 | } | ||
2621 | xml_parser_free($parser); | ||
2622 | // second error check: xml well formed but not xml-rpc compliant | ||
2623 | if ($GLOBALS['_xh']['isf'] > 1) | ||
2624 | { | ||
2625 | if ($this->debug) | ||
2626 | { | ||
2627 | /// @todo echo something for user? | ||
2628 | } | ||
2629 | |||
2630 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], | ||
2631 | $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']); | ||
2632 | } | ||
2633 | // third error check: parsing of the response has somehow gone boink. | ||
2634 | // NB: shall we omit this check, since we trust the parsing code? | ||
2635 | elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value'])) | ||
2636 | { | ||
2637 | // something odd has happened | ||
2638 | // and it's time to generate a client side error | ||
2639 | // indicating something odd went on | ||
2640 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], | ||
2641 | $GLOBALS['xmlrpcstr']['invalid_return']); | ||
2642 | } | ||
2643 | else | ||
2644 | { | ||
2645 | if ($this->debug) | ||
2646 | { | ||
2647 | print "<PRE>---PARSED---\n"; | ||
2648 | // somehow htmlentities chokes on var_export, and some full html string... | ||
2649 | //print htmlentitites(var_export($GLOBALS['_xh']['value'], true)); | ||
2650 | print htmlspecialchars(var_export($GLOBALS['_xh']['value'], true)); | ||
2651 | print "\n---END---</PRE>"; | ||
2652 | } | ||
2653 | |||
2654 | // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object. | ||
2655 | $v =& $GLOBALS['_xh']['value']; | ||
2656 | |||
2657 | if($GLOBALS['_xh']['isf']) | ||
2658 | { | ||
2659 | /// @todo we should test here if server sent an int and a string, | ||
2660 | /// and/or coerce them into such... | ||
2661 | if ($return_type == 'xmlrpcvals') | ||
2662 | { | ||
2663 | $errno_v = $v->structmem('faultCode'); | ||
2664 | $errstr_v = $v->structmem('faultString'); | ||
2665 | $errno = $errno_v->scalarval(); | ||
2666 | $errstr = $errstr_v->scalarval(); | ||
2667 | } | ||
2668 | else | ||
2669 | { | ||
2670 | $errno = $v['faultCode']; | ||
2671 | $errstr = $v['faultString']; | ||
2672 | } | ||
2673 | |||
2674 | if($errno == 0) | ||
2675 | { | ||
2676 | // FAULT returned, errno needs to reflect that | ||
2677 | $errno = -1; | ||
2678 | } | ||
2679 | |||
2680 | $r =& new xmlrpcresp(0, $errno, $errstr); | ||
2681 | } | ||
2682 | else | ||
2683 | { | ||
2684 | $r=&new xmlrpcresp($v, 0, '', $return_type); | ||
2685 | } | ||
2686 | } | ||
2687 | |||
2688 | $r->hdrs = $GLOBALS['_xh']['headers']; | ||
2689 | $r->_cookies = $GLOBALS['_xh']['cookies']; | ||
2690 | $r->raw_data = $raw_data; | ||
2691 | return $r; | ||
2692 | } | ||
2693 | } | ||
2694 | |||
2695 | class xmlrpcval | ||
2696 | { | ||
2697 | var $me=array(); | ||
2698 | var $mytype=0; | ||
2699 | var $_php_class=null; | ||
2700 | |||
2701 | /** | ||
2702 | * @param mixed $val | ||
2703 | * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed | ||
2704 | */ | ||
2705 | function xmlrpcval($val=-1, $type='') | ||
2706 | { | ||
2707 | /// @todo: optimization creep - do not call addXX, do it all inline. | ||
2708 | /// downside: booleans will not be coerced anymore | ||
2709 | if($val!==-1 || $type!='') | ||
2710 | { | ||
2711 | // optimization creep: inlined all work done by constructor | ||
2712 | switch($type) | ||
2713 | { | ||
2714 | case '': | ||
2715 | $this->mytype=1; | ||
2716 | $this->me['string']=$val; | ||
2717 | break; | ||
2718 | case 'i4': | ||
2719 | case 'int': | ||
2720 | case 'double': | ||
2721 | case 'string': | ||
2722 | case 'boolean': | ||
2723 | case 'dateTime.iso8601': | ||
2724 | case 'base64': | ||
2725 | case 'null': | ||
2726 | $this->mytype=1; | ||
2727 | $this->me[$type]=$val; | ||
2728 | break; | ||
2729 | case 'array': | ||
2730 | $this->mytype=2; | ||
2731 | $this->me['array']=$val; | ||
2732 | break; | ||
2733 | case 'struct': | ||
2734 | $this->mytype=3; | ||
2735 | $this->me['struct']=$val; | ||
2736 | break; | ||
2737 | default: | ||
2738 | error_log("XML-RPC: xmlrpcval::xmlrpcval: not a known type ($type)"); | ||
2739 | } | ||
2740 | /*if($type=='') | ||
2741 | { | ||
2742 | $type='string'; | ||
2743 | } | ||
2744 | if($GLOBALS['xmlrpcTypes'][$type]==1) | ||
2745 | { | ||
2746 | $this->addScalar($val,$type); | ||
2747 | } | ||
2748 | elseif($GLOBALS['xmlrpcTypes'][$type]==2) | ||
2749 | { | ||
2750 | $this->addArray($val); | ||
2751 | } | ||
2752 | elseif($GLOBALS['xmlrpcTypes'][$type]==3) | ||
2753 | { | ||
2754 | $this->addStruct($val); | ||
2755 | }*/ | ||
2756 | } | ||
2757 | } | ||
2758 | |||
2759 | /** | ||
2760 | * Add a single php value to an (unitialized) xmlrpcval | ||
2761 | * @param mixed $val | ||
2762 | * @param string $type | ||
2763 | * @return int 1 or 0 on failure | ||
2764 | */ | ||
2765 | function addScalar($val, $type='string') | ||
2766 | { | ||
2767 | $typeof=@$GLOBALS['xmlrpcTypes'][$type]; | ||
2768 | if($typeof!=1) | ||
2769 | { | ||
2770 | error_log("XML-RPC: xmlrpcval::addScalar: not a scalar type ($type)"); | ||
2771 | return 0; | ||
2772 | } | ||
2773 | |||
2774 | // coerce booleans into correct values | ||
2775 | // NB: we should iether do it for datetimes, integers and doubles, too, | ||
2776 | // or just plain remove this check, implemnted on booleans only... | ||
2777 | if($type==$GLOBALS['xmlrpcBoolean']) | ||
2778 | { | ||
2779 | if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false'))) | ||
2780 | { | ||
2781 | $val=true; | ||
2782 | } | ||
2783 | else | ||
2784 | { | ||
2785 | $val=false; | ||
2786 | } | ||
2787 | } | ||
2788 | |||
2789 | switch($this->mytype) | ||
2790 | { | ||
2791 | case 1: | ||
2792 | error_log('XML-RPC: xmlrpcval::addScalar: scalar xmlrpcval can have only one value'); | ||
2793 | return 0; | ||
2794 | case 3: | ||
2795 | error_log('XML-RPC: xmlrpcval::addScalar: cannot add anonymous scalar to struct xmlrpcval'); | ||
2796 | return 0; | ||
2797 | case 2: | ||
2798 | // we're adding a scalar value to an array here | ||
2799 | //$ar=$this->me['array']; | ||
2800 | //$ar[]=&new xmlrpcval($val, $type); | ||
2801 | //$this->me['array']=$ar; | ||
2802 | // Faster (?) avoid all the costly array-copy-by-val done here... | ||
2803 | $this->me['array'][]=&new xmlrpcval($val, $type); | ||
2804 | return 1; | ||
2805 | default: | ||
2806 | // a scalar, so set the value and remember we're scalar | ||
2807 | $this->me[$type]=$val; | ||
2808 | $this->mytype=$typeof; | ||
2809 | return 1; | ||
2810 | } | ||
2811 | } | ||
2812 | |||
2813 | /** | ||
2814 | * Add an array of xmlrpcval objects to an xmlrpcval | ||
2815 | * @param array $vals | ||
2816 | * @return int 1 or 0 on failure | ||
2817 | * @access public | ||
2818 | * | ||
2819 | * @todo add some checking for $vals to be an array of xmlrpcvals? | ||
2820 | */ | ||
2821 | function addArray($vals) | ||
2822 | { | ||
2823 | if($this->mytype==0) | ||
2824 | { | ||
2825 | $this->mytype=$GLOBALS['xmlrpcTypes']['array']; | ||
2826 | $this->me['array']=$vals; | ||
2827 | return 1; | ||
2828 | } | ||
2829 | elseif($this->mytype==2) | ||
2830 | { | ||
2831 | // we're adding to an array here | ||
2832 | $this->me['array'] = array_merge($this->me['array'], $vals); | ||
2833 | return 1; | ||
2834 | } | ||
2835 | else | ||
2836 | { | ||
2837 | error_log('XML-RPC: xmlrpcval::addArray: already initialized as a [' . $this->kindOf() . ']'); | ||
2838 | return 0; | ||
2839 | } | ||
2840 | } | ||
2841 | |||
2842 | /** | ||
2843 | * Add an array of named xmlrpcval objects to an xmlrpcval | ||
2844 | * @param array $vals | ||
2845 | * @return int 1 or 0 on failure | ||
2846 | * @access public | ||
2847 | * | ||
2848 | * @todo add some checking for $vals to be an array? | ||
2849 | */ | ||
2850 | function addStruct($vals) | ||
2851 | { | ||
2852 | if($this->mytype==0) | ||
2853 | { | ||
2854 | $this->mytype=$GLOBALS['xmlrpcTypes']['struct']; | ||
2855 | $this->me['struct']=$vals; | ||
2856 | return 1; | ||
2857 | } | ||
2858 | elseif($this->mytype==3) | ||
2859 | { | ||
2860 | // we're adding to a struct here | ||
2861 | $this->me['struct'] = array_merge($this->me['struct'], $vals); | ||
2862 | return 1; | ||
2863 | } | ||
2864 | else | ||
2865 | { | ||
2866 | error_log('XML-RPC: xmlrpcval::addStruct: already initialized as a [' . $this->kindOf() . ']'); | ||
2867 | return 0; | ||
2868 | } | ||
2869 | } | ||
2870 | |||
2871 | // poor man's version of print_r ??? | ||
2872 | // DEPRECATED! | ||
2873 | function dump($ar) | ||
2874 | { | ||
2875 | foreach($ar as $key => $val) | ||
2876 | { | ||
2877 | echo "$key => $val<br />"; | ||
2878 | if($key == 'array') | ||
2879 | { | ||
2880 | while(list($key2, $val2) = each($val)) | ||
2881 | { | ||
2882 | echo "-- $key2 => $val2<br />"; | ||
2883 | } | ||
2884 | } | ||
2885 | } | ||
2886 | } | ||
2887 | |||
2888 | /** | ||
2889 | * Returns a string containing "struct", "array" or "scalar" describing the base type of the value | ||
2890 | * @return string | ||
2891 | * @access public | ||
2892 | */ | ||
2893 | function kindOf() | ||
2894 | { | ||
2895 | switch($this->mytype) | ||
2896 | { | ||
2897 | case 3: | ||
2898 | return 'struct'; | ||
2899 | break; | ||
2900 | case 2: | ||
2901 | return 'array'; | ||
2902 | break; | ||
2903 | case 1: | ||
2904 | return 'scalar'; | ||
2905 | break; | ||
2906 | default: | ||
2907 | return 'undef'; | ||
2908 | } | ||
2909 | } | ||
2910 | |||
2911 | /** | ||
2912 | * @access private | ||
2913 | */ | ||
2914 | function serializedata($typ, $val, $charset_encoding='') | ||
2915 | { | ||
2916 | $rs=''; | ||
2917 | switch(@$GLOBALS['xmlrpcTypes'][$typ]) | ||
2918 | { | ||
2919 | case 1: | ||
2920 | switch($typ) | ||
2921 | { | ||
2922 | case $GLOBALS['xmlrpcBase64']: | ||
2923 | $rs.="<${typ}>" . base64_encode($val) . "</${typ}>"; | ||
2924 | break; | ||
2925 | case $GLOBALS['xmlrpcBoolean']: | ||
2926 | $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>"; | ||
2927 | break; | ||
2928 | case $GLOBALS['xmlrpcString']: | ||
2929 | // G. Giunta 2005/2/13: do NOT use htmlentities, since | ||
2930 | // it will produce named html entities, which are invalid xml | ||
2931 | $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>"; | ||
2932 | break; | ||
2933 | case $GLOBALS['xmlrpcInt']: | ||
2934 | case $GLOBALS['xmlrpcI4']: | ||
2935 | $rs.="<${typ}>".(int)$val."</${typ}>"; | ||
2936 | break; | ||
2937 | case $GLOBALS['xmlrpcDouble']: | ||
2938 | $rs.="<${typ}>".(double)$val."</${typ}>"; | ||
2939 | break; | ||
2940 | case $GLOBALS['xmlrpcNull']: | ||
2941 | $rs.="<nil/>"; | ||
2942 | break; | ||
2943 | default: | ||
2944 | // no standard type value should arrive here, but provide a possibility | ||
2945 | // for xmlrpcvals of unknown type... | ||
2946 | $rs.="<${typ}>${val}</${typ}>"; | ||
2947 | } | ||
2948 | break; | ||
2949 | case 3: | ||
2950 | // struct | ||
2951 | if ($this->_php_class) | ||
2952 | { | ||
2953 | $rs.='<struct php_class="' . $this->_php_class . "\">\n"; | ||
2954 | } | ||
2955 | else | ||
2956 | { | ||
2957 | $rs.="<struct>\n"; | ||
2958 | } | ||
2959 | foreach($val as $key2 => $val2) | ||
2960 | { | ||
2961 | $rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n"; | ||
2962 | //$rs.=$this->serializeval($val2); | ||
2963 | $rs.=$val2->serialize($charset_encoding); | ||
2964 | $rs.="</member>\n"; | ||
2965 | } | ||
2966 | $rs.='</struct>'; | ||
2967 | break; | ||
2968 | case 2: | ||
2969 | // array | ||
2970 | $rs.="<array>\n<data>\n"; | ||
2971 | for($i=0; $i<count($val); $i++) | ||
2972 | { | ||
2973 | //$rs.=$this->serializeval($val[$i]); | ||
2974 | $rs.=$val[$i]->serialize($charset_encoding); | ||
2975 | } | ||
2976 | $rs.="</data>\n</array>"; | ||
2977 | break; | ||
2978 | default: | ||
2979 | break; | ||
2980 | } | ||
2981 | return $rs; | ||
2982 | } | ||
2983 | |||
2984 | /** | ||
2985 | * Returns xml representation of the value. XML prologue not included | ||
2986 | * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed | ||
2987 | * @return string | ||
2988 | * @access public | ||
2989 | */ | ||
2990 | function serialize($charset_encoding='') | ||
2991 | { | ||
2992 | // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals... | ||
2993 | //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval'))) | ||
2994 | //{ | ||
2995 | reset($this->me); | ||
2996 | list($typ, $val) = each($this->me); | ||
2997 | return '<value>' . $this->serializedata($typ, $val, $charset_encoding) . "</value>\n"; | ||
2998 | //} | ||
2999 | } | ||
3000 | |||
3001 | // DEPRECATED | ||
3002 | function serializeval($o) | ||
3003 | { | ||
3004 | // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals... | ||
3005 | //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval'))) | ||
3006 | //{ | ||
3007 | $ar=$o->me; | ||
3008 | reset($ar); | ||
3009 | list($typ, $val) = each($ar); | ||
3010 | return '<value>' . $this->serializedata($typ, $val) . "</value>\n"; | ||
3011 | //} | ||
3012 | } | ||
3013 | |||
3014 | /** | ||
3015 | * Checks wheter a struct member with a given name is present. | ||
3016 | * Works only on xmlrpcvals of type struct. | ||
3017 | * @param string $m the name of the struct member to be looked up | ||
3018 | * @return boolean | ||
3019 | * @access public | ||
3020 | */ | ||
3021 | function structmemexists($m) | ||
3022 | { | ||
3023 | return array_key_exists($m, $this->me['struct']); | ||
3024 | } | ||
3025 | |||
3026 | /** | ||
3027 | * Returns the value of a given struct member (an xmlrpcval object in itself). | ||
3028 | * Will raise a php warning if struct member of given name does not exist | ||
3029 | * @param string $m the name of the struct member to be looked up | ||
3030 | * @return xmlrpcval | ||
3031 | * @access public | ||
3032 | */ | ||
3033 | function structmem($m) | ||
3034 | { | ||
3035 | return $this->me['struct'][$m]; | ||
3036 | } | ||
3037 | |||
3038 | /** | ||
3039 | * Reset internal pointer for xmlrpcvals of type struct. | ||
3040 | * @access public | ||
3041 | */ | ||
3042 | function structreset() | ||
3043 | { | ||
3044 | reset($this->me['struct']); | ||
3045 | } | ||
3046 | |||
3047 | /** | ||
3048 | * Return next member element for xmlrpcvals of type struct. | ||
3049 | * @return xmlrpcval | ||
3050 | * @access public | ||
3051 | */ | ||
3052 | function structeach() | ||
3053 | { | ||
3054 | return each($this->me['struct']); | ||
3055 | } | ||
3056 | |||
3057 | // DEPRECATED! this code looks like it is very fragile and has not been fixed | ||
3058 | // for a long long time. Shall we remove it for 2.0? | ||
3059 | function getval() | ||
3060 | { | ||
3061 | // UNSTABLE | ||
3062 | reset($this->me); | ||
3063 | list($a,$b)=each($this->me); | ||
3064 | // contributed by I Sofer, 2001-03-24 | ||
3065 | // add support for nested arrays to scalarval | ||
3066 | // i've created a new method here, so as to | ||
3067 | // preserve back compatibility | ||
3068 | |||
3069 | if(is_array($b)) | ||
3070 | { | ||
3071 | @reset($b); | ||
3072 | while(list($id,$cont) = @each($b)) | ||
3073 | { | ||
3074 | $b[$id] = $cont->scalarval(); | ||
3075 | } | ||
3076 | } | ||
3077 | |||
3078 | // add support for structures directly encoding php objects | ||
3079 | if(is_object($b)) | ||
3080 | { | ||
3081 | $t = get_object_vars($b); | ||
3082 | @reset($t); | ||
3083 | while(list($id,$cont) = @each($t)) | ||
3084 | { | ||
3085 | $t[$id] = $cont->scalarval(); | ||
3086 | } | ||
3087 | @reset($t); | ||
3088 | while(list($id,$cont) = @each($t)) | ||
3089 | { | ||
3090 | @$b->$id = $cont; | ||
3091 | } | ||
3092 | } | ||
3093 | // end contrib | ||
3094 | return $b; | ||
3095 | } | ||
3096 | |||
3097 | /** | ||
3098 | * Returns the value of a scalar xmlrpcval | ||
3099 | * @return mixed | ||
3100 | * @access public | ||
3101 | */ | ||
3102 | function scalarval() | ||
3103 | { | ||
3104 | reset($this->me); | ||
3105 | list(,$b)=each($this->me); | ||
3106 | return $b; | ||
3107 | } | ||
3108 | |||
3109 | /** | ||
3110 | * Returns the type of the xmlrpcval. | ||
3111 | * For integers, 'int' is always returned in place of 'i4' | ||
3112 | * @return string | ||
3113 | * @access public | ||
3114 | */ | ||
3115 | function scalartyp() | ||
3116 | { | ||
3117 | reset($this->me); | ||
3118 | list($a,)=each($this->me); | ||
3119 | if($a==$GLOBALS['xmlrpcI4']) | ||
3120 | { | ||
3121 | $a=$GLOBALS['xmlrpcInt']; | ||
3122 | } | ||
3123 | return $a; | ||
3124 | } | ||
3125 | |||
3126 | /** | ||
3127 | * Returns the m-th member of an xmlrpcval of struct type | ||
3128 | * @param integer $m the index of the value to be retrieved (zero based) | ||
3129 | * @return xmlrpcval | ||
3130 | * @access public | ||
3131 | */ | ||
3132 | function arraymem($m) | ||
3133 | { | ||
3134 | return $this->me['array'][$m]; | ||
3135 | } | ||
3136 | |||
3137 | /** | ||
3138 | * Returns the number of members in an xmlrpcval of array type | ||
3139 | * @return integer | ||
3140 | * @access public | ||
3141 | */ | ||
3142 | function arraysize() | ||
3143 | { | ||
3144 | return count($this->me['array']); | ||
3145 | } | ||
3146 | |||
3147 | /** | ||
3148 | * Returns the number of members in an xmlrpcval of struct type | ||
3149 | * @return integer | ||
3150 | * @access public | ||
3151 | */ | ||
3152 | function structsize() | ||
3153 | { | ||
3154 | return count($this->me['struct']); | ||
3155 | } | ||
3156 | } | ||
3157 | |||
3158 | |||
3159 | // date helpers | ||
3160 | |||
3161 | /** | ||
3162 | * Given a timestamp, return the corresponding ISO8601 encoded string. | ||
3163 | * | ||
3164 | * Really, timezones ought to be supported | ||
3165 | * but the XML-RPC spec says: | ||
3166 | * | ||
3167 | * "Don't assume a timezone. It should be specified by the server in its | ||
3168 | * documentation what assumptions it makes about timezones." | ||
3169 | * | ||
3170 | * These routines always assume localtime unless | ||
3171 | * $utc is set to 1, in which case UTC is assumed | ||
3172 | * and an adjustment for locale is made when encoding | ||
3173 | * | ||
3174 | * @param int $timet (timestamp) | ||
3175 | * @param int $utc (0 or 1) | ||
3176 | * @return string | ||
3177 | */ | ||
3178 | function iso8601_encode($timet, $utc=0) | ||
3179 | { | ||
3180 | if(!$utc) | ||
3181 | { | ||
3182 | $t=strftime("%Y%m%dT%H:%M:%S", $timet); | ||
3183 | } | ||
3184 | else | ||
3185 | { | ||
3186 | if(function_exists('gmstrftime')) | ||
3187 | { | ||
3188 | // gmstrftime doesn't exist in some versions | ||
3189 | // of PHP | ||
3190 | $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet); | ||
3191 | } | ||
3192 | else | ||
3193 | { | ||
3194 | $t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z')); | ||
3195 | } | ||
3196 | } | ||
3197 | return $t; | ||
3198 | } | ||
3199 | |||
3200 | /** | ||
3201 | * Given an ISO8601 date string, return a timet in the localtime, or UTC | ||
3202 | * @param string $idate | ||
3203 | * @param int $utc either 0 or 1 | ||
3204 | * @return int (datetime) | ||
3205 | */ | ||
3206 | function iso8601_decode($idate, $utc=0) | ||
3207 | { | ||
3208 | $t=0; | ||
3209 | if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs)) | ||
3210 | { | ||
3211 | if($utc) | ||
3212 | { | ||
3213 | $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); | ||
3214 | } | ||
3215 | else | ||
3216 | { | ||
3217 | $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); | ||
3218 | } | ||
3219 | } | ||
3220 | return $t; | ||
3221 | } | ||
3222 | |||
3223 | /** | ||
3224 | * Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types. | ||
3225 | * | ||
3226 | * Works with xmlrpc message objects as input, too. | ||
3227 | * | ||
3228 | * Given proper options parameter, can rebuild generic php object instances | ||
3229 | * (provided those have been encoded to xmlrpc format using a corresponding | ||
3230 | * option in php_xmlrpc_encode()) | ||
3231 | * PLEASE NOTE that rebuilding php objects involves calling their constructor function. | ||
3232 | * This means that the remote communication end can decide which php code will | ||
3233 | * get executed on your server, leaving the door possibly open to 'php-injection' | ||
3234 | * style of attacks (provided you have some classes defined on your server that | ||
3235 | * might wreak havoc if instances are built outside an appropriate context). | ||
3236 | * Make sure you trust the remote server/client before eanbling this! | ||
3237 | * | ||
3238 | * @author Dan Libby (dan@libby.com) | ||
3239 | * | ||
3240 | * @param xmlrpcval $xmlrpc_val | ||
3241 | * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects | ||
3242 | * @return mixed | ||
3243 | */ | ||
3244 | function php_xmlrpc_decode($xmlrpc_val, $options=array()) | ||
3245 | { | ||
3246 | switch($xmlrpc_val->kindOf()) | ||
3247 | { | ||
3248 | case 'scalar': | ||
3249 | if (in_array('extension_api', $options)) | ||
3250 | { | ||
3251 | reset($xmlrpc_val->me); | ||
3252 | list($typ,$val) = each($xmlrpc_val->me); | ||
3253 | switch ($typ) | ||
3254 | { | ||
3255 | case 'dateTime.iso8601': | ||
3256 | $xmlrpc_val->scalar = $val; | ||
3257 | $xmlrpc_val->xmlrpc_type = 'datetime'; | ||
3258 | $xmlrpc_val->timestamp = iso8601_decode($val); | ||
3259 | return $xmlrpc_val; | ||
3260 | case 'base64': | ||
3261 | $xmlrpc_val->scalar = $val; | ||
3262 | $xmlrpc_val->type = $typ; | ||
3263 | return $xmlrpc_val; | ||
3264 | default: | ||
3265 | return $xmlrpc_val->scalarval(); | ||
3266 | } | ||
3267 | } | ||
3268 | return $xmlrpc_val->scalarval(); | ||
3269 | case 'array': | ||
3270 | $size = $xmlrpc_val->arraysize(); | ||
3271 | $arr = array(); | ||
3272 | for($i = 0; $i < $size; $i++) | ||
3273 | { | ||
3274 | $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options); | ||
3275 | } | ||
3276 | return $arr; | ||
3277 | case 'struct': | ||
3278 | $xmlrpc_val->structreset(); | ||
3279 | // If user said so, try to rebuild php objects for specific struct vals. | ||
3280 | /// @todo should we raise a warning for class not found? | ||
3281 | // shall we check for proper subclass of xmlrpcval instead of | ||
3282 | // presence of _php_class to detect what we can do? | ||
3283 | if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != '' | ||
3284 | && class_exists($xmlrpc_val->_php_class)) | ||
3285 | { | ||
3286 | $obj = @new $xmlrpc_val->_php_class; | ||
3287 | while(list($key,$value)=$xmlrpc_val->structeach()) | ||
3288 | { | ||
3289 | $obj->$key = php_xmlrpc_decode($value, $options); | ||
3290 | } | ||
3291 | return $obj; | ||
3292 | } | ||
3293 | else | ||
3294 | { | ||
3295 | $arr = array(); | ||
3296 | while(list($key,$value)=$xmlrpc_val->structeach()) | ||
3297 | { | ||
3298 | $arr[$key] = php_xmlrpc_decode($value, $options); | ||
3299 | } | ||
3300 | return $arr; | ||
3301 | } | ||
3302 | case 'msg': | ||
3303 | $paramcount = $xmlrpc_val->getNumParams(); | ||
3304 | $arr = array(); | ||
3305 | for($i = 0; $i < $paramcount; $i++) | ||
3306 | { | ||
3307 | $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i)); | ||
3308 | } | ||
3309 | return $arr; | ||
3310 | } | ||
3311 | } | ||
3312 | |||
3313 | // This constant left here only for historical reasons... | ||
3314 | // it was used to decide if we have to define xmlrpc_encode on our own, but | ||
3315 | // we do not do it anymore | ||
3316 | if(function_exists('xmlrpc_decode')) | ||
3317 | { | ||
3318 | define('XMLRPC_EPI_ENABLED','1'); | ||
3319 | } | ||
3320 | else | ||
3321 | { | ||
3322 | define('XMLRPC_EPI_ENABLED','0'); | ||
3323 | } | ||
3324 | |||
3325 | /** | ||
3326 | * Takes native php types and encodes them into xmlrpc PHP object format. | ||
3327 | * It will not re-encode xmlrpcval objects. | ||
3328 | * | ||
3329 | * Feature creep -- could support more types via optional type argument | ||
3330 | * (string => datetime support has been added, ??? => base64 not yet) | ||
3331 | * | ||
3332 | * If given a proper options parameter, php object instances will be encoded | ||
3333 | * into 'special' xmlrpc values, that can later be decoded into php objects | ||
3334 | * by calling php_xmlrpc_decode() with a corresponding option | ||
3335 | * | ||
3336 | * @author Dan Libby (dan@libby.com) | ||
3337 | * | ||
3338 | * @param mixed $php_val the value to be converted into an xmlrpcval object | ||
3339 | * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api' | ||
3340 | * @return xmlrpcval | ||
3341 | */ | ||
3342 | function &php_xmlrpc_encode($php_val, $options=array()) | ||
3343 | { | ||
3344 | $type = gettype($php_val); | ||
3345 | switch($type) | ||
3346 | { | ||
3347 | case 'string': | ||
3348 | if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val)) | ||
3349 | $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']); | ||
3350 | else | ||
3351 | $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcString']); | ||
3352 | break; | ||
3353 | case 'integer': | ||
3354 | $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcInt']); | ||
3355 | break; | ||
3356 | case 'double': | ||
3357 | $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcDouble']); | ||
3358 | break; | ||
3359 | // <G_Giunta_2001-02-29> | ||
3360 | // Add support for encoding/decoding of booleans, since they are supported in PHP | ||
3361 | case 'boolean': | ||
3362 | $xmlrpc_val =& new xmlrpcval($php_val, $GLOBALS['xmlrpcBoolean']); | ||
3363 | break; | ||
3364 | // </G_Giunta_2001-02-29> | ||
3365 | case 'array': | ||
3366 | // PHP arrays can be encoded to either xmlrpc structs or arrays, | ||
3367 | // depending on wheter they are hashes or plain 0..n integer indexed | ||
3368 | // A shorter one-liner would be | ||
3369 | // $tmp = array_diff(array_keys($php_val), range(0, count($php_val)-1)); | ||
3370 | // but execution time skyrockets! | ||
3371 | $j = 0; | ||
3372 | $arr = array(); | ||
3373 | $ko = false; | ||
3374 | foreach($php_val as $key => $val) | ||
3375 | { | ||
3376 | $arr[$key] =& php_xmlrpc_encode($val, $options); | ||
3377 | if(!$ko && $key !== $j) | ||
3378 | { | ||
3379 | $ko = true; | ||
3380 | } | ||
3381 | $j++; | ||
3382 | } | ||
3383 | if($ko) | ||
3384 | { | ||
3385 | $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); | ||
3386 | } | ||
3387 | else | ||
3388 | { | ||
3389 | $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcArray']); | ||
3390 | } | ||
3391 | break; | ||
3392 | case 'object': | ||
3393 | if(is_a($php_val, 'xmlrpcval')) | ||
3394 | { | ||
3395 | $xmlrpc_val = $php_val; | ||
3396 | } | ||
3397 | else | ||
3398 | { | ||
3399 | $arr = array(); | ||
3400 | while(list($k,$v) = each($php_val)) | ||
3401 | { | ||
3402 | $arr[$k] = php_xmlrpc_encode($v, $options); | ||
3403 | } | ||
3404 | $xmlrpc_val =& new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']); | ||
3405 | if (in_array('encode_php_objs', $options)) | ||
3406 | { | ||
3407 | // let's save original class name into xmlrpcval: | ||
3408 | // might be useful later on... | ||
3409 | $xmlrpc_val->_php_class = get_class($php_val); | ||
3410 | } | ||
3411 | } | ||
3412 | break; | ||
3413 | case 'NULL': | ||
3414 | if (in_array('extension_api', $options)) | ||
3415 | { | ||
3416 | $xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcString']); | ||
3417 | } | ||
3418 | if (in_array('null_extension', $options)) | ||
3419 | { | ||
3420 | $xmlrpc_val =& new xmlrpcval('', $GLOBALS['xmlrpcNull']); | ||
3421 | } | ||
3422 | else | ||
3423 | { | ||
3424 | $xmlrpc_val =& new xmlrpcval(); | ||
3425 | } | ||
3426 | break; | ||
3427 | case 'resource': | ||
3428 | if (in_array('extension_api', $options)) | ||
3429 | { | ||
3430 | $xmlrpc_val =& new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']); | ||
3431 | } | ||
3432 | else | ||
3433 | { | ||
3434 | $xmlrpc_val =& new xmlrpcval(); | ||
3435 | } | ||
3436 | // catch "user function", "unknown type" | ||
3437 | default: | ||
3438 | // giancarlo pinerolo <ping@alt.it> | ||
3439 | // it has to return | ||
3440 | // an empty object in case, not a boolean. | ||
3441 | $xmlrpc_val =& new xmlrpcval(); | ||
3442 | break; | ||
3443 | } | ||
3444 | return $xmlrpc_val; | ||
3445 | } | ||
3446 | |||
3447 | /** | ||
3448 | * Convert the xml representation of a method response, method request or single | ||
3449 | * xmlrpc value into the appropriate object (a.k.a. deserialize) | ||
3450 | * @param string $xml_val | ||
3451 | * @param array $options | ||
3452 | * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp | ||
3453 | */ | ||
3454 | function php_xmlrpc_decode_xml($xml_val, $options=array()) | ||
3455 | { | ||
3456 | $GLOBALS['_xh'] = array(); | ||
3457 | $GLOBALS['_xh']['ac'] = ''; | ||
3458 | $GLOBALS['_xh']['stack'] = array(); | ||
3459 | $GLOBALS['_xh']['valuestack'] = array(); | ||
3460 | $GLOBALS['_xh']['params'] = array(); | ||
3461 | $GLOBALS['_xh']['pt'] = array(); | ||
3462 | $GLOBALS['_xh']['isf'] = 0; | ||
3463 | $GLOBALS['_xh']['isf_reason'] = ''; | ||
3464 | $GLOBALS['_xh']['method'] = false; | ||
3465 | $GLOBALS['_xh']['rt'] = ''; | ||
3466 | /// @todo 'guestimate' encoding | ||
3467 | $parser = xml_parser_create(); | ||
3468 | xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); | ||
3469 | // What if internal encoding is not in one of the 3 allowed? | ||
3470 | // we use the broadest one, ie. utf8! | ||
3471 | if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
3472 | { | ||
3473 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); | ||
3474 | } | ||
3475 | else | ||
3476 | { | ||
3477 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']); | ||
3478 | } | ||
3479 | xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee'); | ||
3480 | xml_set_character_data_handler($parser, 'xmlrpc_cd'); | ||
3481 | xml_set_default_handler($parser, 'xmlrpc_dh'); | ||
3482 | if(!xml_parse($parser, $xml_val, 1)) | ||
3483 | { | ||
3484 | $errstr = sprintf('XML error: %s at line %d, column %d', | ||
3485 | xml_error_string(xml_get_error_code($parser)), | ||
3486 | xml_get_current_line_number($parser), xml_get_current_column_number($parser)); | ||
3487 | error_log($errstr); | ||
3488 | xml_parser_free($parser); | ||
3489 | return false; | ||
3490 | } | ||
3491 | xml_parser_free($parser); | ||
3492 | if ($GLOBALS['_xh']['isf'] > 1) // test that $GLOBALS['_xh']['value'] is an obj, too??? | ||
3493 | { | ||
3494 | error_log($GLOBALS['_xh']['isf_reason']); | ||
3495 | return false; | ||
3496 | } | ||
3497 | switch ($GLOBALS['_xh']['rt']) | ||
3498 | { | ||
3499 | case 'methodresponse': | ||
3500 | $v =& $GLOBALS['_xh']['value']; | ||
3501 | if ($GLOBALS['_xh']['isf'] == 1) | ||
3502 | { | ||
3503 | $vc = $v->structmem('faultCode'); | ||
3504 | $vs = $v->structmem('faultString'); | ||
3505 | $r =& new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval()); | ||
3506 | } | ||
3507 | else | ||
3508 | { | ||
3509 | $r =& new xmlrpcresp($v); | ||
3510 | } | ||
3511 | return $r; | ||
3512 | case 'methodcall': | ||
3513 | $m =& new xmlrpcmsg($GLOBALS['_xh']['method']); | ||
3514 | for($i=0; $i < count($GLOBALS['_xh']['params']); $i++) | ||
3515 | { | ||
3516 | $m->addParam($GLOBALS['_xh']['params'][$i]); | ||
3517 | } | ||
3518 | return $m; | ||
3519 | case 'value': | ||
3520 | return $GLOBALS['_xh']['value']; | ||
3521 | default: | ||
3522 | return false; | ||
3523 | } | ||
3524 | } | ||
3525 | |||
3526 | /** | ||
3527 | * decode a string that is encoded w/ "chunked" transfer encoding | ||
3528 | * as defined in rfc2068 par. 19.4.6 | ||
3529 | * code shamelessly stolen from nusoap library by Dietrich Ayala | ||
3530 | * | ||
3531 | * @param string $buffer the string to be decoded | ||
3532 | * @return string | ||
3533 | */ | ||
3534 | function decode_chunked($buffer) | ||
3535 | { | ||
3536 | // length := 0 | ||
3537 | $length = 0; | ||
3538 | $new = ''; | ||
3539 | |||
3540 | // read chunk-size, chunk-extension (if any) and crlf | ||
3541 | // get the position of the linebreak | ||
3542 | $chunkend = strpos($buffer,"\r\n") + 2; | ||
3543 | $temp = substr($buffer,0,$chunkend); | ||
3544 | $chunk_size = hexdec( trim($temp) ); | ||
3545 | $chunkstart = $chunkend; | ||
3546 | while($chunk_size > 0) | ||
3547 | { | ||
3548 | $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size); | ||
3549 | |||
3550 | // just in case we got a broken connection | ||
3551 | if($chunkend == false) | ||
3552 | { | ||
3553 | $chunk = substr($buffer,$chunkstart); | ||
3554 | // append chunk-data to entity-body | ||
3555 | $new .= $chunk; | ||
3556 | $length += strlen($chunk); | ||
3557 | break; | ||
3558 | } | ||
3559 | |||
3560 | // read chunk-data and crlf | ||
3561 | $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); | ||
3562 | // append chunk-data to entity-body | ||
3563 | $new .= $chunk; | ||
3564 | // length := length + chunk-size | ||
3565 | $length += strlen($chunk); | ||
3566 | // read chunk-size and crlf | ||
3567 | $chunkstart = $chunkend + 2; | ||
3568 | |||
3569 | $chunkend = strpos($buffer,"\r\n",$chunkstart)+2; | ||
3570 | if($chunkend == false) | ||
3571 | { | ||
3572 | break; //just in case we got a broken connection | ||
3573 | } | ||
3574 | $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); | ||
3575 | $chunk_size = hexdec( trim($temp) ); | ||
3576 | $chunkstart = $chunkend; | ||
3577 | } | ||
3578 | return $new; | ||
3579 | } | ||
3580 | |||
3581 | /** | ||
3582 | * xml charset encoding guessing helper function. | ||
3583 | * Tries to determine the charset encoding of an XML chunk | ||
3584 | * received over HTTP. | ||
3585 | * NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type, | ||
3586 | * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers, | ||
3587 | * which will be most probably using UTF-8 anyway... | ||
3588 | * | ||
3589 | * @param string $httpheaders the http Content-type header | ||
3590 | * @param string $xmlchunk xml content buffer | ||
3591 | * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled) | ||
3592 | * | ||
3593 | * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!! | ||
3594 | */ | ||
3595 | function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null) | ||
3596 | { | ||
3597 | // discussion: see http://www.yale.edu/pclt/encoding/ | ||
3598 | // 1 - test if encoding is specified in HTTP HEADERS | ||
3599 | |||
3600 | //Details: | ||
3601 | // LWS: (\13\10)?( |\t)+ | ||
3602 | // token: (any char but excluded stuff)+ | ||
3603 | // header: Content-type = ...; charset=value(; ...)* | ||
3604 | // where value is of type token, no LWS allowed between 'charset' and value | ||
3605 | // Note: we do not check for invalid chars in VALUE: | ||
3606 | // this had better be done using pure ereg as below | ||
3607 | |||
3608 | /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it? | ||
3609 | $matches = array(); | ||
3610 | if(preg_match('/;\s*charset=([^;]+)/i', $httpheader, $matches)) | ||
3611 | { | ||
3612 | return strtoupper(trim($matches[1])); | ||
3613 | } | ||
3614 | |||
3615 | // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern | ||
3616 | // (source: http://www.w3.org/TR/2000/REC-xml-20001006) | ||
3617 | // NOTE: actually, according to the spec, even if we find the BOM and determine | ||
3618 | // an encoding, we should check if there is an encoding specified | ||
3619 | // in the xml declaration, and verify if they match. | ||
3620 | /// @todo implement check as described above? | ||
3621 | /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM) | ||
3622 | if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk)) | ||
3623 | { | ||
3624 | return 'UCS-4'; | ||
3625 | } | ||
3626 | elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk)) | ||
3627 | { | ||
3628 | return 'UTF-16'; | ||
3629 | } | ||
3630 | elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk)) | ||
3631 | { | ||
3632 | return 'UTF-8'; | ||
3633 | } | ||
3634 | |||
3635 | // 3 - test if encoding is specified in the xml declaration | ||
3636 | // Details: | ||
3637 | // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ | ||
3638 | // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* | ||
3639 | if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". | ||
3640 | '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", | ||
3641 | $xmlchunk, $matches)) | ||
3642 | { | ||
3643 | return strtoupper(substr($matches[2], 1, -1)); | ||
3644 | } | ||
3645 | |||
3646 | // 4 - if mbstring is available, let it do the guesswork | ||
3647 | // NB: we favour finding an encoding that is compatible with what we can process | ||
3648 | if(extension_loaded('mbstring')) | ||
3649 | { | ||
3650 | if($encoding_prefs) | ||
3651 | { | ||
3652 | $enc = mb_detect_encoding($xmlchunk, $encoding_prefs); | ||
3653 | } | ||
3654 | else | ||
3655 | { | ||
3656 | $enc = mb_detect_encoding($xmlchunk); | ||
3657 | } | ||
3658 | // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII... | ||
3659 | // IANA also likes better US-ASCII, so go with it | ||
3660 | if($enc == 'ASCII') | ||
3661 | { | ||
3662 | $enc = 'US-'.$enc; | ||
3663 | } | ||
3664 | return $enc; | ||
3665 | } | ||
3666 | else | ||
3667 | { | ||
3668 | // no encoding specified: as per HTTP1.1 assume it is iso-8859-1? | ||
3669 | // Both RFC 2616 (HTTP 1.1) and 1945(http 1.0) clearly state that for text/xxx content types | ||
3670 | // this should be the standard. And we should be getting text/xml as request and response. | ||
3671 | // BUT we have to be backward compatible with the lib, which always used UTF-8 as default... | ||
3672 | return $GLOBALS['xmlrpc_defencoding']; | ||
3673 | } | ||
3674 | } | ||
3675 | |||
3676 | /** | ||
3677 | * Checks if a given charset encoding is present in a list of encodings or | ||
3678 | * if it is a valid subset of any encoding in the list | ||
3679 | * @param string $encoding charset to be tested | ||
3680 | * @param mixed $validlist comma separated list of valid charsets (or array of charsets) | ||
3681 | */ | ||
3682 | function is_valid_charset($encoding, $validlist) | ||
3683 | { | ||
3684 | $charset_supersets = array( | ||
3685 | 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', | ||
3686 | 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', | ||
3687 | 'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12', | ||
3688 | 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8', | ||
3689 | 'EUC-JP', 'EUC-', 'EUC-KR', 'EUC-CN') | ||
3690 | ); | ||
3691 | if (is_string($validlist)) | ||
3692 | $validlist = explode(',', $validlist); | ||
3693 | if (@in_array(strtoupper($encoding), $validlist)) | ||
3694 | return true; | ||
3695 | else | ||
3696 | { | ||
3697 | if (array_key_exists($encoding, $charset_supersets)) | ||
3698 | foreach ($validlist as $allowed) | ||
3699 | if (in_array($allowed, $charset_supersets[$encoding])) | ||
3700 | return true; | ||
3701 | return false; | ||
3702 | } | ||
3703 | } | ||
3704 | |||
3705 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/xmlrpc_wrappers.inc b/includes/xmlrpc/xmlrpc_wrappers.inc new file mode 100644 index 0000000..cd0a56f --- /dev/null +++ b/includes/xmlrpc/xmlrpc_wrappers.inc | |||
@@ -0,0 +1,819 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * PHP-XMLRPC "wrapper" functions | ||
4 | * Generate stubs to transparently access xmlrpc methods as php functions and viceversa | ||
5 | * | ||
6 | * @version $Id: xmlrpc_wrappers.inc,v 1.12 2008/03/06 18:58:44 ggiunta Exp $ | ||
7 | * @author Gaetano Giunta | ||
8 | * @copyright (C) 2006-2008 G. Giunta | ||
9 | * @license code licensed under the BSD License: http://phpxmlrpc.sourceforge.net/license.txt | ||
10 | * | ||
11 | * @todo separate introspection from code generation for func-2-method wrapping | ||
12 | * @todo use some better templating system from code generation? | ||
13 | * @todo implement method wrapping with preservation of php objs in calls | ||
14 | * @todo when wrapping methods without obj rebuilding, use return_type = 'phpvals' (faster) | ||
15 | * @todo implement self-parsing of php code for PHP <= 4 | ||
16 | */ | ||
17 | |||
18 | // requires: xmlrpc.inc | ||
19 | |||
20 | /** | ||
21 | * Given a string defining a php type or phpxmlrpc type (loosely defined: strings | ||
22 | * accepted come from javadoc blocks), return corresponding phpxmlrpc type. | ||
23 | * NB: for php 'resource' types returns empty string, since resources cannot be serialized; | ||
24 | * for php class names returns 'struct', since php objects can be serialized as xmlrpc structs | ||
25 | * @param string $phptype | ||
26 | * @return string | ||
27 | */ | ||
28 | function php_2_xmlrpc_type($phptype) | ||
29 | { | ||
30 | switch(strtolower($phptype)) | ||
31 | { | ||
32 | case 'string': | ||
33 | return $GLOBALS['xmlrpcString']; | ||
34 | case 'integer': | ||
35 | case $GLOBALS['xmlrpcInt']: // 'int' | ||
36 | case $GLOBALS['xmlrpcI4']: | ||
37 | return $GLOBALS['xmlrpcInt']; | ||
38 | case 'double': | ||
39 | return $GLOBALS['xmlrpcDouble']; | ||
40 | case 'boolean': | ||
41 | return $GLOBALS['xmlrpcBoolean']; | ||
42 | case 'array': | ||
43 | return $GLOBALS['xmlrpcArray']; | ||
44 | case 'object': | ||
45 | return $GLOBALS['xmlrpcStruct']; | ||
46 | case $GLOBALS['xmlrpcBase64']: | ||
47 | case $GLOBALS['xmlrpcStruct']: | ||
48 | return strtolower($phptype); | ||
49 | case 'resource': | ||
50 | return ''; | ||
51 | default: | ||
52 | if(class_exists($phptype)) | ||
53 | { | ||
54 | return $GLOBALS['xmlrpcStruct']; | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | // unknown: might be any 'extended' xmlrpc type | ||
59 | return $GLOBALS['xmlrpcValue']; | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * Given a string defining a phpxmlrpc type return corresponding php type. | ||
66 | * @param string $xmlrpctype | ||
67 | * @return string | ||
68 | */ | ||
69 | function xmlrpc_2_php_type($xmlrpctype) | ||
70 | { | ||
71 | switch(strtolower($xmlrpctype)) | ||
72 | { | ||
73 | case 'base64': | ||
74 | case 'datetime.iso8601': | ||
75 | case 'string': | ||
76 | return $GLOBALS['xmlrpcString']; | ||
77 | case 'int': | ||
78 | case 'i4': | ||
79 | return 'integer'; | ||
80 | case 'struct': | ||
81 | case 'array': | ||
82 | return 'array'; | ||
83 | case 'double': | ||
84 | return 'float'; | ||
85 | case 'undefined': | ||
86 | return 'mixed'; | ||
87 | case 'boolean': | ||
88 | case 'null': | ||
89 | default: | ||
90 | // unknown: might be any xmlrpc type | ||
91 | return strtolower($xmlrpctype); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * Given a user-defined PHP function, create a PHP 'wrapper' function that can | ||
97 | * be exposed as xmlrpc method from an xmlrpc_server object and called from remote | ||
98 | * clients (as well as its corresponding signature info). | ||
99 | * | ||
100 | * Since php is a typeless language, to infer types of input and output parameters, | ||
101 | * it relies on parsing the javadoc-style comment block associated with the given | ||
102 | * function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64) | ||
103 | * in the @param tag is also allowed, if you need the php function to receive/send | ||
104 | * data in that particular format (note that base64 encoding/decoding is transparently | ||
105 | * carried out by the lib, while datetime vals are passed around as strings) | ||
106 | * | ||
107 | * Known limitations: | ||
108 | * - requires PHP 5.0.3 + | ||
109 | * - only works for user-defined functions, not for PHP internal functions | ||
110 | * (reflection does not support retrieving number/type of params for those) | ||
111 | * - functions returning php objects will generate special xmlrpc responses: | ||
112 | * when the xmlrpc decoding of those responses is carried out by this same lib, using | ||
113 | * the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt. | ||
114 | * In short: php objects can be serialized, too (except for their resource members), | ||
115 | * using this function. | ||
116 | * Other libs might choke on the very same xml that will be generated in this case | ||
117 | * (i.e. it has a nonstandard attribute on struct element tags) | ||
118 | * - usage of javadoc @param tags using param names in a different order from the | ||
119 | * function prototype is not considered valid (to be fixed?) | ||
120 | * | ||
121 | * Note that since rel. 2.0RC3 the preferred method to have the server call 'standard' | ||
122 | * php functions (ie. functions not expecting a single xmlrpcmsg obj as parameter) | ||
123 | * is by making use of the functions_parameters_type class member. | ||
124 | * | ||
125 | * @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') might be ok too, in the future... | ||
126 | * @param string $newfuncname (optional) name for function to be created | ||
127 | * @param array $extra_options (optional) array of options for conversion. valid values include: | ||
128 | * bool return_source when true, php code w. function definition will be returned, not evaluated | ||
129 | * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects | ||
130 | * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- | ||
131 | * bool suppress_warnings remove from produced xml any runtime warnings due to the php function being invoked | ||
132 | * @return false on error, or an array containing the name of the new php function, | ||
133 | * its signature and docs, to be used in the server dispatch map | ||
134 | * | ||
135 | * @todo decide how to deal with params passed by ref: bomb out or allow? | ||
136 | * @todo finish using javadoc info to build method sig if all params are named but out of order | ||
137 | * @todo add a check for params of 'resource' type | ||
138 | * @todo add some trigger_errors / error_log when returning false? | ||
139 | * @todo what to do when the PHP function returns NULL? we are currently an empty string value... | ||
140 | * @todo add an option to suppress php warnings in invocation of user function, similar to server debug level 3? | ||
141 | */ | ||
142 | function wrap_php_function($funcname, $newfuncname='', $extra_options=array()) | ||
143 | { | ||
144 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; | ||
145 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; | ||
146 | $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; | ||
147 | $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; | ||
148 | $catch_warnings = isset($extra_options['suppress_warnings']) && $extra_options['suppress_warnings'] ? '@' : ''; | ||
149 | |||
150 | if(version_compare(phpversion(), '5.0.3') == -1) | ||
151 | { | ||
152 | // up to php 5.0.3 some useful reflection methods were missing | ||
153 | error_log('XML-RPC: cannot not wrap php functions unless running php version bigger than 5.0.3'); | ||
154 | return false; | ||
155 | } | ||
156 | if((is_array($funcname) && !method_exists($funcname[0], $funcname[1])) || !function_exists($funcname)) | ||
157 | { | ||
158 | error_log('XML-RPC: function to be wrapped is not defined: '.$funcname); | ||
159 | return false; | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | // determine name of new php function | ||
164 | if($newfuncname == '') | ||
165 | { | ||
166 | if(is_array($funcname)) | ||
167 | { | ||
168 | $xmlrpcfuncname = "{$prefix}_".implode('_', $funcname); | ||
169 | } | ||
170 | else | ||
171 | { | ||
172 | $xmlrpcfuncname = "{$prefix}_$funcname"; | ||
173 | } | ||
174 | } | ||
175 | else | ||
176 | { | ||
177 | $xmlrpcfuncname = $newfuncname; | ||
178 | } | ||
179 | while($buildit && function_exists($xmlrpcfuncname)) | ||
180 | { | ||
181 | $xmlrpcfuncname .= 'x'; | ||
182 | } | ||
183 | |||
184 | // start to introspect PHP code | ||
185 | $func =& new ReflectionFunction($funcname); | ||
186 | if($func->isInternal()) | ||
187 | { | ||
188 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs | ||
189 | // instead of getparameters to fully reflect internal php functions ? | ||
190 | error_log('XML-RPC: function to be wrapped is internal: '.$funcname); | ||
191 | return false; | ||
192 | } | ||
193 | |||
194 | // retrieve parameter names, types and description from javadoc comments | ||
195 | |||
196 | // function description | ||
197 | $desc = ''; | ||
198 | // type of return val: by default 'any' | ||
199 | $returns = $GLOBALS['xmlrpcValue']; | ||
200 | // desc of return val | ||
201 | $returnsDocs = ''; | ||
202 | // type + name of function parameters | ||
203 | $paramDocs = array(); | ||
204 | |||
205 | $docs = $func->getDocComment(); | ||
206 | if($docs != '') | ||
207 | { | ||
208 | $docs = explode("\n", $docs); | ||
209 | $i = 0; | ||
210 | foreach($docs as $doc) | ||
211 | { | ||
212 | $doc = trim($doc, " \r\t/*"); | ||
213 | if(strlen($doc) && strpos($doc, '@') !== 0 && !$i) | ||
214 | { | ||
215 | if($desc) | ||
216 | { | ||
217 | $desc .= "\n"; | ||
218 | } | ||
219 | $desc .= $doc; | ||
220 | } | ||
221 | elseif(strpos($doc, '@param') === 0) | ||
222 | { | ||
223 | // syntax: @param type [$name] desc | ||
224 | if(preg_match('/@param\s+(\S+)(\s+\$\S+)?\s+(.+)/', $doc, $matches)) | ||
225 | { | ||
226 | if(strpos($matches[1], '|')) | ||
227 | { | ||
228 | //$paramDocs[$i]['type'] = explode('|', $matches[1]); | ||
229 | $paramDocs[$i]['type'] = 'mixed'; | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | $paramDocs[$i]['type'] = $matches[1]; | ||
234 | } | ||
235 | $paramDocs[$i]['name'] = trim($matches[2]); | ||
236 | $paramDocs[$i]['doc'] = $matches[3]; | ||
237 | } | ||
238 | $i++; | ||
239 | } | ||
240 | elseif(strpos($doc, '@return') === 0) | ||
241 | { | ||
242 | // syntax: @return type desc | ||
243 | //$returns = preg_split('/\s+/', $doc); | ||
244 | if(preg_match('/@return\s+(\S+)\s+(.+)/', $doc, $matches)) | ||
245 | { | ||
246 | $returns = php_2_xmlrpc_type($matches[1]); | ||
247 | if(isset($matches[2])) | ||
248 | { | ||
249 | $returnsDocs = $matches[2]; | ||
250 | } | ||
251 | } | ||
252 | } | ||
253 | } | ||
254 | } | ||
255 | |||
256 | // execute introspection of actual function prototype | ||
257 | $params = array(); | ||
258 | $i = 0; | ||
259 | foreach($func->getParameters() as $paramobj) | ||
260 | { | ||
261 | $params[$i] = array(); | ||
262 | $params[$i]['name'] = '$'.$paramobj->getName(); | ||
263 | $params[$i]['isoptional'] = $paramobj->isOptional(); | ||
264 | $i++; | ||
265 | } | ||
266 | |||
267 | |||
268 | // start building of PHP code to be eval'd | ||
269 | $innercode = ''; | ||
270 | $i = 0; | ||
271 | $parsvariations = array(); | ||
272 | $pars = array(); | ||
273 | $pnum = count($params); | ||
274 | foreach($params as $param) | ||
275 | { | ||
276 | if (isset($paramDocs[$i]['name']) && $paramDocs[$i]['name'] && strtolower($paramDocs[$i]['name']) != strtolower($param['name'])) | ||
277 | { | ||
278 | // param name from phpdoc info does not match param definition! | ||
279 | $paramDocs[$i]['type'] = 'mixed'; | ||
280 | } | ||
281 | |||
282 | if($param['isoptional']) | ||
283 | { | ||
284 | // this particular parameter is optional. save as valid previous list of parameters | ||
285 | $innercode .= "if (\$paramcount > $i) {\n"; | ||
286 | $parsvariations[] = $pars; | ||
287 | } | ||
288 | $innercode .= "\$p$i = \$msg->getParam($i);\n"; | ||
289 | if ($decode_php_objects) | ||
290 | { | ||
291 | $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i, array('decode_php_objs'));\n"; | ||
292 | } | ||
293 | else | ||
294 | { | ||
295 | $innercode .= "if (\$p{$i}->kindOf() == 'scalar') \$p$i = \$p{$i}->scalarval(); else \$p$i = php_{$prefix}_decode(\$p$i);\n"; | ||
296 | } | ||
297 | |||
298 | $pars[] = "\$p$i"; | ||
299 | $i++; | ||
300 | if($param['isoptional']) | ||
301 | { | ||
302 | $innercode .= "}\n"; | ||
303 | } | ||
304 | if($i == $pnum) | ||
305 | { | ||
306 | // last allowed parameters combination | ||
307 | $parsvariations[] = $pars; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | $sigs = array(); | ||
312 | $psigs = array(); | ||
313 | if(count($parsvariations) == 0) | ||
314 | { | ||
315 | // only known good synopsis = no parameters | ||
316 | $parsvariations[] = array(); | ||
317 | $minpars = 0; | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | $minpars = count($parsvariations[0]); | ||
322 | } | ||
323 | |||
324 | if($minpars) | ||
325 | { | ||
326 | // add to code the check for min params number | ||
327 | // NB: this check needs to be done BEFORE decoding param values | ||
328 | $innercode = "\$paramcount = \$msg->getNumParams();\n" . | ||
329 | "if (\$paramcount < $minpars) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}');\n" . $innercode; | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | $innercode = "\$paramcount = \$msg->getNumParams();\n" . $innercode; | ||
334 | } | ||
335 | |||
336 | $innercode .= "\$np = false;\n"; | ||
337 | foreach($parsvariations as $pars) | ||
338 | { | ||
339 | $innercode .= "if (\$paramcount == " . count($pars) . ") \$retval = {$catch_warnings}$funcname(" . implode(',', $pars) . "); else\n"; | ||
340 | // build a 'generic' signature (only use an appropriate return type) | ||
341 | $sig = array($returns); | ||
342 | $psig = array($returnsDocs); | ||
343 | for($i=0; $i < count($pars); $i++) | ||
344 | { | ||
345 | if (isset($paramDocs[$i]['type'])) | ||
346 | { | ||
347 | $sig[] = php_2_xmlrpc_type($paramDocs[$i]['type']); | ||
348 | } | ||
349 | else | ||
350 | { | ||
351 | $sig[] = $GLOBALS['xmlrpcValue']; | ||
352 | } | ||
353 | $psig[] = isset($paramDocs[$i]['doc']) ? $paramDocs[$i]['doc'] : ''; | ||
354 | } | ||
355 | $sigs[] = $sig; | ||
356 | $psigs[] = $psig; | ||
357 | } | ||
358 | $innercode .= "\$np = true;\n"; | ||
359 | $innercode .= "if (\$np) return new {$prefix}resp(0, {$GLOBALS['xmlrpcerr']['incorrect_params']}, '{$GLOBALS['xmlrpcstr']['incorrect_params']}'); else {\n"; | ||
360 | //$innercode .= "if (\$_xmlrpcs_error_occurred) return new xmlrpcresp(0, $GLOBALS['xmlrpcerr']user, \$_xmlrpcs_error_occurred); else\n"; | ||
361 | $innercode .= "if (is_a(\$retval, '{$prefix}resp')) return \$retval; else\n"; | ||
362 | if($returns == $GLOBALS['xmlrpcDateTime'] || $returns == $GLOBALS['xmlrpcBase64']) | ||
363 | { | ||
364 | $innercode .= "return new {$prefix}resp(new {$prefix}val(\$retval, '$returns'));"; | ||
365 | } | ||
366 | else | ||
367 | { | ||
368 | if ($encode_php_objects) | ||
369 | $innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval, array('encode_php_objs')));\n"; | ||
370 | else | ||
371 | $innercode .= "return new {$prefix}resp(php_{$prefix}_encode(\$retval));\n"; | ||
372 | } | ||
373 | // shall we exclude functions returning by ref? | ||
374 | // if($func->returnsReference()) | ||
375 | // return false; | ||
376 | $code = "function $xmlrpcfuncname(\$msg) {\n" . $innercode . "}\n}"; | ||
377 | //print_r($code); | ||
378 | if ($buildit) | ||
379 | { | ||
380 | $allOK = 0; | ||
381 | eval($code.'$allOK=1;'); | ||
382 | // alternative | ||
383 | //$xmlrpcfuncname = create_function('$m', $innercode); | ||
384 | |||
385 | if(!$allOK) | ||
386 | { | ||
387 | error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap php function '.$funcname); | ||
388 | return false; | ||
389 | } | ||
390 | } | ||
391 | |||
392 | /// @todo examine if $paramDocs matches $parsvariations and build array for | ||
393 | /// usage as method signature, plus put together a nice string for docs | ||
394 | |||
395 | $ret = array('function' => $xmlrpcfuncname, 'signature' => $sigs, 'docstring' => $desc, 'signature_docs' => $psigs, 'source' => $code); | ||
396 | return $ret; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Given an xmlrpc client and a method name, register a php wrapper function | ||
402 | * that will call it and return results using native php types for both | ||
403 | * params and results. The generated php function will return an xmlrpcresp | ||
404 | * oject for failed xmlrpc calls | ||
405 | * | ||
406 | * Known limitations: | ||
407 | * - server must support system.methodsignature for the wanted xmlrpc method | ||
408 | * - for methods that expose many signatures, only one can be picked (we | ||
409 | * could in priciple check if signatures differ only by number of params | ||
410 | * and not by type, but it would be more complication than we can spare time) | ||
411 | * - nested xmlrpc params: the caller of the generated php function has to | ||
412 | * encode on its own the params passed to the php function if these are structs | ||
413 | * or arrays whose (sub)members include values of type datetime or base64 | ||
414 | * | ||
415 | * Notes: the connection properties of the given client will be copied | ||
416 | * and reused for the connection used during the call to the generated | ||
417 | * php function. | ||
418 | * Calling the generated php function 'might' be slow: a new xmlrpc client | ||
419 | * is created on every invocation and an xmlrpc-connection opened+closed. | ||
420 | * An extra 'debug' param is appended to param list of xmlrpc method, useful | ||
421 | * for debugging purposes. | ||
422 | * | ||
423 | * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server | ||
424 | * @param string $methodname the xmlrpc method to be mapped to a php function | ||
425 | * @param array $extra_options array of options that specify conversion details. valid ptions include | ||
426 | * integer signum the index of the method signature to use in mapping (if method exposes many sigs) | ||
427 | * integer timeout timeout (in secs) to be used when executing function/calling remote method | ||
428 | * string protocol 'http' (default), 'http11' or 'https' | ||
429 | * string new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name | ||
430 | * string return_source if true return php code w. function definition instead fo function name | ||
431 | * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects | ||
432 | * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- | ||
433 | * mixed return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values | ||
434 | * bool debug set it to 1 or 2 to see debug results of querying server for method synopsis | ||
435 | * @return string the name of the generated php function (or false) - OR AN ARRAY... | ||
436 | */ | ||
437 | function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='') | ||
438 | { | ||
439 | // mind numbing: let caller use sane calling convention (as per javadoc, 3 params), | ||
440 | // OR the 2.0 calling convention (no ptions) - we really love backward compat, don't we? | ||
441 | if (!is_array($extra_options)) | ||
442 | { | ||
443 | $signum = $extra_options; | ||
444 | $extra_options = array(); | ||
445 | } | ||
446 | else | ||
447 | { | ||
448 | $signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; | ||
449 | $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; | ||
450 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; | ||
451 | $newfuncname = isset($extra_options['new_function_name']) ? $extra_options['new_function_name'] : ''; | ||
452 | } | ||
453 | //$encode_php_objects = in_array('encode_php_objects', $extra_options); | ||
454 | //$verbatim_client_copy = in_array('simple_client_copy', $extra_options) ? 1 : | ||
455 | // in_array('build_class_code', $extra_options) ? 2 : 0; | ||
456 | |||
457 | $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; | ||
458 | $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; | ||
459 | $simple_client_copy = isset($extra_options['simple_client_copy']) ? (int)($extra_options['simple_client_copy']) : 0; | ||
460 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; | ||
461 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; | ||
462 | if (isset($extra_options['return_on_fault'])) | ||
463 | { | ||
464 | $decode_fault = true; | ||
465 | $fault_response = $extra_options['return_on_fault']; | ||
466 | } | ||
467 | else | ||
468 | { | ||
469 | $decode_fault = false; | ||
470 | $fault_response = ''; | ||
471 | } | ||
472 | $debug = isset($extra_options['debug']) ? ($extra_options['debug']) : 0; | ||
473 | |||
474 | $msgclass = $prefix.'msg'; | ||
475 | $valclass = $prefix.'val'; | ||
476 | $decodefunc = 'php_'.$prefix.'_decode'; | ||
477 | |||
478 | $msg =& new $msgclass('system.methodSignature'); | ||
479 | $msg->addparam(new $valclass($methodname)); | ||
480 | $client->setDebug($debug); | ||
481 | $response =& $client->send($msg, $timeout, $protocol); | ||
482 | if($response->faultCode()) | ||
483 | { | ||
484 | error_log('XML-RPC: could not retrieve method signature from remote server for method '.$methodname); | ||
485 | return false; | ||
486 | } | ||
487 | else | ||
488 | { | ||
489 | $msig = $response->value(); | ||
490 | if ($client->return_type != 'phpvals') | ||
491 | { | ||
492 | $msig = $decodefunc($msig); | ||
493 | } | ||
494 | if(!is_array($msig) || count($msig) <= $signum) | ||
495 | { | ||
496 | error_log('XML-RPC: could not retrieve method signature nr.'.$signum.' from remote server for method '.$methodname); | ||
497 | return false; | ||
498 | } | ||
499 | else | ||
500 | { | ||
501 | // pick a suitable name for the new function, avoiding collisions | ||
502 | if($newfuncname != '') | ||
503 | { | ||
504 | $xmlrpcfuncname = $newfuncname; | ||
505 | } | ||
506 | else | ||
507 | { | ||
508 | // take care to insure that methodname is translated to valid | ||
509 | // php function name | ||
510 | $xmlrpcfuncname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), | ||
511 | array('_', ''), $methodname); | ||
512 | } | ||
513 | while($buildit && function_exists($xmlrpcfuncname)) | ||
514 | { | ||
515 | $xmlrpcfuncname .= 'x'; | ||
516 | } | ||
517 | |||
518 | $msig = $msig[$signum]; | ||
519 | $mdesc = ''; | ||
520 | // if in 'offline' mode, get method description too. | ||
521 | // in online mode, favour speed of operation | ||
522 | if(!$buildit) | ||
523 | { | ||
524 | $msg =& new $msgclass('system.methodHelp'); | ||
525 | $msg->addparam(new $valclass($methodname)); | ||
526 | $response =& $client->send($msg, $timeout, $protocol); | ||
527 | if (!$response->faultCode()) | ||
528 | { | ||
529 | $mdesc = $response->value(); | ||
530 | if ($client->return_type != 'phpvals') | ||
531 | { | ||
532 | $mdesc = $mdesc->scalarval(); | ||
533 | } | ||
534 | } | ||
535 | } | ||
536 | |||
537 | $results = build_remote_method_wrapper_code($client, $methodname, | ||
538 | $xmlrpcfuncname, $msig, $mdesc, $timeout, $protocol, $simple_client_copy, | ||
539 | $prefix, $decode_php_objects, $encode_php_objects, $decode_fault, | ||
540 | $fault_response); | ||
541 | |||
542 | //print_r($code); | ||
543 | if ($buildit) | ||
544 | { | ||
545 | $allOK = 0; | ||
546 | eval($results['source'].'$allOK=1;'); | ||
547 | // alternative | ||
548 | //$xmlrpcfuncname = create_function('$m', $innercode); | ||
549 | if($allOK) | ||
550 | { | ||
551 | return $xmlrpcfuncname; | ||
552 | } | ||
553 | else | ||
554 | { | ||
555 | error_log('XML-RPC: could not create function '.$xmlrpcfuncname.' to wrap remote method '.$methodname); | ||
556 | return false; | ||
557 | } | ||
558 | } | ||
559 | else | ||
560 | { | ||
561 | $results['function'] = $xmlrpcfuncname; | ||
562 | return $results; | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * Similar to wrap_xmlrpc_method, but will generate a php class that wraps | ||
570 | * all xmlrpc methods exposed by the remote server as own methods. | ||
571 | * For more details see wrap_xmlrpc_method. | ||
572 | * @param xmlrpc_client $client the client obj all set to query the desired server | ||
573 | * @param array $extra_options list of options for wrapped code | ||
574 | * @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options) | ||
575 | */ | ||
576 | function wrap_xmlrpc_server($client, $extra_options=array()) | ||
577 | { | ||
578 | $methodfilter = isset($extra_options['method_filter']) ? $extra_options['method_filter'] : ''; | ||
579 | $signum = isset($extra_options['signum']) ? (int)$extra_options['signum'] : 0; | ||
580 | $timeout = isset($extra_options['timeout']) ? (int)$extra_options['timeout'] : 0; | ||
581 | $protocol = isset($extra_options['protocol']) ? $extra_options['protocol'] : ''; | ||
582 | $newclassname = isset($extra_options['new_class_name']) ? $extra_options['new_class_name'] : ''; | ||
583 | $encode_php_objects = isset($extra_options['encode_php_objs']) ? (bool)$extra_options['encode_php_objs'] : false; | ||
584 | $decode_php_objects = isset($extra_options['decode_php_objs']) ? (bool)$extra_options['decode_php_objs'] : false; | ||
585 | $verbatim_client_copy = isset($extra_options['simple_client_copy']) ? !($extra_options['simple_client_copy']) : true; | ||
586 | $buildit = isset($extra_options['return_source']) ? !($extra_options['return_source']) : true; | ||
587 | $prefix = isset($extra_options['prefix']) ? $extra_options['prefix'] : 'xmlrpc'; | ||
588 | |||
589 | $msgclass = $prefix.'msg'; | ||
590 | //$valclass = $prefix.'val'; | ||
591 | $decodefunc = 'php_'.$prefix.'_decode'; | ||
592 | |||
593 | $msg =& new $msgclass('system.listMethods'); | ||
594 | $response =& $client->send($msg, $timeout, $protocol); | ||
595 | if($response->faultCode()) | ||
596 | { | ||
597 | error_log('XML-RPC: could not retrieve method list from remote server'); | ||
598 | return false; | ||
599 | } | ||
600 | else | ||
601 | { | ||
602 | $mlist = $response->value(); | ||
603 | if ($client->return_type != 'phpvals') | ||
604 | { | ||
605 | $mlist = $decodefunc($mlist); | ||
606 | } | ||
607 | if(!is_array($mlist) || !count($mlist)) | ||
608 | { | ||
609 | error_log('XML-RPC: could not retrieve meaningful method list from remote server'); | ||
610 | return false; | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | // pick a suitable name for the new function, avoiding collisions | ||
615 | if($newclassname != '') | ||
616 | { | ||
617 | $xmlrpcclassname = $newclassname; | ||
618 | } | ||
619 | else | ||
620 | { | ||
621 | $xmlrpcclassname = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), | ||
622 | array('_', ''), $client->server).'_client'; | ||
623 | } | ||
624 | while($buildit && class_exists($xmlrpcclassname)) | ||
625 | { | ||
626 | $xmlrpcclassname .= 'x'; | ||
627 | } | ||
628 | |||
629 | /// @todo add function setdebug() to new class, to enable/disable debugging | ||
630 | $source = "class $xmlrpcclassname\n{\nvar \$client;\n\n"; | ||
631 | $source .= "function $xmlrpcclassname()\n{\n"; | ||
632 | $source .= build_client_wrapper_code($client, $verbatim_client_copy, $prefix); | ||
633 | $source .= "\$this->client =& \$client;\n}\n\n"; | ||
634 | $opts = array('simple_client_copy' => 2, 'return_source' => true, | ||
635 | 'timeout' => $timeout, 'protocol' => $protocol, | ||
636 | 'encode_php_objs' => $encode_php_objects, 'prefix' => $prefix, | ||
637 | 'decode_php_objs' => $decode_php_objects | ||
638 | ); | ||
639 | /// @todo build javadoc for class definition, too | ||
640 | foreach($mlist as $mname) | ||
641 | { | ||
642 | if ($methodfilter == '' || preg_match($methodfilter, $mname)) | ||
643 | { | ||
644 | $opts['new_function_name'] = preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), | ||
645 | array('_', ''), $mname); | ||
646 | $methodwrap = wrap_xmlrpc_method($client, $mname, $opts); | ||
647 | if ($methodwrap) | ||
648 | { | ||
649 | if (!$buildit) | ||
650 | { | ||
651 | $source .= $methodwrap['docstring']; | ||
652 | } | ||
653 | $source .= $methodwrap['source']."\n"; | ||
654 | } | ||
655 | else | ||
656 | { | ||
657 | error_log('XML-RPC: will not create class method to wrap remote method '.$mname); | ||
658 | } | ||
659 | } | ||
660 | } | ||
661 | $source .= "}\n"; | ||
662 | if ($buildit) | ||
663 | { | ||
664 | $allOK = 0; | ||
665 | eval($source.'$allOK=1;'); | ||
666 | // alternative | ||
667 | //$xmlrpcfuncname = create_function('$m', $innercode); | ||
668 | if($allOK) | ||
669 | { | ||
670 | return $xmlrpcclassname; | ||
671 | } | ||
672 | else | ||
673 | { | ||
674 | error_log('XML-RPC: could not create class '.$xmlrpcclassname.' to wrap remote server '.$client->server); | ||
675 | return false; | ||
676 | } | ||
677 | } | ||
678 | else | ||
679 | { | ||
680 | return array('class' => $xmlrpcclassname, 'code' => $source, 'docstring' => ''); | ||
681 | } | ||
682 | } | ||
683 | } | ||
684 | } | ||
685 | |||
686 | /** | ||
687 | * Given the necessary info, build php code that creates a new function to | ||
688 | * invoke a remote xmlrpc method. | ||
689 | * Take care that no full checking of input parameters is done to ensure that | ||
690 | * valid php code is emitted. | ||
691 | * Note: real spaghetti code follows... | ||
692 | * @access private | ||
693 | */ | ||
694 | function build_remote_method_wrapper_code($client, $methodname, $xmlrpcfuncname, | ||
695 | $msig, $mdesc='', $timeout=0, $protocol='', $client_copy_mode=0, $prefix='xmlrpc', | ||
696 | $decode_php_objects=false, $encode_php_objects=false, $decode_fault=false, | ||
697 | $fault_response='') | ||
698 | { | ||
699 | $code = "function $xmlrpcfuncname ("; | ||
700 | if ($client_copy_mode < 2) | ||
701 | { | ||
702 | // client copy mode 0 or 1 == partial / full client copy in emitted code | ||
703 | $innercode = build_client_wrapper_code($client, $client_copy_mode, $prefix); | ||
704 | $innercode .= "\$client->setDebug(\$debug);\n"; | ||
705 | $this_ = ''; | ||
706 | } | ||
707 | else | ||
708 | { | ||
709 | // client copy mode 2 == no client copy in emitted code | ||
710 | $innercode = ''; | ||
711 | $this_ = 'this->'; | ||
712 | } | ||
713 | $innercode .= "\$msg =& new {$prefix}msg('$methodname');\n"; | ||
714 | |||
715 | if ($mdesc != '') | ||
716 | { | ||
717 | // take care that PHP comment is not terminated unwillingly by method description | ||
718 | $mdesc = "/**\n* ".str_replace('*/', '* /', $mdesc)."\n"; | ||
719 | } | ||
720 | else | ||
721 | { | ||
722 | $mdesc = "/**\nFunction $xmlrpcfuncname\n"; | ||
723 | } | ||
724 | |||
725 | // param parsing | ||
726 | $plist = array(); | ||
727 | $pcount = count($msig); | ||
728 | for($i = 1; $i < $pcount; $i++) | ||
729 | { | ||
730 | $plist[] = "\$p$i"; | ||
731 | $ptype = $msig[$i]; | ||
732 | if($ptype == 'i4' || $ptype == 'int' || $ptype == 'boolean' || $ptype == 'double' || | ||
733 | $ptype == 'string' || $ptype == 'dateTime.iso8601' || $ptype == 'base64' || $ptype == 'null') | ||
734 | { | ||
735 | // only build directly xmlrpcvals when type is known and scalar | ||
736 | $innercode .= "\$p$i =& new {$prefix}val(\$p$i, '$ptype');\n"; | ||
737 | } | ||
738 | else | ||
739 | { | ||
740 | if ($encode_php_objects) | ||
741 | { | ||
742 | $innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i, array('encode_php_objs'));\n"; | ||
743 | } | ||
744 | else | ||
745 | { | ||
746 | $innercode .= "\$p$i =& php_{$prefix}_encode(\$p$i);\n"; | ||
747 | } | ||
748 | } | ||
749 | $innercode .= "\$msg->addparam(\$p$i);\n"; | ||
750 | $mdesc .= '* @param '.xmlrpc_2_php_type($ptype)." \$p$i\n"; | ||
751 | } | ||
752 | if ($client_copy_mode < 2) | ||
753 | { | ||
754 | $plist[] = '$debug=0'; | ||
755 | $mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; | ||
756 | } | ||
757 | $plist = implode(', ', $plist); | ||
758 | $mdesc .= '* @return '.xmlrpc_2_php_type($msig[0])." (or an {$prefix}resp obj instance if call fails)\n*/\n"; | ||
759 | |||
760 | $innercode .= "\$res =& \${$this_}client->send(\$msg, $timeout, '$protocol');\n"; | ||
761 | if ($decode_fault) | ||
762 | { | ||
763 | if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false))) | ||
764 | { | ||
765 | $respcode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $fault_response)."')"; | ||
766 | } | ||
767 | else | ||
768 | { | ||
769 | $respcode = var_export($fault_response, true); | ||
770 | } | ||
771 | } | ||
772 | else | ||
773 | { | ||
774 | $respcode = '$res'; | ||
775 | } | ||
776 | if ($decode_php_objects) | ||
777 | { | ||
778 | $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value(), array('decode_php_objs'));"; | ||
779 | } | ||
780 | else | ||
781 | { | ||
782 | $innercode .= "if (\$res->faultcode()) return $respcode; else return php_{$prefix}_decode(\$res->value());"; | ||
783 | } | ||
784 | |||
785 | $code = $code . $plist. ") {\n" . $innercode . "\n}\n"; | ||
786 | |||
787 | return array('source' => $code, 'docstring' => $mdesc); | ||
788 | } | ||
789 | |||
790 | /** | ||
791 | * Given necessary info, generate php code that will rebuild a client object | ||
792 | * Take care that no full checking of input parameters is done to ensure that | ||
793 | * valid php code is emitted. | ||
794 | * @access private | ||
795 | */ | ||
796 | function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') | ||
797 | { | ||
798 | $code = "\$client =& new {$prefix}_client('".str_replace("'", "\'", $client->path). | ||
799 | "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; | ||
800 | |||
801 | // copy all client fields to the client that will be generated runtime | ||
802 | // (this provides for future expansion or subclassing of client obj) | ||
803 | if ($verbatim_client_copy) | ||
804 | { | ||
805 | foreach($client as $fld => $val) | ||
806 | { | ||
807 | if($fld != 'debug' && $fld != 'return_type') | ||
808 | { | ||
809 | $val = var_export($val, true); | ||
810 | $code .= "\$client->$fld = $val;\n"; | ||
811 | } | ||
812 | } | ||
813 | } | ||
814 | // only make sure that client always returns the correct data type | ||
815 | $code .= "\$client->return_type = '{$prefix}vals';\n"; | ||
816 | //$code .= "\$client->setDebug(\$debug);\n"; | ||
817 | return $code; | ||
818 | } | ||
819 | ?> \ No newline at end of file | ||
diff --git a/includes/xmlrpc/xmlrpcs.inc b/includes/xmlrpc/xmlrpcs.inc new file mode 100644 index 0000000..9588919 --- /dev/null +++ b/includes/xmlrpc/xmlrpcs.inc | |||
@@ -0,0 +1,1193 @@ | |||
1 | <?php | ||
2 | // by Edd Dumbill (C) 1999-2002 | ||
3 | // <edd@usefulinc.com> | ||
4 | // $Id: xmlrpcs.inc,v 1.69 2007/09/20 20:14:25 ggiunta Exp $ | ||
5 | |||
6 | // Copyright (c) 1999,2000,2002 Edd Dumbill. | ||
7 | // All rights reserved. | ||
8 | // | ||
9 | // Redistribution and use in source and binary forms, with or without | ||
10 | // modification, are permitted provided that the following conditions | ||
11 | // are met: | ||
12 | // | ||
13 | // * Redistributions of source code must retain the above copyright | ||
14 | // notice, this list of conditions and the following disclaimer. | ||
15 | // | ||
16 | // * Redistributions in binary form must reproduce the above | ||
17 | // copyright notice, this list of conditions and the following | ||
18 | // disclaimer in the documentation and/or other materials provided | ||
19 | // with the distribution. | ||
20 | // | ||
21 | // * Neither the name of the "XML-RPC for PHP" nor the names of its | ||
22 | // contributors may be used to endorse or promote products derived | ||
23 | // from this software without specific prior written permission. | ||
24 | // | ||
25 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
26 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
27 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
28 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
29 | // REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
30 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
31 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
32 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
33 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
34 | // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
35 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
36 | // OF THE POSSIBILITY OF SUCH DAMAGE. | ||
37 | |||
38 | // XML RPC Server class | ||
39 | // requires: xmlrpc.inc | ||
40 | |||
41 | $GLOBALS['xmlrpcs_capabilities'] = array( | ||
42 | // xmlrpc spec: always supported | ||
43 | 'xmlrpc' => new xmlrpcval(array( | ||
44 | 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/spec', 'string'), | ||
45 | 'specVersion' => new xmlrpcval(1, 'int') | ||
46 | ), 'struct'), | ||
47 | // if we support system.xxx functions, we always support multicall, too... | ||
48 | // Note that, as of 2006/09/17, the following URL does not respond anymore | ||
49 | 'system.multicall' => new xmlrpcval(array( | ||
50 | 'specUrl' => new xmlrpcval('http://www.xmlrpc.com/discuss/msgReader$1208', 'string'), | ||
51 | 'specVersion' => new xmlrpcval(1, 'int') | ||
52 | ), 'struct'), | ||
53 | // introspection: version 2! we support 'mixed', too | ||
54 | 'introspection' => new xmlrpcval(array( | ||
55 | 'specUrl' => new xmlrpcval('http://phpxmlrpc.sourceforge.net/doc-2/ch10.html', 'string'), | ||
56 | 'specVersion' => new xmlrpcval(2, 'int') | ||
57 | ), 'struct') | ||
58 | ); | ||
59 | |||
60 | /* Functions that implement system.XXX methods of xmlrpc servers */ | ||
61 | $_xmlrpcs_getCapabilities_sig=array(array($GLOBALS['xmlrpcStruct'])); | ||
62 | $_xmlrpcs_getCapabilities_doc='This method lists all the capabilites that the XML-RPC server has: the (more or less standard) extensions to the xmlrpc spec that it adheres to'; | ||
63 | $_xmlrpcs_getCapabilities_sdoc=array(array('list of capabilities, described as structs with a version number and url for the spec')); | ||
64 | function _xmlrpcs_getCapabilities($server, $m=null) | ||
65 | { | ||
66 | $outAr = $GLOBALS['xmlrpcs_capabilities']; | ||
67 | // NIL extension | ||
68 | if ($GLOBALS['xmlrpc_null_extension']) { | ||
69 | $outAr['nil'] = new xmlrpcval(array( | ||
70 | 'specUrl' => new xmlrpcval('http://www.ontosys.com/xml-rpc/extensions.php', 'string'), | ||
71 | 'specVersion' => new xmlrpcval(1, 'int') | ||
72 | ), 'struct'); | ||
73 | } | ||
74 | return new xmlrpcresp(new xmlrpcval($outAr, 'struct')); | ||
75 | } | ||
76 | |||
77 | // listMethods: signature was either a string, or nothing. | ||
78 | // The useless string variant has been removed | ||
79 | $_xmlrpcs_listMethods_sig=array(array($GLOBALS['xmlrpcArray'])); | ||
80 | $_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch'; | ||
81 | $_xmlrpcs_listMethods_sdoc=array(array('list of method names')); | ||
82 | function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing | ||
83 | { | ||
84 | |||
85 | $outAr=array(); | ||
86 | foreach($server->dmap as $key => $val) | ||
87 | { | ||
88 | $outAr[]=&new xmlrpcval($key, 'string'); | ||
89 | } | ||
90 | if($server->allow_system_funcs) | ||
91 | { | ||
92 | foreach($GLOBALS['_xmlrpcs_dmap'] as $key => $val) | ||
93 | { | ||
94 | $outAr[]=&new xmlrpcval($key, 'string'); | ||
95 | } | ||
96 | } | ||
97 | return new xmlrpcresp(new xmlrpcval($outAr, 'array')); | ||
98 | } | ||
99 | |||
100 | $_xmlrpcs_methodSignature_sig=array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcString'])); | ||
101 | $_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)'; | ||
102 | $_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described')); | ||
103 | function _xmlrpcs_methodSignature($server, $m) | ||
104 | { | ||
105 | // let accept as parameter both an xmlrpcval or string | ||
106 | if (is_object($m)) | ||
107 | { | ||
108 | $methName=$m->getParam(0); | ||
109 | $methName=$methName->scalarval(); | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | $methName=$m; | ||
114 | } | ||
115 | if(strpos($methName, "system.") === 0) | ||
116 | { | ||
117 | $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1; | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | $dmap=$server->dmap; $sysCall=0; | ||
122 | } | ||
123 | if(isset($dmap[$methName])) | ||
124 | { | ||
125 | if(isset($dmap[$methName]['signature'])) | ||
126 | { | ||
127 | $sigs=array(); | ||
128 | foreach($dmap[$methName]['signature'] as $inSig) | ||
129 | { | ||
130 | $cursig=array(); | ||
131 | foreach($inSig as $sig) | ||
132 | { | ||
133 | $cursig[]=&new xmlrpcval($sig, 'string'); | ||
134 | } | ||
135 | $sigs[]=&new xmlrpcval($cursig, 'array'); | ||
136 | } | ||
137 | $r=&new xmlrpcresp(new xmlrpcval($sigs, 'array')); | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | // NB: according to the official docs, we should be returning a | ||
142 | // "none-array" here, which means not-an-array | ||
143 | $r=&new xmlrpcresp(new xmlrpcval('undef', 'string')); | ||
144 | } | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | $r=&new xmlrpcresp(0,$GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); | ||
149 | } | ||
150 | return $r; | ||
151 | } | ||
152 | |||
153 | $_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString'])); | ||
154 | $_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string'; | ||
155 | $_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described')); | ||
156 | function _xmlrpcs_methodHelp($server, $m) | ||
157 | { | ||
158 | // let accept as parameter both an xmlrpcval or string | ||
159 | if (is_object($m)) | ||
160 | { | ||
161 | $methName=$m->getParam(0); | ||
162 | $methName=$methName->scalarval(); | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | $methName=$m; | ||
167 | } | ||
168 | if(strpos($methName, "system.") === 0) | ||
169 | { | ||
170 | $dmap=$GLOBALS['_xmlrpcs_dmap']; $sysCall=1; | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | $dmap=$server->dmap; $sysCall=0; | ||
175 | } | ||
176 | if(isset($dmap[$methName])) | ||
177 | { | ||
178 | if(isset($dmap[$methName]['docstring'])) | ||
179 | { | ||
180 | $r=&new xmlrpcresp(new xmlrpcval($dmap[$methName]['docstring']), 'string'); | ||
181 | } | ||
182 | else | ||
183 | { | ||
184 | $r=&new xmlrpcresp(new xmlrpcval('', 'string')); | ||
185 | } | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | $r=&new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['introspect_unknown'], $GLOBALS['xmlrpcstr']['introspect_unknown']); | ||
190 | } | ||
191 | return $r; | ||
192 | } | ||
193 | |||
194 | $_xmlrpcs_multicall_sig = array(array($GLOBALS['xmlrpcArray'], $GLOBALS['xmlrpcArray'])); | ||
195 | $_xmlrpcs_multicall_doc = 'Boxcar multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details'; | ||
196 | $_xmlrpcs_multicall_sdoc = array(array('list of response structs, where each struct has the usual members', 'list of calls, with each call being represented as a struct, with members "methodname" and "params"')); | ||
197 | function _xmlrpcs_multicall_error($err) | ||
198 | { | ||
199 | if(is_string($err)) | ||
200 | { | ||
201 | $str = $GLOBALS['xmlrpcstr']["multicall_${err}"]; | ||
202 | $code = $GLOBALS['xmlrpcerr']["multicall_${err}"]; | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | $code = $err->faultCode(); | ||
207 | $str = $err->faultString(); | ||
208 | } | ||
209 | $struct = array(); | ||
210 | $struct['faultCode'] =& new xmlrpcval($code, 'int'); | ||
211 | $struct['faultString'] =& new xmlrpcval($str, 'string'); | ||
212 | return new xmlrpcval($struct, 'struct'); | ||
213 | } | ||
214 | |||
215 | function _xmlrpcs_multicall_do_call($server, $call) | ||
216 | { | ||
217 | if($call->kindOf() != 'struct') | ||
218 | { | ||
219 | return _xmlrpcs_multicall_error('notstruct'); | ||
220 | } | ||
221 | $methName = @$call->structmem('methodName'); | ||
222 | if(!$methName) | ||
223 | { | ||
224 | return _xmlrpcs_multicall_error('nomethod'); | ||
225 | } | ||
226 | if($methName->kindOf() != 'scalar' || $methName->scalartyp() != 'string') | ||
227 | { | ||
228 | return _xmlrpcs_multicall_error('notstring'); | ||
229 | } | ||
230 | if($methName->scalarval() == 'system.multicall') | ||
231 | { | ||
232 | return _xmlrpcs_multicall_error('recursion'); | ||
233 | } | ||
234 | |||
235 | $params = @$call->structmem('params'); | ||
236 | if(!$params) | ||
237 | { | ||
238 | return _xmlrpcs_multicall_error('noparams'); | ||
239 | } | ||
240 | if($params->kindOf() != 'array') | ||
241 | { | ||
242 | return _xmlrpcs_multicall_error('notarray'); | ||
243 | } | ||
244 | $numParams = $params->arraysize(); | ||
245 | |||
246 | $msg =& new xmlrpcmsg($methName->scalarval()); | ||
247 | for($i = 0; $i < $numParams; $i++) | ||
248 | { | ||
249 | if(!$msg->addParam($params->arraymem($i))) | ||
250 | { | ||
251 | $i++; | ||
252 | return _xmlrpcs_multicall_error(new xmlrpcresp(0, | ||
253 | $GLOBALS['xmlrpcerr']['incorrect_params'], | ||
254 | $GLOBALS['xmlrpcstr']['incorrect_params'] . ": probable xml error in param " . $i)); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | $result = $server->execute($msg); | ||
259 | |||
260 | if($result->faultCode() != 0) | ||
261 | { | ||
262 | return _xmlrpcs_multicall_error($result); // Method returned fault. | ||
263 | } | ||
264 | |||
265 | return new xmlrpcval(array($result->value()), 'array'); | ||
266 | } | ||
267 | |||
268 | function _xmlrpcs_multicall_do_call_phpvals($server, $call) | ||
269 | { | ||
270 | if(!is_array($call)) | ||
271 | { | ||
272 | return _xmlrpcs_multicall_error('notstruct'); | ||
273 | } | ||
274 | if(!array_key_exists('methodName', $call)) | ||
275 | { | ||
276 | return _xmlrpcs_multicall_error('nomethod'); | ||
277 | } | ||
278 | if (!is_string($call['methodName'])) | ||
279 | { | ||
280 | return _xmlrpcs_multicall_error('notstring'); | ||
281 | } | ||
282 | if($call['methodName'] == 'system.multicall') | ||
283 | { | ||
284 | return _xmlrpcs_multicall_error('recursion'); | ||
285 | } | ||
286 | if(!array_key_exists('params', $call)) | ||
287 | { | ||
288 | return _xmlrpcs_multicall_error('noparams'); | ||
289 | } | ||
290 | if(!is_array($call['params'])) | ||
291 | { | ||
292 | return _xmlrpcs_multicall_error('notarray'); | ||
293 | } | ||
294 | |||
295 | // this is a real dirty and simplistic hack, since we might have received a | ||
296 | // base64 or datetime values, but they will be listed as strings here... | ||
297 | $numParams = count($call['params']); | ||
298 | $pt = array(); | ||
299 | foreach($call['params'] as $val) | ||
300 | $pt[] = php_2_xmlrpc_type(gettype($val)); | ||
301 | |||
302 | $result = $server->execute($call['methodName'], $call['params'], $pt); | ||
303 | |||
304 | if($result->faultCode() != 0) | ||
305 | { | ||
306 | return _xmlrpcs_multicall_error($result); // Method returned fault. | ||
307 | } | ||
308 | |||
309 | return new xmlrpcval(array($result->value()), 'array'); | ||
310 | } | ||
311 | |||
312 | function _xmlrpcs_multicall($server, $m) | ||
313 | { | ||
314 | $result = array(); | ||
315 | // let accept a plain list of php parameters, beside a single xmlrpc msg object | ||
316 | if (is_object($m)) | ||
317 | { | ||
318 | $calls = $m->getParam(0); | ||
319 | $numCalls = $calls->arraysize(); | ||
320 | for($i = 0; $i < $numCalls; $i++) | ||
321 | { | ||
322 | $call = $calls->arraymem($i); | ||
323 | $result[$i] = _xmlrpcs_multicall_do_call($server, $call); | ||
324 | } | ||
325 | } | ||
326 | else | ||
327 | { | ||
328 | $numCalls=count($m); | ||
329 | for($i = 0; $i < $numCalls; $i++) | ||
330 | { | ||
331 | $result[$i] = _xmlrpcs_multicall_do_call_phpvals($server, $m[$i]); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | return new xmlrpcresp(new xmlrpcval($result, 'array')); | ||
336 | } | ||
337 | |||
338 | $GLOBALS['_xmlrpcs_dmap']=array( | ||
339 | 'system.listMethods' => array( | ||
340 | 'function' => '_xmlrpcs_listMethods', | ||
341 | 'signature' => $_xmlrpcs_listMethods_sig, | ||
342 | 'docstring' => $_xmlrpcs_listMethods_doc, | ||
343 | 'signature_docs' => $_xmlrpcs_listMethods_sdoc), | ||
344 | 'system.methodHelp' => array( | ||
345 | 'function' => '_xmlrpcs_methodHelp', | ||
346 | 'signature' => $_xmlrpcs_methodHelp_sig, | ||
347 | 'docstring' => $_xmlrpcs_methodHelp_doc, | ||
348 | 'signature_docs' => $_xmlrpcs_methodHelp_sdoc), | ||
349 | 'system.methodSignature' => array( | ||
350 | 'function' => '_xmlrpcs_methodSignature', | ||
351 | 'signature' => $_xmlrpcs_methodSignature_sig, | ||
352 | 'docstring' => $_xmlrpcs_methodSignature_doc, | ||
353 | 'signature_docs' => $_xmlrpcs_methodSignature_sdoc), | ||
354 | 'system.multicall' => array( | ||
355 | 'function' => '_xmlrpcs_multicall', | ||
356 | 'signature' => $_xmlrpcs_multicall_sig, | ||
357 | 'docstring' => $_xmlrpcs_multicall_doc, | ||
358 | 'signature_docs' => $_xmlrpcs_multicall_sdoc), | ||
359 | 'system.getCapabilities' => array( | ||
360 | 'function' => '_xmlrpcs_getCapabilities', | ||
361 | 'signature' => $_xmlrpcs_getCapabilities_sig, | ||
362 | 'docstring' => $_xmlrpcs_getCapabilities_doc, | ||
363 | 'signature_docs' => $_xmlrpcs_getCapabilities_sdoc) | ||
364 | ); | ||
365 | |||
366 | $GLOBALS['_xmlrpcs_occurred_errors'] = ''; | ||
367 | $GLOBALS['_xmlrpcs_prev_ehandler'] = ''; | ||
368 | /** | ||
369 | * Error handler used to track errors that occur during server-side execution of PHP code. | ||
370 | * This allows to report back to the client whether an internal error has occurred or not | ||
371 | * using an xmlrpc response object, instead of letting the client deal with the html junk | ||
372 | * that a PHP execution error on the server generally entails. | ||
373 | * | ||
374 | * NB: in fact a user defined error handler can only handle WARNING, NOTICE and USER_* errors. | ||
375 | * | ||
376 | */ | ||
377 | function _xmlrpcs_errorHandler($errcode, $errstring, $filename=null, $lineno=null, $context=null) | ||
378 | { | ||
379 | // obey the @ protocol | ||
380 | if (error_reporting() == 0) | ||
381 | return; | ||
382 | |||
383 | //if($errcode != E_NOTICE && $errcode != E_WARNING && $errcode != E_USER_NOTICE && $errcode != E_USER_WARNING) | ||
384 | if($errcode != 2048) // do not use E_STRICT by name, since on PHP 4 it will not be defined | ||
385 | { | ||
386 | $GLOBALS['_xmlrpcs_occurred_errors'] = $GLOBALS['_xmlrpcs_occurred_errors'] . $errstring . "\n"; | ||
387 | } | ||
388 | // Try to avoid as much as possible disruption to the previous error handling | ||
389 | // mechanism in place | ||
390 | if($GLOBALS['_xmlrpcs_prev_ehandler'] == '') | ||
391 | { | ||
392 | // The previous error handler was the default: all we should do is log error | ||
393 | // to the default error log (if level high enough) | ||
394 | if(ini_get('log_errors') && (intval(ini_get('error_reporting')) & $errcode)) | ||
395 | { | ||
396 | error_log($errstring); | ||
397 | } | ||
398 | } | ||
399 | else | ||
400 | { | ||
401 | // Pass control on to previous error handler, trying to avoid loops... | ||
402 | if($GLOBALS['_xmlrpcs_prev_ehandler'] != '_xmlrpcs_errorHandler') | ||
403 | { | ||
404 | // NB: this code will NOT work on php < 4.0.2: only 2 params were used for error handlers | ||
405 | if(is_array($GLOBALS['_xmlrpcs_prev_ehandler'])) | ||
406 | { | ||
407 | // the following works both with static class methods and plain object methods as error handler | ||
408 | call_user_func_array($GLOBALS['_xmlrpcs_prev_ehandler'], array($errcode, $errstring, $filename, $lineno, $context)); | ||
409 | } | ||
410 | else | ||
411 | { | ||
412 | $GLOBALS['_xmlrpcs_prev_ehandler']($errcode, $errstring, $filename, $lineno, $context); | ||
413 | } | ||
414 | } | ||
415 | } | ||
416 | } | ||
417 | |||
418 | $GLOBALS['_xmlrpc_debuginfo']=''; | ||
419 | |||
420 | /** | ||
421 | * Add a string to the debug info that can be later seralized by the server | ||
422 | * as part of the response message. | ||
423 | * Note that for best compatbility, the debug string should be encoded using | ||
424 | * the $GLOBALS['xmlrpc_internalencoding'] character set. | ||
425 | * @param string $m | ||
426 | * @access public | ||
427 | */ | ||
428 | function xmlrpc_debugmsg($m) | ||
429 | { | ||
430 | $GLOBALS['_xmlrpc_debuginfo'] .= $m . "\n"; | ||
431 | } | ||
432 | |||
433 | class xmlrpc_server | ||
434 | { | ||
435 | /// array defining php functions exposed as xmlrpc methods by this server | ||
436 | var $dmap=array(); | ||
437 | /** | ||
438 | * Defines how functions in dmap will be invokde: either using an xmlrpc msg object | ||
439 | * or plain php values. | ||
440 | * valid strings are 'xmlrpcvals', 'phpvals' or 'epivals' | ||
441 | */ | ||
442 | var $functions_parameters_type='xmlrpcvals'; | ||
443 | /// controls wether the server is going to echo debugging messages back to the client as comments in response body. valid values: 0,1,2,3 | ||
444 | var $debug = 1; | ||
445 | /** | ||
446 | * When set to true, it will enable HTTP compression of the response, in case | ||
447 | * the client has declared its support for compression in the request. | ||
448 | */ | ||
449 | var $compress_response = false; | ||
450 | /** | ||
451 | * List of http compression methods accepted by the server for requests. | ||
452 | * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib | ||
453 | */ | ||
454 | var $accepted_compression = array(); | ||
455 | /// shall we serve calls to system.* methods? | ||
456 | var $allow_system_funcs = true; | ||
457 | /// list of charset encodings natively accepted for requests | ||
458 | var $accepted_charset_encodings = array(); | ||
459 | /** | ||
460 | * charset encoding to be used for response. | ||
461 | * NB: if we can, we will convert the generated response from internal_encoding to the intended one. | ||
462 | * can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled), | ||
463 | * null (leave unspecified in response, convert output stream to US_ASCII), | ||
464 | * 'default' (use xmlrpc library default as specified in xmlrpc.inc, convert output stream if needed), | ||
465 | * or 'auto' (use client-specified charset encoding or same as request if request headers do not specify it (unless request is US-ASCII: then use library default anyway). | ||
466 | * NB: pretty dangerous if you accept every charset and do not have mbstring enabled) | ||
467 | */ | ||
468 | var $response_charset_encoding = ''; | ||
469 | /// storage for internal debug info | ||
470 | var $debug_info = ''; | ||
471 | /// extra data passed at runtime to method handling functions. Used only by EPI layer | ||
472 | var $user_data = null; | ||
473 | |||
474 | /** | ||
475 | * @param array $dispmap the dispatch map withd efinition of exposed services | ||
476 | * @param boolean $servicenow set to false to prevent the server from runnung upon construction | ||
477 | */ | ||
478 | function xmlrpc_server($dispMap=null, $serviceNow=true) | ||
479 | { | ||
480 | // if ZLIB is enabled, let the server by default accept compressed requests, | ||
481 | // and compress responses sent to clients that support them | ||
482 | if(function_exists('gzinflate')) | ||
483 | { | ||
484 | $this->accepted_compression = array('gzip', 'deflate'); | ||
485 | $this->compress_response = true; | ||
486 | } | ||
487 | |||
488 | // by default the xml parser can support these 3 charset encodings | ||
489 | $this->accepted_charset_encodings = array('UTF-8', 'ISO-8859-1', 'US-ASCII'); | ||
490 | |||
491 | // dispMap is a dispatch array of methods | ||
492 | // mapped to function names and signatures | ||
493 | // if a method | ||
494 | // doesn't appear in the map then an unknown | ||
495 | // method error is generated | ||
496 | /* milosch - changed to make passing dispMap optional. | ||
497 | * instead, you can use the class add_to_map() function | ||
498 | * to add functions manually (borrowed from SOAPX4) | ||
499 | */ | ||
500 | if($dispMap) | ||
501 | { | ||
502 | $this->dmap = $dispMap; | ||
503 | if($serviceNow) | ||
504 | { | ||
505 | $this->service(); | ||
506 | } | ||
507 | } | ||
508 | } | ||
509 | |||
510 | /** | ||
511 | * Set debug level of server. | ||
512 | * @param integer $in debug lvl: determines info added to xmlrpc responses (as xml comments) | ||
513 | * 0 = no debug info, | ||
514 | * 1 = msgs set from user with debugmsg(), | ||
515 | * 2 = add complete xmlrpc request (headers and body), | ||
516 | * 3 = add also all processing warnings happened during method processing | ||
517 | * (NB: this involves setting a custom error handler, and might interfere | ||
518 | * with the standard processing of the php function exposed as method. In | ||
519 | * particular, triggering an USER_ERROR level error will not halt script | ||
520 | * execution anymore, but just end up logged in the xmlrpc response) | ||
521 | * Note that info added at elevel 2 and 3 will be base64 encoded | ||
522 | * @access public | ||
523 | */ | ||
524 | function setDebug($in) | ||
525 | { | ||
526 | $this->debug=$in; | ||
527 | } | ||
528 | |||
529 | /** | ||
530 | * Return a string with the serialized representation of all debug info | ||
531 | * @param string $charset_encoding the target charset encoding for the serialization | ||
532 | * @return string an XML comment (or two) | ||
533 | */ | ||
534 | function serializeDebug($charset_encoding='') | ||
535 | { | ||
536 | // Tough encoding problem: which internal charset should we assume for debug info? | ||
537 | // It might contain a copy of raw data received from client, ie with unknown encoding, | ||
538 | // intermixed with php generated data and user generated data... | ||
539 | // so we split it: system debug is base 64 encoded, | ||
540 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING | ||
541 | $out = ''; | ||
542 | if ($this->debug_info != '') | ||
543 | { | ||
544 | $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; | ||
545 | } | ||
546 | if($GLOBALS['_xmlrpc_debuginfo']!='') | ||
547 | { | ||
548 | |||
549 | $out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites(str_replace('--', '_-', $GLOBALS['_xmlrpc_debuginfo']), $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "\n-->\n"; | ||
550 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it | ||
551 | // into return payload AFTER the beginning tag | ||
552 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', $GLOBALS['_xmlrpc_debuginfo']) . "\n]]>\n"; | ||
553 | } | ||
554 | return $out; | ||
555 | } | ||
556 | |||
557 | /** | ||
558 | * Execute the xmlrpc request, printing the response | ||
559 | * @param string $data the request body. If null, the http POST request will be examined | ||
560 | * @return xmlrpcresp the response object (usually not used by caller...) | ||
561 | * @access public | ||
562 | */ | ||
563 | function service($data=null, $return_payload=false) | ||
564 | { | ||
565 | if ($data === null) | ||
566 | { | ||
567 | // workaround for a known bug in php ver. 5.2.2 that broke $HTTP_RAW_POST_DATA | ||
568 | $ver = phpversion(); | ||
569 | if ($ver[0] >= 5) | ||
570 | { | ||
571 | $data = file_get_contents('php://input'); | ||
572 | } | ||
573 | else | ||
574 | { | ||
575 | $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; | ||
576 | } | ||
577 | } | ||
578 | $raw_data = $data; | ||
579 | |||
580 | // reset internal debug info | ||
581 | $this->debug_info = ''; | ||
582 | |||
583 | // Echo back what we received, before parsing it | ||
584 | if($this->debug > 1) | ||
585 | { | ||
586 | $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); | ||
587 | } | ||
588 | |||
589 | $r = $this->parseRequestHeaders($data, $req_charset, $resp_charset, $resp_encoding); | ||
590 | if (!$r) | ||
591 | { | ||
592 | $r=$this->parseRequest($data, $req_charset); | ||
593 | } | ||
594 | |||
595 | // save full body of request into response, for more debugging usages | ||
596 | $r->raw_data = $raw_data; | ||
597 | |||
598 | if($this->debug > 2 && $GLOBALS['_xmlrpcs_occurred_errors']) | ||
599 | { | ||
600 | $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . | ||
601 | $GLOBALS['_xmlrpcs_occurred_errors'] . "+++END+++"); | ||
602 | } | ||
603 | |||
604 | $payload=$this->xml_header($resp_charset); | ||
605 | if($this->debug > 0) | ||
606 | { | ||
607 | $payload = $payload . $this->serializeDebug($resp_charset); | ||
608 | } | ||
609 | |||
610 | // G. Giunta 2006-01-27: do not create response serialization if it has | ||
611 | // already happened. Helps building json magic | ||
612 | if (empty($r->payload)) | ||
613 | { | ||
614 | $r->serialize($resp_charset); | ||
615 | } | ||
616 | $payload = $payload . $r->payload; | ||
617 | |||
618 | if ($return_payload) | ||
619 | { | ||
620 | return $payload; | ||
621 | } | ||
622 | |||
623 | // if we get a warning/error that has output some text before here, then we cannot | ||
624 | // add a new header. We cannot say we are sending xml, either... | ||
625 | if(!headers_sent()) | ||
626 | { | ||
627 | header('Content-Type: '.$r->content_type); | ||
628 | // we do not know if client actually told us an accepted charset, but if he did | ||
629 | // we have to tell him what we did | ||
630 | header("Vary: Accept-Charset"); | ||
631 | |||
632 | // http compression of output: only | ||
633 | // if we can do it, and we want to do it, and client asked us to, | ||
634 | // and php ini settings do not force it already | ||
635 | $php_no_self_compress = ini_get('zlib.output_compression') == '' && (ini_get('output_handler') != 'ob_gzhandler'); | ||
636 | if($this->compress_response && function_exists('gzencode') && $resp_encoding != '' | ||
637 | && $php_no_self_compress) | ||
638 | { | ||
639 | if(strpos($resp_encoding, 'gzip') !== false) | ||
640 | { | ||
641 | $payload = gzencode($payload); | ||
642 | header("Content-Encoding: gzip"); | ||
643 | header("Vary: Accept-Encoding"); | ||
644 | } | ||
645 | elseif (strpos($resp_encoding, 'deflate') !== false) | ||
646 | { | ||
647 | $payload = gzcompress($payload); | ||
648 | header("Content-Encoding: deflate"); | ||
649 | header("Vary: Accept-Encoding"); | ||
650 | } | ||
651 | } | ||
652 | |||
653 | // do not ouput content-length header if php is compressing output for us: | ||
654 | // it will mess up measurements | ||
655 | if($php_no_self_compress) | ||
656 | { | ||
657 | header('Content-Length: ' . (int)strlen($payload)); | ||
658 | } | ||
659 | } | ||
660 | else | ||
661 | { | ||
662 | error_log('XML-RPC: xmlrpc_server::service: http headers already sent before response is fully generated. Check for php warning or error messages'); | ||
663 | } | ||
664 | |||
665 | print $payload; | ||
666 | |||
667 | // return request, in case subclasses want it | ||
668 | return $r; | ||
669 | } | ||
670 | |||
671 | /** | ||
672 | * Add a method to the dispatch map | ||
673 | * @param string $methodname the name with which the method will be made available | ||
674 | * @param string $function the php function that will get invoked | ||
675 | * @param array $sig the array of valid method signatures | ||
676 | * @param string $doc method documentation | ||
677 | * @access public | ||
678 | */ | ||
679 | function add_to_map($methodname,$function,$sig=null,$doc='') | ||
680 | { | ||
681 | $this->dmap[$methodname] = array( | ||
682 | 'function' => $function, | ||
683 | 'docstring' => $doc | ||
684 | ); | ||
685 | if ($sig) | ||
686 | { | ||
687 | $this->dmap[$methodname]['signature'] = $sig; | ||
688 | } | ||
689 | } | ||
690 | |||
691 | /** | ||
692 | * Verify type and number of parameters received against a list of known signatures | ||
693 | * @param array $in array of either xmlrpcval objects or xmlrpc type definitions | ||
694 | * @param array $sig array of known signatures to match against | ||
695 | * @access private | ||
696 | */ | ||
697 | function verifySignature($in, $sig) | ||
698 | { | ||
699 | // check each possible signature in turn | ||
700 | if (is_object($in)) | ||
701 | { | ||
702 | $numParams = $in->getNumParams(); | ||
703 | } | ||
704 | else | ||
705 | { | ||
706 | $numParams = count($in); | ||
707 | } | ||
708 | foreach($sig as $cursig) | ||
709 | { | ||
710 | if(count($cursig)==$numParams+1) | ||
711 | { | ||
712 | $itsOK=1; | ||
713 | for($n=0; $n<$numParams; $n++) | ||
714 | { | ||
715 | if (is_object($in)) | ||
716 | { | ||
717 | $p=$in->getParam($n); | ||
718 | if($p->kindOf() == 'scalar') | ||
719 | { | ||
720 | $pt=$p->scalartyp(); | ||
721 | } | ||
722 | else | ||
723 | { | ||
724 | $pt=$p->kindOf(); | ||
725 | } | ||
726 | } | ||
727 | else | ||
728 | { | ||
729 | $pt= $in[$n] == 'i4' ? 'int' : $in[$n]; // dispatch maps never use i4... | ||
730 | } | ||
731 | |||
732 | // param index is $n+1, as first member of sig is return type | ||
733 | if($pt != $cursig[$n+1] && $cursig[$n+1] != $GLOBALS['xmlrpcValue']) | ||
734 | { | ||
735 | $itsOK=0; | ||
736 | $pno=$n+1; | ||
737 | $wanted=$cursig[$n+1]; | ||
738 | $got=$pt; | ||
739 | break; | ||
740 | } | ||
741 | } | ||
742 | if($itsOK) | ||
743 | { | ||
744 | return array(1,''); | ||
745 | } | ||
746 | } | ||
747 | } | ||
748 | if(isset($wanted)) | ||
749 | { | ||
750 | return array(0, "Wanted ${wanted}, got ${got} at param ${pno}"); | ||
751 | } | ||
752 | else | ||
753 | { | ||
754 | return array(0, "No method signature matches number of parameters"); | ||
755 | } | ||
756 | } | ||
757 | |||
758 | /** | ||
759 | * Parse http headers received along with xmlrpc request. If needed, inflate request | ||
760 | * @return null on success or an xmlrpcresp | ||
761 | * @access private | ||
762 | */ | ||
763 | function parseRequestHeaders(&$data, &$req_encoding, &$resp_encoding, &$resp_compression) | ||
764 | { | ||
765 | // Play nice to PHP 4.0.x: superglobals were not yet invented... | ||
766 | if(!isset($_SERVER)) | ||
767 | { | ||
768 | $_SERVER = $GLOBALS['HTTP_SERVER_VARS']; | ||
769 | } | ||
770 | |||
771 | if($this->debug > 1) | ||
772 | { | ||
773 | if(function_exists('getallheaders')) | ||
774 | { | ||
775 | $this->debugmsg(''); // empty line | ||
776 | foreach(getallheaders() as $name => $val) | ||
777 | { | ||
778 | $this->debugmsg("HEADER: $name: $val"); | ||
779 | } | ||
780 | } | ||
781 | |||
782 | } | ||
783 | |||
784 | if(isset($_SERVER['HTTP_CONTENT_ENCODING'])) | ||
785 | { | ||
786 | $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']); | ||
787 | } | ||
788 | else | ||
789 | { | ||
790 | $content_encoding = ''; | ||
791 | } | ||
792 | |||
793 | // check if request body has been compressed and decompress it | ||
794 | if($content_encoding != '' && strlen($data)) | ||
795 | { | ||
796 | if($content_encoding == 'deflate' || $content_encoding == 'gzip') | ||
797 | { | ||
798 | // if decoding works, use it. else assume data wasn't gzencoded | ||
799 | if(function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression)) | ||
800 | { | ||
801 | if($content_encoding == 'deflate' && $degzdata = @gzuncompress($data)) | ||
802 | { | ||
803 | $data = $degzdata; | ||
804 | if($this->debug > 1) | ||
805 | { | ||
806 | $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++"); | ||
807 | } | ||
808 | } | ||
809 | elseif($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) | ||
810 | { | ||
811 | $data = $degzdata; | ||
812 | if($this->debug > 1) | ||
813 | $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n" . $data . "\n+++END+++"); | ||
814 | } | ||
815 | else | ||
816 | { | ||
817 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_decompress_fail'], $GLOBALS['xmlrpcstr']['server_decompress_fail']); | ||
818 | return $r; | ||
819 | } | ||
820 | } | ||
821 | else | ||
822 | { | ||
823 | //error_log('The server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); | ||
824 | $r =& new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['server_cannot_decompress'], $GLOBALS['xmlrpcstr']['server_cannot_decompress']); | ||
825 | return $r; | ||
826 | } | ||
827 | } | ||
828 | } | ||
829 | |||
830 | // check if client specified accepted charsets, and if we know how to fulfill | ||
831 | // the request | ||
832 | if ($this->response_charset_encoding == 'auto') | ||
833 | { | ||
834 | $resp_encoding = ''; | ||
835 | if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) | ||
836 | { | ||
837 | // here we should check if we can match the client-requested encoding | ||
838 | // with the encodings we know we can generate. | ||
839 | /// @todo we should parse q=0.x preferences instead of getting first charset specified... | ||
840 | $client_accepted_charsets = explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET'])); | ||
841 | // Give preference to internal encoding | ||
842 | $known_charsets = array($GLOBALS['xmlrpc_internalencoding'], 'UTF-8', 'ISO-8859-1', 'US-ASCII'); | ||
843 | foreach ($known_charsets as $charset) | ||
844 | { | ||
845 | foreach ($client_accepted_charsets as $accepted) | ||
846 | if (strpos($accepted, $charset) === 0) | ||
847 | { | ||
848 | $resp_encoding = $charset; | ||
849 | break; | ||
850 | } | ||
851 | if ($resp_encoding) | ||
852 | break; | ||
853 | } | ||
854 | } | ||
855 | } | ||
856 | else | ||
857 | { | ||
858 | $resp_encoding = $this->response_charset_encoding; | ||
859 | } | ||
860 | |||
861 | if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) | ||
862 | { | ||
863 | $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING']; | ||
864 | } | ||
865 | else | ||
866 | { | ||
867 | $resp_compression = ''; | ||
868 | } | ||
869 | |||
870 | // 'guestimate' request encoding | ||
871 | /// @todo check if mbstring is enabled and automagic input conversion is on: it might mingle with this check??? | ||
872 | $req_encoding = guess_encoding(isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '', | ||
873 | $data); | ||
874 | |||
875 | return null; | ||
876 | } | ||
877 | |||
878 | /** | ||
879 | * Parse an xml chunk containing an xmlrpc request and execute the corresponding | ||
880 | * php function registered with the server | ||
881 | * @param string $data the xml request | ||
882 | * @param string $req_encoding (optional) the charset encoding of the xml request | ||
883 | * @return xmlrpcresp | ||
884 | * @access private | ||
885 | */ | ||
886 | function parseRequest($data, $req_encoding='') | ||
887 | { | ||
888 | // 2005/05/07 commented and moved into caller function code | ||
889 | //if($data=='') | ||
890 | //{ | ||
891 | // $data=$GLOBALS['HTTP_RAW_POST_DATA']; | ||
892 | //} | ||
893 | |||
894 | // G. Giunta 2005/02/13: we do NOT expect to receive html entities | ||
895 | // so we do not try to convert them into xml character entities | ||
896 | //$data = xmlrpc_html_entity_xlate($data); | ||
897 | |||
898 | $GLOBALS['_xh']=array(); | ||
899 | $GLOBALS['_xh']['ac']=''; | ||
900 | $GLOBALS['_xh']['stack']=array(); | ||
901 | $GLOBALS['_xh']['valuestack'] = array(); | ||
902 | $GLOBALS['_xh']['params']=array(); | ||
903 | $GLOBALS['_xh']['pt']=array(); | ||
904 | $GLOBALS['_xh']['isf']=0; | ||
905 | $GLOBALS['_xh']['isf_reason']=''; | ||
906 | $GLOBALS['_xh']['method']=false; // so we can check later if we got a methodname or not | ||
907 | $GLOBALS['_xh']['rt']=''; | ||
908 | |||
909 | // decompose incoming XML into request structure | ||
910 | if ($req_encoding != '') | ||
911 | { | ||
912 | if (!in_array($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
913 | // the following code might be better for mb_string enabled installs, but | ||
914 | // makes the lib about 200% slower... | ||
915 | //if (!is_valid_charset($req_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
916 | { | ||
917 | error_log('XML-RPC: xmlrpc_server::parseRequest: invalid charset encoding of received request: '.$req_encoding); | ||
918 | $req_encoding = $GLOBALS['xmlrpc_defencoding']; | ||
919 | } | ||
920 | /// @BUG this will fail on PHP 5 if charset is not specified in the xml prologue, | ||
921 | // the encoding is not UTF8 and there are non-ascii chars in the text... | ||
922 | /// @todo use an ampty string for php 5 ??? | ||
923 | $parser = xml_parser_create($req_encoding); | ||
924 | } | ||
925 | else | ||
926 | { | ||
927 | $parser = xml_parser_create(); | ||
928 | } | ||
929 | |||
930 | xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); | ||
931 | // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell | ||
932 | // the xml parser to give us back data in the expected charset | ||
933 | // What if internal encoding is not in one of the 3 allowed? | ||
934 | // we use the broadest one, ie. utf8 | ||
935 | // This allows to send data which is native in various charset, | ||
936 | // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding | ||
937 | if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) | ||
938 | { | ||
939 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8'); | ||
940 | } | ||
941 | else | ||
942 | { | ||
943 | xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']); | ||
944 | } | ||
945 | |||
946 | if ($this->functions_parameters_type != 'xmlrpcvals') | ||
947 | xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast'); | ||
948 | else | ||
949 | xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee'); | ||
950 | xml_set_character_data_handler($parser, 'xmlrpc_cd'); | ||
951 | xml_set_default_handler($parser, 'xmlrpc_dh'); | ||
952 | if(!xml_parse($parser, $data, 1)) | ||
953 | { | ||
954 | // return XML error as a faultCode | ||
955 | $r=&new xmlrpcresp(0, | ||
956 | $GLOBALS['xmlrpcerrxml']+xml_get_error_code($parser), | ||
957 | sprintf('XML error: %s at line %d, column %d', | ||
958 | xml_error_string(xml_get_error_code($parser)), | ||
959 | xml_get_current_line_number($parser), xml_get_current_column_number($parser))); | ||
960 | xml_parser_free($parser); | ||
961 | } | ||
962 | elseif ($GLOBALS['_xh']['isf']) | ||
963 | { | ||
964 | xml_parser_free($parser); | ||
965 | $r=&new xmlrpcresp(0, | ||
966 | $GLOBALS['xmlrpcerr']['invalid_request'], | ||
967 | $GLOBALS['xmlrpcstr']['invalid_request'] . ' ' . $GLOBALS['_xh']['isf_reason']); | ||
968 | } | ||
969 | else | ||
970 | { | ||
971 | xml_parser_free($parser); | ||
972 | if ($this->functions_parameters_type != 'xmlrpcvals') | ||
973 | { | ||
974 | if($this->debug > 1) | ||
975 | { | ||
976 | $this->debugmsg("\n+++PARSED+++\n".var_export($GLOBALS['_xh']['params'], true)."\n+++END+++"); | ||
977 | } | ||
978 | $r = $this->execute($GLOBALS['_xh']['method'], $GLOBALS['_xh']['params'], $GLOBALS['_xh']['pt']); | ||
979 | } | ||
980 | else | ||
981 | { | ||
982 | // build an xmlrpcmsg object with data parsed from xml | ||
983 | $m=&new xmlrpcmsg($GLOBALS['_xh']['method']); | ||
984 | // now add parameters in | ||
985 | for($i=0; $i<count($GLOBALS['_xh']['params']); $i++) | ||
986 | { | ||
987 | $m->addParam($GLOBALS['_xh']['params'][$i]); | ||
988 | } | ||
989 | |||
990 | if($this->debug > 1) | ||
991 | { | ||
992 | $this->debugmsg("\n+++PARSED+++\n".var_export($m, true)."\n+++END+++"); | ||
993 | } | ||
994 | $r = $this->execute($m); | ||
995 | } | ||
996 | } | ||
997 | return $r; | ||
998 | } | ||
999 | |||
1000 | /** | ||
1001 | * Execute a method invoked by the client, checking parameters used | ||
1002 | * @param mixed $m either an xmlrpcmsg obj or a method name | ||
1003 | * @param array $params array with method parameters as php types (if m is method name only) | ||
1004 | * @param array $paramtypes array with xmlrpc types of method parameters (if m is method name only) | ||
1005 | * @return xmlrpcresp | ||
1006 | * @access private | ||
1007 | */ | ||
1008 | function execute($m, $params=null, $paramtypes=null) | ||
1009 | { | ||
1010 | if (is_object($m)) | ||
1011 | { | ||
1012 | $methName = $m->method(); | ||
1013 | } | ||
1014 | else | ||
1015 | { | ||
1016 | $methName = $m; | ||
1017 | } | ||
1018 | $sysCall = $this->allow_system_funcs && (strpos($methName, "system.") === 0); | ||
1019 | $dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap; | ||
1020 | |||
1021 | if(!isset($dmap[$methName]['function'])) | ||
1022 | { | ||
1023 | // No such method | ||
1024 | return new xmlrpcresp(0, | ||
1025 | $GLOBALS['xmlrpcerr']['unknown_method'], | ||
1026 | $GLOBALS['xmlrpcstr']['unknown_method']); | ||
1027 | } | ||
1028 | |||
1029 | // Check signature | ||
1030 | if(isset($dmap[$methName]['signature'])) | ||
1031 | { | ||
1032 | $sig = $dmap[$methName]['signature']; | ||
1033 | if (is_object($m)) | ||
1034 | { | ||
1035 | list($ok, $errstr) = $this->verifySignature($m, $sig); | ||
1036 | } | ||
1037 | else | ||
1038 | { | ||
1039 | list($ok, $errstr) = $this->verifySignature($paramtypes, $sig); | ||
1040 | } | ||
1041 | if(!$ok) | ||
1042 | { | ||
1043 | // Didn't match. | ||
1044 | return new xmlrpcresp( | ||
1045 | 0, | ||
1046 | $GLOBALS['xmlrpcerr']['incorrect_params'], | ||
1047 | $GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}" | ||
1048 | ); | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | $func = $dmap[$methName]['function']; | ||
1053 | // let the 'class::function' syntax be accepted in dispatch maps | ||
1054 | if(is_string($func) && strpos($func, '::')) | ||
1055 | { | ||
1056 | $func = explode('::', $func); | ||
1057 | } | ||
1058 | // verify that function to be invoked is in fact callable | ||
1059 | if(!is_callable($func)) | ||
1060 | { | ||
1061 | error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler is not callable"); | ||
1062 | return new xmlrpcresp( | ||
1063 | 0, | ||
1064 | $GLOBALS['xmlrpcerr']['server_error'], | ||
1065 | $GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method" | ||
1066 | ); | ||
1067 | } | ||
1068 | |||
1069 | // If debug level is 3, we should catch all errors generated during | ||
1070 | // processing of user function, and log them as part of response | ||
1071 | if($this->debug > 2) | ||
1072 | { | ||
1073 | $GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler'); | ||
1074 | } | ||
1075 | if (is_object($m)) | ||
1076 | { | ||
1077 | if($sysCall) | ||
1078 | { | ||
1079 | $r = call_user_func($func, $this, $m); | ||
1080 | } | ||
1081 | else | ||
1082 | { | ||
1083 | $r = call_user_func($func, $m); | ||
1084 | } | ||
1085 | if (!is_a($r, 'xmlrpcresp')) | ||
1086 | { | ||
1087 | error_log("XML-RPC: xmlrpc_server::execute: function $func registered as method handler does not return an xmlrpcresp object"); | ||
1088 | if (is_a($r, 'xmlrpcval')) | ||
1089 | { | ||
1090 | $r =& new xmlrpcresp($r); | ||
1091 | } | ||
1092 | else | ||
1093 | { | ||
1094 | $r =& new xmlrpcresp( | ||
1095 | 0, | ||
1096 | $GLOBALS['xmlrpcerr']['server_error'], | ||
1097 | $GLOBALS['xmlrpcstr']['server_error'] . ": function does not return xmlrpcresp object" | ||
1098 | ); | ||
1099 | } | ||
1100 | } | ||
1101 | } | ||
1102 | else | ||
1103 | { | ||
1104 | // call a 'plain php' function | ||
1105 | if($sysCall) | ||
1106 | { | ||
1107 | array_unshift($params, $this); | ||
1108 | $r = call_user_func_array($func, $params); | ||
1109 | } | ||
1110 | else | ||
1111 | { | ||
1112 | // 3rd API convention for method-handling functions: EPI-style | ||
1113 | if ($this->functions_parameters_type == 'epivals') | ||
1114 | { | ||
1115 | $r = call_user_func_array($func, array($methName, $params, $this->user_data)); | ||
1116 | // mimic EPI behaviour: if we get an array that looks like an error, make it | ||
1117 | // an eror response | ||
1118 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) | ||
1119 | { | ||
1120 | $r =& new xmlrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']); | ||
1121 | } | ||
1122 | else | ||
1123 | { | ||
1124 | // functions using EPI api should NOT return resp objects, | ||
1125 | // so make sure we encode the return type correctly | ||
1126 | $r =& new xmlrpcresp(php_xmlrpc_encode($r, array('extension_api'))); | ||
1127 | } | ||
1128 | } | ||
1129 | else | ||
1130 | { | ||
1131 | $r = call_user_func_array($func, $params); | ||
1132 | } | ||
1133 | } | ||
1134 | // the return type can be either an xmlrpcresp object or a plain php value... | ||
1135 | if (!is_a($r, 'xmlrpcresp')) | ||
1136 | { | ||
1137 | // what should we assume here about automatic encoding of datetimes | ||
1138 | // and php classes instances??? | ||
1139 | $r =& new xmlrpcresp(php_xmlrpc_encode($r, array('auto_dates'))); | ||
1140 | } | ||
1141 | } | ||
1142 | if($this->debug > 2) | ||
1143 | { | ||
1144 | // note: restore the error handler we found before calling the | ||
1145 | // user func, even if it has been changed inside the func itself | ||
1146 | if($GLOBALS['_xmlrpcs_prev_ehandler']) | ||
1147 | { | ||
1148 | set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']); | ||
1149 | } | ||
1150 | else | ||
1151 | { | ||
1152 | restore_error_handler(); | ||
1153 | } | ||
1154 | } | ||
1155 | return $r; | ||
1156 | } | ||
1157 | |||
1158 | /** | ||
1159 | * add a string to the 'internal debug message' (separate from 'user debug message') | ||
1160 | * @param string $strings | ||
1161 | * @access private | ||
1162 | */ | ||
1163 | function debugmsg($string) | ||
1164 | { | ||
1165 | $this->debug_info .= $string."\n"; | ||
1166 | } | ||
1167 | |||
1168 | /** | ||
1169 | * @access private | ||
1170 | */ | ||
1171 | function xml_header($charset_encoding='') | ||
1172 | { | ||
1173 | if ($charset_encoding != '') | ||
1174 | { | ||
1175 | return "<?xml version=\"1.0\" encoding=\"$charset_encoding\"?" . ">\n"; | ||
1176 | } | ||
1177 | else | ||
1178 | { | ||
1179 | return "<?xml version=\"1.0\"?" . ">\n"; | ||
1180 | } | ||
1181 | } | ||
1182 | |||
1183 | /** | ||
1184 | * A debugging routine: just echoes back the input packet as a string value | ||
1185 | * DEPRECATED! | ||
1186 | */ | ||
1187 | function echoInput() | ||
1188 | { | ||
1189 | $r=&new xmlrpcresp(new xmlrpcval( "'Aha said I: '" . $GLOBALS['HTTP_RAW_POST_DATA'], 'string')); | ||
1190 | print $r->serialize(); | ||
1191 | } | ||
1192 | } | ||
1193 | ?> \ No newline at end of file | ||
diff --git a/index.php b/index.php new file mode 100644 index 0000000..12ba2ab --- /dev/null +++ b/index.php | |||
@@ -0,0 +1,56 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 index.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | require('headerproc.php'); | ||
22 | |||
23 | header('X-Pingback: http://www.fourisland.com/xmlrpc.php'); | ||
24 | |||
25 | include('../security/config.php'); | ||
26 | include('includes/db.php'); | ||
27 | include('includes/template.php'); | ||
28 | include('includes/session.php'); | ||
29 | include('includes/bbcode.php'); | ||
30 | include('includes/xmlrpc/xmlrpc.inc'); | ||
31 | include('includes/specialdates.php'); | ||
32 | include('includes/functions.php'); | ||
33 | include('includes/hits.php'); | ||
34 | include('includes/updatePending.php'); | ||
35 | |||
36 | ob_start(); | ||
37 | |||
38 | $pageName = isset($_GET['area']) ? $_GET['area'] : 'welcome'; | ||
39 | |||
40 | if (file_exists('pages/' . $pageName . '.php')) | ||
41 | { | ||
42 | include('pages/' . $pageName . '.php'); | ||
43 | } else { | ||
44 | generateError('404'); | ||
45 | } | ||
46 | |||
47 | $doc = ob_get_contents(); | ||
48 | ob_end_clean(); | ||
49 | |||
50 | $doc = stripslashes($doc); | ||
51 | |||
52 | include('includes/header.php'); | ||
53 | echo($doc); | ||
54 | include('includes/footer.php'); | ||
55 | |||
56 | ?> | ||
diff --git a/ipdetails.txt b/ipdetails.txt new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/ipdetails.txt | |||
@@ -0,0 +1 @@ | |||
diff --git a/pages/addresses.php b/pages/addresses.php new file mode 100644 index 0000000..c97dfad --- /dev/null +++ b/pages/addresses.php | |||
@@ -0,0 +1,74 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 includes/addresses.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $title = 'A Gift for our Robot Friends'; | ||
26 | |||
27 | $template = new FITemplate('addresses'); | ||
28 | |||
29 | $acceptable = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', | ||
30 | 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); | ||
31 | $numAcceptable = count($acceptable) - 1; | ||
32 | |||
33 | $longerTopDomains = array( 'com', 'net', 'gov', 'org', 'info', 'biz', | ||
34 | 'edu', 'pro', 'name','co'); | ||
35 | $numTops = count($longerTopDomains) - 1; | ||
36 | |||
37 | $maxLettersBefore = 20; | ||
38 | $maxDomainLength = 20; | ||
39 | |||
40 | for ($i = 0; $i < 1000; $i++) | ||
41 | { | ||
42 | $addy = ''; | ||
43 | |||
44 | $numLetters = mt_rand(1, $maxLettersBefore); | ||
45 | |||
46 | for ($b = 0; $b < $numLetters; $b++) | ||
47 | { | ||
48 | $addy .= $acceptable[mt_rand(0, $numAcceptable)]; | ||
49 | } | ||
50 | |||
51 | $addy .= '@'; | ||
52 | |||
53 | $numLetters = mt_rand(1, $maxDomainLength); | ||
54 | |||
55 | for ($b = 0; $b < $numLetters; $b++) | ||
56 | { | ||
57 | $addy .= $acceptable[mt_rand(0, $numAcceptable)]; | ||
58 | } | ||
59 | |||
60 | $addy .= '.'; | ||
61 | |||
62 | if (mt_rand(1, 2) == 1) | ||
63 | { | ||
64 | $addy .= $longerTopDomains[mt_rand(0, $numTops)] . '.' . $acceptable[mt_rand(0, $numAcceptable)] . $acceptable[mt_rand(0, $numAcceptable)]; | ||
65 | } else { | ||
66 | $addy .= $longerTopDomains[mt_rand(0, $numTops)]; | ||
67 | } | ||
68 | |||
69 | $template->adds_block('ADDRESS', array('ADDY' => $addy)); | ||
70 | } | ||
71 | |||
72 | $template->display(); | ||
73 | |||
74 | ?> | ||
diff --git a/pages/admin.php b/pages/admin.php new file mode 100644 index 0000000..ca7a7fa --- /dev/null +++ b/pages/admin.php | |||
@@ -0,0 +1,661 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/admin.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'panel'; | ||
26 | |||
27 | if (isLoggedIn()) | ||
28 | { | ||
29 | if (getUserlevel() == 1) | ||
30 | { | ||
31 | if (!isset($_GET['page'])) | ||
32 | { | ||
33 | $template = new FITemplate('admin/index'); | ||
34 | } else if ($_GET['page'] == 'writePost') | ||
35 | { | ||
36 | if (!isset($_GET['submit'])) | ||
37 | { | ||
38 | $template = new FITemplate('admin/write'); | ||
39 | } else { | ||
40 | if ($_POST['type'] == 'draft') | ||
41 | { | ||
42 | $insdraft = "INSERT INTO drafts (title,author,text,tag1,tag2,tag3,slug) VALUES (\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
43 | $insdraft2 = mysql_query($insdraft); | ||
44 | |||
45 | $getdraft = "SELECT * FROM drafts ORDER BY id DESC LIMIT 0,1"; | ||
46 | $getdraft2 = mysql_query($getdraft); | ||
47 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
48 | |||
49 | $template = new FITemplate('admin/draftSuccess'); | ||
50 | $template->add('ID', $getdraft3['id']); | ||
51 | } else if ($_POST['type'] == 'instant') | ||
52 | { | ||
53 | postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); | ||
54 | |||
55 | $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; | ||
56 | $getpost2 = mysql_query($getpost); | ||
57 | $getpost3 = mysql_fetch_array($getpost2); | ||
58 | |||
59 | $template = new FITemplate('admin/postSuccess'); | ||
60 | $template->add('ID', $getpost3['id']); | ||
61 | $template->add('CODED', $getpost3['slug']); | ||
62 | } else { | ||
63 | if ($_POST['type'] == 'normal') | ||
64 | { | ||
65 | $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; | ||
66 | $getpending2 = mysql_query($getpending); | ||
67 | $getpending3 = mysql_fetch_array($getpending2); | ||
68 | if (isset($getpending3['id']) === FALSE) | ||
69 | { | ||
70 | $id = 50; | ||
71 | } else { | ||
72 | $id = $getpending3['id']+1; | ||
73 | } | ||
74 | } else if ($_POST['type'] == 'priority') | ||
75 | { | ||
76 | $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | ||
77 | $getpending2 = mysql_query($getpending); | ||
78 | $getpending3 = mysql_fetch_array($getpending2); | ||
79 | if (isset($getpending3['id']) === FALSE) | ||
80 | { | ||
81 | $id = 50; | ||
82 | } else { | ||
83 | $id = $getpending3['id']-1; | ||
84 | } | ||
85 | } else { | ||
86 | generateError(404); | ||
87 | } | ||
88 | |||
89 | $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
90 | $inspending2 = mysql_query($inspending); | ||
91 | |||
92 | $template = new FITemplate('admin/pendingSuccess'); | ||
93 | $template->add('ID', $id); | ||
94 | } | ||
95 | } | ||
96 | } else if ($_GET['page'] == 'manageDrafts') | ||
97 | { | ||
98 | $template = new FITemplate('admin/manageDrafts'); | ||
99 | |||
100 | $getdrafts = "SELECT * FROM drafts ORDER BY id ASC"; | ||
101 | $getdrafts2 = mysql_query($getdrafts); | ||
102 | $i=0; | ||
103 | while ($getdrafts3[$i] = mysql_fetch_array($getdrafts2)) | ||
104 | { | ||
105 | $template->adds_block('DRAFT', array( 'TITLE' => $getdrafts3[$i]['title'], | ||
106 | 'AUTHOR' => $getdrafts3[$i]['author'], | ||
107 | 'ID' => $getdrafts3[$i]['id'])); | ||
108 | $i++; | ||
109 | } | ||
110 | } else if ($_GET['page'] == 'editDraft') | ||
111 | { | ||
112 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
113 | $getdraft2 = mysql_query($getdraft); | ||
114 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
115 | |||
116 | if ($getdraft3['id'] == $_GET['id']) | ||
117 | { | ||
118 | if (!isset($_GET['submit'])) | ||
119 | { | ||
120 | $template = new FITemplate('admin/editDraft'); | ||
121 | $template->add('ID', $_GET['id']); | ||
122 | $template->add('TEXT', $getdraft3['text']); | ||
123 | $template->add('TAG1', $getdraft3['tag1']); | ||
124 | $template->add('TAG2', $getdraft3['tag2']); | ||
125 | $template->add('TAG3', $getdraft3['tag3']); | ||
126 | $template->add('TITLE', $getdraft3['title']); | ||
127 | } else { | ||
128 | if ($_POST['type'] == 'draft') | ||
129 | { | ||
130 | $setdraft = "UPDATE drafts SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
131 | $setdraft2 = mysql_query($setdraft); | ||
132 | |||
133 | $template = new FITemplate('admin/draftSuccess'); | ||
134 | $template->add('ID', $_GET['id']); | ||
135 | } else if ($_POST['type'] == 'instant') | ||
136 | { | ||
137 | postBlogPost($_POST['title'], sess_get('uname'), $_POST['tag1'], $_POST['tag2'], $_POST['tag3'], $_POST['text']); | ||
138 | |||
139 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
140 | $deldraft2 = mysql_query($deldraft); | ||
141 | |||
142 | $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,1"; | ||
143 | $getpost2 = mysql_query($getpost); | ||
144 | $getpost3 = mysql_fetch_array($getpost2); | ||
145 | |||
146 | $template = new FITemplate('admin/postSuccess'); | ||
147 | $template->add('ID', $getpost3['id']); | ||
148 | $template->add('CODED', $getpost3['slug']); | ||
149 | } else { | ||
150 | if ($_POST['type'] == 'normal') | ||
151 | { | ||
152 | $getpending = "SELECT * FROM pending ORDER BY id DESC LIMIT 0,1"; | ||
153 | $getpending2 = mysql_query($getpending); | ||
154 | $getpending3 = mysql_fetch_array($getpending2); | ||
155 | if (isset($getpending3['id']) === FALSE) | ||
156 | { | ||
157 | $id = 50; | ||
158 | } else { | ||
159 | $id = $getpending3['id']+1; | ||
160 | } | ||
161 | } else if ($_POST['type'] == 'priority') | ||
162 | { | ||
163 | $getpending = "SELECT * FROM pending ORDER BY id ASC LIMIT 0,1"; | ||
164 | $getpending2 = mysql_query($getpending); | ||
165 | $getpending3 = mysql_fetch_array($getpending2); | ||
166 | if (isset($getpending3['id']) === FALSE) | ||
167 | { | ||
168 | $id = 50; | ||
169 | } else { | ||
170 | $id = $getpending3['id']-1; | ||
171 | } | ||
172 | } else { | ||
173 | generateError(404); | ||
174 | } | ||
175 | |||
176 | $inspending = "INSERT INTO pending (id,title,author,text,tag1,tag2,tag3,slug) VALUES (" . $id . ",\"" . addslashes($_POST['title']) . "\",\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\",\"" . $_POST['tag1'] . "\",\"" . $_POST['tag2'] . "\",\"" . $_POST['tag3'] . "\",\"" . generateSlug($_POST['title'],'updates') . "\")"; | ||
177 | $inspending2 = mysql_query($inspending); | ||
178 | |||
179 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
180 | $deldraft2 = mysql_query($deldraft); | ||
181 | |||
182 | $template = new FITemplate('admin/pendingSuccess'); | ||
183 | $template->add('ID', $id); | ||
184 | } | ||
185 | } | ||
186 | } else { | ||
187 | $template = new FITemplate('msg'); | ||
188 | $template->add('BACK', 'the previous page'); | ||
189 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
190 | } | ||
191 | } else if ($_GET['page'] == 'deleteDraft') | ||
192 | { | ||
193 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
194 | $getdraft2 = mysql_query($getdraft); | ||
195 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
196 | |||
197 | if ($getdraft3['id'] == $_GET['id']) | ||
198 | { | ||
199 | if (!isset($_GET['submit'])) | ||
200 | { | ||
201 | $template = new FITemplate('admin/deleteDraft'); | ||
202 | $template->add('ID', $_GET['id']); | ||
203 | } else { | ||
204 | $deldraft = "DELETE FROM drafts WHERE id = " . $_GET['id']; | ||
205 | $deldraft2 = mysql_query($deldraft); | ||
206 | |||
207 | $template = new FITemplate('admin/deletedDraft'); | ||
208 | } | ||
209 | } else { | ||
210 | $template = new FITemplate('msg'); | ||
211 | $template->add('BACK', 'the previous page'); | ||
212 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
213 | } | ||
214 | } else if ($_GET['page'] == 'viewDraft') | ||
215 | { | ||
216 | $getdraft = "SELECT * FROM drafts WHERE id = " . $_GET['id']; | ||
217 | $getdraft2 = mysql_query($getdraft); | ||
218 | $getdraft3 = mysql_fetch_array($getdraft2); | ||
219 | |||
220 | if ($getdraft3['id'] == $_GET['id']) | ||
221 | { | ||
222 | $template = new FITemplate('post'); | ||
223 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
224 | $template->adds_block('POST', array( 'ID' => $getdraft3['id'], | ||
225 | 'YEARID' => ((date('Y')-2006) % 4), | ||
226 | 'DATE' => date('F dS Y \a\\t g:i:s a'), | ||
227 | 'MONTH' => date('M'), | ||
228 | 'DAY' => date('d'), | ||
229 | 'CODED' => $getdraft3['slug'], | ||
230 | 'TITLE' => $getdraft3['title'], | ||
231 | 'AUTHOR' => $getdraft3['author'], | ||
232 | 'TAG1' => $getdraft3['tag1'], | ||
233 | 'TAG2' => $getdraft3['tag2'], | ||
234 | 'TAG3' => $getdraft3['tag3'], | ||
235 | 'RATING' => 0, | ||
236 | 'TEXT' => parseBBCode($getdraft3['text']))); | ||
237 | } else { | ||
238 | $template = new FITemplate('msg'); | ||
239 | $template->add('BACK', 'the previous page'); | ||
240 | $template->add('MSG', 'I\'m sorry, that draft doesn\'t exist.'); | ||
241 | } | ||
242 | } else if ($_GET['page'] == 'managePending') | ||
243 | { | ||
244 | $template = new FITemplate('admin/managePending'); | ||
245 | |||
246 | $getpending = "SELECT * FROM pending ORDER BY id ASC"; | ||
247 | $getpending2 = mysql_query($getpending); | ||
248 | $i=0; | ||
249 | while ($getpending3[$i] = mysql_fetch_array($getpending2)) | ||
250 | { | ||
251 | $template->adds_block('PENDING', array( 'TITLE' => $getpending3[$i]['title'], | ||
252 | 'AUTHOR' => $getpending3[$i]['author'], | ||
253 | 'ID' => $getpending3[$i]['id'])); | ||
254 | $i++; | ||
255 | } | ||
256 | } else if ($_GET['page'] == 'editPending') | ||
257 | { | ||
258 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
259 | $getpending2 = mysql_query($getpending); | ||
260 | $getpending3 = mysql_fetch_array($getpending2); | ||
261 | |||
262 | if ($getpending3['id'] == $_GET['id']) | ||
263 | { | ||
264 | if (!isset($_GET['submit'])) | ||
265 | { | ||
266 | $template = new FITemplate('admin/editPending'); | ||
267 | $template->add('ID', $_GET['id']); | ||
268 | $template->add('TEXT', $getpending3['text']); | ||
269 | $template->add('TAG1', $getpending3['tag1']); | ||
270 | $template->add('TAG2', $getpending3['tag2']); | ||
271 | $template->add('TAG3', $getpending3['tag3']); | ||
272 | $template->add('TITLE', $getpending3['title']); | ||
273 | } else { | ||
274 | $setpending = "UPDATE pending SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
275 | $setpending2 = mysql_query($setpending); | ||
276 | |||
277 | $template = new FITemplate('admin/pendingSuccess'); | ||
278 | $template->add('ID', $_GET['id']); | ||
279 | } | ||
280 | } else { | ||
281 | $template = new FITemplate('msg'); | ||
282 | $template->add('BACK', 'the previous page'); | ||
283 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
284 | } | ||
285 | } else if ($_GET['page'] == 'deletePending') | ||
286 | { | ||
287 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
288 | $getpending2 = mysql_query($getpending); | ||
289 | $getpending3 = mysql_fetch_array($getpending2); | ||
290 | |||
291 | if ($getpending3['id'] == $_GET['id']) | ||
292 | { | ||
293 | if (!isset($_GET['submit'])) | ||
294 | { | ||
295 | $template = new FITemplate('admin/deletePending'); | ||
296 | $template->add('ID', $_GET['id']); | ||
297 | } else { | ||
298 | $delpending = "DELETE FROM pending WHERE id = " . $_GET['id']; | ||
299 | $delpending2 = mysql_query($delpending); | ||
300 | |||
301 | $template = new FITemplate('admin/deletedPending'); | ||
302 | } | ||
303 | } else { | ||
304 | $template = new FITemplate('msg'); | ||
305 | $template->add('BACK', 'the previous page'); | ||
306 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
307 | } | ||
308 | } else if ($_GET['page'] == 'viewPending') | ||
309 | { | ||
310 | $getpending = "SELECT * FROM pending WHERE id = " . $_GET['id']; | ||
311 | $getpending2 = mysql_query($getpending); | ||
312 | $getpending3 = mysql_fetch_array($getpending2); | ||
313 | |||
314 | if ($getpending3['id'] == $_GET['id']) | ||
315 | { | ||
316 | $template = new FITemplate('post'); | ||
317 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
318 | $template->adds_block('POST', array( 'ID' => $getpending3['id'], | ||
319 | 'YEARID' => ((date('Y')-2006) % 4), | ||
320 | 'DATE' => date('F dS Y \a\\t g:i:s a'), | ||
321 | 'MONTH' => date('M'), | ||
322 | 'DAY' => date('d'), | ||
323 | 'CODED' => $getpending3['slug'], | ||
324 | 'TITLE' => $getpending3['title'], | ||
325 | 'AUTHOR' => $getpending3['author'], | ||
326 | 'TAG1' => $getpending3['tag1'], | ||
327 | 'TAG2' => $getpending3['tag2'], | ||
328 | 'TAG3' => $getpending3['tag3'], | ||
329 | 'RATING' => 0, | ||
330 | 'TEXT' => parseBBCode($getpending3['text']))); | ||
331 | } else { | ||
332 | $template = new FITemplate('msg'); | ||
333 | $template->add('BACK', 'the previous page'); | ||
334 | $template->add('MSG', 'I\'m sorry, that pending post doesn\'t exist.'); | ||
335 | } | ||
336 | } else if ($_GET['page'] == 'managePosts') | ||
337 | { | ||
338 | $template = new FITemplate('admin/managePosts'); | ||
339 | |||
340 | $getposts = "SELECT * FROM updates ORDER BY id ASC"; | ||
341 | $getposts2 = mysql_query($getposts); | ||
342 | $i=0; | ||
343 | while ($getposts3[$i] = mysql_fetch_array($getposts2)) | ||
344 | { | ||
345 | $template->adds_block('POST', array( 'TITLE' => $getposts3[$i]['title'], | ||
346 | 'AUTHOR' => $getposts3[$i]['author'], | ||
347 | 'ID' => $getposts3[$i]['id'], | ||
348 | 'CODED' => $getposts3[$i]['slug'])); | ||
349 | $i++; | ||
350 | } | ||
351 | } else if ($_GET['page'] == 'editPost') | ||
352 | { | ||
353 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | ||
354 | $getpost2 = mysql_query($getpost); | ||
355 | $getpost3 = mysql_fetch_array($getpost2); | ||
356 | |||
357 | if ($getpost3['id'] == $_GET['id']) | ||
358 | { | ||
359 | if (!isset($_GET['submit'])) | ||
360 | { | ||
361 | $template = new FITemplate('admin/editPost'); | ||
362 | $template->add('ID', $_GET['id']); | ||
363 | $template->add('TEXT', $getpost3['text']); | ||
364 | $template->add('TAG1', $getpost3['tag1']); | ||
365 | $template->add('TAG2', $getpost3['tag2']); | ||
366 | $template->add('TAG3', $getpost3['tag3']); | ||
367 | $template->add('TITLE', $getpost3['title']); | ||
368 | } else { | ||
369 | $setpost = "UPDATE updates SET title = \"" . addslashes($_POST['title']) . "\", text = \"" . addslashes($_POST['text']) . "\", tag1 = \"" . $_POST['tag1'] . "\", tag2 = \"" . $_POST['tag2'] . "\", tag3 = \"" . $_POST['tag3'] . "\" WHERE id = " . $_GET['id']; | ||
370 | $setpost2 = mysql_query($setpost); | ||
371 | |||
372 | $template = new FITemplate('admin/postSuccess'); | ||
373 | $template->add('ID', $_GET['id']); | ||
374 | $template->add('CODED', $getpost3['slug']); | ||
375 | } | ||
376 | } else { | ||
377 | $template = new FITemplate('msg'); | ||
378 | $template->add('BACK', 'the previous page'); | ||
379 | $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); | ||
380 | } | ||
381 | } else if ($_GET['page'] == 'deletePost') | ||
382 | { | ||
383 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | ||
384 | $getpost2 = mysql_query($getpost); | ||
385 | $getpost3 = mysql_fetch_array($getpost2); | ||
386 | |||
387 | if ($getpost3['id'] == $_GET['id']) | ||
388 | { | ||
389 | if (!isset($_GET['submit'])) | ||
390 | { | ||
391 | $template = new FITemplate('admin/deletePost'); | ||
392 | $template->add('ID', $_GET['id']); | ||
393 | } else { | ||
394 | $delpost = "DELETE FROM updates WHERE id = " . $_GET['id']; | ||
395 | $delpost2 = mysql_query($delpost); | ||
396 | |||
397 | $template = new FITemplate('admin/deletedPost'); | ||
398 | } | ||
399 | } else { | ||
400 | $template = new FITemplate('msg'); | ||
401 | $template->add('BACK', 'the previous page'); | ||
402 | $template->add('MSG', 'I\'m sorry, that post doesn\'t exist.'); | ||
403 | } | ||
404 | } else if ($_GET['page'] == 'moderateComments') | ||
405 | { | ||
406 | $template = new FITemplate('admin/moderateComments'); | ||
407 | |||
408 | $getcomments = "SELECT * FROM moderation ORDER BY id ASC"; | ||
409 | $getcomments2 = mysql_query($getcomments); | ||
410 | $i=0; | ||
411 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
412 | { | ||
413 | $comType = substr($getcomments3[$i]['page_id'],0,strpos($getcomments3[$i]['page_id'],'-')); | ||
414 | $comID = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
415 | |||
416 | if ($comType == 'updates') | ||
417 | { | ||
418 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
419 | $getpost2 = mysql_query($getpost); | ||
420 | $getpost3 = mysql_fetch_array($getpost2); | ||
421 | $title = $getpost3['title']; | ||
422 | } else if ($comType = 'polloftheweek') | ||
423 | { | ||
424 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; | ||
425 | $getpoll2 = mysql_query($getpoll); | ||
426 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
427 | $title = $getpoll3['question']; | ||
428 | } else if ($comType = 'quotes') | ||
429 | { | ||
430 | $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; | ||
431 | $getquote2 = mysql_query($getquote); | ||
432 | $getquote3 = mysql_fetch_array($getquote2); | ||
433 | $title = '#' . $getquote3['id']; | ||
434 | } | ||
435 | |||
436 | $template->adds_block('COMMENT', array( 'TITLE' => $title, | ||
437 | 'AUTHOR' => $getcomments3[$i]['author'], | ||
438 | 'ID' => $getcomments3[$i]['id'])); | ||
439 | $i++; | ||
440 | } | ||
441 | } else if ($_GET['page'] == 'viewComment') | ||
442 | { | ||
443 | $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; | ||
444 | $getcomment2 = mysql_query($getcomment); | ||
445 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
446 | |||
447 | if ($getcomment3['id'] == $_GET['id']) | ||
448 | { | ||
449 | $getuser = "SELECT * FROM users WHERE username = \"" . $getcomment3['author'] . "\""; | ||
450 | $getuser2 = mysql_query($getuser); | ||
451 | $getuser3 = mysql_fetch_array($getuser2); | ||
452 | |||
453 | $template = new FITemplate('admin/viewComment'); | ||
454 | $template->add('ID', $_GET['id']); | ||
455 | $template->add('USERNAME', $getcomment3['author']); | ||
456 | $template->add('CODEDEMAIL', md5(strtolower($getuser3['email']))); | ||
457 | $template->add('TEXT', parseBBCode($getcomment3['comment'])); | ||
458 | $template->add('DATE', date("F dS Y \a\\t g:i:s a",strtotime($getcomment3['pubDate']))); | ||
459 | $template->add('CODEDDEF',urlencode('http://www.fourisland.com/images/error404.png')); | ||
460 | } else { | ||
461 | $template = new FITemplate('msg'); | ||
462 | $template->add('BACK', 'the previous page'); | ||
463 | $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); | ||
464 | } | ||
465 | } else if ($_GET['page'] == 'actionComment') | ||
466 | { | ||
467 | $getcomment = "SELECT * FROM moderation WHERE id = " . $_GET['id']; | ||
468 | $getcomment2 = mysql_query($getcomment); | ||
469 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
470 | |||
471 | if ($getcomment3['id'] == $_GET['id']) | ||
472 | { | ||
473 | if (isset($_GET['approve'])) | ||
474 | { | ||
475 | $insanon = "INSERT INTO anon_commenters (username,email,website) VALUES (\"" . $getcomment3['author'] . "\",\"" . $getcomment3['email'] . "\",\"" . $getcomment3['website'] . "\")"; | ||
476 | $insanon2 = mysql_query($insanon); | ||
477 | |||
478 | $inscomment = "INSERT INTO comments (page_id,username,comment) VALUES (\"" . $getcomment3['page_id'] . "\",\"" . $getcomment3['author'] . "\",\"" . $getcomment3['comment'] . "\")"; | ||
479 | $inscomment2 = mysql_query($inscomment); | ||
480 | |||
481 | $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; | ||
482 | $delcomment2 = mysql_query($delcomment); | ||
483 | |||
484 | $template = new FITemplate('msg'); | ||
485 | $template->add('BACK', 'Comment Moderation'); | ||
486 | $template->add('MSG', 'You\'ve successfully approved this comment.'); | ||
487 | } else if (isset($_GET['deny'])) | ||
488 | { | ||
489 | $delcomment = "DELETE FROM moderation WHERE id = " . $getcomment3['id']; | ||
490 | $delcomment2 = mysql_query($delcomment); | ||
491 | |||
492 | $template = new FITemplate('msg'); | ||
493 | $template->add('BACK', 'Comment Moderation'); | ||
494 | $template->add('MSG', 'You\'ve successfully denied this comment.'); | ||
495 | } else { | ||
496 | $template = new FITemplate('msg'); | ||
497 | $template->add('BACK', 'the previous page'); | ||
498 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
499 | } | ||
500 | } else { | ||
501 | $template = new FITemplate('msg'); | ||
502 | $template->add('BACK', 'the previous page'); | ||
503 | $template->add('MSG', 'I\'m sorry, that comment doesn\'t exist.'); | ||
504 | } | ||
505 | } else if ($_GET['page'] == 'managePages') | ||
506 | { | ||
507 | $template = new FITemplate('admin/managePages'); | ||
508 | |||
509 | $getpages = "SELECT wiki_pages.*, wiki_revisions.author FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY id ASC"; | ||
510 | $getpages2 = mysql_query($getpages); | ||
511 | $i=0; $template = new FITemplate('msg'); | ||
512 | $template->add('BACK', 'the previous page'); | ||
513 | $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); | ||
514 | while ($getpages3[$i] = mysql_fetch_array($getpages2)) | ||
515 | { | ||
516 | $template->adds_block('PAGE', array( 'TITLE' => $getpages3[$i]['title'], | ||
517 | 'AUTHOR' => $getpages3[$i]['author'], | ||
518 | 'ID' => $getpages3[$i]['id'], | ||
519 | 'CODED' => $getpages3[$i]['slug'])); | ||
520 | $i++; | ||
521 | } | ||
522 | } else if ($_GET['page'] == 'pageHistory') | ||
523 | { | ||
524 | $getpage = "SELECT * FROM wiki_pages WHERE id = " . $_GET['id'] . " ORDER BY id ASC"; | ||
525 | $getpage2 = mysql_query($getpage); | ||
526 | $getpage3 = mysql_fetch_array($getpage2); | ||
527 | |||
528 | if ($getpage3['id'] == $_GET['id']) | ||
529 | { | ||
530 | $template = new FITemplate('admin/pageHistory'); | ||
531 | |||
532 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; | ||
533 | $getrev2 = mysql_query($getrev); | ||
534 | $getrev3 = mysql_fetch_array($getrev2); | ||
535 | |||
536 | $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], | ||
537 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), | ||
538 | 'ID' => $getrev3['id'])); | ||
539 | |||
540 | while ($getrev3['previous'] != 0) | ||
541 | { | ||
542 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getrev3['previous']; | ||
543 | $getrev2 = mysql_query($getrev); | ||
544 | $getrev3 = mysql_fetch_array($getrev2); | ||
545 | |||
546 | $template->adds_block('REV', array( 'AUTHOR' => $getrev3['author'], | ||
547 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrev3['pubDate'])), | ||
548 | 'ID' => $getrev3['id'])); | ||
549 | } | ||
550 | } else { | ||
551 | $template = new FITemplate('msg'); | ||
552 | $template->add('BACK', 'the previous page'); | ||
553 | $template->add('MSG', 'I\'m sorry, but this page doesn\'t exist.'); | ||
554 | } | ||
555 | } else if ($_GET['page'] == 'viewRevision') | ||
556 | { | ||
557 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $_GET['id']; | ||
558 | $getrev2 = mysql_query($getrev); | ||
559 | $getrev3 = mysql_fetch_array($getrev2); | ||
560 | |||
561 | if ($getrev3['id'] == $_GET['id']) | ||
562 | { | ||
563 | $template = new FITemplate('admin/viewRevision'); | ||
564 | $template->add('TEXT', $getrev3['text']); | ||
565 | } else { | ||
566 | $template = new FITemplate('msg'); | ||
567 | $template->add('BACK', 'the previous page'); | ||
568 | $template->add('MSG', 'I\'m sorry, but this revision doesn\'t exist.'); | ||
569 | } | ||
570 | } else if ($_GET['page'] == 'pollProcess') | ||
571 | { | ||
572 | if (!isset($_GET['step'])) | ||
573 | { | ||
574 | $template = new FITemplate('admin/pollrss'); | ||
575 | } else if ($_GET['step'] == 2) | ||
576 | { | ||
577 | $insrss = "INSERT INTO pollrss (author,rss) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")"; | ||
578 | $insrss2 = mysql_query($insrss); | ||
579 | |||
580 | $template = new FITemplate('admin/newPoll'); | ||
581 | } else if ($_GET['step'] == 3) | ||
582 | { | ||
583 | $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4) VALUES (\"" . addslashes($_POST['question']) . "\",\"" . $_POST['option1'] . "\",\"" . $_POST['option2'] . "\",\"" . $_POST['option3'] . "\",\"" . $_POST['option4'] . "\")"; | ||
584 | $inspoll2 = mysql_query($inspoll); | ||
585 | |||
586 | $cleardid = "TRUNCATE TABLE didpollalready"; | ||
587 | $cleardid2 = mysql_query($cleardid); | ||
588 | |||
589 | $template = new FITemplate('msg2'); | ||
590 | $template->add('BACK', 'Back to the Admin Panel'); | ||
591 | $template->add('LINK', '/admin/'); | ||
592 | $template->add('MSG', "You've successfully created a poll!"); | ||
593 | } else { | ||
594 | $template = new FITemplate('msg'); | ||
595 | $template->add('BACK', 'the previous page'); | ||
596 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
597 | } | ||
598 | } else if ($_GET['page'] == 'managePendingQuotes') | ||
599 | { | ||
600 | $template = new FITemplate('admin/managePendingQuotes'); | ||
601 | |||
602 | $getpending = "SELECT * FROM rash_queue ORDER BY id ASC"; | ||
603 | $getpending2 = mysql_query($getpending); | ||
604 | $i=0; | ||
605 | while ($getpending3[$i] = mysql_fetch_array($getpending2)) | ||
606 | { | ||
607 | $template->adds_block('QUOTE', array( 'ID' => $getpending3[$i]['id'], | ||
608 | 'TEXT' => $getpending3[$i]['quote'])); | ||
609 | $i++; | ||
610 | } | ||
611 | } else if ($_GET['page'] == 'actionPendingQuotes') | ||
612 | { | ||
613 | $getpending = "SELECT * FROM rash_queue WHERE id = " . $_GET['id']; | ||
614 | $getpending2 = mysql_query($getpending); | ||
615 | $getpending3 = mysql_fetch_array($getpending2); | ||
616 | |||
617 | if ($getpending3['id'] == $_GET['id']) | ||
618 | { | ||
619 | if (isset($_GET['approve'])) | ||
620 | { | ||
621 | $insquote = "INSERT INTO rash_quotes (quote) VALUES (\"" . addslashes($getpending3['quote']) . "\")"; | ||
622 | $insquote2 = mysql_query($insquote); | ||
623 | |||
624 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; | ||
625 | $delpending2 = mysql_query($delpending); | ||
626 | |||
627 | $template = new FITemplate('msg2'); | ||
628 | $template->add('BACK', 'Back to the Admin Panel'); | ||
629 | $template->add('LINK', '/admin/'); | ||
630 | $template->add('MSG', "You've successfully approved this quote."); | ||
631 | } else if (isset($_GET['deny'])) | ||
632 | { | ||
633 | $delpending = "DELETE FROM rash_queue WHERE id = " . $_GET['id']; | ||
634 | $delpending2 = mysql_query($delpending); | ||
635 | |||
636 | $template = new FITemplate('msg2'); | ||
637 | $template->add('BACK', 'Back to the Admin Panel'); | ||
638 | $template->add('LINK', '/admin/'); | ||
639 | $template->add('MSG', "You've successfully denied this quote."); | ||
640 | } else { | ||
641 | $template = new FITemplate('msg'); | ||
642 | $template->add('BACK', 'the previous page'); | ||
643 | $template->add('MSG', "Um, what on earth are you doing?"); | ||
644 | } | ||
645 | } else { | ||
646 | $template = new FITemplate('msg'); | ||
647 | $template->add('BACK', 'the previous page'); | ||
648 | $template->add('MSG', 'I\'m sorry, but this pending quote doesn\'t exist.'); | ||
649 | } | ||
650 | } else { | ||
651 | generateError(404); | ||
652 | } | ||
653 | @$template->display(); | ||
654 | } else { | ||
655 | generateError(404); | ||
656 | } | ||
657 | } else { | ||
658 | generateError(404); | ||
659 | } | ||
660 | |||
661 | ?> | ||
diff --git a/pages/blog.php b/pages/blog.php new file mode 100644 index 0000000..93d5dc6 --- /dev/null +++ b/pages/blog.php | |||
@@ -0,0 +1,197 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/blog.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'home'; | ||
26 | $pageAID = 'archive'; | ||
27 | |||
28 | if (isset($_GET['post'])) | ||
29 | { | ||
30 | $template = new FITemplate('post'); | ||
31 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
32 | |||
33 | $getpost = "SELECT * FROM updates WHERE slug = \"" . urldecode($_GET['post']) . "\""; | ||
34 | $getpost2 = mysql_query($getpost); | ||
35 | $getpost3 = mysql_fetch_array($getpost2); | ||
36 | |||
37 | if ($getpost3['slug'] == urldecode($_GET['post'])) | ||
38 | { | ||
39 | updatePop($getpost3['id'],'views'); | ||
40 | |||
41 | $title = stripslashes($getpost3['title']) . ' - Blog Archive'; | ||
42 | |||
43 | $getback = "SELECT * FROM updates WHERE id = " . ($getpost3['id']-1); | ||
44 | $getback2 = mysql_query($getback); | ||
45 | $getback3 = mysql_fetch_array($getback2); | ||
46 | if (isset($getback3['title'])) | ||
47 | { | ||
48 | $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], | ||
49 | 'TITLE' => $getback3['title'])); | ||
50 | } | ||
51 | |||
52 | $getnext = "SELECT * FROM updates WHERE id = " . ($getpost3['id']+1); | ||
53 | $getnext2 = mysql_query($getnext); | ||
54 | $getnext3 = mysql_fetch_array($getnext2); | ||
55 | if (isset($getnext3['title'])) | ||
56 | { | ||
57 | $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], | ||
58 | 'TITLE' => $getnext3['title'])); | ||
59 | } | ||
60 | |||
61 | $template->adds_block('POST', array( 'ID' => $getpost3['id'], | ||
62 | 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), | ||
63 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), | ||
64 | 'MONTH' => date('M',strtotime($getpost3['pubDate'])), | ||
65 | 'DAY' => date('d',strtotime($getpost3['pubDate'])), | ||
66 | 'CODED' => $getpost3['slug'], | ||
67 | 'TITLE' => $getpost3['title'], | ||
68 | 'AUTHOR' => $getpost3['author'], | ||
69 | 'TAG1' => $getpost3['tag1'], | ||
70 | 'TAG2' => $getpost3['tag2'], | ||
71 | 'TAG3' => $getpost3['tag3'], | ||
72 | 'RATING' => $getpost3['rating'], | ||
73 | 'TEXT' => parseBBCode($getpost3['text']))); | ||
74 | |||
75 | $template->display(); | ||
76 | $page_id = 'updates-' . $getpost3['id']; | ||
77 | include('includes/comments.php'); | ||
78 | |||
79 | $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AS score FROM updates WHERE MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AND id <> " . $getpost3['id'] . " LIMIT 0,5"; | ||
80 | $getrelated2 = mysql_query($getrelated); | ||
81 | $i=0; | ||
82 | while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) | ||
83 | { | ||
84 | if ($i==0) | ||
85 | { | ||
86 | $template = new FITemplate('related'); | ||
87 | } | ||
88 | |||
89 | $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], | ||
90 | 'CODED' => $getrelated3[$i]['slug'], | ||
91 | 'AUTHOR' => $getrelated3[$i]['author'], | ||
92 | 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y',strtotime($getrelated3[$i]['pubDate'])))); | ||
93 | $i++; | ||
94 | } | ||
95 | |||
96 | if ($i > 0) | ||
97 | { | ||
98 | $template->display(); | ||
99 | } | ||
100 | } else { | ||
101 | generateError('404'); | ||
102 | } | ||
103 | } else { | ||
104 | $template = new FITemplate('archive'); | ||
105 | if (isset($_GET['author'])) | ||
106 | { | ||
107 | $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; | ||
108 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | ||
109 | $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; | ||
110 | $getbio2 = mysql_query($getbio); | ||
111 | $getbio3 = mysql_fetch_array($getbio2); | ||
112 | if ($getbio3['username'] == $_GET['author']) | ||
113 | { | ||
114 | $template->adds_block('BIO', array( 'TEXT' => $getbio3['text'], | ||
115 | 'USERNAME' => $getbio3['username'], | ||
116 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getbio3['lastUpdated'])))); | ||
117 | } | ||
118 | } elseif (isset($_GET['tag'])) | ||
119 | { | ||
120 | $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; | ||
121 | $getposts = "SELECT * FROM updates WHERE tag1 = \"" . $_GET['tag'] . "\" OR tag2 = \"" . $_GET['tag'] . "\" OR tag3 = \"" . $_GET['tag'] . "\" ORDER BY id DESC"; | ||
122 | } else { | ||
123 | $title = 'Blog Archive'; | ||
124 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | ||
125 | } | ||
126 | $getposts2 = mysql_query($getposts); | ||
127 | $i=0; | ||
128 | while ($getposts3[$i] = mysql_fetch_array($getposts2)) | ||
129 | { | ||
130 | if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getposts3[$i]['pubDate'])))) | ||
131 | { | ||
132 | if (!isset($curID)) | ||
133 | { | ||
134 | $curID = 0; | ||
135 | } else { | ||
136 | $curID++; | ||
137 | } | ||
138 | $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate'])))); | ||
139 | if ($curID == 0) | ||
140 | { | ||
141 | $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); | ||
142 | } | ||
143 | $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate'])); | ||
144 | } | ||
145 | |||
146 | $page_id = 'updates-' . $getposts3[$i]['id']; | ||
147 | $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; | ||
148 | $getcomments2 = mysql_query($getcomments); | ||
149 | $total_post=0; | ||
150 | while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) | ||
151 | { | ||
152 | $total_post++; | ||
153 | } | ||
154 | if ($total_post >= 2) | ||
155 | { | ||
156 | $plural = 's'; | ||
157 | } | ||
158 | if ($total_post == 0) | ||
159 | { | ||
160 | $comText = 'No Comments'; | ||
161 | } elseif ($total_post == 1) | ||
162 | { | ||
163 | $comText = '1 Comment'; | ||
164 | } else { | ||
165 | $comText = $total_post . ' Comments'; | ||
166 | } | ||
167 | |||
168 | if ($curID == 0) | ||
169 | { | ||
170 | $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), | ||
171 | 'CODED' => $getposts3[$i]['slug'], | ||
172 | 'TITLE' => $getposts3[$i]['title'], | ||
173 | 'ID' => $getposts3[$i]['id'], | ||
174 | 'YEARID' => ((date('Y',strtotime($getposts3[$i]['pubDate']))-2006) % 4), | ||
175 | 'MONTH' => date('M',strtotime($getposts3[$i]['pubDate'])), | ||
176 | 'DAY' => date('d',strtotime($getposts3[$i]['pubDate'])), | ||
177 | 'AUTHOR' => $getposts3[$i]['author'], | ||
178 | 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), | ||
179 | 'COMMENTS' => $comText, | ||
180 | 'TAG1' => $getposts3[$i]['tag1'], | ||
181 | 'TAG2' => $getposts3[$i]['tag2'], | ||
182 | 'TAG3' => $getposts3[$i]['tag3'])); | ||
183 | } else { | ||
184 | $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), | ||
185 | 'CODED' => $getposts3[$i]['slug'], | ||
186 | 'TITLE' => $getposts3[$i]['title'])); | ||
187 | } | ||
188 | $i++; | ||
189 | } | ||
190 | if ($i==0) | ||
191 | { | ||
192 | generateError('404'); | ||
193 | } | ||
194 | $template->display(); | ||
195 | } | ||
196 | |||
197 | ?> | ||
diff --git a/pages/comic.php b/pages/comic.php new file mode 100644 index 0000000..103cb17 --- /dev/null +++ b/pages/comic.php | |||
@@ -0,0 +1,177 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/comic.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'wiki'; | ||
26 | |||
27 | if (isset($_GET['comic'])) | ||
28 | { | ||
29 | $template = new FITemplate('comic'); | ||
30 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
31 | |||
32 | $getcomic = "SELECT * FROM comic WHERE slug = \"" . urldecode($_GET['comic']) . "\""; | ||
33 | $getcomic2 = mysql_query($getcomic); | ||
34 | $getcomic3 = mysql_fetch_array($getcomic2); | ||
35 | |||
36 | if ($getcomic3['slug'] == urldecode($_GET['comic'])) | ||
37 | { | ||
38 | $title = stripslashes($getcomic3['title']) . ' - Kirby Fan Mail'; | ||
39 | |||
40 | $getback = "SELECT * FROM comic WHERE id = " . ($getcomic3['id']-1); | ||
41 | $getback2 = mysql_query($getback); | ||
42 | $getback3 = mysql_fetch_array($getback2); | ||
43 | if (isset($getback3['title'])) | ||
44 | { | ||
45 | $template->adds_block('BACK', array( 'CODED' => $getback3['slug'], | ||
46 | 'TITLE' => $getback3['title'])); | ||
47 | } | ||
48 | |||
49 | $getnext = "SELECT * FROM comic WHERE id = " . ($getcomic3['id']+1); | ||
50 | $getnext2 = mysql_query($getnext); | ||
51 | $getnext3 = mysql_fetch_array($getnext2); | ||
52 | if (isset($getnext3['title'])) | ||
53 | { | ||
54 | $template->adds_block('NEXT', array( 'CODED' => $getnext3['slug'], | ||
55 | 'TITLE' => $getnext3['title'])); | ||
56 | } | ||
57 | |||
58 | if (stripos($getcomic3['image'], 'gif') !== FALSE) | ||
59 | { | ||
60 | $mode = 'scalegif'; | ||
61 | } else { | ||
62 | $mode = 'scale'; | ||
63 | } | ||
64 | |||
65 | $template->adds_block('COMIC', array( 'ID' => $getcomic3['id'], | ||
66 | 'YEARID' => ((date('Y',strtotime($getcomic3['pubDate']))-2006) % 4), | ||
67 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getcomic3['pubDate'])), | ||
68 | 'MONTH' => date('M',strtotime($getcomic3['pubDate'])), | ||
69 | 'DAY' => date('d',strtotime($getcomic3['pubDate'])), | ||
70 | 'CODED' => $getcomic3['slug'], | ||
71 | 'TITLE' => $getcomic3['title'], | ||
72 | 'RATING' => $getcomic3['rating'], | ||
73 | 'TEXT' => parseBBCode($getcomic3['text']), | ||
74 | 'IMAGE' => $getcomic3['image'], | ||
75 | 'MODE' => $mode)); | ||
76 | |||
77 | $template->display(); | ||
78 | $page_id = 'kfm-' . $getcomic3['id']; | ||
79 | include('includes/comments.php'); | ||
80 | |||
81 | $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($getcomic3['title']) . "\") AS score FROM comic WHERE MATCH (title, text) AGAINST (\"" . addslashes($getcomic3['title']) . "\") AND id <> " . $getcomic3['id'] . " LIMIT 0,5"; | ||
82 | $getrelated2 = mysql_query($getrelated); | ||
83 | $i=0; | ||
84 | while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) | ||
85 | { | ||
86 | if ($i==0) | ||
87 | { | ||
88 | $template = new FITemplate('related'); | ||
89 | } | ||
90 | |||
91 | $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], | ||
92 | 'CODED' => $getrelated3[$i]['slug'], | ||
93 | 'AUTHOR' => 'Hatkirby', | ||
94 | 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y',strtotime($getrelated3[$i]['pubDate'])))); | ||
95 | $i++; | ||
96 | } | ||
97 | |||
98 | if ($i > 0) | ||
99 | { | ||
100 | $template->display(); | ||
101 | } | ||
102 | } else { | ||
103 | generateError('404'); | ||
104 | } | ||
105 | } else { | ||
106 | $template = new FITemplate('comicarchive'); | ||
107 | $title = 'Kirby Fan Mail'; | ||
108 | $getcomics = "SELECT * FROM comic ORDER BY id DESC"; | ||
109 | $getcomics2 = mysql_query($getcomics); | ||
110 | $i=0; | ||
111 | while ($getcomics3[$i] = mysql_fetch_array($getcomics2)) | ||
112 | { | ||
113 | if ((!isset($lastmonth)) || ($lastmonth != date('m-Y',strtotime($getcomics3[$i]['pubDate'])))) | ||
114 | { | ||
115 | if (!isset($curID)) | ||
116 | { | ||
117 | $curID = 0; | ||
118 | } else { | ||
119 | $curID++; | ||
120 | } | ||
121 | $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getcomics3[$i]['pubDate'])))); | ||
122 | if ($curID == 0) | ||
123 | { | ||
124 | $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); | ||
125 | } | ||
126 | $lastmonth = date('m-Y',strtotime($getcomics3[$i]['pubDate'])); | ||
127 | } | ||
128 | |||
129 | $page_id = 'kfm-' . $getcomics3[$i]['id']; | ||
130 | $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; | ||
131 | $getcomments2 = mysql_query($getcomments); | ||
132 | $total_post=0; | ||
133 | while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) | ||
134 | { | ||
135 | $total_post++; | ||
136 | } | ||
137 | if ($total_post >= 2) | ||
138 | { | ||
139 | $plural = 's'; | ||
140 | } | ||
141 | if ($total_post == 0) | ||
142 | { | ||
143 | $comText = 'No Comments'; | ||
144 | } elseif ($total_post == 1) | ||
145 | { | ||
146 | $comText = '1 Comment'; | ||
147 | } else { | ||
148 | $comText = $total_post . ' Comments'; | ||
149 | } | ||
150 | |||
151 | if ($curID == 0) | ||
152 | { | ||
153 | $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getcomics3[$i]['pubDate'])), | ||
154 | 'CODED' => $getcomics3[$i]['slug'], | ||
155 | 'TITLE' => $getcomics3[$i]['title'], | ||
156 | 'ID' => $getcomics3[$i]['id'], | ||
157 | 'YEARID' => ((date('Y',strtotime($getcomics3[$i]['pubDate']))-2006) % 4), | ||
158 | 'MONTH' => date('M',strtotime($getcomics3[$i]['pubDate'])), | ||
159 | 'DAY' => date('d',strtotime($getcomics3[$i]['pubDate'])), | ||
160 | 'AUTHOR' => 'Hatkirby', | ||
161 | 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), | ||
162 | 'COMMENTS' => $comText)); | ||
163 | } else { | ||
164 | $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getcomics3[$i]['pubDate'])), | ||
165 | 'CODED' => $getcomics3[$i]['slug'], | ||
166 | 'TITLE' => $getcomics3[$i]['title'])); | ||
167 | } | ||
168 | $i++; | ||
169 | } | ||
170 | if ($i==0) | ||
171 | { | ||
172 | generateError('404'); | ||
173 | } | ||
174 | $template->display(); | ||
175 | } | ||
176 | |||
177 | ?> | ||
diff --git a/pages/error.php b/pages/error.php new file mode 100644 index 0000000..7f6c505 --- /dev/null +++ b/pages/error.php | |||
@@ -0,0 +1,84 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/error.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | if (!isset($errorid) && isset($_GET['id'])) | ||
26 | { | ||
27 | $errorid = $_GET['id']; | ||
28 | } | ||
29 | |||
30 | if ($errorid == '404') | ||
31 | { | ||
32 | header("HTTP/1.0 404 Not Found"); | ||
33 | |||
34 | $template = new FITemplate('errors/404'); | ||
35 | |||
36 | $strReferer = strtolower($_SERVER['HTTP_REFERER']); | ||
37 | |||
38 | if (strlen($strReferer) == 0) | ||
39 | { | ||
40 | $template->adds_block('NOREFERER',array('exi'=>1)); | ||
41 | } else { | ||
42 | if ((strpos($strReferer,".looksmart.co")>0) || (strpos($strReferer,".ifind.freeserve")>0) || (strpos($strReferer,".ask.co")>0) || (strpos($strReferer,"google.co")>0) || (strpos($strReferer,"altavista.co")>0) || (strpos($strReferer,"msn.co")>0) || (strpos($strReferer,"yahoo.co")>0)) | ||
43 | { | ||
44 | $arrSite = split("/",$strReferer); | ||
45 | $arrParams = split("?",$strReferer); | ||
46 | $strSearchTerms = $arrParams[1]; | ||
47 | $arrParams = split("&",$strSearchTerms); | ||
48 | $strSite = $arrSite[2]; | ||
49 | $sQryStr=""; | ||
50 | $arrQueryStrings = array("q=","p=","ask=","key="); | ||
51 | |||
52 | for ($i=0;$i<count($arrParams);$i++) | ||
53 | { | ||
54 | for ($q=0;$q<count($arrQueryStrings);$q++) | ||
55 | { | ||
56 | $sQryStr = $arrQueryStrings[$q]; | ||
57 | if (strpos($arrParams[$i],$sQryStr)==0) | ||
58 | { | ||
59 | $strSearchTerms = $arrParams[$i]; | ||
60 | $strSearchTerms = split($sQryStr,$strSearchTerms); | ||
61 | $strSearchTerms = $strSearchTerms[1]; | ||
62 | $strSearchTerms = str_replace("+"," ",$strSearchTerms); | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | $template->adds_block('SEARCHREF',array( 'REF' => $strReferer, | ||
67 | 'SITE' => $strSite, | ||
68 | 'TERMS' => $strSearchTerms)); | ||
69 | } else { | ||
70 | $strSite = $strReferer; | ||
71 | $strSite = split("/",$strSite); | ||
72 | $strSite = $strSite[2]; | ||
73 | |||
74 | if (preg_match('/fourisland\.com/',$strSite) == 1) | ||
75 | { | ||
76 | $template->adds_block('OURBAD',array('exi'=>1)); | ||
77 | } | ||
78 | $template->adds_block('NORMALREF',array( 'REF' => $strReferer, | ||
79 | 'SITE' => $strSite)); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | $template->display(); | ||
84 | } | ||
diff --git a/pages/fourm.php b/pages/fourm.php new file mode 100644 index 0000000..41ae0a1 --- /dev/null +++ b/pages/fourm.php | |||
@@ -0,0 +1,27 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/fourm.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | include('fourm/link.php'); | ||
26 | |||
27 | ?> | ||
diff --git a/pages/holidates.php b/pages/holidates.php new file mode 100644 index 0000000..29b0ca4 --- /dev/null +++ b/pages/holidates.php | |||
@@ -0,0 +1,10 @@ | |||
1 | <TABLE WIDTH="100%" CLASS="webmail"><TR><TH>ID</TH><TH>Date</TH><TH>Holidate</TH></TR><?php | ||
2 | |||
3 | foreach ($specialdates as $num => $val) | ||
4 | { | ||
5 | $date = sd_clearDate(); | ||
6 | $date += ($num*60*60*24); | ||
7 | echo('<TR' . (($num % 2 == 0) ? ' CLASS="even"' : '') . '><TD>' . $num . '</TD><TD>' . date('F jS',$date) . '</TD><TD>' . $val . '</TD></TR>'); | ||
8 | } | ||
9 | |||
10 | ?></TABLE> | ||
diff --git a/pages/login.php b/pages/login.php new file mode 100644 index 0000000..6270502 --- /dev/null +++ b/pages/login.php | |||
@@ -0,0 +1,64 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/login.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $noMembers=1; | ||
26 | |||
27 | include('includes/recaptchalib.php'); | ||
28 | $publickey = "6LfgvgEAAAAAAG_BJMkWk8sNcT1nBaGoXKJYb-JT"; | ||
29 | $privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr"; | ||
30 | |||
31 | if (!isset($_GET['submit'])) | ||
32 | { | ||
33 | $template = new FITemplate('login'); | ||
34 | $template->add('REDIRECT',$_GET['redirect']); | ||
35 | |||
36 | $template->add('RECAPTCHA',recaptcha_get_html($publickey)); | ||
37 | } else { | ||
38 | $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); | ||
39 | if (!$resp->is_valid) | ||
40 | { | ||
41 | $template = new FITemplate('login'); | ||
42 | $template->add('REDIRECT',$_GET['redirect']); | ||
43 | $template->adds_block('ERROR',array('msg' => "The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")")); | ||
44 | |||
45 | $template->add('RECAPTCHA',recaptcha_get_html($publickey)); | ||
46 | } else { | ||
47 | if (verifyUser($_POST['username'], $_POST['password'])) | ||
48 | { | ||
49 | sess_set('uname',$_POST['username']); | ||
50 | header('Location: ' . rawurldecode($_POST['redirect'])); | ||
51 | exit; | ||
52 | } else { | ||
53 | $template = new FITemplate('login'); | ||
54 | $template->add('REDIRECT',$_POST['redirect']); | ||
55 | $template->adds_block('ERROR',array('MSG' => "The username/password pair didn't resolve to a real user. Try logging on again, spelling the password right, or making sure you actually have an a account.")); | ||
56 | |||
57 | $template->add('RECAPTCHA',recaptcha_get_html($publickey)); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | |||
62 | $template->display(); | ||
63 | |||
64 | ?> | ||
diff --git a/pages/logout.php b/pages/logout.php new file mode 100644 index 0000000..69b9386 --- /dev/null +++ b/pages/logout.php | |||
@@ -0,0 +1,28 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/logout.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | sess_delete('uname'); | ||
26 | header('Location: ' . rawurldecode($_GET['redirect'])); | ||
27 | |||
28 | ?> | ||
diff --git a/pages/poll.php b/pages/poll.php new file mode 100644 index 0000000..67f51a8 --- /dev/null +++ b/pages/poll.php | |||
@@ -0,0 +1,85 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/poll.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'poll'; | ||
26 | |||
27 | if (!isset($_GET['id'])) | ||
28 | { | ||
29 | $template = new FITemplate('pollIndex'); | ||
30 | |||
31 | $getpolls = "SELECT * FROM polloftheweek ORDER BY id DESC"; | ||
32 | $getpolls2 = mysql_query($getpolls); | ||
33 | $i=0; | ||
34 | while ($getpolls3[$i] = mysql_fetch_array($getpolls2)) | ||
35 | { | ||
36 | $template->adds_block('POLL', array( 'ID' => $getpolls3[$i]['id'], | ||
37 | 'QUESTION' => $getpolls3[$i]['question'], | ||
38 | 'WEEK' => date('F jS Y', strtotime($getpolls3[$i]['week'])))); | ||
39 | $i++; | ||
40 | } | ||
41 | |||
42 | include('pages/polloftheweek.php'); | ||
43 | |||
44 | $template->display(); | ||
45 | } else { | ||
46 | $template = new FITemplate('poll'); | ||
47 | |||
48 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id']; | ||
49 | $getpoll2 = mysql_query($getpoll); | ||
50 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
51 | |||
52 | $template->add('QUESTION', $getpoll3['question']); | ||
53 | |||
54 | $getrss = "SELECT * FROM pollrss WHERE id = " . $_GET['id']; | ||
55 | $getrss2 = mysql_query($getrss); | ||
56 | $getrss3 = mysql_fetch_array($getrss2); | ||
57 | |||
58 | if ($getrss3['id'] == $_GET['id']) | ||
59 | { | ||
60 | $template->adds_block('COMPLETE', array( 'RSS' => parseBBCode($getrss3['rss']), | ||
61 | 'AUTHOR' => $getrss3['author'], | ||
62 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getrss3['date'])), | ||
63 | 'OPTION1' => $getpoll3['option1'], | ||
64 | 'OPTION2' => $getpoll3['option2'], | ||
65 | 'OPTION3' => $getpoll3['option3'], | ||
66 | 'OPTION4' => $getpoll3['option4'], | ||
67 | 'CLICKS1' => $getpoll3['clicks1'], | ||
68 | 'CLICKS2' => $getpoll3['clicks2'], | ||
69 | 'CLICKS3' => $getpoll3['clicks3'], | ||
70 | 'CLICKS4' => $getpoll3['clicks4'])); | ||
71 | } else { | ||
72 | $template->adds_block('INCOMPLETE', array('exi'=>1)); | ||
73 | } | ||
74 | |||
75 | $forceDisplay = $_GET['id']; | ||
76 | include('pages/polloftheweek.php'); | ||
77 | unset($forceDisplay); | ||
78 | |||
79 | $template->display(); | ||
80 | |||
81 | $page_id = 'polloftheweek-' . $getpoll3['id']; | ||
82 | include('includes/comments.php'); | ||
83 | } | ||
84 | |||
85 | ?> | ||
diff --git a/pages/polloftheweek.php b/pages/polloftheweek.php new file mode 100644 index 0000000..930f346 --- /dev/null +++ b/pages/polloftheweek.php | |||
@@ -0,0 +1,73 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/polloftheweek.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | if (!isset($_GET['potw'])) | ||
26 | { | ||
27 | if (!isset($forceDisplay)) | ||
28 | { | ||
29 | $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; | ||
30 | } else { | ||
31 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $forceDisplay; | ||
32 | } | ||
33 | $getpoll2 = mysql_query($getpoll); | ||
34 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
35 | |||
36 | $template->add('QUESTION', $getpoll3['question']); | ||
37 | $template->add('OPTION1', $getpoll3['option1']); | ||
38 | $template->add('OPTION2', $getpoll3['option2']); | ||
39 | $template->add('OPTION3', $getpoll3['option3']); | ||
40 | $template->add('OPTION4', $getpoll3['option4']); | ||
41 | |||
42 | $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
43 | $getip2 = mysql_query($getip); | ||
44 | $getip3 = mysql_fetch_array($getip2); | ||
45 | |||
46 | if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && (!isset($forceDisplay))) | ||
47 | { | ||
48 | $template->adds_block('FORM',array('exi'=>1)); | ||
49 | } else { | ||
50 | $template->adds_block('DISPLAY',array('exi'=>1)); | ||
51 | |||
52 | $template->add('PERCENT1', getpercent($getpoll3,'1')); | ||
53 | $template->add('PERCENT2', getpercent($getpoll3,'2')); | ||
54 | $template->add('PERCENT3', getpercent($getpoll3,'3')); | ||
55 | $template->add('PERCENT4', getpercent($getpoll3,'4')); | ||
56 | } | ||
57 | } else { | ||
58 | $setip = "INSERT INTO didpollalready SET ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
59 | $setip2 = mysql_query($setip); | ||
60 | $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; | ||
61 | $getpoll2 = mysql_query($getpoll); | ||
62 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
63 | $setpoll = "UPDATE polloftheweek SET clicks" . $_POST['options'] . " = " . ($getpoll3['clicks' . $_POST['options']]+1) . " WHERE id = " . $getpoll3['id']; | ||
64 | $setpoll2 = mysql_query($setpoll); | ||
65 | |||
66 | $template = new FITemplate('msg'); | ||
67 | |||
68 | $template->add('MSG','<H2>' . $getpoll3['question'] . '</H2><P>Thank you for voting on the Poll of the Week!<BR><A HREF="poll.php?id=' . $getpoll3['id'] . '">Click here to visit the page for this poll.'); | ||
69 | |||
70 | $template->display(); | ||
71 | } | ||
72 | |||
73 | ?> | ||
diff --git a/pages/post.php b/pages/post.php new file mode 100644 index 0000000..f7990bd --- /dev/null +++ b/pages/post.php | |||
@@ -0,0 +1,107 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/post.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'home'; | ||
26 | $pageAID = 'archive'; | ||
27 | |||
28 | include('includes/recaptchalib.php'); | ||
29 | $privatekey = "6LfgvgEAAAAAAD0_UVLp57MU7tqcypsbZPS9qTnr"; | ||
30 | |||
31 | $template = new FITemplate('msg'); | ||
32 | $template->add('BACK','the previous page'); | ||
33 | |||
34 | if (!isset($_GET['id'])) | ||
35 | { | ||
36 | $template->add('MSG','I\'m sorry, but there\'s no page-id set here, so sadly you can\'t comment yet. Why not contact the administratior (link on the HatBar) and tell him that you saw this error?'); | ||
37 | } else { | ||
38 | if ($_POST['comment'] == "") | ||
39 | { | ||
40 | $template->add('MSG','I\'m sorry, but you didn\'t enter a comment!'); | ||
41 | } else { | ||
42 | if (!isLoggedIn()) | ||
43 | { | ||
44 | $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); | ||
45 | if (!$resp->is_valid) | ||
46 | { | ||
47 | $template->add('MSG',"The reCAPTCHA wasn't entered correctly. Go back and try it again. (reCAPTCHA said: " . $resp->error . ")"); | ||
48 | } else { | ||
49 | if (preg_match('/^[A-Za-z0-9!#$&\'*+-\/=?^_`{|}~]+@[-A-Za-z0-9]+(\.[-A-Za-z0-9]+)+[A-Za-z]$/', $_POST['email'])) | ||
50 | { | ||
51 | $getanon = "SELECT * FROM anon_commenters WHERE username = \"" . $_POST['username'] . "\""; | ||
52 | $getanon2 = mysql_query($getanon); | ||
53 | $getanon3 = mysql_fetch_array($getanon2); | ||
54 | |||
55 | if ($getanon3['username'] == $_POST['username']) | ||
56 | { | ||
57 | if ($getanon3['email'] == $_POST['email']) | ||
58 | { | ||
59 | $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", username = \"" . $_POST['username'] . "\", comment = \"" . $_POST['comment'] . "\""; | ||
60 | $setcomment2 = mysql_query($setcomment); | ||
61 | |||
62 | $page_id = $_GET['id']; | ||
63 | $comType = substr($page_id,0,strpos($page_id,'-')); | ||
64 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
65 | if ($comType == 'updates') | ||
66 | { | ||
67 | recalcPop($comID); | ||
68 | } | ||
69 | |||
70 | $template->add('MSG',"Thank you, " . $getanon3['username'] . ", for posting your valuable comment!"); | ||
71 | } else { | ||
72 | $template->add('MSG',"I'm sorry, but this anonymous username is already in use. If this is in fact you, please verify that you have entered the same email address that you entered the first time you commented here."); | ||
73 | } | ||
74 | } else { | ||
75 | $setcomment = "INSERT INTO moderation SET page_id = \"" . $_GET['id'] . "\", author = \"" . $_POST['username'] . "\", email = \"" . $_POST['email'] . "\", comment = \"" . $_POST['comment'] . "\", website = \"" . $_POST['website'] . "\""; | ||
76 | $setcomment2 = mysql_query($setcomment); | ||
77 | |||
78 | mail('hatkirby@fourisland.com', 'New comment to moderate on Four Island', 'Some one has anonymously left a comment on Four Island and it will require moderation.'); | ||
79 | |||
80 | $template->add('MSG',"Thank you for posting your valuable comment!<P>However, as you aren't logged in, your comment will have to be verified by a moderator before it appears. Sorry!"); | ||
81 | } | ||
82 | } else { | ||
83 | $template->add('MSG',"I'm sorry, but you've entered an invalid email address."); | ||
84 | } | ||
85 | } | ||
86 | } else { | ||
87 | $setcomment = "INSERT INTO comments SET page_id = \"" . $_GET['id'] . "\", username = \"" . sess_get('uname') . "\", comment = \"" . $_POST['comment'] . "\""; | ||
88 | $setcomment2 = mysql_query($setcomment); | ||
89 | |||
90 | mail('hatkirby@fourisland.com', 'New comment on Four Island!', sess_get('uname') . ' has posted a comment on Four Island under the "page id" ' . $_GET['id']); | ||
91 | |||
92 | $page_id = $_GET['id']; | ||
93 | $comType = substr($page_id,0,strpos($page_id,'-')); | ||
94 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
95 | if ($comType == 'updates') | ||
96 | { | ||
97 | recalcPop($comID); | ||
98 | } | ||
99 | |||
100 | $template->add('MSG',"Thank you, " . sess_get('uname') . ", for posting your valuable comment!"); | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | |||
105 | $template->display(); | ||
106 | |||
107 | ?> | ||
diff --git a/pages/projects.php b/pages/projects.php new file mode 100644 index 0000000..4129cdf --- /dev/null +++ b/pages/projects.php | |||
@@ -0,0 +1,94 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/projects.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | include('includes/phpsvnclient.php'); | ||
26 | |||
27 | if (!isset($_GET['project'])) | ||
28 | { | ||
29 | |||
30 | } else { | ||
31 | if (!isset($_GET['folder']) && !isset($_GET['file'])) | ||
32 | { | ||
33 | } else if (isset($_GET['folder'])) | ||
34 | { | ||
35 | if ($_GET['folder'] == 'browse') | ||
36 | { | ||
37 | $template = new FITemplate('projects/browse'); | ||
38 | |||
39 | if (!isset($_GET['id'])) | ||
40 | { | ||
41 | $path = '/'; | ||
42 | } else { | ||
43 | $path = '/' . $_GET['id']; | ||
44 | } | ||
45 | if (!isset($_GET['rev'])) | ||
46 | { | ||
47 | $rev = -1; | ||
48 | } else { | ||
49 | $rev = $_GET['rev']; | ||
50 | } | ||
51 | |||
52 | $svn = new phpSVNclient(); | ||
53 | $svn->setRespository('http://svn.fourisland.com/' . $_GET['project']); | ||
54 | $svn->setAuth('hatkirby','popstartwo506'); | ||
55 | $data = $svn->getFile($path,$rev); | ||
56 | |||
57 | if (substr($path,strlen($path)-1,1) != '/') | ||
58 | { | ||
59 | $template->add('DATA', str_replace(' ',' ',str_replace(' ',' ',nl2br(htmlentities($data))))); | ||
60 | $template->adds_block('FILE', array('NAME' => $path)); | ||
61 | } else { | ||
62 | $template->add('DATA', $data); | ||
63 | } | ||
64 | |||
65 | $logs = $svn->getFileLogs($path); | ||
66 | $template->add('LOGDATA', str_replace("\n\n",'<P>',htmlentities($logs[count($logs)-1]['comment']))); | ||
67 | $template->add('AUTHOR', $logs[count($logs)-1]['author']); | ||
68 | $template->add('DATE', date('F dS Y \a\\t g:i:s a',strtotime($logs[count($logs)-1]['date']))); | ||
69 | |||
70 | if ($rev != -1) | ||
71 | { | ||
72 | $template->adds_block('FORWARD', array( 'URL' => ('/projects/' . $_GET['project'] . '/browse' . $path . '?rev=' . ($rev+1)), | ||
73 | 'NUM' => ($rev+1))); | ||
74 | } | ||
75 | |||
76 | if ($rev == -1) | ||
77 | { | ||
78 | $rev = $svn->getVersion(); | ||
79 | } | ||
80 | |||
81 | if ($rev != 1) | ||
82 | { | ||
83 | $template->adds_block('BACK', array( 'URL' => ('/projects/' . $_GET['project'] . '/browse' . $path . '?rev=' . ($rev-1)), | ||
84 | 'NUM' => ($rev-1))); | ||
85 | } | ||
86 | } | ||
87 | } else if (isset($_GET['file'])) | ||
88 | { | ||
89 | } | ||
90 | } | ||
91 | |||
92 | $template->display(); | ||
93 | |||
94 | ?> | ||
diff --git a/pages/quotes.php b/pages/quotes.php new file mode 100644 index 0000000..78cd543 --- /dev/null +++ b/pages/quotes.php | |||
@@ -0,0 +1,166 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/quotes.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | include('includes/functions_quotes.php'); | ||
26 | |||
27 | $pageCategory = 'quotes'; | ||
28 | |||
29 | if (isset($_GET['id'])) | ||
30 | { | ||
31 | $quote_num = $_GET['id']; | ||
32 | } | ||
33 | |||
34 | if ($_GET['act'] == 'add') | ||
35 | { | ||
36 | $template = new FITemplate('quotes/add'); | ||
37 | if (isset($_GET['submit'])) | ||
38 | { | ||
39 | $template->adds_block('SUBMITTED',array('QUOTE' => (nl2br(htmlspecialchars($_POST['rash_quote'])) . "\n"))); | ||
40 | if (!isLoggedIn()) | ||
41 | { | ||
42 | $insquote = "INSERT INTO rash_queue (quote) VALUES(\"" . addslashes(htmlspecialchars($_POST['rash_quote'])) . "\")"; | ||
43 | } else { | ||
44 | $today = mktime(date('G'),date('i'),date('s'),date('m'),date('d'),date('Y')); | ||
45 | $insquote = "INSERT INTO rash_quotes (quote, rating, flag, date) VALUES (\"" . addslashes($_POST['rash_quote']) . "\", 0, 0, \"" . $today . "\")"; | ||
46 | } | ||
47 | $insquote2 = mysql_query($insquote); | ||
48 | } | ||
49 | $template->display(); | ||
50 | } elseif ($_GET['act'] == 'bottom') | ||
51 | { | ||
52 | $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating < 0 ORDER BY rating ASC LIMIT 50"; | ||
53 | quote_generation($query, "Bottom", -1); | ||
54 | } elseif ($_GET['act'] == 'browse') | ||
55 | { | ||
56 | $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY id ASC "; | ||
57 | quote_generation($query, "Browse", (isset($_GET['page']) ? $_GET['page'] : 1), 10, 5); | ||
58 | } elseif ($_GET['act'] == 'flag') | ||
59 | { | ||
60 | $template = new FITemplate('msg'); | ||
61 | $tracking_verdict = user_quote_status('flag', $quote_num, $template); | ||
62 | if ($tracking_verdict < 3) | ||
63 | { | ||
64 | $getfla = "SELECT flag FROM rash_quotes WHERE id = " . $quote_num . " LIMIT 0,1"; | ||
65 | $getfla2 = mysql_query($getfla); | ||
66 | $getfla3 = mysql_fetch_array($getfla2); | ||
67 | |||
68 | if ($getfla3['flag'] == 2) | ||
69 | { | ||
70 | $template->add('MSG',"This quote has been flagged and rechecked by a moderator already."); | ||
71 | } elseif ($getfla3['flag'] == 1) | ||
72 | { | ||
73 | $template->add('MSG',"This quote is currently pending deletion."); | ||
74 | } else { | ||
75 | $template->add('MSG',"You have marked this quote for deletion."); | ||
76 | $setfla = "UPDATE rash_quotes SET flag = 1 WHERE id = " . $quote_num; | ||
77 | $setfla2 = mysql_query($setfla); | ||
78 | } | ||
79 | } | ||
80 | $template->add('BACK','Quote #' . $quote_num); | ||
81 | $template->display(); | ||
82 | } elseif ($_GET['act'] == 'latest') | ||
83 | { | ||
84 | $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY id DESC LIMIT 50"; | ||
85 | quote_generation($query, "Latest", -1); | ||
86 | } elseif ($_GET['act'] == 'random') | ||
87 | { | ||
88 | $query = "SELECT id, quote, rating, flag FROM rash_quotes ORDER BY rand() LIMIT 50"; | ||
89 | quote_generation($query, "Random", -1); | ||
90 | } elseif ($_GET['act'] == 'random2') | ||
91 | { | ||
92 | $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating > 1 ORDER BY rand() LIMIT 50"; | ||
93 | quote_generation($query, "Random2", -1); | ||
94 | } elseif ($_GET['act'] == 'search') | ||
95 | { | ||
96 | if (isset($_GET['fetch'])) | ||
97 | { | ||
98 | if ($_POST['sortby'] == 'rating') | ||
99 | { | ||
100 | $how = 'desc'; | ||
101 | } else { | ||
102 | $how = 'asc'; | ||
103 | } | ||
104 | $getquotes = "SELECT id, quote, rating, flag FROM rash_quotes WHERE quote LIKE \"%" . $_POST['search'] . "%\" ORDER BY " . $_POST['sortby'] . " " . $how . " LIMIT 0," . $_POST['number']; | ||
105 | quote_generation($getquotes, "Query Results", -1); | ||
106 | } | ||
107 | $template = new FITemplate('quotes/search'); | ||
108 | $template->display(); | ||
109 | } elseif ($_GET['act'] == 'top') | ||
110 | { | ||
111 | $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE rating > 0 ORDER BY rating DESC LIMIT 50"; | ||
112 | quote_generation($query, "Top", -1); | ||
113 | } elseif ($_GET['act'] == 'vote') | ||
114 | { | ||
115 | $template = new FITemplate('msg'); | ||
116 | $tracking_verdict = user_quote_status('vote', $quote_num,$template); | ||
117 | $template->add('BACK','Quote #' . $quote_num); | ||
118 | $template->display(); | ||
119 | if ($tracking_verdict < 3) | ||
120 | { | ||
121 | if ($_GET['dir'] == "plus") | ||
122 | { | ||
123 | $setquote = "UPDATE rash_quotes SET rating = rating+1 WHERE id = " . $quote_num; | ||
124 | $setquote2 = mysql_query($setquote); | ||
125 | } elseif($_GET['dir'] == "minus") | ||
126 | { | ||
127 | $setquote = "UPDATE rash_quotes SET rating = rating-1 WHERE id = " . $quote_num; | ||
128 | $setquote2 = mysql_query($setquote); | ||
129 | } | ||
130 | } | ||
131 | } else { | ||
132 | if ((is_int($_GET['act']) || ($_GET['act'] != false)) && (verify_int($_GET['act']))) | ||
133 | { | ||
134 | $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE id = " . $_GET['act']; | ||
135 | quote_generation($query, "#" . $_GET['act'], -1); | ||
136 | $page_id = 'quote-' . $_GET['act']; | ||
137 | } else { | ||
138 | $template = new FITemplate('post'); | ||
139 | $template->adds_block('INTERNAL',array('exi'=>1)); | ||
140 | |||
141 | $getpost = "SELECT * FROM updates WHERE tag1 = \"quotes\" OR tag2 = \"tag2\" OR tag3 = \"tag3\" ORDER BY id DESC LIMIT 0,1"; | ||
142 | $getpost2 = mysql_query($getpost); | ||
143 | $getpost3 = mysql_fetch_array($getpost2); | ||
144 | |||
145 | $title = $getpost3['title'] . ' - Blog Archive'; | ||
146 | |||
147 | $template->adds_block('POST', array( 'ID' => $getpost3['id'], | ||
148 | 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), | ||
149 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), | ||
150 | 'MONTH' => date('M',strtotime($getpost3['pubDate'])), | ||
151 | 'DAY' => date('d',strtotime($getpost3['pubDate'])), | ||
152 | 'CODED' => urlencode($getpost3['title']), | ||
153 | 'TITLE' => $getpost3['title'], | ||
154 | 'AUTHOR' => $getpost3['author'], | ||
155 | 'TAG1' => $getpost3['tag1'], | ||
156 | 'TAG2' => $getpost3['tag2'], | ||
157 | 'TAG3' => $getpost3['tag3'], | ||
158 | 'TEXT' => parseBBCode($getpost3['text']))); | ||
159 | |||
160 | $template->display(); | ||
161 | $page_id = 'updates-' . $getpost3['id']; | ||
162 | } | ||
163 | include('includes/comments.php'); | ||
164 | } | ||
165 | |||
166 | ?> | ||
diff --git a/pages/splash.php b/pages/splash.php new file mode 100644 index 0000000..0a9ca89 --- /dev/null +++ b/pages/splash.php | |||
@@ -0,0 +1,28 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/splash.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $template = new FITemplate('welcome'); | ||
26 | $template->display(); | ||
27 | |||
28 | ?> | ||
diff --git a/pages/vote.php b/pages/vote.php new file mode 100644 index 0000000..890b379 --- /dev/null +++ b/pages/vote.php | |||
@@ -0,0 +1,115 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/vote.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'home'; | ||
26 | $pageAID = 'archive'; | ||
27 | |||
28 | if (!isset($_GET['mode'])) | ||
29 | { | ||
30 | $getpost = "SELECT * FROM updates WHERE id = " . $_GET['id']; | ||
31 | $getpost2 = mysql_query($getpost); | ||
32 | $getpost3 = mysql_fetch_array($getpost2); | ||
33 | |||
34 | if ($getpost3['id'] == $_GET['id']) | ||
35 | { | ||
36 | $template = new FITemplate('msg2'); | ||
37 | $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); | ||
38 | $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); | ||
39 | |||
40 | if ($_GET['dir'] == 'plus') | ||
41 | { | ||
42 | if (updatePop($_GET['id'],'rating')) | ||
43 | { | ||
44 | $template->add('MSG','Thank you for voting!'); | ||
45 | } else { | ||
46 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); | ||
47 | } | ||
48 | } else if ($_GET['dir'] == 'minus') | ||
49 | { | ||
50 | if (updatePop($_GET['id'],'rating',-1)) | ||
51 | { | ||
52 | $template->add('MSG','Thank you for voting!'); | ||
53 | } else { | ||
54 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this post.'); | ||
55 | } | ||
56 | } else { | ||
57 | $template = new FITemplate('msg'); | ||
58 | $template->add('BACK','the previous page'); | ||
59 | $template->add('MSG','Um, what on earth are you doing?'); | ||
60 | } | ||
61 | } else { | ||
62 | $template = new FITemplate('msg'); | ||
63 | $template->add('BACK','the previous page'); | ||
64 | $template->add('MSG','Um, what on earth are you doing?'); | ||
65 | } | ||
66 | } else if ($_GET['mode'] == 'comment') | ||
67 | { | ||
68 | $getcomment = "SELECT * FROM comments WHERE id = " . $_GET['id']; | ||
69 | $getcomment2 = mysql_query($getcomment); | ||
70 | $getcomment3 = mysql_fetch_array($getcomment2); | ||
71 | |||
72 | if ($getcomment3['id'] == $_GET['id']) | ||
73 | { | ||
74 | $page_id = $getcomment3['page_id']; | ||
75 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
76 | |||
77 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
78 | $getpost2 = mysql_query($getpost); | ||
79 | $getpost3 = mysql_fetch_array($getpost2); | ||
80 | |||
81 | $template = new FITemplate('msg2'); | ||
82 | $template->add('BACK','Back to ' . stripslashes($getpost3['title'])); | ||
83 | $template->add('LINK','/blog/' . $getpost3['slug'] . '/'); | ||
84 | |||
85 | if ($_GET['dir'] == 'plus') | ||
86 | { | ||
87 | if (updateCommentPop($_GET['id'])) | ||
88 | { | ||
89 | $template->add('MSG','Thank you for voting!'); | ||
90 | } else { | ||
91 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); | ||
92 | } | ||
93 | } else if ($_GET['dir'] == 'minus') | ||
94 | { | ||
95 | if (updateCommentPop($_GET['id'],-1)) | ||
96 | { | ||
97 | $template->add('MSG','Thank you for voting!'); | ||
98 | } else { | ||
99 | $template->add('MSG','I\'m sorry, but you\'ve already voted on this comment.'); | ||
100 | } | ||
101 | } else { | ||
102 | $template = new FITemplate('msg'); | ||
103 | $template->add('BACK','the previous page'); | ||
104 | $template->add('MSG','Um, what on earth are you doing?'); | ||
105 | } | ||
106 | } else { | ||
107 | $template = new FITemplate('msg'); | ||
108 | $template->add('BACK','the previous page'); | ||
109 | $template->add('MSG','Um, what on earth are you doing?'); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | $template->display(); | ||
114 | |||
115 | ?> | ||
diff --git a/pages/welcome.php b/pages/welcome.php new file mode 100644 index 0000000..24fd7ad --- /dev/null +++ b/pages/welcome.php | |||
@@ -0,0 +1,81 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/welcome.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'home'; | ||
26 | |||
27 | $template = new FITemplate('post'); | ||
28 | $template->adds_block('EXTERNAL',array('exi'=>1)); | ||
29 | |||
30 | $curID = 0; | ||
31 | |||
32 | $getpost = "SELECT * FROM updates ORDER BY id DESC LIMIT 0,4"; | ||
33 | $getpost2 = mysql_query($getpost); | ||
34 | while ($getpost3 = mysql_fetch_array($getpost2)) | ||
35 | { | ||
36 | updatePop($getpost3['id'],'home_views'); | ||
37 | |||
38 | $page_id = 'updates-' . $getpost3['id']; | ||
39 | $getcomments = "SELECT * FROM comments WHERE page_id = \"" . $page_id . "\" ORDER BY posttime"; | ||
40 | $getcomments2 = mysql_query($getcomments); | ||
41 | $total_post=0; | ||
42 | while ($getcomments3[$total_post] = mysql_fetch_array($getcomments2)) | ||
43 | { | ||
44 | $total_post++; | ||
45 | } | ||
46 | if ($total_post >= 2) | ||
47 | { | ||
48 | $plural = 's'; | ||
49 | } | ||
50 | if ($total_post == 0) | ||
51 | { | ||
52 | $comText = 'No Comments'; | ||
53 | } elseif ($total_post == 1) | ||
54 | { | ||
55 | $comText = '1 Comment'; | ||
56 | } else { | ||
57 | $comText = $total_post . ' Comments'; | ||
58 | } | ||
59 | |||
60 | $template->add_ref($curID, 'POST', array( 'ID' => $getpost3['id'], | ||
61 | 'YEARID' => ((date('Y',strtotime($getpost3['pubDate']))-2006) % 4), | ||
62 | 'DATE' => date('F dS Y \a\\t g:i:s a',strtotime($getpost3['pubDate'])), | ||
63 | 'MONTH' => date('M',strtotime($getpost3['pubDate'])), | ||
64 | 'DAY' => date('d',strtotime($getpost3['pubDate'])), | ||
65 | 'CODED' => $getpost3['slug'], | ||
66 | 'TITLE' => $getpost3['title'], | ||
67 | 'AUTHOR' => $getpost3['author'], | ||
68 | 'TAG1' => $getpost3['tag1'], | ||
69 | 'TAG2' => $getpost3['tag2'], | ||
70 | 'TAG3' => $getpost3['tag3'], | ||
71 | 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), | ||
72 | 'COMMENTS' => $comText, | ||
73 | 'RATING' => $getpost3['rating'], | ||
74 | 'TEXT' => parseBBCode($getpost3['text']))); | ||
75 | |||
76 | $curID++; | ||
77 | } | ||
78 | |||
79 | $template->display(); | ||
80 | |||
81 | ?> | ||
diff --git a/pages/wiki.php b/pages/wiki.php new file mode 100644 index 0000000..3e5a410 --- /dev/null +++ b/pages/wiki.php | |||
@@ -0,0 +1,179 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 pages/wiki.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | $pageCategory = 'wiki'; | ||
26 | |||
27 | $page = (isset($_GET['page']) ? $_GET['page'] : ''); | ||
28 | |||
29 | if (!isset($_GET['action'])) | ||
30 | { | ||
31 | $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $page . "\""; | ||
32 | $getpage2 = mysql_query($getpage); | ||
33 | $getpage3 = mysql_fetch_array($getpage2); | ||
34 | |||
35 | if ($getpage3['slug'] == $page) | ||
36 | { | ||
37 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; | ||
38 | $getrev2 = mysql_query($getrev); | ||
39 | $getrev3 = mysql_fetch_array($getrev2); | ||
40 | |||
41 | $title = $getpage3['title'] . ' - Wiki'; | ||
42 | |||
43 | $template = new FITemplate('wiki/page'); | ||
44 | $template->add('TITLE', $getpage3['title']); | ||
45 | $template->add('CONTENT', parseBBCode($getrev3['text'])); | ||
46 | $template->display(); | ||
47 | } else { | ||
48 | if (isLoggedIn()) | ||
49 | { | ||
50 | header('Location: ./?action=create'); | ||
51 | exit; | ||
52 | } else { | ||
53 | $template = new FITemplate('msg'); | ||
54 | $template->add('MSG', "The wiki page you are trying to access does not yet exist, and as you are not logged in, you cannot create it. If you would like to, why not log in and create this page?"); | ||
55 | $template->add('BACK', "the previous page"); | ||
56 | $template->display(); | ||
57 | } | ||
58 | } | ||
59 | } else if ($_GET['action'] == 'create') | ||
60 | { | ||
61 | if (isLoggedIn()) | ||
62 | { | ||
63 | $template = new FITemplate('wiki/create'); | ||
64 | $template->display(); | ||
65 | } else { | ||
66 | $template = new FITemplate('msg'); | ||
67 | $template->add('MSG', "I'm sorry, but you are attempting to create a wiki page while you aren't logged in. Please log in and then return."); | ||
68 | $template->add('BACK', "the previous page"); | ||
69 | $template->display(); | ||
70 | } | ||
71 | } else if ($_GET['action'] == 'edit') | ||
72 | { | ||
73 | if (isLoggedIn()) | ||
74 | { | ||
75 | $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $page . "\""; | ||
76 | $getpage2 = mysql_query($getpage); | ||
77 | $getpage3 = mysql_fetch_array($getpage2); | ||
78 | |||
79 | if ($getpage3['slug'] == $page) | ||
80 | { | ||
81 | $getrev = "SELECT * FROM wiki_revisions WHERE id = " . $getpage3['revision']; | ||
82 | $getrev2 = mysql_query($getrev); | ||
83 | $getrev3 = mysql_fetch_array($getrev2); | ||
84 | |||
85 | $template = new FITemplate('wiki/edit'); | ||
86 | $template->add('PAGENAME', $getpage3['title']); | ||
87 | $template->add('PAGETEXT', $getrev3['text']); | ||
88 | $template->display(); | ||
89 | } else { | ||
90 | header('Location: ./?action=create'); | ||
91 | exit; | ||
92 | } | ||
93 | } else { | ||
94 | $template = new FITemplate('msg'); | ||
95 | $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return."); | ||
96 | $template->add('BACK', "the previous page"); | ||
97 | $template->display(); | ||
98 | } | ||
99 | } else if ($_GET['action'] == 'submit') | ||
100 | { | ||
101 | if (isLoggedIn()) | ||
102 | { | ||
103 | if ($_GET['submit'] == 'create') | ||
104 | { | ||
105 | $insrev = "INSERT INTO wiki_revisions (author,text) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\")"; | ||
106 | $insrev2 = mysql_query($insrev); | ||
107 | |||
108 | $getrev = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" ORDER BY id DESC LIMIT 0,1"; | ||
109 | $getrev2 = mysql_query($getrev); | ||
110 | $getrev3 = mysql_fetch_array($getrev2); | ||
111 | |||
112 | $slug = generateSlug($_POST['title'],'wiki-pages'); | ||
113 | |||
114 | $inspage = "INSERT INTO wiki_pages (title,slug,revision) VALUES (\"" . $_POST['title'] . "\",\"" . $slug . "\"," . $getrev3['id'] . ")"; | ||
115 | $inspage2 = mysql_query($inspage); | ||
116 | |||
117 | $template = new FITemplate('msg2'); | ||
118 | $template->add('MSG', 'YAY! You\'ve just created a page!'); | ||
119 | $template->add('LINK', '/wiki/' . $slug . '/'); | ||
120 | $template->add('BACK', 'View the page you just created'); | ||
121 | $template->display(); | ||
122 | } else if ($_GET['submit'] == 'edit') | ||
123 | { | ||
124 | $getpage = "SELECT * FROM wiki_pages WHERE slug = \"" . $_GET['page'] . "\""; | ||
125 | $getpage2 = mysql_query($getpage); | ||
126 | $getpage3 = mysql_fetch_array($getpage2); | ||
127 | |||
128 | $insrev = "INSERT INTO wiki_revisions (author,text,previous) VALUES (\"" . sess_get('uname') . "\",\"" . addslashes($_POST['text']) . "\"," . $getpage3['revision'] . ")"; | ||
129 | $insrev2 = mysql_query($insrev); | ||
130 | |||
131 | $getrev4 = "SELECT * FROM wiki_revisions WHERE author = \"" . sess_get('uname') . "\" AND text = \"" . addslashes($_POST['text']) . "\" AND previous = " . $getpage3['revision'] . " ORDER BY id DESC LIMIT 0,1"; | ||
132 | $getrev5 = mysql_query($getrev4); | ||
133 | $getrev6 = mysql_fetch_array($getrev5); | ||
134 | |||
135 | $setpage = "UPDATE wiki_pages SET revision = " . $getrev6['id'] . " WHERE revision = " . $getpage3['revision']; | ||
136 | $setpage2 = mysql_query($setpage); | ||
137 | |||
138 | $template = new FITemplate('msg2'); | ||
139 | $template->add('MSG', 'YAY! You\'ve just edited a page!'); | ||
140 | $template->add('LINK', './'); | ||
141 | $template->add('BACK', 'View the page you just edited'); | ||
142 | $template->display(); | ||
143 | } | ||
144 | } else { | ||
145 | $template = new FITemplate('msg'); | ||
146 | $template->add('MSG', "I'm sorry, but you are attempting to edit a wiki page while you aren't logged in. Please log in and then return."); | ||
147 | $template->add('BACK', "the previous page"); | ||
148 | $template->display(); | ||
149 | } | ||
150 | } else if ($_GET['action'] == 'index') | ||
151 | { | ||
152 | $template = new FITemplate('wiki/index'); | ||
153 | $getpages = "SELECT * FROM wiki_pages, wiki_revisions WHERE wiki_revisions.id = wiki_pages.revision ORDER BY title ASC"; | ||
154 | $getpages2 = mysql_query($getpages); | ||
155 | $i=0; | ||
156 | $lastLetter=''; | ||
157 | while ($getpages3[$i] = mysql_fetch_array($getpages2)) | ||
158 | { | ||
159 | if (substr($getpages3[$i]['title'],0,1) != $lastLetter) | ||
160 | { | ||
161 | if (!isset($curID)) | ||
162 | { | ||
163 | $curID = 0; | ||
164 | } else { | ||
165 | $curID++; | ||
166 | } | ||
167 | $template->add_ref($curID, 'LETTER', array('TITLE' => substr($getpages3[$i]['title'],0,1))); | ||
168 | $lastLetter = substr($getpages3[$i]['title'],0,1); | ||
169 | } | ||
170 | |||
171 | $template->adds_ref_sub($curID, 'PAGE', array( 'TITLE' => $getpages3[$i]['title'], | ||
172 | 'CODED' => ($getpages3[$i]['slug'] != '' ? $getpages3[$i]['slug'] . '/' : ''), | ||
173 | 'DATE' => date('m-d-y',strtotime($getpages3[$i]['pubDate'])))); | ||
174 | $i++; | ||
175 | } | ||
176 | $template->display(); | ||
177 | } | ||
178 | |||
179 | ?> | ||
diff --git a/rss.php b/rss.php new file mode 100644 index 0000000..c9e866f --- /dev/null +++ b/rss.php | |||
@@ -0,0 +1,334 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 rss.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | require('headerproc.php'); | ||
22 | |||
23 | include('../security/config.php'); | ||
24 | include('includes/db.php'); | ||
25 | include('includes/bbcode.php'); | ||
26 | include('includes/phpsvnclient.php'); | ||
27 | |||
28 | header('Content-type: application/rss+xml'); | ||
29 | |||
30 | echo('<?xml version="1.0" encoding="UTF-8"?>'); | ||
31 | |||
32 | ?> | ||
33 | <rss version="2.0"> | ||
34 | <channel> | ||
35 | <title>Four Island<?php | ||
36 | if (isset($_GET['mode'])) | ||
37 | { | ||
38 | switch ($_GET['mode']) | ||
39 | { | ||
40 | case 'blog': | ||
41 | if (isset($_GET['blog'])) | ||
42 | { | ||
43 | switch ($_GET['blog']) | ||
44 | { | ||
45 | case 'author': | ||
46 | ?> Blog Posts by <?php | ||
47 | echo($_GET['author']); | ||
48 | break; | ||
49 | case 'tag': | ||
50 | ?> Blog Posts tagged with <?php | ||
51 | echo($_GET['tag']); | ||
52 | break; | ||
53 | } | ||
54 | } else { | ||
55 | ?> Blog Posts<?php | ||
56 | } | ||
57 | break; | ||
58 | case 'quotes': | ||
59 | ?> Quotes<?php | ||
60 | break; | ||
61 | case 'poll': | ||
62 | ?> Polls<?php | ||
63 | break; | ||
64 | case 'projects': | ||
65 | ?> Projects<?php | ||
66 | break; | ||
67 | case 'comments': | ||
68 | ?> Comments<?php | ||
69 | break; | ||
70 | } | ||
71 | } | ||
72 | ?></title> | ||
73 | |||
74 | <description><?php | ||
75 | if (isset($_GET['mode'])) | ||
76 | { | ||
77 | switch ($_GET['mode']) | ||
78 | { | ||
79 | case 'blog': | ||
80 | if (isset($_GET['blog'])) | ||
81 | { | ||
82 | switch ($_GET['blog']) | ||
83 | { | ||
84 | case 'author': | ||
85 | ?>An archive of all Four Island blog posts written by <?php | ||
86 | echo($_GET['author']); | ||
87 | break; | ||
88 | case 'tag': | ||
89 | ?>An archive of all Four Island blog posts tagged with <?php | ||
90 | echo($_GET['tag']); | ||
91 | break; | ||
92 | } | ||
93 | } else { | ||
94 | ?>An archive of all Four Island blog posts<?php | ||
95 | } | ||
96 | break; | ||
97 | case 'quotes': | ||
98 | ?>An archive of all Four Island quotes<?php | ||
99 | break; | ||
100 | case 'poll': | ||
101 | ?>An archive of all of the Four Island POTWs<?php | ||
102 | break; | ||
103 | case 'projects': | ||
104 | ?>An archive of all of the Four Island Project checkins<?php | ||
105 | break; | ||
106 | case 'comments': | ||
107 | ?>An archive of all of the comments people have left on Four Island<?php | ||
108 | break; | ||
109 | } | ||
110 | } else { | ||
111 | ?>All the wonderfour going-ons on Four Island<?php | ||
112 | } | ||
113 | ?></description> | ||
114 | |||
115 | <language>en</language> | ||
116 | |||
117 | <?php | ||
118 | |||
119 | $i=0; | ||
120 | |||
121 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'blog')) | ||
122 | { | ||
123 | if ($_GET['blog'] == 'author') | ||
124 | { | ||
125 | $getposts = "SELECT * FROM updates WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; | ||
126 | } else if ($_GET['blog'] == 'tag') | ||
127 | { | ||
128 | $getposts = "SELECT * FROM updates WHERE tag1 = \"" . $_GET['tag'] . "\" OR tag2 = \"" . $_GET['tag'] . "\" OR tag3 = \"" . $_GET['tag'] . "\" ORDER BY id DESC"; | ||
129 | } else if (!isset($_GET['blog'])) { | ||
130 | $getposts = "SELECT * FROM updates ORDER BY id DESC"; | ||
131 | } | ||
132 | $getposts2 = mysql_query($getposts); | ||
133 | |||
134 | // $si = $i; | ||
135 | |||
136 | while (($items[$i] = mysql_fetch_array($getposts2))) | ||
137 | { | ||
138 | $items[$i]['sortDate'] = strtotime($items[$i]['pubDate']); | ||
139 | $items[$i]['itemType'] = 'post'; | ||
140 | $i++; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'quotes')) | ||
145 | { | ||
146 | $getquotes = "SELECT * FROM rash_quotes"; | ||
147 | $getquotes2 = mysql_query($getquotes); | ||
148 | |||
149 | // $si = $i; | ||
150 | |||
151 | while (($items[$i] = mysql_fetch_array($getquotes2))) | ||
152 | { | ||
153 | $items[$i]['sortDate'] = $items[$i]['date']; | ||
154 | $items[$i]['itemType'] = 'quote'; | ||
155 | $i++; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | if ($_GET['mode'] == 'poll') | ||
160 | { | ||
161 | $getpolls = "SELECT * FROM polloftheweek"; | ||
162 | $getpolls2 = mysql_query($getpolls); | ||
163 | while (($items[$i] = mysql_fetch_array($getpolls2)) && ($i < ($si+10))) | ||
164 | { | ||
165 | $items[$i]['sortDate'] = strtotime($items[$i]['week']); | ||
166 | $items[$i]['itemType'] = 'poll'; | ||
167 | $i++; | ||
168 | } | ||
169 | } | ||
170 | |||
171 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'projects')) | ||
172 | { | ||
173 | $svn = new phpSVNclient(); | ||
174 | ob_start(); | ||
175 | $projs = explode(" ",system('dir /var/svn')); | ||
176 | ob_end_clean(); | ||
177 | |||
178 | // $si = $i; | ||
179 | |||
180 | foreach ($projs as $name) | ||
181 | { | ||
182 | $svn->setRespository('http://svn.fourisland.com/' . $name); | ||
183 | // $svn->setAuth('hatkirby','popstartwo506'); | ||
184 | $logs = $svn->getFileLogs(''); | ||
185 | |||
186 | $k=0; | ||
187 | while (($items[$i] = $logs[$k])) | ||
188 | { | ||
189 | $items[$i]['sortDate'] = strtotime($items[$i]['date']); | ||
190 | $items[$i]['itemType'] = 'project'; | ||
191 | $items[$i]['project'] = $name; | ||
192 | $i++; | ||
193 | $k++; | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | |||
198 | if (!isset($_GET['mode']) || ($_GET['mode'] == 'comments')) | ||
199 | { | ||
200 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,10"; | ||
201 | $getcomments2 = mysql_query($getcomments); | ||
202 | while ($items[$i] = mysql_fetch_array($getcomments2)) | ||
203 | { | ||
204 | $items[$i]['sortDate'] = strtotime($items[$i]['posttime']); | ||
205 | $items[$i]['itemType'] = 'comment'; | ||
206 | |||
207 | $page_id = $items[$i]['page_id']; | ||
208 | $comType = substr($page_id,0,strpos($page_id,'-')); | ||
209 | $comID = substr($page_id,strpos($page_id,'-')+1); | ||
210 | |||
211 | switch ($comType) | ||
212 | { | ||
213 | case 'updates': | ||
214 | $getpost = "SELECT * FROM updates WHERE id = " . $comID; | ||
215 | $getpost2 = mysql_query($getpost); | ||
216 | $getpost3 = mysql_fetch_array($getpost2); | ||
217 | |||
218 | $items[$i]['title'] = $getpost3['title']; | ||
219 | $items[$i]['url'] = 'blog/' . $getpost3['slug'] . '/'; | ||
220 | break; | ||
221 | case 'poll': | ||
222 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $comID; | ||
223 | $getpoll2 = mysql_query($getpoll); | ||
224 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
225 | |||
226 | $items[$i]['title'] = $getpoll3['question']; | ||
227 | $items[$i]['url'] = 'poll/' . $getpoll3['id'] . '.php'; | ||
228 | break; | ||
229 | case 'quote': | ||
230 | $getquote = "SELECT * FROM rash_quotes WHERE id = " . $comID; | ||
231 | $getquote2 = mysql_query($getquote); | ||
232 | $getquote3 = mysql_fetch_array($getquote2); | ||
233 | |||
234 | $items[$i]['title'] = '#' . $getquote3['id']; | ||
235 | $items[$i]['url'] = 'quotes/' . $getquote3['id'] . '.php'; | ||
236 | break; | ||
237 | } | ||
238 | $i++; | ||
239 | } | ||
240 | } | ||
241 | |||
242 | function sortItems($a, $b) | ||
243 | { | ||
244 | if ($a['sortDate'] < $b['sortDate']) | ||
245 | { | ||
246 | return 1; | ||
247 | } else if ($a['sortDate'] == $b['sortDate']) | ||
248 | { | ||
249 | return 0; | ||
250 | } else if ($a['sortDate'] > $b['sortDate']) | ||
251 | { | ||
252 | return -1; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | uasort($items,"sortItems"); | ||
257 | |||
258 | $j=0; | ||
259 | foreach ($items as $key => $value) | ||
260 | { | ||
261 | switch ($value['itemType']) | ||
262 | { | ||
263 | case 'post': | ||
264 | ?> | ||
265 | <item> | ||
266 | <title><?php echo($value['title']); ?></title> | ||
267 | |||
268 | <link>http://www.fourisland.com/blog/<?php echo($value['slug']); ?>/</link> | ||
269 | |||
270 | <description><?php echo(stripslashes(htmlentities(parseBBCode($value['text'])))); ?></description> | ||
271 | |||
272 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
273 | </item> | ||
274 | <?php | ||
275 | break; | ||
276 | case 'quote': | ||
277 | ?> | ||
278 | <item> | ||
279 | <title>Quote #<?php echo($value['id']); ?></title> | ||
280 | |||
281 | <link>http://www.fourisland.com/quotes/<?php echo(urlencode($value['id'])); ?>.php</link> | ||
282 | |||
283 | <description><?php echo(htmlentities(nl2br($value['quote']))); ?></description> | ||
284 | |||
285 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
286 | </item> | ||
287 | <?php | ||
288 | break; | ||
289 | case 'poll': | ||
290 | break; | ||
291 | case 'project': | ||
292 | $value['comment'] = str_replace('[','',str_replace(']','',$value['comment'])); | ||
293 | if (strpos($value['comment'],"\n") !== FALSE) | ||
294 | { | ||
295 | $title = htmlentities(substr($value['comment'],0,strpos($value['comment'],"\n"))); | ||
296 | } else { | ||
297 | $title = htmlentities($value['comment']); | ||
298 | } | ||
299 | ?> | ||
300 | <item> | ||
301 | <title><?php echo($value['project']); ?> r<?php echo($value['version']); ?> - <?php echo($title); ?></title> | ||
302 | |||
303 | <link>http://www.fourisland.com/projects/<?php echo($value['project']); ?>/changeset/<?php echo(urlencode($value['version'])); ?></link> | ||
304 | |||
305 | <description><?php echo(htmlentities(nl2br($value['comment']))); ?></description> | ||
306 | |||
307 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
308 | </item> | ||
309 | <?php | ||
310 | break; | ||
311 | case 'comment': | ||
312 | ?> | ||
313 | <item> | ||
314 | <title>Comment on <?php echo($value['title']); ?> by <?php echo($value['username']); ?></title> | ||
315 | |||
316 | <link>http://www.fourisland.com/comments/<?php echo($value['id']); ?>/</link> | ||
317 | |||
318 | <description><?php echo(stripslashes(htmlentities(parseBBCode($value['comment'])))); ?></description> | ||
319 | |||
320 | <pubDate><?php echo(date('D, d M Y H:i:s O',$value['sortDate'])); ?></pubDate> | ||
321 | </item> | ||
322 | <?php | ||
323 | break; | ||
324 | } | ||
325 | $j++; | ||
326 | if ($j==9) | ||
327 | { | ||
328 | break; | ||
329 | } | ||
330 | } | ||
331 | |||
332 | ?> | ||
333 | </channel> | ||
334 | </rss> | ||
diff --git a/theme/addresses.tpl b/theme/addresses.tpl new file mode 100644 index 0000000..5b06a7a --- /dev/null +++ b/theme/addresses.tpl | |||
@@ -0,0 +1,9 @@ | |||
1 | <P>Click <A HREF="http://hackles.org/spam">here</A> for information about this page.</P> | ||
2 | |||
3 | <H2>Calling all email-harvesting robots!</H2> | ||
4 | |||
5 | <P>Come fetch 1000 juicy email addresses here:</P> | ||
6 | |||
7 | <!--BEGIN ADDRESS--> | ||
8 | <A HREF="mailto:<!--ADDRESS.ADDY-->"><!--ADDRESS.ADDY--></A><BR> | ||
9 | <!--END ADDRESS--> | ||
diff --git a/theme/admin/deleteDraft.tpl b/theme/admin/deleteDraft.tpl new file mode 100644 index 0000000..346604e --- /dev/null +++ b/theme/admin/deleteDraft.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <H2>Delete a Draft</H2><P> | ||
2 | |||
3 | Are you ABSOLUTELY SURE that you want to delete this draft?<P> | ||
4 | |||
5 | <A HREF="/admin/deleteDraft.php?id=<!--ID-->&submit=">Yes</A><BR> | ||
6 | <A HREF="javascript:history.back();window.refresh();">Ummm.... actually I'd rather not</A> | ||
diff --git a/theme/admin/deletePending.tpl b/theme/admin/deletePending.tpl new file mode 100644 index 0000000..03541f2 --- /dev/null +++ b/theme/admin/deletePending.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <H2>Delete a Pending Post</H2><P> | ||
2 | |||
3 | Are you ABSOLUTELY SURE that you want to delete this pending post?<P> | ||
4 | |||
5 | <A HREF="/admin/deletePending.php?id=<!--ID-->&submit=">Yes</A><BR> | ||
6 | <A HREF="javascript:history.back();window.refresh();">Ummm.... actually I'd rather not</A> | ||
diff --git a/theme/admin/deletePost.tpl b/theme/admin/deletePost.tpl new file mode 100644 index 0000000..8c08112 --- /dev/null +++ b/theme/admin/deletePost.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <H2>Delete a Post</H2><P> | ||
2 | |||
3 | Are you ABSOLUTELY SURE that you want to delete this post?<P> | ||
4 | |||
5 | <A HREF="/admin/deletePost.php?id=<!--ID-->&submit=">Yes</A><BR> | ||
6 | <A HREF="javascript:history.back();window.refresh();">Ummm.... actually I'd rather not</A> | ||
diff --git a/theme/admin/deletedDraft.tpl b/theme/admin/deletedDraft.tpl new file mode 100644 index 0000000..dd449f6 --- /dev/null +++ b/theme/admin/deletedDraft.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | You've just deleted a draft! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/manageDrafts.php">Manage Drafts</A></LI> | ||
5 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
6 | </UL> | ||
diff --git a/theme/admin/deletedPending.tpl b/theme/admin/deletedPending.tpl new file mode 100644 index 0000000..220aa11 --- /dev/null +++ b/theme/admin/deletedPending.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | You've just deleted a pending post! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/managePending.php">Manage Pending Posts</A></LI> | ||
5 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
6 | </UL> | ||
diff --git a/theme/admin/deletedPost.tpl b/theme/admin/deletedPost.tpl new file mode 100644 index 0000000..12cc68a --- /dev/null +++ b/theme/admin/deletedPost.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | You've just deleted a post! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/managePosts.php">Manage Posts</A></LI> | ||
5 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
6 | </UL> | ||
diff --git a/theme/admin/draftSuccess.tpl b/theme/admin/draftSuccess.tpl new file mode 100644 index 0000000..7d76d2a --- /dev/null +++ b/theme/admin/draftSuccess.tpl | |||
@@ -0,0 +1,8 @@ | |||
1 | Congradulations, you've just made/edited a draft! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/editDraft.php?id=<!--ID-->">Edit this draft</A></LI> | ||
5 | <LI><A HREF="/admin/viewDraft.php?id=<!--ID-->">View this draft</A></LI> | ||
6 | <LI><A HREF="/admin/manageDrafts.php">Manage Drafts</A></LI> | ||
7 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
8 | </UL> | ||
diff --git a/theme/admin/editDraft.tpl b/theme/admin/editDraft.tpl new file mode 100644 index 0000000..b3197c4 --- /dev/null +++ b/theme/admin/editDraft.tpl | |||
@@ -0,0 +1,16 @@ | |||
1 | <H2>Edit a draft</H2><P> | ||
2 | |||
3 | <FORM ACTION="/admin/editDraft.php?id=<!--ID-->&submit=" METHOD="POST"> | ||
4 | Draft Title: <INPUT TYPE="text" NAME="title" VALUE="<!--TITLE-->"><BR> | ||
5 | <TEXTAREA NAME="text" COLS="80" ROWS="20"><!--TEXT--></TEXTAREA><P> | ||
6 | Tag 1: <INPUT TYPE="text" NAME="tag1" VALUE="<!--TAG1-->"><BR> | ||
7 | Tag 2: <INPUT TYPE="text" NAME="tag2" VALUE="<!--TAG2-->"> (Optional)<BR> | ||
8 | Tag 3: <INPUT TYPE="text" NAME="tag3" VALUE="<!--TAG3-->"> (Optional)<BR> | ||
9 | Post Type: <SELECT NAME="type" SIZE="4"> | ||
10 | <OPTION VALUE="draft" SELECTED>Draft</OPTION> | ||
11 | <OPTION VALUE="normal">Normal (Article-style) Post</OPTION> | ||
12 | <OPTION VALUE="priority">High-Priority Post</OPTION> | ||
13 | <OPTION VALUE="instant">Instant Post</OPTION> | ||
14 | </SELECT><BR> | ||
15 | <INPUT TYPE="submit" VALUE="Edit draft"> | ||
16 | </FORM> | ||
diff --git a/theme/admin/editPending.tpl b/theme/admin/editPending.tpl new file mode 100644 index 0000000..ccded76 --- /dev/null +++ b/theme/admin/editPending.tpl | |||
@@ -0,0 +1,10 @@ | |||
1 | <H2>Edit a pending post</H2><P> | ||
2 | |||
3 | <FORM ACTION="/admin/editPending.php?id=<!--ID-->&submit=" METHOD="POST"> | ||
4 | Post Title: <INPUT TYPE="text" NAME="title" VALUE="<!--TITLE-->"><BR> | ||
5 | <TEXTAREA NAME="text" COLS="80" ROWS="20"><!--TEXT--></TEXTAREA><P> | ||
6 | Tag 1: <INPUT TYPE="text" NAME="tag1" VALUE="<!--TAG1-->"><BR> | ||
7 | Tag 2: <INPUT TYPE="text" NAME="tag2" VALUE="<!--TAG2-->"> (Optional)<BR> | ||
8 | Tag 3: <INPUT TYPE="text" NAME="tag3" VALUE="<!--TAG3-->"> (Optional)<BR> | ||
9 | <INPUT TYPE="submit" VALUE="Edit post"> | ||
10 | </FORM> | ||
diff --git a/theme/admin/editPost.tpl b/theme/admin/editPost.tpl new file mode 100644 index 0000000..544fe5f --- /dev/null +++ b/theme/admin/editPost.tpl | |||
@@ -0,0 +1,10 @@ | |||
1 | <H2>Edit a post</H2><P> | ||
2 | |||
3 | <FORM ACTION="/admin/editPost.php?id=<!--ID-->&submit=" METHOD="POST"> | ||
4 | Post Title: <INPUT TYPE="text" NAME="title" VALUE="<!--TITLE-->"><BR> | ||
5 | <TEXTAREA NAME="text" COLS="80" ROWS="20"><!--TEXT--></TEXTAREA><P> | ||
6 | Tag 1: <INPUT TYPE="text" NAME="tag1" VALUE="<!--TAG1-->"><BR> | ||
7 | Tag 2: <INPUT TYPE="text" NAME="tag2" VALUE="<!--TAG2-->"> (Optional)<BR> | ||
8 | Tag 3: <INPUT TYPE="text" NAME="tag3" VALUE="<!--TAG3-->"> (Optional)<BR> | ||
9 | <INPUT TYPE="submit" VALUE="Edit post"> | ||
10 | </FORM> | ||
diff --git a/theme/admin/index.tpl b/theme/admin/index.tpl new file mode 100644 index 0000000..f886f2d --- /dev/null +++ b/theme/admin/index.tpl | |||
@@ -0,0 +1,31 @@ | |||
1 | <H2>Admin Panel</H2><P> | ||
2 | |||
3 | Welcome to the ubiquitous administration panel!<P> | ||
4 | |||
5 | <H3>Blog</H3> | ||
6 | |||
7 | <UL> | ||
8 | <LI><A HREF="/admin/writePost.php">Write a post</A></LI> | ||
9 | <LI><A HREF="/admin/manageDrafts.php">Manage Drafts</A></LI> | ||
10 | <LI><A HREF="/admin/managePending.php">Manage Pending Posts</A></LI> | ||
11 | <LI><A HREF="/admin/managePosts.php">Manage Published Posts</A></LI> | ||
12 | <LI><A HREF="/admin/moderateComments.php">Moderate Comments</A></LI> | ||
13 | </UL> | ||
14 | |||
15 | <H3>Wiki</H3> | ||
16 | |||
17 | <UL> | ||
18 | <LI><A HREF="/admin/managePages.php">Manage Pages</A></LI> | ||
19 | </UL> | ||
20 | |||
21 | <H3>Poll</H3> | ||
22 | |||
23 | <UL> | ||
24 | <LI><A HREF="/admin/pollProcess.php">Weekly Poll Process</A></LI> | ||
25 | </UL> | ||
26 | |||
27 | <H3>Quotes</H3> | ||
28 | |||
29 | <UL> | ||
30 | <LI><A HREF="/admin/managePendingQuotes.php">Manage Pending Quotes</A></LI> | ||
31 | </UL> | ||
diff --git a/theme/admin/manageDrafts.tpl b/theme/admin/manageDrafts.tpl new file mode 100644 index 0000000..8a498ac --- /dev/null +++ b/theme/admin/manageDrafts.tpl | |||
@@ -0,0 +1,24 @@ | |||
1 | <H2>Manage Drafts</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Draft Title</TH> | ||
6 | <TH>Draft Author</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN DRAFT--> | ||
11 | <TR> | ||
12 | <TD><!--DRAFT.TITLE--></TD> | ||
13 | <TD><!--DRAFT.AUTHOR--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/editDraft.php?id=<!--DRAFT.ID-->"><IMG SRC="/theme/images/icons/page_edit.png" ALT="Edit"></A> | ||
17 | <A HREF="/admin/deleteDraft.php?id=<!--DRAFT.ID-->"><IMG SRC="/theme/images/icons/page_delete.png" ALT="Delete"></A> | ||
18 | <A HREF="/admin/viewDraft.php?id=<!--DRAFT.ID-->"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
19 | </TD> | ||
20 | </TR> | ||
21 | <!--END DRAFT--> | ||
22 | </TABLE> | ||
23 | |||
24 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/managePages.tpl b/theme/admin/managePages.tpl new file mode 100644 index 0000000..eef8c75 --- /dev/null +++ b/theme/admin/managePages.tpl | |||
@@ -0,0 +1,23 @@ | |||
1 | <H2>Manage Pages</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Page Title</TH> | ||
6 | <TH>Revision Author</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN PAGE--> | ||
11 | <TR> | ||
12 | <TD><!--PAGE.TITLE--></TD> | ||
13 | <TD><!--PAGE.AUTHOR--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/pageHistory.php?id=<!--PAGE.ID-->"><IMG SRC="/theme/images/icons/page_edit.png" ALT="View History"></A> | ||
17 | <A HREF="/wiki/<!--PAGE.CODED-->/"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
18 | </TD> | ||
19 | </TR> | ||
20 | <!--END PAGE--> | ||
21 | </TABLE> | ||
22 | |||
23 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/managePending.tpl b/theme/admin/managePending.tpl new file mode 100644 index 0000000..d119b92 --- /dev/null +++ b/theme/admin/managePending.tpl | |||
@@ -0,0 +1,24 @@ | |||
1 | <H2>Manage Pending</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Pending Post Title</TH> | ||
6 | <TH>Pending Post Author</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN PENDING--> | ||
11 | <TR> | ||
12 | <TD><!--PENDING.TITLE--></TD> | ||
13 | <TD><!--PENDING.AUTHOR--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/editPending.php?id=<!--PENDING.ID-->"><IMG SRC="/theme/images/icons/page_edit.png" ALT="Edit"></A> | ||
17 | <A HREF="/admin/deletePending.php?id=<!--PENDING.ID-->"><IMG SRC="/theme/images/icons/page_delete.png" ALT="Delete"></A> | ||
18 | <A HREF="/admin/viewPending.php?id=<!--PENDING.ID-->"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
19 | </TD> | ||
20 | </TR> | ||
21 | <!--END PENDING--> | ||
22 | </TABLE> | ||
23 | |||
24 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/managePendingQuotes.tpl b/theme/admin/managePendingQuotes.tpl new file mode 100644 index 0000000..660e126 --- /dev/null +++ b/theme/admin/managePendingQuotes.tpl | |||
@@ -0,0 +1,21 @@ | |||
1 | <H2>Manage Pending Quotes</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Quote</TH> | ||
6 | <TH>Actions</TH> | ||
7 | </TR> | ||
8 | |||
9 | <!--BEGIN QUOTE--> | ||
10 | <TR> | ||
11 | <TD><!--QUOTE.TEXT--></TD> | ||
12 | |||
13 | <TD> | ||
14 | <A HREF="/admin/actionPendingQuotes.php?id=<!--QUOTE.ID-->&approve"><IMG SRC="/theme/images/icons/page_attach.png" ALT="Approve"></A> | ||
15 | <A HREF="/admin/actionPendingQuotes.php?id=<!--QUOTE.ID-->&deny"><IMG SRC="/theme/images/icons/page_delete.png" ALT="Deny"></A> | ||
16 | </TD> | ||
17 | </TR> | ||
18 | <!--END QUOTE--> | ||
19 | </TABLE> | ||
20 | |||
21 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/managePosts.tpl b/theme/admin/managePosts.tpl new file mode 100644 index 0000000..7e37b1f --- /dev/null +++ b/theme/admin/managePosts.tpl | |||
@@ -0,0 +1,24 @@ | |||
1 | <H2>Manage Posts</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Post Title</TH> | ||
6 | <TH>Post Author</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN POST--> | ||
11 | <TR> | ||
12 | <TD><!--POST.TITLE--></TD> | ||
13 | <TD><!--POST.AUTHOR--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/editPost.php?id=<!--POST.ID-->"><IMG SRC="/theme/images/icons/page_edit.png" ALT="Edit"></A> | ||
17 | <A HREF="/admin/deletePost.php?id=<!--POST.ID-->"><IMG SRC="/theme/images/icons/page_delete.png" ALT="Delete"></A> | ||
18 | <A HREF="/blog/<!--POST.CODED-->/"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
19 | </TD> | ||
20 | </TR> | ||
21 | <!--END POST--> | ||
22 | </TABLE> | ||
23 | |||
24 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/moderateComments.tpl b/theme/admin/moderateComments.tpl new file mode 100644 index 0000000..f3da51c --- /dev/null +++ b/theme/admin/moderateComments.tpl | |||
@@ -0,0 +1,24 @@ | |||
1 | <H2>Moderate Comments</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Title of Article Commented Upon</TH> | ||
6 | <TH>Comment Author</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN COMMENT--> | ||
11 | <TR> | ||
12 | <TD><!--COMMENT.TITLE--></TD> | ||
13 | <TD><!--COMMENT.AUTHOR--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/viewComment.php?id=<!--COMMENT.ID-->"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
17 | <A HREF="/admin/actionComment.php?id=<!--COMMENT.ID-->&approve"><IMG SRC="/theme/images/icons/page_attach.png" ALT="Approve"></A> | ||
18 | <A HREF="/admin/actionComment.php?id=<!--COMMENT.ID-->&deny"><IMG SRC="/theme/images/icons/page_delete.png" ALT="Deny"></A> | ||
19 | </TD> | ||
20 | </TR> | ||
21 | <!--END COMMENT--> | ||
22 | </TABLE> | ||
23 | |||
24 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/newPoll.tpl b/theme/admin/newPoll.tpl new file mode 100644 index 0000000..5f1d2a4 --- /dev/null +++ b/theme/admin/newPoll.tpl | |||
@@ -0,0 +1,10 @@ | |||
1 | Congradulations! You've successfully added a Poll RSS. Now it's time to add the new Poll Of The Week:<P> | ||
2 | |||
3 | <FORM ACTION="/admin/pollProcess.php?step=3" METHOD="POST"> | ||
4 | Question: <INPUT TYPE="text" NAME="question"><BR> | ||
5 | Option 1: <INPUT TYPE="text" NAME="option1"><BR> | ||
6 | Option 2: <INPUT TYPE="text" NAME="option2"><BR> | ||
7 | Option 3: <INPUT TYPE="text" NAME="option3"><BR> | ||
8 | Option 4: <INPUT TYPE="text" NAME="option4"><BR> | ||
9 | <INPUT TYPE="submit" VALUE="Create poll"> | ||
10 | </FORM> | ||
diff --git a/theme/admin/pageHistory.tpl b/theme/admin/pageHistory.tpl new file mode 100644 index 0000000..b5fd326 --- /dev/null +++ b/theme/admin/pageHistory.tpl | |||
@@ -0,0 +1,23 @@ | |||
1 | <H2>Page History</H2> | ||
2 | |||
3 | <TABLE WIDTH="100%" CLASS="webmail"> | ||
4 | <TR> | ||
5 | <TH>Revision Author</TH> | ||
6 | <TH>Revision Date</TH> | ||
7 | <TH>Actions</TH> | ||
8 | </TR> | ||
9 | |||
10 | <!--BEGIN REV--> | ||
11 | <TR> | ||
12 | <TD><!--REV.AUTHOR--></TD> | ||
13 | <TD><!--REV.DATE--></TD> | ||
14 | |||
15 | <TD> | ||
16 | <A HREF="/admin/viewRevision.php?id=<!--REV.ID-->"><IMG SRC="/theme/images/icons/page_go.png" ALT="View"></A> | ||
17 | </TD> | ||
18 | </TR> | ||
19 | <!--END REV--> | ||
20 | </TABLE> | ||
21 | |||
22 | <A HREF="/admin/managePages.php">Back to Manage Pages</A><BR> | ||
23 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/pendingSuccess.tpl b/theme/admin/pendingSuccess.tpl new file mode 100644 index 0000000..64adbe6 --- /dev/null +++ b/theme/admin/pendingSuccess.tpl | |||
@@ -0,0 +1,8 @@ | |||
1 | Congradulations, you've just made/edited a pending post! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/editPending.php?id=<!--ID-->">Edit this pending post</A></LI> | ||
5 | <LI><A HREF="/admin/viewPending.php?id=<!--ID-->">View this pending post</A></LI> | ||
6 | <LI><A HREF="/admin/managePending.php">Manage Pending Posts</A></LI> | ||
7 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
8 | </UL> | ||
diff --git a/theme/admin/pollrss.tpl b/theme/admin/pollrss.tpl new file mode 100644 index 0000000..5ea628f --- /dev/null +++ b/theme/admin/pollrss.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <H2>Write a Poll RSS</H2><P> | ||
2 | |||
3 | <FORM ACTION="/admin/pollProcess.php?step=2" METHOD="POST"> | ||
4 | <TEXTAREA NAME="text" COLS="80" ROWS="20"></TEXTAREA><P> | ||
5 | <INPUT TYPE="submit" VALUE="Write RSS"> | ||
6 | </FORM> | ||
diff --git a/theme/admin/postSuccess.tpl b/theme/admin/postSuccess.tpl new file mode 100644 index 0000000..12920fe --- /dev/null +++ b/theme/admin/postSuccess.tpl | |||
@@ -0,0 +1,8 @@ | |||
1 | Congradulations, you've just made/edited a post! | ||
2 | |||
3 | <UL> | ||
4 | <LI><A HREF="/admin/editPost.php?id=<!--ID-->">Edit this post</A></LI> | ||
5 | <LI><A HREF="/blog/<!--CODED-->/">View this post</A></LI> | ||
6 | <LI><A HREF="/admin/managePosts.php">Manage Posts</A></LI> | ||
7 | <LI><A HREF="/admin/">Return to the Admin Panel</A></LI> | ||
8 | </UL> | ||
diff --git a/theme/admin/viewComment.tpl b/theme/admin/viewComment.tpl new file mode 100644 index 0000000..9254f1d --- /dev/null +++ b/theme/admin/viewComment.tpl | |||
@@ -0,0 +1,12 @@ | |||
1 | <DIV CLASS="bubble"> | ||
2 | <BLOCKQUOTE> | ||
3 | <DIV> | ||
4 | <IMG SRC="http://www.gravatar.com/avatar.php?gravatar_id=<!--CODEDEMAIL-->&rating=G&size=40&default=<!--CODEDDEF-->"> | ||
5 | <!--TEXT--> | ||
6 | </DIV> | ||
7 | </BLOCKQUOTE> | ||
8 | <CITE><STRONG><!--USERNAME--></STRONG> on <!--DATE--></CITE> | ||
9 | </DIV><P> | ||
10 | |||
11 | <A HREF="/admin/moderateComments.php">Back to Comment Moderation</A><BR> | ||
12 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/viewRevision.tpl b/theme/admin/viewRevision.tpl new file mode 100644 index 0000000..fc6fc83 --- /dev/null +++ b/theme/admin/viewRevision.tpl | |||
@@ -0,0 +1,5 @@ | |||
1 | <!--TEXT--> | ||
2 | <P> | ||
3 | <A HREF="javascript:history.back()">Back to Page History</A> | ||
4 | <A HREF="/admin/managePages.php">Back to Manage Pages</A><BR> | ||
5 | <A HREF="/admin/">Back to Admin Panel</A> | ||
diff --git a/theme/admin/write.tpl b/theme/admin/write.tpl new file mode 100644 index 0000000..30e870c --- /dev/null +++ b/theme/admin/write.tpl | |||
@@ -0,0 +1,16 @@ | |||
1 | <H2>Write a post</H2><P> | ||
2 | |||
3 | <FORM ACTION="/admin/writePost.php?submit=" METHOD="POST"> | ||
4 | Post Title: <INPUT TYPE="text" NAME="title"><BR> | ||
5 | <TEXTAREA NAME="text" COLS="80" ROWS="20"></TEXTAREA><P> | ||
6 | Tag 1: <INPUT TYPE="text" NAME="tag1" VALUE="update"><BR> | ||
7 | Tag 2: <INPUT TYPE="text" NAME="tag2"> (Optional)<BR> | ||
8 | Tag 3: <INPUT TYPE="text" NAME="tag3"> (Optional)<BR> | ||
9 | Post Type: <SELECT NAME="type" SIZE="4"> | ||
10 | <OPTION VALUE="draft">Draft</OPTION> | ||
11 | <OPTION VALUE="normal" SELECTED>Normal (Article-style) Post</OPTION> | ||
12 | <OPTION VALUE="priority">High-Priority Post</OPTION> | ||
13 | <OPTION VALUE="instant">Instant Post</OPTION> | ||
14 | </SELECT><BR> | ||
15 | <INPUT TYPE="submit" VALUE="Write post"> | ||
16 | </FORM> | ||
diff --git a/theme/archive.tpl b/theme/archive.tpl new file mode 100644 index 0000000..7d85565 --- /dev/null +++ b/theme/archive.tpl | |||
@@ -0,0 +1,43 @@ | |||
1 | <!--BEGIN MONTH--> | ||
2 | <H3 STYLE="clear: both; display: block; margin-bottom: 0"><!--MONTH.TITLE--></H2> | ||
3 | <!--BEGIN MONTH.BIG--> | ||
4 | <DIV CLASS="post"> | ||
5 | <DIV CLASS="post-date-<!--MONTH.BIG.YEARID-->"> | ||
6 | <ABBR CLASS="dtstart" TITLE="<!--MONTH.BIG.DATE-->"> | ||
7 | <SPAN CLASS="post-month"><!--MONTH.BIG.MONTH--></SPAN> | ||
8 | <SPAN CLASS="post-day"><!--MONTH.BIG.DAY--></SPAN> | ||
9 | </ABBR> | ||
10 | </DIV> | ||
11 | |||
12 | <DIV CLASS="post-title"> | ||
13 | <H2> | ||
14 | <A CLASS="url" HREF="/blog/<!--MONTH.BIG.CODED-->/" REL="bookmark" TITLE="Permalink for <!--MONTH.BIG.TITLE-->"> | ||
15 | <SPAN CLASS="summary"><!--MONTH.BIG.TITLE--></SPAN> | ||
16 | </A> | ||
17 | </H2> | ||
18 | |||
19 | <SPAN CLASS="post-cat-<!--MONTH.BIG.AUTHOR--> category"> | ||
20 | <A HREF="/blog/author/<!--MONTH.BIG.AUTHOR-->.php"><!--MONTH.BIG.AUTHOR--></A> | ||
21 | </SPAN> | ||
22 | |||
23 | <SPAN CLASS="post-tag-3 category"> | ||
24 | <A CLASS="noVisit" HREF="/blog/tag/<!--MONTH.BIG.TAG1-->.php" REL="tag" TITLE="<!--MONTH.BIG.TAG1-->"><!--MONTH.BIG.TAG1--></A> | ||
25 | <A CLASS="noVisit" HREF="/blog/tag/<!--MONTH.BIG.TAG2-->.php" REL="tag" TITLE="<!--MONTH.BIG.TAG2-->"><!--MONTH.BIG.TAG2--></A> | ||
26 | <A CLASS="noVisit" HREF="/blog/tag/<!--MONTH.BIG.TAG3-->.php" REL="tag" TITLE="<!--MONTH.BIG.TAG3-->"><!--MONTH.BIG.TAG3--></A> | ||
27 | </SPAN> | ||
28 | |||
29 | <SPAN CLASS="post-comment<!--MONTH.BIG.PLURALCOMMENT-->"> | ||
30 | <A CLASS="noVisit" HREF="/blog/<!--MONTH.BIG.CODED-->/#comments"><!--MONTH.BIG.COMMENTS--> »</A> | ||
31 | </SPAN> | ||
32 | </DIV> | ||
33 | </DIV> | ||
34 | <!--END MONTH.BIG--> | ||
35 | |||
36 | <!--BEGIN MONTH.SMALL--> | ||
37 | <SMALL><SPAN STYLE="margin-left: 50"><!--MONTH.SMALL.DATE--> | <A HREF="/blog/<!--MONTH.SMALL.CODED-->/"><!--MONTH.SMALL.TITLE--></A></SPAN></SMALL><BR> | ||
38 | <!--END MONTH.SMALL--> | ||
39 | |||
40 | <!--BEGIN MONTH.BIGEND--> | ||
41 | <BR><P><BR> | ||
42 | <!--END MONTH.BIGEND--> | ||
43 | <!--END MONTH--> | ||
diff --git a/theme/comic.tpl b/theme/comic.tpl new file mode 100644 index 0000000..8ce4236 --- /dev/null +++ b/theme/comic.tpl | |||
@@ -0,0 +1,46 @@ | |||
1 | <!--BEGIN BACK--><SPAN CLASS="back-post">« <A HREF="/comic/<!--BACK.CODED-->/"><!--BACK.TITLE--></A></SPAN><!--END BACK--> | ||
2 | <!--BEGIN NEXT--><SPAN CLASS="next-post"><A HREF="/comic/<!--NEXT.CODED-->/"><!--NEXT.TITLE--></A> »</SPAN><!--END NEXT--> | ||
3 | |||
4 | <!--BEGIN COMIC--> | ||
5 | <DIV CLASS="post vevent" ID="post-<!--COMIC.ID-->"> | ||
6 | <DIV CLASS="post-date-<!--COMIC.YEARID-->"> | ||
7 | <ABBR CLASS="dtstart" TITLE="<!--COMIC.DATE-->"> | ||
8 | <SPAN CLASS="post-month"><!--COMIC.MONTH--></SPAN> | ||
9 | <SPAN CLASS="post-day"><!--COMIC.DAY--></SPAN> | ||
10 | </ABBR> | ||
11 | </DIV> | ||
12 | |||
13 | <DIV CLASS="post-title"> | ||
14 | <H2> | ||
15 | <!--BEGIN EXTERNAL--><A CLASS="url" HREF="/comic/<!--POST.CODED-->/" REL="bookmark" TITLE="Permalink for <!--COMIC.TITLE-->"><!--END EXTERNAL--> | ||
16 | <SPAN CLASS="summary"><!--COMIC.TITLE--></SPAN> | ||
17 | <!--BEGIN EXTERNAL--></A><!--END EXTERNAL--> | ||
18 | </H2> | ||
19 | |||
20 | <SPAN CLASS="post-cat-hatkirby category"> | ||
21 | <A HREF="/blog/author/hatkirby.php">Hatkirby</A> | ||
22 | </SPAN> | ||
23 | |||
24 | <SPAN CLASS="mini-add-comment"> | ||
25 | <A CLASS="noVisit" HREF="/comic/<!--COMIC.CODED-->/#comments">Add Comment »</A> | ||
26 | </SPAN> | ||
27 | </DIV> | ||
28 | |||
29 | <DIV CLASS="entry description"> | ||
30 | <DIV CLASS="bubble"> | ||
31 | <DIV CLASS="rounded"> | ||
32 | <BLOCKQUOTE> | ||
33 | <DIV> | ||
34 | <A HREF="/images/kfm/<!--COMIC.IMAGE-->" CLASS="thickbox"> | ||
35 | <IMG SRC="http://fourisland.com/thumb.php?file=images/kfm/<!--COMIC.IMAGE-->&mode=<!--COMIC.MODE-->&by=400" ALIGN="center" WIDTH="400"> | ||
36 | </A> | ||
37 | |||
38 | <P><!--COMIC.TEXT--></P> | ||
39 | </DIV> | ||
40 | </BLOCKQUOTE> | ||
41 | </DIV> | ||
42 | <CITE CLASS="rounded"><STRONG>Hatkirby</STRONG> on <!--COMIC.DATE--></CITE> | ||
43 | </DIV> | ||
44 | </DIV> | ||
45 | </DIV> | ||
46 | <!--END COMIC--> | ||
diff --git a/theme/comicarchive.tpl b/theme/comicarchive.tpl new file mode 100644 index 0000000..dc5e443 --- /dev/null +++ b/theme/comicarchive.tpl | |||
@@ -0,0 +1,37 @@ | |||
1 | <!--BEGIN MONTH--> | ||
2 | <H3 STYLE="clear: both; display: block; margin-bottom: 0"><!--MONTH.TITLE--></H2> | ||
3 | <!--BEGIN MONTH.BIG--> | ||
4 | <DIV CLASS="post"> | ||
5 | <DIV CLASS="post-date-<!--MONTH.BIG.YEARID-->"> | ||
6 | <ABBR CLASS="dtstart" TITLE="<!--MONTH.BIG.DATE-->"> | ||
7 | <SPAN CLASS="post-month"><!--MONTH.BIG.MONTH--></SPAN> | ||
8 | <SPAN CLASS="post-day"><!--MONTH.BIG.DAY--></SPAN> | ||
9 | </ABBR> | ||
10 | </DIV> | ||
11 | |||
12 | <DIV CLASS="post-title"> | ||
13 | <H2> | ||
14 | <A CLASS="url" HREF="/comic/<!--MONTH.BIG.CODED-->/" REL="bookmark" TITLE="Permalink for <!--MONTH.BIG.TITLE-->"> | ||
15 | <SPAN CLASS="summary"><!--MONTH.BIG.TITLE--></SPAN> | ||
16 | </A> | ||
17 | </H2> | ||
18 | |||
19 | <SPAN CLASS="post-cat-<!--MONTH.BIG.AUTHOR--> category"> | ||
20 | <A HREF="/blog/author/<!--MONTH.BIG.AUTHOR-->.php"><!--MONTH.BIG.AUTHOR--></A> | ||
21 | </SPAN> | ||
22 | |||
23 | <SPAN CLASS="post-comment<!--MONTH.BIG.PLURALCOMMENT-->"> | ||
24 | <A CLASS="noVisit" HREF="/comic/<!--MONTH.BIG.CODED-->/#comments"><!--MONTH.BIG.COMMENTS--> »</A> | ||
25 | </SPAN> | ||
26 | </DIV> | ||
27 | </DIV> | ||
28 | <!--END MONTH.BIG--> | ||
29 | |||
30 | <!--BEGIN MONTH.SMALL--> | ||
31 | <SMALL><SPAN STYLE="margin-left: 50"><!--MONTH.SMALL.DATE--> | <A HREF="/comic/<!--MONTH.SMALL.CODED-->/"><!--MONTH.SMALL.TITLE--></A></SPAN></SMALL><BR> | ||
32 | <!--END MONTH.SMALL--> | ||
33 | |||
34 | <!--BEGIN MONTH.BIGEND--> | ||
35 | <BR><P><BR> | ||
36 | <!--END MONTH.BIGEND--> | ||
37 | <!--END MONTH--> | ||
diff --git a/theme/comments.tpl b/theme/comments.tpl new file mode 100644 index 0000000..ab4e05b --- /dev/null +++ b/theme/comments.tpl | |||
@@ -0,0 +1,49 @@ | |||
1 | <!--<script> | ||
2 | var idcomments_acct = '150cde7e591dedeb7098b992cc4f382a'; | ||
3 | var idcomments_post_id; | ||
4 | var idcomments_post_url; | ||
5 | </script> | ||
6 | <span id="IDCommentsPostTitle" style="display:none"></span> | ||
7 | <script type='text/javascript' src='http://www.intensedebate.com/js/genericCommentWrapperV2.js'></script> | ||
8 | --> | ||
9 | |||
10 | <!--BEGIN COMMENTS--> | ||
11 | <DIV CLASS="bubble"> | ||
12 | <BLOCKQUOTE> | ||
13 | <DIV> | ||
14 | <IMG SRC="http://www.gravatar.com/avatar.php?gravatar_id=<!--COMMENTS.CODEDEMAIL-->&rating=G&size=40&default=<!--CODEDDEF-->"> | ||
15 | <!--COMMENTS.TEXT--> | ||
16 | </DIV> | ||
17 | </BLOCKQUOTE> | ||
18 | <CITE><STRONG><!--COMMENTS.USERNAME--></STRONG> on <!--COMMENTS.DATE--></CITE> | ||
19 | |||
20 | <SPAN STYLE="float: right"> | ||
21 | <A HREF="/vote.php?id=<!--COMMENTS.ID-->&dir=plus&mode=comment" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_up.png"></A> | ||
22 | <!--COMMENTS.RATING--> | ||
23 | <A HREF="/vote.php?id=<!--COMMENTS.ID-->&dir=minus&mode=comment" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_down.png"></A> | ||
24 | </SPAN> | ||
25 | </DIV> | ||
26 | <!--END COMMENTS--> | ||
27 | |||
28 | <FORM ACTION="/post.php?id=<!--PAGEID-->" METHOD="POST"> | ||
29 | <DIV CLASS="bubble"> | ||
30 | <BLOCKQUOTE> | ||
31 | <DIV ID="postBubble"> | ||
32 | <TEXTAREA ROWS="4" CLASS="comments_field" NAME="comment" COLS="73"></TEXTAREA> | ||
33 | </DIV> | ||
34 | </BLOCKQUOTE> | ||
35 | <CITE><STRONG><!--USERNAME--></STRONG>, feel free to post a comment</CITE> | ||
36 | </DIV> | ||
37 | |||
38 | <CENTER> | ||
39 | <!--BEGIN NOLOG--> | ||
40 | <!--RECAPTCHA--> | ||
41 | <P> | ||
42 | Name: <INPUT TYPE="text" NAME="username"><BR> | ||
43 | Email: <INPUT TYPE="text" NAME="email"><BR> | ||
44 | Website (Optional): <INPUT TYPE="text" NAME="website"> | ||
45 | <P> | ||
46 | <!--END NOLOG--> | ||
47 | <INPUT TYPE="submit" VALUE="Post"></INPUT> | ||
48 | </CENTER> | ||
49 | </FORM> | ||
diff --git a/theme/css.php b/theme/css.php new file mode 100755 index 0000000..4984f03 --- /dev/null +++ b/theme/css.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | require('../headerproc.php'); | ||
22 | |||
23 | header('Content-type: text/css'); | ||
24 | |||
25 | include('../../security/config.php'); | ||
26 | include('../includes/db.php'); | ||
27 | |||
28 | if (!isset($_GET['background'])) | ||
29 | { | ||
30 | include("css/website.php"); | ||
31 | include("css/headers.php"); | ||
32 | include("css/navigation.php"); | ||
33 | include("css/uniform.php"); | ||
34 | include("css/quotes.php"); | ||
35 | include("css/bubbles.css"); | ||
36 | } | ||
37 | |||
38 | include("css/backgrounds.php"); | ||
39 | |||
40 | ?> | ||
diff --git a/theme/css/backgrounds.php b/theme/css/backgrounds.php new file mode 100755 index 0000000..51e7dbf --- /dev/null +++ b/theme/css/backgrounds.php | |||
@@ -0,0 +1,148 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css/backgrounds.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | ?> | ||
25 | /* Four Island Background CSS */ | ||
26 | <?php | ||
27 | |||
28 | include_once('../includes/specialdates.php'); | ||
29 | |||
30 | if (sd_ifNoSpecialDay()) | ||
31 | { | ||
32 | $bgimgm = 'island6'; | ||
33 | } elseif (sd_isSpecialDay('Four Island A')) | ||
34 | { | ||
35 | $bgimgm = 'islandYearly'; | ||
36 | } elseif (sd_isSpecialDay('Christmas Eve')) | ||
37 | { | ||
38 | $bgimgm = 'christmasEve'; | ||
39 | $bgcolor = 'black'; | ||
40 | } elseif (sd_isSpecialDay('Christmas Day')) | ||
41 | { | ||
42 | $bgimgm = 'christmas'; | ||
43 | } elseif (sd_isSpecialDay('New Years Eve')) | ||
44 | { | ||
45 | $bgimgm = 'newYearsEve'; | ||
46 | $bgcolor = 'black'; | ||
47 | } elseif (sd_isSpecialDay('Veterans Day')) | ||
48 | { | ||
49 | $bgimgm = 'veterans'; | ||
50 | } elseif (sd_isSpecialDay('Independance Day')) | ||
51 | { | ||
52 | $bgimgm = '4ofjuly'; | ||
53 | $bgcolor = 'black'; | ||
54 | } elseif (sd_isSpecialDay('Fathers Day')) | ||
55 | { | ||
56 | $bgimgm = 'fathers'; | ||
57 | } elseif (sd_isSpecialDay('Hatkirbys B-Day')) | ||
58 | { | ||
59 | $bgimgm = 'hatkirbybday'; | ||
60 | } elseif (sd_isSpecialDay('Kirby Week')) | ||
61 | { | ||
62 | $bgimgm = 'kirbyweek'; | ||
63 | } elseif (sd_isSpecialDay('Memorial Day')) | ||
64 | { | ||
65 | $bgimgm = 'memorial'; | ||
66 | $bgcolor = 'gray'; | ||
67 | } elseif (sd_isSpecialDay('Mothers Day')) | ||
68 | { | ||
69 | $bgimgm = 'mothers'; | ||
70 | } elseif (sd_isSpecialDay('New Years Day')) | ||
71 | { | ||
72 | $bgimgm = 'newYear'; | ||
73 | } elseif (sd_isSpecialDay('Ash Wednesday')) | ||
74 | { | ||
75 | $bgimgm = 'ashWeds'; | ||
76 | } elseif (sd_isSpecialDay('Columbus Day')) | ||
77 | { | ||
78 | $bgimgm = 'columbus'; | ||
79 | } elseif (sd_isSpecialDay('Easter')) | ||
80 | { | ||
81 | $bgimgm = 'easter'; | ||
82 | } elseif (sd_isSpecialDay('Flag Day')) | ||
83 | { | ||
84 | $bgimgm = 'flagDay'; | ||
85 | } elseif (sd_isSpecialDay('Good Friday')) | ||
86 | { | ||
87 | $bgimgm = 'goodFriday'; | ||
88 | } elseif (sd_isSpecialDay('Groundhog Day')) | ||
89 | { | ||
90 | $bgimgm = 'groundhog'; | ||
91 | } elseif (sd_isSpecialDay('Halloween')) | ||
92 | { | ||
93 | $bgimgm = 'halloween'; | ||
94 | $bgcolor = 'black'; | ||
95 | } elseif (sd_isSpecialDay('Mardi Gras')) | ||
96 | { | ||
97 | $bgimgm = 'mardiGras'; | ||
98 | } elseif (sd_isSpecialDay('Martin Luther King Day')) | ||
99 | { | ||
100 | $bgimgm = 'martinLuther'; | ||
101 | } elseif (sd_isSpecialDay('Valentines Day')) | ||
102 | { | ||
103 | $bgimgm = 'valentines'; | ||
104 | } else { | ||
105 | $bgimgm = 'island6'; | ||
106 | } | ||
107 | |||
108 | if (isset($_GET['nolayout'])) | ||
109 | { | ||
110 | if ((date('G') >= 20) || (date('G') <= 6)) | ||
111 | { | ||
112 | // $bodyID = 'night'; | ||
113 | } else { | ||
114 | $bodyID = 'day'; | ||
115 | } | ||
116 | } else { | ||
117 | $bodyID = $_GET['id']; | ||
118 | } | ||
119 | |||
120 | if (!isset($bgcolor)) {$bgcolor='aqua';} | ||
121 | if (($bgimgm == 'island6') && ($bodyID == 'night')) {$bgcolor='black';} | ||
122 | |||
123 | ?> | ||
124 | /* Body */ | ||
125 | |||
126 | body { | ||
127 | background-color: <?php echo($bgcolor); ?>; | ||
128 | background-image: url(/theme/images/backgrounds/<?php echo($bgimgm); ?>.PNG); | ||
129 | background-repeat: repeat-x; | ||
130 | background-attachment: fixed; | ||
131 | background-position: bottom left; | ||
132 | font-family: Arial, FreeSans; | ||
133 | margin: 0px; | ||
134 | padding: 0px 0px 30px !important; | ||
135 | } | ||
136 | |||
137 | <?php | ||
138 | |||
139 | if ($bgimgm == 'island6') | ||
140 | { | ||
141 | ?> | ||
142 | body#night { | ||
143 | background: black url(/theme/images/backgrounds/island6night.PNG) repeat-x fixed bottom left; | ||
144 | } | ||
145 | |||
146 | <?php | ||
147 | } | ||
148 | ?> | ||
diff --git a/theme/css/bubbles.css b/theme/css/bubbles.css new file mode 100644 index 0000000..e48eba0 --- /dev/null +++ b/theme/css/bubbles.css | |||
@@ -0,0 +1,71 @@ | |||
1 | /* Normal Bubble */ | ||
2 | div.bubble { | ||
3 | width: auto; | ||
4 | font-size: 0.75em; | ||
5 | margin-bottom: 24px; | ||
6 | font: 1em "Lucida Grande", Lucida, Verdana, sans-serif; | ||
7 | } | ||
8 | |||
9 | div.bubble blockquote { | ||
10 | margin: 0px; | ||
11 | padding: 0px; | ||
12 | border: 1px solid #c9c2c1; | ||
13 | background-color: #fff; | ||
14 | } | ||
15 | |||
16 | div.bubble blockquote div { | ||
17 | margin: 10px; | ||
18 | padding: 0px; | ||
19 | } | ||
20 | |||
21 | div.bubble cite { | ||
22 | position: relative; | ||
23 | margin: 0px; | ||
24 | padding: 7px 0px 0px 15px; | ||
25 | top: 6px; | ||
26 | background: transparent url(/theme/images/tip.gif) no-repeat 20px 0; | ||
27 | font-style: normal; | ||
28 | font-size: small; | ||
29 | } | ||
30 | |||
31 | /* Rounded Bubble */ | ||
32 | div.bubble div.rounded { | ||
33 | margin-bottom: 10px; | ||
34 | border: 3px solid #fff; | ||
35 | background-color: #b7e0ff; | ||
36 | } | ||
37 | div.bubble div.rounded blockquote { | ||
38 | border: 0; | ||
39 | background-color: transparent; | ||
40 | } | ||
41 | div.bubble div.rounded blockquote div { | ||
42 | margin: 0px 10px; | ||
43 | } | ||
44 | div.bubble cite.rounded { | ||
45 | position: relative; | ||
46 | margin: 0px; | ||
47 | padding-left: 15px; | ||
48 | padding-top: 12px; | ||
49 | top: 9px; | ||
50 | background: transparent url(/theme/images/tip-rounded.gif) no-repeat 15px 0; | ||
51 | } | ||
52 | |||
53 | /* Pimped Bubble */ | ||
54 | div#pimped.bubble { | ||
55 | font-size: 0.9em; | ||
56 | } | ||
57 | div#pimped.bubble div.rounded { | ||
58 | color: #fff; | ||
59 | border: 3px solid #fff; | ||
60 | background-color: #111; | ||
61 | } | ||
62 | div#pimped.bubble cite.rounded { | ||
63 | background: transparent url(/theme/images/tip-pimped.gif) no-repeat 15px 0; | ||
64 | } | ||
65 | |||
66 | div.bubble div.bquote blockquote { | ||
67 | margin: 0px; | ||
68 | padding: 0px; | ||
69 | border: 1px solid #c9c2c1; | ||
70 | background-color: #fff; | ||
71 | } | ||
diff --git a/theme/css/headers.php b/theme/css/headers.php new file mode 100755 index 0000000..bb5a179 --- /dev/null +++ b/theme/css/headers.php | |||
@@ -0,0 +1,85 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css/headers.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | ?> | ||
26 | /* Four Island Header CSS */ | ||
27 | <?php | ||
28 | |||
29 | include_once('../includes/specialdates.php'); | ||
30 | |||
31 | if (sd_ifNoSpecialDay()) | ||
32 | { | ||
33 | $bgimgm = 'main'; | ||
34 | } elseif (sd_isSpecialDay('Four Island A')) | ||
35 | { | ||
36 | $bgimgm = 'islandYearly'; | ||
37 | } elseif (sd_isSpecialDay('Mothers Day')) | ||
38 | { | ||
39 | $bgimgm = 'mothers'; | ||
40 | } elseif (sd_isSpecialDay('Memorial Day')) | ||
41 | { | ||
42 | $bgimgm = 'memorial'; | ||
43 | } elseif (sd_isSpecialDay('Hatkirbys B-Day')) | ||
44 | { | ||
45 | $bgimgm = 'hatkirbybday'; | ||
46 | } else if (sd_isSpecialDay('CTNH')) | ||
47 | { | ||
48 | $bgimgm = 'ctnh'; | ||
49 | } else { | ||
50 | $bgimgm = 'main'; | ||
51 | } | ||
52 | |||
53 | if ($bgimgm == 'main') | ||
54 | { | ||
55 | //Check for page-based headers | ||
56 | ?> | ||
57 | /* Category-Based Headers */ | ||
58 | body.projects div#banner { | ||
59 | background-image: url("/theme/images/headers/projects.png"); | ||
60 | } | ||
61 | body.wiki div#banner { | ||
62 | background-image: url("/theme/images/headers/kfm.png"); | ||
63 | } | ||
64 | body.fourm div#banner { | ||
65 | background-image: url("/theme/images/headers/fourm.png"); | ||
66 | } | ||
67 | body.misc div#banner { | ||
68 | background-image: url("/theme/images/headers/random.png"); | ||
69 | } | ||
70 | body.webs div#banner { | ||
71 | background-image: url("/theme/images/headers/links.png"); | ||
72 | } | ||
73 | body.quotes div#banner { | ||
74 | background-image: url("/theme/images/headers/quotes.png"); | ||
75 | } | ||
76 | body.poll div#banner { | ||
77 | background-image: url("/theme/images/headers/potw.png"); | ||
78 | } | ||
79 | /* AID-Based Headers */ | ||
80 | <?php | ||
81 | } | ||
82 | ?> | ||
83 | div#banner { | ||
84 | background-image: url("/theme/images/headers/<?php echo($bgimgm); ?>.png"); /*850x129*/ | ||
85 | } | ||
diff --git a/theme/css/navigation.php b/theme/css/navigation.php new file mode 100755 index 0000000..4b5f117 --- /dev/null +++ b/theme/css/navigation.php | |||
@@ -0,0 +1,198 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css/navigation.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | ?> | ||
26 | /* Four Island NavBar CSS */ | ||
27 | |||
28 | ul#bannernav { | ||
29 | list-style: none; | ||
30 | clear: both; | ||
31 | margin: 0px; | ||
32 | } | ||
33 | |||
34 | div#banner-nav { | ||
35 | height: 30px; | ||
36 | clear: both; | ||
37 | margin: 1px 30px 0 30px; | ||
38 | background: url("/theme/images/bg_navbar.gif") repeat-x 0 0; | ||
39 | } | ||
40 | |||
41 | ul#bannernav li { | ||
42 | float: left; | ||
43 | margin: 0; | ||
44 | padding: 0; | ||
45 | padding-right: 6px; | ||
46 | } | ||
47 | |||
48 | ul#bannernav li a { | ||
49 | text-decoration: none; | ||
50 | display: block; | ||
51 | width: 100; | ||
52 | height: 30; | ||
53 | } | ||
54 | |||
55 | ul#bannernav li a span { | ||
56 | visibility: hidden; | ||
57 | } | ||
58 | |||
59 | ul#bannernav li img { | ||
60 | display: none; | ||
61 | } | ||
62 | |||
63 | ul#bannernav li#bannernav-home a { | ||
64 | background-image: url("/theme/images/Home.gif"); | ||
65 | } | ||
66 | |||
67 | body.home ul#bannernav li#bannernav-home a, | ||
68 | ul#bannernav li#bannernav-home a:hover { | ||
69 | background-image: url("/theme/images/Home_ro.gif"); | ||
70 | } | ||
71 | |||
72 | ul#bannernav li#bannernav-projects a { | ||
73 | background-image: url("/theme/images/Projects.gif"); | ||
74 | } | ||
75 | |||
76 | body.projects ul#bannernav li#bannernav-projects a, | ||
77 | ul#bannernav li#bannernav-projects a:hover { | ||
78 | background-image: url("/theme/images/Projects_ro.gif"); | ||
79 | } | ||
80 | |||
81 | ul#bannernav li#bannernav-wiki a { | ||
82 | background-image: url("/theme/images/Wiki.gif"); | ||
83 | } | ||
84 | |||
85 | body.wiki ul#bannernav li#bannernav-wiki a, | ||
86 | ul#bannernav li#bannernav-wiki a:hover { | ||
87 | background-image: url("/theme/images/Wiki_ro.gif"); | ||
88 | } | ||
89 | |||
90 | ul#bannernav li#bannernav-fourm a { | ||
91 | background-image: url("/theme/images/Fourm.gif"); | ||
92 | } | ||
93 | |||
94 | body.fourm ul#bannernav li#bannernav-fourm a, | ||
95 | ul#bannernav li#bannernav-fourm a:hover { | ||
96 | background-image: url("/theme/images/Fourm_ro.gif"); | ||
97 | } | ||
98 | |||
99 | ul#bannernav li#bannernav-misc a { | ||
100 | background-image: url("/theme/images/Random.gif"); | ||
101 | } | ||
102 | |||
103 | body.misc ul#bannernav li#bannernav-misc a, | ||
104 | ul#bannernav li#bannernav-misc a:hover { | ||
105 | background-image: url("/theme/images/Random_ro.gif"); | ||
106 | } | ||
107 | |||
108 | ul#bannernav li#bannernav-webs a { | ||
109 | background-image: url("/theme/images/Links.gif"); | ||
110 | } | ||
111 | |||
112 | body.webs ul#bannernav li#bannernav-webs a, | ||
113 | ul#bannernav li#bannernav-webs a:hover { | ||
114 | background-image: url("/theme/images/Links_ro.gif"); | ||
115 | } | ||
116 | |||
117 | ul#bannernav li#bannernav-poll a { | ||
118 | background-image: url("/theme/images/Poll.gif"); | ||
119 | } | ||
120 | |||
121 | body.poll ul#bannernav li#bannernav-poll a, | ||
122 | ul#bannernav li#bannernav-poll a:hover { | ||
123 | background-image: url("/theme/images/Poll_ro.gif"); | ||
124 | } | ||
125 | |||
126 | ul#bannernav li#bannernav-quotes a { | ||
127 | background-image: url("/theme/images/Quotes.gif"); | ||
128 | } | ||
129 | |||
130 | body.quotes ul#bannernav li#bannernav-quotes a, | ||
131 | ul#bannernav li#bannernav-quotes a:hover { | ||
132 | background-image: url("/theme/images/Quotes_ro.gif"); | ||
133 | } | ||
134 | |||
135 | ul#bannernav li#bannernav-login a { | ||
136 | background-image: url("/theme/images/Login.gif"); | ||
137 | } | ||
138 | |||
139 | body.login ul#bannernav li#bannernav-login a, | ||
140 | ul#bannernav li#bannernav-login a:hover { | ||
141 | background-image: url("/theme/images/Login_ro.gif"); | ||
142 | } | ||
143 | |||
144 | ul#bannernav li#bannernav-logout a { | ||
145 | background-image: url("/theme/images/Logout.gif"); | ||
146 | } | ||
147 | |||
148 | ul#bannernav li#bannernav-logout a:hover { | ||
149 | background-image: url("/theme/images/Logout_ro.gif"); | ||
150 | } | ||
151 | |||
152 | ul#bannernav li#bannernav-panel a { | ||
153 | background-image: url("/theme/images/Panel.gif"); | ||
154 | } | ||
155 | |||
156 | body.panel ul#bannernav li#bannernav-panel a, | ||
157 | ul#bannernav li#bannernav-panel a:hover { | ||
158 | background-image: url("/theme/images/Panel_ro.gif"); | ||
159 | } | ||
160 | |||
161 | ul#bannernav li#bannernav-search { | ||
162 | display: block; | ||
163 | float: right; | ||
164 | width: 165px; | ||
165 | height: 30px; | ||
166 | margin: 0px; | ||
167 | background: url("/theme/images/bg_search.gif") 0 0 no-repeat; | ||
168 | } | ||
169 | |||
170 | ul#bannernav li#bannernav-search fieldset { | ||
171 | border: none; | ||
172 | padding-top: 6px; | ||
173 | border-width:0pt; | ||
174 | font-family:Verdana,Helvetica,Arial,sans-serif; | ||
175 | font-size:1.1em; | ||
176 | } | ||
177 | |||
178 | ul#bannernav li#bannernav-search input { | ||
179 | width: 125px; | ||
180 | height: 19px !important; | ||
181 | margin-left: 13px; | ||
182 | border: none !important; | ||
183 | background-color: transparent; | ||
184 | cursor:pointer; | ||
185 | font-family:Verdana,Helvetica,Arial,sans-serif; | ||
186 | font-weight:normal; | ||
187 | padding:0pt 3px; | ||
188 | vertical-align:middle; | ||
189 | line-height:1.3em; | ||
190 | color:#536482; | ||
191 | margin-top: -20px; | ||
192 | } | ||
193 | |||
194 | body.fourm ul#bannernav li#bannernav-search input { | ||
195 | margin-top: 0px; | ||
196 | font-size: 1.1em !important; | ||
197 | margin-left: 28px; | ||
198 | } | ||
diff --git a/theme/css/quotes.php b/theme/css/quotes.php new file mode 100644 index 0000000..f66ad14 --- /dev/null +++ b/theme/css/quotes.php | |||
@@ -0,0 +1,199 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css/quotes.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | ?> | ||
26 | /* site-wide */ | ||
27 | div#site_all{ | ||
28 | font-family: serif; | ||
29 | font-size: 12pt; | ||
30 | margin-left: 9%; | ||
31 | margin-right: 9%; | ||
32 | } | ||
33 | a#site_nav_admin{ | ||
34 | color: #c08000; | ||
35 | } | ||
36 | a#site_nav_logout{ | ||
37 | color: #000000; | ||
38 | } | ||
39 | a#site_admin_flag, a#site_admin_queue{ | ||
40 | color: #336699; | ||
41 | } | ||
42 | |||
43 | |||
44 | /* quote-output styles */ | ||
45 | |||
46 | div.quote_quote{ | ||
47 | padding-bottom: 5pt; | ||
48 | } | ||
49 | div.quote_whole{ | ||
50 | padding-top: 10pt; | ||
51 | } | ||
52 | |||
53 | /* searchpage */ | ||
54 | input#search_submit-button{ | ||
55 | background-color: #c08000; | ||
56 | } | ||
57 | input#search_query-box{ | ||
58 | background-color: #f0f0f0; | ||
59 | } | ||
60 | select#search_sortby-dropdown{ | ||
61 | background-color: #f0f0f0; | ||
62 | } | ||
63 | select#search_limit-dropdown{ | ||
64 | background-color: #f0f0f0; | ||
65 | } | ||
66 | |||
67 | |||
68 | /* home_*: styles for the default homepage */ | ||
69 | |||
70 | div.home_news_date{ | ||
71 | font-weight: bold; | ||
72 | } | ||
73 | div#home_greeting{ | ||
74 | float: left; | ||
75 | width: 50%; | ||
76 | } | ||
77 | div#home_news{ | ||
78 | width: 100%; | ||
79 | } | ||
80 | |||
81 | |||
82 | /* *admin*: used on administration pages and admin-only content */ | ||
83 | |||
84 | div#site_admin_nav{ | ||
85 | position: relative; | ||
86 | margin-top: 90pt; | ||
87 | clear: both; | ||
88 | margin-top: -.1pt; | ||
89 | } | ||
90 | div#site_admin_nav_upper_linkbar{ | ||
91 | background-color: #f0f0f0; | ||
92 | } | ||
93 | div#site_admin_nav_lower_infobar{ | ||
94 | background-color: #c08000; | ||
95 | text-align: right; | ||
96 | } | ||
97 | html>body div#site_admin_nav{ /* hack for firefox, disabled in opera and ie */ | ||
98 | margin-top: 0pt; | ||
99 | } | ||
100 | .admin_queue_alt1{ | ||
101 | background-color: #ffffff; | ||
102 | } | ||
103 | .admin_queue_alt2{ | ||
104 | background-color: #f0f0f0; | ||
105 | } | ||
106 | input#admin_login_username-box{ | ||
107 | background-color: #f0f0f0; | ||
108 | } | ||
109 | input#admin_login_password-box{ | ||
110 | background-color: #f0f0f0; | ||
111 | } | ||
112 | input#admin_login_submit-button{ | ||
113 | background-color: #c08000; | ||
114 | } | ||
115 | |||
116 | |||
117 | /* site_nav_*: navigation on the top, for everyone */ | ||
118 | |||
119 | div#site_nav_lower{ | ||
120 | background-color: #f0f0f0; | ||
121 | } | ||
122 | div#site_nav_lower_linkbar{ | ||
123 | clear: both; | ||
124 | text-align: right; | ||
125 | } | ||
126 | div#site_nav_upper{ | ||
127 | background-color: #c08000; | ||
128 | padding: 3px; | ||
129 | } | ||
130 | div#site_nav_upper_qms{ | ||
131 | position: relative; | ||
132 | z-index: 1; | ||
133 | float: left; | ||
134 | font-size: 14pt; | ||
135 | font-weight: bold; | ||
136 | font-style: italic; | ||
137 | } | ||
138 | div#site_nav_upper_qms-long{ | ||
139 | position: relative; | ||
140 | z-index: 1; | ||
141 | float: right; | ||
142 | font-weight: bold; | ||
143 | font-size: 15pt; | ||
144 | } | ||
145 | div#site_nav{ | ||
146 | position: relative; | ||
147 | z-index: 0; | ||
148 | } | ||
149 | |||
150 | |||
151 | /* user-based functions */ | ||
152 | div#add_outputmsg_quote{ | ||
153 | padding-top: 10pt; | ||
154 | font-family: monospace; | ||
155 | padding-bottom: 10pt; | ||
156 | } | ||
157 | |||
158 | |||
159 | /* page titles */ | ||
160 | div#quote_origin-name{ | ||
161 | font-size: 23.6pt; | ||
162 | font-weight: bold; | ||
163 | } | ||
164 | div#search_title{ | ||
165 | font-size: 23.6pt; | ||
166 | font-weight: bold; | ||
167 | } | ||
168 | div#admin_add-news_title{ | ||
169 | font-size: 23.6pt; | ||
170 | font-weight: bold; | ||
171 | } | ||
172 | div#add_title{ | ||
173 | font-size: 23.6pt; | ||
174 | font-weight: bold; | ||
175 | } | ||
176 | div#admin_queue_title{ | ||
177 | font-size: 23.6pt; | ||
178 | font-weight: bold; | ||
179 | } | ||
180 | div#admin_flag_title{ | ||
181 | font-size: 23.6pt; | ||
182 | font-weight: bold; | ||
183 | } | ||
184 | div#admin_change-pw_title{ | ||
185 | font-size: 23.6pt; | ||
186 | font-weight: bold; | ||
187 | } | ||
188 | div#admin_users_title{ | ||
189 | font-size: 23.6pt; | ||
190 | font-weight: bold; | ||
191 | } | ||
192 | div#admin_add-user_title{ | ||
193 | font-size: 23.6pt; | ||
194 | font-weight: bold; | ||
195 | } | ||
196 | |||
197 | div.quote_pagenums{ | ||
198 | text-align: center; | ||
199 | } | ||
diff --git a/theme/css/thickbox.css b/theme/css/thickbox.css new file mode 100755 index 0000000..0de29b2 --- /dev/null +++ b/theme/css/thickbox.css | |||
@@ -0,0 +1,164 @@ | |||
1 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
2 | /* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ | ||
3 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
4 | *{padding: 0; margin: 0;} | ||
5 | |||
6 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
7 | /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ | ||
8 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
9 | #TB_window { | ||
10 | font: 12px Arial, Helvetica, sans-serif; | ||
11 | color: #333333; | ||
12 | } | ||
13 | |||
14 | #TB_secondLine { | ||
15 | font: 10px Arial, Helvetica, sans-serif; | ||
16 | color:#666666; | ||
17 | } | ||
18 | |||
19 | #TB_window a:link {color: #666666;} | ||
20 | #TB_window a:visited {color: #666666;} | ||
21 | #TB_window a:hover {color: #000;} | ||
22 | #TB_window a:active {color: #666666;} | ||
23 | #TB_window a:focus{color: #666666;} | ||
24 | |||
25 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
26 | /* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ | ||
27 | /* ----------------------------------------------------------------------------------------------------------------*/ | ||
28 | #TB_overlay { | ||
29 | position: fixed; | ||
30 | z-index:100; | ||
31 | top: 0px; | ||
32 | left: 0px; | ||
33 | height:100%; | ||
34 | width:100%; | ||
35 | } | ||
36 | |||
37 | .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} | ||
38 | .TB_overlayBG { | ||
39 | background-color:#000; | ||
40 | filter:alpha(opacity=75); | ||
41 | -moz-opacity: 0.75; | ||
42 | opacity: 0.75; | ||
43 | } | ||
44 | |||
45 | * html #TB_overlay { /* ie6 hack */ | ||
46 | position: absolute; | ||
47 | height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); | ||
48 | } | ||
49 | |||
50 | #TB_window { | ||
51 | position: fixed; | ||
52 | background: #ffffff; | ||
53 | z-index: 102; | ||
54 | color:#000000; | ||
55 | display:none; | ||
56 | border: 4px solid #525252; | ||
57 | text-align:left; | ||
58 | top:50%; | ||
59 | left:50%; | ||
60 | } | ||
61 | |||
62 | * html #TB_window { /* ie6 hack */ | ||
63 | position: absolute; | ||
64 | margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); | ||
65 | } | ||
66 | |||
67 | #TB_window img#TB_Image { | ||
68 | display:block; | ||
69 | margin: 15px 0 0 15px; | ||
70 | border-right: 1px solid #ccc; | ||
71 | border-bottom: 1px solid #ccc; | ||
72 | border-top: 1px solid #666; | ||
73 | border-left: 1px solid #666; | ||
74 | } | ||
75 | |||
76 | #TB_caption{ | ||
77 | height:25px; | ||
78 | padding:7px 30px 10px 25px; | ||
79 | float:left; | ||
80 | } | ||
81 | |||
82 | #TB_closeWindow{ | ||
83 | height:25px; | ||
84 | padding:11px 25px 10px 0; | ||
85 | float:right; | ||
86 | } | ||
87 | |||
88 | #TB_closeAjaxWindow{ | ||
89 | padding:7px 10px 5px 0; | ||
90 | margin-bottom:1px; | ||
91 | text-align:right; | ||
92 | float:right; | ||
93 | } | ||
94 | |||
95 | #TB_ajaxWindowTitle{ | ||
96 | float:left; | ||
97 | padding:7px 0 5px 10px; | ||
98 | margin-bottom:1px; | ||
99 | } | ||
100 | |||
101 | #TB_title{ | ||
102 | background-color:#e8e8e8; | ||
103 | height:27px; | ||
104 | } | ||
105 | |||
106 | #TB_ajaxContent{ | ||
107 | clear:both; | ||
108 | padding:2px 15px 15px 15px; | ||
109 | overflow:auto; | ||
110 | text-align:center; | ||
111 | line-height:1.4em; | ||
112 | background: url(/theme/images/backgrounds/island6.PNG) bottom; | ||
113 | } | ||
114 | |||
115 | #TB_ajaxContent.TB_modal{ | ||
116 | padding:15px; | ||
117 | } | ||
118 | |||
119 | #TB_ajaxContent p{ | ||
120 | padding:5px 0px 5px 0px; | ||
121 | } | ||
122 | |||
123 | #TB_load{ | ||
124 | position: fixed; | ||
125 | display:none; | ||
126 | height:13px; | ||
127 | width:208px; | ||
128 | z-index:103; | ||
129 | top: 50%; | ||
130 | left: 50%; | ||
131 | margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ | ||
132 | } | ||
133 | |||
134 | * html #TB_load { /* ie6 hack */ | ||
135 | position: absolute; | ||
136 | margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); | ||
137 | } | ||
138 | |||
139 | #TB_HideSelect{ | ||
140 | z-index:99; | ||
141 | position:fixed; | ||
142 | top: 0; | ||
143 | left: 0; | ||
144 | background-color:#fff; | ||
145 | border:none; | ||
146 | filter:alpha(opacity=0); | ||
147 | -moz-opacity: 0; | ||
148 | opacity: 0; | ||
149 | height:100%; | ||
150 | width:100%; | ||
151 | } | ||
152 | |||
153 | * html #TB_HideSelect { /* ie6 hack */ | ||
154 | position: absolute; | ||
155 | height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); | ||
156 | } | ||
157 | |||
158 | #TB_iframeContent{ | ||
159 | clear:both; | ||
160 | border:none; | ||
161 | margin-bottom:-1px; | ||
162 | margin-top:1px; | ||
163 | _margin-bottom:1px; | ||
164 | } | ||
diff --git a/theme/css/uniform.php b/theme/css/uniform.php new file mode 100644 index 0000000..0a57b49 --- /dev/null +++ b/theme/css/uniform.php | |||
@@ -0,0 +1,270 @@ | |||
1 | /* Four Island UniForm CSS */ | ||
2 | |||
3 | /* uniForm */ | ||
4 | .uniForm{ | ||
5 | margin:0; padding:0; | ||
6 | position:relative; | ||
7 | width:100%; | ||
8 | /* user prefs */ | ||
9 | padding:10px 0; | ||
10 | } | ||
11 | |||
12 | /* Some generals */ | ||
13 | .uniForm fieldset{ | ||
14 | border:none; | ||
15 | margin:0; padding:0; | ||
16 | /* user prefs */ | ||
17 | margin:0 0 7px 0; padding:0 0 10px 0; | ||
18 | border-bottom:1px solid #efefef; | ||
19 | } | ||
20 | .uniForm fieldset legend{ | ||
21 | color:#000; /* Reset IE */ | ||
22 | margin:0; padding:0; | ||
23 | /* user prefs */ | ||
24 | margin:0 0 .5em 0; | ||
25 | font:bold small-caps 100%/100% "lucida grande", "lucida sans unicode", "trebuchet ms", arial, verdana, sans-serif; | ||
26 | letter-spacing:.1em; | ||
27 | color:#93b5be; | ||
28 | } | ||
29 | |||
30 | .ctrlHolder{ /* This is the main unit that contains our form "modules" */ | ||
31 | overflow:hidden; | ||
32 | margin:0; padding:0; | ||
33 | clear:both; | ||
34 | /* user prefs */ | ||
35 | background:#f9f9f9; | ||
36 | margin:0; padding:7px 4px; | ||
37 | } | ||
38 | |||
39 | .buttonHolder{ | ||
40 | overflow:hidden; | ||
41 | clear:both; | ||
42 | /* user prefs */ | ||
43 | background:#f9f9f9; | ||
44 | border:1px solid #ccc; border-width:1px 0; | ||
45 | margin:10px 0 0 0; padding:10px; | ||
46 | text-align:right; | ||
47 | } | ||
48 | .resetButton{ | ||
49 | } | ||
50 | .submitButton{ | ||
51 | } | ||
52 | |||
53 | .uniForm .inlineLabel{ | ||
54 | width:auto; | ||
55 | float:none; | ||
56 | display:inline; | ||
57 | /* user prefs */ | ||
58 | margin:0 2em 0 0; | ||
59 | font-weight:normal; | ||
60 | } | ||
61 | .uniForm .inlineLabel input{ | ||
62 | } | ||
63 | |||
64 | /* Highlighting the rows on input focus */ | ||
65 | .focused{ | ||
66 | background:#FFFCDF url(/theme/images/uf_focused.png); | ||
67 | border:1px solid #EFE795; border-width:1px 0; | ||
68 | padding:6px 4px; | ||
69 | } | ||
70 | |||
71 | |||
72 | /* Styles for form controls where labels are in line with the input elements */ | ||
73 | /* Set the class to the parent to .inlineLabels */ | ||
74 | .inlineLabels .ctrlHolder{ | ||
75 | } | ||
76 | .inlineLabels label, | ||
77 | .inlineLabels .label{ | ||
78 | float:left; | ||
79 | margin:.3em 0 0 0; padding:0; | ||
80 | line-height:100%; | ||
81 | /* user prefs */ | ||
82 | width:30%; | ||
83 | font-weight:bold; | ||
84 | } | ||
85 | |||
86 | .inlineLabels .textInput, | ||
87 | .inlineLabels .fileUpload{ | ||
88 | float:left; | ||
89 | /* user prefs */ | ||
90 | width:68%; | ||
91 | border:2px solid #dfdfdf; | ||
92 | } | ||
93 | .inlineLabels .fileUpload > input{ | ||
94 | } | ||
95 | |||
96 | .inlineLabels .selectInput{ | ||
97 | float:left; | ||
98 | /* user prefs */ | ||
99 | width:69%; | ||
100 | border:2px solid #dfdfdf; | ||
101 | } | ||
102 | |||
103 | .inlineLabels textarea{ | ||
104 | float:left; | ||
105 | width:68%; | ||
106 | /* user prefs */ | ||
107 | border:2px solid #dfdfdf; | ||
108 | height:12em; | ||
109 | } | ||
110 | |||
111 | .inlineLabels .formHint{ | ||
112 | clear:both; | ||
113 | /* user prefs */ | ||
114 | color:#999; | ||
115 | margin:.5em 0 0 30%; padding:3px 0; | ||
116 | font-size:80%; | ||
117 | } | ||
118 | |||
119 | /* inlineLabels esthetics */ | ||
120 | .inlineLabels .formHint strong{ | ||
121 | padding:0 0 0 14px; | ||
122 | background:url(/theme/images/icon_alert.png) 0 0 no-repeat; | ||
123 | display:inline-block; | ||
124 | } | ||
125 | |||
126 | |||
127 | /* ########################################################################## */ | ||
128 | |||
129 | /* Styles for form controls where labels are above the input elements */ | ||
130 | /* Set the class to the parent to .blockLabels */ | ||
131 | .blockLabels .ctrlHolder{ | ||
132 | } | ||
133 | |||
134 | .blockLabels label, | ||
135 | .blockLabels .label{ | ||
136 | display:block; | ||
137 | float:none; | ||
138 | margin:.3em 0; padding:0; | ||
139 | line-height:100%; | ||
140 | width:60%; | ||
141 | /* user prefs */ | ||
142 | font-weight:bold; | ||
143 | width:auto; | ||
144 | } | ||
145 | .blockLabels .label{ | ||
146 | float:left; | ||
147 | margin-right:3em; | ||
148 | } | ||
149 | |||
150 | .blockLabels .textInput{ | ||
151 | float:left; | ||
152 | width:60%; | ||
153 | /* user prefs */ | ||
154 | border:2px solid #dfdfdf; | ||
155 | } | ||
156 | |||
157 | .blockLabels .selectInput{ | ||
158 | float:left; | ||
159 | width:60%; | ||
160 | /* user prefs */ | ||
161 | border:2px solid #dfdfdf; | ||
162 | |||
163 | } | ||
164 | |||
165 | .blockLabels textarea{ | ||
166 | display:block; | ||
167 | float:left; | ||
168 | /* user prefs */ | ||
169 | border:2px solid #dfdfdf; | ||
170 | height:12em; | ||
171 | } | ||
172 | |||
173 | .blockLabels .formHint{ | ||
174 | float:right; | ||
175 | margin:0; | ||
176 | width:38%; | ||
177 | clear:none; | ||
178 | /* user prefs */ | ||
179 | color:#999; | ||
180 | font-size:80%; | ||
181 | font-style:italic; | ||
182 | } | ||
183 | |||
184 | /* blockLabels esthetics */ | ||
185 | .blockLabels .ctrlHolder{ | ||
186 | border:1px solid #dfdfdf; border-width:1px 0; | ||
187 | margin-top:-1px; | ||
188 | } | ||
189 | |||
190 | .blockLabels .focused{ | ||
191 | padding:7px 4px; | ||
192 | } | ||
193 | |||
194 | /* ########################################################################## */ | ||
195 | |||
196 | /* Focus pseudoclasses */ | ||
197 | .ctrlHolder .textInput:focus{ | ||
198 | border-color:#DFD77D; | ||
199 | } | ||
200 | div.focused .textInput:focus{ | ||
201 | } | ||
202 | div.focused .formHint{ | ||
203 | color:#000; | ||
204 | } | ||
205 | |||
206 | /* Required asterisk styling, use if needed */ | ||
207 | label em, | ||
208 | .label em{ | ||
209 | display:block; | ||
210 | position:absolute; left:28%; | ||
211 | font-style:normal; | ||
212 | font-weight:bold; | ||
213 | } | ||
214 | .blockLabels label em, | ||
215 | .blockLabels .label em{ | ||
216 | position:static; | ||
217 | display:inline; | ||
218 | } | ||
219 | |||
220 | /* Messages */ | ||
221 | .uniForm #errorMsg{ | ||
222 | background:#ffdfdf url(/theme/images/uf_error.png); | ||
223 | border:1px solid #df7d7d; border-width:1px 0; | ||
224 | margin:0 0 1em 0; padding:1em; | ||
225 | } | ||
226 | .uniForm .error, | ||
227 | .uniForm .blockLabels.ctrlHolder.error{ | ||
228 | background:#ffdfdf url(/theme/images/uf_error.png); | ||
229 | border:1px solid #df7d7d; border-width:1px 0; | ||
230 | position:relative; | ||
231 | } | ||
232 | .uniForm #errorMsg dt, | ||
233 | .uniForm #errorMsg h3{ | ||
234 | margin:0 0 .5em 0; | ||
235 | font-size:110%; | ||
236 | line-height:100%; | ||
237 | font-weight:bold; | ||
238 | color:#000; | ||
239 | padding:2px 0 2px 18px; | ||
240 | background:url(/theme/images/icon-error.png) 0 0 no-repeat; | ||
241 | } | ||
242 | .uniForm #errorMsg dd{ | ||
243 | margin:0; padding:0; | ||
244 | } | ||
245 | .uniForm #errorMsg ol{ | ||
246 | margin:0; padding:0; | ||
247 | } | ||
248 | .uniForm #errorMsg ol li{ | ||
249 | margin:0; padding:2px; | ||
250 | list-style-position:inside; | ||
251 | border-bottom:1px dotted #df7d7d; | ||
252 | position:relative; | ||
253 | } | ||
254 | .uniForm .errorField{ | ||
255 | margin:0 0 3px 0; | ||
256 | } | ||
257 | .uniForm .inlineLabels .errorField{ | ||
258 | margin-left:30%; | ||
259 | } | ||
260 | .uniForm .errorField strong{ | ||
261 | background:#FFE2E2; | ||
262 | padding:1px 3px 3px 3px; | ||
263 | } | ||
264 | .ctrlHolder.error input, | ||
265 | .ctrlHolder.error input:focus{ | ||
266 | border-color:#DF7D7D; | ||
267 | } | ||
268 | .ctrlHolder.error.focused{ | ||
269 | padding:7px 4px; | ||
270 | } | ||
diff --git a/theme/css/website.php b/theme/css/website.php new file mode 100755 index 0000000..9b26d7c --- /dev/null +++ b/theme/css/website.php | |||
@@ -0,0 +1,843 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 theme/css/website.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
22 | |||
23 | require('headerproc.php'); | ||
24 | |||
25 | ?> | ||
26 | /* Four Island General CSS */ | ||
27 | |||
28 | ul#bannernav, p { | ||
29 | margin:0pt; | ||
30 | padding:0pt; | ||
31 | } | ||
32 | |||
33 | .idw-container { | ||
34 | text-align: none !important; | ||
35 | } | ||
36 | |||
37 | p {margin-top: 1em;} | ||
38 | |||
39 | ul, ol {margin-top: 1em; margin-bottom: 1em} | ||
40 | |||
41 | /*li {margin-left: 60px}*/ | ||
42 | |||
43 | ::selection { | ||
44 | background: pink; | ||
45 | } | ||
46 | ::-moz-selection { | ||
47 | background: pink; | ||
48 | } | ||
49 | |||
50 | /* A (Links) */ | ||
51 | |||
52 | A:link { | ||
53 | color: blue; | ||
54 | font-weight: bold; | ||
55 | text-decoration: none; | ||
56 | } | ||
57 | |||
58 | A:visited { | ||
59 | color: blue; | ||
60 | text-decoration: none; | ||
61 | } | ||
62 | |||
63 | A:hover { | ||
64 | color: blue; | ||
65 | font-weight: bold; | ||
66 | text-decoration: none; | ||
67 | font-variant: small-caps; | ||
68 | text-transform: capitalize; | ||
69 | } | ||
70 | |||
71 | A:active { | ||
72 | color: blue; | ||
73 | text-decoration: none; | ||
74 | } | ||
75 | |||
76 | a img { | ||
77 | border: 0; | ||
78 | } | ||
79 | |||
80 | /* Random Elements */ | ||
81 | |||
82 | hr { | ||
83 | height:1px; | ||
84 | color: gray; | ||
85 | background: gray; | ||
86 | border: none; | ||
87 | text-align: left; | ||
88 | margin-left: 0; | ||
89 | } | ||
90 | |||
91 | .center { | ||
92 | text-align: center; | ||
93 | } | ||
94 | |||
95 | img.center, img[align="center"] { | ||
96 | display: block; | ||
97 | margin-left: auto; | ||
98 | margin-right: auto; | ||
99 | } | ||
100 | |||
101 | acronym, abbr, span.caps { | ||
102 | cursor: help; | ||
103 | } | ||
104 | |||
105 | acronym, abbr { | ||
106 | border-bottom: 1px dashed #999; | ||
107 | } | ||
108 | |||
109 | <?php if (!isset($_GET['nolayout'])) { ?> | ||
110 | |||
111 | blockquote { | ||
112 | padding-left: 10px; | ||
113 | border-left: 3px solid #CCC; | ||
114 | font-family: helvetica; | ||
115 | font-size: 14px; | ||
116 | margin-top: 10px; | ||
117 | margin-bottom: 10px; | ||
118 | margin-left: 50px; | ||
119 | } | ||
120 | |||
121 | <?php } ?> | ||
122 | |||
123 | pre { | ||
124 | line-height: 12px; | ||
125 | } | ||
126 | |||
127 | .toolTip { | ||
128 | border-bottom: 1px dashed #999; | ||
129 | cursor: help; | ||
130 | } | ||
131 | |||
132 | * html div#members { | ||
133 | position: absolute; | ||
134 | } | ||
135 | |||
136 | #wrap { | ||
137 | width: 910px; | ||
138 | background: #FFFFFF url("/theme/images/bg_body.gif") repeat-y 0 0; | ||
139 | margin: 10px auto; | ||
140 | text-align: left; | ||
141 | padding: 0; | ||
142 | margin-top: 25px; | ||
143 | /* margin-left: 50px; */ | ||
144 | } | ||
145 | |||
146 | #page-header { | ||
147 | background: url("/theme/images/bg_header.gif") repeat-x 0 0; | ||
148 | height: 150px; | ||
149 | clear: both; | ||
150 | } | ||
151 | |||
152 | span.side-left, span.side-right { | ||
153 | display: block; | ||
154 | width: 20px; | ||
155 | height: 150px; | ||
156 | background: url("/theme/images/sides_top.gif") no-repeat; | ||
157 | } | ||
158 | span.side-left { | ||
159 | float: left; | ||
160 | margin-right: 10px; | ||
161 | } | ||
162 | span.side-right { | ||
163 | background-position: 100% 0; | ||
164 | float: right; | ||
165 | } | ||
166 | span.fcorners-bottom, span.fcorners-bottom span { | ||
167 | font-size: 1px; | ||
168 | line-height: 1px; | ||
169 | display: block; | ||
170 | height: 20px; | ||
171 | background-repeat: no-repeat; | ||
172 | background-image: url("/theme/images/corners_bottom.gif"); | ||
173 | margin: 0; | ||
174 | } | ||
175 | span.fcorners-bottom { | ||
176 | background-position: 0 0; | ||
177 | } | ||
178 | span.fcorners-bottom span { | ||
179 | background-position: 100% -20px; | ||
180 | } | ||
181 | |||
182 | <?php //if (!isset($_GET['nolayout'])) { ?> | ||
183 | |||
184 | /* Banner */ | ||
185 | |||
186 | div#banner, div#fi-banner { | ||
187 | background-repeat: no-repeat; | ||
188 | width: 850px; | ||
189 | height: 129px; | ||
190 | float: left; | ||
191 | margin-top: 21px; | ||
192 | } | ||
193 | |||
194 | body div#banner h1, body div#fi-banner h1 { | ||
195 | margin: 0; | ||
196 | } | ||
197 | |||
198 | body div#banner h1 a, body div#fi-banner h1 a { | ||
199 | display: block; | ||
200 | width: 850px; | ||
201 | height: 129px; | ||
202 | text-indent: -5000px; | ||
203 | text-decoration: none; | ||
204 | margin: 0; | ||
205 | } | ||
206 | |||
207 | div#banner h1, div#fi-banner h1 { | ||
208 | margin: 0; | ||
209 | font-size: 3.0em; | ||
210 | font-weight: normal; | ||
211 | } | ||
212 | |||
213 | div#banner div#bannerNav, div#fi-banner div#bannerNav { | ||
214 | position: relative; | ||
215 | top: -20px; | ||
216 | } | ||
217 | |||
218 | #page-body { | ||
219 | margin: 0 30px; | ||
220 | clear: both; | ||
221 | } | ||
222 | |||
223 | body.fourm #page-body { | ||
224 | margin-left: 25; | ||
225 | margin-right: 10; | ||
226 | width: 95%; | ||
227 | font-size: 62.5%; | ||
228 | } | ||
229 | |||
230 | #phpBB3-page-body { | ||
231 | margin: 4px 0 !important; | ||
232 | clear: both; | ||
233 | } | ||
234 | |||
235 | div#pageTabs { | ||
236 | float: left; | ||
237 | margin-left: -40px; | ||
238 | padding-top: 140px; | ||
239 | } | ||
240 | |||
241 | body.fourm div#pageTabs { | ||
242 | margin-left: 0; | ||
243 | } | ||
244 | |||
245 | div#pageTabs ul li { | ||
246 | list-style-type: none; | ||
247 | background-image: url("/theme/images/tabUn.png"); | ||
248 | display: block; | ||
249 | height: 37; | ||
250 | width: 100; | ||
251 | margin-bottom: 2px; | ||
252 | text-align: right; | ||
253 | } | ||
254 | |||
255 | div#pageTabs ul li * { | ||
256 | padding-top: 4px; | ||
257 | padding-right: 2px; | ||
258 | } | ||
259 | |||
260 | body.main div#pageTabs ul li#bannernav-home, | ||
261 | body.projects div#pageTabs ul li#bannernav-proj, | ||
262 | body.wiki div#pageTabs ul li#bannernav-wiki, | ||
263 | body.fourm div#pageTabs ul li#bannernav-fourm, | ||
264 | body.misc div#pageTabs ul li#bannernav-misc, | ||
265 | body.webs div#pageTabs ul li#bannernav-webs, | ||
266 | body.login div#pageTabs ul li#bannernav-login { | ||
267 | background-image: url("/theme/images/tabSe.png"); | ||
268 | } | ||
269 | |||
270 | /* Sidebar */ | ||
271 | |||
272 | div#rightbar { | ||
273 | float: right; | ||
274 | width: 250px; /*210*/ | ||
275 | /* clear: right; */ | ||
276 | padding: 0 10; | ||
277 | } | ||
278 | |||
279 | div#iconbar { | ||
280 | text-align: center; | ||
281 | margin-left: 20px; | ||
282 | } | ||
283 | |||
284 | div#iconbar ul li { | ||
285 | list-style-type: none; | ||
286 | } | ||
287 | |||
288 | div.sidebar { | ||
289 | width: 250px; /*250*/ /*240*/ /*210*/ | ||
290 | padding: 0 10px; | ||
291 | margin-bottom: 5px; | ||
292 | } | ||
293 | |||
294 | div.sidebar h3 { | ||
295 | font-family: Verdana, Helvetica, Arial, sans-serif; | ||
296 | margin: 5px 0 0 0; | ||
297 | font-weight: bold; | ||
298 | color: #333333; | ||
299 | } | ||
300 | |||
301 | div.sidebar p { | ||
302 | font-size: 0.8em; | ||
303 | margin: 3px 0; | ||
304 | } | ||
305 | |||
306 | span.corners-top, | ||
307 | span.corners-bottom { | ||
308 | margin: 0 -10px; | ||
309 | background-image: url("/theme/images/corners_left.png"); | ||
310 | } | ||
311 | |||
312 | span.corners-top span, | ||
313 | span.corners-bottom span { | ||
314 | background-image: url("/theme/images/corners_right.png"); | ||
315 | } | ||
316 | |||
317 | span.corners-top span { | ||
318 | background-position: 100% 0pt; | ||
319 | } | ||
320 | |||
321 | span.corners-bottom { | ||
322 | background-position: 0pt 100%; | ||
323 | } | ||
324 | |||
325 | span.corners-bottom span { | ||
326 | background-position: 100% 100%; | ||
327 | } | ||
328 | |||
329 | span.corners-top, | ||
330 | span.corners-bottom, | ||
331 | span.corners-top span, | ||
332 | span.corners-bottom span { | ||
333 | background-repeat:no-repeat; | ||
334 | display:block; | ||
335 | font-size:1px; | ||
336 | height:5px; | ||
337 | line-height:1px; | ||
338 | } | ||
339 | |||
340 | div.sidebar ul { | ||
341 | list-style-type: none; | ||
342 | padding: 0; | ||
343 | margin: 0; | ||
344 | line-height: normal !important; | ||
345 | list-style-image: none !important; | ||
346 | } | ||
347 | |||
348 | div#sidebar ul li { | ||
349 | margin-top: 4px; | ||
350 | } | ||
351 | |||
352 | div#sidebar ul li a { | ||
353 | display: block; | ||
354 | width: 230px; | ||
355 | } | ||
356 | |||
357 | body.main div#sidebar div#hatnav ul li a#main, | ||
358 | body.about div#sidebar div#hatnav ul li a#about, | ||
359 | body.archive div#sidebar div#hatnav ul li a#archive, | ||
360 | body.winProg div#sidebar div#hatnav ul li a#winProg, | ||
361 | body.winGames div#sidebar div#hatnav ul li a#winGames, | ||
362 | body.flash div#sidebar div#hatnav ul li a#flash, | ||
363 | body.challenge div#sidebar div#hatnav ul li a#challenge, | ||
364 | body.experiment div#sidebar div#hatnav ul li a#experiment, | ||
365 | body.kfm div#sidebar div#hatnav ul li a#kfm, | ||
366 | body.mailchat div#sidebar div#hatnav ul li a#mailchat, | ||
367 | body.articles div#sidebar div#hatnav ul li a#articles, | ||
368 | body.poll div#sidebar div#hatnav ul li a#poll, | ||
369 | body.subversion div#sidebar div#hatnav ul li a#subversion { | ||
370 | background: #FEFFB2; | ||
371 | font-weight: bold; | ||
372 | text-decoration: none; | ||
373 | color: black; | ||
374 | } | ||
375 | |||
376 | div#sidebar li img { | ||
377 | border: 0; | ||
378 | height: 16px; | ||
379 | width: 16px; | ||
380 | } | ||
381 | |||
382 | /* Content */ | ||
383 | |||
384 | div#content, div#fi-content { | ||
385 | float: left; | ||
386 | width: 555px; /*465*/ /*555*/ | ||
387 | } | ||
388 | |||
389 | body#day div#page div#content code { | ||
390 | display: block; | ||
391 | border: solid black 1px; | ||
392 | background-color: #FFFF64; | ||
393 | width: 485px; | ||
394 | overflow: visible; | ||
395 | } | ||
396 | |||
397 | <?php //} ?> | ||
398 | |||
399 | |||
400 | div#content h2 { | ||
401 | color: #59770e; | ||
402 | margin: 0px 0px 2px; | ||
403 | border-bottom: 1px dotted #CCCCCC; | ||
404 | letter-spacing: -1px; | ||
405 | font: normal 140%/100% "Trebuchet MS", Tahoma, Arial; | ||
406 | padding-bottom: 3px; | ||
407 | } | ||
408 | |||
409 | /* Random Divs/Spans */ | ||
410 | |||
411 | div#stripe { | ||
412 | position: fixed; | ||
413 | top: 0; | ||
414 | left: 0; | ||
415 | width: 100%; | ||
416 | background-color: #FBEC5D; | ||
417 | height: 20px; | ||
418 | z-index: 99; | ||
419 | padding-top: 5px; | ||
420 | text-align: center; | ||
421 | } | ||
422 | |||
423 | * > html div#stripe { | ||
424 | position: absolute; | ||
425 | } | ||
426 | |||
427 | div.autosize { | ||
428 | display: table; | ||
429 | width: 1px; | ||
430 | } | ||
431 | |||
432 | div.autosize > div { | ||
433 | display: table-cell; | ||
434 | } | ||
435 | |||
436 | div#chat { | ||
437 | float: right; | ||
438 | position: fixed; | ||
439 | bottom: 0; | ||
440 | background-color: brown; | ||
441 | color: white; | ||
442 | right: 20; | ||
443 | height: 100%; | ||
444 | width: 40%; | ||
445 | } | ||
446 | |||
447 | div.cleardiv { | ||
448 | clear: both; | ||
449 | height: 1em; | ||
450 | } | ||
451 | |||
452 | div#footer { | ||
453 | clear: both; | ||
454 | padding-bottom: 1em; | ||
455 | padding-top: .5em; | ||
456 | margin-top: .5em; | ||
457 | text-align: center; | ||
458 | font-size: .68em; | ||
459 | width: 100%; | ||
460 | border-top: 1px black solid; | ||
461 | border-bottom: 4px gray solid; | ||
462 | } | ||
463 | |||
464 | div#footer ul.rows li { | ||
465 | display: list-item; | ||
466 | } | ||
467 | |||
468 | #rightbar-bottom { | ||
469 | background: url("/theme/images/bg_footer.gif") repeat-x 0 100%; | ||
470 | } | ||
471 | |||
472 | #pollOfTheWeek { | ||
473 | color: black; | ||
474 | } | ||
475 | |||
476 | div.post { | ||
477 | clear: both; | ||
478 | padding-top: 15px; | ||
479 | } | ||
480 | |||
481 | span.back-post { | ||
482 | float: left; | ||
483 | font-size: 0.9em; | ||
484 | } | ||
485 | |||
486 | span.next-post { | ||
487 | float: right; | ||
488 | font-size: 0.9em; | ||
489 | } | ||
490 | |||
491 | span.up-post { | ||
492 | font-size: 0.9em; | ||
493 | } | ||
494 | |||
495 | div.post-date-1 { | ||
496 | width: 45px; | ||
497 | height: 49px; | ||
498 | float: left; | ||
499 | background: url(/theme/images/date-bg-1.gif) no-repeat; | ||
500 | } | ||
501 | |||
502 | div.post-date-0 { | ||
503 | width: 45px; | ||
504 | height: 49px; | ||
505 | float: left; | ||
506 | } | ||
507 | |||
508 | div.post-date-0 span.post-month { | ||
509 | color: #999999; | ||
510 | font-size: 18px; | ||
511 | } | ||
512 | |||
513 | span.post-month { | ||
514 | font-size: 11px; | ||
515 | text-transform: uppercase; | ||
516 | color: #FFFFFF; | ||
517 | text-align: center; | ||
518 | display: block; | ||
519 | line-height: 11px; | ||
520 | padding-top: 2px; | ||
521 | margin-left: -3px; | ||
522 | } | ||
523 | |||
524 | span.post-day { | ||
525 | font-size: 18px; | ||
526 | text-transform: uppercase; | ||
527 | color: #999999; | ||
528 | text-align: center; | ||
529 | display: block; | ||
530 | line-height: 18px; | ||
531 | padding-top: 7px; | ||
532 | margin-left: -3px; | ||
533 | } | ||
534 | |||
535 | div.post-title { | ||
536 | float: left; | ||
537 | margin-left: 10px; | ||
538 | width: 500px; /* 430px */ | ||
539 | } | ||
540 | |||
541 | div.entry { | ||
542 | clear: both; | ||
543 | padding-top: 10px; | ||
544 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
545 | } | ||
546 | |||
547 | <?php | ||
548 | |||
549 | $getupdates = "SELECT * FROM updates"; | ||
550 | $getupdates2 = mysql_query($getupdates); | ||
551 | $i=0; | ||
552 | $k=0; | ||
553 | while ($getupdates3[$i] = mysql_fetch_array($getupdates2)) | ||
554 | { | ||
555 | $j=0; | ||
556 | for ($j=0;$j<$k;$j++) | ||
557 | { | ||
558 | if ($authors[$j] == $getupdates3[$i]['author']) | ||
559 | { | ||
560 | break; | ||
561 | } | ||
562 | } | ||
563 | if ($j==$k) | ||
564 | { | ||
565 | $authors[$k] = $getupdates3[$i]['author']; | ||
566 | $k++; | ||
567 | } | ||
568 | $i++; | ||
569 | } | ||
570 | $i=0; | ||
571 | for ($i=0;$i<$k;$i++) | ||
572 | { | ||
573 | ?> | ||
574 | span.post-cat-<?php echo($authors[$i]); ?> { | ||
575 | background: url(/theme/images/authors/<?php echo($authors[$i]); ?>.ico) no-repeat; | ||
576 | padding-left: 20px; | ||
577 | float: left; | ||
578 | font-size: 95%; | ||
579 | color: #999999; | ||
580 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
581 | } | ||
582 | |||
583 | <?php | ||
584 | } | ||
585 | |||
586 | ?> | ||
587 | span.post-comment { | ||
588 | background: url(/theme/images/icons/comment.png) no-repeat; | ||
589 | padding-left: 20px; | ||
590 | float: right; | ||
591 | font-size: 95%; | ||
592 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
593 | } | ||
594 | |||
595 | span.mini-add-comment { | ||
596 | background: url(/theme/images/icons/comment_add.png) no-repeat; | ||
597 | padding-left: 18px; | ||
598 | float: right; | ||
599 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
600 | } | ||
601 | |||
602 | span.post-comments { | ||
603 | background: url(/theme/images/icons/comments.png) no-repeat; | ||
604 | padding-left: 20px; | ||
605 | float: right; | ||
606 | font-size: 95%; | ||
607 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
608 | } | ||
609 | |||
610 | div#page { | ||
611 | /*margin: 0 auto;*/ | ||
612 | padding: 0; | ||
613 | width: 850px; | ||
614 | position: relative; | ||
615 | left: 50%; | ||
616 | margin-left: -422px; | ||
617 | } | ||
618 | |||
619 | div#footer ul { | ||
620 | padding: 0; | ||
621 | margin: 0; | ||
622 | list-style-type: none; | ||
623 | } | ||
624 | |||
625 | div#footer ul li { | ||
626 | display: inline; | ||
627 | margin-right: 1em; | ||
628 | } | ||
629 | |||
630 | div#footer ul li img { | ||
631 | width: 20px; | ||
632 | height: 20px; | ||
633 | vertical-align: top; | ||
634 | } | ||
635 | |||
636 | <?php if (!isset($_GET['nolayout'])) { ?> | ||
637 | |||
638 | div#content ul { | ||
639 | list-style: url(/theme/images/bullet_disk_big.png); | ||
640 | } | ||
641 | |||
642 | <?php } ?> | ||
643 | |||
644 | div.push { | ||
645 | clear: both; | ||
646 | height: 20px; | ||
647 | } | ||
648 | |||
649 | span.print { | ||
650 | display: none; | ||
651 | } | ||
652 | |||
653 | span.post-tag-1 { | ||
654 | background: url(/theme/images/icons/tag.png) no-repeat; | ||
655 | padding-left: 20px; | ||
656 | margin-left: 90px; | ||
657 | float: left; | ||
658 | font-size: 95%; | ||
659 | color: #999999; | ||
660 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
661 | text-transform: capitalize; | ||
662 | } | ||
663 | |||
664 | form textarea:focus, form input:focus { | ||
665 | border: 2px solid #900; | ||
666 | background-color: #FEFFB2; | ||
667 | } | ||
668 | |||
669 | span.post-tag-2 { | ||
670 | background: url(/theme/images/icons/tag.png) no-repeat; | ||
671 | padding-left: 20px; | ||
672 | margin-left: 75px; | ||
673 | float: left; | ||
674 | font-size: 95%; | ||
675 | color: #999999; | ||
676 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
677 | text-transform: capitalize; | ||
678 | } | ||
679 | |||
680 | span.post-tag-3 { | ||
681 | background: url(/theme/images/icons/tag.png) no-repeat; | ||
682 | padding-left: 20px; | ||
683 | margin-left: 35px; | ||
684 | float: left; | ||
685 | font-size: 95%; | ||
686 | color: #999999; | ||
687 | font: 75%/150% Arial, "Trebuchet MS", Tahoma; | ||
688 | text-transform: capitalize; | ||
689 | } | ||
690 | |||
691 | div.post-date-2 { | ||
692 | width: 45px; | ||
693 | height: 49px; | ||
694 | float: left; | ||
695 | background: url(/theme/images/date-bg-2.gif) no-repeat; | ||
696 | } | ||
697 | |||
698 | div.post-date-3 { | ||
699 | width: 45px; | ||
700 | height: 49px; | ||
701 | float: left; | ||
702 | background: url(/theme/images/date-bg-3.gif) no-repeat; | ||
703 | } | ||
704 | |||
705 | div.post-date-4 { | ||
706 | width: 45px; | ||
707 | height: 49px; | ||
708 | float: left; | ||
709 | background: url(/theme/images/date-bg-4.gif) no-repeat; | ||
710 | } | ||
711 | |||
712 | div#members { | ||
713 | position: fixed; | ||
714 | left: -40px; | ||
715 | top: 20px; | ||
716 | } | ||
717 | |||
718 | div#members ul li { | ||
719 | list-style-type: none; | ||
720 | } | ||
721 | |||
722 | div#members ul li a { | ||
723 | color: white; | ||
724 | width: 100px; | ||
725 | height: 30px; | ||
726 | padding-right: 5px; | ||
727 | background-image: url(/theme/images/tabBG.png); | ||
728 | display: block; | ||
729 | text-align: right; | ||
730 | padding-top: 5px; | ||
731 | padding-bottom: 0px; | ||
732 | background-repeat: no-repeat; | ||
733 | } | ||
734 | |||
735 | div#members ul li a:hover { | ||
736 | background-image: url(/theme/images/tabBG2.png); | ||
737 | } | ||
738 | |||
739 | div#content a img { | ||
740 | border: solid transparent 1px; | ||
741 | } | ||
742 | |||
743 | div#content a:hover img { | ||
744 | border: dashed gray 1px; | ||
745 | } | ||
746 | |||
747 | div.morePost { | ||
748 | border-top: gray 1px dashed; | ||
749 | } | ||
750 | |||
751 | div.plainText { | ||
752 | font-family: Courier New; | ||
753 | font-size: small; | ||
754 | } | ||
755 | |||
756 | div.breadcrumb { | ||
757 | margin-bottom: 10px; | ||
758 | font-size: 10px; | ||
759 | border-bottom: 1px dotted black; | ||
760 | } | ||
761 | |||
762 | .delicious-posts { margin: 1em; padding: 0.5em; font-family: sans-serif; } | ||
763 | .delicious-posts ul, .delicious-posts li, .delicious-banner { margin: 0; padding: 0} | ||
764 | .delicious-post { border-top: 1px solid #eee; padding: 0.25em; font-size: 80% } | ||
765 | .delicious-posts a:hover { text-decoration: underline } | ||
766 | |||
767 | /* #twitter_div { | ||
768 | margin: 1em; | ||
769 | padding: 0.5em; | ||
770 | font-family: sans-serif; | ||
771 | } */ | ||
772 | |||
773 | /* #twitter_div ul, #twitter_div li, .twitter-title { | ||
774 | margin: 0; | ||
775 | padding: 0; | ||
776 | } */ | ||
777 | |||
778 | .twitter_update_list { | ||
779 | list-style-type: none; | ||
780 | } | ||
781 | |||
782 | .twitter_update_list li { | ||
783 | /* border-top: 1px solid #eee; | ||
784 | padding: 0.25em; */ | ||
785 | display: inline; | ||
786 | } | ||
787 | |||
788 | /* .twitter-title { | ||
789 | margin-left: -20px; | ||
790 | font-size: 120%; | ||
791 | } */ | ||
792 | |||
793 | .dispIfNew a:visited img { | ||
794 | display: none; | ||
795 | } | ||
796 | |||
797 | /* Tables */ | ||
798 | |||
799 | table.webmail { | ||
800 | border: 0; | ||
801 | width: 100%; | ||
802 | } | ||
803 | |||
804 | table.webmail, table.webmail td { | ||
805 | border-spacing: 0; | ||
806 | } | ||
807 | |||
808 | table.webmail tr { | ||
809 | background-color: #3CE4ED; | ||
810 | } | ||
811 | |||
812 | table.webmail tr.even { | ||
813 | background-color: #39B7CD; | ||
814 | } | ||
815 | |||
816 | table.webmail th { | ||
817 | background-color: #FF9912; | ||
818 | text-align: left; | ||
819 | } | ||
820 | |||
821 | table.webmail td { | ||
822 | word-wrap: break-word; | ||
823 | } | ||
824 | |||
825 | /* Print Only */ | ||
826 | |||
827 | @media print { | ||
828 | body { | ||
829 | width: 100% !important; | ||
830 | } | ||
831 | |||
832 | div#banner, div#footer, div#members { | ||
833 | display: none; | ||
834 | } | ||
835 | |||
836 | span.print { | ||
837 | display: inline; | ||
838 | } | ||
839 | |||
840 | div#cleardiv { | ||
841 | clear: none; | ||
842 | } | ||
843 | } | ||
diff --git a/theme/datefinder.tpl b/theme/datefinder.tpl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/theme/datefinder.tpl | |||
diff --git a/theme/errors/404.tpl b/theme/errors/404.tpl new file mode 100644 index 0000000..1758a57 --- /dev/null +++ b/theme/errors/404.tpl | |||
@@ -0,0 +1,64 @@ | |||
1 | <TABLE cellSpacing=5 cellPadding=3 width=400> | ||
2 | <TBODY> | ||
3 | <TR> | ||
4 | <TD id=tableProps vAlign=top align=left><IMG id=pagerrorImg src="/images/error404.png"></TD> | ||
5 | <TD id=tableProps2 vAlign=center align=left width=360> | ||
6 | <H1 id=textSection1 style="FONT: 13pt/15pt verdana; COLOR: black"><SPAN id=errorText>Hello, my name is Waddle Dee</SPAN></H1> | ||
7 | </TD> | ||
8 | </TR> | ||
9 | |||
10 | <TR> | ||
11 | <TD id=tablePropsWidth width=400 colSpan=2><FONT style="FONT: 8pt/11pt verdana; COLOR: black">Aaaa.... well... I'm really sorry, but I can't find the page you're looking for. Really, I'm so sorry! Please don't tell Hat Kirby! This is the 17'th page I lost this week!</FONT></TD> | ||
12 | </TR> | ||
13 | |||
14 | <TR> | ||
15 | <TD id=tablePropsWidth width=400 colSpan=2><FONT id=LID1 style="FONT: 8pt/11pt verdana; COLOR: black"> | ||
16 | <P id=LID2>Oh wait. Here we go. We can't find your page because... hmmm... oh not again... It seems Kirby ate the page you are looking for.<BR>Yes, I'm really sorry! He gets really hungry sometimes (all of the time) but we try to keep him fed. Anyway, instead of talking to me, you can:</P> | ||
17 | |||
18 | <!--BEGIN NOREFERER--> | ||
19 | <UL> | ||
20 | <LI id=instructionsText1>Swim over to <A HREF="index.php">Fourever Island</A></LI> | ||
21 | <LI id=instructionsText2>Or maybe you could go to the <A HREF="http://cvs.fourisland.com">CVS Respository</A>!</LI> | ||
22 | </UL> | ||
23 | |||
24 | <P id=LID2>I'm sure you'll have fun.</P> | ||
25 | <P id=LID2><strong>Oh, oh! More info has come in! You may not be able to find the page because of:</strong></p> | ||
26 | |||
27 | <ol type="a"> | ||
28 | <li>An <strong>out-of-date bookmark/favourite</strong></li> | ||
29 | <li>A search engine that has an <strong>out-of-date listing for us</strong></li> | ||
30 | <li>A <strong>mis-typed address</strong></li> | ||
31 | </ol> | ||
32 | <!--END NOREFERER--> | ||
33 | |||
34 | <!--BEGIN SEARCHREF--> | ||
35 | <P id=LID2><strong>Oh, oh! More info has come in!</STRONG></P> | ||
36 | <P>You did a search on <strong><a href="<!--SEARCHREF.REF-->" target=_blank><!--SEARCHREF.SITE--></a></strong> for "<strong><!--SEARCHREF.TERMS--></strong>". However, their index appears to be out of date. (Because Kirby ate the page)</p><h2>All is not lost!</h2><p>Why not try these links?</p> | ||
37 | <UL> | ||
38 | <LI id=instructionsText1>Swim over to <A HREF="index.php">Fourever Island</A> | ||
39 | <LI id=instructionsText2>Or maybe you could go to the <A HREF="http://cvs.fourisland.com">CVS Respository</A>! | ||
40 | </UL> | ||
41 | <P id=LID2>I'm sure you'll have fun.</P> | ||
42 | <!--END SEARCHREF--> | ||
43 | |||
44 | <!--BEGIN NORMALREF--> | ||
45 | <P id=LID2><strong>Oh, oh! More info has come in!</STRONG></P> | ||
46 | <P>You were referred to this page by: <strong><a href='<!--NORMALREF.REF-->' target='_blank'><!--NORMALREF.SITE--></a></strong><br />I guess they didn't know that Kirby ate the page.</P> | ||
47 | <!--BEGIN OURBAD--> | ||
48 | <p id=LID2>Wait a minute! That's us! Uh oh! It looks like one of our own links is broken - I'm really sorry about this, and I'll try to fix it before Hatkirby notices. Please send an email to the email address on the HatBar. Thanks!</P> | ||
49 | <!--END OURBAD--> | ||
50 | <P id=LID2>Why not try one of these links?</P> | ||
51 | <UL> | ||
52 | <LI id=instructionsText1>Swim over to <A HREF="http://fourisland.com">Fourever Island</A></LI> | ||
53 | <LI id=instructionsText2>Or maybe you could go to the <A HREF="http://instadisc.org">InstaDisc site</A>!</LI> | ||
54 | </UL> | ||
55 | <P id=LID2>I'm sure you'll have fun.</P> | ||
56 | <!--END NORMALREF--> | ||
57 | |||
58 | <P id=LID2>Oh wait, I have to go. Hat Kirby's coming, and I better have an explanation for this one!</P> | ||
59 | <P><BR></P> | ||
60 | <H2 id=IEText style="FONT: 8pt/11pt verdana; COLOR: black">Kirby 404<BR>Property of hatkirby</H2> | ||
61 | </FONT></TD> | ||
62 | </TR> | ||
63 | </TBODY> | ||
64 | </TABLE> | ||
diff --git a/theme/footer.tpl b/theme/footer.tpl new file mode 100644 index 0000000..220e0f7 --- /dev/null +++ b/theme/footer.tpl | |||
@@ -0,0 +1,241 @@ | |||
1 | <!-- End content --></DIV> | ||
2 | |||
3 | <!--BEGIN RIGHTBAR--> | ||
4 | <DIV ID="rightbar"> | ||
5 | <DIV CLASS="sidebar"> | ||
6 | <DIV ID="pimped" CLASS="bubble"> | ||
7 | <DIV CLASS="rounded"> | ||
8 | <BLOCKQUOTE> | ||
9 | <DIV> | ||
10 | Hi! My name is Hatkirby, and I run Four Island. | ||
11 | |||
12 | <P> | ||
13 | Four Island is a fun place with a blog, | ||
14 | a fourm, a wiki, many projects and a quotes database!<BR> | ||
15 | |||
16 | I hope you enjoy your time on Four Island! | ||
17 | </P> | ||
18 | </DIV> | ||
19 | </BLOCKQUOTE> | ||
20 | </DIV> | ||
21 | <CITE CLASS="rounded"><STRONG>Hatkirby</STRONG> on Four Island</CITE> | ||
22 | </DIV> | ||
23 | </DIV> | ||
24 | |||
25 | <!--BEGIN USEHATNAV--> | ||
26 | <DIV class="sidebar"> | ||
27 | <DIV CLASS="bubble"> | ||
28 | <DIV CLASS="rounded"> | ||
29 | <BLOCKQUOTE> | ||
30 | <DIV ID="hatnav"><H3>Hatnav</H3><P> | ||
31 | <UL> | ||
32 | <!--BEGIN HATNAV--> | ||
33 | <LI STYLE="margin-left: 10"><A ID="<!--HATNAV.AID-->" HREF="<!--HATNAV.HREF-->"><IMG SRC="<!--HATNAV.IMAGE-->"><!--HATNAV.TEXT--><!--HATNAV.NEW--></A></LI> | ||
34 | <!--END HATNAV--> | ||
35 | </UL> | ||
36 | </P></DIV> | ||
37 | </BLOCKQUOTE> | ||
38 | </DIV> | ||
39 | </DIV> | ||
40 | </DIV> | ||
41 | <!--END USEHATNAV--> | ||
42 | |||
43 | <!--EXTRASIDEBARS--> | ||
44 | |||
45 | <DIV class="sidebar"> | ||
46 | <DIV CLASS="bubble"> | ||
47 | <DIV CLASS="rounded"> | ||
48 | <BLOCKQUOTE> | ||
49 | <DIV ID="hatbar"><H3>Hatbar</H3><P> | ||
50 | Confused? Email the webmaster at hatk<a href="http://mailhide.recaptcha.net/d?k=01gkW_nSHD3Qbf7dcAwJVdsg==&c=M-Dz6vqhsLdR6tNVOO5f7c6jZUsKP1mUNWfmLFkJqak=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01gkW_nSHD3Qbf7dcAwJVdsg==&c=M-Dz6vqhsLdR6tNVOO5f7c6jZUsKP1mUNWfmLFkJqak=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@fourisland.com</SMALL> | ||
51 | <P> | ||
52 | <SPAN ID="hitcounter"> | ||
53 | Hits: <!--HITS--><BR> | ||
54 | Today: <!--TODAY--><BR> | ||
55 | <SPAN> | ||
56 | <!--INCLUDE polloftheweek--><BR> | ||
57 | <!--INCLUDE datefinder--> | ||
58 | </P> | ||
59 | |||
60 | <P> | ||
61 | <CENTER> | ||
62 | <A HREF="/addresses.php" TITLE="goodemail@happybobby.com"><IMG SRC="/images/btn_bot.png"></A><BR> | ||
63 | |||
64 | <a href="http://www.prchecker.info/" target="_blank"><img src="http://pr.prchecker.info/getpr.php?codex=aHR0cDovL2ZvdXJpc2xhbmQuY29t&tag=3" alt="Page Rank Check" border="0" /></a> | ||
65 | |||
66 | <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/us/80x15.png"/></a><BR> | ||
67 | |||
68 | <a href="http://whos.amung.us/show/t1sj4g2u"><img src="http://whos.amung.us/swidget/t1sj4g2u.gif" alt="website stats" width="80" height="15" border="0" /></a> | ||
69 | |||
70 | <A HREF="/blog/color-4eva/"><IMG SRC="/images/colorPencils.png"></A><BR> | ||
71 | |||
72 | <a href="http://feeds.feedburner.com/FourIsland"><img src="http://feeds.feedburner.com/~fc/FourIsland?bg=99CCFF&fg=444444&anim=0" height="26" width="88" style="border:0" alt="" /></a><BR> | ||
73 | |||
74 | <A HREF="/rss.php?mode=comments">Comments Feed</A> | ||
75 | </CENTER> | ||
76 | </P> | ||
77 | </DIV> | ||
78 | </BLOCKQUOTE> | ||
79 | </DIV> | ||
80 | </DIV> | ||
81 | </DIV> | ||
82 | |||
83 | <DIV class="sidebar"> | ||
84 | <DIV CLASS="bubble"> | ||
85 | <DIV CLASS="rounded"> | ||
86 | <BLOCKQUOTE> | ||
87 | <DIV ID="hatbar"> | ||
88 | <H3>Popular Posts</H3> | ||
89 | |||
90 | <P> | ||
91 | <UL> | ||
92 | <!--BEGIN POPULAR--> | ||
93 | <LI STYLE="font-size: 0.9em"><A HREF="/blog/<!--POPULAR.CODED-->/"><!--POPULAR.TITLE--></A></LI> | ||
94 | <!--END POPULAR--> | ||
95 | </UL> | ||
96 | </P> | ||
97 | </DIV> | ||
98 | </BLOCKQUOTE> | ||
99 | </DIV> | ||
100 | </DIV> | ||
101 | </DIV> | ||
102 | |||
103 | <DIV class="sidebar"> | ||
104 | <DIV CLASS="bubble"> | ||
105 | <DIV CLASS="rounded"> | ||
106 | <BLOCKQUOTE> | ||
107 | <DIV ID="hatbar"> | ||
108 | <H3>Recent Comments</H3> | ||
109 | |||
110 | <P> | ||
111 | <UL> | ||
112 | <!--BEGIN COMMENTS--> | ||
113 | <LI STYLE="font-size: 0.9em"><!--COMMENTS.AUTHOR--> on <A HREF="/blog/<!--COMMENTS.CODED-->/"><!--COMMENTS.TITLE--></A></LI> | ||
114 | <!--END COMMENTS--> | ||
115 | </UL> | ||
116 | </P> | ||
117 | </DIV> | ||
118 | </BLOCKQUOTE> | ||
119 | </DIV> | ||
120 | </DIV> | ||
121 | </DIV> | ||
122 | |||
123 | <DIV class="sidebar"> | ||
124 | <DIV CLASS="bubble"> | ||
125 | <DIV CLASS="rounded"> | ||
126 | <BLOCKQUOTE> | ||
127 | <DIV ID="hatbar"> | ||
128 | <H3>Recent Fourm Posts</H3> | ||
129 | |||
130 | <P> | ||
131 | <UL> | ||
132 | <!--BEGIN FOURM--> | ||
133 | <LI STYLE="font-size: 0.9em"><!--FOURM.USERNAME--> on <A HREF="/fourm/viewtopic.php?t=<!--FOURM.TOPIC-->&p=<!--FOURM.POST-->#p<!--FOURM.POST-->"><!--FOURM.SUBJECT--></A></LI> | ||
134 | <!--END FOURM--> | ||
135 | </UL> | ||
136 | </P> | ||
137 | </DIV> | ||
138 | </BLOCKQUOTE> | ||
139 | </DIV> | ||
140 | </DIV> | ||
141 | </DIV> | ||
142 | |||
143 | <DIV class="sidebar"> | ||
144 | <DIV CLASS="bubble"> | ||
145 | <DIV CLASS="rounded"> | ||
146 | <BLOCKQUOTE> | ||
147 | <DIV ID="hatbar"> | ||
148 | <H3>Top Commenters</H3> | ||
149 | |||
150 | <P> | ||
151 | <UL> | ||
152 | <!--BEGIN TOP--> | ||
153 | <LI STYLE="font-size: 0.9em"><!--TOP.USERNAME--> (<!--TOP.COUNT-->)</LI> | ||
154 | <!--END TOP--> | ||
155 | </UL> | ||
156 | </P> | ||
157 | </DIV> | ||
158 | </BLOCKQUOTE> | ||
159 | </DIV> | ||
160 | </DIV> | ||
161 | </DIV> | ||
162 | |||
163 | <P> | ||
164 | |||
165 | <DIV CLASS="sidebar"> | ||
166 | <DIV ID="pimped" CLASS="bubble"> | ||
167 | <DIV CLASS="rounded"> | ||
168 | <BLOCKQUOTE> | ||
169 | <DIV> | ||
170 | Like something you see here on Four Island? | ||
171 | |||
172 | <P> | ||
173 | Well, the best way to promote a post here is to link to it from your blog. | ||
174 | We always appreciate Pingbacks.<BR> | ||
175 | |||
176 | Of course, if you don't have a blog, | ||
177 | you could simply comment on the post in question.<BR> | ||
178 | |||
179 | Can't be bothered to think up a comment? Well, you can always rate it then.<BR> | ||
180 | |||
181 | There's always a way to show how you feel about a post on Four Island. | ||
182 | </P> | ||
183 | </DIV> | ||
184 | </BLOCKQUOTE> | ||
185 | </DIV> | ||
186 | <CITE CLASS="rounded"><STRONG>Hatkirby</STRONG> on Four Island</CITE> | ||
187 | </DIV> | ||
188 | </DIV> | ||
189 | |||
190 | <!--BEGIN SIDEBARS--> | ||
191 | <DIV class="sidebar"> | ||
192 | <DIV CLASS="bubble"> | ||
193 | <DIV CLASS="rounded"> | ||
194 | <BLOCKQUOTE> | ||
195 | <H3><!--SIDEBARS.TITLE--></H3> | ||
196 | |||
197 | <P> | ||
198 | <!--SIDEBARS.TEXT--> | ||
199 | </P> | ||
200 | </BLOCKQUOTE> | ||
201 | </DIV> | ||
202 | </DIV> | ||
203 | </DIV> | ||
204 | <!--END SIDEBARS--> | ||
205 | </DIV> | ||
206 | <!--END RIGHTBAR--> | ||
207 | |||
208 | <DIV CLASS="cleardiv"></DIV> | ||
209 | |||
210 | <!--BEGIN ONFOURM--> | ||
211 | <DIV> | ||
212 | <!--END ONFOURM--> | ||
213 | </DIV> | ||
214 | |||
215 | <DIV ID="footer"> | ||
216 | <UL CLASS="rows"> | ||
217 | <LI><span xmlns:dc="http://purl.org/dc/elements/1.1/" property="dc:title">Four Island</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.fourisland.com" property="cc:attributionName" rel="cc:attributionURL">Starla Insigna</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License</a>.</LI> | ||
218 | <LI><A HREF="/wiki/privacy-policy/">Privacy Policy</A></LI> | ||
219 | </UL> | ||
220 | |||
221 | <UL CLASS="together"> | ||
222 | <LI><A HREF="http://jigsaw.w3.org/css-validator/"><IMG SRC="/theme/images/icons/css_valid.png"></A></LI> | ||
223 | <LI><A HREF="/no-doctype.php"><IMG SRC="/theme/images/icons/html_valid.png"></A></LI> | ||
224 | <LI><A class="noVisit" HREF="/rss.php"><IMG SRC="/theme/images/icons/feed.png"></A></LI> | ||
225 | </UL> | ||
226 | </DIV> | ||
227 | </DIV> | ||
228 | |||
229 | <!--Google Analytics--> | ||
230 | <script type="text/javascript"> | ||
231 | var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
232 | document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
233 | </script> | ||
234 | <script type="text/javascript"> | ||
235 | var pageTracker = _gat._getTracker("UA-2895652-1"); | ||
236 | pageTracker._initData(); | ||
237 | pageTracker._trackPageview(); | ||
238 | </script> | ||
239 | <!--Google Analytics--> | ||
240 | </BODY> | ||
241 | </HTML> | ||
diff --git a/theme/footer.tpl~ b/theme/footer.tpl~ new file mode 100644 index 0000000..b332f0f --- /dev/null +++ b/theme/footer.tpl~ | |||
@@ -0,0 +1,225 @@ | |||
1 | <!-- End content --></DIV> | ||
2 | |||
3 | <!--BEGIN RIGHTBAR--> | ||
4 | <DIV ID="rightbar"> | ||
5 | <DIV CLASS="sidebar"> | ||
6 | <DIV ID="pimped" CLASS="bubble"> | ||
7 | <DIV CLASS="rounded"> | ||
8 | <BLOCKQUOTE> | ||
9 | <DIV> | ||
10 | Hi! My name is Hatkirby, and I run Four Island. | ||
11 | |||
12 | <P> | ||
13 | Four Island is a fun place with a blog, | ||
14 | a fourm, a wiki, many projects and a quotes database!<BR> | ||
15 | |||
16 | I hope you enjoy your time on Four Island! | ||
17 | </P> | ||
18 | </DIV> | ||
19 | </BLOCKQUOTE> | ||
20 | </DIV> | ||
21 | <CITE CLASS="rounded"><STRONG>Hatkirby</STRONG> on Four Island</CITE> | ||
22 | </DIV> | ||
23 | </DIV> | ||
24 | |||
25 | <!--BEGIN USEHATNAV--> | ||
26 | <DIV class="sidebar"> | ||
27 | <DIV CLASS="bubble"> | ||
28 | <DIV CLASS="rounded"> | ||
29 | <BLOCKQUOTE> | ||
30 | <DIV ID="hatnav"><H3>Hatnav</H3><P> | ||
31 | <UL> | ||
32 | <!--BEGIN HATNAV--> | ||
33 | <LI STYLE="margin-left: 10"><A ID="<!--HATNAV.AID-->" HREF="<!--HATNAV.HREF-->"><IMG SRC="<!--HATNAV.IMAGE-->"><!--HATNAV.TEXT--><!--HATNAV.NEW--></A></LI> | ||
34 | <!--END HATNAV--> | ||
35 | </UL> | ||
36 | </P></DIV> | ||
37 | </BLOCKQUOTE> | ||
38 | </DIV> | ||
39 | </DIV> | ||
40 | </DIV> | ||
41 | <!--END USEHATNAV--> | ||
42 | |||
43 | <!--EXTRASIDEBARS--> | ||
44 | |||
45 | <DIV class="sidebar"> | ||
46 | <DIV CLASS="bubble"> | ||
47 | <DIV CLASS="rounded"> | ||
48 | <BLOCKQUOTE> | ||
49 | <DIV ID="hatbar"><H3>Hatbar</H3><P> | ||
50 | Confused? Email the webmaster at hatk<a href="http://mailhide.recaptcha.net/d?k=01gkW_nSHD3Qbf7dcAwJVdsg==&c=M-Dz6vqhsLdR6tNVOO5f7c6jZUsKP1mUNWfmLFkJqak=" onclick="window.open('http://mailhide.recaptcha.net/d?k=01gkW_nSHD3Qbf7dcAwJVdsg==&c=M-Dz6vqhsLdR6tNVOO5f7c6jZUsKP1mUNWfmLFkJqak=', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;" title="Reveal this e-mail address">...</a>@fourisland.com</SMALL> | ||
51 | <P> | ||
52 | <SPAN ID="hitcounter"> | ||
53 | Hits: <!--HITS--><BR> | ||
54 | Today: <!--TODAY--><BR> | ||
55 | <SPAN> | ||
56 | <!--INCLUDE polloftheweek--><BR> | ||
57 | <!--INCLUDE datefinder--> | ||
58 | </P> | ||
59 | |||
60 | <P> | ||
61 | <CENTER> | ||
62 | <A HREF="/addresses.php" TITLE="goodemail@happybobby.com"><IMG SRC="/images/btn_bot.png"></A><BR> | ||
63 | |||
64 | <a href="http://www.prchecker.info/" target="_blank"><img src="http://pr.prchecker.info/getpr.php?codex=aHR0cDovL2ZvdXJpc2xhbmQuY29t&tag=3" alt="Page Rank Check" border="0" /></a> | ||
65 | |||
66 | <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-sa/3.0/us/80x15.png"/></a><BR> | ||
67 | |||
68 | <a href="http://whos.amung.us/show/t1sj4g2u"><img src="http://whos.amung.us/swidget/t1sj4g2u.gif" alt="website stats" width="80" height="15" border="0" /></a> | ||
69 | |||
70 | <A HREF="/blog/color-4eva/"><IMG SRC="/images/colorPencils.png"></A><BR> | ||
71 | |||
72 | <a href="http://feeds.feedburner.com/FourIsland"><img src="http://feeds.feedburner.com/~fc/FourIsland?bg=99CCFF&fg=444444&anim=0" height="26" width="88" style="border:0" alt="" /></a><BR> | ||
73 | |||
74 | <A HREF="/rss.php?mode=comments">Comments Feed</A> | ||
75 | </CENTER> | ||
76 | </P> | ||
77 | </DIV> | ||
78 | </BLOCKQUOTE> | ||
79 | </DIV> | ||
80 | </DIV> | ||
81 | </DIV> | ||
82 | |||
83 | <DIV class="sidebar"> | ||
84 | <DIV CLASS="bubble"> | ||
85 | <DIV CLASS="rounded"> | ||
86 | <BLOCKQUOTE> | ||
87 | <DIV ID="hatbar"> | ||
88 | <H3>Popular Posts</H3> | ||
89 | |||
90 | <P> | ||
91 | <UL> | ||
92 | <!--BEGIN POPULAR--> | ||
93 | <LI STYLE="font-size: 0.9em"><A HREF="/blog/<!--POPULAR.CODED-->/"><!--POPULAR.TITLE--></A></LI> | ||
94 | <!--END POPULAR--> | ||
95 | </UL> | ||
96 | </P> | ||
97 | </DIV> | ||
98 | </BLOCKQUOTE> | ||
99 | </DIV> | ||
100 | </DIV> | ||
101 | </DIV> | ||
102 | |||
103 | <DIV class="sidebar"> | ||
104 | <script src="http://www.intensedebate.com/widgets/acctComment/85295/5" type="text/javascript"></script> | ||
105 | </DIV> | ||
106 | |||
107 | <DIV class="sidebar"> | ||
108 | <DIV CLASS="bubble"> | ||
109 | <DIV CLASS="rounded"> | ||
110 | <BLOCKQUOTE> | ||
111 | <DIV ID="hatbar"> | ||
112 | <H3>Recent Fourm Posts</H3> | ||
113 | |||
114 | <P> | ||
115 | <UL> | ||
116 | <!--BEGIN FOURM--> | ||
117 | <LI STYLE="font-size: 0.9em"><!--FOURM.USERNAME--> on <A HREF="/fourm/viewtopic.php?t=<!--FOURM.TOPIC-->&p=<!--FOURM.POST-->#p<!--FOURM.POST-->"><!--FOURM.SUBJECT--></A></LI> | ||
118 | <!--END FOURM--> | ||
119 | </UL> | ||
120 | </P> | ||
121 | </DIV> | ||
122 | </BLOCKQUOTE> | ||
123 | </DIV> | ||
124 | </DIV> | ||
125 | </DIV> | ||
126 | |||
127 | <DIV class="sidebar"> | ||
128 | <DIV CLASS="bubble"> | ||
129 | <DIV CLASS="rounded"> | ||
130 | <BLOCKQUOTE> | ||
131 | <DIV ID="hatbar"> | ||
132 | <H3>Top Commenters</H3> | ||
133 | |||
134 | <P> | ||
135 | <UL> | ||
136 | <!--BEGIN TOP--> | ||
137 | <LI STYLE="font-size: 0.9em"><!--TOP.USERNAME--> (<!--TOP.COUNT-->)</LI> | ||
138 | <!--END TOP--> | ||
139 | </UL> | ||
140 | </P> | ||
141 | </DIV> | ||
142 | </BLOCKQUOTE> | ||
143 | </DIV> | ||
144 | </DIV> | ||
145 | </DIV> | ||
146 | |||
147 | <P> | ||
148 | |||
149 | <DIV CLASS="sidebar"> | ||
150 | <DIV ID="pimped" CLASS="bubble"> | ||
151 | <DIV CLASS="rounded"> | ||
152 | <BLOCKQUOTE> | ||
153 | <DIV> | ||
154 | Like something you see here on Four Island? | ||
155 | |||
156 | <P> | ||
157 | Well, the best way to promote a post here is to link to it from your blog. | ||
158 | We always appreciate Pingbacks.<BR> | ||
159 | |||
160 | Of course, if you don't have a blog, | ||
161 | you could simply comment on the post in question.<BR> | ||
162 | |||
163 | Can't be bothered to think up a comment? Well, you can always rate it then.<BR> | ||
164 | |||
165 | There's always a way to show how you feel about a post on Four Island. | ||
166 | </P> | ||
167 | </DIV> | ||
168 | </BLOCKQUOTE> | ||
169 | </DIV> | ||
170 | <CITE CLASS="rounded"><STRONG>Hatkirby</STRONG> on Four Island</CITE> | ||
171 | </DIV> | ||
172 | </DIV> | ||
173 | |||
174 | <!--BEGIN SIDEBARS--> | ||
175 | <DIV class="sidebar"> | ||
176 | <DIV CLASS="bubble"> | ||
177 | <DIV CLASS="rounded"> | ||
178 | <BLOCKQUOTE> | ||
179 | <H3><!--SIDEBARS.TITLE--></H3> | ||
180 | |||
181 | <P> | ||
182 | <!--SIDEBARS.TEXT--> | ||
183 | </P> | ||
184 | </BLOCKQUOTE> | ||
185 | </DIV> | ||
186 | </DIV> | ||
187 | </DIV> | ||
188 | <!--END SIDEBARS--> | ||
189 | </DIV> | ||
190 | <!--END RIGHTBAR--> | ||
191 | |||
192 | <DIV CLASS="cleardiv"></DIV> | ||
193 | |||
194 | <!--BEGIN ONFOURM--> | ||
195 | <DIV> | ||
196 | <!--END ONFOURM--> | ||
197 | </DIV> | ||
198 | |||
199 | <DIV ID="footer"> | ||
200 | <UL CLASS="rows"> | ||
201 | <LI><span xmlns:dc="http://purl.org/dc/elements/1.1/" property="dc:title">Four Island</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.fourisland.com" property="cc:attributionName" rel="cc:attributionURL">Starla Insigna</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License</a>.</LI> | ||
202 | <LI><A HREF="/wiki/privacy-policy/">Privacy Policy</A></LI> | ||
203 | </UL> | ||
204 | |||
205 | <UL CLASS="together"> | ||
206 | <LI><A HREF="http://jigsaw.w3.org/css-validator/"><IMG SRC="/theme/images/icons/css_valid.png"></A></LI> | ||
207 | <LI><A HREF="/no-doctype.php"><IMG SRC="/theme/images/icons/html_valid.png"></A></LI> | ||
208 | <LI><A class="noVisit" HREF="/rss.php"><IMG SRC="/theme/images/icons/feed.png"></A></LI> | ||
209 | </UL> | ||
210 | </DIV> | ||
211 | </DIV> | ||
212 | |||
213 | <!--Google Analytics--> | ||
214 | <script type="text/javascript"> | ||
215 | var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | ||
216 | document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | ||
217 | </script> | ||
218 | <script type="text/javascript"> | ||
219 | var pageTracker = _gat._getTracker("UA-2895652-1"); | ||
220 | pageTracker._initData(); | ||
221 | pageTracker._trackPageview(); | ||
222 | </script> | ||
223 | <!--Google Analytics--> | ||
224 | </BODY> | ||
225 | </HTML> | ||
diff --git a/theme/header.tpl b/theme/header.tpl new file mode 100644 index 0000000..e0d000a --- /dev/null +++ b/theme/header.tpl | |||
@@ -0,0 +1,64 @@ | |||
1 | <HTML> | ||
2 | <HEAD> | ||
3 | <TITLE><!--EXTRATITLE-->Four Island</TITLE> | ||
4 | |||
5 | <LINK REL="stylesheet" TYPE="text/css" HREF="http://fourisland.com/theme/css.php?id=<!--BODYID-->" /> | ||
6 | <LINK REL="stylesheet" TYPE="text/css" HREF="http://fourisland.com/theme/css/thickbox.css" /> | ||
7 | <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" /> | ||
8 | <META HTTP-EQUIV="Content-Language" CONTENT="en" /> | ||
9 | <LINK REL="alternate" TYPE="application/rss+xml" HREF="http://feeds.feedburner.com/FourIsland?format=xml" TITLE="Four Island" /> | ||
10 | <LINK REL="shortcut" HREF="/images/kirbyfolder.ico" /> | ||
11 | <LINK REL="icon" HREF="/images/kirbyfolder.ico" /> | ||
12 | <LINK REL="pingback" HREF="http://fourisland.com/xmlrpc.php" /> | ||
13 | <SCRIPT SRC="/theme/js/jquery-1.2.6.min.js" TYPE="text/javascript"></SCRIPT> | ||
14 | <SCRIPT SRC="/theme/js/jquery.ie6blocker.js" TYPE="text/javascript"></SCRIPT> | ||
15 | <SCRIPT SRC="/theme/js/message.js" TYPE="text/javascript"></SCRIPT> | ||
16 | <SCRIPT SRC="/theme/js/rounded_corners.inc.js" TYPE="text/javascript"></SCRIPT> | ||
17 | <SCRIPT SRC="/theme/js/round_bubbles.js" TYPE="text/javascript"></SCRIPT> | ||
18 | <SCRIPT SRC="/theme/js/thickbox.js" TYPE="text/javascript"></SCRIPT> | ||
19 | |||
20 | <!--BEGIN SPLASH--> | ||
21 | <SCRIPT TYPE="text/javascript"> | ||
22 | tb_splash(); | ||
23 | </SCRIPT> | ||
24 | <!--END SPLASH--> | ||
25 | |||
26 | <!--HEADTAGS--> | ||
27 | </HEAD> | ||
28 | |||
29 | <BODY ID="<!--BODYID-->" CLASS="<!--CATEGORY--> <!--AID--> <!--CATEGORY-->-<!--AID-->"<!--BODYTAGS-->> | ||
30 | <DIV ID="stripe"> | ||
31 | You can get notifications on new Four Island posts either via | ||
32 | <A HREF="http://feeds.feedburner.com/FourIsland">RSS</A> | ||
33 | or | ||
34 | <A HREF="http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1464430">Email</A> | ||
35 | </DIV> | ||
36 | |||
37 | <DIV ID="wrap"> | ||
38 | <DIV ID="page-header"> | ||
39 | <SPAN CLASS="side-left"></SPAN> | ||
40 | <DIV ID="banner" STYLE="position: relative;"> | ||
41 | <H1 ID="logo-banner"><A HREF="/" TITLE="Four Island">Four Island</A></H1> | ||
42 | </DIV> | ||
43 | <SPAN CLASS="side-right"></SPAN> | ||
44 | </DIV> | ||
45 | |||
46 | <DIV ID="banner-nav"> | ||
47 | <UL ID="bannernav"> | ||
48 | <LI id="bannernav-home"><A HREF="/" REL="home"><B><SPAN>Home</SPAN></B></A></LI> | ||
49 | <LI id="bannernav-projects"><A HREF="/projects/"><B><SPAN>Projects</SPAN></B></A></LI> | ||
50 | <LI id="bannernav-wiki"><A HREF="/wiki/"><B><SPAN>Wiki</SPAN></B></A></LI> | ||
51 | <LI id="bannernav-fourm"><A HREF="/fourm/"><B><SPAN>Fourm</SPAN></B></A></LI> | ||
52 | <LI id="bannernav-poll"><A HREF="/poll/"><B><SPAN>Poll</SPAN></B></A></LI> | ||
53 | <LI id="bannernav-quotes"><A HREF="/quotes/"><B><SPAN>Quotes</SPAN></B></A></LI> | ||
54 | <LI id="bannernav-<!--LOWERLOGDATA-->"><A HREF="/<!--LOWERLOGDATA-->.php?redirect=<!--REDIRPAGE-->"><B><SPAN><!--LOGDATA--></SPAN></B></A></LI> | ||
55 | <!--BEGIN PANEL--> | ||
56 | <LI id="bannernav-panel"><A HREF="/admin/"><B><SPAN>Panel</SPAN></B></A></LI> | ||
57 | <!--END PANEL--> | ||
58 | </UL> | ||
59 | </DIV> | ||
60 | |||
61 | <DIV CLASS="push"></DIV> | ||
62 | |||
63 | <DIV id="page-body"> | ||
64 | <DIV id="content"><!-- Begin content --> | ||
diff --git a/theme/hits.tpl b/theme/hits.tpl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/theme/hits.tpl | |||
diff --git a/theme/images/Fourm.gif b/theme/images/Fourm.gif new file mode 100755 index 0000000..1365fd6 --- /dev/null +++ b/theme/images/Fourm.gif | |||
Binary files differ | |||
diff --git a/theme/images/Fourm_ro.gif b/theme/images/Fourm_ro.gif new file mode 100755 index 0000000..8a1cad6 --- /dev/null +++ b/theme/images/Fourm_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Home.gif b/theme/images/Home.gif new file mode 100755 index 0000000..e3e523d --- /dev/null +++ b/theme/images/Home.gif | |||
Binary files differ | |||
diff --git a/theme/images/Home_ro.gif b/theme/images/Home_ro.gif new file mode 100755 index 0000000..b409d75 --- /dev/null +++ b/theme/images/Home_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Links.gif b/theme/images/Links.gif new file mode 100755 index 0000000..a223b3e --- /dev/null +++ b/theme/images/Links.gif | |||
Binary files differ | |||
diff --git a/theme/images/Links_ro.gif b/theme/images/Links_ro.gif new file mode 100755 index 0000000..d540220 --- /dev/null +++ b/theme/images/Links_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Login.gif b/theme/images/Login.gif new file mode 100644 index 0000000..3573589 --- /dev/null +++ b/theme/images/Login.gif | |||
Binary files differ | |||
diff --git a/theme/images/Login_ro.gif b/theme/images/Login_ro.gif new file mode 100644 index 0000000..404f305 --- /dev/null +++ b/theme/images/Login_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Logout.gif b/theme/images/Logout.gif new file mode 100644 index 0000000..12696fe --- /dev/null +++ b/theme/images/Logout.gif | |||
Binary files differ | |||
diff --git a/theme/images/Logout_ro.gif b/theme/images/Logout_ro.gif new file mode 100644 index 0000000..ff103a2 --- /dev/null +++ b/theme/images/Logout_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Panel.gif b/theme/images/Panel.gif new file mode 100644 index 0000000..42075dc --- /dev/null +++ b/theme/images/Panel.gif | |||
Binary files differ | |||
diff --git a/theme/images/Panel_ro.gif b/theme/images/Panel_ro.gif new file mode 100644 index 0000000..e64c5ad --- /dev/null +++ b/theme/images/Panel_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Poll.gif b/theme/images/Poll.gif new file mode 100644 index 0000000..08815d2 --- /dev/null +++ b/theme/images/Poll.gif | |||
Binary files differ | |||
diff --git a/theme/images/Poll_ro.gif b/theme/images/Poll_ro.gif new file mode 100644 index 0000000..6a4549f --- /dev/null +++ b/theme/images/Poll_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Projects.gif b/theme/images/Projects.gif new file mode 100755 index 0000000..bf0cfc7 --- /dev/null +++ b/theme/images/Projects.gif | |||
Binary files differ | |||
diff --git a/theme/images/Projects_ro.gif b/theme/images/Projects_ro.gif new file mode 100755 index 0000000..718ab03 --- /dev/null +++ b/theme/images/Projects_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Quotes.gif b/theme/images/Quotes.gif new file mode 100644 index 0000000..8bf0289 --- /dev/null +++ b/theme/images/Quotes.gif | |||
Binary files differ | |||
diff --git a/theme/images/Quotes_ro.gif b/theme/images/Quotes_ro.gif new file mode 100644 index 0000000..f15831c --- /dev/null +++ b/theme/images/Quotes_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Random.gif b/theme/images/Random.gif new file mode 100755 index 0000000..94cb4be --- /dev/null +++ b/theme/images/Random.gif | |||
Binary files differ | |||
diff --git a/theme/images/Random_ro.gif b/theme/images/Random_ro.gif new file mode 100755 index 0000000..4e62f24 --- /dev/null +++ b/theme/images/Random_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/Wiki.gif b/theme/images/Wiki.gif new file mode 100644 index 0000000..e4a0cc7 --- /dev/null +++ b/theme/images/Wiki.gif | |||
Binary files differ | |||
diff --git a/theme/images/Wiki_ro.gif b/theme/images/Wiki_ro.gif new file mode 100644 index 0000000..b8d9438 --- /dev/null +++ b/theme/images/Wiki_ro.gif | |||
Binary files differ | |||
diff --git a/theme/images/authors/Hatkirby.ico b/theme/images/authors/Hatkirby.ico new file mode 100755 index 0000000..fbc13bd --- /dev/null +++ b/theme/images/authors/Hatkirby.ico | |||
Binary files differ | |||
diff --git a/theme/images/authors/Starla.ico b/theme/images/authors/Starla.ico new file mode 100755 index 0000000..fbc13bd --- /dev/null +++ b/theme/images/authors/Starla.ico | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/4ofjuly.PNG b/theme/images/backgrounds/4ofjuly.PNG new file mode 100755 index 0000000..41c71ea --- /dev/null +++ b/theme/images/backgrounds/4ofjuly.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/ashWeds.PNG b/theme/images/backgrounds/ashWeds.PNG new file mode 100755 index 0000000..b1f9db4 --- /dev/null +++ b/theme/images/backgrounds/ashWeds.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/christmas.PNG b/theme/images/backgrounds/christmas.PNG new file mode 100755 index 0000000..7491fa6 --- /dev/null +++ b/theme/images/backgrounds/christmas.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/christmasEve.PNG b/theme/images/backgrounds/christmasEve.PNG new file mode 100755 index 0000000..7f10edb --- /dev/null +++ b/theme/images/backgrounds/christmasEve.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/columbus.PNG b/theme/images/backgrounds/columbus.PNG new file mode 100755 index 0000000..069f2fd --- /dev/null +++ b/theme/images/backgrounds/columbus.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/easter.PNG b/theme/images/backgrounds/easter.PNG new file mode 100755 index 0000000..8a40688 --- /dev/null +++ b/theme/images/backgrounds/easter.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/fathers.PNG b/theme/images/backgrounds/fathers.PNG new file mode 100755 index 0000000..f0ba36f --- /dev/null +++ b/theme/images/backgrounds/fathers.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/flagDay.PNG b/theme/images/backgrounds/flagDay.PNG new file mode 100755 index 0000000..6440e46 --- /dev/null +++ b/theme/images/backgrounds/flagDay.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/goodFriday.PNG b/theme/images/backgrounds/goodFriday.PNG new file mode 100755 index 0000000..3eb2c0c --- /dev/null +++ b/theme/images/backgrounds/goodFriday.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/groundhog.PNG b/theme/images/backgrounds/groundhog.PNG new file mode 100755 index 0000000..3e7229e --- /dev/null +++ b/theme/images/backgrounds/groundhog.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/halloween.PNG b/theme/images/backgrounds/halloween.PNG new file mode 100755 index 0000000..b9897c6 --- /dev/null +++ b/theme/images/backgrounds/halloween.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/hatkirbybday.PNG b/theme/images/backgrounds/hatkirbybday.PNG new file mode 100755 index 0000000..f82354e --- /dev/null +++ b/theme/images/backgrounds/hatkirbybday.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island.PNG b/theme/images/backgrounds/island.PNG new file mode 100755 index 0000000..440f8e2 --- /dev/null +++ b/theme/images/backgrounds/island.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island2.PNG b/theme/images/backgrounds/island2.PNG new file mode 100755 index 0000000..7127a0f --- /dev/null +++ b/theme/images/backgrounds/island2.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island3.PNG b/theme/images/backgrounds/island3.PNG new file mode 100755 index 0000000..bf74ab9 --- /dev/null +++ b/theme/images/backgrounds/island3.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island4.PNG b/theme/images/backgrounds/island4.PNG new file mode 100755 index 0000000..3b31e79 --- /dev/null +++ b/theme/images/backgrounds/island4.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island5.PNG b/theme/images/backgrounds/island5.PNG new file mode 100755 index 0000000..081a51c --- /dev/null +++ b/theme/images/backgrounds/island5.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island6.PNG b/theme/images/backgrounds/island6.PNG new file mode 100755 index 0000000..319eeeb --- /dev/null +++ b/theme/images/backgrounds/island6.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/island6night.PNG b/theme/images/backgrounds/island6night.PNG new file mode 100755 index 0000000..95e9558 --- /dev/null +++ b/theme/images/backgrounds/island6night.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/islandYearly.PNG b/theme/images/backgrounds/islandYearly.PNG new file mode 100755 index 0000000..4125be6 --- /dev/null +++ b/theme/images/backgrounds/islandYearly.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/kirbyweek.PNG b/theme/images/backgrounds/kirbyweek.PNG new file mode 100755 index 0000000..202c5e0 --- /dev/null +++ b/theme/images/backgrounds/kirbyweek.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/mardiGras.PNG b/theme/images/backgrounds/mardiGras.PNG new file mode 100755 index 0000000..131efd2 --- /dev/null +++ b/theme/images/backgrounds/mardiGras.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/martinLuther.PNG b/theme/images/backgrounds/martinLuther.PNG new file mode 100755 index 0000000..8313af8 --- /dev/null +++ b/theme/images/backgrounds/martinLuther.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/memorial.PNG b/theme/images/backgrounds/memorial.PNG new file mode 100755 index 0000000..cc5be0a --- /dev/null +++ b/theme/images/backgrounds/memorial.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/mothers.PNG b/theme/images/backgrounds/mothers.PNG new file mode 100755 index 0000000..3c7d69d --- /dev/null +++ b/theme/images/backgrounds/mothers.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/newYear.PNG b/theme/images/backgrounds/newYear.PNG new file mode 100755 index 0000000..9884051 --- /dev/null +++ b/theme/images/backgrounds/newYear.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/newYearsEve.PNG b/theme/images/backgrounds/newYearsEve.PNG new file mode 100755 index 0000000..81f9a5b --- /dev/null +++ b/theme/images/backgrounds/newYearsEve.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/valentines.PNG b/theme/images/backgrounds/valentines.PNG new file mode 100755 index 0000000..7d105a9 --- /dev/null +++ b/theme/images/backgrounds/valentines.PNG | |||
Binary files differ | |||
diff --git a/theme/images/backgrounds/veterans.PNG b/theme/images/backgrounds/veterans.PNG new file mode 100755 index 0000000..a0a5a03 --- /dev/null +++ b/theme/images/backgrounds/veterans.PNG | |||
Binary files differ | |||
diff --git a/theme/images/bg_body.gif b/theme/images/bg_body.gif new file mode 100755 index 0000000..80d75d5 --- /dev/null +++ b/theme/images/bg_body.gif | |||
Binary files differ | |||
diff --git a/theme/images/bg_body_short.gif b/theme/images/bg_body_short.gif new file mode 100644 index 0000000..b396204 --- /dev/null +++ b/theme/images/bg_body_short.gif | |||
Binary files differ | |||
diff --git a/theme/images/bg_footer.gif b/theme/images/bg_footer.gif new file mode 100755 index 0000000..ff3f511 --- /dev/null +++ b/theme/images/bg_footer.gif | |||
Binary files differ | |||
diff --git a/theme/images/bg_header.gif b/theme/images/bg_header.gif new file mode 100755 index 0000000..46c22e8 --- /dev/null +++ b/theme/images/bg_header.gif | |||
Binary files differ | |||
diff --git a/theme/images/bg_navbar.gif b/theme/images/bg_navbar.gif new file mode 100755 index 0000000..d96c6ea --- /dev/null +++ b/theme/images/bg_navbar.gif | |||
Binary files differ | |||
diff --git a/theme/images/bg_search.gif b/theme/images/bg_search.gif new file mode 100644 index 0000000..79e040e --- /dev/null +++ b/theme/images/bg_search.gif | |||
Binary files differ | |||
diff --git a/theme/images/blue.PNG b/theme/images/blue.PNG new file mode 100755 index 0000000..e274621 --- /dev/null +++ b/theme/images/blue.PNG | |||
Binary files differ | |||
diff --git a/theme/images/corners_bottom.gif b/theme/images/corners_bottom.gif new file mode 100755 index 0000000..bea794f --- /dev/null +++ b/theme/images/corners_bottom.gif | |||
Binary files differ | |||
diff --git a/theme/images/corners_left.png b/theme/images/corners_left.png new file mode 100755 index 0000000..256bde3 --- /dev/null +++ b/theme/images/corners_left.png | |||
Binary files differ | |||
diff --git a/theme/images/corners_right.png b/theme/images/corners_right.png new file mode 100755 index 0000000..df41823 --- /dev/null +++ b/theme/images/corners_right.png | |||
Binary files differ | |||
diff --git a/theme/images/date-bg-1.gif b/theme/images/date-bg-1.gif new file mode 100755 index 0000000..cb7a771 --- /dev/null +++ b/theme/images/date-bg-1.gif | |||
Binary files differ | |||
diff --git a/theme/images/date-bg-2.gif b/theme/images/date-bg-2.gif new file mode 100755 index 0000000..49efaef --- /dev/null +++ b/theme/images/date-bg-2.gif | |||
Binary files differ | |||
diff --git a/theme/images/date-bg-3.gif b/theme/images/date-bg-3.gif new file mode 100755 index 0000000..60a6888 --- /dev/null +++ b/theme/images/date-bg-3.gif | |||
Binary files differ | |||
diff --git a/theme/images/date-bg-4.gif b/theme/images/date-bg-4.gif new file mode 100755 index 0000000..685e5c1 --- /dev/null +++ b/theme/images/date-bg-4.gif | |||
Binary files differ | |||
diff --git a/theme/images/headers/ctnh.png b/theme/images/headers/ctnh.png new file mode 100644 index 0000000..b9542fc --- /dev/null +++ b/theme/images/headers/ctnh.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/fourm.png b/theme/images/headers/fourm.png new file mode 100644 index 0000000..e7bebde --- /dev/null +++ b/theme/images/headers/fourm.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/hatkirbybday.png b/theme/images/headers/hatkirbybday.png new file mode 100644 index 0000000..ba7bff0 --- /dev/null +++ b/theme/images/headers/hatkirbybday.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/islandYearly.png b/theme/images/headers/islandYearly.png new file mode 100644 index 0000000..099d963 --- /dev/null +++ b/theme/images/headers/islandYearly.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/kfm.png b/theme/images/headers/kfm.png new file mode 100644 index 0000000..cc568ec --- /dev/null +++ b/theme/images/headers/kfm.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/links.png b/theme/images/headers/links.png new file mode 100644 index 0000000..b24ded0 --- /dev/null +++ b/theme/images/headers/links.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/main.png b/theme/images/headers/main.png new file mode 100755 index 0000000..009d3ac --- /dev/null +++ b/theme/images/headers/main.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/main.xcf b/theme/images/headers/main.xcf new file mode 100755 index 0000000..fd37ee4 --- /dev/null +++ b/theme/images/headers/main.xcf | |||
Binary files differ | |||
diff --git a/theme/images/headers/memorial.png b/theme/images/headers/memorial.png new file mode 100644 index 0000000..b68b97d --- /dev/null +++ b/theme/images/headers/memorial.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/mothers.png b/theme/images/headers/mothers.png new file mode 100644 index 0000000..e656d7d --- /dev/null +++ b/theme/images/headers/mothers.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/potw.png b/theme/images/headers/potw.png new file mode 100644 index 0000000..9ce3174 --- /dev/null +++ b/theme/images/headers/potw.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/projects.png b/theme/images/headers/projects.png new file mode 100644 index 0000000..d59f47a --- /dev/null +++ b/theme/images/headers/projects.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/projects.xcf b/theme/images/headers/projects.xcf new file mode 100644 index 0000000..f1950ad --- /dev/null +++ b/theme/images/headers/projects.xcf | |||
Binary files differ | |||
diff --git a/theme/images/headers/quotes.png b/theme/images/headers/quotes.png new file mode 100644 index 0000000..9fb966e --- /dev/null +++ b/theme/images/headers/quotes.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/random.png b/theme/images/headers/random.png new file mode 100644 index 0000000..e7db228 --- /dev/null +++ b/theme/images/headers/random.png | |||
Binary files differ | |||
diff --git a/theme/images/headers/short.png b/theme/images/headers/short.png new file mode 100644 index 0000000..4d4d267 --- /dev/null +++ b/theme/images/headers/short.png | |||
Binary files differ | |||
diff --git a/theme/images/home.png b/theme/images/home.png new file mode 100755 index 0000000..2615467 --- /dev/null +++ b/theme/images/home.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-clock.png b/theme/images/icons/16-clock.png new file mode 100644 index 0000000..b583ae4 --- /dev/null +++ b/theme/images/icons/16-clock.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-em-pencil.png b/theme/images/icons/16-em-pencil.png new file mode 100644 index 0000000..006974c --- /dev/null +++ b/theme/images/icons/16-em-pencil.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-file-archive.png b/theme/images/icons/16-file-archive.png new file mode 100644 index 0000000..737bb5b --- /dev/null +++ b/theme/images/icons/16-file-archive.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-file-page.png b/theme/images/icons/16-file-page.png new file mode 100644 index 0000000..2bae432 --- /dev/null +++ b/theme/images/icons/16-file-page.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-message-warn.png b/theme/images/icons/16-message-warn.png new file mode 100644 index 0000000..3d41fec --- /dev/null +++ b/theme/images/icons/16-message-warn.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/16-star-hot.png b/theme/images/icons/16-star-hot.png new file mode 100644 index 0000000..8a7d83c --- /dev/null +++ b/theme/images/icons/16-star-hot.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/book_open.png b/theme/images/icons/book_open.png new file mode 100755 index 0000000..7d863f9 --- /dev/null +++ b/theme/images/icons/book_open.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/bricks.png b/theme/images/icons/bricks.png new file mode 100755 index 0000000..0905f93 --- /dev/null +++ b/theme/images/icons/bricks.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/comment.png b/theme/images/icons/comment.png new file mode 100755 index 0000000..7bc9233 --- /dev/null +++ b/theme/images/icons/comment.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/comment_add.png b/theme/images/icons/comment_add.png new file mode 100755 index 0000000..75e78de --- /dev/null +++ b/theme/images/icons/comment_add.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/comments.png b/theme/images/icons/comments.png new file mode 100755 index 0000000..39433cf --- /dev/null +++ b/theme/images/icons/comments.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/computer.png b/theme/images/icons/computer.png new file mode 100755 index 0000000..9bc37dc --- /dev/null +++ b/theme/images/icons/computer.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/controller.png b/theme/images/icons/controller.png new file mode 100755 index 0000000..5cf76ed --- /dev/null +++ b/theme/images/icons/controller.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/css_valid.png b/theme/images/icons/css_valid.png new file mode 100755 index 0000000..4c72ca5 --- /dev/null +++ b/theme/images/icons/css_valid.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/door_in.png b/theme/images/icons/door_in.png new file mode 100755 index 0000000..41676a0 --- /dev/null +++ b/theme/images/icons/door_in.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/door_out.png b/theme/images/icons/door_out.png new file mode 100755 index 0000000..2541d2b --- /dev/null +++ b/theme/images/icons/door_out.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/feed.png b/theme/images/icons/feed.png new file mode 100755 index 0000000..315c4f4 --- /dev/null +++ b/theme/images/icons/feed.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/fourm.png b/theme/images/icons/fourm.png new file mode 100755 index 0000000..b7675de --- /dev/null +++ b/theme/images/icons/fourm.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/house.png b/theme/images/icons/house.png new file mode 100755 index 0000000..fed6221 --- /dev/null +++ b/theme/images/icons/house.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/html_valid.png b/theme/images/icons/html_valid.png new file mode 100755 index 0000000..71cec92 --- /dev/null +++ b/theme/images/icons/html_valid.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/link_delete.png b/theme/images/icons/link_delete.png new file mode 100755 index 0000000..f66e297 --- /dev/null +++ b/theme/images/icons/link_delete.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/link_edit.png b/theme/images/icons/link_edit.png new file mode 100755 index 0000000..5b3aed0 --- /dev/null +++ b/theme/images/icons/link_edit.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/medal_gold_1.png b/theme/images/icons/medal_gold_1.png new file mode 100755 index 0000000..87584dc --- /dev/null +++ b/theme/images/icons/medal_gold_1.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/new.png b/theme/images/icons/new.png new file mode 100755 index 0000000..6a9bf03 --- /dev/null +++ b/theme/images/icons/new.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/newspaper.png b/theme/images/icons/newspaper.png new file mode 100755 index 0000000..6a2ecce --- /dev/null +++ b/theme/images/icons/newspaper.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/note.png b/theme/images/icons/note.png new file mode 100755 index 0000000..244e6ca --- /dev/null +++ b/theme/images/icons/note.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/note_delete.png b/theme/images/icons/note_delete.png new file mode 100755 index 0000000..8a1f0ff --- /dev/null +++ b/theme/images/icons/note_delete.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/note_edit.png b/theme/images/icons/note_edit.png new file mode 100755 index 0000000..291bfc7 --- /dev/null +++ b/theme/images/icons/note_edit.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/note_go.png b/theme/images/icons/note_go.png new file mode 100755 index 0000000..49e54fd --- /dev/null +++ b/theme/images/icons/note_go.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/overlays.png b/theme/images/icons/overlays.png new file mode 100755 index 0000000..ab3100b --- /dev/null +++ b/theme/images/icons/overlays.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/page_attach.png b/theme/images/icons/page_attach.png new file mode 100755 index 0000000..89ee2da --- /dev/null +++ b/theme/images/icons/page_attach.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/page_delete.png b/theme/images/icons/page_delete.png new file mode 100755 index 0000000..3141467 --- /dev/null +++ b/theme/images/icons/page_delete.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/page_edit.png b/theme/images/icons/page_edit.png new file mode 100755 index 0000000..046811e --- /dev/null +++ b/theme/images/icons/page_edit.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/page_go.png b/theme/images/icons/page_go.png new file mode 100755 index 0000000..80fe1ed --- /dev/null +++ b/theme/images/icons/page_go.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/rainbow.png b/theme/images/icons/rainbow.png new file mode 100755 index 0000000..5ede989 --- /dev/null +++ b/theme/images/icons/rainbow.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/report.png b/theme/images/icons/report.png new file mode 100755 index 0000000..779ad58 --- /dev/null +++ b/theme/images/icons/report.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/script.png b/theme/images/icons/script.png new file mode 100755 index 0000000..0f9ed4d --- /dev/null +++ b/theme/images/icons/script.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag.png b/theme/images/icons/tag.png new file mode 100755 index 0000000..e093032 --- /dev/null +++ b/theme/images/icons/tag.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_blue.png b/theme/images/icons/tag_blue.png new file mode 100755 index 0000000..9757fc6 --- /dev/null +++ b/theme/images/icons/tag_blue.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_blue_add.png b/theme/images/icons/tag_blue_add.png new file mode 100755 index 0000000..f135248 --- /dev/null +++ b/theme/images/icons/tag_blue_add.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_blue_delete.png b/theme/images/icons/tag_blue_delete.png new file mode 100755 index 0000000..9fbae67 --- /dev/null +++ b/theme/images/icons/tag_blue_delete.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_blue_edit.png b/theme/images/icons/tag_blue_edit.png new file mode 100755 index 0000000..2a9f626 --- /dev/null +++ b/theme/images/icons/tag_blue_edit.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_green.png b/theme/images/icons/tag_green.png new file mode 100755 index 0000000..83ec984 --- /dev/null +++ b/theme/images/icons/tag_green.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_orange.png b/theme/images/icons/tag_orange.png new file mode 100755 index 0000000..454a59f --- /dev/null +++ b/theme/images/icons/tag_orange.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_pink.png b/theme/images/icons/tag_pink.png new file mode 100755 index 0000000..76e2296 --- /dev/null +++ b/theme/images/icons/tag_pink.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_purple.png b/theme/images/icons/tag_purple.png new file mode 100755 index 0000000..ebaf0e8 --- /dev/null +++ b/theme/images/icons/tag_purple.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_red.png b/theme/images/icons/tag_red.png new file mode 100755 index 0000000..6ebb37d --- /dev/null +++ b/theme/images/icons/tag_red.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tag_yellow.png b/theme/images/icons/tag_yellow.png new file mode 100755 index 0000000..83d1292 --- /dev/null +++ b/theme/images/icons/tag_yellow.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/thumb_down.png b/theme/images/icons/thumb_down.png new file mode 100644 index 0000000..3c832d4 --- /dev/null +++ b/theme/images/icons/thumb_down.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/thumb_up.png b/theme/images/icons/thumb_up.png new file mode 100644 index 0000000..2bd16cc --- /dev/null +++ b/theme/images/icons/thumb_up.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/tux.png b/theme/images/icons/tux.png new file mode 100755 index 0000000..bbefe2e --- /dev/null +++ b/theme/images/icons/tux.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/user_edit.png b/theme/images/icons/user_edit.png new file mode 100755 index 0000000..c1974cd --- /dev/null +++ b/theme/images/icons/user_edit.png | |||
Binary files differ | |||
diff --git a/theme/images/icons/vcard.png b/theme/images/icons/vcard.png new file mode 100755 index 0000000..c02f315 --- /dev/null +++ b/theme/images/icons/vcard.png | |||
Binary files differ | |||
diff --git a/theme/images/loadingAnimation.gif b/theme/images/loadingAnimation.gif new file mode 100755 index 0000000..82290f4 --- /dev/null +++ b/theme/images/loadingAnimation.gif | |||
Binary files differ | |||
diff --git a/theme/images/misc.png b/theme/images/misc.png new file mode 100755 index 0000000..fc226e6 --- /dev/null +++ b/theme/images/misc.png | |||
Binary files differ | |||
diff --git a/theme/images/no-ie6.png b/theme/images/no-ie6.png new file mode 100644 index 0000000..fef317c --- /dev/null +++ b/theme/images/no-ie6.png | |||
Binary files differ | |||
diff --git a/theme/images/projects.png b/theme/images/projects.png new file mode 100755 index 0000000..1821e93 --- /dev/null +++ b/theme/images/projects.png | |||
Binary files differ | |||
diff --git a/theme/images/sides_top.gif b/theme/images/sides_top.gif new file mode 100755 index 0000000..a84383a --- /dev/null +++ b/theme/images/sides_top.gif | |||
Binary files differ | |||
diff --git a/theme/images/tabBG.png b/theme/images/tabBG.png new file mode 100755 index 0000000..6c04d14 --- /dev/null +++ b/theme/images/tabBG.png | |||
Binary files differ | |||
diff --git a/theme/images/tabBG2.png b/theme/images/tabBG2.png new file mode 100755 index 0000000..15821a9 --- /dev/null +++ b/theme/images/tabBG2.png | |||
Binary files differ | |||
diff --git a/theme/images/tabSe.png b/theme/images/tabSe.png new file mode 100644 index 0000000..e3955fe --- /dev/null +++ b/theme/images/tabSe.png | |||
Binary files differ | |||
diff --git a/theme/images/tabUn.png b/theme/images/tabUn.png new file mode 100644 index 0000000..7ba116d --- /dev/null +++ b/theme/images/tabUn.png | |||
Binary files differ | |||
diff --git a/theme/images/tip-pimped.gif b/theme/images/tip-pimped.gif new file mode 100644 index 0000000..f3f604e --- /dev/null +++ b/theme/images/tip-pimped.gif | |||
Binary files differ | |||
diff --git a/theme/images/tip-rounded.gif b/theme/images/tip-rounded.gif new file mode 100644 index 0000000..d0308a6 --- /dev/null +++ b/theme/images/tip-rounded.gif | |||
Binary files differ | |||
diff --git a/theme/images/tip.gif b/theme/images/tip.gif new file mode 100644 index 0000000..4713f05 --- /dev/null +++ b/theme/images/tip.gif | |||
Binary files differ | |||
diff --git a/theme/images/webs.png b/theme/images/webs.png new file mode 100755 index 0000000..5506afd --- /dev/null +++ b/theme/images/webs.png | |||
Binary files differ | |||
diff --git a/theme/images/youdropifollow.jpg b/theme/images/youdropifollow.jpg new file mode 100644 index 0000000..c811576 --- /dev/null +++ b/theme/images/youdropifollow.jpg | |||
Binary files differ | |||
diff --git a/theme/js/jquery-1.2.6.min.js b/theme/js/jquery-1.2.6.min.js new file mode 100644 index 0000000..1acc8fd --- /dev/null +++ b/theme/js/jquery-1.2.6.min.js | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * jQuery 1.2.6 - New Wave Javascript | ||
3 | * | ||
4 | * Copyright (c) 2008 John Resig (jquery.com) | ||
5 | * Dual licensed under the MIT (MIT-LICENSE.txt) | ||
6 | * and GPL (GPL-LICENSE.txt) licenses. | ||
7 | * | ||
8 | * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ | ||
9 | * $Rev: 5685 $ | ||
10 | */ | ||
11 | (function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else | ||
12 | return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else | ||
13 | return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else | ||
14 | selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else | ||
15 | return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else | ||
16 | this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else | ||
17 | return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else | ||
18 | jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else | ||
19 | script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else | ||
20 | for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else | ||
21 | for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else | ||
22 | jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else | ||
23 | ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else | ||
24 | while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else | ||
25 | while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else | ||
26 | for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else | ||
27 | jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else | ||
28 | xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else | ||
29 | jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else | ||
30 | for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else | ||
31 | s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else | ||
32 | e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})(); | ||
diff --git a/theme/js/jquery.ie6blocker.js b/theme/js/jquery.ie6blocker.js new file mode 100644 index 0000000..222f335 --- /dev/null +++ b/theme/js/jquery.ie6blocker.js | |||
@@ -0,0 +1,34 @@ | |||
1 | var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false; | ||
2 | if(IE6){ | ||
3 | |||
4 | $(function(){ | ||
5 | |||
6 | $("<div>") | ||
7 | .css({ | ||
8 | 'position': 'absolute', | ||
9 | 'top': '0px', | ||
10 | 'left': '0px', | ||
11 | backgroundColor: 'black', | ||
12 | 'opacity': '0.75', | ||
13 | 'width': '100%', | ||
14 | 'height': $(window).height(), | ||
15 | zIndex: 5000 | ||
16 | }) | ||
17 | .appendTo("body"); | ||
18 | |||
19 | $("<div><img src='/theme/images/no-ie6.png' alt='' style='float: left;'/><p><br /><strong>Sorry! This page doesn't support Internet Explorer 6.</strong><br /><br />If you'd like to read our content please <a href='http://getfirefox.org'>upgrade your browser</a> or <a href='/rss.php'>subscribe to our RSS feed</a>.</p>") | ||
20 | .css({ | ||
21 | backgroundColor: 'white', | ||
22 | 'top': '50%', | ||
23 | 'left': '50%', | ||
24 | marginLeft: -210, | ||
25 | marginTop: -100, | ||
26 | width: 410, | ||
27 | paddingRight: 10, | ||
28 | height: 200, | ||
29 | 'position': 'absolute', | ||
30 | zIndex: 6000 | ||
31 | }) | ||
32 | .appendTo("body"); | ||
33 | }); | ||
34 | } | ||
diff --git a/theme/js/message.js b/theme/js/message.js new file mode 100644 index 0000000..9de4bae --- /dev/null +++ b/theme/js/message.js | |||
@@ -0,0 +1,5 @@ | |||
1 | $(document).ready(function() { | ||
2 | $("div#stripe").click(function() { | ||
3 | $("div#stripe").slideUp(); | ||
4 | }); | ||
5 | }); | ||
diff --git a/theme/js/round_bubbles.js b/theme/js/round_bubbles.js new file mode 100644 index 0000000..8423b99 --- /dev/null +++ b/theme/js/round_bubbles.js | |||
@@ -0,0 +1,13 @@ | |||
1 | window.onload = function() { | ||
2 | settings = { | ||
3 | tl: { radius: 10 }, | ||
4 | tr: { radius: 10 }, | ||
5 | bl: { radius: 10 }, | ||
6 | br: { radius: 10 }, | ||
7 | antiAlias: true, | ||
8 | autoPad: true | ||
9 | } | ||
10 | var myBoxObject = new curvyCorners(settings, "rounded"); | ||
11 | myBoxObject.applyCornersToAll(); | ||
12 | } | ||
13 | |||
diff --git a/theme/js/rounded_corners.inc.js b/theme/js/rounded_corners.inc.js new file mode 100644 index 0000000..81af16d --- /dev/null +++ b/theme/js/rounded_corners.inc.js | |||
@@ -0,0 +1,279 @@ | |||
1 | |||
2 | /**************************************************************** | ||
3 | * * | ||
4 | * curvyCorners * | ||
5 | * ------------ * | ||
6 | * * | ||
7 | * This script generates rounded corners for your divs. * | ||
8 | * * | ||
9 | * Version 1.2.7 * | ||
10 | * Copyright (c) 2006 Cameron Cooke * | ||
11 | * By: Cameron Cooke and Tim Hutchison. * | ||
12 | * * | ||
13 | * * | ||
14 | * Website: http://www.curvycorners.net * | ||
15 | * Email: info@totalinfinity.com * | ||
16 | * Forum: http://www.curvycorners.net/forum/ * | ||
17 | * * | ||
18 | * * | ||
19 | * This library is free software; you can redistribute * | ||
20 | * it and/or modify it under the terms of the GNU * | ||
21 | * Lesser General Public License as published by the * | ||
22 | * Free Software Foundation; either version 2.1 of the * | ||
23 | * License, or (at your option) any later version. * | ||
24 | * * | ||
25 | * This library is distributed in the hope that it will * | ||
26 | * be useful, but WITHOUT ANY WARRANTY; without even the * | ||
27 | * implied warranty of MERCHANTABILITY or FITNESS FOR A * | ||
28 | * PARTICULAR PURPOSE. See the GNU Lesser General Public * | ||
29 | * License for more details. * | ||
30 | * * | ||
31 | * You should have received a copy of the GNU Lesser * | ||
32 | * General Public License along with this library; * | ||
33 | * Inc., 59 Temple Place, Suite 330, Boston, * | ||
34 | * MA 02111-1307 USA * | ||
35 | * * | ||
36 | ****************************************************************/ | ||
37 | |||
38 | var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1; var isMoz = document.implementation && document.implementation.createDocument; var isSafari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false; function curvyCorners() | ||
39 | { if(typeof(arguments[0]) != "object") throw newCurvyError("First parameter of curvyCorners() must be an object."); if(typeof(arguments[1]) != "object" && typeof(arguments[1]) != "string") throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name."); if(typeof(arguments[1]) == "string") | ||
40 | { var startIndex = 0; var boxCol = getElementsByClass(arguments[1]);} | ||
41 | else | ||
42 | { var startIndex = 1; var boxCol = arguments;} | ||
43 | var curvyCornersCol = new Array(); for(var i = startIndex, j = boxCol.length; i < j; i++) | ||
44 | { if(boxCol[i].tagName.toLowerCase() == "div") | ||
45 | { curvyCornersCol[curvyCornersCol.length] = new curvyObject(arguments[0], boxCol[i]);} | ||
46 | } | ||
47 | this.objects = curvyCornersCol; this.applyCornersToAll = function() | ||
48 | { for(var x = 0, k = this.objects.length; x < k; x++) | ||
49 | { this.objects[x].applyCorners();} | ||
50 | } | ||
51 | } | ||
52 | function curvyObject() | ||
53 | { this.box = arguments[1]; this.settings = arguments[0]; this.topContainer = null; this.bottomContainer = null; this.masterCorners = new Array(); this.contentDIV = null; var boxHeight = get_style(this.box, "height", "height"); var boxWidth = get_style(this.box, "width", "width"); var borderWidth = get_style(this.box, "borderTopWidth", "border-top-width"); var borderColour = get_style(this.box, "borderTopColor", "border-top-color"); var boxColour = get_style(this.box, "backgroundColor", "background-color"); var backgroundImage = get_style(this.box, "backgroundImage", "background-image"); var boxPosition = get_style(this.box, "position", "position"); var boxPadding = get_style(this.box, "paddingTop", "padding-top"); this.boxHeight = parseInt(((boxHeight != "" && boxHeight != "auto" && boxHeight.indexOf("%") == -1)? boxHeight.substring(0, boxHeight.indexOf("px")) : this.box.scrollHeight)); this.boxWidth = parseInt(((boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1)? boxWidth.substring(0, boxWidth.indexOf("px")) : this.box.scrollWidth)); this.borderWidth = parseInt(((borderWidth != "" && borderWidth.indexOf("px") !== -1)? borderWidth.slice(0, borderWidth.indexOf("px")) : 0)); this.boxColour = format_colour(boxColour); this.boxPadding = parseInt(((boxPadding != "" && boxPadding.indexOf("px") !== -1)? boxPadding.slice(0, boxPadding.indexOf("px")) : 0)); this.borderColour = format_colour(borderColour); this.borderString = this.borderWidth + "px" + " solid " + this.borderColour; this.backgroundImage = ((backgroundImage != "none")? backgroundImage : ""); this.boxContent = this.box.innerHTML; if(boxPosition != "absolute") this.box.style.position = "relative"; this.box.style.padding = "0px"; if(isIE && boxWidth == "auto" && boxHeight == "auto") this.box.style.width = "100%"; if(this.settings.autoPad == true && this.boxPadding > 0) | ||
54 | this.box.innerHTML = ""; this.applyCorners = function() | ||
55 | { for(var t = 0; t < 2; t++) | ||
56 | { switch(t) | ||
57 | { case 0: | ||
58 | if(this.settings.tl || this.settings.tr) | ||
59 | { var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var topMaxRadius = Math.max(this.settings.tl ? this.settings.tl.radius : 0, this.settings.tr ? this.settings.tr.radius : 0); newMainContainer.style.height = topMaxRadius + "px"; newMainContainer.style.top = 0 - topMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.topContainer = this.box.appendChild(newMainContainer);} | ||
60 | break; case 1: | ||
61 | if(this.settings.bl || this.settings.br) | ||
62 | { var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var botMaxRadius = Math.max(this.settings.bl ? this.settings.bl.radius : 0, this.settings.br ? this.settings.br.radius : 0); newMainContainer.style.height = botMaxRadius + "px"; newMainContainer.style.bottom = 0 - botMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.bottomContainer = this.box.appendChild(newMainContainer);} | ||
63 | break;} | ||
64 | } | ||
65 | if(this.topContainer) this.box.style.borderTopWidth = "0px"; if(this.bottomContainer) this.box.style.borderBottomWidth = "0px"; var corners = ["tr", "tl", "br", "bl"]; for(var i in corners) | ||
66 | { var cc = corners[i]; if(!this.settings[cc]) | ||
67 | { if(((cc == "tr" || cc == "tl") && this.topContainer != null) || ((cc == "br" || cc == "bl") && this.bottomContainer != null)) | ||
68 | { var newCorner = document.createElement("DIV"); newCorner.style.position = "relative"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; if(this.backgroundImage == "") | ||
69 | newCorner.style.backgroundColor = this.boxColour; else | ||
70 | newCorner.style.backgroundImage = this.backgroundImage; switch(cc) | ||
71 | { case "tl": | ||
72 | newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.tr.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.left = -this.borderWidth + "px"; break; case "tr": | ||
73 | newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.tl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; newCorner.style.left = this.borderWidth + "px"; break; case "bl": | ||
74 | newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.br.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = -this.borderWidth + "px"; newCorner.style.backgroundPosition = "-" + (this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break; case "br": | ||
75 | newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.bl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = this.borderWidth + "px" | ||
76 | newCorner.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break;} | ||
77 | } | ||
78 | } | ||
79 | else | ||
80 | { if(this.masterCorners[this.settings[cc].radius]) | ||
81 | { var newCorner = this.masterCorners[this.settings[cc].radius].cloneNode(true);} | ||
82 | else | ||
83 | { var newCorner = document.createElement("DIV"); newCorner.style.height = this.settings[cc].radius + "px"; newCorner.style.width = this.settings[cc].radius + "px"; newCorner.style.position = "absolute"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; var borderRadius = parseInt(this.settings[cc].radius - this.borderWidth); for(var intx = 0, j = this.settings[cc].radius; intx < j; intx++) | ||
84 | { if((intx +1) >= borderRadius) | ||
85 | var y1 = -1; else | ||
86 | var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx+1), 2))) - 1); if(borderRadius != j) | ||
87 | { if((intx) >= borderRadius) | ||
88 | var y2 = -1; else | ||
89 | var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius,2) - Math.pow(intx, 2))); if((intx+1) >= j) | ||
90 | var y3 = -1; else | ||
91 | var y3 = (Math.floor(Math.sqrt(Math.pow(j ,2) - Math.pow((intx+1), 2))) - 1);} | ||
92 | if((intx) >= j) | ||
93 | var y4 = -1; else | ||
94 | var y4 = Math.ceil(Math.sqrt(Math.pow(j ,2) - Math.pow(intx, 2))); if(y1 > -1) this.drawPixel(intx, 0, this.boxColour, 100, (y1+1), newCorner, -1, this.settings[cc].radius); if(borderRadius != j) | ||
95 | { for(var inty = (y1 + 1); inty < y2; inty++) | ||
96 | { if(this.settings.antiAlias) | ||
97 | { if(this.backgroundImage != "") | ||
98 | { var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if(borderFract < 30) | ||
99 | { this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, 0, this.settings[cc].radius);} | ||
100 | else | ||
101 | { this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, -1, this.settings[cc].radius);} | ||
102 | } | ||
103 | else | ||
104 | { var pixelcolour = BlendColour(this.boxColour, this.borderColour, pixelFraction(intx, inty, borderRadius)); this.drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, this.settings[cc].radius, cc);} | ||
105 | } | ||
106 | } | ||
107 | if(this.settings.antiAlias) | ||
108 | { if(y3 >= y2) | ||
109 | { if (y2 == -1) y2 = 0; this.drawPixel(intx, y2, this.borderColour, 100, (y3 - y2 + 1), newCorner, 0, 0);} | ||
110 | } | ||
111 | else | ||
112 | { if(y3 >= y1) | ||
113 | { this.drawPixel(intx, (y1 + 1), this.borderColour, 100, (y3 - y1), newCorner, 0, 0);} | ||
114 | } | ||
115 | var outsideColour = this.borderColour;} | ||
116 | else | ||
117 | { var outsideColour = this.boxColour; var y3 = y1;} | ||
118 | if(this.settings.antiAlias) | ||
119 | { for(var inty = (y3 + 1); inty < y4; inty++) | ||
120 | { this.drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty , j) * 100), 1, newCorner, ((this.borderWidth > 0)? 0 : -1), this.settings[cc].radius);} | ||
121 | } | ||
122 | } | ||
123 | this.masterCorners[this.settings[cc].radius] = newCorner.cloneNode(true);} | ||
124 | if(cc != "br") | ||
125 | { for(var t = 0, k = newCorner.childNodes.length; t < k; t++) | ||
126 | { var pixelBar = newCorner.childNodes[t]; var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px"))); var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px"))); var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px"))); if(cc == "tl" || cc == "bl"){ pixelBar.style.left = this.settings[cc].radius -pixelBarLeft -1 + "px";} | ||
127 | if(cc == "tr" || cc == "tl"){ pixelBar.style.top = this.settings[cc].radius -pixelBarHeight -pixelBarTop + "px";} | ||
128 | switch(cc) | ||
129 | { case "tr": | ||
130 | pixelBar.style.backgroundPosition = "-" + Math.abs((this.boxWidth - this.settings[cc].radius + this.borderWidth) + pixelBarLeft) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "tl": | ||
131 | pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "bl": | ||
132 | pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs((this.boxHeight + this.settings[cc].radius + pixelBarTop) -this.borderWidth) + "px"; break;} | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | if(newCorner) | ||
137 | { switch(cc) | ||
138 | { case "tl": | ||
139 | if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "tr": | ||
140 | if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "bl": | ||
141 | if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break; case "br": | ||
142 | if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break;} | ||
143 | } | ||
144 | } | ||
145 | var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(this.settings.tl.radius - this.settings.tr.radius) | ||
146 | radiusDiff["b"] = Math.abs(this.settings.bl.radius - this.settings.br.radius); for(z in radiusDiff) | ||
147 | { if(radiusDiff[z]) | ||
148 | { var smallerCornerType = ((this.settings[z + "l"].radius < this.settings[z + "r"].radius)? z +"l" : z +"r"); var newFiller = document.createElement("DIV"); newFiller.style.height = radiusDiff[z] + "px"; newFiller.style.width = this.settings[smallerCornerType].radius+ "px" | ||
149 | newFiller.style.position = "absolute"; newFiller.style.fontSize = "1px"; newFiller.style.overflow = "hidden"; newFiller.style.backgroundColor = this.boxColour; switch(smallerCornerType) | ||
150 | { case "tl": | ||
151 | newFiller.style.bottom = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.topContainer.appendChild(newFiller); break; case "tr": | ||
152 | newFiller.style.bottom = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.topContainer.appendChild(newFiller); break; case "bl": | ||
153 | newFiller.style.top = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.bottomContainer.appendChild(newFiller); break; case "br": | ||
154 | newFiller.style.top = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.bottomContainer.appendChild(newFiller); break;} | ||
155 | } | ||
156 | var newFillerBar = document.createElement("DIV"); newFillerBar.style.position = "relative"; newFillerBar.style.fontSize = "1px"; newFillerBar.style.overflow = "hidden"; newFillerBar.style.backgroundColor = this.boxColour; newFillerBar.style.backgroundImage = this.backgroundImage; switch(z) | ||
157 | { case "t": | ||
158 | if(this.topContainer) | ||
159 | { if(this.settings.tl.radius && this.settings.tr.radius) | ||
160 | { newFillerBar.style.height = topMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.tl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.tr.radius - this.borderWidth + "px"; newFillerBar.style.borderTop = this.borderString; if(this.backgroundImage != "") | ||
161 | newFillerBar.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; this.topContainer.appendChild(newFillerBar);} | ||
162 | this.box.style.backgroundPosition = "0px -" + (topMaxRadius - this.borderWidth) + "px";} | ||
163 | break; case "b": | ||
164 | if(this.bottomContainer) | ||
165 | { if(this.settings.bl.radius && this.settings.br.radius) | ||
166 | { newFillerBar.style.height = botMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.bl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.br.radius - this.borderWidth + "px"; newFillerBar.style.borderBottom = this.borderString; if(this.backgroundImage != "") | ||
167 | newFillerBar.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (topMaxRadius + this.borderWidth)) + "px"; this.bottomContainer.appendChild(newFillerBar);} | ||
168 | } | ||
169 | break;} | ||
170 | } | ||
171 | if(this.settings.autoPad == true && this.boxPadding > 0) | ||
172 | { var contentContainer = document.createElement("DIV"); contentContainer.style.position = "relative"; contentContainer.innerHTML = this.boxContent; contentContainer.className = "autoPadDiv"; var topPadding = Math.abs(topMaxRadius - this.boxPadding); var botPadding = Math.abs(botMaxRadius - this.boxPadding); if(topMaxRadius < this.boxPadding) | ||
173 | contentContainer.style.paddingTop = topPadding + "px"; if(botMaxRadius < this.boxPadding) | ||
174 | contentContainer.style.paddingBottom = botMaxRadius + "px"; contentContainer.style.paddingLeft = this.boxPadding + "px"; contentContainer.style.paddingRight = this.boxPadding + "px"; this.contentDIV = this.box.appendChild(contentContainer);} | ||
175 | } | ||
176 | this.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius) | ||
177 | { var pixel = document.createElement("DIV"); pixel.style.height = height + "px"; pixel.style.width = "1px"; pixel.style.position = "absolute"; pixel.style.fontSize = "1px"; pixel.style.overflow = "hidden"; var topMaxRadius = Math.max(this.settings["tr"].radius, this.settings["tl"].radius); if(image == -1 && this.backgroundImage != "") | ||
178 | { pixel.style.backgroundImage = this.backgroundImage; pixel.style.backgroundPosition = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) -this.borderWidth) + "px";} | ||
179 | else | ||
180 | { pixel.style.backgroundColor = colour;} | ||
181 | if (transAmount != 100) | ||
182 | setOpacity(pixel, transAmount); pixel.style.top = inty + "px"; pixel.style.left = intx + "px"; newCorner.appendChild(pixel);} | ||
183 | } | ||
184 | function insertAfter(parent, node, referenceNode) | ||
185 | { parent.insertBefore(node, referenceNode.nextSibling);} | ||
186 | function BlendColour(Col1, Col2, Col1Fraction) | ||
187 | { var red1 = parseInt(Col1.substr(1,2),16); var green1 = parseInt(Col1.substr(3,2),16); var blue1 = parseInt(Col1.substr(5,2),16); var red2 = parseInt(Col2.substr(1,2),16); var green2 = parseInt(Col2.substr(3,2),16); var blue2 = parseInt(Col2.substr(5,2),16); if(Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if(endRed > 255) endRed = 255; if(endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if(endGreen > 255) endGreen = 255; if(endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if(endBlue > 255) endBlue = 255; if(endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed)+ IntToHex(endGreen)+ IntToHex(endBlue);} | ||
188 | function IntToHex(strNum) | ||
189 | { base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS;} | ||
190 | function MakeHex(x) | ||
191 | { if((x >= 0) && (x <= 9)) | ||
192 | { return x;} | ||
193 | else | ||
194 | { switch(x) | ||
195 | { case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F";} | ||
196 | } | ||
197 | } | ||
198 | function pixelFraction(x, y, r) | ||
199 | { var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x,2))); if ((intersect >= y) && (intersect < (y+1))) | ||
200 | { whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1;} | ||
201 | var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y+1,2))); if ((intersect >= x) && (intersect < (x+1))) | ||
202 | { whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1;} | ||
203 | var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x+1,2))); if ((intersect >= y) && (intersect < (y+1))) | ||
204 | { whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1;} | ||
205 | var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y,2))); if ((intersect >= x) && (intersect < (x+1))) | ||
206 | { whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0;} | ||
207 | switch (whatsides) | ||
208 | { case "LeftRight": | ||
209 | pixelfraction = Math.min(yvalues[0],yvalues[1]) + ((Math.max(yvalues[0],yvalues[1]) - Math.min(yvalues[0],yvalues[1]))/2); break; case "TopRight": | ||
210 | pixelfraction = 1-(((1-xvalues[0])*(1-yvalues[1]))/2); break; case "TopBottom": | ||
211 | pixelfraction = Math.min(xvalues[0],xvalues[1]) + ((Math.max(xvalues[0],xvalues[1]) - Math.min(xvalues[0],xvalues[1]))/2); break; case "LeftBottom": | ||
212 | pixelfraction = (yvalues[0]*xvalues[1])/2; break; default: | ||
213 | pixelfraction = 1;} | ||
214 | return pixelfraction;} | ||
215 | function rgb2Hex(rgbColour) | ||
216 | { try{ var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue);} | ||
217 | catch(e){ alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");} | ||
218 | return hexColour;} | ||
219 | function rgb2Array(rgbColour) | ||
220 | { var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray;} | ||
221 | function setOpacity(obj, opacity) | ||
222 | { opacity = (opacity == 100)?99.999:opacity; if(isSafari && obj.tagName != "IFRAME") | ||
223 | { var rgbArray = rgb2Array(obj.style.backgroundColor); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";} | ||
224 | else if(typeof(obj.style.opacity) != "undefined") | ||
225 | { obj.style.opacity = opacity/100;} | ||
226 | else if(typeof(obj.style.MozOpacity) != "undefined") | ||
227 | { obj.style.MozOpacity = opacity/100;} | ||
228 | else if(typeof(obj.style.filter) != "undefined") | ||
229 | { obj.style.filter = "alpha(opacity:" + opacity + ")";} | ||
230 | else if(typeof(obj.style.KHTMLOpacity) != "undefined") | ||
231 | { obj.style.KHTMLOpacity = opacity/100;} | ||
232 | } | ||
233 | function inArray(array, value) | ||
234 | { for(var i = 0; i < array.length; i++){ if (array[i] === value) return i;} | ||
235 | return false;} | ||
236 | function inArrayKey(array, value) | ||
237 | { for(key in array){ if(key === value) return true;} | ||
238 | return false;} | ||
239 | function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true;} | ||
240 | else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r;} | ||
241 | else { elm['on' + evType] = fn;} | ||
242 | } | ||
243 | function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture); return true;} else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType, fn); return r;} else { alert("Handler could not be removed");} | ||
244 | } | ||
245 | function format_colour(colour) | ||
246 | { var returnColour = "#ffffff"; if(colour != "" && colour != "transparent") | ||
247 | { if(colour.substr(0, 3) == "rgb") | ||
248 | { returnColour = rgb2Hex(colour);} | ||
249 | else if(colour.length == 4) | ||
250 | { returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4);} | ||
251 | else | ||
252 | { returnColour = colour;} | ||
253 | } | ||
254 | return returnColour;} | ||
255 | function get_style(obj, property, propertyNS) | ||
256 | { try | ||
257 | { if(obj.currentStyle) | ||
258 | { var returnVal = eval("obj.currentStyle." + property);} | ||
259 | else | ||
260 | { if(isSafari && obj.style.display == "none") | ||
261 | { obj.style.display = ""; var wasHidden = true;} | ||
262 | var returnVal = document.defaultView.getComputedStyle(obj, '').getPropertyValue(propertyNS); if(isSafari && wasHidden) | ||
263 | { obj.style.display = "none";} | ||
264 | } | ||
265 | } | ||
266 | catch(e) | ||
267 | { } | ||
268 | return returnVal;} | ||
269 | function getElementsByClass(searchClass, node, tag) | ||
270 | { var classElements = new Array(); if(node == null) | ||
271 | node = document; if(tag == null) | ||
272 | tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)"); for (i = 0, j = 0; i < elsLen; i++) | ||
273 | { if(pattern.test(els[i].className)) | ||
274 | { classElements[j] = els[i]; j++;} | ||
275 | } | ||
276 | return classElements;} | ||
277 | function newCurvyError(errorMessage) | ||
278 | { return new Error("curvyCorners Error:\n" + errorMessage) | ||
279 | } | ||
diff --git a/theme/js/thickbox.js b/theme/js/thickbox.js new file mode 100755 index 0000000..2ac1a21 --- /dev/null +++ b/theme/js/thickbox.js | |||
@@ -0,0 +1,328 @@ | |||
1 | /* | ||
2 | * Thickbox 3.1 - One Box To Rule Them All. | ||
3 | * By Cody Lindley (http://www.codylindley.com) | ||
4 | * Copyright (c) 2007 cody lindley | ||
5 | * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php | ||
6 | */ | ||
7 | |||
8 | var tb_pathToImage = "/theme/images/loadingAnimation.gif"; | ||
9 | |||
10 | /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ | ||
11 | |||
12 | //on page load call tb_init | ||
13 | $(document).ready(function(){ | ||
14 | tb_startup(); | ||
15 | }); | ||
16 | |||
17 | function tb_startup() { | ||
18 | tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox | ||
19 | imgLoader = new Image();// preload image | ||
20 | imgLoader.src = tb_pathToImage; | ||
21 | } | ||
22 | |||
23 | function tb_splash() { | ||
24 | tb_startup(); | ||
25 | tb_show("Welcome to Four Island!", "theme/welcome.tpl?no=", false); | ||
26 | } | ||
27 | |||
28 | //add thickbox to href & area elements that have a class of .thickbox | ||
29 | function tb_init(domChunk){ | ||
30 | $(domChunk).click(function(){ | ||
31 | var t = this.title || this.name || null; | ||
32 | var a = this.href || this.alt; | ||
33 | var g = this.rel || false; | ||
34 | tb_show(t,a,g); | ||
35 | this.blur(); | ||
36 | return false; | ||
37 | }); | ||
38 | } | ||
39 | |||
40 | function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link | ||
41 | |||
42 | try { | ||
43 | /* if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 | ||
44 | $("body","html").css({height: "100%", width: "100%"}); | ||
45 | $("html").css("overflow","hidden"); | ||
46 | if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 | ||
47 | $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); | ||
48 | $("#TB_overlay").click(tb_remove); | ||
49 | } | ||
50 | }else*/{//all others | ||
51 | if(document.getElementById("TB_overlay") === null){ | ||
52 | $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); | ||
53 | $("#TB_overlay").click(tb_remove); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | if(tb_detectMacXFF()){ | ||
58 | $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash | ||
59 | }else{ | ||
60 | $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity | ||
61 | } | ||
62 | |||
63 | if(caption===null){caption="";} | ||
64 | $("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page | ||
65 | $('#TB_load').show();//show loader | ||
66 | |||
67 | var baseURL; | ||
68 | if(url.indexOf("?")!==-1){ //ff there is a query string involved | ||
69 | baseURL = url.substr(0, url.indexOf("?")); | ||
70 | }else{ | ||
71 | baseURL = url; | ||
72 | } | ||
73 | |||
74 | var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; | ||
75 | var urlType = baseURL.toLowerCase().match(urlString); | ||
76 | |||
77 | if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images | ||
78 | |||
79 | TB_PrevCaption = ""; | ||
80 | TB_PrevURL = ""; | ||
81 | TB_PrevHTML = ""; | ||
82 | TB_NextCaption = ""; | ||
83 | TB_NextURL = ""; | ||
84 | TB_NextHTML = ""; | ||
85 | TB_imageCount = ""; | ||
86 | TB_FoundURL = false; | ||
87 | if(imageGroup){ | ||
88 | TB_TempArray = $("a[@rel="+imageGroup+"]").get(); | ||
89 | for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { | ||
90 | var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); | ||
91 | if (!(TB_TempArray[TB_Counter].href == url)) { | ||
92 | if (TB_FoundURL) { | ||
93 | TB_NextCaption = TB_TempArray[TB_Counter].title; | ||
94 | TB_NextURL = TB_TempArray[TB_Counter].href; | ||
95 | TB_NextHTML = "<span id='TB_next'> <a href='#'>Next ></a></span>"; | ||
96 | } else { | ||
97 | TB_PrevCaption = TB_TempArray[TB_Counter].title; | ||
98 | TB_PrevURL = TB_TempArray[TB_Counter].href; | ||
99 | TB_PrevHTML = "<span id='TB_prev'> <a href='#'>< Prev</a></span>"; | ||
100 | } | ||
101 | } else { | ||
102 | TB_FoundURL = true; | ||
103 | TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); | ||
104 | } | ||
105 | } | ||
106 | } | ||
107 | |||
108 | imgPreloader = new Image(); | ||
109 | imgPreloader.onload = function(){ | ||
110 | imgPreloader.onload = null; | ||
111 | |||
112 | // Resizing large images - orginal by Christian Montoya edited by me. | ||
113 | var pagesize = tb_getPageSize(); | ||
114 | var x = pagesize[0] - 150; | ||
115 | var y = pagesize[1] - 150; | ||
116 | var imageWidth = imgPreloader.width; | ||
117 | var imageHeight = imgPreloader.height; | ||
118 | if (imageWidth > x) { | ||
119 | imageHeight = imageHeight * (x / imageWidth); | ||
120 | imageWidth = x; | ||
121 | if (imageHeight > y) { | ||
122 | imageWidth = imageWidth * (y / imageHeight); | ||
123 | imageHeight = y; | ||
124 | } | ||
125 | } else if (imageHeight > y) { | ||
126 | imageWidth = imageWidth * (y / imageHeight); | ||
127 | imageHeight = y; | ||
128 | if (imageWidth > x) { | ||
129 | imageHeight = imageHeight * (x / imageWidth); | ||
130 | imageWidth = x; | ||
131 | } | ||
132 | } | ||
133 | // End Resizing | ||
134 | |||
135 | TB_WIDTH = imageWidth + 30; | ||
136 | TB_HEIGHT = imageHeight + 60; | ||
137 | $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); | ||
138 | |||
139 | $("#TB_closeWindowButton").click(tb_remove); | ||
140 | |||
141 | if (!(TB_PrevHTML === "")) { | ||
142 | function goPrev(){ | ||
143 | if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);} | ||
144 | $("#TB_window").remove(); | ||
145 | $("body").append("<div id='TB_window'></div>"); | ||
146 | tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); | ||
147 | return false; | ||
148 | } | ||
149 | $("#TB_prev").click(goPrev); | ||
150 | } | ||
151 | |||
152 | if (!(TB_NextHTML === "")) { | ||
153 | function goNext(){ | ||
154 | $("#TB_window").remove(); | ||
155 | $("body").append("<div id='TB_window'></div>"); | ||
156 | tb_show(TB_NextCaption, TB_NextURL, imageGroup); | ||
157 | return false; | ||
158 | } | ||
159 | $("#TB_next").click(goNext); | ||
160 | |||
161 | } | ||
162 | |||
163 | document.onkeydown = function(e){ | ||
164 | if (e == null) { // ie | ||
165 | keycode = event.keyCode; | ||
166 | } else { // mozilla | ||
167 | keycode = e.which; | ||
168 | } | ||
169 | if(keycode == 27){ // close | ||
170 | tb_remove(); | ||
171 | } else if(keycode == 190){ // display previous image | ||
172 | if(!(TB_NextHTML == "")){ | ||
173 | document.onkeydown = ""; | ||
174 | goNext(); | ||
175 | } | ||
176 | } else if(keycode == 188){ // display next image | ||
177 | if(!(TB_PrevHTML == "")){ | ||
178 | document.onkeydown = ""; | ||
179 | goPrev(); | ||
180 | } | ||
181 | } | ||
182 | }; | ||
183 | |||
184 | tb_position(); | ||
185 | $("#TB_load").remove(); | ||
186 | $("#TB_ImageOff").click(tb_remove); | ||
187 | $("#TB_window").css({display:"block"}); //for safari using css instead of show | ||
188 | }; | ||
189 | |||
190 | imgPreloader.src = url; | ||
191 | }else{//code to show html | ||
192 | |||
193 | var queryString = url.replace(/^[^\?]+\??/,''); | ||
194 | var params = tb_parseQuery( queryString ); | ||
195 | |||
196 | TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL | ||
197 | TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL | ||
198 | ajaxContentW = TB_WIDTH - 30; | ||
199 | ajaxContentH = TB_HEIGHT - 45; | ||
200 | |||
201 | if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window | ||
202 | urlNoQuery = url.split('TB_'); | ||
203 | $("#TB_iframeContent").remove(); | ||
204 | if(params['modal'] != "true"){//iframe no modal | ||
205 | $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>"); | ||
206 | }else{//iframe modal | ||
207 | $("#TB_overlay").unbind(); | ||
208 | $("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>"); | ||
209 | } | ||
210 | }else{// not an iframe, ajax | ||
211 | if($("#TB_window").css("display") != "block"){ | ||
212 | if(params['modal'] != "true"){//ajax no modal | ||
213 | $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); | ||
214 | }else{//ajax modal | ||
215 | $("#TB_overlay").unbind(); | ||
216 | $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); | ||
217 | } | ||
218 | }else{//this means the window is already up, we are just loading new content via ajax | ||
219 | $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; | ||
220 | $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; | ||
221 | $("#TB_ajaxContent")[0].scrollTop = 0; | ||
222 | $("#TB_ajaxWindowTitle").html(caption); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | $("#TB_closeWindowButton").click(tb_remove); | ||
227 | |||
228 | if(url.indexOf('TB_inline') != -1){ | ||
229 | $("#TB_ajaxContent").append($('#' + params['inlineId']).children()); | ||
230 | $("#TB_window").unload(function () { | ||
231 | $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished | ||
232 | }); | ||
233 | tb_position(); | ||
234 | $("#TB_load").remove(); | ||
235 | $("#TB_window").css({display:"block"}); | ||
236 | }else if(url.indexOf('TB_iframe') != -1){ | ||
237 | tb_position(); | ||
238 | if($.browser.safari){//safari needs help because it will not fire iframe onload | ||
239 | $("#TB_load").remove(); | ||
240 | $("#TB_window").css({display:"block"}); | ||
241 | } | ||
242 | }else{ | ||
243 | $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method | ||
244 | tb_position(); | ||
245 | $("#TB_load").remove(); | ||
246 | tb_init("#TB_ajaxContent a.thickbox"); | ||
247 | $("#TB_window").css({display:"block"}); | ||
248 | }); | ||
249 | } | ||
250 | |||
251 | } | ||
252 | |||
253 | if(!params['modal']){ | ||
254 | document.onkeyup = function(e){ | ||
255 | if (e == null) { // ie | ||
256 | keycode = event.keyCode; | ||
257 | } else { // mozilla | ||
258 | keycode = e.which; | ||
259 | } | ||
260 | if(keycode == 27){ // close | ||
261 | tb_remove(); | ||
262 | } | ||
263 | }; | ||
264 | } | ||
265 | |||
266 | } catch(e) { | ||
267 | //nothing here | ||
268 | } | ||
269 | } | ||
270 | |||
271 | //helper functions below | ||
272 | function tb_showIframe(){ | ||
273 | $("#TB_load").remove(); | ||
274 | $("#TB_window").css({display:"block"}); | ||
275 | } | ||
276 | |||
277 | function tb_remove() { | ||
278 | $("#TB_imageOff").unbind("click"); | ||
279 | $("#TB_closeWindowButton").unbind("click"); | ||
280 | $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); | ||
281 | $("#TB_load").remove(); | ||
282 | if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 | ||
283 | $("body","html").css({height: "auto", width: "auto"}); | ||
284 | $("html").css("overflow",""); | ||
285 | } | ||
286 | document.onkeydown = ""; | ||
287 | document.onkeyup = ""; | ||
288 | return false; | ||
289 | } | ||
290 | |||
291 | function tb_position() { | ||
292 | $("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); | ||
293 | if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 | ||
294 | $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | function tb_parseQuery ( query ) { | ||
299 | var Params = {}; | ||
300 | if ( ! query ) {return Params;}// return empty object | ||
301 | var Pairs = query.split(/[;&]/); | ||
302 | for ( var i = 0; i < Pairs.length; i++ ) { | ||
303 | var KeyVal = Pairs[i].split('='); | ||
304 | if ( ! KeyVal || KeyVal.length != 2 ) {continue;} | ||
305 | var key = unescape( KeyVal[0] ); | ||
306 | var val = unescape( KeyVal[1] ); | ||
307 | val = val.replace(/\+/g, ' '); | ||
308 | Params[key] = val; | ||
309 | } | ||
310 | return Params; | ||
311 | } | ||
312 | |||
313 | function tb_getPageSize(){ | ||
314 | var de = document.documentElement; | ||
315 | var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; | ||
316 | var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; | ||
317 | arrayPageSize = [w,h]; | ||
318 | return arrayPageSize; | ||
319 | } | ||
320 | |||
321 | function tb_detectMacXFF() { | ||
322 | var userAgent = navigator.userAgent.toLowerCase(); | ||
323 | if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { | ||
324 | return true; | ||
325 | } | ||
326 | } | ||
327 | |||
328 | |||
diff --git a/theme/login.tpl b/theme/login.tpl new file mode 100644 index 0000000..f175f59 --- /dev/null +++ b/theme/login.tpl | |||
@@ -0,0 +1,18 @@ | |||
1 | <H1>Four Island Login Page</H1> | ||
2 | |||
3 | <P><CENTER> | ||
4 | <!--BEGIN ERROR--> | ||
5 | <FONT COLOR="RED" SIZE="5">ERROR: <!--ERROR.MSG--></FONT><P> | ||
6 | <!--END ERROR--> | ||
7 | Welcome to the Four Island Login page!<BR> | ||
8 | To post feedback on this site, and also to post on the forums, you must be a member.<BR> | ||
9 | Sadly, currently membership is invitation-only. But hopefully that will change in the near future.<BR> | ||
10 | HOWEVER, you may request membership by email hatkirby@fourisland.com (link on the right).<BR> | ||
11 | A NOTICE TO ALL MEMBERS! Do NOT share your password with anyone! If you misplace your password send an email to hatkirby@fourisland.com (link on the right).<P> | ||
12 | <FORM ACTION="login.php?submit=" METHOD="POST"> | ||
13 | <LABEL FOR="username">Username:</LABEL><INPUT TYPE="text" NAME="username" ID="username"><BR> | ||
14 | <LABEL FOR="password">Password:</LABEL><INPUT TYPE="password" NAME="password" ID="password"><BR> | ||
15 | <!--RECAPTCHA--> | ||
16 | <INPUT TYPE="hidden" NAME="redirect" VALUE="<!--REDIRECT-->"> | ||
17 | <INPUT TYPE="submit"> | ||
18 | </FORM></CENTER> | ||
diff --git a/theme/msg.tpl b/theme/msg.tpl new file mode 100644 index 0000000..25a4f36 --- /dev/null +++ b/theme/msg.tpl | |||
@@ -0,0 +1 @@ | |||
<!--TRACKING--><P><!--MSG--><P><A HREF="javascript:history.back();window.reload();">Back to <!--BACK--></A> | |||
diff --git a/theme/msg2.tpl b/theme/msg2.tpl new file mode 100644 index 0000000..59c723e --- /dev/null +++ b/theme/msg2.tpl | |||
@@ -0,0 +1 @@ | |||
<!--MSG--><P><A HREF="<!--LINK-->"><!--BACK--></A> | |||
diff --git a/theme/poll.tpl b/theme/poll.tpl new file mode 100644 index 0000000..3781e47 --- /dev/null +++ b/theme/poll.tpl | |||
@@ -0,0 +1,30 @@ | |||
1 | <H2><!--QUESTION--></H2> | ||
2 | <P> | ||
3 | <CENTER> | ||
4 | <!--INCLUDE polloftheweek--> | ||
5 | </CENTER> | ||
6 | <P> | ||
7 | <DIV CLASS="bubble"> | ||
8 | <DIV CLASS="rounded"> | ||
9 | <BLOCKQUOTE> | ||
10 | <DIV> | ||
11 | <!--BEGIN COMPLETE--> | ||
12 | <!--COMPLETE.RSS--> | ||
13 | <P> | ||
14 | <!--COMPLETE.OPTION1--> - <!--COMPLETE.CLICKS1--> vote(s)!<BR> | ||
15 | <!--COMPLETE.OPTION2--> - <!--COMPLETE.CLICKS2--> vote(s)!<BR> | ||
16 | <!--COMPLETE.OPTION3--> - <!--COMPLETE.CLICKS3--> vote(s)!<BR> | ||
17 | <!--COMPLETE.OPTION4--> - <!--COMPLETE.CLICKS4--> vote(s)! | ||
18 | </DIV> | ||
19 | </BLOCKQUOTE> | ||
20 | </DIV> | ||
21 | <CITE CLASS="rounded"><STRONG><!--COMPLETE.AUTHOR--></STRONG> on <!--COMPLETE.DATE--></CITE> | ||
22 | <!--END COMPLETE--> | ||
23 | <!--BEGIN INCOMPLETE--> | ||
24 | The results of this poll of the week are pending. Meanwhile, if you haven't voted yet, why not do so? | ||
25 | </DIV> | ||
26 | </BLOCKQUOTE> | ||
27 | </DIV> | ||
28 | <!--END INCOMPLETE--> | ||
29 | </DIV> | ||
30 | </CENTER> | ||
diff --git a/theme/pollIndex.tpl b/theme/pollIndex.tpl new file mode 100644 index 0000000..2111b39 --- /dev/null +++ b/theme/pollIndex.tpl | |||
@@ -0,0 +1,12 @@ | |||
1 | <H2>Poll of the Week</H2> | ||
2 | <P> | ||
3 | <CENTER><!--INCLUDE polloftheweek--></CENTER> | ||
4 | <P> | ||
5 | Welcome to the Poll of the Week! Feel free to vote on these! You can review old ones and also comment on them if | ||
6 | you're logged in using the links below! | ||
7 | <P> | ||
8 | <UL> | ||
9 | <!--BEGIN POLL--> | ||
10 | <LI><A HREF="/poll/<!--POLL.ID-->.php"><!--POLL.QUESTION--></A> - Week of <!--POLL.WEEK--></LI> | ||
11 | <!--END POLL--> | ||
12 | </UL> | ||
diff --git a/theme/polloftheweek.tpl b/theme/polloftheweek.tpl new file mode 100644 index 0000000..13a7dce --- /dev/null +++ b/theme/polloftheweek.tpl | |||
@@ -0,0 +1,59 @@ | |||
1 | <!--BEGIN FORM--> | ||
2 | <FORM ACTION="/polloftheweek.php?potw=" METHOD="POST" ID="pollOfTheWeek"> | ||
3 | <TABLE BORDER=1 STYLE="background: #d3d3d3; font-size: 12px" ALIGN="center"> | ||
4 | <TR> | ||
5 | <TD WIDTH="100%" COLSPAN=2><!--QUESTION--></TD> | ||
6 | </TR> | ||
7 | |||
8 | <TR> | ||
9 | <TD> | ||
10 | <INPUT TYPE="radio" NAME="options" VALUE="1" ID="option1"> | ||
11 | <LABEL FOR="option1"><!--OPTION1--></LABEL> | ||
12 | </TD> | ||
13 | |||
14 | <TD> | ||
15 | <INPUT TYPE="radio" NAME="options" VALUE="2" ID="option2"> | ||
16 | <LABEL FOR="option2"><!--OPTION2--></LABEL> | ||
17 | </TD> | ||
18 | </TR> | ||
19 | |||
20 | <TR> | ||
21 | <TD> | ||
22 | <INPUT TYPE="radio" NAME="options" VALUE="3" ID="option3"> | ||
23 | <LABEL FOR="option3"><!--OPTION3--></LABEL> | ||
24 | </TD> | ||
25 | |||
26 | <TD> | ||
27 | <INPUT TYPE="radio" NAME="options" VALUE="4" ID="option4"> | ||
28 | <LABEL FOR="option4"><!--OPTION4--></LABEL> | ||
29 | </TD> | ||
30 | </TR> | ||
31 | |||
32 | <TR> | ||
33 | <TD COLSPAN=2> | ||
34 | <CENTER> | ||
35 | <INPUT TYPE="submit" VALUE="Vote!"> | ||
36 | </CENTER> | ||
37 | </TD> | ||
38 | </TR> | ||
39 | </TABLE> | ||
40 | </FORM> | ||
41 | <!--END FORM--> | ||
42 | |||
43 | <!--BEGIN DISPLAY--> | ||
44 | <TABLE BORDER=1 STYLE="background: #d3d3d3; font-size: 12px" ALIGN="center" ID="pollOfTheWeek"> | ||
45 | <TR> | ||
46 | <TD WIDTH="100%" COLSPAN=2><!--QUESTION--></TD> | ||
47 | </TR> | ||
48 | |||
49 | <TR> | ||
50 | <TD>%<!--PERCENT1--><IMG SRC="/theme/images/blue.PNG" WIDTH="<!--PERCENT1-->" HEIGHT="8" ALT="%<!--PERCENT1-->"><BR><!--OPTION1--></TD> | ||
51 | <TD>%<!--PERCENT2--><IMG SRC="/theme/images/blue.PNG" WIDTH="<!--PERCENT2-->" HEIGHT="8" ALT="%<!--PERCENT2-->"><BR><!--OPTION2--></TD> | ||
52 | </TR> | ||
53 | |||
54 | <TR> | ||
55 | <TD>%<!--PERCENT3--><IMG SRC="/theme/images/blue.PNG" WIDTH="<!--PERCENT3-->" HEIGHT="8" ALT="%<!--PERCENT3-->"><BR><!--OPTION3--></TD> | ||
56 | <TD>%<!--PERCENT4--><IMG SRC="/theme/images/blue.PNG" WIDTH="<!--PERCENT4-->" HEIGHT="8" ALT="%<!--PERCENT4-->"><BR><!--OPTION4--></TD> | ||
57 | </TR> | ||
58 | </TABLE> | ||
59 | <!--END DISPLAY--> | ||
diff --git a/theme/post.tpl b/theme/post.tpl new file mode 100644 index 0000000..91bf4e9 --- /dev/null +++ b/theme/post.tpl | |||
@@ -0,0 +1,66 @@ | |||
1 | <!--BEGIN INTERNAL--> | ||
2 | <!--BEGIN BACK--><SPAN CLASS="back-post">« <A HREF="/blog/<!--BACK.CODED-->/"><!--BACK.TITLE--></A></SPAN><!--END BACK--> | ||
3 | <!--BEGIN NEXT--><SPAN CLASS="next-post"><A HREF="/blog/<!--NEXT.CODED-->/"><!--NEXT.TITLE--></A> »</SPAN><!--END NEXT--> | ||
4 | <!--END INTERNAL--> | ||
5 | |||
6 | <!--BEGIN POST--> | ||
7 | <DIV CLASS="post vevent" ID="post-<!--POST.ID-->"> | ||
8 | <DIV CLASS="post-date-<!--POST.YEARID-->"> | ||
9 | <ABBR CLASS="dtstart" TITLE="<!--POST.DATE-->"> | ||
10 | <SPAN CLASS="post-month"><!--POST.MONTH--></SPAN> | ||
11 | <SPAN CLASS="post-day"><!--POST.DAY--></SPAN> | ||
12 | </ABBR> | ||
13 | </DIV> | ||
14 | |||
15 | <DIV CLASS="post-title"> | ||
16 | <H2> | ||
17 | <!--BEGIN EXTERNAL--><A CLASS="url" HREF="/blog/<!--POST.CODED-->/" REL="bookmark" TITLE="Permalink for <!--POST.TITLE-->"><!--END EXTERNAL--> | ||
18 | <SPAN CLASS="summary"><!--POST.TITLE--></SPAN> | ||
19 | <!--BEGIN EXTERNAL--></A><!--END EXTERNAL--> | ||
20 | </H2> | ||
21 | |||
22 | <SPAN CLASS="post-cat-<!--POST.AUTHOR--> category"> | ||
23 | <A HREF="/blog/author/<!--POST.AUTHOR-->.php"><!--POST.AUTHOR--></A> | ||
24 | </SPAN> | ||
25 | |||
26 | <SPAN CLASS="post-tag-3 category"> | ||
27 | <A CLASS="noVisit" HREF="/blog/tag/<!--POST.TAG1-->.php" REL="tag" TITLE="<!--POST.TAG1-->"><!--POST.TAG1--></A> | ||
28 | <A CLASS="noVisit" HREF="/blog/tag/<!--POST.TAG2-->.php" REL="tag" TITLE="<!--POST.TAG2-->"><!--POST.TAG2--></A> | ||
29 | <A CLASS="noVisit" HREF="/blog/tag/<!--POST.TAG3-->.php" REL="tag" TITLE="<!--POST.TAG3-->"><!--POST.TAG3--></A> | ||
30 | </SPAN> | ||
31 | |||
32 | <!--BEGIN EXTERNAL--> | ||
33 | <SPAN CLASS="post-comment<!--POST.PLURALCOMMENT-->"> | ||
34 | <A CLASS="noVisit" HREF="/blog/<!--POST.CODED-->/#comments"><!--POST.COMMENTS--> »</A> | ||
35 | </SPAN> | ||
36 | <!--END EXTERNAL--><!--BEGIN INTERNAL--> | ||
37 | <SPAN CLASS="mini-add-comment"> | ||
38 | <A CLASS="noVisit" HREF="/blog/<!--POST.CODED-->/#comments">Add Comment »</A> | ||
39 | </SPAN> | ||
40 | <!--END INTERNAL--> | ||
41 | </DIV> | ||
42 | |||
43 | <DIV CLASS="entry description"> | ||
44 | <DIV CLASS="bubble"> | ||
45 | <DIV CLASS="rounded"> | ||
46 | <BLOCKQUOTE> | ||
47 | <DIV> | ||
48 | <!--POST.TEXT--> | ||
49 | |||
50 | <!--BEGIN POST.EXCERPT--> | ||
51 | <P>[....] <A HREF="/blog/<!--POST.CODED-->/">Click here to read the rest of this post</A>.</P> | ||
52 | <!--END POST.EXCERPT--> | ||
53 | </DIV> | ||
54 | </BLOCKQUOTE> | ||
55 | </DIV> | ||
56 | <CITE CLASS="rounded"><STRONG><!--POST.AUTHOR--></STRONG> on <!--POST.DATE--></CITE> | ||
57 | |||
58 | <SPAN STYLE="float: right"> | ||
59 | <A HREF="/vote.php?id=<!--POST.ID-->&dir=plus" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_up.png"></A> | ||
60 | <BIG><!--POST.RATING--></BIG> | ||
61 | <A HREF="/vote.php?id=<!--POST.ID-->&dir=minus" REL="nofollow"><IMG SRC="/theme/images/icons/thumb_down.png"></A> | ||
62 | </SPAN> | ||
63 | </DIV> | ||
64 | </DIV> | ||
65 | </DIV> | ||
66 | <!--END POST--> | ||
diff --git a/theme/postLogin.tpl b/theme/postLogin.tpl new file mode 100644 index 0000000..31dce48 --- /dev/null +++ b/theme/postLogin.tpl | |||
@@ -0,0 +1,16 @@ | |||
1 | <H1>Four Island Login Page</H1> | ||
2 | |||
3 | <P> | ||
4 | <CENTER>Congradulations, you've logged in!<BR> | ||
5 | You can now: | ||
6 | <UL> | ||
7 | <LI>Comment on the blog posts</LI> | ||
8 | <LI>Comment on Projects</LI> | ||
9 | <LI>Comment on Flash Games</LI> | ||
10 | <LI>Comment on a whole lot of other things I can't remember right now</LI> | ||
11 | <LI>Update your userpage</LI> | ||
12 | <LI>More soon...</LI> | ||
13 | </UL> | ||
14 | <A HREF="<!--REDIRECT-->">Click here to return to the page you were on.</A> | ||
15 | </CENTER> | ||
16 | </P> | ||
diff --git a/theme/quotes/add.tpl b/theme/quotes/add.tpl new file mode 100644 index 0000000..4073277 --- /dev/null +++ b/theme/quotes/add.tpl | |||
@@ -0,0 +1,17 @@ | |||
1 | <DIV ID="add_all"> | ||
2 | <DIV ID="add_title">Contribute</DIV> | ||
3 | |||
4 | <!--BEGIN SUBMITTED--> | ||
5 | <DIV ID="add_outputmsg"> | ||
6 | <DIV ID="add_outputmsg_top">The quote you have submitted is:</DIV> | ||
7 | <DIV ID="add_outputmsg_quote"><!--SUBMITTED.QUOTE--></DIV> | ||
8 | <DIV ID="add_outputmsg_bottom">If this is not the quote you have entered, please contact the administrator and explain your problem. Also, there is no need to press the submit button again. You're quote has already been sent.</DIV> | ||
9 | </DIV> | ||
10 | <!--END SUBMITTED--> | ||
11 | |||
12 | <FORM ACTION="/quotes/add.php?submit=" METHOD="POST"> | ||
13 | <TEXTAREA COLS="80" ROWS="5" NAME="rash_quote" ID="add_quote"></TEXTAREA><BR> | ||
14 | <INPUT TYPE="submit" VALUE="Add Quote!" ID="add_submit"> | ||
15 | <INPUT TYPE="reset" VALUE="Reset" ID="add_reset"> | ||
16 | </FORM> | ||
17 | </DIV> | ||
diff --git a/theme/quotes/add_news.tpl b/theme/quotes/add_news.tpl new file mode 100644 index 0000000..3c81474 --- /dev/null +++ b/theme/quotes/add_news.tpl | |||
@@ -0,0 +1,8 @@ | |||
1 | <DIV ID="admin_add-news_all"> | ||
2 | <DIV ID="admin_add-news_title">Add News</DIV> | ||
3 | |||
4 | <FORM METHOD="POST" ACTION="/quotes/add_news.php?submit="> | ||
5 | <TEXTAREA COLS="80" ROWS="5" NAME="news" ID="add_news_news"></TEXTAREA><BR> | ||
6 | <INPUT TYPE="submit" VALUE="Add News" ID="add_news"> | ||
7 | </FORM> | ||
8 | </DIV> | ||
diff --git a/theme/quotes/browse.tpl b/theme/quotes/browse.tpl new file mode 100644 index 0000000..d35abfe --- /dev/null +++ b/theme/quotes/browse.tpl | |||
@@ -0,0 +1,25 @@ | |||
1 | <DIV ID="quote_all"> | ||
2 | <!--BEGIN PAGENUMBERS--> | ||
3 | <!--INCLUDE quotes/pagenumbers--> | ||
4 | <!--END PAGENUMBERS--> | ||
5 | |||
6 | <DIV ID="quote_origin-name"><!--ORIGIN--></DIV> | ||
7 | |||
8 | <!--BEGIN QUOTES--> | ||
9 | <DIV CLASS="quotes_whole"> | ||
10 | <DIV CLASS="quote_option-bar"> | ||
11 | <A HREF="/quotes/<!--QUOTES.NUMBER-->.php" CLASS="quote_number">#<!--QUOTES.NUMBER--></A> | ||
12 | <A HREF="/quotes/vote.php?id=<!--QUOTES.NUMBER-->&dir=plus" CLASS="quote_plus">+</A> | ||
13 | <SPAN CLASS="quote_rating">(<!--QUOTES.RATING-->)</SPAN> | ||
14 | <A HREF="/quotes/vote.php?id=<!--QUOTES.NUMBER-->&dir=minus" CLASS="quote_minus">-</A> | ||
15 | <A HREF="/quotes/flag.php?id=<!--QUOTES.NUMBER-->" CLASS="quote_flag">[X]</A> | ||
16 | </DIV> | ||
17 | |||
18 | <DIV CLASS="quote_quote"><!--QUOTES.QUOTE--></DIV> | ||
19 | </DIV> | ||
20 | <!--END QUOTES--> | ||
21 | |||
22 | <!--BEGIN PAGENUMBERS--> | ||
23 | <!--INCLUDE quotes/pagenumbers--> | ||
24 | <!--END PAGENUMBERS--> | ||
25 | </DIV> | ||
diff --git a/theme/quotes/home.tpl b/theme/quotes/home.tpl new file mode 100644 index 0000000..7e8c10f --- /dev/null +++ b/theme/quotes/home.tpl | |||
@@ -0,0 +1,10 @@ | |||
1 | <DIV ID="home_all"> | ||
2 | <H2>Four Island Quotes DB</H2> | ||
3 | |||
4 | <DIV ID="home_news"> | ||
5 | <!--BEGIN NEWS--> | ||
6 | <DIV CLASS="home_news_date"><!--NEWS.DATE--></DIV> | ||
7 | <DIV CLASS="home_news_news"><!--NEWS.POST--></DIV><P> | ||
8 | <!--END NEWS--> | ||
9 | </DIV> | ||
10 | </DIV> | ||
diff --git a/theme/quotes/pagenumbers.tpl b/theme/quotes/pagenumbers.tpl new file mode 100644 index 0000000..3171c10 --- /dev/null +++ b/theme/quotes/pagenumbers.tpl | |||
@@ -0,0 +1,15 @@ | |||
1 | <DIV CLASS="quote_pagenums"> | ||
2 | <A HREF="/quotes/<!--LORIGIN-->.php">First</A> | ||
3 | <A HREF="/quotes/<!--LORIGIN-->.php?page=<!--MINUSTEN-->">-10</A> | ||
4 | <!--BDDD--> | ||
5 | <!--BEGIN BPAGES--> | ||
6 | <A HREF="/quotes/<!--LORIGIN-->.php?page=<!--BPAGES.PAGENUM-->"><!--BPAGES.PAGENUM--></A> | ||
7 | <!--END BPAGES--> | ||
8 | <!--CURPAGE--> | ||
9 | <!--BEGIN APAGES--> | ||
10 | <A HREF="/quotes/<!--LORIGIN-->.php?page=<!--APAGES.PAGENUM-->"><!--APAGES.PAGENUM--></A> | ||
11 | <!--END APAGES--> | ||
12 | <!--ADDD--> | ||
13 | <A HREF="/quotes/<!--LORIGIN-->.php?page=<!--PLUSTEN-->">+10</A> | ||
14 | <A HREF="/quotes/<!--LORIGIN-->.php?page=<!--LASTPAGE-->">Last</A> | ||
15 | </DIV> | ||
diff --git a/theme/quotes/search.tpl b/theme/quotes/search.tpl new file mode 100644 index 0000000..491c861 --- /dev/null +++ b/theme/quotes/search.tpl | |||
@@ -0,0 +1,19 @@ | |||
1 | <DIV CLASS="search_all"> | ||
2 | <DIV ID="search_title">Search</DIV> | ||
3 | |||
4 | <FORM METHOD="POST" ACTION="/quotes/search.php?fetch="> | ||
5 | <INPUT TYPE="text" NAME="search" SIZE="28" ID="search_query-box"> | ||
6 | <INPUT TYPE="submit" NAME="submit" ID="search_submit-button"><BR> | ||
7 | Sort: <SELECT NAME="sortby" SIZE="1" ID="search_sortby-dropdown"> | ||
8 | <OPTION SELECTED>Rating</OPTION> | ||
9 | <OPTION>ID</OPTION> | ||
10 | </SELECT> | ||
11 | How many: <SELECT NAME="number" SIZE="1" ID="search_limit-dropdown"> | ||
12 | <OPTION SELECTED>10</OPTION> | ||
13 | <OPTION>25</OPTION> | ||
14 | <OPTION>50</OPTION> | ||
15 | <OPTION>75</OPTION> | ||
16 | <OPTION>100</OPTION> | ||
17 | </SELECT> | ||
18 | </FORM> | ||
19 | </DIV> | ||
diff --git a/theme/related.tpl b/theme/related.tpl new file mode 100644 index 0000000..c070359 --- /dev/null +++ b/theme/related.tpl | |||
@@ -0,0 +1,12 @@ | |||
1 | <DIV CLASS="bubble"> | ||
2 | <DIV CLASS="rounded"> | ||
3 | <BLOCKQUOTE> | ||
4 | <DIV> | ||
5 | <!--BEGIN POST--> | ||
6 | <A HREF="/blog/<!--POST.CODED-->/"><!--POST.TITLE--></A> by <A HREF="/blog/author/<!--POST.AUTHOR-->.php"><!--POST.AUTHOR--></A> on <!--POST.DATE--><BR> | ||
7 | <!--END POST--> | ||
8 | </DIV> | ||
9 | </BLOCKQUOTE> | ||
10 | </DIV> | ||
11 | <CITE CLASS="rounded"><STRONG>Theoretically Related Posts</STRONG></CITE> | ||
12 | </DIV> | ||
diff --git a/theme/welcome.tpl b/theme/welcome.tpl new file mode 100644 index 0000000..7872c6f --- /dev/null +++ b/theme/welcome.tpl | |||
@@ -0,0 +1,5 @@ | |||
1 | <P><H1>Welcome to Four Island</H1></P> | ||
2 | <DIV STYLE="font-size: 16px">You've reached Four Island, a fun place with:<UL> | ||
3 | <LI>a blog</LI><LI>a fourm</LI><LI>a wiki</LI><LI>many projects<LI>and a quotes database!</LI></UL> | ||
4 | I hope you enjoy your time on Four Island!<P> | ||
5 | <P>....Don't worry, I'll eventually think of something to actually put here :) | ||
diff --git a/theme/wiki/create.tpl b/theme/wiki/create.tpl new file mode 100644 index 0000000..ecd2d6b --- /dev/null +++ b/theme/wiki/create.tpl | |||
@@ -0,0 +1,7 @@ | |||
1 | <H2>Create a page</H2><P> | ||
2 | |||
3 | <FORM ACTION="./?action=submit&submit=create" METHOD="POST"> | ||
4 | Page Title: <INPUT TYPE="text" NAME="title"><BR> | ||
5 | <TEXTAREA NAME="text" COLS="80" ROWS="20"></TEXTAREA><P> | ||
6 | <INPUT TYPE="submit" VALUE="Create page"> | ||
7 | </FORM> | ||
diff --git a/theme/wiki/edit.tpl b/theme/wiki/edit.tpl new file mode 100644 index 0000000..12d2deb --- /dev/null +++ b/theme/wiki/edit.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <H2>Edit <!--PAGENAME--></H2><P> | ||
2 | |||
3 | <FORM ACTION="./?action=submit&submit=edit" METHOD="POST"> | ||
4 | <TEXTAREA NAME="text" COLS="80" ROWS="20"><!--PAGETEXT--></TEXTAREA><P> | ||
5 | <INPUT TYPE="submit" VALUE="Edit page"> | ||
6 | </FORM> | ||
diff --git a/theme/wiki/index.tpl b/theme/wiki/index.tpl new file mode 100644 index 0000000..ed4e513 --- /dev/null +++ b/theme/wiki/index.tpl | |||
@@ -0,0 +1,6 @@ | |||
1 | <!--BEGIN LETTER--> | ||
2 | <H3 STYLE="clear: both; display: block; margin-bottom: 0"><!--LETTER.TITLE--></H2> | ||
3 | <!--BEGIN LETTER.PAGE--> | ||
4 | <SMALL><SPAN STYLE="margin-left: 50"><!--LETTER.PAGE.DATE--> | <A HREF="/wiki/<!--LETTER.PAGE.CODED-->"><!--LETTER.PAGE.TITLE--></A></SPAN></SMALL><BR> | ||
5 | <!--END LETTER.PAGE--> | ||
6 | <!--END LETTER--> | ||
diff --git a/theme/wiki/page.tpl b/theme/wiki/page.tpl new file mode 100644 index 0000000..b021e95 --- /dev/null +++ b/theme/wiki/page.tpl | |||
@@ -0,0 +1,3 @@ | |||
1 | <H2><!--TITLE--></H2><P> | ||
2 | |||
3 | <!--CONTENT--> | ||
diff --git a/thumb.php b/thumb.php new file mode 100644 index 0000000..ba9c645 --- /dev/null +++ b/thumb.php | |||
@@ -0,0 +1,147 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 thumb.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | require('headerproc.php'); | ||
22 | |||
23 | if ($_GET['mode'] != 'scalegif') | ||
24 | { | ||
25 | header('Content-type: image/png'); | ||
26 | } else { | ||
27 | header('Content-type: image/gif'); | ||
28 | } | ||
29 | |||
30 | $filename = $_GET['file']; | ||
31 | |||
32 | switch ($_GET['mode']) | ||
33 | { | ||
34 | case 'scale': | ||
35 | $mode = 'scale'; | ||
36 | $side = $_GET['side']; | ||
37 | $by = $_GET['by']; | ||
38 | if (file_exists($filename)) { | ||
39 | $im2 = imagecreatefrompng($filename); | ||
40 | list($width, $height, $type, $attr) = getimagesize($filename); | ||
41 | if ($side == 0) { | ||
42 | if ($by < $width) | ||
43 | { | ||
44 | $width2 = $by; | ||
45 | } else { | ||
46 | $width2 = $width; | ||
47 | } | ||
48 | } else { | ||
49 | if ($by < $height) | ||
50 | { | ||
51 | $width2 = ($width/100)*($height/$by*100); | ||
52 | } else { | ||
53 | $width2 = $width; | ||
54 | } | ||
55 | } | ||
56 | if ($side == 1) { | ||
57 | if ($by < $height) | ||
58 | { | ||
59 | $height2 = $by; | ||
60 | } else { | ||
61 | $height2 = $height; | ||
62 | } | ||
63 | } else { | ||
64 | if ($by < $width) | ||
65 | { | ||
66 | $height2 = ($height/100)*($by/$width*100); | ||
67 | } else { | ||
68 | $height2 = $height; | ||
69 | } | ||
70 | } | ||
71 | $im = imagecreatetruecolor($width2,$height2); | ||
72 | $b = imagecopyresized($im,$im2,0,0,0,0,$width2,$height2,$width,$height); | ||
73 | imagepng($im); | ||
74 | imagedestroy($im); | ||
75 | exit; | ||
76 | } | ||
77 | case 'scalegif': | ||
78 | $mode = 'scalegif'; | ||
79 | $side = $_GET['side']; | ||
80 | $by = $_GET['by']; | ||
81 | if (file_exists($filename)) { | ||
82 | $im2 = imagecreatefromgif($filename); | ||
83 | list($width, $height, $type, $attr) = getimagesize($filename); | ||
84 | if ($side == 0) { | ||
85 | if ($by < $width) | ||
86 | { | ||
87 | $width2 = $by; | ||
88 | } else { | ||
89 | $width2 = $width; | ||
90 | } | ||
91 | } else { | ||
92 | if ($by < $height) | ||
93 | { | ||
94 | $width2 = ($width/100)*($height/$by*100); | ||
95 | } else { | ||
96 | $width2 = $width; | ||
97 | } | ||
98 | } | ||
99 | if ($side == 1) { | ||
100 | if ($by < $height) | ||
101 | { | ||
102 | $height2 = $by; | ||
103 | } else { | ||
104 | $height2 = $height; | ||
105 | } | ||
106 | } else { | ||
107 | if ($by < $width) | ||
108 | { | ||
109 | $height2 = ($height/100)*($by/$width*100); | ||
110 | } else { | ||
111 | $height2 = $height; | ||
112 | } | ||
113 | } | ||
114 | $im = imagecreatetruecolor($width2,$height2); | ||
115 | $b = imagecopyresized($im,$im2,0,0,0,0,$width2,$height2,$width,$height); | ||
116 | imagegif($im); | ||
117 | imagedestroy($im); | ||
118 | exit; | ||
119 | } | ||
120 | case 'percent': | ||
121 | $mode = 'percent'; | ||
122 | $by = $_GET['by']; | ||
123 | if (file_exists($filename)) { | ||
124 | $im2 = imagecreatefrompng($filename); | ||
125 | list($width, $height, $type, $attr) = getimagesize($filename); | ||
126 | $width2 = ($width/100)*$by; | ||
127 | $height2 = ($height/100)*$by; | ||
128 | $im = imagecreatetruecolor($width2,$height2); | ||
129 | $b = imagecopyresized($im,$im2,0,0,0,0,$width2,$height2,$width,$height); | ||
130 | imagepng($im); | ||
131 | imagedestroy($im); | ||
132 | exit; | ||
133 | } | ||
134 | default: | ||
135 | $string = 'An error was encountered.'; | ||
136 | $im2 = imagecreatefrompng("images/blue.png"); | ||
137 | $im = imagecreate(200,30); | ||
138 | $b = imagecopyresized($im,$im2,0,0,0,0,400,400,1,1); | ||
139 | $orange = imagecolorallocate($im, 220, 210, 60); | ||
140 | $px = (imagesx($im) - 7.5 * strlen($string)) / 2; | ||
141 | imagestring($im, 3, $px, 9, $string, $orange); | ||
142 | imagepng($im); | ||
143 | imagedestroy($im); | ||
144 | exit; | ||
145 | } | ||
146 | |||
147 | ?> | ||
diff --git a/xmlrpc.php b/xmlrpc.php new file mode 100644 index 0000000..2c634d3 --- /dev/null +++ b/xmlrpc.php | |||
@@ -0,0 +1,101 @@ | |||
1 | <?php | ||
2 | /* | ||
3 | 444444444 | ||
4 | 4::::::::4 | ||
5 | 4:::::::::4 | ||
6 | 4::::44::::4 | ||
7 | 4::::4 4::::4 Four Island | ||
8 | 4::::4 4::::4 | ||
9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
10 | 4::::444444::::444 | ||
11 | 4::::::::::::::::4 xmlrpc.php | ||
12 | 4444444444:::::444 | ||
13 | 4::::4 Please do not use, reproduce or steal the | ||
14 | 4::::4 contents of this file without explicit | ||
15 | 4::::4 permission from Hatkirby. | ||
16 | 44::::::44 | ||
17 | 4::::::::4 | ||
18 | 4444444444 | ||
19 | */ | ||
20 | |||
21 | require('headerproc.php'); | ||
22 | |||
23 | include('../security/config.php'); | ||
24 | include('includes/db.php'); | ||
25 | include('includes/xmlrpc/xmlrpc.inc'); | ||
26 | include('includes/xmlrpc/xmlrpcs.inc'); | ||
27 | include('includes/functions.php'); | ||
28 | |||
29 | function ping($xmlrpcmsg) | ||
30 | { | ||
31 | $from = $xmlrpcmsg->getParam(0)->scalarVal(); | ||
32 | $to = $xmlrpcmsg->getParam(1)->scalarVal(); | ||
33 | |||
34 | if (preg_match('/^http:\/\/w?w?w?\.?fourisland\.com\/blog\/([-a-z0-9]+)\/$/',$to)) | ||
35 | { | ||
36 | $slug = preg_replace('/^http:\/\/w?w?w?\.?fourisland\.com\/blog\/([-a-z0-9]+)\/$/','$1',$to); | ||
37 | |||
38 | $getpost = "SELECT * FROM updates WHERE slug = \"" . $slug . "\""; | ||
39 | $getpost2 = mysql_query($getpost); | ||
40 | $getpost3 = mysql_fetch_array($getpost2); | ||
41 | |||
42 | if ($getpost3['slug'] == $slug) | ||
43 | { | ||
44 | |||
45 | $c = curl_init(); | ||
46 | curl_setopt($c, CURLOPT_URL, $from); | ||
47 | curl_setopt($c, CURLOPT_RETURNTRANSFER, true); | ||
48 | curl_setopt($c, CURLOPT_HEADER, false); | ||
49 | $page_data = curl_exec($c); | ||
50 | curl_close($c); | ||
51 | |||
52 | if (stripos($page_data,$to) !== FALSE) | ||
53 | { | ||
54 | if (preg_match('/<TITLE>([^>]+)<\/TITLE>/i',$page_data,$matches)) | ||
55 | { | ||
56 | $title = $matches[1]; | ||
57 | } else { | ||
58 | $title = $from; | ||
59 | } | ||
60 | |||
61 | $text = substr($page_data,(stripos($page_data,$to)-300),700); | ||
62 | $text = strip_tags($text); | ||
63 | $text = str_replace("\n",' ',$text); | ||
64 | |||
65 | $commentText = "[url=" . $from . "]" . $title . "[/url]\n\n[....] " . $text . " [....]"; | ||
66 | |||
67 | $getping = "SELECT * FROM comments WHERE page_id = \"updates-" . $getpost3['id'] . "\" AND comment = \"" . addslashes($commentText) . "\""; | ||
68 | $getping2 = mysql_query($getping); | ||
69 | $getping3 = mysql_fetch_array($getping2); | ||
70 | |||
71 | if ($getping3['comment'] == $commentText) | ||
72 | { | ||
73 | return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); | ||
74 | } else { | ||
75 | $insping = "INSERT INTO comments (page_id,username,comment) VALUES (\"updates-" . $getpost3['id'] . "\",\"Pingback\",\"" . $commentText . "\")"; | ||
76 | $insping2 = mysql_query($insping); | ||
77 | recalcPop($getpost3['id']); | ||
78 | |||
79 | return new xmlrpcresp(new xmlrpcval("YAY! Your Pingback has been registered!", "string")); | ||
80 | } | ||
81 | } else { | ||
82 | return new xmlrpcresp(0, 17, "Source uri does have link to target uri"); | ||
83 | } | ||
84 | } else { | ||
85 | return new xmlrpcresp(0, 32, "Target uri does not exist"); | ||
86 | } | ||
87 | } else { | ||
88 | return new xmlrpcresp(0, 33, "Target uri cannot be used as target"); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | function rr($xmlrpcmsg) | ||
93 | { | ||
94 | return new xmlrpcresp(new xmlrpcval(0, "int")); | ||
95 | } | ||
96 | |||
97 | $s = new xmlrpc_server(array( | ||
98 | "pingback.ping" => array("function" => "ping"), | ||
99 | "InstaDisc.checkRegistration" => array("function" => "rr"))); | ||
100 | |||
101 | ?> | ||