diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2009-08-09 09:14:58 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2009-08-09 09:14:58 -0400 |
commit | 893957c41481a0cd5eb624096337762ffa54ff28 (patch) | |
tree | 09d2487f8add5a6281e3482a471abf21faa4f819 /includes | |
parent | d27a3784c81f0c582e43655509e806978b7e65e4 (diff) | |
download | fourisland-893957c41481a0cd5eb624096337762ffa54ff28.tar.gz fourisland-893957c41481a0cd5eb624096337762ffa54ff28.tar.bz2 fourisland-893957c41481a0cd5eb624096337762ffa54ff28.zip |
Created layout 7
The following changes were also made in this revision: * All HTML was changed to XHTML and a !DOCTYPE was included to reflect this * Rewrote quotes tracking system to be much less complicated and actually working * Changed quotes rendering to look more like Chirpy than Rash * Fixed comment textarea bug * Rewrote a ton of CSS so it's not as bloated * Added a JavaScript confirmation when deleting a comment * AJAXified voting on the POTW * AJAXified voting and flagging quotes * AJAXified commenting * AJAXified voting on posts * Added DateFinder back after it was accidentally deleted in Layout 4.5 The following database changes must be performed as soon as possible: * Fix title of NO <!DOCTYPE> post (the < is missing the semicolon) * Restore post Frasty Tha Snaman from a backup * Reset "flag" field of all rows in "rash_quotes" to 0 * Remove the "vote" and "flag" columns of "rash_tracking" * Rename the "quote_id" column of "rash_tracking" to "vote" The following external code changes must also be performed as soon as possible: * Add the following line to the end of the // Four Island block in The Fourm's functions.php: require('/svr/www/hatkirby/fourisland/main/includes/specialdates.php');
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/bbcode.php | 66 | ||||
-rwxr-xr-x | includes/comments.php | 6 | ||||
-rwxr-xr-x | includes/footer.php | 322 | ||||
-rwxr-xr-x | includes/functions.php | 48 | ||||
-rwxr-xr-x | includes/header.php | 47 | ||||
-rwxr-xr-x | includes/smilies.php | 2 | ||||
-rwxr-xr-x | includes/specialdates.php | 52 |
7 files changed, 281 insertions, 262 deletions
diff --git a/includes/bbcode.php b/includes/bbcode.php index af0b1a4..b116e7a 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php | |||
@@ -30,30 +30,33 @@ class BBCode | |||
30 | 30 | ||
31 | function init() | 31 | function init() |
32 | { | 32 | { |
33 | $this->bbcodes['b'] = '<B>{CONTENT}</B>'; | 33 | $this->bbcodes['b'] = '<strong>{CONTENT}</strong>'; |
34 | $this->bbcodes['i'] = '<I>{CONTENT}</I>'; | 34 | $this->bbcodes['i'] = '<em>{CONTENT}</em>'; |
35 | $this->bbcodes['u'] = '<U>{CONTENT}</U>'; | 35 | $this->bbcodes['u'] = '<u>{CONTENT}</u>'; |
36 | $this->bbcodes['url'] = '<A HREF="{CONTENT}">{CONTENT}</A>'; | 36 | $this->bbcodes['url'] = '<a href="{CONTENT}">{CONTENT}</a>'; |
37 | $this->bbcodes2['url'] = '<A HREF="{PARAM}">{CONTENT}</A>'; | 37 | $this->bbcodes2['url'] = '<a href="{PARAM}">{CONTENT}</a>'; |
38 | $this->bbcodes['img'] = '<IMG SRC="{CONTENT}" ALT="Image">'; | 38 | $this->bbcodes['img'] = '<img src="{CONTENT}" alt="Image" />'; |
39 | $this->bbcodes2['img'] = '<IMG SRC="{CONTENT}" ALT="{PARAM}" TITLE="{PARAM}">'; | 39 | $this->bbcodes2['img'] = '<img src="{CONTENT}" alt="{PARAM}" title="{PARAM}" />'; |
40 | $this->bbcodes['big'] = '<BIG>{CONTENT}</BIG>'; | 40 | $this->bbcodes['big'] = '<big>{CONTENT}</big>'; |
41 | $this->bbcodes['small'] = '<SMALL>{CONTENT}</SMALL>'; | 41 | $this->bbcodes['small'] = '<small>{CONTENT}</small>'; |
42 | $this->bbcodes['ul'] = '<UL>{CONTENT}</UL>'; | 42 | $this->bbcodes['ul'] = '<ul>{CONTENT}</ul>'; |
43 | $this->bbcodes['ol'] = '<OL>{CONTENT}</OL>'; | 43 | $this->bbcodes['ol'] = '<ol>{CONTENT}</ol>'; |
44 | $this->bbcodes['li'] = '<LI>{CONTENT}</LI>'; | 44 | $this->bbcodes['li'] = '<li>{CONTENT}</li>'; |
45 | $this->bbcodes['code'] = '<CODE>{CONTENT}</CODE>'; | 45 | $this->bbcodes['code'] = '<code>{CONTENT}</code>'; |
46 | $this->bbcodes['pre'] = '<P><DIV CLASS="autosize"><DIV CLASS="bubble"><DIV CLASS="bquote"><BLOCKQUOTE><DIV><CODE>{CONTENT}</CODE></DIV></BLOCKQUOTE></DIV></DIV></DIV><DIV CLASS="cleardiv"></DIV>'; | 46 | $this->bbcodes['pre'] = '<pre><code>{CONTENT}</code></pre>'; |
47 | $this->bbcodes2['blog'] = '<A HREF="/blog/{PARAM}/">{CONTENT}</A>'; | 47 | $this->bbcodes['pref'] = '<pre>{CONTENT}</pre>'; |
48 | $this->bbcodes2['quote'] = '<A HREF="/quotes/{PARAM}.php">{CONTENT}</A>'; | 48 | $this->bbcodes2['blog'] = '<a href="/blog/{PARAM}/">{CONTENT}</a>'; |
49 | $this->bbcodes['ins'] = '<INS>{CONTENT}</INS>'; | 49 | $this->bbcodes['quote'] = '<a href="/quotes/{CONTENT}.php">#{CONTENT}</a>'; |
50 | $this->bbcodes['del'] = '<DEL>{CONTENT}</DEL>'; | 50 | $this->bbcodes2['quote'] = '<a href="/quotes/{PARAM}.php">{CONTENT}</a>'; |
51 | $this->bbcodes['bquote'] = '<P><DIV CLASS="autosize"><DIV CLASS="bubble"><DIV CLASS="bquote"><BLOCKQUOTE><DIV>{CONTENT}</DIV></BLOCKQUOTE></DIV><CITE><STRONG>Anonymous</STRONG></CITE></DIV></DIV><DIV CLASS="cleardiv"></DIV>'; | 51 | $this->bbcodes['ins'] = '<ins>{CONTENT}</ins>'; |
52 | $this->bbcodes2['bquote'] = '<P><DIV CLASS="autosize"><DIV CLASS="bubble"><DIV CLASS="bquote"><BLOCKQUOTE><DIV>{CONTENT}</DIV></BLOCKQUOTE></DIV><CITE><STRONG>{PARAM}</STRONG></CITE></DIV></DIV><DIV CLASS="cleardiv"></DIV>'; | 52 | $this->bbcodes['del'] = '<del>{CONTENT}</del>'; |
53 | $this->bbcodes2['abbr'] = '<ABBR TITLE="{PARAM}">{CONTENT}</ABBR>'; | 53 | $this->bbcodes['bquote'] = '<div class="bquote module unrounded"><blockquote>{CONTENT}</blockquote></div><cite><strong>Anonymous</strong></cite><div class="cleardiv"></div>'; |
54 | $this->bbcodes['hidden'] = '<SPAN STYLE="display: none">{CONTENT}</SPAN>'; | 54 | $this->bbcodes2['bquote'] = '<div class="bquote module unrounded"><blockquote>{CONTENT}</blockquote></div><cite><strong>{PARAM}</strong></cite><div class="cleardiv"></div>'; |
55 | $this->bbcodes['thumb'] = '<A HREF="/images/{CONTENT}"><IMG SRC="http://fourisland.com/thumb.php?file=images/{CONTENT}&mode=scale&by=521&side=0" ALT="Image"></A>'; | 55 | $this->bbcodes2['abbr'] = '<abbr title="{PARAM}">{CONTENT}</abbr>'; |
56 | $this->bbcodes['thumb2'] = '<A HREF="/images/{CONTENT}"><IMG SRC="http://fourisland.com/thumb.php?file=images/{CONTENT}&mode=scale&by=260&side=0" ALIGN="right" ALT="Image"></A>'; | 56 | $this->bbcodes['hidden'] = '<span style="display: none">{CONTENT}</span>'; |
57 | $this->bbcodes['thumb'] = '<a href="/images/{CONTENT}"><img src="http://fourisland.com/thumb.php?file=images/{CONTENT}&mode=scale&by=521&side=0" alt="Image" /></a>'; | ||
58 | $this->bbcodes['thumb2'] = '<a href="/images/{CONTENT}"><img src="http://fourisland.com/thumb.php?file=images/{CONTENT}&mode=scale&by=260&side=0" align="right" alt="Image" /></a>'; | ||
59 | $this->bbcodes['project'] = '<a href="http://projects.fourisland.com/projects/show/{CONTENT}">{CONTENT}</a>'; | ||
57 | 60 | ||
58 | $this->init = true; | 61 | $this->init = true; |
59 | } | 62 | } |
@@ -73,8 +76,15 @@ class BBCode | |||
73 | { | 76 | { |
74 | $bbcode_uid = unique_id(); | 77 | $bbcode_uid = unique_id(); |
75 | $bbpos = strpos($to_parse, '[' . $name . ']'); | 78 | $bbpos = strpos($to_parse, '[' . $name . ']'); |
76 | $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . ']', $bbpos, strlen($name) + 2); | 79 | $otag = '[' . $name . ':' . $bbcode_uid . ']'; |
77 | $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3); | 80 | $ctag = '[/' . $name . ':' . $bbcode_uid . ']'; |
81 | $to_parse = substr_replace($to_parse, $otag, $bbpos, strlen($name) + 2); | ||
82 | $to_parse = substr_replace($to_parse, $ctag, strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3); | ||
83 | |||
84 | if (strpos($this->bbcodes[$name], '<pre>') !== -1) | ||
85 | { | ||
86 | $to_parse = substr_replace($to_parse, str_replace('[br]', '', substr($to_parse, strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag)))), strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag))); | ||
87 | } | ||
78 | 88 | ||
79 | $value = str_replace('{CONTENT}', '\1', $value); | 89 | $value = str_replace('{CONTENT}', '\1', $value); |
80 | $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse); | 90 | $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse); |
@@ -96,13 +106,13 @@ class BBCode | |||
96 | } | 106 | } |
97 | } | 107 | } |
98 | 108 | ||
99 | return str_replace('[br]','<BR>',$to_parse); | 109 | return str_replace('[br]','<br />',$to_parse); |
100 | } | 110 | } |
101 | } | 111 | } |
102 | 112 | ||
103 | function parseBBCode($text) | 113 | function parseBBCode($text) |
104 | { | 114 | { |
105 | global $bbcode; | 115 | static $bbcode; |
106 | if (!isset($bbcode)) | 116 | if (!isset($bbcode)) |
107 | { | 117 | { |
108 | $bbcode = new BBCode(); | 118 | $bbcode = new BBCode(); |
diff --git a/includes/comments.php b/includes/comments.php index e050073..0f48444 100755 --- a/includes/comments.php +++ b/includes/comments.php | |||
@@ -69,8 +69,8 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | |||
69 | if (isset($username)) | 69 | if (isset($username)) |
70 | { | 70 | { |
71 | $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), | 71 | $template->add_ref($curID, 'COMMENTS', array( 'CODEDEMAIL' => md5(strtolower($email)), |
72 | 'USERNAME' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username), | 72 | 'USERNAME' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username), |
73 | 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), | 73 | 'DATE' => date("F jS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), |
74 | 'ID' => $getcomments3[$i]['id'], | 74 | 'ID' => $getcomments3[$i]['id'], |
75 | 'TEXT' => parseText($getcomments3[$i]['comment']))); | 75 | 'TEXT' => parseText($getcomments3[$i]['comment']))); |
76 | 76 | ||
@@ -78,7 +78,7 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | |||
78 | { | 78 | { |
79 | if ((isAdmin()) || (($getcomments3[$i]['is_anon'] == 0) && (getSessionUserID() === $getcomments3[$i]['user_id']))) | 79 | if ((isAdmin()) || (($getcomments3[$i]['is_anon'] == 0) && (getSessionUserID() === $getcomments3[$i]['user_id']))) |
80 | { | 80 | { |
81 | $template->adds_ref_sub($curID, 'EDITOR', array('BEFORE' => $getcomments3[$i]['comment'])); | 81 | $template->adds_ref_sub($curID, 'EDITOR', array('BEFORE' => htmlspecialchars($getcomments3[$i]['comment']))); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
diff --git a/includes/footer.php b/includes/footer.php index 6713db0..19cc341 100755 --- a/includes/footer.php +++ b/includes/footer.php | |||
@@ -24,244 +24,156 @@ require('headerproc.php'); | |||
24 | 24 | ||
25 | $template = new FITemplate('footer'); | 25 | $template = new FITemplate('footer'); |
26 | 26 | ||
27 | if (isset($extraSidebars)) | ||
28 | { | ||
29 | $template->adds_block('EXTRA', array('SIDEBARS' => $extraSidebars)); | ||
30 | } | ||
31 | |||
32 | if (isset($onFourm)) | 27 | if (isset($onFourm)) |
33 | { | 28 | { |
34 | $template->adds_block('ONFOURM',array('exi'=>1)); | 29 | $template->adds_block('ONFOURM',array('exi'=>1)); |
35 | } | 30 | } |
36 | 31 | ||
37 | if (!isset($noRightbar)) | 32 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; |
33 | $getcomments2 = mysql_query($getcomments); | ||
34 | $i=0; | ||
35 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
38 | { | 36 | { |
39 | $template->adds_block('RIGHTBAR',array('exi'=>1)); | 37 | if ($getcomments3[$i]['is_anon'] == 0) |
40 | 38 | { | |
41 | if (!isset($noHatNav)) | 39 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; |
42 | { | 40 | $getuser2 = mysql_query($getuser); |
43 | $cnthatnav = "SELECT COUNT(*) FROM hatnav WHERE category = \"" . $pageCategory . "\""; | 41 | $getuser3 = mysql_fetch_array($getuser2); |
44 | $cnthatnav2 = mysql_query($cnthatnav); | ||
45 | $cnthatnav3 = mysql_fetch_array($cnthatnav2); | ||
46 | 42 | ||
47 | if ($cnthatnav3['COUNT(*)'] > 0) | 43 | $username = $getuser3['username']; |
44 | $website = $getuser3['user_website']; | ||
45 | } else if ($getcomments3[$i]['is_anon'] == 1) | ||
48 | { | 46 | { |
49 | $template->adds_block('USEHATNAV', array('exi'=>1)); | 47 | $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; |
50 | if (!isset($genHatNav)) | 48 | $getanon2 = mysql_query($getanon); |
51 | { | 49 | $getanon3 = mysql_fetch_array($getanon2); |
52 | $gethnis = 'SELECT * FROM hatnav WHERE category = "' . $pageCategory . '"'; | 50 | |
53 | $gethnis2 = mysql_query($gethnis); | 51 | if ($getanon3['id'] == $getcomments3[$i]['user_id']) |
54 | $i=0; | ||
55 | while ($gethnis3[$i] = mysql_fetch_array($gethnis2)) | ||
56 | { | ||
57 | $template->adds_block('HATNAV', array( 'AID' => $gethnis3[$i]['AID'], | ||
58 | 'HREF' => $gethnis3[$i]['href'], | ||
59 | 'IMAGE' => '/theme/images/icons/' . $gethnis3[$i]['image'] . '.png', | ||
60 | 'TEXT' => $gethnis3[$i]['text'], | ||
61 | 'NEW' => dispIfNotOld($gethnis3[$i]['lastEdit']))); | ||
62 | $i++; | ||
63 | } | ||
64 | } else { | ||
65 | $i=0; | ||
66 | while ($i < $genHatNavNum) | ||
67 | { | 52 | { |
68 | $template->adds_block('HATNAV', array( 'AID' => 'post', | 53 | $username = $getanon3['username'] . ' (Guest)'; |
69 | 'HREF' => $genHatNav[$i]['href'], | 54 | $website = $getanon3['website']; |
70 | 'IMAGE' => '/theme/images/blue.PNG', | ||
71 | 'TEXT' => $genHatNav[$i]['text'], | ||
72 | 'NEW' => '')); | ||
73 | $i++; | ||
74 | } | 55 | } |
75 | } | ||
76 | } | 56 | } |
77 | } | ||
78 | 57 | ||
79 | include('pages/polloftheweek.php'); | 58 | if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) |
80 | |||
81 | $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; | ||
82 | $getpopular2 = mysql_query($getpopular); | ||
83 | $i=0; | ||
84 | while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) | ||
85 | { | 59 | { |
86 | $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], | 60 | $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); |
87 | 'TITLE' => stripslashes($getpopular3[$i]['title']))); | 61 | $getpost2 = mysql_query($getpost); |
62 | $getpost3 = mysql_fetch_array($getpost2); | ||
63 | |||
64 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
65 | 'AREA' => 'blog', | ||
66 | 'CODED' => $getpost3['slug'], | ||
67 | 'ENDING' => '/', | ||
68 | 'TITLE' => stripslashes($getpost3['title']), | ||
69 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); | ||
88 | $i++; | 70 | $i++; |
89 | } | 71 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) |
90 | |||
91 | $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; | ||
92 | $getcomments2 = mysql_query($getcomments); | ||
93 | $i=0; | ||
94 | while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) | ||
95 | { | 72 | { |
96 | if ($getcomments3[$i]['is_anon'] == 0) | 73 | $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); |
97 | { | 74 | |
98 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; | 75 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], |
99 | $getuser2 = mysql_query($getuser); | 76 | 'AREA' => 'quotes', |
100 | $getuser3 = mysql_fetch_array($getuser2); | 77 | 'CODED' => $num, |
101 | 78 | 'ENDING' => '.php', | |
102 | $username = $getuser3['username']; | 79 | 'TITLE' => 'Quote #' . $num, |
103 | $website = $getuser3['user_website']; | 80 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); |
104 | } else if ($getcomments3[$i]['is_anon'] == 1) | 81 | $i++; |
105 | { | 82 | } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) |
106 | $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; | ||
107 | $getanon2 = mysql_query($getanon); | ||
108 | $getanon3 = mysql_fetch_array($getanon2); | ||
109 | |||
110 | if ($getanon3['id'] == $getcomments3[$i]['user_id']) | ||
111 | { | ||
112 | $username = $getanon3['username'] . ' (Guest)'; | ||
113 | $website = $getanon3['website']; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) | ||
118 | { | ||
119 | $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
120 | $getpost2 = mysql_query($getpost); | ||
121 | $getpost3 = mysql_fetch_array($getpost2); | ||
122 | |||
123 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
124 | 'AREA' => 'blog', | ||
125 | 'CODED' => $getpost3['slug'], | ||
126 | 'ENDING' => '/', | ||
127 | 'TITLE' => stripslashes($getpost3['title']), | ||
128 | 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username))); | ||
129 | $i++; | ||
130 | } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) | ||
131 | { | ||
132 | $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
133 | |||
134 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
135 | 'AREA' => 'quotes', | ||
136 | 'CODED' => $num, | ||
137 | 'ENDING' => '.php', | ||
138 | 'TITLE' => 'Quote #' . $num, | ||
139 | 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username))); | ||
140 | $i++; | ||
141 | } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) | ||
142 | { | ||
143 | $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); | ||
144 | $getpotw2 = mysql_query($getpotw); | ||
145 | $getpotw3 = mysql_fetch_array($getpotw2); | ||
146 | |||
147 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], | ||
148 | 'AREA' => 'poll', | ||
149 | 'CODED' => $getpotw3['id'], | ||
150 | 'ENDING' => '.php', | ||
151 | 'TITLE' => 'Poll "' . $getpotw3['question'] . '"', | ||
152 | 'AUTHOR' => (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username))); | ||
153 | $i++; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | $users = array(); | ||
158 | $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; | ||
159 | $getusers2 = mysql_query($getusers); | ||
160 | $i=0; | ||
161 | while ($getusers3[$i] = mysql_fetch_array($getusers2)) | ||
162 | { | 83 | { |
163 | $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; | 84 | $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); |
164 | $getcount2 = mysql_query($getcount); | 85 | $getpotw2 = mysql_query($getpotw); |
165 | $getcount3 = mysql_fetch_array($getcount2); | 86 | $getpotw3 = mysql_fetch_array($getpotw2); |
166 | 87 | ||
167 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; | 88 | $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], |
168 | $getuser2 = mysql_query($getuser); | 89 | 'AREA' => 'poll', |
169 | $getuser3 = mysql_fetch_array($getuser2); | 90 | 'CODED' => $getpotw3['id'], |
170 | 91 | 'ENDING' => '.php', | |
171 | $username = $getuser3['username']; | 92 | 'TITLE' => 'Poll "' . $getpotw3['question'] . '"', |
172 | $website = $getuser3['user_website']; | 93 | 'AUTHOR' => (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username))); |
173 | 94 | $i++; | |
174 | $name = (($website != '') ? '<A HREF="' . $website . '">' . $username . '</A>' : $username); | ||
175 | $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); | ||
176 | |||
177 | $i++; | ||
178 | } | 95 | } |
96 | } | ||
179 | 97 | ||
180 | function count_sort($a, $b) | 98 | $users = array(); |
181 | { | 99 | $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; |
182 | $a = $a['count']; | 100 | $getusers2 = mysql_query($getusers); |
183 | $b = $b['count']; | 101 | $i=0; |
102 | while ($getusers3[$i] = mysql_fetch_array($getusers2)) | ||
103 | { | ||
104 | $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; | ||
105 | $getcount2 = mysql_query($getcount); | ||
106 | $getcount3 = mysql_fetch_array($getcount2); | ||
184 | 107 | ||
185 | if ($a > $b) | 108 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; |
186 | { | 109 | $getuser2 = mysql_query($getuser); |
187 | return -1; | 110 | $getuser3 = mysql_fetch_array($getuser2); |
188 | } else if ($a < $b) | ||
189 | { | ||
190 | return 1; | ||
191 | } else { | ||
192 | return 0; | ||
193 | } | ||
194 | } | ||
195 | 111 | ||
196 | usort($users, 'count_sort'); | 112 | $username = $getuser3['username']; |
197 | $i=0; | 113 | $website = $getuser3['user_website']; |
198 | foreach ($users as $value) | ||
199 | { | ||
200 | if ($i == 5) | ||
201 | { | ||
202 | break; | ||
203 | } | ||
204 | 114 | ||
205 | $template->adds_block('TOP', array( 'USERNAME' => $value['name'], | 115 | $name = (($website != '') ? '<a href="' . $website . '">' . $username . '</a>' : $username); |
206 | 'COUNT' => $value['count'])); | 116 | $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); |
207 | $i++; | ||
208 | } | ||
209 | 117 | ||
210 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | 118 | $i++; |
211 | $gethits2 = mysql_query($gethits); | 119 | } |
212 | $gethits3 = mysql_fetch_array($gethits2); | ||
213 | $template->add('HITS', $gethits3['value']); | ||
214 | 120 | ||
215 | $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; | 121 | function count_sort($a, $b) |
216 | $gethits2 = mysql_query($gethits); | 122 | { |
217 | $gethits3 = mysql_fetch_array($gethits2); | 123 | $a = $a['count']; |
218 | $template->add('TODAY', $gethits3['value']); | 124 | $b = $b['count']; |
219 | 125 | ||
220 | $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; | 126 | if ($a > $b) |
221 | $getpost2 = mysql_query($getpost) or die($getpost); | ||
222 | $i=0; | ||
223 | while ($getpost3[$i] = mysql_fetch_array($getpost2)) | ||
224 | { | 127 | { |
225 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; | 128 | return -1; |
226 | $getuser2 = mysql_query($getuser) or die($getuser); | 129 | } else if ($a < $b) |
227 | $getuser3 = mysql_fetch_array($getuser2); | 130 | { |
228 | 131 | return 1; | |
229 | $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], | 132 | } else { |
230 | 'TOPIC' => $getpost3[$i]['topic_id'], | 133 | return 0; |
231 | 'POST' => $getpost3[$i]['post_id'], | ||
232 | 'USERNAME' => $getuser3['username'])); | ||
233 | } | 134 | } |
135 | } | ||
234 | 136 | ||
235 | $gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\""; | 137 | usort($users, 'count_sort'); |
236 | $gettags2 = mysql_query($gettags); | 138 | $i=0; |
237 | $i=0; | 139 | foreach ($users as $value) |
238 | while ($gettags3[$i] = mysql_fetch_array($gettags2)) | 140 | { |
141 | if ($i == 5) | ||
239 | { | 142 | { |
240 | $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\""; | 143 | break; |
241 | $cnttag2 = mysql_query($cnttag); | 144 | } |
242 | $cnttag3 = mysql_fetch_array($cnttag2); | ||
243 | 145 | ||
244 | $counts[$gettags3[$i]['tag']] = $cnttag3[0]; | 146 | $template->adds_block('TOP', array( 'USERNAME' => $value['name'], |
147 | 'COUNT' => $value['count'])); | ||
148 | $i++; | ||
149 | } | ||
245 | 150 | ||
246 | $i++; | 151 | $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; |
247 | } | 152 | $getpost2 = mysql_query($getpost) or die($getpost); |
153 | $i=0; | ||
154 | while ($getpost3[$i] = mysql_fetch_array($getpost2)) | ||
155 | { | ||
156 | $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; | ||
157 | $getuser2 = mysql_query($getuser) or die($getuser); | ||
158 | $getuser3 = mysql_fetch_array($getuser2); | ||
159 | |||
160 | $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], | ||
161 | 'TOPIC' => $getpost3[$i]['topic_id'], | ||
162 | 'POST' => $getpost3[$i]['post_id'], | ||
163 | 'USERNAME' => $getuser3['username'])); | ||
164 | } | ||
248 | 165 | ||
249 | $min_count = min($counts); | 166 | $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; |
250 | $spread = max($counts) - $min_count; | 167 | $getpopular2 = mysql_query($getpopular); |
251 | $spread = ($spread <= 0) ? 1 : $spread; | 168 | $i=0; |
252 | $font_step = 8 / $spread; | 169 | while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) |
253 | foreach ($counts as $tag => $count) | 170 | { |
254 | { | 171 | $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], |
255 | if ($count != $min_count) | 172 | 'TITLE' => stripslashes($getpopular3[$i]['title']))); |
256 | { | 173 | $i++; |
257 | $template->adds_block('TAGCLOUD', array( 'TAG' => $tag, | ||
258 | 'SIZE' => (8 + (($count - $min_count) * $font_step)), | ||
259 | 'COUNT' => $count)); | ||
260 | } | ||
261 | } | ||
262 | } | 174 | } |
263 | 175 | ||
264 | $template->add('REVISION', exec('hg tip --template {rev}')); | 176 | $template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}')); |
265 | 177 | ||
266 | $template->display(); | 178 | $template->display(); |
267 | 179 | ||
diff --git a/includes/functions.php b/includes/functions.php index 9eb1634..090e9d0 100755 --- a/includes/functions.php +++ b/includes/functions.php | |||
@@ -272,7 +272,7 @@ function displayRelated($title, $avoid = 0) | |||
272 | $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], | 272 | $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], |
273 | 'CODED' => $getrelated3[$i]['slug'], | 273 | 'CODED' => $getrelated3[$i]['slug'], |
274 | 'AUTHOR' => $getrelated3[$i]['author'], | 274 | 'AUTHOR' => $getrelated3[$i]['author'], |
275 | 'DATE' => date('F d<\S\U\P>S</\S\U\P> Y',strtotime($getrelated3[$i]['pubDate'])))); | 275 | 'DATE' => date('F jS Y',strtotime($getrelated3[$i]['pubDate'])))); |
276 | $i++; | 276 | $i++; |
277 | } | 277 | } |
278 | 278 | ||
@@ -304,4 +304,50 @@ function getCommentUrl($getcomment3) | |||
304 | } | 304 | } |
305 | } | 305 | } |
306 | 306 | ||
307 | function getPollOfTheWeek($id = -1) | ||
308 | { | ||
309 | static $showed_form = false; | ||
310 | |||
311 | $potw = new FITemplate('polloftheweek'); | ||
312 | |||
313 | if ($id == -1) | ||
314 | { | ||
315 | $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; | ||
316 | } else { | ||
317 | $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $id; | ||
318 | } | ||
319 | $getpoll2 = mysql_query($getpoll); | ||
320 | $getpoll3 = mysql_fetch_array($getpoll2); | ||
321 | |||
322 | $potw->add('QUESTION', $getpoll3['question']); | ||
323 | $potw->add('OPTION1', $getpoll3['option1']); | ||
324 | $potw->add('OPTION2', $getpoll3['option2']); | ||
325 | $potw->add('OPTION3', $getpoll3['option3']); | ||
326 | $potw->add('OPTION4', $getpoll3['option4']); | ||
327 | |||
328 | $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; | ||
329 | $getip2 = mysql_query($getip); | ||
330 | $getip3 = mysql_fetch_array($getip2); | ||
331 | |||
332 | if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && ($id == -1) && ($showed_form == false)) | ||
333 | { | ||
334 | $potw->adds_block('FORM',array('exi'=>1)); | ||
335 | $showed_form = true; | ||
336 | } else { | ||
337 | $potw->adds_block('DISPLAY',array('exi'=>1)); | ||
338 | |||
339 | $potw->add('PERCENT1', getpercent($getpoll3,'1')); | ||
340 | $potw->add('PERCENT2', getpercent($getpoll3,'2')); | ||
341 | $potw->add('PERCENT3', getpercent($getpoll3,'3')); | ||
342 | $potw->add('PERCENT4', getpercent($getpoll3,'4')); | ||
343 | } | ||
344 | |||
345 | ob_start(); | ||
346 | $potw->display(); | ||
347 | $result = ob_get_contents(); | ||
348 | ob_end_clean(); | ||
349 | |||
350 | return $result; | ||
351 | } | ||
352 | |||
307 | ?> | 353 | ?> |
diff --git a/includes/header.php b/includes/header.php index 427ad93..5a6b8e2 100755 --- a/includes/header.php +++ b/includes/header.php | |||
@@ -24,31 +24,10 @@ require('headerproc.php'); | |||
24 | 24 | ||
25 | $headerTemp = new FITemplate('header'); | 25 | $headerTemp = new FITemplate('header'); |
26 | 26 | ||
27 | if (!isset($_GET['emulateTime'])) | ||
28 | { | ||
29 | if ((date('G') >= 20) || (date('G') <= 6)) | ||
30 | { | ||
31 | $bodyID = 'night'; | ||
32 | } else { | ||
33 | $bodyID = 'day'; | ||
34 | } | ||
35 | } else { | ||
36 | $bodyID = $_GET['emulateTime']; | ||
37 | } | ||
38 | |||
39 | $headerTemp->add('BODYID',$bodyID); | ||
40 | $headerTemp->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); | 27 | $headerTemp->add('CATEGORY',(isset($pageCategory)) ? $pageCategory : 'none'); |
41 | $headerTemp->add('AID',(isset($pageAID)) ? $pageAID : 'none'); | 28 | $headerTemp->add('AID',(isset($pageAID)) ? $pageAID : 'none'); |
42 | $headerTemp->add('BODYTAGS',(isset($bodyTags)) ? $bodyTags : ''); | ||
43 | $headerTemp->add('HEADTAGS',isset($headtags) ? $headtags : ''); | ||
44 | $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); | 29 | $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); |
45 | $headerTemp->add('PAGEID',(isset($pageID)) ? $pageID : 'none'); | 30 | $headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' class="active"'); |
46 | $headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' CLASS="active"'); | ||
47 | |||
48 | if (isset($_POST['message'])) | ||
49 | { | ||
50 | $headerTemp->adds_block('MESSAGE',array('MSG' => $_POST['message'])); | ||
51 | } | ||
52 | 31 | ||
53 | if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) | 32 | if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) |
54 | { | 33 | { |
@@ -63,6 +42,30 @@ if (($pageCategory != 'fourm') && ($pageCategory != 'wiki')) | |||
63 | } | 42 | } |
64 | } | 43 | } |
65 | 44 | ||
45 | if (isset($hatNav) && is_array($hatNav)) | ||
46 | { | ||
47 | $headerTemp->adds_block('CREATE_HATNAV', array('exi'=>1)); | ||
48 | |||
49 | foreach ($hatNav as $item) | ||
50 | { | ||
51 | $headerTemp->adds_block('HATNAV',array('TITLE' => $item['title'], 'URL' => $item['url'], 'ICON' => $item['icon'])); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | $headerTemp->add('POTW', getPollOfTheWeek()); | ||
56 | |||
57 | $gethits = "SELECT * FROM config WHERE name = \"hits\""; | ||
58 | $gethits2 = mysql_query($gethits); | ||
59 | $gethits3 = mysql_fetch_array($gethits2); | ||
60 | $headerTemp->add('HITS', $gethits3['value']); | ||
61 | |||
62 | $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; | ||
63 | $gethits2 = mysql_query($gethits); | ||
64 | $gethits3 = mysql_fetch_array($gethits2); | ||
65 | $headerTemp->add('TODAY', $gethits3['value']); | ||
66 | |||
67 | $headerTemp->add('DATEFINDER', sd_dateFinder()); | ||
68 | |||
66 | $headerTemp->display(); | 69 | $headerTemp->display(); |
67 | 70 | ||
68 | ?> | 71 | ?> |
diff --git a/includes/smilies.php b/includes/smilies.php index e7579a6..fbadc57 100755 --- a/includes/smilies.php +++ b/includes/smilies.php | |||
@@ -45,7 +45,7 @@ class Smilies | |||
45 | 45 | ||
46 | foreach ($this->smilies as $name => $value) | 46 | foreach ($this->smilies as $name => $value) |
47 | { | 47 | { |
48 | $text = str_replace($name, '<IMG SRC="http://fourisland.com/theme/images/smilies/' . $value . '" ALT="' . $name . '">', $text); | 48 | $text = str_replace($name, '<img src="http://fourisland.com/theme/images/smilies/' . $value . '" alt="' . $name . '" />', $text); |
49 | } | 49 | } |
50 | 50 | ||
51 | return $text; | 51 | return $text; |
diff --git a/includes/specialdates.php b/includes/specialdates.php index 4c774a7..067de6d 100755 --- a/includes/specialdates.php +++ b/includes/specialdates.php | |||
@@ -48,10 +48,10 @@ sd_solar_annual('WCA Day',5,5); //DateFinder | |||
48 | sd_lunar_annual('Mothers Day',5,7,2); //BG Pic; DateFinder; Header Pic | 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 | 49 | sd_lunar_annual('Memorial Day',5,1,4); //BG Pic; DateFinder; Header Pic |
50 | sd_easter(); //BG Pic; DateFinder | 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 | 51 | sd_solar_annual('Flag Day',6,14); //BG Pic; DateFinder |
52 | sd_solar_annual('Hatkirbys B-Day',6,17); //BG Pic; DateFinder; Header Pic | ||
53 | sd_lunar_annual('Fathers Day',6,7,3); //BG Pic; DateFinder | 53 | sd_lunar_annual('Fathers Day',6,7,3); //BG Pic; DateFinder |
54 | sd_solar_annual('CTNH',6,17); //Header Pic | 54 | sd_solar_annual('CTNH',6,17); //Header Pic; DateFinder |
55 | sd_solar_annual('Independance Day',7,4); //BG Pic; DateFinder | 55 | sd_solar_annual('Independance Day',7,4); //BG Pic; DateFinder |
56 | sd_lunar_annual('SysAdminDay',7,5,4); //DateFinder | 56 | sd_lunar_annual('SysAdminDay',7,5,4); //DateFinder |
57 | sd_lunar_annual('Labor Day',9,1,1); //Yet to be implemented | 57 | sd_lunar_annual('Labor Day',9,1,1); //Yet to be implemented |
@@ -308,4 +308,52 @@ function sd_addDateIn($id,$dateid) | |||
308 | $specialdates[$dateid] = $id; | 308 | $specialdates[$dateid] = $id; |
309 | } | 309 | } |
310 | 310 | ||
311 | function sd_dateFinder() | ||
312 | { | ||
313 | if (sd_ifNoSpecialDay()) | ||
314 | { | ||
315 | $did = sd_getMonthStart(date('n')-1); | ||
316 | $did += (date('j')-1); | ||
317 | $did = sd_findNextDay() - $did; | ||
318 | return ($did . ' more days until the next holiday!'); | ||
319 | } else { | ||
320 | switch (sd_getCurrentDay()) | ||
321 | { | ||
322 | case 'New Years Day': return 'Happy new years!'; | ||
323 | case 'Martin Luther King Day': return 'Happy Martin Luther King Day!'; | ||
324 | case 'Groundhog Day': return 'It\'s groundhog day? Will he see his shadow?'; | ||
325 | case 'Presidents Day': return 'Happy President\'s Day!'; | ||
326 | case 'Valentines Day': return 'Happy Valentines Day! Will you be mine?'; | ||
327 | case 'St Patricks Day': return 'Happy St. Patrick\'s Day! If you\'re not wearing green, I\'ll pinch you!'; | ||
328 | case 'Mothers Day': return 'Happy Mothers Day!'; | ||
329 | case 'Memorial Day': return 'Remember...'; | ||
330 | case 'Easter': return 'Happy Easter! Where are those eggs?'; | ||
331 | case 'Mardi Gras': return 'Happy Mardi Gras! Time to get fat!'; | ||
332 | case 'Ash Wednesday': return 'Happy Ash Wednesday! Did you get your ashes?'; | ||
333 | case 'Palm Sunday': return 'Happy Palm Sunday!'; | ||
334 | case 'Holy Thursday': return 'Happy Holy Thursday!'; | ||
335 | case 'Hatkirbys B-Day': return 'Happy Birthday to me! Happy Birthday to me! Happy Birthday dear Hatkirby! Happy Birthday to me!'; | ||
336 | case 'Flag Day': return 'Happy Flag Day!'; | ||
337 | case 'Fathers Day': return 'Happy Fathers Day!'; | ||
338 | case 'Independance Day': return 'Happy 4th of July!'; | ||
339 | case 'Labor Day': return 'Happy Labor Day!'; | ||
340 | case 'Four Island A': return ('Happy birthday Four Island! Four Island is ' . (date('Y')-2007) . ' years old!'); | ||
341 | case 'Columbus Day': return 'Happy Columbus Day!'; | ||
342 | case 'Halloween': return 'Happy Halloween!'; | ||
343 | case 'Veterans Day': return 'Only 2 minutes of silence. Remember... remember...'; | ||
344 | case 'Thanksgiving': return 'Happy Thanksgiving! Gobble gobble gobble gobble!'; | ||
345 | case 'Kirby Week': return 'It\'s Kirby Week! Not only is it a time of celebreation and fun on Four Island, it\'s only a week before Christmas!'; | ||
346 | case 'Christmas Eve': return '"1 Day Left" says Fourie!'; | ||
347 | case 'Christmas Day': return 'Merry Christmas! Time for presents!'; | ||
348 | case 'New Years Eve': return '5... 4... 3... 2...'; | ||
349 | case 'SysAdminDay': return '<A HREF="http://www.sysadminday.com">If you can read this, thank your <I><B>sysadmin</B></I></A>'; | ||
350 | case 'WCA Day': return '<A HREF="http://wca2001.keenspace.com">Webcomic Appreciation Day!</A> Stare in wonder at all of your favorite webcomics! Like Pillowcase, for instance!'; | ||
351 | case 'Leap Day': return 'What day is it? LEAP DAY? This only happens once every four years! LET\'S LEAP IN JOY!'; | ||
352 | case 'Tris CIEday': return 'This is the day that shei came.'; | ||
353 | case 'Silence Day': return 'Support LGBT people by keeping the silence until 5 PM.'; | ||
354 | case 'CTNH': return '<A HREF="/fuhsdiufgsadiufgaisfioas.php">It never happened.</A>'; | ||
355 | } | ||
356 | } | ||
357 | } | ||
358 | |||
311 | ?> | 359 | ?> |