Not Reviewed
Show More
Add another comment
| @@ -0,0 +1,34 | |||
|
|
1 | DirectoryIndex index.php | |
|
|
2 | Options -MultiViews | |
|
|
3 | ||
|
|
4 | # Redirects for main page | |
|
|
5 | <IfModule mod_rewrite.c> | |
|
|
6 | RewriteEngine On | |
|
|
7 | ||
|
|
8 | # Base URL for site | |
|
|
9 | # This MUST be changed when moving to the production servers | |
|
|
10 | RewriteBase / | |
|
|
11 | ||
|
|
12 | # Pretty URLs for dynamic pages | |
|
|
13 | RewriteRule ^strip/([0-9]+)/?$ index.php?strip_id=$1 [L] | |
|
|
14 | RewriteRule ^transcript/([0-9]+)/?$ index.php?transcript_id=$1 [L] | |
|
|
15 | RewriteRule ^rant/([0-9]+)/?$ index.php?rant_id=$1 [L] | |
|
|
16 | RewriteRule ^archive(/by_(.+))?/?$ archive.php?list_by=$2 [L] | |
|
|
17 | RewriteRule ^search/?$ search.php [L] | |
|
|
18 | RewriteRule ^nameplates - [L] | |
|
|
19 | RewriteRule ^strips - [L] | |
|
|
20 | ||
|
|
21 | RewriteCond %{REQUEST_FILENAME} !-F | |
|
|
22 | RewriteCond %{REQUEST_FILENAME} !-d | |
|
|
23 | RewriteRule ^(.+)/? static.php?name=$1 [L,NS] | |
|
|
24 | </IfModule> | |
|
|
25 | ||
|
|
26 | <FilesMatch "^(header|footer|LocalSettings)\.php$"> | |
|
|
27 | Order Deny,Allow | |
|
|
28 | Deny from All | |
|
|
29 | </FilesMatch> | |
|
|
30 | ||
|
|
31 | <FilesMatch "\.(css|js)$"> | |
|
|
32 | ExpiresActive on | |
|
|
33 | ExpiresDefault "modification plus 5 years" | |
|
|
34 | </FilesMatch> | |
| @@ -0,0 +1,14 | |||
|
|
1 | <script type="text/javascript"> | |
|
|
2 | ||
|
|
3 | var _gaq = _gaq || []; | |
|
|
4 | _gaq.push(['_setAccount', 'UA-752051-1']); | |
|
|
5 | _gaq.push(['_trackPageview']); | |
|
|
6 | ||
|
|
7 | (function() { | |
|
|
8 | var ga = document.createElement('script'); | |
|
|
9 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
|
|
10 | ga.setAttribute('async', 'true'); | |
|
|
11 | document.documentElement.firstChild.appendChild(ga); | |
|
|
12 | })(); | |
|
|
13 | ||
|
|
14 | </script> | |
| @@ -0,0 +1,16 | |||
|
|
1 | .content ol { | |
|
|
2 | padding: 1ex 3em; | |
|
|
3 | background-color: #757b81; | |
|
|
4 | margin: 0px; | |
|
|
5 | } | |
|
|
6 | ||
|
|
7 | .content ul { | |
|
|
8 | list-style-type: none; | |
|
|
9 | padding: 1ex 2em; | |
|
|
10 | background-color: #757b81; | |
|
|
11 | margin: 0px; | |
|
|
12 | } | |
|
|
13 | ||
|
|
14 | .content a { color: #f6b33d; } | |
|
|
15 | .content a:visited { color:#ececa3; } | |
|
|
16 | .content a:hover { color:#eb5252; } | |
| @@ -0,0 +1,77 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | $TYPES = mysqli_query($link,'SELECT DISTINCT strip_t.id, strip_t.description, strip_t.name, meta.meta FROM strip_t | |
|
|
6 | LEFT JOIN meta ON strip_t.id = meta.type | |
|
|
7 | ORDER BY meta.meta, strip_t.id') or die(mysqli_error($link)); | |
|
|
8 | ||
|
|
9 | #$MTIME = mysqli_query($link,'SELECT UNIX_TIMESTAMP(MAX(published)) FROM strip') or die(mysqli_error($link)); | |
|
|
10 | #conditional_exit(current(mysqli_fetch_row($MTIME))); | |
|
|
11 | ||
|
|
12 | pagehead('archive', 'Archives'); | |
|
|
13 | ?> | |
|
|
14 | ||
|
|
15 | <div class="content"> | |
|
|
16 | <h2>View By:</h2> | |
|
|
17 | <div><ul class="nl"> | |
|
|
18 | <li><a href="archive.php?list_by=date">View by Date</a></li> | |
|
|
19 | <li><a href="archive.php">View by Section</a></li> | |
|
|
20 | <li><a href="archive.php?list_by=date">View in Order</a></li> | |
|
|
21 | </ul></div> | |
|
|
22 | </div> | |
|
|
23 | ||
|
|
24 | <?php | |
|
|
25 | ||
|
|
26 | if(isset($_REQUEST['list_by']) && $_REQUEST['list_by'] == "date") | |
|
|
27 | { | |
|
|
28 | $comics = mysqli_query($link,"SELECT distinct id, title, | |
|
|
29 | DATE_FORMAT(published, '%M %D, %Y') AS pubdate | |
|
|
30 | FROM strip WHERE published < NOW() ORDER BY id") or die(mysqli_error($link)); | |
|
|
31 | ||
|
|
32 | echo '<div class="content"><h2>Comics by Date</h2><div><ul>'; | |
|
|
33 | ||
|
|
34 | while($comic = mysqli_fetch_assoc($comics)) | |
|
|
35 | printf('<li><a title="%s" name="%d" href="./strip/%d">%04d - %s</a></li>', $comic['pubdate'], $comic['id'], $comic['id'], $comic['id'], htmlentities($comic['title'])); | |
|
|
36 | ||
|
|
37 | echo '</ul></div></div>'; | |
|
|
38 | } | |
|
|
39 | ||
|
|
40 | #elseif(!isset($_REQUEST['list_by']) || $_REQUEST['list_by'] == "type") | |
|
|
41 | else | |
|
|
42 | { | |
|
|
43 | ?> | |
|
|
44 | <div class="content" id="typelinks"> | |
|
|
45 | <h2>Comics by Section</h2> | |
|
|
46 | <div><ul><?php | |
|
|
47 | while ($type = mysqli_fetch_assoc($TYPES)) { | |
|
|
48 | $comics = mysqli_query($link,"SELECT distinct id, title FROM strip WHERE type = $type[id] AND published < NOW()") or die(mysqli_error($link)); | |
|
|
49 | if (mysqli_num_rows($comics) <= 0) | |
|
|
50 | continue; | |
|
|
51 | echo "\t\t<li><a href=\"archive.php#$type[name]\">", htmlentities($type[description]), "</a></li>\n"; | |
|
|
52 | } | |
|
|
53 | ?></ul></div> | |
|
|
54 | </div> | |
|
|
55 | <?php | |
|
|
56 | mysqli_data_seek($TYPES, 0); | |
|
|
57 | while($type = mysqli_fetch_assoc($TYPES)) { | |
|
|
58 | $comics = mysqli_query($link,"SELECT distinct id, title, | |
|
|
59 | DATE_FORMAT(published, '%M %D, %Y') AS pubdate | |
|
|
60 | FROM strip WHERE type = $type[id] AND published < NOW()") or die(mysqli_error($link)); | |
|
|
61 | ||
|
|
62 | if(mysqli_num_rows($comics) <= 0) | |
|
|
63 | continue; | |
|
|
64 | ||
|
|
65 | echo '<div class="content"><h2><a id="', $type['name'], '">', htmlentities($type['description']), '</a></h2><div><ol>'; | |
|
|
66 | ||
|
|
67 | while($comic = mysqli_fetch_assoc($comics)) | |
|
|
68 | printf('<li><a title="%s" name="%d" href="./strip/%d">%04d - %s</a></li>', $comic['pubdate'], $comic['id'], $comic['id'], $comic['id'], utfentities($comic['title'])); | |
|
|
69 | ||
|
|
70 | echo '</ol></div></div>'; | |
|
|
71 | } | |
|
|
72 | } | |
|
|
73 | ?> | |
|
|
74 | ||
|
|
75 | <?php pagefoot() ?> | |
|
|
76 | </body> | |
|
|
77 | </html> | |
|
|
1 | NO CONTENT: new file 100644 |
| @@ -0,0 +1,18 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | pagehead('characters', 'Characters'); | |
|
|
6 | ?> | |
|
|
7 | <div class="content"><div> | |
|
|
8 | <p><q>All right, all right! I still don't feel like finishing these sections, but whatever (grumble)...</q><br /> | |
|
|
9 | piro - fall 2007</p> | |
|
|
10 | ||
|
|
11 | <p>Believe it or not, the (page) is in production and will be incorporated into the new site launch. We just are not including them as part of this beta test | |
|
|
12 | (because they still need some work).</p> | |
|
|
13 | ||
|
|
14 | </div></div> | |
|
|
15 | ||
|
|
16 | <?php pagefoot() ?> | |
|
|
17 | </body> | |
|
|
18 | </html> | |
|
|
1 | NO CONTENT: new file 100644 |
| @@ -0,0 +1,296 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | require_once 'frontend.inc.php'; | |
|
|
4 | ||
|
|
5 | class MTAPIi | |
|
|
6 | { | |
|
|
7 | ||
|
|
8 | private static $db_conn; | |
|
|
9 | ||
|
|
10 | static function construct($db) | |
|
|
11 | { | |
|
|
12 | $db_conn = $db; | |
|
|
13 | return mysqli_ping($db_conn); | |
|
|
14 | } | |
|
|
15 | ||
|
|
16 | static function destruct() | |
|
|
17 | { | |
|
|
18 | $db_conn = NULL; | |
|
|
19 | } | |
|
|
20 | ||
|
|
21 | #This just returns the current maximum comic | |
|
|
22 | static function getNumStrips() | |
|
|
23 | { | |
|
|
24 | return max_strip_id(); | |
|
|
25 | } | |
|
|
26 | ||
|
|
27 | static function getNumPanels($comic) | |
|
|
28 | { | |
|
|
29 | return get_num_panels($comic); | |
|
|
30 | } | |
|
|
31 | ||
|
|
32 | static function getPanelTranscript($comic, $panel, $xml=false) | |
|
|
33 | { | |
|
|
34 | if(!validate_panel_id($comic, $panel)) | |
|
|
35 | { | |
|
|
36 | die("Invalid args: $comic $panel\n"); | |
|
|
37 | return false; | |
|
|
38 | } | |
|
|
39 | ||
|
|
40 | $script = build_panel_transcript($comic, $panel); | |
|
|
41 | if(!$xml) | |
|
|
42 | { | |
|
|
43 | return $script; | |
|
|
44 | } | |
|
|
45 | else | |
|
|
46 | { | |
|
|
47 | $ret = '<panel id="'.$panel.'">'; | |
|
|
48 | foreach($script as $id => $line) | |
|
|
49 | { | |
|
|
50 | $ret .= '<line id="' . ($id+1) . '" speaker="'.utfentities($script[$id]['speaker']).'">'; | |
|
|
51 | $ret .= utfentities($script[$id]['speech']); | |
|
|
52 | $ret .= '</line>'; | |
|
|
53 | } | |
|
|
54 | $ret .= '</panel>'; | |
|
|
55 | } | |
|
|
56 | return $ret; | |
|
|
57 | } | |
|
|
58 | ||
|
|
59 | static function getStripTranscript($comic, $xml=false) | |
|
|
60 | { | |
|
|
61 | if(!validate_comic_id($comic)) | |
|
|
62 | { | |
|
|
63 | return false; | |
|
|
64 | } | |
|
|
65 | $script = array(); | |
|
|
66 | $panels = MTAPIi::getNumPanels((int)$comic); | |
|
|
67 | #Panel numbering is 1-indexed, not 0-indexed, for semantic reasons | |
|
|
68 | for($i=1; $i <= $panels; $i++) | |
|
|
69 | { | |
|
|
70 | $script[]= MTAPIi::getPanelTranscript($comic, $i, $xml); | |
|
|
71 | } | |
|
|
72 | if(!$xml) | |
|
|
73 | { | |
|
|
74 | return $script; | |
|
|
75 | } | |
|
|
76 | else | |
|
|
77 | { | |
|
|
78 | $ret = '<comic id="'.$comic.'">'; | |
|
|
79 | $ret .= implode($script, ''); | |
|
|
80 | $ret .= '</comic>'; | |
|
|
81 | } | |
|
|
82 | return $ret; | |
|
|
83 | } | |
|
|
84 | ||
|
|
85 | static function getCharactersByPanel($comic, $panel, $speakersOnly=false) | |
|
|
86 | { | |
|
|
87 | if(!validate_panel_id($comic, $panel)) | |
|
|
88 | { | |
|
|
89 | return false; | |
|
|
90 | } | |
|
|
91 | ||
|
|
92 | $panels = MTAPIi::getNumPanels($comic); | |
|
|
93 | ||
|
|
94 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; | |
|
|
95 | $query .= ' AND panel = '.(int)$panel; | |
|
|
96 | $query .= ' AND speaker NOT LIKE "#%" '; | |
|
|
97 | if($speakersOnly) | |
|
|
98 | { | |
|
|
99 | $query .= " AND search != '' "; | |
|
|
100 | } | |
|
|
101 | $query .= 'ORDER BY speaker'; | |
|
|
102 | ||
|
|
103 | return query_to_array($query); | |
|
|
104 | } | |
|
|
105 | ||
|
|
106 | static function getCharactersByStrip($comic, $speakersOnly=false) | |
|
|
107 | { | |
|
|
108 | if(!validate_comic_id($comic)) | |
|
|
109 | { | |
|
|
110 | return false; | |
|
|
111 | } | |
|
|
112 | ||
|
|
113 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; | |
|
|
114 | $query .= ' AND speaker NOT LIKE "#%" '; | |
|
|
115 | if($speakersOnly) | |
|
|
116 | { | |
|
|
117 | $query .= " AND search != '' "; | |
|
|
118 | } | |
|
|
119 | $query .= 'ORDER BY speaker'; | |
|
|
120 | ||
|
|
121 | return query_to_array($query); | |
|
|
122 | } | |
|
|
123 | ||
|
|
124 | static function getStripTitle($comic) | |
|
|
125 | { | |
|
|
126 | if(!validate_comic_id($comic)) | |
|
|
127 | { | |
|
|
128 | return false; | |
|
|
129 | } | |
|
|
130 | $strip = load_strip($comic); | |
|
|
131 | return $strip['title']; | |
|
|
132 | } | |
|
|
133 | ||
|
|
134 | static function getStripPubdate($comic) | |
|
|
135 | { | |
|
|
136 | if(!validate_comic_id($comic)) | |
|
|
137 | { | |
|
|
138 | return false; | |
|
|
139 | } | |
|
|
140 | $strip = load_strip($comic); | |
|
|
141 | return $strip['published']; | |
|
|
142 | } | |
|
|
143 | ||
|
|
144 | static function getStripType($comic) | |
|
|
145 | { | |
|
|
146 | if(!validate_comic_id($comic)) | |
|
|
147 | { | |
|
|
148 | return false; | |
|
|
149 | } | |
|
|
150 | $strip = load_strip($comic); | |
|
|
151 | return $strip['type']; | |
|
|
152 | } | |
|
|
153 | ||
|
|
154 | static function getStripTypeName($comic) | |
|
|
155 | { | |
|
|
156 | if(!validate_comic_id($comic)) | |
|
|
157 | { | |
|
|
158 | return false; | |
|
|
159 | } | |
|
|
160 | #load_strip() really isn't the best tool for this job, as it would mean two queries instead of one | |
|
|
161 | $query = 'SELECT description FROM strip_t | |
|
|
162 | JOIN strip ON strip.type = strip_t.id | |
|
|
163 | WHERE strip.id = '.(int)$comic; | |
|
|
164 | ||
|
|
165 | $qr = query_to_array($query); | |
|
|
166 | return $qr[0]; | |
|
|
167 | } | |
|
|
168 | ||
|
|
169 | ||
|
|
170 | static function getStripMeta($comic) | |
|
|
171 | { | |
|
|
172 | if(!validate_comic_id($comic)) | |
|
|
173 | { | |
|
|
174 | return false; | |
|
|
175 | } | |
|
|
176 | $query = 'SELECT meta_t.id FROM meta_t | |
|
|
177 | JOIN meta ON meta_t.id = meta.meta | |
|
|
178 | JOIN strip_t ON meta.type = strip_t.id | |
|
|
179 | JOIN strip ON strip.type = strip_t.id | |
|
|
180 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.id'; | |
|
|
181 | ||
|
|
182 | $qr = query_to_array($query); | |
|
|
183 | return $qr; | |
|
|
184 | } | |
|
|
185 | ||
|
|
186 | static function getStrip($comic) | |
|
|
187 | { | |
|
|
188 | if(!validate_comic_id($comic)) | |
|
|
189 | { | |
|
|
190 | return false; | |
|
|
191 | } | |
|
|
192 | $strip = load_strip($comic); | |
|
|
193 | $strip['type'] = self::getStripTypeName($strip['type']); | |
|
|
194 | $strip['number'] = self::getStripNumberInType($comic); | |
|
|
195 | ||
|
|
196 | unset($strip['udate']); | |
|
|
197 | ||
|
|
198 | return $strip; | |
|
|
199 | } | |
|
|
200 | ||
|
|
201 | static function getStripNumberInType($comic) | |
|
|
202 | { | |
|
|
203 | if(!validate_comic_id($comic)) | |
|
|
204 | { | |
|
|
205 | return false; | |
|
|
206 | } | |
|
|
207 | ||
|
|
208 | $type = self::getStripType($comic); | |
|
|
209 | ||
|
|
210 | $query = "SELECT count(*) | |
|
|
211 | FROM strip_t JOIN strip ON strip_t.id = strip.type | |
|
|
212 | WHERE strip.id < {$comic}+1 | |
|
|
213 | AND strip.type = {$type}"; | |
|
|
214 | ||
|
|
215 | $qr = query_to_array($query); | |
|
|
216 | return $qr[0]; | |
|
|
217 | } | |
|
|
218 | ||
|
|
219 | static function getStripMetaName($comic) | |
|
|
220 | { | |
|
|
221 | if(!validate_comic_id($comic)) | |
|
|
222 | { | |
|
|
223 | return false; | |
|
|
224 | } | |
|
|
225 | $query = 'SELECT meta_t.name FROM meta_t | |
|
|
226 | JOIN meta ON meta_t.id = meta.meta | |
|
|
227 | JOIN strip_t ON meta.type = strip_t.id | |
|
|
228 | JOIN strip ON strip.type = strip_t.id | |
|
|
229 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.name'; | |
|
|
230 | ||
|
|
231 | $qr = query_to_array($query); | |
|
|
232 | return $qr; | |
|
|
233 | } | |
|
|
234 | ||
|
|
235 | static function getTypeMeta($type) | |
|
|
236 | { | |
|
|
237 | if(!validate_type_id($type)) | |
|
|
238 | { | |
|
|
239 | return false; | |
|
|
240 | } | |
|
|
241 | ||
|
|
242 | $query = 'SELECT meta_t.id FROM meta_t | |
|
|
243 | JOIN meta ON meta_t.id = meta.meta | |
|
|
244 | JOIN strip_t ON meta.type = strip_t.id | |
|
|
245 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.id'; | |
|
|
246 | ||
|
|
247 | $qr = query_to_array($query); | |
|
|
248 | return $qr; | |
|
|
249 | } | |
|
|
250 | ||
|
|
251 | static function getTypeMetaName($type) | |
|
|
252 | { | |
|
|
253 | if(!validate_type_id($type)) | |
|
|
254 | { | |
|
|
255 | return false; | |
|
|
256 | } | |
|
|
257 | ||
|
|
258 | $query = 'SELECT meta_t.name FROM meta_t | |
|
|
259 | JOIN meta ON meta_t.id = meta.meta | |
|
|
260 | JOIN strip_t ON meta.type = strip_t.id | |
|
|
261 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.name'; | |
|
|
262 | ||
|
|
263 | $qr = query_to_array($query); | |
|
|
264 | return $qr; | |
|
|
265 | } | |
|
|
266 | ||
|
|
267 | static function getStripsByType($type) | |
|
|
268 | { | |
|
|
269 | if(!validate_type_id($type)) | |
|
|
270 | { | |
|
|
271 | return false; | |
|
|
272 | } | |
|
|
273 | ||
|
|
274 | $query = 'SELECT strip.id FROM strip WHERE strip.type = '.(int)$type.' ORDER BY strip.id'; | |
|
|
275 | $qr = query_to_array($query); | |
|
|
276 | return $qr; | |
|
|
277 | } | |
|
|
278 | ||
|
|
279 | ||
|
|
280 | static function getStripsByMeta($meta) | |
|
|
281 | { | |
|
|
282 | if(!ctype_digit($meta) || $meta < 1) | |
|
|
283 | { | |
|
|
284 | return false; | |
|
|
285 | } | |
|
|
286 | ||
|
|
287 | $query = 'SELECT strip.id FROM strip | |
|
|
288 | JOIN strip_t ON strip.type = strip_t.id | |
|
|
289 | JOIN meta ON strip_t.id = meta.type | |
|
|
290 | JOIN meta_t ON meta.meta = meta_t.id | |
|
|
291 | WHERE meta_t.id = '.(int)$meta.' ORDER BY strip.id'; | |
|
|
292 | $qr = query_to_array($query); | |
|
|
293 | return $qr; | |
|
|
294 | } | |
|
|
295 | } | |
|
|
296 | ?> | |
|
|
1 | NO CONTENT: new file 100644 |
|
|
1 | NO CONTENT: new file 100644, binary diff hidden |
| @@ -0,0 +1,372 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | require_once('LocalSettings.php'); | |
|
|
4 | set_error_handler('mtdie'); | |
|
|
5 | ||
|
|
6 | ||
|
|
7 | /* BEGIN FRONT END LIBRARY FUNCTIONS */ | |
|
|
8 | ||
|
|
9 | function validate_comic_id($comic) | |
|
|
10 | { | |
|
|
11 | if(!ctype_digit((string)$comic) || (int)$comic > max_strip_id() || (int)$comic < 1) | |
|
|
12 | { | |
|
|
13 | return false; | |
|
|
14 | } | |
|
|
15 | return $comic; | |
|
|
16 | } | |
|
|
17 | ||
|
|
18 | function validate_panel_id($comic, $panel) | |
|
|
19 | { | |
|
|
20 | $panels = get_num_panels($comic); | |
|
|
21 | if(!ctype_digit((string)$panel) || $panel === false || $panel > $panels || $panel < 1) | |
|
|
22 | { | |
|
|
23 | return false; | |
|
|
24 | } | |
|
|
25 | return $panel; | |
|
|
26 | } | |
|
|
27 | ||
|
|
28 | function validate_type_id($type) | |
|
|
29 | { | |
|
|
30 | if(!ctype_digit((string)$type) || $type < 1 || count_by_type($type) == 0) | |
|
|
31 | { | |
|
|
32 | return false; | |
|
|
33 | } | |
|
|
34 | } | |
|
|
35 | ||
|
|
36 | function get_num_panels($comic) | |
|
|
37 | { | |
|
|
38 | global $link; | |
|
|
39 | if(!validate_comic_id($comic)) | |
|
|
40 | { | |
|
|
41 | return false; | |
|
|
42 | } | |
|
|
43 | ||
|
|
44 | $rs = mysqli_query($link,'SELECT MAX(panel) FROM transcript WHERE strip = '.(int)$comic); | |
|
|
45 | return current(mysqli_fetch_row($rs)); | |
|
|
46 | } | |
|
|
47 | ||
|
|
48 | function build_panel_transcript($comic, $panel) | |
|
|
49 | { | |
|
|
50 | $query = 'SELECT speaker, speech FROM transcript | |
|
|
51 | WHERE strip = '.(int)$comic.' AND panel = '.(int)$panel.' | |
|
|
52 | AND speaker NOT LIKE "#%" ORDER BY line'; | |
|
|
53 | ||
|
|
54 | $qr = query_to_nested($query); | |
|
|
55 | return $qr; | |
|
|
56 | } | |
|
|
57 | ||
|
|
58 | function query_to_nested($query) | |
|
|
59 | { | |
|
|
60 | global $link; | |
|
|
61 | $ret = array(); | |
|
|
62 | $rs = mysqli_query($link,$query) or die(mysqli_error($link)); | |
|
|
63 | while($row = mysqli_fetch_assoc($rs)) | |
|
|
64 | { | |
|
|
65 | $ret[]= $row; | |
|
|
66 | } | |
|
|
67 | mysqli_free_result($rs); | |
|
|
68 | ||
|
|
69 | return $ret; | |
|
|
70 | } | |
|
|
71 | ||
|
|
72 | #Runs a query | |
|
|
73 | #Compresses the specified column in the returned columns into a single array | |
|
|
74 | function query_to_array($query, $col=0) | |
|
|
75 | { | |
|
|
76 | global $link; | |
|
|
77 | $ret = array(); | |
|
|
78 | $rs = mysqli_query($link,$query) or die(mysqli_error($link)); | |
|
|
79 | while($row = mysqli_fetch_array($rs)) | |
|
|
80 | { | |
|
|
81 | $ret[]= $row[0]; | |
|
|
82 | } | |
|
|
83 | mysqli_free_result($rs); | |
|
|
84 | ||
|
|
85 | return $ret; | |
|
|
86 | } | |
|
|
87 | ||
|
|
88 | function count_by_type($type) | |
|
|
89 | { | |
|
|
90 | global $link; | |
|
|
91 | $qr = mysqli_query($link,'SELECT COUNT(*) FROM strip WHERE type = '.(int)$type) or die(mysqli_error($link)); | |
|
|
92 | return current(mysqli_fetch_row($qr)); | |
|
|
93 | } | |
|
|
94 | ||
|
|
95 | function max_rant_id() | |
|
|
96 | { | |
|
|
97 | global $link; | |
|
|
98 | $qr = mysqli_query($link,'SELECT MAX(id) FROM rant WHERE published < NOW()') or die(mysqli_error($link)); | |
|
|
99 | return current(mysqli_fetch_row($qr)); | |
|
|
100 | } | |
|
|
101 | ||
|
|
102 | ||
|
|
103 | function max_transcript_strip_id() | |
|
|
104 | { | |
|
|
105 | global $link; | |
|
|
106 | $qr = mysqli_query($link,'SELECT MAX(strip) FROM transcript') or die(mysqli_error($link)); | |
|
|
107 | return current(mysqli_fetch_row($qr)); | |
|
|
108 | } | |
|
|
109 | ||
|
|
110 | function max_strip_id() | |
|
|
111 | { | |
|
|
112 | global $link; | |
|
|
113 | $qr = mysqli_query($link,'SELECT MAX(id) FROM strip WHERE published < NOW()') or die(mysqli_error($link)); | |
|
|
114 | return current(mysqli_fetch_row($qr)); | |
|
|
115 | } | |
|
|
116 | ||
|
|
117 | function load_strip($id) | |
|
|
118 | { | |
|
|
119 | global $link; | |
|
|
120 | $qr = mysqli_query($link,"SELECT UNIX_TIMESTAMP(s.published) as udate, | |
|
|
121 | s.title AS title, media.extension AS ext, s.type AS type, | |
|
|
122 | s.book AS book, s.page AS page, | |
|
|
123 | DATE_FORMAT(s.published, '%M %D, %Y') AS pubdate | |
|
|
124 | FROM media_t media, strip s | |
|
|
125 | WHERE s.media = media.id AND s.id = $id") or die(mysqli_error($link)); | |
|
|
126 | ||
|
|
127 | return mysqli_fetch_assoc($qr); | |
|
|
128 | } | |
|
|
129 | ||
|
|
130 | function load_transcript($id) | |
|
|
131 | { | |
|
|
132 | global $link; | |
|
|
133 | $qr = mysqli_query($link,"SELECT panel, speaker, speech | |
|
|
134 | FROM transcript WHERE strip = $id | |
|
|
135 | AND (transcript.speaker NOT LIKE \"#%\") | |
|
|
136 | ORDER BY panel, line") or die(mysqli_error($link)); | |
|
|
137 | return $qr; | |
|
|
138 | } | |
|
|
139 | ||
|
|
140 | function conditional_exit($mtime) | |
|
|
141 | { | |
|
|
142 | if(!PERFORM_CONDITIONAL_CACHE) | |
|
|
143 | return; | |
|
|
144 | ||
|
|
145 | $f_date = gmdate( 'D, d M Y H:i:s T', $mtime ); | |
|
|
146 | header("Last-Modified: $f_date"); | |
|
|
147 | ||
|
|
148 | if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $f_date) { | |
|
|
149 | header('HTTP/1.0 304 Not Modified'); | |
|
|
150 | exit(0); | |
|
|
151 | } | |
|
|
152 | } | |
|
|
153 | ||
|
|
154 | function mt_query($link,$sql) { | |
|
|
155 | global $link; | |
|
|
156 | $r = mysqli_query($link,$sql); | |
|
|
157 | if( !$r ) trigger_error("SQL Error", E_USER_ERROR); | |
|
|
158 | return $r; | |
|
|
159 | } | |
|
|
160 | ||
|
|
161 | function mtdie($errno, $errstr, $errfile, $errline, $errcontext) { | |
|
|
162 | $extra = ''; | |
|
|
163 | switch ($errno) { | |
|
|
164 | case E_NOTICE: | |
|
|
165 | break; | |
|
|
166 | case E_WARNING: // for SQL errors | |
|
|
167 | case E_USER_WARNING: | |
|
|
168 | case E_USER_NOTICE: | |
|
|
169 | ||
|
|
170 | case E_CORE_WARNING: | |
|
|
171 | case E_COMPILE_WARNING: | |
|
|
172 | case E_USER_ERROR: | |
|
|
173 | case E_ERROR: | |
|
|
174 | case E_PARSE: | |
|
|
175 | case E_CORE_ERROR: | |
|
|
176 | case E_COMPILE_ERROR: | |
|
|
177 | ||
|
|
178 | @header('Content-Type: text/html; charset=utf-8'); | |
|
|
179 | ||
|
|
180 | $message = "$errstr in $errfile at line $errline"; | |
|
|
181 | if (strcasecmp('sql', $errstr) == 0 ) { | |
|
|
182 | $message .= "\r\nSQL Error " .': ' . mysqli_error($link); | |
|
|
183 | } | |
|
|
184 | ||
|
|
185 | error_log( $message, 0 ); // Log to Syslog | |
|
|
186 | ||
|
|
187 | $message .= "\r\n\r\nBacktrace:"; | |
|
|
188 | $backtrace = array_reverse(debug_backtrace()); | |
|
|
189 | $i=2; | |
|
|
190 | $message .= "\r\n1: " . $err_context . " at $errfile:$errline"; | |
|
|
191 | foreach($backtrace as $k=>$call) { | |
|
|
192 | $message .= "\r\n" . str_pad("$i:", $i+4 ) . $call['function'] . '( ' . implode(', ', $call['args']) . ' ) at ' . $call['file'] . ':' . $call['line']; | |
|
|
193 | $i++; | |
|
|
194 | } | |
|
|
195 | $message .= "\r\n"; | |
|
|
196 | ||
|
|
197 | $message .= "\r\nRequest Details:" | |
|
|
198 | . "\r\nscript_url: " . $_SERVER["SCRIPT_URL"] | |
|
|
199 | . "\r\nquery_string: " . $_SERVER["QUERY_STRING"] | |
|
|
200 | . "\r\nremote_addr: " . $_SERVER["REMOTE_ADDR"] | |
|
|
201 | . "\r\nhttp_user_agent: " . $_SERVER["HTTP_USER_AGENT"]; | |
|
|
202 | print_r($message); | |
|
|
203 | error_log( "Megatokyo Site Error at " .date('Y-m-d H:i'). "\r\n\r\n$message\r\n", 1, SITE_CONTACT ); //, "Subject: Megatokyo Site Errors for " . date('Y-m-d') ); // Log to email | |
|
|
204 | ||
|
|
205 | // Log to user on screen | |
|
|
206 | ||
|
|
207 | ?> | |
|
|
208 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
|
|
209 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
|
|
210 | <head> | |
|
|
211 | <title><?php echo $title?$title:'Megatokyo Administration Editor'; ?></title> | |
|
|
212 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
|
|
213 | <style media="screen" type="text/css"> | |
|
|
214 | html { | |
|
|
215 | background: #eee; | |
|
|
216 | } | |
|
|
217 | body { | |
|
|
218 | background: #fff; | |
|
|
219 | color: #000; | |
|
|
220 | font-family: Georgia, "Times New Roman", Times, serif; | |
|
|
221 | margin-left: 25%; | |
|
|
222 | margin-right: 25%; | |
|
|
223 | padding: .2em 2em; | |
|
|
224 | } | |
|
|
225 | h1 { | |
|
|
226 | color: #006; | |
|
|
227 | font-dize: 18px; | |
|
|
228 | font-weight: lighter; | |
|
|
229 | } | |
|
|
230 | h2 { | |
|
|
231 | font-size: 16px; | |
|
|
232 | color: red; | |
|
|
233 | } | |
|
|
234 | p, li, dt { | |
|
|
235 | line-height: 140%; | |
|
|
236 | padding-bottom: 2px; | |
|
|
237 | } | |
|
|
238 | ul, ol { | |
|
|
239 | padding: 5px 5px 5px 20px; | |
|
|
240 | } | |
|
|
241 | #logo { | |
|
|
242 | margin-bottom: 2em; | |
|
|
243 | } | |
|
|
244 | --> | |
|
|
245 | </style> | |
|
|
246 | </head> | |
|
|
247 | <body> | |
|
|
248 | <h1 id="Logo">Megatokyo</h1> | |
|
|
249 | <h2>Encountered a problem servicing your request.</h2> | |
|
|
250 | <p><?php echo date('Y-m-d H:i'); ?> - Administrators have been notified, we'll try to have things fixed shortly.</p> | |
|
|
251 | <p><a href="<?php SITE_HOST . SITE_PATH; ?>">‹ Back to Megatokyo.com</a></p> | |
|
|
252 | </body> | |
|
|
253 | </html> | |
|
|
254 | <?php die(); | |
|
|
255 | break; | |
|
|
256 | ||
|
|
257 | } | |
|
|
258 | } | |
|
|
259 | ||
|
|
260 | function term($code) | |
|
|
261 | { | |
|
|
262 | header("HTTP/1.0 $code"); | |
|
|
263 | exit(0); | |
|
|
264 | } | |
|
|
265 | ||
|
|
266 | function utfentities($string) | |
|
|
267 | { | |
|
|
268 | return htmlentities($string, ENT_COMPAT, 'UTF-8'); | |
|
|
269 | } | |
|
|
270 | ||
|
|
271 | ||
|
|
272 | /* BEGIN FRONT END HTML DISPLAY FUNCTIONS */ | |
|
|
273 | ||
|
|
274 | function ad_template($zone, $n) { } | |
|
|
275 | ||
|
|
276 | /* | |
|
|
277 | { ?><span class="glowwrap"><script type="text/javascript"><!--// <![CDATA[ | |
|
|
278 | OA_show(<?php echo $zone; ?>); | |
|
|
279 | // ]]> --></script></span> | |
|
|
280 | <noscript> | |
|
|
281 | <?php printf('<a href="%s%s/adclick.php?n=%s"><img src="%s%s/adview.php?what=zone:%d&n=%s" alt="" /></a>', ADS_HOST, ADS_PATH, $n, ADS_HOST, ADS_PATH, $zone, $n) ?> | |
|
|
282 | </noscript> | |
|
|
283 | <?php } | |
|
|
284 | */ | |
|
|
285 | ||
|
|
286 | function pagehead($caller, $title = 'relax, we understand j00', $style='') | |
|
|
287 | { ?> | |
|
|
288 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
|
|
289 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
|
|
290 | <head> | |
|
|
291 | <meta name="description" content="MegaTokyo the Comic" /> | |
|
|
292 | <meta name="author" content="Frederick M. Gallagher III" /> | |
|
|
293 | <meta name="generator" content="Alan J Castonguay, Robert Sherby, Jeremy Wagner-Kaiser, Shawn Morford (!! nathanbp, jrl !!)" /> | |
|
|
294 | <meta name="keywords" content="megatokyo.com, online comic, gaming, japanese animation, anime, fan art, pop culture, japan, nihongo, nihonjin, otaku, photoshop, fansubs, computer graphics, fred gallagher" /> | |
|
|
295 | ||
|
|
296 | <base href="<?php echo SITE_HOST.SITE_PATH ?>/" /> | |
|
|
297 | ||
|
|
298 | <title>MegaTokyo - <?php echo $title ?></title> | |
|
|
299 | <link type="image/x-icon" rel="shortcut icon" href="favicon.ico" /> | |
|
|
300 | <link type="text/css" rel="stylesheet" href="main.css" /> | |
|
|
301 | <link type="text/css" rel="stylesheet" href="<?php echo $caller ?>.css" /> | |
|
|
302 | ||
|
|
303 | <?php | |
|
|
304 | if($style != '') | |
|
|
305 | { | |
|
|
306 | echo '<style type="text/css">'; | |
|
|
307 | echo $style; | |
|
|
308 | echo '</style>'; | |
|
|
309 | } | |
|
|
310 | ?> | |
|
|
311 | <link type="application/rss+xml" rel="alternate" title="Strips Only" href="rss/strips.xml" /> | |
|
|
312 | <link type="application/rss+xml" rel="alternate" title="Rants Only" href="rss/rants.xml" /> | |
|
|
313 | <link type="application/rss+xml" rel="alternate" title="Strips and Rants" href="rss/megatokyo.xml" /> | |
|
|
314 | ||
|
|
315 | <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
|
|
316 | <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> | |
|
|
317 | ||
|
|
318 | <script type="text/javascript" src="index.js"></script><?php /* | |
|
|
319 | <script type='text/javascript' src='<?php echo ADS_HOST, ADS_PATH ?>/www/delivery/spcjs.php?id=1'></script> */ ?> | |
|
|
320 | <script type="text/javascript" src="resources.js"></script> | |
|
|
321 | <?php include('analytics.php'); ?> | |
|
|
322 | </head> | |
|
|
323 | ||
|
|
324 | <body> | |
|
|
325 | <div id="adbar"> | |
|
|
326 | <a id="megagear-ad" href="http://www.megagear.com"><img src="parts/mt-head-left-MG.png" alt="MegaGear" /></a><?php // ad_template(1, 'a2eed23e') ?> | |
|
|
327 | <a id="kickstarter-ad" href="http://vn.megatokyo.com"><img src="extra/MTVN-ADBANNER-animated-02.gif" alt="MegaTokyo Visual Novel" /></a> | |
|
|
328 | <a id="cologuys-ad" href="http://www.megagear.com"><img src="parts/mt-head-left-MG.png" alt="MegaGear" /></a> | |
|
|
329 | </div> | |
|
|
330 | ||
|
|
331 | <div id="banner"> <div class="blackbar"><span></span>online webcomic / manga / doujinshi</div> | |
|
|
332 | <h1><a href="index.php"><img src="parts/mt-masthead2010.png" alt="megatokyo - relax, we understand j00" /></a></h1> | |
|
|
333 | <ul class="nl" style="letter-spacing: -1px;"> | |
|
|
334 | <li><a href="faq">FAQ</a></li> | |
|
|
335 | <li>·</li> | |
|
|
336 | <li><a href="story">story</a></li> | |
|
|
337 | <li>·</li> | |
|
|
338 | <li><a href="characters.php">characters</a></li> | |
|
|
339 | <li>·</li> | |
|
|
340 | <li><a href="fredarting" title="Watch Fred draw live on UStream!">fredarting</a></li> | |
|
|
341 | <li>·</li> | |
|
|
342 | <li><a href="http://www.megagear.com" title="Buy stuff from the MegaGear store!">merchandise</a></li> | |
|
|
343 | <li>·</li> | |
|
|
344 | <li><a href="http://vn.megatokyo.com" title="Megatokyo Visual Novel">visual novel</a></li> | |
|
|
345 | <li>·</li> | |
|
|
346 | <li><a href="http://forums.megatokyo.com">forums</a></li> | |
|
|
347 | <li>·</li> | |
|
|
348 | <li><a href="community">community</a></li> | |
|
|
349 | <li>·</li> | |
|
|
350 | <li><a href="search">search</a></li> | |
|
|
351 | </ul> | |
|
|
352 | </div> | |
|
|
353 | <?php } | |
|
|
354 | ||
|
|
355 | function pagefoot() | |
|
|
356 | { ?> | |
|
|
357 | <div id="credits"> | |
|
|
358 | <h2><span></span>credits</h2> | |
|
|
359 | <p>megatokyo the comic - | |
|
|
360 | copyright © 2000 - <?php echo date('Y'); ?> | |
|
|
361 | <a href="mailto:piro@megatokyo.com">fred gallagher</a>. | |
|
|
362 | all rights reserved.</p> | |
|
|
363 | <p>'megatokyo' is a registered trademark of | |
|
|
364 | <a href="http://www.fredart.com">fredart studios llc</a>.</p> | |
|
|
365 | </div><?php | |
|
|
366 | } | |
|
|
367 | ||
|
|
368 | ||
|
|
369 | /* OPEN THE DATABASE */ | |
|
|
370 | ||
|
|
371 | $link = @mysqli_connect(DB_SERVER, DB_READ_USER, DB_READ_PASS, DB_NAME) or trigger_error('Problem connecting to the SQL database server: '.mysqli_error($link), E_USER_ERROR); | |
|
|
372 | ?> | |
| This diff has been collapsed as it changes many lines, (614 lines changed) Show them Hide them | |||
| @@ -0,0 +1,614 | |||
|
|
1 | h2, | |
|
|
2 | h3 a { | |
|
|
3 | margin: 0px; | |
|
|
4 | padding: 0px; | |
|
|
5 | color: #f6b33d; | |
|
|
6 | } | |
|
|
7 | ||
|
|
8 | .content .column { width:330px } | |
|
|
9 | ||
|
|
10 | /* Dress up the comic */ | |
|
|
11 | #comic { | |
|
|
12 | margin-top: 0px; | |
|
|
13 | height: 1%; /* Give IE hasLayout to fix a neg margin bug */ | |
|
|
14 | width: auto; | |
|
|
15 | } | |
|
|
16 | ||
|
|
17 | ||
|
|
18 | #comic .nl { | |
|
|
19 | padding-top: 5px; | |
|
|
20 | padding-bottom: 5px; | |
|
|
21 | background-color: black; | |
|
|
22 | margin: -5em auto 0px; | |
|
|
23 | border-top: solid 5em #b7bfc7; | |
|
|
24 | width: 700px; | |
|
|
25 | text-align: center; | |
|
|
26 | } | |
|
|
27 | ||
|
|
28 | #comic .navpanel { | |
|
|
29 | position: relative; | |
|
|
30 | margin: auto; | |
|
|
31 | } | |
|
|
32 | ||
|
|
33 | #comic div.navpanel { | |
|
|
34 | position: relative; /* Make IE draw panel above glow border */ | |
|
|
35 | z-index: 1; | |
|
|
36 | height: 33px; | |
|
|
37 | padding: 0px; | |
|
|
38 | width: 650px; | |
|
|
39 | } | |
|
|
40 | ||
|
|
41 | #comic form.navpanel { | |
|
|
42 | margin-top: -28px; | |
|
|
43 | padding: 0px; | |
|
|
44 | width: 625px; | |
|
|
45 | } | |
|
|
46 | ||
|
|
47 | /* Need to gank the button out of the document flow somehow */ | |
|
|
48 | #comic .search-field { position:relative } | |
|
|
49 | #comic .search-field a { position:absolute } | |
|
|
50 | ||
|
|
51 | #comic .search-filter { | |
|
|
52 | padding:0px 25px; | |
|
|
53 | margin-bottom: 15px; | |
|
|
54 | } | |
|
|
55 | ||
|
|
56 | #comic .navpanel .navcontrols { | |
|
|
57 | position: absolute; | |
|
|
58 | z-index: 1; | |
|
|
59 | } | |
|
|
60 | ||
|
|
61 | #comic div.navpanel .navcontrols { right:25px } | |
|
|
62 | #comic form.navpanel .navcontrols { right:0px } | |
|
|
63 | ||
|
|
64 | #comic .navpanel .navcontrols ul { | |
|
|
65 | width: 124px; height: 33px; | |
|
|
66 | margin: 0px; | |
|
|
67 | padding: 0px; | |
|
|
68 | clear: both; | |
|
|
69 | } | |
|
|
70 | ||
|
|
71 | #comic .navpanel .navcontrols ul li { | |
|
|
72 | display: block; | |
|
|
73 | float: left; | |
|
|
74 | } | |
|
|
75 | ||
|
|
76 | #comic .navpanel .navcontrols ul li a, | |
|
|
77 | #comic .navpanel .navcontrols ul li span { | |
|
|
78 | display: block; | |
|
|
79 | padding-top: 33px; | |
|
|
80 | width: 62px; | |
|
|
81 | height: 0px; | |
|
|
82 | overflow: hidden; | |
|
|
83 | } | |
|
|
84 | ||
|
|
85 | ||
|
|
86 | /* Top Nav */ | |
|
|
87 | ||
|
|
88 | #comic .navpanel .navcontrols.top li.prev { | |
|
|
89 | background: url(parts/nav2-top-prev.png) no-repeat; | |
|
|
90 | } | |
|
|
91 | ||
|
|
92 | #comic .navpanel .navcontrols.top li.next { | |
|
|
93 | background: url(parts/nav2-top-next.png) no-repeat; | |
|
|
94 | } | |
|
|
95 | ||
|
|
96 | #comic .navpanel .navcontrols.top li.prevoff { | |
|
|
97 | background: url(parts/nav2-top-prevoff.png) no-repeat; | |
|
|
98 | } | |
|
|
99 | ||
|
|
100 | #comic .navpanel .navcontrols.top li.nextoff { | |
|
|
101 | background: url(parts/nav2-top-nextoff.png) no-repeat; | |
|
|
102 | } | |
|
|
103 | ||
|
|
104 | /* Bottom Nav */ | |
|
|
105 | ||
|
|
106 | #comic .navpanel .navcontrols.bottom li.prev { | |
|
|
107 | background: url(parts/nav2-bottom-prev.png) no-repeat; | |
|
|
108 | } | |
|
|
109 | ||
|
|
110 | #comic .navpanel .navcontrols.bottom li.next { | |
|
|
111 | background: url(parts/nav2-bottom-next.png) no-repeat; | |
|
|
112 | } | |
|
|
113 | ||
|
|
114 | #comic .navpanel .navcontrols.bottom li.prevoff { | |
|
|
115 | background: url(parts/nav2-bottom-prevoff.png) no-repeat; | |
|
|
116 | } | |
|
|
117 | ||
|
|
118 | #comic .navpanel .navcontrols.bottom li.nextoff { | |
|
|
119 | background: url(parts/nav2-bottom-nextoff.png) no-repeat; | |
|
|
120 | } | |
|
|
121 | ||
|
|
122 | /* Form Nav only for disable */ | |
|
|
123 | ||
|
|
124 | #comic .navpanel .navcontrols li.findprevoff { | |
|
|
125 | background: url(parts/nav2-prevfindoff.png) no-repeat; | |
|
|
126 | } | |
|
|
127 | ||
|
|
128 | #comic .navpanel .navcontrols li.findnextoff { | |
|
|
129 | background: url(parts/nav2-nextfindoff.png) no-repeat; | |
|
|
130 | } | |
|
|
131 | ||
|
|
132 | #comic .navpanel .navcontrols ul#searchprevnext li { | |
|
|
133 | height: 33px; | |
|
|
134 | } | |
|
|
135 | ||
|
|
136 | #comic div.navpanel #title { | |
|
|
137 | padding: 1ex; | |
|
|
138 | } | |
|
|
139 | ||
|
|
140 | #comic .navpanel .search-filter { | |
|
|
141 | margin-bottom: 15px; | |
|
|
142 | } | |
|
|
143 | ||
|
|
144 | #comic .navpanel #q { | |
|
|
145 | width: 350px; | |
|
|
146 | } | |
|
|
147 | ||
|
|
148 | #comic .navpanel #go, | |
|
|
149 | #comic .navpanel #iego { | |
|
|
150 | vertical-align: middle; | |
|
|
151 | padding-bottom: 2px; | |
|
|
152 | } | |
|
|
153 | ||
|
|
154 | #comic .transcript { | |
|
|
155 | list-style-type:none; | |
|
|
156 | padding: 66px 50px; | |
|
|
157 | margin: 0px; | |
|
|
158 | } | |
|
|
159 | ||
|
|
160 | #comic .transcript .panelhead { | |
|
|
161 | font-size: larger; | |
|
|
162 | font-weight: bold; | |
|
|
163 | } | |
|
|
164 | ||
|
|
165 | #comic .transcript dl { padding-left:50px } | |
|
|
166 | #comic .transcript dt { | |
|
|
167 | float: left; | |
|
|
168 | padding-right: 1em; | |
|
|
169 | font-weight: bold; | |
|
|
170 | } | |
|
|
171 | ||
|
|
172 | #comic .transcript dd { | |
|
|
173 | margin-left: 5.5em; | |
|
|
174 | padding-left: 0px; | |
|
|
175 | padding-bottom: 0.5ex; | |
|
|
176 | } | |
|
|
177 | ||
|
|
178 | /* Make the archive link stand out */ | |
|
|
179 | #comic #archivelink { background-color:#b7bfc7 } | |
|
|
180 | #comic #archivelink a { color:black } | |
|
|
181 | #comic #archivelink a:hover { color:#eb5252 } | |
|
|
182 | ||
|
|
183 | /* Boxes between the comic and the rants */ | |
|
|
184 | #megagear { text-align:center } | |
|
|
185 | ||
|
|
186 | #newsbox a { color:#f6b33d } | |
|
|
187 | #newsbox ul { | |
|
|
188 | margin-left: 3ex; | |
|
|
189 | padding-left: 0px; | |
|
|
190 | } | |
|
|
191 | #newsbox h3 { | |
|
|
192 | text-align: center; | |
|
|
193 | } | |
|
|
194 | #support { font-size: 80%; } | |
|
|
195 | ||
|
|
196 | #status dl { | |
|
|
197 | margin: 1em; | |
|
|
198 | } | |
|
|
199 | ||
|
|
200 | #status dt { | |
|
|
201 | float: left; | |
|
|
202 | } | |
|
|
203 | ||
|
|
204 | #status dd { | |
|
|
205 | margin-left: 7em; | |
|
|
206 | color: #f6b33d; | |
|
|
207 | } | |
|
|
208 | ||
|
|
209 | #status dd div#percentbox { | |
|
|
210 | padding: 1px; | |
|
|
211 | width: 90%; | |
|
|
212 | border: 1px solid #567; | |
|
|
213 | margin: 0px; | |
|
|
214 | } | |
|
|
215 | ||
|
|
216 | #newsbox div.thewrap, | |
|
|
217 | #support div.thewrap { | |
|
|
218 | border-bottom:none; | |
|
|
219 | margin:0; | |
|
|
220 | padding:0; | |
|
|
221 | background: url(parts/twitter-seperator.png) 6px 0 #23272B; | |
|
|
222 | } | |
|
|
223 | ||
|
|
224 | /* Fix a bug caused by OpenAds injecting a <div> into the status area which | |
|
|
225 | * partially obscures the 'support' heading | |
|
|
226 | */ | |
|
|
227 | #support div.thewrap div { | |
|
|
228 | background-color: transparent; | |
|
|
229 | } | |
|
|
230 | ||
|
|
231 | .content div.column.leftcol, | |
|
|
232 | .content div.column.rightcol { border: none; } | |
|
|
233 | ||
|
|
234 | .content div#status, | |
|
|
235 | .content div#fred_twitter { border: none; background: none; } | |
|
|
236 | ||
|
|
237 | #support { border-bottom: 5px solid black; } | |
|
|
238 | ||
|
|
239 | #status ul, #fred_twitter ul { margin-top:0px } | |
|
|
240 | ||
|
|
241 | #status li, #fred_twitter li { | |
|
|
242 | padding-top: 4px; | |
|
|
243 | padding-right: 1em; | |
|
|
244 | } | |
|
|
245 | ||
|
|
246 | #newsbox { | |
|
|
247 | overflow: visible; | |
|
|
248 | height: 60px; | |
|
|
249 | } | |
|
|
250 | ||
|
|
251 | /* | |
|
|
252 | #newsbox .leftcol { | |
|
|
253 | left: 5px; | |
|
|
254 | } | |
|
|
255 | ||
|
|
256 | #newsbox .rightcol { | |
|
|
257 | right: 5px; | |
|
|
258 | } | |
|
|
259 | */ | |
|
|
260 | ||
|
|
261 | #newsbox div { | |
|
|
262 | border:none; | |
|
|
263 | overflow:visible; | |
|
|
264 | } | |
|
|
265 | ||
|
|
266 | #blogbits { | |
|
|
267 | padding: 0px; | |
|
|
268 | width: 370px; | |
|
|
269 | } | |
|
|
270 | ||
|
|
271 | #blogbits ul | |
|
|
272 | { | |
|
|
273 | margin: 0px; | |
|
|
274 | padding: 0px; | |
|
|
275 | text-align: center; | |
|
|
276 | list-style-type: none; | |
|
|
277 | } | |
|
|
278 | ||
|
|
279 | #blogbits ul#blogbitslist { margin-left:250px } | |
|
|
280 | #blogbits ul#feed-list { | |
|
|
281 | margin: auto; | |
|
|
282 | } | |
|
|
283 | ||
|
|
284 | #blogbits #feed-list ul { | |
|
|
285 | display: none; | |
|
|
286 | position: absolute; | |
|
|
287 | z-index: 1; | |
|
|
288 | border: solid 5px black; | |
|
|
289 | width: 400px; | |
|
|
290 | background: #4c565e; | |
|
|
291 | text-align: left; | |
|
|
292 | } | |
|
|
293 | ||
|
|
294 | #blogbits ul#feed-list li { | |
|
|
295 | display: inline-block; | |
|
|
296 | margin: 0px; | |
|
|
297 | padding: 7.5px 4px; | |
|
|
298 | color: #B7BFC7; | |
|
|
299 | } | |
|
|
300 | ||
|
|
301 | #blogbits a.rightcol img, | |
|
|
302 | #blogbits a.leftcol img { | |
|
|
303 | width: 180px; | |
|
|
304 | } | |
|
|
305 | ||
|
|
306 | #blogbits a.rightcol img { | |
|
|
307 | padding-left: 5px; | |
|
|
308 | } | |
|
|
309 | ||
|
|
310 | #blogbits a.leftcol img { | |
|
|
311 | padding-right: 5px; | |
|
|
312 | } | |
|
|
313 | ||
|
|
314 | #facebook img { | |
|
|
315 | width: 300px; | |
|
|
316 | height: 60px; | |
|
|
317 | } | |
|
|
318 | ||
|
|
319 | #facebook { | |
|
|
320 | border: none; | |
|
|
321 | padding: 0px; | |
|
|
322 | } | |
|
|
323 | ||
|
|
324 | #support { position:relative } | |
|
|
325 | ||
|
|
326 | #support .thewrap .column .glowwrap, | |
|
|
327 | #support .thewrap .column .glowwrap a { | |
|
|
328 | display: block; | |
|
|
329 | width: 100%; | |
|
|
330 | } | |
|
|
331 | ||
|
|
332 | #support .thewrap .column .glowwrap img, | |
|
|
333 | #support .thewrap .column .glowwrap embed { | |
|
|
334 | display: block; | |
|
|
335 | margin: auto; | |
|
|
336 | } | |
|
|
337 | ||
|
|
338 | #support .glowwrap div { | |
|
|
339 | border: none; | |
|
|
340 | } | |
|
|
341 | ||
|
|
342 | #newsbox .adinfo, #support .adinfo { | |
|
|
343 | position: absolute; | |
|
|
344 | top: 2px; | |
|
|
345 | right: 10px; | |
|
|
346 | height: 16px; | |
|
|
347 | ||
|
|
348 | margin: 0px; | |
|
|
349 | border: 0px; | |
|
|
350 | padding: 0px; | |
|
|
351 | ||
|
|
352 | background-color: transparent; | |
|
|
353 | } | |
|
|
354 | ||
|
|
355 | #newsbox .adinfo a, #support .adinfo a { | |
|
|
356 | color: #f6b33d; | |
|
|
357 | font-size: 11px; | |
|
|
358 | } | |
|
|
359 | ||
|
|
360 | #newsbox .adinfo p, #support .adinfo p { | |
|
|
361 | margin: 0px 10px 0px 0px; | |
|
|
362 | } | |
|
|
363 | ||
|
|
364 | /* Rant Columns */ | |
|
|
365 | #console { | |
|
|
366 | overflow: hidden; | |
|
|
367 | } | |
|
|
368 | ||
|
|
369 | #console h3 { | |
|
|
370 | padding: 0.75ex; | |
|
|
371 | background-color: #757b81; | |
|
|
372 | ||
|
|
373 | font-family: monospace; | |
|
|
374 | font-size: xx-large; | |
|
|
375 | text-align: center; | |
|
|
376 | } | |
|
|
377 | ||
|
|
378 | #console .date, | |
|
|
379 | #console .rantbody { | |
|
|
380 | margin: 5px; | |
|
|
381 | padding: 5px; | |
|
|
382 | width: 330px; | |
|
|
383 | } | |
|
|
384 | ||
|
|
385 | #feed-list h4 { | |
|
|
386 | margin: auto; | |
|
|
387 | color: #F6B33D; | |
|
|
388 | text-align: center; | |
|
|
389 | font-size: medium; | |
|
|
390 | width: 400px; | |
|
|
391 | } | |
|
|
392 | ||
|
|
393 | #console h4 { | |
|
|
394 | margin: auto; | |
|
|
395 | padding: 0.75ex 0px; | |
|
|
396 | width: 330px; | |
|
|
397 | ||
|
|
398 | background-color: #757b81; | |
|
|
399 | color: #F6B33D; | |
|
|
400 | ||
|
|
401 | text-align: center; | |
|
|
402 | font-size: medium; | |
|
|
403 | } | |
|
|
404 | ||
|
|
405 | #console h4 a {color:#f6b33d} | |
|
|
406 | ||
|
|
407 | #console .rantbody { | |
|
|
408 | margin-top: 0px; | |
|
|
409 | padding-top: 0px; | |
|
|
410 | } | |
|
|
411 | ||
|
|
412 | /* force <pre> to not break our boxes */ | |
|
|
413 | #console .rantbody pre { | |
|
|
414 | white-space: pre-wrap; | |
|
|
415 | white-space: -moz-pre-wrap; | |
|
|
416 | word-wrap: break-word; | |
|
|
417 | } | |
|
|
418 | ||
|
|
419 | #console .leftcol { | |
|
|
420 | width: 350px; | |
|
|
421 | color: #b7bfc7; | |
|
|
422 | } | |
|
|
423 | ||
|
|
424 | #console .rightcol { | |
|
|
425 | width: 350px; | |
|
|
426 | color: #f6b33D; | |
|
|
427 | } | |
|
|
428 | ||
|
|
429 | #console .rantimage { | |
|
|
430 | background: url(parts/mt-glow-mainrant-vert.png) repeat-y; | |
|
|
431 | width: 350px; | |
|
|
432 | height: 285px; | |
|
|
433 | } | |
|
|
434 | ||
|
|
435 | #console .ri-top { | |
|
|
436 | background: url(parts/mt-glow-mainrant-top.png) top no-repeat; | |
|
|
437 | width: 350px; | |
|
|
438 | height: 245px; | |
|
|
439 | } | |
|
|
440 | ||
|
|
441 | #console .ri-bottom { | |
|
|
442 | background: url(parts/mt-glow-mainrant-bottom.png) bottom no-repeat; | |
|
|
443 | width: 350px; | |
|
|
444 | } | |
|
|
445 | ||
|
|
446 | #console .ri-matte { | |
|
|
447 | padding: 20px 0px 20px 0px; | |
|
|
448 | margin: 0px 25px; | |
|
|
449 | width: 300px; | |
|
|
450 | height: 245px; | |
|
|
451 | } | |
|
|
452 | ||
|
|
453 | #console .rantimage p, | |
|
|
454 | #console .rantimage p img { | |
|
|
455 | float: none; | |
|
|
456 | width: 300px; | |
|
|
457 | height: 245px; | |
|
|
458 | text-align: left; | |
|
|
459 | padding: 0px; | |
|
|
460 | margin: 0px; | |
|
|
461 | } | |
|
|
462 | ||
|
|
463 | #console .rantnav { | |
|
|
464 | margin: 2em 0px; | |
|
|
465 | text-align: center; | |
|
|
466 | } | |
|
|
467 | ||
|
|
468 | #console .nameplate { | |
|
|
469 | background-color: #757B81; | |
|
|
470 | width: 350px | |
|
|
471 | } | |
|
|
472 | ||
|
|
473 | #console .nameplate span { | |
|
|
474 | display: block; | |
|
|
475 | height: 48px; | |
|
|
476 | background-repeat: no-repeat; | |
|
|
477 | background-position: top center; | |
|
|
478 | } | |
|
|
479 | ||
|
|
480 | #console .nameplate h3 { | |
|
|
481 | display: none; | |
|
|
482 | } | |
|
|
483 | ||
|
|
484 | #console .oldrant { | |
|
|
485 | margin-top: 1.5em; | |
|
|
486 | border-top: medium solid #B7BFC7; | |
|
|
487 | padding-top: 1em; | |
|
|
488 | width: 345px; | |
|
|
489 | } | |
|
|
490 | ||
|
|
491 | #console .oldrant .rantimage { | |
|
|
492 | float:left; | |
|
|
493 | background: url(parts/mt-glow-oldrant-vert.png) repeat-y; | |
|
|
494 | width: 176px; | |
|
|
495 | height: 141px; | |
|
|
496 | } | |
|
|
497 | ||
|
|
498 | #console .oldrant .ri-top { | |
|
|
499 | background: url(parts/mt-glow-oldrant-top.png) top no-repeat; | |
|
|
500 | width: 178px; | |
|
|
501 | height: 123px; | |
|
|
502 | } | |
|
|
503 | ||
|
|
504 | #console .oldrant .ri-bottom { | |
|
|
505 | background: url(parts/mt-glow-oldrant-bottom.png) bottom no-repeat; | |
|
|
506 | width: 178px; | |
|
|
507 | } | |
|
|
508 | ||
|
|
509 | #console .oldrant .ri-matte { | |
|
|
510 | padding: 9px 0px 9px 0px; | |
|
|
511 | margin: 0px 13px; | |
|
|
512 | width: 150px; | |
|
|
513 | height: 123px; | |
|
|
514 | } | |
|
|
515 | ||
|
|
516 | #console .oldrant .rantimage p, | |
|
|
517 | #console .oldrant .rantimage p img { | |
|
|
518 | float: none; | |
|
|
519 | width: 150px; | |
|
|
520 | height: 123px; | |
|
|
521 | text-align: left; | |
|
|
522 | padding: 0px; | |
|
|
523 | margin: 0px; | |
|
|
524 | } | |
|
|
525 | ||
|
|
526 | #console .oldrant .nameplate { | |
|
|
527 | margin-top: 43px; | |
|
|
528 | background-color: #757B81; | |
|
|
529 | width: 150px; | |
|
|
530 | float: right; | |
|
|
531 | } | |
|
|
532 | ||
|
|
533 | #console .oldrant h4 { | |
|
|
534 | float: right; | |
|
|
535 | margin:5px 0pt 5px 5px; | |
|
|
536 | } | |
|
|
537 | ||
|
|
538 | /* Shaded borders around images */ | |
|
|
539 | #strip, | |
|
|
540 | #strip span { | |
|
|
541 | display: block; /* Everyone treat <span> like <div> */ | |
|
|
542 | display: inline-block; /* Shrinkwrap blocks for IE */ | |
|
|
543 | } | |
|
|
544 | ||
|
|
545 | /* hasLayout */ | |
|
|
546 | * html #strip, * html #strip span { height: 1%; } | |
|
|
547 | ||
|
|
548 | #strip { | |
|
|
549 | display: table; /* Shrinkwrap blocks for everyone else */ | |
|
|
550 | position: relative; | |
|
|
551 | margin: -33px auto 0px; | |
|
|
552 | min-width: 650px; | |
|
|
553 | } | |
|
|
554 | ||
|
|
555 | div#strip { | |
|
|
556 | width:700px; | |
|
|
557 | background-color: white; | |
|
|
558 | } | |
|
|
559 | ||
|
|
560 | #strip-tl { | |
|
|
561 | background: url(parts/mt-corner-UL.png) no-repeat left top; | |
|
|
562 | } | |
|
|
563 | ||
|
|
564 | #strip-tr { | |
|
|
565 | background: url(parts/mt-corner-UR.png) no-repeat right top; | |
|
|
566 | } | |
|
|
567 | ||
|
|
568 | #strip-t { | |
|
|
569 | background: url(parts/mt-slice-vert-top.png) repeat-x top; | |
|
|
570 | } | |
|
|
571 | ||
|
|
572 | #strip-bl { | |
|
|
573 | background: url(parts/mt-corner-LL.png) no-repeat left bottom; | |
|
|
574 | } | |
|
|
575 | ||
|
|
576 | #strip-br { | |
|
|
577 | background: url(parts/mt-corner-LR.png) no-repeat right bottom; | |
|
|
578 | } | |
|
|
579 | ||
|
|
580 | #strip-b { | |
|
|
581 | background: url(parts/mt-slice-vert-bottom.png) repeat-x bottom; | |
|
|
582 | } | |
|
|
583 | ||
|
|
584 | #strip-l { | |
|
|
585 | background: url(parts/mt-shadow-vert-left.png) repeat-y left; | |
|
|
586 | } | |
|
|
587 | ||
|
|
588 | #strip-r { | |
|
|
589 | background: url(parts/mt-shadow-vert-right.png) repeat-y right; | |
|
|
590 | } | |
|
|
591 | ||
|
|
592 | #strip img { | |
|
|
593 | margin: 33px 25px; | |
|
|
594 | } | |
|
|
595 | ||
|
|
596 | #strip iframe { | |
|
|
597 | border: none; | |
|
|
598 | margin: 33px 25px; | |
|
|
599 | width: 1024px; | |
|
|
600 | height: 576px; | |
|
|
601 | } | |
|
|
602 | ||
|
|
603 | #strip-transcript { | |
|
|
604 | padding: 10px 10px 10px 10px; | |
|
|
605 | } | |
|
|
606 | ||
|
|
607 | /* Center the comic */ | |
|
|
608 | #comic { text-align:center } | |
|
|
609 | #comic * { text-align:left } | |
|
|
610 | ||
|
|
611 | /* Overload header texts */ | |
|
|
612 | #metabox h2 span { background: url(parts/mt-blk_bar-metabox.png) no-repeat } | |
|
|
613 | #support h2 span { background: url(parts/mt-blk_bar-support.png) no-repeat } | |
|
|
614 | #console h2 span { background: url(parts/mt-blk_bar-console.png) no-repeat } | |
| @@ -0,0 +1,13 | |||
|
|
1 | $(document).ready(function() { | |
|
|
2 | /* Load up the Twitters and UI */ | |
|
|
3 | /* XXX This doesn't work anymore. | |
|
|
4 | $.getJSON('https://twitter.com/statuses/user_timeline/megatokyo.json?count=3&callback=?', function(obj) { | |
|
|
5 | $('#feed-twitter-megatokyo').append(twitterToHTML(obj)); | |
|
|
6 | $('#feed-twitter-megatokyo').hover(function(){ $(this).children('ul').show() }, function(){ $(this).children('ul').hide() }); | |
|
|
7 | }); | |
|
|
8 | $.getJSON('https://twitter.com/statuses/user_timeline/fredrin.json?count=3&callback=?', function(obj) { | |
|
|
9 | $('#feed-twitter-fredrin').append(twitterToHTML(obj)); | |
|
|
10 | $('#feed-twitter-fredrin').hover(function(){ $(this).children('ul').show() }, function(){ $(this).children('ul').hide() }); | |
|
|
11 | }); | |
|
|
12 | */ | |
|
|
13 | }); | |
| This diff has been collapsed as it changes many lines, (504 lines changed) Show them Hide them | |||
| @@ -0,0 +1,504 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | /* Bring an end to that GET string and load the strip */ | |
|
|
6 | if(isset($_GET['strip_id']) && ctype_digit($_GET['strip_id'])) { | |
|
|
7 | $MAX_METHOD_ID = max_strip_id(); | |
|
|
8 | $EFFECTIVE_ID = $_GET['strip_id']; | |
|
|
9 | $METHOD = 'strip'; | |
|
|
10 | } elseif(isset($_GET['transcript_id']) && ctype_digit($_GET['transcript_id'])) { | |
|
|
11 | $MAX_METHOD_ID = max_transcript_strip_id(); | |
|
|
12 | $EFFECTIVE_ID = $_GET['transcript_id']; | |
|
|
13 | $METHOD = 'transcript'; | |
|
|
14 | } elseif(isset($_GET['rant_id']) && ctype_digit($_GET['rant_id'])) { | |
|
|
15 | if($_GET['rant_id'] < 0) | |
|
|
16 | term(404); | |
|
|
17 | ||
|
|
18 | $EFFECTIVE_ID = strip_id_from_rant_id($_GET['rant_id']); | |
|
|
19 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
20 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$EFFECTIVE_ID#rant".$_GET['rant_id']); | |
|
|
21 | exit(0); | |
|
|
22 | } else { | |
|
|
23 | $EFFECTIVE_ID = $MAX_METHOD_ID = max_strip_id(); | |
|
|
24 | $METHOD = 'strip'; | |
|
|
25 | } | |
|
|
26 | ||
|
|
27 | if($EFFECTIVE_ID < 0 || $EFFECTIVE_ID > $MAX_METHOD_ID) | |
|
|
28 | { | |
|
|
29 | header('HTTP/1.0 404 Not Found'); | |
|
|
30 | $EFFECTIVE_ID = $MAX_METHOD_ID; | |
|
|
31 | } | |
|
|
32 | ||
|
|
33 | #$MTIME = mysqli_query($link,"SELECT UNIX_TIMESTAMP(MAX(pd)) | |
|
|
34 | # FROM (SELECT MAX(pubdate) AS pd FROM fredart | |
|
|
35 | # UNION SELECT published AS pd FROM strip WHERE id = $EFFECTIVE_ID | |
|
|
36 | # UNION SELECT MAX(published) AS pd FROM rant) t") or die(mysqli_error($link)); | |
|
|
37 | #conditional_exit(current(mysqli_fetch_row($MTIME))); | |
|
|
38 | ||
|
|
39 | $STRIP = load_strip($EFFECTIVE_ID) or term(410); | |
|
|
40 | $TRANSCRIPT = load_transcript($EFFECTIVE_ID); | |
|
|
41 | $HAS_TRANSCRIPT = mysqli_num_rows($TRANSCRIPT) > 0; | |
|
|
42 | ||
|
|
43 | $CONTROLS = load_nav_controls(); | |
|
|
44 | ||
|
|
45 | #$STATUS = load_status(); | |
|
|
46 | $FREDART = load_fredart(); | |
|
|
47 | $RANT['left'] = load_rant($EFFECTIVE_ID, 'left'); | |
|
|
48 | $RANT['right'] = load_rant($EFFECTIVE_ID, 'right'); | |
|
|
49 | ||
|
|
50 | header("XX-Powered-By: Taiyaki"); | |
|
|
51 | flock(fopen(SITE_PATH_ABS.'/'.SITE_STRIP.'/'.SITE_STRIP_LOCK, 'r'), LOCK_SH) or | |
|
|
52 | trigger_error('Down for maintenance. Try again in a moment. (Bad lock)', E_USER_ERROR); | |
|
|
53 | ||
|
|
54 | ||
|
|
55 | if(isset($_GET['strip_id']) || isset($_GET['transcript_id'])) | |
|
|
56 | pagehead('index', "[$EFFECTIVE_ID] " . numeric_entities(utfentities($STRIP['title']))); | |
|
|
57 | else | |
|
|
58 | pagehead('index'); | |
|
|
59 | ?> | |
|
|
60 | ||
|
|
61 | <div id="comic"> | |
|
|
62 | <div class="navpanel"> | |
|
|
63 | <div class="navcontrols top"> | |
|
|
64 | <ul class="prevnext"><?php | |
|
|
65 | if($EFFECTIVE_ID > 1) | |
|
|
66 | echo "<li class=\"prev\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID - 1) . '">Prev</a></li>'; | |
|
|
67 | else | |
|
|
68 | echo '<li class="prevoff"><span>Prev</span></li>'; | |
|
|
69 | ||
|
|
70 | if($EFFECTIVE_ID < $MAX_METHOD_ID) | |
|
|
71 | echo "<li class=\"next\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID + 1) . '">Next</a></li>'; | |
|
|
72 | else | |
|
|
73 | echo '<li class="nextoff"><span>Next</span></li>'; | |
|
|
74 | ?></ul> | |
|
|
75 | </div> | |
|
|
76 | <div id="title">"<?php echo numeric_entities(utfentities($STRIP['title'])); ?>"</div> | |
|
|
77 | </div> | |
|
|
78 | ||
|
|
79 | <?php | |
|
|
80 | switch($METHOD) { | |
|
|
81 | case 'strip': | |
|
|
82 | #construct tooltip | |
|
|
83 | $tooltip = "Comic ".$EFFECTIVE_ID; | |
|
|
84 | $tooltip .= ': "'; | |
|
|
85 | $tooltip .= $STRIP['title'].'", '; | |
|
|
86 | $result = mysqli_query($link,"SELECT strip_t.description, count(*) | |
|
|
87 | FROM strip_t JOIN strip ON strip_t.id = strip.type | |
|
|
88 | WHERE strip.id < $EFFECTIVE_ID+1 | |
|
|
89 | AND strip.type = $STRIP[type] | |
|
|
90 | GROUP BY strip.type"); | |
|
|
91 | if($result) | |
|
|
92 | { | |
|
|
93 | $qr = mysqli_fetch_row($result); | |
|
|
94 | $tmp = explode(':', $qr[0]); | |
|
|
95 | $tooltip .= $tmp[0].", Number ".$qr[1].", ".$STRIP['pubdate']; | |
|
|
96 | } | |
|
|
97 | ||
|
|
98 | $alttext = "Strip ".$EFFECTIVE_ID; | |
|
|
99 | if($STRIP['book']) | |
|
|
100 | $alttext .= ", Volume ".$STRIP['book']; | |
|
|
101 | ||
|
|
102 | if($STRIP['page']) | |
|
|
103 | $alttext .= ", Page ".$STRIP['page']; | |
|
|
104 | ||
|
|
105 | ?> | |
|
|
106 | <span id="strip"> | |
|
|
107 | <span id="strip-l"><span id="strip-r"> | |
|
|
108 | <span id="strip-t"><span id="strip-b"> | |
|
|
109 | <span id="strip-tr"><span id="strip-tl"> | |
|
|
110 | <span id="strip-br"><span id="strip-bl"> | |
|
|
111 | <?php | |
|
|
112 | /* With apologies, patching in support for the embedded Endgames: Persistence visual novel. */ | |
|
|
113 | if ($STRIP['type'] == 24 || $_GET['hidden_vn_test'] == 'yes_please') { | |
|
|
114 | /* TODO: Support more than just one of these. */ | |
|
|
115 | printf('<iframe src="endgames-vn/index.htm" scrolling="no"></iframe>'); | |
|
|
116 | } else { | |
|
|
117 | printf('<img align="middle" src="%s/%04d.%s" alt="%s" title="%s" />', SITE_STRIP, $EFFECTIVE_ID, $STRIP['ext'], $alttext, utfentities($tooltip)); | |
|
|
118 | } | |
|
|
119 | ?> | |
|
|
120 | </span></span> | |
|
|
121 | </span></span> | |
|
|
122 | </span></span> | |
|
|
123 | </span></span> | |
|
|
124 | </span> | |
|
|
125 | <?php | |
|
|
126 | break; | |
|
|
127 | case 'transcript': | |
|
|
128 | ?> | |
|
|
129 | <div id="strip"> | |
|
|
130 | <div id="strip-l"><div id="strip-r"> | |
|
|
131 | <div id="strip-t"><div id="strip-b"> | |
|
|
132 | <div id="strip-tr"><div id="strip-tl"> | |
|
|
133 | <div id="strip-br"><div id="strip-bl"> | |
|
|
134 | <ol class="transcript"> | |
|
|
135 | <?php | |
|
|
136 | $line = mysqli_fetch_row($TRANSCRIPT); | |
|
|
137 | while($line) { | |
|
|
138 | $panel = $line[0]; | |
|
|
139 | $has_speakers = false; | |
|
|
140 | echo "<li><span class=\"panelhead\">Panel $panel:</span> <dl>"; | |
|
|
141 | ||
|
|
142 | # Print out all speaking characters | |
|
|
143 | if(strlen($line[2]) > 0) { | |
|
|
144 | $has_speakers = true; | |
|
|
145 | do { | |
|
|
146 | echo "<dt>$line[1]:</dt><dd>".($line[2] ? utfentities($line[2]) : ' ').'</dd>'; | |
|
|
147 | } while(($line = mysqli_fetch_row($TRANSCRIPT)) && $line[0] == $panel && strlen($line[2]) > 0); | |
|
|
148 | } | |
|
|
149 | ||
|
|
150 | # Given an "also shown" list if there is at least one silent character | |
|
|
151 | if($line && $line[0] == $panel && strlen($line[2]) == 0) { | |
|
|
152 | echo '<dt>', ($has_speakers ? 'Also' : 'Characters'), ' shown:</dt>'; | |
|
|
153 | $also = Array(); | |
|
|
154 | do { | |
|
|
155 | array_push($also, $line[1]); | |
|
|
156 | } while(($line = mysqli_fetch_row($TRANSCRIPT)) && $line[0] == $panel); | |
|
|
157 | sort($also, SORT_STRING); | |
|
|
158 | echo '<dd>' . join(', ', $also) . '</dd>'; | |
|
|
159 | } | |
|
|
160 | ||
|
|
161 | echo '</dl></li>'; | |
|
|
162 | } ?> | |
|
|
163 | </ol> | |
|
|
164 | </div></div> | |
|
|
165 | </div></div> | |
|
|
166 | </div></div> | |
|
|
167 | </div></div> | |
|
|
168 | </div> | |
|
|
169 | <?php | |
|
|
170 | break; | |
|
|
171 | default: | |
|
|
172 | die("Unknown request method: $METHOD"); | |
|
|
173 | } | |
|
|
174 | ?> | |
|
|
175 | ||
|
|
176 | <form class="navpanel" method="get" action="search.php"> | |
|
|
177 | <div style="display:none"> | |
|
|
178 | <input type="hidden" name="current" value="<?php echo $EFFECTIVE_ID ?>" /> | |
|
|
179 | <input type="submit" /> | |
|
|
180 | </div> | |
|
|
181 | ||
|
|
182 | <div class="navcontrols bottom"> | |
|
|
183 | <ul id="normalprevnext" class="prevnext"><?php | |
|
|
184 | if($EFFECTIVE_ID > 1) | |
|
|
185 | echo "<li class=\"prev\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID - 1) . '">Prev</a></li>'; | |
|
|
186 | else | |
|
|
187 | echo '<li class="prevoff"><span>Prev</span></li>'; | |
|
|
188 | ||
|
|
189 | if($EFFECTIVE_ID < $MAX_METHOD_ID) | |
|
|
190 | echo "<li class=\"next\"><a href=\"./$METHOD/" . ($EFFECTIVE_ID + 1) . '">Next</a></li>'; | |
|
|
191 | else | |
|
|
192 | echo '<li class="nextoff"><span>Next</span></li>'; | |
|
|
193 | ?></ul> | |
|
|
194 | <ul id="searchprevnext" class="prevnext"><?php | |
|
|
195 | if( $EFFECTIVE_ID > 1 ) | |
|
|
196 | echo '<li>', | |
|
|
197 | '<input class="iehide" type="image" src="parts/nav2-prevfind.png" alt="Find Previous" name="method-fp" value="Find Previous" />', | |
|
|
198 | '</li>'; | |
|
|
199 | else | |
|
|
200 | echo '<li class="findprevoff"><span>Find Next</span></li>'; | |
|
|
201 | ||
|
|
202 | if($EFFECTIVE_ID < $MAX_METHOD_ID) | |
|
|
203 | echo '<li>', | |
|
|
204 | '<input class="iehide" type="image" src="parts/nav2-nextfind.png" alt="Find Next" name="method-fn" value="Find Next" />', | |
|
|
205 | '</li>'; | |
|
|
206 | else | |
|
|
207 | echo '<li class="findnextoff"><span>Find Next</span></li>'; | |
|
|
208 | ?></ul> | |
|
|
209 | </div> | |
|
|
210 | <div class="search-field">Search: | |
|
|
211 | <input type="text" name="q" id="q" value="<?php if(isset($_REQUEST['q'])) {echo utfentities(trim($_REQUEST['q']));} ?>" /> | |
|
|
212 | <input class="iehide" id="go" type="image" src="parts/nav2-go.png" alt="Go Search" /> | |
|
|
213 | <a href="search_help"><img src="parts/nav2-help.png" alt="help" title="help" /></a> | |
|
|
214 | </div> | |
|
|
215 | <div class="search-filter" id="search-filters">Within: <?php | |
|
|
216 | foreach($CONTROLS as $name => $controls) { | |
|
|
217 | foreach($controls as $control) { | |
|
|
218 | printf('<label><input type="checkbox" name="%s[]" value="%s" />%s</label>', $name, $control, $control); | |
|
|
219 | } | |
|
|
220 | } | |
|
|
221 | ?></div> | |
|
|
222 | </form> | |
|
|
223 | ||
|
|
224 | <ul class="nl"> | |
|
|
225 | <li><a href="./strip/1">First Comic</a></li> | |
|
|
226 | <li>·</li> | |
|
|
227 | <li id="archivelink"><a href="archive.php<?php if(isset($_GET['strip_id'])) echo "#".$EFFECTIVE_ID; ?>">Archives</a></li> | |
|
|
228 | <?php | |
|
|
229 | if($METHOD == 'transcript') | |
|
|
230 | echo "<li>·</li><li><a href=\"./strip/$EFFECTIVE_ID\">Strip</a></li>"; | |
|
|
231 | elseif($HAS_TRANSCRIPT) | |
|
|
232 | echo "<li>·</li><li><a href=\"./transcript/$EFFECTIVE_ID\">Transcript</a></li>"; | |
|
|
233 | ?> | |
|
|
234 | <li>·</li> | |
|
|
235 | <li><a href="http://www.megatokyo.it/?id=<?php echo $EFFECTIVE_ID ?>">Translation</a></li> | |
|
|
236 | <li>·</li> | |
|
|
237 | <li><a href="index.php">Latest Comic</a></li> | |
|
|
238 | </ul> | |
|
|
239 | </div> | |
|
|
240 | ||
|
|
241 | <script type="text/javascript" src="rewrite_searchbox.js"></script> | |
|
|
242 | <script type="text/javascript" src="navswitch.js"></script> | |
|
|
243 | ||
|
|
244 | <div class="content" id="metabox"> | |
|
|
245 | <h2><span></span>newsbox</h2> | |
|
|
246 | <div id="newsbox"> | |
|
|
247 | <div id="facebook" class="leftcol"> | |
|
|
248 | <!--<a href="http://www.facebook.com/pages/Megatokyo/250777389376" title="Megatokyo" ><img alt="Megatokyo on Facebook" src="https://badge.facebook.com/badge/250777389376.3850.611436821.png" /></a> --> | |
|
|
249 | </div> | |
|
|
250 | <div id="blogbits" class="rightcol"> | |
|
|
251 | <a href="http://www.fredart.com/fredart/index.php3" class="leftcol"><img src="parts/fredart-big01.gif" alt="A Fredart banner" title="More of Fred's art" /></a> | |
|
|
252 | <a href="http://www.s-words-podcast.com/" class="rightcol"><img src="parts/s-words.jpg" alt="S-Words" title="Dom's podcast" /></a> | |
|
|
253 | <ul id="feed-list"> | |
|
|
254 | <li id="feed-twitter-megatokyo"><a href="http://twitter.com/megatokyo"><img src="parts/twtmega.png" alt="Megatokyo Twitter" /></a></li> | |
|
|
255 | <li id="feed-megatokyo"><a href="rss/megatokyo.xml"><img src="parts/rssmega.png" alt="Megatokyo RSS feed" title="Megatokyo RSS Feed" /></a></li> | |
|
|
256 | <li id="feed-twitter-fredrin"><a href="http://twitter.com/fredrin"><img src="parts/twtfredrin.png" alt="Fred's Twitter" /></a></li> | |
|
|
257 | <li id="feed-fredart"><a href="http://fredart.com/wordpress/?feed=rss2"><img src="parts/rssfredart.png" alt="Fredart RSS Feed" title="Fredart RSS Feed" /></a></li> | |
|
|
258 | </ul> | |
|
|
259 | </div> | |
|
|
260 | </div> | |
|
|
261 | </div> | |
|
|
262 | ||
|
|
263 | <div class="content" id="support"> | |
|
|
264 | <h2><span></span>support</h2> | |
|
|
265 | <div class="adinfo"><p><a href="support">Advertise on Megatokyo!</a></p></div> | |
|
|
266 | <div id="megagear"> | |
|
|
267 | <?php // ad_template(7,'a058c23f') ?> | |
|
|
268 | <?php // ad_template(9,'a058c23f') ?> | |
|
|
269 | <a href="http://vn.megatokyo.com"><img src="extra/MTVN-ADBANNER-animated-02.gif" alt="MegaTokyo Visual Novel" /></a> | |
|
|
270 | </div> | |
|
|
271 | <div class="thewrap" style="display: none;"> | |
|
|
272 | <div class="column leftcol"> | |
|
|
273 | <?php ad_template(4, 'a63c0f77') ?> | |
|
|
274 | <?php ad_template(3, 'a1f95ec5') ?> | |
|
|
275 | </div> | |
|
|
276 | ||
|
|
277 | <div class="column rightcol"> | |
|
|
278 | <?php ad_template(6, 'aad50baf') ?> | |
|
|
279 | <?php ad_template(5, 'ad741b2d') ?> | |
|
|
280 | </div> | |
|
|
281 | ||
|
|
282 | </div> | |
|
|
283 | ||
|
|
284 | <script src="rewrite_supportbox.js" type="text/javascript"></script> | |
|
|
285 | </div> | |
|
|
286 | ||
|
|
287 | <div id="console"> | |
|
|
288 | <h2><span></span>console</h2> | |
|
|
289 | <?php show_rantcol('left') ?> | |
|
|
290 | <?php show_rantcol('right') ?> | |
|
|
291 | <div class="clearer"></div> | |
|
|
292 | </div> | |
|
|
293 | ||
|
|
294 | <?php pagefoot() ?> | |
|
|
295 | ||
|
|
296 | </body> | |
|
|
297 | </html> | |
|
|
298 | <?php | |
|
|
299 | ||
|
|
300 | function load_fredart() | |
|
|
301 | { | |
|
|
302 | global $link; | |
|
|
303 | $qr = mysqli_query($link,"SELECT DATE_FORMAT(pubdate, '%a %c.%d.%Y') AS pub, title, link | |
|
|
304 | FROM fredart ORDER BY pubdate DESC LIMIT 5"); | |
|
|
305 | ||
|
|
306 | while($tmp = mysqli_fetch_assoc($qr)) | |
|
|
307 | $fredart[] = $tmp; | |
|
|
308 | ||
|
|
309 | return $fredart; | |
|
|
310 | } | |
|
|
311 | ||
|
|
312 | function load_nav_controls() | |
|
|
313 | { | |
|
|
314 | global $link; | |
|
|
315 | $controls = Array(); | |
|
|
316 | ||
|
|
317 | $qr = mysqli_query($link,'SELECT name FROM meta_t'); | |
|
|
318 | while($tmp = mysqli_fetch_row($qr)) | |
|
|
319 | $controls['meta'][] = $tmp[0]; | |
|
|
320 | ||
|
|
321 | return $controls; | |
|
|
322 | } | |
|
|
323 | ||
|
|
324 | function load_rant($id, $side) | |
|
|
325 | { | |
|
|
326 | global $MAX_METHOD_ID, $EFFECTIVE_ID, $link; | |
|
|
327 | ||
|
|
328 | $parameters = "r.id AS rantnum, r.title AS title, r.body AS body, | |
|
|
329 | r.published AS published, UNIX_TIMESTAMP(r.published) AS date, | |
|
|
330 | r.link AS link, r.imagetext AS alttext, m.extension AS extension, | |
|
|
331 | c.name AS author, c.email AS email, | |
|
|
332 | ( SELECT id FROM rant r1 WHERE r1.status = 'published' AND r1.side = r.side AND r1.published < r.published ORDER BY r1.published DESC LIMIT 1) AS prev, | |
|
|
333 | ( SELECT id FROM rant r1 WHERE r1.status = 'published' AND r1.side = r.side AND r1.published > r.published AND r1.published < NOW() ORDER BY r1.published ASC LIMIT 1 ) AS next"; | |
|
|
334 | $rantinfo = "rant r JOIN media_t m ON m.id = r.imagetype | |
|
|
335 | JOIN contributor c ON c.id = r.author | |
|
|
336 | JOIN strip s"; | |
|
|
337 | $rantlimit = "( r.side = '$side' AND r.published < NOW() AND r.status = 'published' AND s.id = $id )"; | |
|
|
338 | ||
|
|
339 | # Create a window of previous days' rants on the most recent strip | |
|
|
340 | if($MAX_METHOD_ID == $EFFECTIVE_ID) | |
|
|
341 | $rantwindow = "UNION DISTINCT (SELECT $parameters FROM $rantinfo WHERE $rantlimit AND DATEDIFF(NOW(), r.published) < " . RANT_DATE_WINDOW . ')'; | |
|
|
342 | ||
|
|
343 | $lookahead = mysqli_query($link,"( SELECT $parameters | |
|
|
344 | FROM $rantinfo LEFT JOIN strip sn ON sn.id = s.id + 1 | |
|
|
345 | WHERE $rantlimit AND ( s.id = $id AND r.published >= s.published) AND ( r.published < sn.published OR sn.published IS NULL ) ) | |
|
|
346 | $rantwindow | |
|
|
347 | ORDER BY published DESC") or die(mysqli_error($link)); | |
|
|
348 | ||
|
|
349 | if(mysqli_num_rows($lookahead) > 0) | |
|
|
350 | return $lookahead; | |
|
|
351 | ||
|
|
352 | $lookbehind = mysqli_query($link,"(SELECT $parameters | |
|
|
353 | FROM $rantinfo | |
|
|
354 | WHERE $rantlimit AND r.published < s.published | |
|
|
355 | ORDER BY r.published DESC LIMIT 1) | |
|
|
356 | $rantwindow | |
|
|
357 | ORDER BY published DESC") or die(mysqli_error($link)); | |
|
|
358 | ||
|
|
359 | return $lookbehind; | |
|
|
360 | } | |
|
|
361 | ||
|
|
362 | function load_status() | |
|
|
363 | { | |
|
|
364 | global $link; | |
|
|
365 | //"%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]" | |
|
|
366 | $qr = mysqli_query($link,'SELECT UNIX_TIMESTAMP(published) as udate, | |
|
|
367 | DATE_FORMAT(published, "%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]") AS published, | |
|
|
368 | DATE_FORMAT(eta, "%a %c.%d.%Y [%I:%i %p EST (-5 GMT)]") AS eta, percentage, text | |
|
|
369 | FROM status | |
|
|
370 | ORDER BY udate DESC LIMIT 1') or die(mysqli_error($link)); | |
|
|
371 | return mysqli_fetch_assoc($qr); | |
|
|
372 | } | |
|
|
373 | ||
|
|
374 | function show_rantcol($side) | |
|
|
375 | { | |
|
|
376 | global $RANT, $link; | |
|
|
377 | ?> | |
|
|
378 | <div class="<?php echo $side ?>col"> | |
|
|
379 | <?php $rant = mysqli_fetch_assoc($RANT[$side]) ?> | |
|
|
380 | <div class="mainrant" id="rant<?php echo $rant['rantnum'] ?>"> | |
|
|
381 | <div class="nameplate"> | |
|
|
382 | <span style="background-image:url(nameplates/<?php echo $rant['author'] ?>.jpg)"></span> | |
|
|
383 | <h3>< <?php echo $rant['author'] ?> ></h3> | |
|
|
384 | </div> | |
|
|
385 | ||
|
|
386 | <div class="rantimage"><div class="ri-top"><div class="ri-bottom"><div class="ri-matte"><p><?php | |
|
|
387 | printf('<a href="%s"><img src="%s/%04d.%s" alt="%s" title="%s" /></a>', | |
|
|
388 | $rant['link'], SITE_RANT, $rant['rantnum'], $rant['extension'], | |
|
|
389 | utfentities($rant['alttext']), utfentities($rant['alttext'])) | |
|
|
390 | ?></p></div></div></div></div> | |
|
|
391 | ||
|
|
392 | <h4><a href="rant/<?php echo $rant['rantnum'] ?>">"<?php echo utfentities($rant['title']) ?>"</a></h4> | |
|
|
393 | ||
|
|
394 | <?php echo '<p class="date">', date('l - F j, Y', $rant['date']), '</p>'?> | |
|
|
395 | <?php printf('<p class="date">[<a href="mailto:%s">%s</a>] - %s - [<a href="rant/%s">link here</a>]</p>', $rant['email'], $rant['author'], date('H:i:s', $rant['date']), $rant['rantnum']) ?> | |
|
|
396 | ||
|
|
397 | <div class="rantbody"><?php echo $rant['body'] ?></div> | |
|
|
398 | ||
|
|
399 | <div class="rantnav"><?php | |
|
|
400 | if($rant['prev']) | |
|
|
401 | { | |
|
|
402 | echo "[<a href=\"./rant/".$rant['prev']."\">previous rant</a>]"; | |
|
|
403 | } | |
|
|
404 | ||
|
|
405 | echo ' - [<a href="rant-archive.php">rant archive</a>]'; | |
|
|
406 | ||
|
|
407 | if($rant['next'] && $rant['prev']) | |
|
|
408 | { | |
|
|
409 | echo ' - '; | |
|
|
410 | } | |
|
|
411 | ||
|
|
412 | if($rant['next']) | |
|
|
413 | { | |
|
|
414 | echo "[<a href=\"./rant/".$rant['next']."\">next rant</a>]"; | |
|
|
415 | } | |
|
|
416 | ?></div> | |
|
|
417 | </div> | |
|
|
418 | <?php while($rant = mysqli_fetch_assoc($RANT[$side])) { ?> | |
|
|
419 | <div class="oldrant" id="rant<?php echo $rant['rantnum'] ?>"> | |
|
|
420 | <div class="rantimage"><div class="ri-top"><div class="ri-bottom"><div class="ri-matte"><p><?php | |
|
|
421 | printf('<a href="%s"><img src="%s/%04d.%s" alt="%s" title="%s" /></a>', | |
|
|
422 | $rant['link'], SITE_RANT, $rant['rantnum'], $rant['extension'], | |
|
|
423 | utfentities($rant['alttext']), utfentities($rant['alttext'])) | |
|
|
424 | ?></p></div></div></div></div> | |
|
|
425 | ||
|
|
426 | <div class="nameplate"> | |
|
|
427 | <span style="background-image:url(nameplates/<?php echo $rant['author'] ?>.jpg)"></span> | |
|
|
428 | <h3>< <?php echo $rant['author'] ?> ></h3> | |
|
|
429 | </div> | |
|
|
430 | ||
|
|
431 | <h4><a href="rant/<?php echo $rant['rantnum'] ?>">"<?php echo utfentities($rant['title']) ?>"</a></h4> | |
|
|
432 | <div class="clearer"></div> | |
|
|
433 | ||
|
|
434 | <?php echo '<p class="date">', date('l - F j, Y', $rant['date']), '</p>'?> | |
|
|
435 | <?php printf('<p class="date">[<a href="mailto:%s">%s</a>] - %s - [<a href="rant/%s">link here</a>]</p>', $rant['email'], $rant['author'], date('H:i:s', $rant['date']), $rant['rantnum']) ?> | |
|
|
436 | ||
|
|
437 | <div class="rantbody"><?php echo $rant['body'] ?></div> | |
|
|
438 | ||
|
|
439 | <div class="rantnav"><?php | |
|
|
440 | if($rant['prev']) | |
|
|
441 | { | |
|
|
442 | echo "[<a href=\"./rant/".$rant['prev']."\">previous rant</a>]"; | |
|
|
443 | } | |
|
|
444 | ||
|
|
445 | echo ' - [<a href="rant-archive.php">rant archive</a>]'; | |
|
|
446 | ||
|
|
447 | if($rant['next'] && $rant['prev']) | |
|
|
448 | { | |
|
|
449 | echo ' - '; | |
|
|
450 | } | |
|
|
451 | ||
|
|
452 | if($rant['next']) | |
|
|
453 | { | |
|
|
454 | echo "[<a href=\"./rant/".$rant['next']."\">next rant</a>]"; | |
|
|
455 | } | |
|
|
456 | ?></div> | |
|
|
457 | </div> | |
|
|
458 | <?php } ?> | |
|
|
459 | </div> | |
|
|
460 | <?php } | |
|
|
461 | ||
|
|
462 | function strip_id_from_rant_id($id) | |
|
|
463 | { | |
|
|
464 | global $link; | |
|
|
465 | $qr = mysqli_query($link,"SELECT MAX(strip.id) FROM strip, rant WHERE strip.published <= rant.published AND rant.id = $id AND rant.published < NOW()"); | |
|
|
466 | return current(mysqli_fetch_row($qr)); | |
|
|
467 | } | |
|
|
468 | ||
|
|
469 | function transcript($trans) | |
|
|
470 | { | |
|
|
471 | global $link; | |
|
|
472 | if(!$trans) | |
|
|
473 | return "Transcript not yet available for this comic."; | |
|
|
474 | ||
|
|
475 | $transcript = Array(); | |
|
|
476 | ||
|
|
477 | foreach($trans as $panel => $lines) { | |
|
|
478 | if(!is_numeric($panel)) | |
|
|
479 | continue; | |
|
|
480 | ||
|
|
481 | $idx = array_push($transcript, Array()) - 1; | |
|
|
482 | ||
|
|
483 | foreach($lines as $line) { | |
|
|
484 | array_push($transcript[$idx], $line['speaker']); | |
|
|
485 | ||
|
|
486 | if($line['speech']) | |
|
|
487 | array_push($transcript, wordwrap("\t$line[speaker]:\t$line[speech]", 80, "\n\t\t")); | |
|
|
488 | } | |
|
|
489 | ||
|
|
490 | $transcript[$idx] = "Panel $panel: " . implode(', ', array_unique($transcript[$idx])); | |
|
|
491 | } | |
|
|
492 | ||
|
|
493 | return implode("\n", $transcript); | |
|
|
494 | } | |
|
|
495 | ||
|
|
496 | function numeric_entities($string){ | |
|
|
497 | $mapping = array(); | |
|
|
498 | foreach (get_html_translation_table(HTML_ENTITIES, ENT_QUOTES) as $char => $entity){ | |
|
|
499 | $mapping[$entity] = '&#' . ord($char) . ';'; | |
|
|
500 | } | |
|
|
501 | return str_replace(array_keys($mapping), $mapping, $string); | |
|
|
502 | } | |
|
|
503 | ||
|
|
504 | ?> | |
| @@ -0,0 +1,182 | |||
|
|
1 | /* Set basic element styles */ | |
|
|
2 | img { border:none } | |
|
|
3 | ||
|
|
4 | a { | |
|
|
5 | text-decoration: none; | |
|
|
6 | color: #f60; | |
|
|
7 | } | |
|
|
8 | ||
|
|
9 | a:visited { color:#ececa3; } | |
|
|
10 | a:hover { color:#eb5252; } | |
|
|
11 | ||
|
|
12 | body { | |
|
|
13 | position: relative; /* Make IE not hate positioned elements */ | |
|
|
14 | ||
|
|
15 | margin: auto; | |
|
|
16 | padding: 14px; | |
|
|
17 | ||
|
|
18 | background-color: #4c565e; | |
|
|
19 | ||
|
|
20 | font-size: 0.8em; | |
|
|
21 | font-family: Verdana, Arial, Helvetica, sans-serif; | |
|
|
22 | } | |
|
|
23 | ||
|
|
24 | /* Set default widths for page boxes */ | |
|
|
25 | body div { | |
|
|
26 | position: relative; | |
|
|
27 | margin: auto; | |
|
|
28 | width: 700px; | |
|
|
29 | } | |
|
|
30 | body div div { width:auto } | |
|
|
31 | ||
|
|
32 | /* Make the headers look nice */ | |
|
|
33 | h1 { margin:0px } | |
|
|
34 | ||
|
|
35 | h2 { | |
|
|
36 | text-align: left; | |
|
|
37 | color: #f6b33d; | |
|
|
38 | } | |
|
|
39 | ||
|
|
40 | /* Create special elements and classes */ | |
|
|
41 | h2, .blackbar { | |
|
|
42 | height: 18px; /* Take that, old gecko! */ | |
|
|
43 | margin: 0px; | |
|
|
44 | padding: 0px 1ex; | |
|
|
45 | ||
|
|
46 | overflow: hidden; | |
|
|
47 | background-color: black; | |
|
|
48 | ||
|
|
49 | font-size: 16px; | |
|
|
50 | font-weight: 150; | |
|
|
51 | font-family: monospace; | |
|
|
52 | letter-spacing: 0.5ex; | |
|
|
53 | } | |
|
|
54 | ||
|
|
55 | h2 span, .blackbar span { | |
|
|
56 | display: block; | |
|
|
57 | width: 100%; | |
|
|
58 | height: 100%; | |
|
|
59 | } | |
|
|
60 | ||
|
|
61 | .clearer { clear:both } | |
|
|
62 | br.clearer { line-height:0px } | |
|
|
63 | .leftcol { float:left } | |
|
|
64 | .rightcol { float:right } | |
|
|
65 | ||
|
|
66 | .nl { | |
|
|
67 | margin: 0px; | |
|
|
68 | padding: 0px; | |
|
|
69 | ||
|
|
70 | background-color: black; | |
|
|
71 | text-align: center; | |
|
|
72 | ||
|
|
73 | list-style-type: none; | |
|
|
74 | } | |
|
|
75 | ||
|
|
76 | .nl li { | |
|
|
77 | display: inline; | |
|
|
78 | margin: 0px; | |
|
|
79 | padding: 0em 0.5ex; | |
|
|
80 | color: #B7BFC7; | |
|
|
81 | } | |
|
|
82 | ||
|
|
83 | .nl a { color:#b7bfc7; text-decoration:none } | |
|
|
84 | .nl a:link, .nl a:visited { color:#b7bfc7 } | |
|
|
85 | .nl a:hover { color:#eb5252 } | |
|
|
86 | ||
|
|
87 | .content { | |
|
|
88 | margin-top: 1em; | |
|
|
89 | margin-bottom: 1em; | |
|
|
90 | background-color: black; | |
|
|
91 | color: #b7bfc7; | |
|
|
92 | } | |
|
|
93 | ||
|
|
94 | .content div { | |
|
|
95 | /* Satisfy internal floated elements */ | |
|
|
96 | overflow: hidden; | |
|
|
97 | height: 100%; | |
|
|
98 | ||
|
|
99 | border: solid 5px black; | |
|
|
100 | background-color: #23272b; | |
|
|
101 | padding: 5px; | |
|
|
102 | } | |
|
|
103 | ||
|
|
104 | .content .clearer { | |
|
|
105 | border: none; | |
|
|
106 | padding: 0px; | |
|
|
107 | } | |
|
|
108 | ||
|
|
109 | /* Correct a word wrapping bug in the ad bar */ | |
|
|
110 | #adbar { | |
|
|
111 | position: relative; | |
|
|
112 | height: 90px; | |
|
|
113 | text-align: center; | |
|
|
114 | font-size: 1px; | |
|
|
115 | letter-spacing: 500px; | |
|
|
116 | } | |
|
|
117 | ||
|
|
118 | #adbar #megagear-ad { | |
|
|
119 | position: absolute; | |
|
|
120 | top: 14px; | |
|
|
121 | left: 0px; | |
|
|
122 | } | |
|
|
123 | ||
|
|
124 | #adbar #kickstarter-ad { | |
|
|
125 | position: absolute; | |
|
|
126 | top: 14px; | |
|
|
127 | left: 115px; | |
|
|
128 | } | |
|
|
129 | ||
|
|
130 | #adbar #cologuys-ad { | |
|
|
131 | position: absolute; | |
|
|
132 | top: 14px; | |
|
|
133 | right: 0px; | |
|
|
134 | } | |
|
|
135 | ||
|
|
136 | #adbar .glowwrap { | |
|
|
137 | position: absolute; | |
|
|
138 | display: block; | |
|
|
139 | top: 0px; | |
|
|
140 | left: 50%; | |
|
|
141 | width: 468px; | |
|
|
142 | margin-left: -246px; | |
|
|
143 | ||
|
|
144 | background-image:url(parts/banner_bg.gif); | |
|
|
145 | padding: 14px 12px; | |
|
|
146 | } | |
|
|
147 | ||
|
|
148 | /* Style the top banner */ | |
|
|
149 | #banner { | |
|
|
150 | background-color: black; | |
|
|
151 | text-align: center; | |
|
|
152 | } | |
|
|
153 | ||
|
|
154 | #banner h2 { | |
|
|
155 | color: #b7bfc7; | |
|
|
156 | font-family: monospace; | |
|
|
157 | } | |
|
|
158 | ||
|
|
159 | #banner .nl { | |
|
|
160 | padding-bottom: 5px; | |
|
|
161 | padding-top: 5px; | |
|
|
162 | } | |
|
|
163 | ||
|
|
164 | /* Style the footer */ | |
|
|
165 | #credits { | |
|
|
166 | background-color: #757b81; | |
|
|
167 | color: #e4e4d6; | |
|
|
168 | padding-bottom: 0.5ex; | |
|
|
169 | margin-top: 1em; | |
|
|
170 | } | |
|
|
171 | ||
|
|
172 | #credits p { | |
|
|
173 | margin: 0px; | |
|
|
174 | text-align: center; | |
|
|
175 | padding: 0.5ex; | |
|
|
176 | font-family: Arial, helvetica, sans-serif; | |
|
|
177 | font-size: x-small; | |
|
|
178 | } | |
|
|
179 | ||
|
|
180 | /* Overload header texts */ | |
|
|
181 | #banner .blackbar span { background: url(parts/mt3-bar-comic.gif) no-repeat } | |
|
|
182 | #credits h2 span { background: url(parts/mt-blk_bar-credits.png) no-repeat } No newline at end of file | |
| @@ -0,0 +1,10 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | require('LocalSettings.php'); | |
|
|
4 | ||
|
|
5 | if($_GET['section'] == 'characters') | |
|
|
6 | header('Location: '.SITE_HOST.SITE_PATH.'/characters.php'); | |
|
|
7 | else | |
|
|
8 | header('Location: '.SITE_HOST.SITE_PATH.'/'.$_GET['section']); | |
|
|
9 | ||
|
|
10 | ?> | |
|
|
1 | NO CONTENT: new file 100644, binary diff hidden |
| @@ -0,0 +1,78 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | require_once('external.php'); | |
|
|
4 | ||
|
|
5 | function toXML($data) | |
|
|
6 | { | |
|
|
7 | $xml = new XmlWriter(); | |
|
|
8 | $xml->openMemory(); | |
|
|
9 | $xml->startDocument('1.0', 'UTF-8'); | |
|
|
10 | $xml->startElement('root'); | |
|
|
11 | ||
|
|
12 | function write(XMLWriter $xml, $data) | |
|
|
13 | { | |
|
|
14 | foreach($data as $key => $value) | |
|
|
15 | { | |
|
|
16 | if(is_array($value)) | |
|
|
17 | { | |
|
|
18 | echo "$key\n"; | |
|
|
19 | $xml->startElement($key); | |
|
|
20 | write($xml, $value); | |
|
|
21 | $xml->endElement(); | |
|
|
22 | continue; | |
|
|
23 | } | |
|
|
24 | $xml->writeElement($key, $value); | |
|
|
25 | } | |
|
|
26 | } | |
|
|
27 | write($xml, $data); | |
|
|
28 | ||
|
|
29 | $xml->endElement(); | |
|
|
30 | return $xml->outputMemory(true); | |
|
|
31 | } | |
|
|
32 | ||
|
|
33 | $API = new ReflectionClass('MTAPIi'); | |
|
|
34 | ||
|
|
35 | if( $API->hasMethod($_GET['method']) ) { | |
|
|
36 | $method = $API->getMethod($_GET['method']); | |
|
|
37 | $parameters = $method->getParameters(); | |
|
|
38 | ||
|
|
39 | $method_parameters = Array(); | |
|
|
40 | foreach($parameters as $parameter) { | |
|
|
41 | $param = (Array) $parameter; | |
|
|
42 | $parameter_name = reset($param); | |
|
|
43 | if(isset( $_GET[$parameter_name] )) | |
|
|
44 | array_push($method_parameters, $_GET[$parameter_name]); | |
|
|
45 | elseif( 'xml' == $parameter->getName() && 'xml' == $_GET['output-type'] ) | |
|
|
46 | array_push($method_parameters, true); | |
|
|
47 | elseif( $parameter->isOptional() ) | |
|
|
48 | { /* empty */ } | |
|
|
49 | else { | |
|
|
50 | header('HTTP/1.0 400 Bad Request'); | |
|
|
51 | printf( 'Parameter %s is required but not supplied', $parameter_name ); | |
|
|
52 | } | |
|
|
53 | } | |
|
|
54 | ||
|
|
55 | $result = $method->invokeArgs($API, $method_parameters); | |
|
|
56 | ||
|
|
57 | switch($_GET['output-type']) { | |
|
|
58 | case 'json': | |
|
|
59 | $result = json_encode($result); | |
|
|
60 | header('Content-Type: application/json'); | |
|
|
61 | echo $result; | |
|
|
62 | break; | |
|
|
63 | case 'xml': | |
|
|
64 | header('Content-Type: application/xml'); | |
|
|
65 | echo $result; | |
|
|
66 | break; | |
|
|
67 | default: | |
|
|
68 | header('HTTP/1.0 400 Bad Request'); | |
|
|
69 | header('Content-Type: text/plain'); | |
|
|
70 | print_r($result); | |
|
|
71 | break; | |
|
|
72 | } | |
|
|
73 | } else { | |
|
|
74 | header('HTTP/1.0 404 Not Found'); | |
|
|
75 | echo 'There is no such method in the MT API.'; | |
|
|
76 | } | |
|
|
77 | ||
|
|
78 | ?> | |
| @@ -0,0 +1,59 | |||
|
|
1 | ||
|
|
2 | var PageLoaded = 0; | |
|
|
3 | ||
|
|
4 | window.onload = function() { | |
|
|
5 | PageLoaded = 1; | |
|
|
6 | } | |
|
|
7 | ||
|
|
8 | function navwait(i) { | |
|
|
9 | if ( document.getElementById && document.getElementById(i) !== null ) { | |
|
|
10 | navinit(); | |
|
|
11 | } else if ( !PageLoaded ) { | |
|
|
12 | setTimeout('navwait(\''+i+'\')', 100); | |
|
|
13 | } | |
|
|
14 | } | |
|
|
15 | ||
|
|
16 | function navinit() { | |
|
|
17 | f = document.getElementById('searchprevnext'); | |
|
|
18 | f.style.display="none"; | |
|
|
19 | ||
|
|
20 | b = document.getElementById('q'); | |
|
|
21 | for( i=0; i<b.form.elements.length; i++ ) { | |
|
|
22 | if( b.form.elements[i].type=="checkbox" ) { | |
|
|
23 | b.form.elements[i].onclick = navrecheck; | |
|
|
24 | } | |
|
|
25 | } | |
|
|
26 | ||
|
|
27 | b.onblur = navrecheck; | |
|
|
28 | b.onchange = navrecheck; | |
|
|
29 | b.onkeyup = navrecheck; | |
|
|
30 | b.onreset = navrecheck; | |
|
|
31 | navrecheck(); | |
|
|
32 | } | |
|
|
33 | ||
|
|
34 | function navrecheck() { | |
|
|
35 | b = document.getElementById('q'); | |
|
|
36 | n = document.getElementById('normalprevnext'); | |
|
|
37 | f = document.getElementById('searchprevnext'); | |
|
|
38 | ||
|
|
39 | find = b.value; | |
|
|
40 | if(!find ) { | |
|
|
41 | for( i=0; i<b.form.elements.length; i++ ) { | |
|
|
42 | if( b.form.elements[i].checked ) { | |
|
|
43 | find = 1; | |
|
|
44 | break; | |
|
|
45 | } | |
|
|
46 | } | |
|
|
47 | } | |
|
|
48 | ||
|
|
49 | if( find ) { | |
|
|
50 | n.style.display="none"; | |
|
|
51 | f.style.display=""; | |
|
|
52 | } else { | |
|
|
53 | n.style.display=""; | |
|
|
54 | f.style.display="none"; | |
|
|
55 | } | |
|
|
56 | ||
|
|
57 | } | |
|
|
58 | ||
|
|
59 | navwait('q'); | |
| @@ -0,0 +1,28 | |||
|
|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
|
|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
|
|
3 | <head> | |
|
|
4 | <base href="http://megatokyo.com/" /> | |
|
|
5 | <title>MegaTokyo - Fredarting</title> | |
|
|
6 | <script type='text/javascript' src='http://akiko.megatokyo.com/adsystem/www/delivery/spcjs.php?id=1'></script> | |
|
|
7 | <style type="text/css"> | |
|
|
8 | span img, object {margin:auto; display:block;} | |
|
|
9 | </style> | |
|
|
10 | </head> | |
|
|
11 | <body> | |
|
|
12 | <div style="position:absolute;top:0;bottom:0;left:0;right:0;"> | |
|
|
13 | <span> | |
|
|
14 | <script type="text/javascript"><!-- | |
|
|
15 | OA_show(10); | |
|
|
16 | // --></script> | |
|
|
17 | </span> | |
|
|
18 | <object id="live_embed_player_flash" width="100%" height="100%" type="application/x-shockwave-flash" data="http://www.justin.tv/widgets/live_embed_player.swf?channel=fredrin"> | |
|
|
19 | <param name="allowFullScreen" value="true" /> | |
|
|
20 | <param name="allowScriptAccess" value="always" /> | |
|
|
21 | <param name="allowNetworking" value="all" /> | |
|
|
22 | <param name="movie" value="http://www.justin.tv/widgets/live_embed_player.swf" /> | |
|
|
23 | <param name="flashvars" value="channel=fredrin&auto_play=true&start_volume=25" /> | |
|
|
24 | </object> | |
|
|
25 | </div> | |
|
|
26 | </body> | |
|
|
27 | </html> | |
|
|
28 | ||
| @@ -0,0 +1,80 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | $AUTHORS = mysqli_query($link,"SELECT DISTINCT id, name FROM contributor"); | |
|
|
6 | ||
|
|
7 | #$MTIME = mysqli_query($link,'SELECT UNIX_TIMESTAMP(MAX(published)) FROM strip') or die(mysqli_error($link)); | |
|
|
8 | #conditional_exit(current(mysqli_fetch_row($MTIME))); | |
|
|
9 | ||
|
|
10 | pagehead('archive', 'Rant Archives'); | |
|
|
11 | ||
|
|
12 | ?> | |
|
|
13 | ||
|
|
14 | <div class="content"> | |
|
|
15 | <h2>View By:</h2> | |
|
|
16 | <div><ul class="nl"> | |
|
|
17 | <li><a href="rant-archive.php?list_by=date">View by Date</a></li> | |
|
|
18 | <li><a href="rant-archive.php">View by Author</a></li> | |
|
|
19 | </ul></div> | |
|
|
20 | </div> | |
|
|
21 | ||
|
|
22 | <?php | |
|
|
23 | ||
|
|
24 | if(isset($_REQUEST['list_by']) && $_REQUEST['list_by'] == "date") | |
|
|
25 | { | |
|
|
26 | $rants = mysqli_query($link,"SELECT rant.id AS id, rant.title AS title, contributor.name AS author, | |
|
|
27 | DATE_FORMAT(rant.published, '%M %D, %Y') AS pubdate | |
|
|
28 | FROM rant JOIN contributor ON rant.author = contributor.id | |
|
|
29 | WHERE (rant.published < NOW()) | |
|
|
30 | AND rant.status = 'published' ORDER BY rant.published") or die(mysqli_error($link)); | |
|
|
31 | ||
|
|
32 | echo '<div class="content"><h2>Rants by Date</h2><div><ol>'; | |
|
|
33 | ||
|
|
34 | while($rant = mysqli_fetch_assoc($rants)) | |
|
|
35 | { | |
|
|
36 | printf('<li><a title="%s" name="%d" href="./rant/%d">%s - %s</a></li>', $rant['pubdate'], $rant['id'], $rant['id'], | |
|
|
37 | $rant['author'], utfentities($rant['title'])); | |
|
|
38 | } | |
|
|
39 | ||
|
|
40 | echo '</ol></div></div>'; | |
|
|
41 | } | |
|
|
42 | else | |
|
|
43 | { | |
|
|
44 | ?> | |
|
|
45 | <div class="content" id="typelinks"> | |
|
|
46 | <h2>Rants by Author</h2> | |
|
|
47 | <div><ul><?php | |
|
|
48 | while ($author = mysqli_fetch_assoc($AUTHORS)) { | |
|
|
49 | $rants = mysqli_query($link,"SELECT distinct id | |
|
|
50 | FROM rant WHERE author = $author[id] AND published < NOW() AND rant.status = 'published'"); | |
|
|
51 | if (mysqli_num_rows($rants) <= 0) | |
|
|
52 | continue; | |
|
|
53 | echo "\t\t<li><a href=\"rant-archive.php#$author[name]\">", utfentities($author[name]), "</a></li>\n"; | |
|
|
54 | } | |
|
|
55 | ?></ul></div> | |
|
|
56 | </div> | |
|
|
57 | <?php | |
|
|
58 | ||
|
|
59 | mysqli_data_seek($AUTHORS, 0); | |
|
|
60 | while ($author = mysqli_fetch_assoc($AUTHORS)) { | |
|
|
61 | $rants = mysqli_query($link,"SELECT distinct id, title, | |
|
|
62 | DATE_FORMAT(published, '%M %D, %Y') AS pubdate | |
|
|
63 | FROM rant WHERE author = $author[id] AND published < NOW() AND rant.status = 'published'"); | |
|
|
64 | if (mysqli_num_rows($rants) <= 0) | |
|
|
65 | continue; | |
|
|
66 | echo '<div class="content"><h2><a id="', $author['name'], '">', utfentities($author['name']), '</a></h2><div><ol>'; | |
|
|
67 | ||
|
|
68 | while($rant = mysqli_fetch_assoc($rants)) | |
|
|
69 | { | |
|
|
70 | printf('<li><a title="%s" name="%d" href="./rant/%d">%s</a></li>', $rant['pubdate'], $rant['id'], $rant['id'], | |
|
|
71 | utfentities($rant['title'])); | |
|
|
72 | } | |
|
|
73 | echo '</ol></div></div>'; | |
|
|
74 | } | |
|
|
75 | } | |
|
|
76 | ||
|
|
77 | pagefoot(); | |
|
|
78 | ?> | |
|
|
79 | </body> | |
|
|
80 | </html> | |
| @@ -0,0 +1,61 | |||
|
|
1 | function relative_time(time_value) { | |
|
|
2 | var values = time_value.split(" "); | |
|
|
3 | time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3]; | |
|
|
4 | var parsed_date = Date.parse(time_value); | |
|
|
5 | var relative_to = (arguments.length > 1) ? arguments[1] : new Date(); | |
|
|
6 | var delta = parseInt((relative_to.getTime() - parsed_date) / 1000); | |
|
|
7 | delta = delta + (relative_to.getTimezoneOffset() * 60); | |
|
|
8 | ||
|
|
9 | if (delta < 60) { | |
|
|
10 | return 'less than a minute ago'; | |
|
|
11 | } else if(delta < 120) { | |
|
|
12 | return 'about a minute ago'; | |
|
|
13 | } else if(delta < (60*60)) { | |
|
|
14 | return (parseInt(delta / 60)).toString() + ' minutes ago'; | |
|
|
15 | } else if(delta < (120*60)) { | |
|
|
16 | return 'about an hour ago'; | |
|
|
17 | } else if(delta < (24*60*60)) { | |
|
|
18 | return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago'; | |
|
|
19 | } else if(delta < (48*60*60)) { | |
|
|
20 | return '1 day ago'; | |
|
|
21 | } else { | |
|
|
22 | return (parseInt(delta / 86400)).toString() + ' days ago'; | |
|
|
23 | } | |
|
|
24 | } | |
|
|
25 | ||
|
|
26 | function twitterToHTML(twitters, title) { | |
|
|
27 | var statusHTML = ''; | |
|
|
28 | ||
|
|
29 | for (var i=0; i<twitters.length && i < 3; i++){ | |
|
|
30 | var tweet = twitters[i].text.replace(/(https?\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/ig, "<a href=\"$1\">$1</a>"); | |
|
|
31 | var uri = 'https://twitter.com/' + twitters[i].user.screen_name + '/statuses/' + twitters[i].id; | |
|
|
32 | statusHTML += '<li>· <span>' + tweet + '</span> <em><a href="' + uri + '">' + relative_time(twitters[i].created_at) + '</a></em></li>'; | |
|
|
33 | } | |
|
|
34 | ||
|
|
35 | return '<ul>' + '<li style="font-weight:bold"><h4><a href="http://twitter.com/' + twitters[0].user.screen_name + '">' + twitters[0].user.screen_name + "'s twitter" + '</a></h4></li>' + statusHTML + '</ul>'; | |
|
|
36 | } | |
|
|
37 | ||
|
|
38 | function mtCallback(obj) { | |
|
|
39 | $('#feed-twitter-megatokyo').html(twitterToHTML(obj, "Megatokyo Twitter")); | |
|
|
40 | } | |
|
|
41 | ||
|
|
42 | function fredCallback(obj) { | |
|
|
43 | $('#feed-twitter-fredrin').html(twitterToHTML(obj, "Fred's Twitter")); | |
|
|
44 | } | |
|
|
45 | ||
|
|
46 | function generateAd(zone, root) | |
|
|
47 | { | |
|
|
48 | if (!document.phpAds_used) | |
|
|
49 | document.phpAds_used = ','; | |
|
|
50 | ||
|
|
51 | phpAds_random = new String (Math.random()); | |
|
|
52 | phpAds_random = phpAds_random.substring(2,11); | |
|
|
53 | ||
|
|
54 | document.write ("<script language='JavaScript' type='text/javascript' src='"); | |
|
|
55 | document.write (root + "/adjs.php?n=" + phpAds_random); | |
|
|
56 | document.write ("&what=zone:" + zone); | |
|
|
57 | document.write ("&exclude=" + document.phpAds_used); | |
|
|
58 | if (document.referrer) | |
|
|
59 | document.write ("&referer=" + escape(document.referrer)); | |
|
|
60 | document.write ("'></script>"); | |
|
|
61 | } | |
| @@ -0,0 +1,22 | |||
|
|
1 | var textbox = document.getElementById('q'); | |
|
|
2 | var filters = document.getElementById('search-filters'); | |
|
|
3 | ||
|
|
4 | var metarx = new RegExp(/\bmeta:"(.*?)"/); | |
|
|
5 | ||
|
|
6 | while(match = metarx.exec(textbox.value)) { | |
|
|
7 | var checks = document.getElementById('search-filters'); | |
|
|
8 | checks = checks.getElementsByTagName('input'); | |
|
|
9 | ||
|
|
10 | var t = checks[4].checked; | |
|
|
11 | checks[4].checked = true; | |
|
|
12 | checks[4].checked = false; | |
|
|
13 | checks[4].checked = t; | |
|
|
14 | ||
|
|
15 | for(i=0; i<checks.length; i++) { | |
|
|
16 | if( checks[i].value == match[1] ) { | |
|
|
17 | checks[i].checked = true; | |
|
|
18 | } | |
|
|
19 | } | |
|
|
20 | ||
|
|
21 | textbox.value = textbox.value.replace(match[0], '').replace(/^\s+|\s+$/g,""); | |
|
|
22 | } | |
| @@ -0,0 +1,22 | |||
|
|
1 | /* track down the ad box */ | |
|
|
2 | var supportbox = document.getElementById('support'); | |
|
|
3 | var adboxes = supportbox.getElementsByTagName('div'); | |
|
|
4 | var adbox; | |
|
|
5 | for(x = 0; x < adboxes.length; x++) { | |
|
|
6 | if('thewrap' == adboxes[x].className) { | |
|
|
7 | adbox = adboxes[x]; | |
|
|
8 | break; | |
|
|
9 | } | |
|
|
10 | } | |
|
|
11 | ||
|
|
12 | /* Track down the half ads */ | |
|
|
13 | var ads = adbox.getElementsByTagName('span'); | |
|
|
14 | var placeholders = 0; | |
|
|
15 | for(x = 0; x < ads.length; x++) { | |
|
|
16 | if('oa-placeholder' == ads[x].className) | |
|
|
17 | placeholders++; | |
|
|
18 | } | |
|
|
19 | ||
|
|
20 | /* Clobber the half ads if both are placeholders */ | |
|
|
21 | if(2 == placeholders) | |
|
|
22 | adbox.style.display = 'none'; | |
|
|
1 | NO CONTENT: new file 100644 |
| @@ -0,0 +1,71 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | pagehead('search-help', 'search help'); | |
|
|
5 | ||
|
|
6 | ?> | |
|
|
7 | ||
|
|
8 | <div class="content"><h2>About Searching</h2><div> | |
|
|
9 | As the guy who wrote the search, I'm the logical candidate to | |
|
|
10 | explain the thing. I'm not quite sure what they other guys make of | |
|
|
11 | it, except that questions about it are bounced to me with remarkable | |
|
|
12 | alacrity.<br><br> | |
|
|
13 | ||
|
|
14 | Without further delay, I'll cut right to the subject: taming the | |
|
|
15 | vicious search ninjas. I mean, using the search engine. Same | |
|
|
16 | difference.<br><br> | |
|
|
17 | ||
|
|
18 | There are two main modes to the search. There's search, which | |
|
|
19 | displays a list of results, and find, which just takes you directly | |
|
|
20 | to a strip. Both are accessible from the <a href="index.php">index page</a>. | |
|
|
21 | Hitting 'enter' or pushing the "go" | |
|
|
22 | button will initiate a normal search. Entering any text in the | |
|
|
23 | searchbox or checking any of the checkboxes will cause the find | |
|
|
24 | buttons to appear. They take you to the previous or next comic | |
|
|
25 | fitting the criteria you've provided. Or the search ninjas apologize | |
|
|
26 | for not being able to find anything, either way.<br><br> | |
|
|
27 | ||
|
|
28 | A brief note about the checkboxes - none checked is the same as | |
|
|
29 | all checked. It makes no difference, except that the latter may take | |
|
|
30 | slightly longer.<br><br> | |
|
|
31 | ||
|
|
32 | The search does a lot of interesting little things. One of the | |
|
|
33 | more useful ones is that if just put in a number and hit enter, | |
|
|
34 | you'll be taken to that strip. Go on, try it. I'll be here when you | |
|
|
35 | get back. One of the side-effects of this is that if you want to | |
|
|
36 | search for a number you have to <A HREF="search.php?q=%2242%22">enclose | |
|
|
37 | it in quotes</A>, but that's the price of convenience.<br><br> | |
|
|
38 | ||
|
|
39 | The most important operator is the colon. It distinguishes between | |
|
|
40 | someone speaking and what's being said. The next most important | |
|
|
41 | operator is the asterisk: *. It's a wildcard, denoting that <I>something</I> | |
|
|
42 | goes there. There's a big difference between <A HREF="search.php?q=Largo%3A">looking | |
|
|
43 | for Largo</A> and looking for <A HREF="search.php?q=*%3ALargo">someone | |
|
|
44 | talking about Largo</A>. Then there's looking for <A HREF="search.php?q=Erika%3Aidiot">Erika | |
|
|
45 | talking about Largo</A>, in which the colon makes a <A HREF="search.php?q=Erika+idiot">very | |
|
|
46 | big difference</A> in the results you get.<br><br> | |
|
|
47 | ||
|
|
48 | There are a few useful magic words - note the highly technical | |
|
|
49 | term. One of them is "chapter". For illustration, here's | |
|
|
50 | <A HREF="search.php?q=Kimiko+chapter%3A6">Kimiko | |
|
|
51 | in Chapter 6</A>. There's also "min" and "max", | |
|
|
52 | which do pretty much what you might expect. Just so we're clear, | |
|
|
53 | here's <A HREF="search.php?q=Piro+max%3A500+min%3A400">what | |
|
|
54 | Piro was up to between comics 400 and 500</A>. There are other magic | |
|
|
55 | words. One of them is "meta", and it's documented on the | |
|
|
56 | search page.<br><br> | |
|
|
57 | ||
|
|
58 | There's one deserving of special mention: "#:random". It | |
|
|
59 | takes you to a random strip within the criteria you specify. So if | |
|
|
60 | you're Alpicola, you can go to a<A HREF="search.php?q=Megumi+%23%3Arandom"> | |
|
|
61 | random Megumi strip</A> with ease.<br><br> | |
|
|
62 | ||
|
|
63 | There may or may not be others. Explore as you will. Just watch | |
|
|
64 | out for the ninjas.<br><br> | |
|
|
65 | ||
|
|
66 | --Kalium | |
|
|
67 | </div></div> | |
|
|
68 | ||
|
|
69 | <?php pagefoot(); ?> | |
|
|
70 | </body> | |
|
|
71 | </html> No newline at end of file | |
| @@ -0,0 +1,31 | |||
|
|
1 | .search { | |
|
|
2 | margin: 10px; | |
|
|
3 | } | |
|
|
4 | ||
|
|
5 | .search #q { | |
|
|
6 | width: 45%; | |
|
|
7 | } | |
|
|
8 | ||
|
|
9 | .results { | |
|
|
10 | margin: 0px; | |
|
|
11 | padding: 1ex 2em; | |
|
|
12 | background-color: #757b81; | |
|
|
13 | } | |
|
|
14 | ||
|
|
15 | .results, .results a { color: #f6b33d; } | |
|
|
16 | .results a:visited { color:#ececa3; } | |
|
|
17 | .results a:hover { color:#eb5252; } | |
|
|
18 | ||
|
|
19 | #syntax code { color:#f6b33d } | |
|
|
20 | #syntax form { margin:0px } | |
|
|
21 | ||
|
|
22 | dt { | |
|
|
23 | font-size:larger; | |
|
|
24 | } | |
|
|
25 | ||
|
|
26 | ol { | |
|
|
27 | list-style-type: none; | |
|
|
28 | } | |
|
|
29 | ||
|
|
30 | /* Overload header texts */ | |
|
|
31 | #syntax h2 span { background:url(parts/mt-blk_bar-search_syntax.png) no-repeat } | |
| This diff has been collapsed as it changes many lines, (598 lines changed) Show them Hide them | |||
| @@ -0,0 +1,598 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | require_once('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | $strings = $queries = $rhits = $hcount = $magic = $value = $sub_magic = $sub_value = Array(); | |
|
|
6 | $sub_queries = $sub_rhits = $sub_uhits = Array(); | |
|
|
7 | $META_TYPES = $META_TEMP = $SEARCH_TYPES = $SEARCH_TEMP = Array(); | |
|
|
8 | $query = ''; | |
|
|
9 | $modifier = ''; | |
|
|
10 | $random = false; | |
|
|
11 | $date = $date_f = false; | |
|
|
12 | ||
|
|
13 | if(isset($_REQUEST['q']) && ctype_digit($_REQUEST['q'])) { | |
|
|
14 | $MAX_METHOD_ID = max_strip_id(); | |
|
|
15 | if($MAX_METHOD_ID >= $_REQUEST['q'] && $_REQUEST['q'] > 0) | |
|
|
16 | { | |
|
|
17 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
18 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$_REQUEST[q]"); | |
|
|
19 | exit(0); | |
|
|
20 | } | |
|
|
21 | } | |
|
|
22 | ||
|
|
23 | #check if it's a date | |
|
|
24 | #try these three different formats | |
|
|
25 | # mm dd yyyy first | |
|
|
26 | $date = strptime($_REQUEST['q'], "%m.%d.%Y"); | |
|
|
27 | if(!$date) $date = strptime($_REQUEST['q'], "%m/%d/%Y"); | |
|
|
28 | if(!$date) $date = strptime($_REQUEST['q'], "%m-%d-%Y"); | |
|
|
29 | ||
|
|
30 | #then yyyy mm dd | |
|
|
31 | if(!$date) $date = strptime($_REQUEST['q'], "%Y/%m/%d"); | |
|
|
32 | if(!$date) $date = strptime($_REQUEST['q'], "%Y.%m.%d"); | |
|
|
33 | if(!$date) $date = strptime($_REQUEST['q'], "%Y-%m-%d"); | |
|
|
34 | ||
|
|
35 | #if date, convert to unix timestamp | |
|
|
36 | if($date) | |
|
|
37 | { | |
|
|
38 | $date_formatted = (1900+$date['tm_year']).'-'.(1+$date['tm_mon']).'-'.$date['tm_mday']; | |
|
|
39 | $date_f = strtotime($date_formatted); | |
|
|
40 | $date_f = strtotime("+1 day", $date_f); | |
|
|
41 | } | |
|
|
42 | ||
|
|
43 | #if unix timestamp, try to go there | |
|
|
44 | if($date_f && $date) | |
|
|
45 | { | |
|
|
46 | $goto = get_by_date($date_f); | |
|
|
47 | if(isset($goto) && $goto > 0) | |
|
|
48 | { | |
|
|
49 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
50 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$goto"); | |
|
|
51 | exit(0); | |
|
|
52 | } | |
|
|
53 | } | |
|
|
54 | ||
|
|
55 | if(isset($_REQUEST['q'])) | |
|
|
56 | { | |
|
|
57 | ||
|
|
58 | if( isset($_GET['method-fp_x']) || isset($_GET['method-fp_y']) | |
|
|
59 | || isset($_GET['method-fp.x']) || isset($_GET['method-fp.y']) ) { | |
|
|
60 | array_push($magic, 'max'); | |
|
|
61 | array_push($value, $_GET['current'] - 1); | |
|
|
62 | ||
|
|
63 | array_push($magic, 'method'); | |
|
|
64 | array_push($value, 'Find Previous'); | |
|
|
65 | } | |
|
|
66 | if( isset($_GET['method-fn_x']) || isset($_GET['method-fn_y']) | |
|
|
67 | || isset($_GET['method-fn.x']) || isset($_GET['method-fn.y']) ) { | |
|
|
68 | array_push($magic, 'min'); | |
|
|
69 | array_push($value, $_GET['current'] + 1); | |
|
|
70 | ||
|
|
71 | array_push($magic, 'method'); | |
|
|
72 | array_push($value, 'Find Next'); | |
|
|
73 | } | |
|
|
74 | ||
|
|
75 | // Turn named parameters into query string items | |
|
|
76 | $_REQUEST['q'] = trim($_REQUEST['q']); | |
|
|
77 | foreach($_GET as $k => $v) { | |
|
|
78 | if( $k == 'x' || $k == 'y' ) continue; | |
|
|
79 | if( $k == 'q' || $k == 'current' ) continue; | |
|
|
80 | if( substr($k, 0, 7) == 'method-' ) continue; | |
|
|
81 | if(is_array($v)) { | |
|
|
82 | foreach($v as $val) | |
|
|
83 | $_REQUEST['q'] = trim("$_REQUEST[q] $k:\"$val\""); | |
|
|
84 | } else { | |
|
|
85 | $_REQUEST['q'] = trim("$_REQUEST[q] $k:\"$v\""); | |
|
|
86 | } | |
|
|
87 | } | |
|
|
88 | ||
|
|
89 | if(get_magic_quotes_gpc()) | |
|
|
90 | $_REQUEST['q'] = stripslashes($_REQUEST['q']); | |
|
|
91 | ||
|
|
92 | $tokens = tpw_parse_line('\s+', $_REQUEST['q']); | |
|
|
93 | ||
|
|
94 | # Protect against SQL injection in the event of Register Globals being on. | |
|
|
95 | $SEARCH_MIN = $SEARCH_MAX = null; | |
|
|
96 | ||
|
|
97 | foreach($tokens as $token) { | |
|
|
98 | $token = strtolower($token); | |
|
|
99 | ||
|
|
100 | # Determine if we want to subtract | |
|
|
101 | if($token[0] == '-') { | |
|
|
102 | $token = substr($token, 1); | |
|
|
103 | $loop_magic =& $sub_magic; | |
|
|
104 | $loop_value =& $sub_value; | |
|
|
105 | } else { | |
|
|
106 | $loop_magic =& $magic; | |
|
|
107 | $loop_value =& $value; | |
|
|
108 | } | |
|
|
109 | ||
|
|
110 | $subtokens = preg_match('/(?:\w+|[#*]):/', $token) ? preg_split('/:/', $token, 2) : Array( false, $token ); | |
|
|
111 | ||
|
|
112 | # Magic values are easy, just throw them on the list | |
|
|
113 | array_push($loop_magic, $subtokens[0]); | |
|
|
114 | ||
|
|
115 | # Values, however, need a bit more cleaning up first | |
|
|
116 | if('""' == $subtokens[1]) | |
|
|
117 | array_push($loop_value, '""'); | |
|
|
118 | else | |
|
|
119 | array_push($loop_value, preg_replace('/[[:punct:]]|(?<=\s)\s+/', '', $subtokens[1])); | |
|
|
120 | } | |
|
|
121 | ||
|
|
122 | #DEBUG | |
|
|
123 | #print_r($magic); | |
|
|
124 | #echo "<br>"; | |
|
|
125 | #print_r($value); | |
|
|
126 | #echo "<br>"; | |
|
|
127 | ||
|
|
128 | #do subtraction logic first | |
|
|
129 | if(count($sub_magic) > 0) | |
|
|
130 | { | |
|
|
131 | #iterate over all subtraction magic/value pairs | |
|
|
132 | foreach($sub_magic as $i => $m) | |
|
|
133 | { | |
|
|
134 | $query = "SELECT DISTINCT strip.id FROM strip | |
|
|
135 | LEFT JOIN transcript ON strip.id = transcript.strip | |
|
|
136 | JOIN strip_t ON strip.type = strip_t.id | |
|
|
137 | LEFT JOIN meta ON strip_t.id = meta.type | |
|
|
138 | LEFT JOIN meta_t ON meta.meta = meta_t.id | |
|
|
139 | WHERE (strip.published < NOW()) | |
|
|
140 | AND (transcript.speaker NOT LIKE \"#%\" | |
|
|
141 | OR transcript.speaker IS NULL) "; | |
|
|
142 | ||
|
|
143 | $flag = false; | |
|
|
144 | ||
|
|
145 | if($m) #attempt to short-circuit on no magic | |
|
|
146 | { | |
|
|
147 | # well, we have magic | |
|
|
148 | if($m == "type" || $m == "chapter") | |
|
|
149 | { | |
|
|
150 | if(ctype_digit(strval($sub_value[$i]))) | |
|
|
151 | { | |
|
|
152 | $modifier .= " AND (strip_t.description NOT LIKE '%chapter ".mysqli_real_escape_string($link,$sub_value[$i])."%')"; | |
|
|
153 | continue; | |
|
|
154 | } | |
|
|
155 | else | |
|
|
156 | { | |
|
|
157 | $modifier .= " AND (strip_t.description NOT LIKE '%".mysqli_real_escape_string($link,$sub_value[$i])."%')"; | |
|
|
158 | continue; | |
|
|
159 | } | |
|
|
160 | } | |
|
|
161 | else if($m == "meta") | |
|
|
162 | { | |
|
|
163 | $modifier .= " AND (meta_t.name NOT LIKE '".mysqli_real_escape_string($link,$sub_value[$i])."%')"; | |
|
|
164 | continue; | |
|
|
165 | } | |
|
|
166 | else if($m == "*") | |
|
|
167 | { | |
|
|
168 | #we want to exclude the speaker from this search | |
|
|
169 | # but here, we don't actually need to do much | |
|
|
170 | $m = mysqli_real_escape_string($link,$m); | |
|
|
171 | } | |
|
|
172 | else | |
|
|
173 | { | |
|
|
174 | #it's not a special operator, so assume they mean a character speaking | |
|
|
175 | $tmp = mysqli_real_escape_string($link,$m); | |
|
|
176 | $query .= "AND (transcript.speaker LIKE \"%$tmp%\" ) "; | |
|
|
177 | $flag = true; | |
|
|
178 | } | |
|
|
179 | } | |
|
|
180 | ||
|
|
181 | #now, handle the $value portion of the string | |
|
|
182 | # first, handle for "" | |
|
|
183 | switch($sub_value[$i]) { | |
|
|
184 | case '""': | |
|
|
185 | $query .= "AND (transcript.search = '' ) "; | |
|
|
186 | break; | |
|
|
187 | case '': | |
|
|
188 | break; | |
|
|
189 | case '*': | |
|
|
190 | $query .= "AND (transcript.search != '' ) "; | |
|
|
191 | break; | |
|
|
192 | default: | |
|
|
193 | $tmp = mysqli_real_escape_string($link,$sub_value[$i]); | |
|
|
194 | $query .= "AND (transcript.search LIKE \"%$tmp%\""; | |
|
|
195 | if($m != '*' && !$flag) | |
|
|
196 | { | |
|
|
197 | $query.= "OR transcript.speaker = \"$tmp\" | |
|
|
198 | OR strip.title LIKE \"%$tmp%\" "; | |
|
|
199 | } | |
|
|
200 | $query.=") "; | |
|
|
201 | } | |
|
|
202 | ||
|
|
203 | array_push($sub_queries, $query); | |
|
|
204 | } | |
|
|
205 | ||
|
|
206 | foreach($sub_queries as $q) | |
|
|
207 | { | |
|
|
208 | #DEBUG: run the search | |
|
|
209 | #echo $q; | |
|
|
210 | $result = mysqli_query($link,$q); | |
|
|
211 | ||
|
|
212 | if(!$result) | |
|
|
213 | { | |
|
|
214 | continue; | |
|
|
215 | } | |
|
|
216 | ||
|
|
217 | while($row = mysqli_fetch_row($result)) | |
|
|
218 | { | |
|
|
219 | #and put all the hits onto an array | |
|
|
220 | array_push($sub_rhits, $row[0]); | |
|
|
221 | } | |
|
|
222 | } | |
|
|
223 | } | |
|
|
224 | ||
|
|
225 | foreach($magic as $i => $m) | |
|
|
226 | { | |
|
|
227 | $query = "SELECT DISTINCT strip.id FROM strip | |
|
|
228 | LEFT JOIN transcript ON strip.id = transcript.strip | |
|
|
229 | JOIN strip_t ON strip.type = strip_t.id | |
|
|
230 | LEFT JOIN meta ON strip_t.id = meta.type | |
|
|
231 | LEFT JOIN meta_t ON meta.meta = meta_t.id | |
|
|
232 | WHERE (strip.published < NOW()) | |
|
|
233 | AND (transcript.speaker NOT LIKE \"#%\" | |
|
|
234 | OR transcript.speaker IS NULL) "; | |
|
|
235 | ||
|
|
236 | $flag = false; | |
|
|
237 | ||
|
|
238 | if($m) #attempt to short-circuit on no magic | |
|
|
239 | { | |
|
|
240 | # well, we have magic | |
|
|
241 | # so handle special operators first | |
|
|
242 | # max and min don't really generate queries, so they short-circuit the loop | |
|
|
243 | if($m == "min") | |
|
|
244 | { | |
|
|
245 | if(ctype_digit(strval($value[$i]))) | |
|
|
246 | $SEARCH_MIN = (int)$value[$i]; | |
|
|
247 | continue; | |
|
|
248 | } | |
|
|
249 | else if($m == "max") | |
|
|
250 | { | |
|
|
251 | if(ctype_digit(strval($value[$i]))) | |
|
|
252 | $SEARCH_MAX = (int)$value[$i]; | |
|
|
253 | continue; | |
|
|
254 | } | |
|
|
255 | else if($m == "#") | |
|
|
256 | { | |
|
|
257 | if(ctype_digit(strval($value[$i]))) | |
|
|
258 | { | |
|
|
259 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
260 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$value[$i]"); | |
|
|
261 | exit(0); | |
|
|
262 | } | |
|
|
263 | elseif($value[$i] == "random") | |
|
|
264 | { | |
|
|
265 | $random = true; | |
|
|
266 | } | |
|
|
267 | continue; | |
|
|
268 | } | |
|
|
269 | else if($m == "type" || $m == "chapter") | |
|
|
270 | { | |
|
|
271 | if(ctype_digit(strval($value[$i]))) | |
|
|
272 | { | |
|
|
273 | array_push($SEARCH_TYPES, mysqli_real_escape_string($link,"chapter ".$value[$i])); | |
|
|
274 | continue; | |
|
|
275 | } | |
|
|
276 | else | |
|
|
277 | { | |
|
|
278 | array_push($SEARCH_TYPES, mysqli_real_escape_string($link,$value[$i])); | |
|
|
279 | continue; | |
|
|
280 | } | |
|
|
281 | } | |
|
|
282 | else if($m == "meta") | |
|
|
283 | { | |
|
|
284 | array_push($META_TYPES, mysqli_real_escape_string($link,$value[$i])); | |
|
|
285 | continue; | |
|
|
286 | } | |
|
|
287 | else if($m == "book") | |
|
|
288 | { | |
|
|
289 | if(ctype_digit(strval($value[$i]))) | |
|
|
290 | { | |
|
|
291 | $BOOK = " AND (strip.book =" . (int)$value[$i] . ") "; | |
|
|
292 | continue; | |
|
|
293 | } | |
|
|
294 | } | |
|
|
295 | else if($m == "page") | |
|
|
296 | { | |
|
|
297 | if(ctype_digit(strval($value[$i]))) | |
|
|
298 | { | |
|
|
299 | $PAGE = " AND (strip.page =" . (int)$value[$i] . ") "; | |
|
|
300 | continue; | |
|
|
301 | } | |
|
|
302 | } | |
|
|
303 | else if($m == "method") | |
|
|
304 | { | |
|
|
305 | $METHOD = $value[$i]; | |
|
|
306 | continue; | |
|
|
307 | } | |
|
|
308 | else if($m == "*") | |
|
|
309 | { | |
|
|
310 | #we want to exclude the speaker from this search | |
|
|
311 | # but here, we don't actually need to do much | |
|
|
312 | $m = mysqli_real_escape_string($link,$m); | |
|
|
313 | } | |
|
|
314 | else | |
|
|
315 | { | |
|
|
316 | #it's not a special operator, so assume they mean a character speaking | |
|
|
317 | $tmp = mysqli_real_escape_string($link,$m); | |
|
|
318 | $query .= "AND (transcript.speaker LIKE \"%$tmp%\" ) "; | |
|
|
319 | $flag = true; | |
|
|
320 | } | |
|
|
321 | } | |
|
|
322 | ||
|
|
323 | #now, handle the $value portion of the string | |
|
|
324 | # first, handle for "" | |
|
|
325 | switch($value[$i]) { | |
|
|
326 | case '""': | |
|
|
327 | $query .= "AND (transcript.search = '' ) "; | |
|
|
328 | break; | |
|
|
329 | case '': | |
|
|
330 | break; | |
|
|
331 | case '*': | |
|
|
332 | $query .= "AND (transcript.search != '' ) "; | |
|
|
333 | break; | |
|
|
334 | default: | |
|
|
335 | $tmp = mysqli_real_escape_string($link,$value[$i]); | |
|
|
336 | $query .= "AND (transcript.search LIKE \"%$tmp%\""; | |
|
|
337 | if($m != '*' && !$flag) | |
|
|
338 | { | |
|
|
339 | $query.= "OR transcript.speaker = \"$tmp\" | |
|
|
340 | OR strip.title LIKE \"%$tmp%\" "; | |
|
|
341 | } | |
|
|
342 | $query.=") "; | |
|
|
343 | } | |
|
|
344 | ||
|
|
345 | array_push($queries, $query); | |
|
|
346 | } | |
|
|
347 | ||
|
|
348 | if(count($queries) == 0) | |
|
|
349 | { | |
|
|
350 | array_push($queries, $query); | |
|
|
351 | } | |
|
|
352 | ||
|
|
353 | #additive search logic | |
|
|
354 | ||
|
|
355 | #generate type and metatype strings now | |
|
|
356 | #searching for a specific type is a little messy | |
|
|
357 | if(count($SEARCH_TYPES) > 0) | |
|
|
358 | { | |
|
|
359 | foreach($SEARCH_TYPES as $SEARCH) | |
|
|
360 | { | |
|
|
361 | array_push($SEARCH_TEMP, "strip_t.description LIKE '%$SEARCH%' | |
|
|
362 | OR strip_t.name LIKE '%$SEARCH%'"); | |
|
|
363 | } | |
|
|
364 | #second, collapse them into one clause | |
|
|
365 | $modifier .= " AND (" . implode(" OR ", $SEARCH_TEMP) . ") "; | |
|
|
366 | } | |
|
|
367 | ||
|
|
368 | #now the metatypes, just like the types | |
|
|
369 | if(count($META_TYPES) > 0) | |
|
|
370 | { | |
|
|
371 | #OK, now apply the metatype restrictions... | |
|
|
372 | foreach($META_TYPES as $META) | |
|
|
373 | { | |
|
|
374 | #first, generate the restriction strings | |
|
|
375 | array_push($META_TEMP, "meta_t.name LIKE '" . $META . "%'"); | |
|
|
376 | } | |
|
|
377 | #second, collapse them into one clause | |
|
|
378 | $modifier .= " AND (" . implode(" OR ", $META_TEMP) . ") "; | |
|
|
379 | } | |
|
|
380 | ||
|
|
381 | #now do min and max | |
|
|
382 | if(isset($SEARCH_MIN)) | |
|
|
383 | { | |
|
|
384 | $modifier .= "AND ($SEARCH_MIN <= strip.id) "; | |
|
|
385 | } | |
|
|
386 | if(isset($SEARCH_MAX)) | |
|
|
387 | { | |
|
|
388 | $modifier .= "AND (strip.id <= $SEARCH_MAX) "; | |
|
|
389 | } | |
|
|
390 | ||
|
|
391 | #and now book and page | |
|
|
392 | if(isset($BOOK)) | |
|
|
393 | { | |
|
|
394 | $modifier .= $BOOK; | |
|
|
395 | } | |
|
|
396 | if(isset($PAGE)) | |
|
|
397 | { | |
|
|
398 | $modifier .= $PAGE; | |
|
|
399 | } | |
|
|
400 | ||
|
|
401 | foreach($queries as $q) | |
|
|
402 | { | |
|
|
403 | #apply modifiers | |
|
|
404 | $q .= $modifier; | |
|
|
405 | #DEBUG: run the search | |
|
|
406 | #echo $q; | |
|
|
407 | if(empty($q)) { | |
|
|
408 | continue; | |
|
|
409 | } | |
|
|
410 | $result = mysqli_query($link,$q); | |
|
|
411 | ||
|
|
412 | if(!$result) | |
|
|
413 | { | |
|
|
414 | continue; | |
|
|
415 | } | |
|
|
416 | ||
|
|
417 | while($row = mysqli_fetch_row($result)) | |
|
|
418 | { | |
|
|
419 | #and put all the hits onto an array | |
|
|
420 | array_push($rhits, $row[0]); | |
|
|
421 | } | |
|
|
422 | } | |
|
|
423 | ||
|
|
424 | #so, now all the raw hits are in the same spot | |
|
|
425 | #now comes The Magic | |
|
|
426 | ||
|
|
427 | # if book and page are used, break out | |
|
|
428 | if(isset($BOOK) && isset($PAGE) && count($rhits) != 0) | |
|
|
429 | { | |
|
|
430 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
431 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$rhits[0]"); | |
|
|
432 | exit(0); | |
|
|
433 | } | |
|
|
434 | ||
|
|
435 | #first, reverse sort and uniquify a copy | |
|
|
436 | rsort($rhits); | |
|
|
437 | $uhits = array_unique($rhits); | |
|
|
438 | #do the same for the subtraction hits | |
|
|
439 | $sub_uhits = array_unique($sub_rhits); | |
|
|
440 | ||
|
|
441 | #now... the subtraction! | |
|
|
442 | $uhits = array_diff($uhits, $sub_uhits); | |
|
|
443 | ||
|
|
444 | #if we're redirecting, break out of the normal search logic here | |
|
|
445 | if(isset($METHOD) && count($uhits) > 0) | |
|
|
446 | { | |
|
|
447 | #$METHOD has a value, so we're bustin' outta here! | |
|
|
448 | if($METHOD == "Find Next") | |
|
|
449 | { | |
|
|
450 | $target = end($rhits); | |
|
|
451 | } | |
|
|
452 | else if($METHOD == "Find Previous") | |
|
|
453 | { | |
|
|
454 | $target = $rhits[0]; | |
|
|
455 | } | |
|
|
456 | ||
|
|
457 | //die($METHOD); | |
|
|
458 | ||
|
|
459 | header('HTTP/1.0 301 Moved Permanently'); | |
|
|
460 | header('Location: ' . SITE_HOST . SITE_PATH . "/index.php?strip_id=$target" . "&q=" . urlencode($_REQUEST['q'])); | |
|
|
461 | exit(0); | |
|
|
462 | } | |
|
|
463 | ||
|
|
464 | $revhits = array_reverse($rhits); | |
|
|
465 | #now create a count for each unique hit | |
|
|
466 | foreach($uhits as $key => $value) | |
|
|
467 | { | |
|
|
468 | $first = array_search($value, $rhits); | |
|
|
469 | $last = array_search($value, $revhits); | |
|
|
470 | ||
|
|
471 | $numhits = count($rhits) - $first - $last; | |
|
|
472 | ||
|
|
473 | array_push($hcount, $numhits); | |
|
|
474 | } | |
|
|
475 | ||
|
|
476 | if(count($uhits) > 0) { | |
|
|
477 | if($random) | |
|
|
478 | { | |
|
|
479 | $rand = mt_rand(1, count($uhits)); | |
|
|
480 | header('Location: ' . SITE_HOST . SITE_PATH . "/index.php?strip_id=$uhits[$rand]" . "&q=" . urlencode($_REQUEST['q'])); | |
|
|
481 | } | |
|
|
482 | $qsearch = mysqli_query($link,'SELECT id, title FROM strip WHERE id IN(' . implode(', ', $uhits) . ') GROUP BY id ORDER BY id DESC'); | |
|
|
483 | while($result = mysqli_fetch_array($qsearch)) | |
|
|
484 | { | |
|
|
485 | $entry = "<li><a href=\"strip/$result[0]\">".str_pad($result[0], 4, 0, STR_PAD_LEFT); | |
|
|
486 | $entry.= " - ". htmlentities($result[1]) . "</a></li>"; | |
|
|
487 | array_push($strings, $entry); | |
|
|
488 | } | |
|
|
489 | ||
|
|
490 | #now, a clever multisort... | |
|
|
491 | array_multisort($hcount, SORT_DESC, SORT_NUMERIC, | |
|
|
492 | $uhits, SORT_DESC, SORT_NUMERIC, | |
|
|
493 | $strings, SORT_ASC, SORT_STRING); | |
|
|
494 | } | |
|
|
495 | } | |
|
|
496 | ||
|
|
497 | pagehead('search', 'Search'); | |
|
|
498 | ?> | |
|
|
499 | ||
|
|
500 | <form class="search" action="search.php" method="get"><div> | |
|
|
501 | <input type="text" name="q" <?php if( $_REQUEST['q'] ) { printf('value="%s"', utfentities($_REQUEST['q']) ); } ?> /> | |
|
|
502 | <input type="submit" value="Search" /> | |
|
|
503 | </div></form> | |
|
|
504 | ||
|
|
505 | <?php if(count($uhits) > 0) { | |
|
|
506 | echo '<div class="content"><div><ol class="results">'; | |
|
|
507 | /*$qsearch = mysqli_query($link,'SELECT id, title FROM strip WHERE id IN(' . implode(', ', $uhits) . ')'); | |
|
|
508 | while($result = mysqli_fetch_array($qsearch)) | |
|
|
509 | printf('<li><a href="?strip_id=%d">%s - %s</a></li>', | |
|
|
510 | $result[0], str_pad($result[0], 4, 0, STR_PAD_LEFT), $result[1]);*/ | |
|
|
511 | foreach($strings as $str) | |
|
|
512 | { | |
|
|
513 | echo $str; | |
|
|
514 | } | |
|
|
515 | echo '</ol></div>'; | |
|
|
516 | echo '<div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; | |
|
|
517 | ||
|
|
518 | ?> | |
|
|
519 | <form class="search" action="search.php" method="get"><div> | |
|
|
520 | <input type="text" name="q" <?php if( $_REQUEST['q'] ) { printf('value="%s"', utfentities($_REQUEST['q']) ); } ?> /> | |
|
|
521 | <input type="submit" value="Search" /> | |
|
|
522 | </div></form> | |
|
|
523 | <?php | |
|
|
524 | } elseif(isset($_REQUEST['q']) && (strlen($_REQUEST['q']) > 0)) { | |
|
|
525 | echo '<div class="content"><div><p class="results">So sorry. Search ninjas obey without fail, yet find nothing.</p></div>'; | |
|
|
526 | echo '<div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; | |
|
|
527 | } else | |
|
|
528 | { | |
|
|
529 | echo '<div class="content"><div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; | |
|
|
530 | } | |
|
|
531 | #search_help(); | |
|
|
532 | ||
|
|
533 | ?> | |
|
|
534 | ||
|
|
535 | <?php pagefoot() ?> | |
|
|
536 | </body> | |
|
|
537 | </html> | |
|
|
538 | <?php | |
|
|
539 | ||
|
|
540 | function tpw_parse_line($delimiter, $line) | |
|
|
541 | { | |
|
|
542 | $i = 0; | |
|
|
543 | $bits = Array(); | |
|
|
544 | $word = ''; | |
|
|
545 | ||
|
|
546 | $valid_quotes = '"'; | |
|
|
547 | ||
|
|
548 | # $line must not have trailing slash or quote | |
|
|
549 | $line = preg_replace('/((?:\\\\\\\\)*)\\\\?$/', '\1', rtrim($line)); | |
|
|
550 | if(substr_count($line, '"') % 2 == 1) | |
|
|
551 | $line .= '"'; | |
|
|
552 | ||
|
|
553 | $regex = "/^([$valid_quotes])((?:\\\\.|(?!\\1)[^\\\\])*)\\1([\\000-\\377]*)|" . | |
|
|
554 | "^((?:\\\\.|[^\\\\$valid_quotes])*?)(\\Z(?!\\n)|$delimiter|(?!^)(?=[$valid_quotes]))([\\000-\\377]*)/x"; | |
|
|
555 | ||
|
|
556 | while (strlen($line) && $i++ < 100) { | |
|
|
557 | $tokens = preg_match($regex, $line, $matches); | |
|
|
558 | $tpw_quote = $matches[1]; | |
|
|
559 | $tpw_quoted = $matches[2]; | |
|
|
560 | $tpw_unquoted = $matches[4]; | |
|
|
561 | $tpw_delim = $matches[5]; | |
|
|
562 | ||
|
|
563 | if ($tpw_quote || strlen($tpw_unquoted) || strlen($tpw_delim)) { } | |
|
|
564 | else { return; } | |
|
|
565 | ||
|
|
566 | $line = (isset($matches[6]) ? $matches[6] : $matches[3]); | |
|
|
567 | ||
|
|
568 | // Remove quotes and backslashes from tokens | |
|
|
569 | /* $tpw_unquoted = preg_replace("/\\\\(.)/", '$1', $tpw_unquoted); | |
|
|
570 | if (isset($tpw_quote)) { | |
|
|
571 | preg_replace("/\\\\(.)/", '$1', $tpw_quoted); | |
|
|
572 | } */ | |
|
|
573 | ||
|
|
574 | // Keep quotes and backslashes in tokens | |
|
|
575 | $tpw_quoted = "$tpw_quote$tpw_quoted$tpw_quote"; | |
|
|
576 | ||
|
|
577 | $word .= ($tpw_quote ? $tpw_quoted : $tpw_unquoted); | |
|
|
578 | ||
|
|
579 | if (strlen($tpw_delim)) { | |
|
|
580 | array_push($bits, $word); | |
|
|
581 | $word = ''; | |
|
|
582 | } | |
|
|
583 | if (!strlen($line)) { | |
|
|
584 | array_push($bits, $word); | |
|
|
585 | } | |
|
|
586 | } | |
|
|
587 | ||
|
|
588 | return $bits; | |
|
|
589 | } | |
|
|
590 | ||
|
|
591 | function get_by_date($stamp) | |
|
|
592 | { | |
|
|
593 | global $link; | |
|
|
594 | $qr = mysqli_query($link,"SELECT MAX(id) FROM strip WHERE published < NOW() AND published < FROM_UNIXTIME($stamp)") or die(mysqli_error($link)); | |
|
|
595 | return current(mysqli_fetch_row($qr)); | |
|
|
596 | } | |
|
|
597 | ||
|
|
598 | ?> | |
| @@ -0,0 +1,1 | |||
|
|
1 | h3, h4, h5, h6 { color:#f6b33d } | |
| @@ -0,0 +1,32 | |||
|
|
1 | <?php | |
|
|
2 | ||
|
|
3 | include('frontend.inc.php'); | |
|
|
4 | ||
|
|
5 | $qr = mysqli_query($link,'SELECT title, body, style, UNIX_TIMESTAMP(pubdate) AS published, status | |
|
|
6 | FROM static_page | |
|
|
7 | WHERE url_name = "' . mysqli_real_escape_string($link, $_GET['name']) . '"') or die(mysqli_error($link)); | |
|
|
8 | $PAGE = mysqli_fetch_assoc($qr); | |
|
|
9 | ||
|
|
10 | if(!$PAGE) { | |
|
|
11 | header('HTTP/1.0 404 Not Found'); | |
|
|
12 | exit(0); | |
|
|
13 | } | |
|
|
14 | if($PAGE['status'] != 'published') { | |
|
|
15 | header('HTTP/1.0 403 Forbidden'); | |
|
|
16 | exit(0); | |
|
|
17 | } | |
|
|
18 | conditional_exit($PAGE['published']); | |
|
|
19 | ||
|
|
20 | ||
|
|
21 | pagehead('static', $PAGE['title'], $PAGE['style']); | |
|
|
22 | ?> | |
|
|
23 | ||
|
|
24 | <div class="content"> | |
|
|
25 | <h2><?php echo utfentities($PAGE['title']) ?></h2> | |
|
|
26 | <div id="<?php echo utfentities($_GET['name']) ?>"> | |
|
|
27 | <?php echo $PAGE['body'] ?> | |
|
|
28 | </div></div> | |
|
|
29 | ||
|
|
30 | <?php pagefoot() ?> | |
|
|
31 | </body> | |
|
|
32 | </html> | |
|
|
1 | NO CONTENT: new file 100644 |
| @@ -0,0 +1,19 | |||
|
|
1 | #inner { | |
|
|
2 | /* Satisfy internal floated elements */ | |
|
|
3 | overflow: hidden; | |
|
|
4 | height: 100%; | |
|
|
5 | border: none; | |
|
|
6 | margin: 0em 1em; | |
|
|
7 | } | |
|
|
8 | ||
|
|
9 | #inner img | |
|
|
10 | { | |
|
|
11 | display: block; | |
|
|
12 | margin-left: auto; | |
|
|
13 | margin-right: auto | |
|
|
14 | } | |
|
|
15 | ||
|
|
16 | #inner h3 | |
|
|
17 | { | |
|
|
18 | color:#F6B33D; | |
|
|
19 | } No newline at end of file | |
| @@ -0,0 +1,1 | |||
|
|
1 | LocalSettings.php | |
Comments 0
You need to be logged in to leave comments.
Login now
