Not Reviewed
Show More
Add another comment
| @@ -4,6 +4,11 LocalSettings.php | |||||
|
|
4 | # Comic images |
|
4 | # Comic images |
|
|
5 | strips |
|
5 | strips |
|
|
6 |
|
6 | ||
|
|
|
7 | # Site assets | ||
|
|
|
8 | attachments | ||
|
|
|
9 | nameplates | ||
|
|
|
10 | rantimgs | ||
|
|
|
11 | |||
|
|
7 | # Fred's random extra stuff |
|
12 | # Fred's random extra stuff |
|
|
8 | extra |
|
13 | extra |
|
|
9 | naishou |
|
14 | naishou |
| @@ -28,7 +28,7 if(isset($_REQUEST['list_by']) && $_REQUEST['list_by'] == "date") | |||||
|
|
28 | $comics = mysqli_query($link,"SELECT distinct id, title, |
|
28 | $comics = mysqli_query($link,"SELECT distinct id, title, |
|
|
29 | DATE_FORMAT(published, '%M %D, %Y') AS pubdate |
|
29 | DATE_FORMAT(published, '%M %D, %Y') AS pubdate |
|
|
30 | FROM strip WHERE published < NOW() ORDER BY id") or die(mysqli_error($link)); |
|
30 | FROM strip WHERE published < NOW() ORDER BY id") or die(mysqli_error($link)); |
|
|
31 |
|
31 | ||
|
|
32 | echo '<div class="content"><h2>Comics by Date</h2><div><ul>'; |
|
32 | echo '<div class="content"><h2>Comics by Date</h2><div><ul>'; |
|
|
33 |
|
33 | ||
|
|
34 | while($comic = mysqli_fetch_assoc($comics)) |
|
34 | while($comic = mysqli_fetch_assoc($comics)) |
| @@ -8,7 +8,7 pagehead('characters', 'Characters'); | |||||
|
|
8 | <p><q>All right, all right! I still don't feel like finishing these sections, but whatever (grumble)...</q><br /> |
|
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> |
|
9 | piro - fall 2007</p> |
|
|
10 |
|
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 |
|
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> |
|
12 | (because they still need some work).</p> |
|
|
13 |
|
13 | ||
|
|
14 | </div></div> |
|
14 | </div></div> |
| @@ -4,20 +4,20 require_once 'frontend.inc.php'; | |||||
|
|
4 |
|
4 | ||
|
|
5 | class MTAPIi |
|
5 | class MTAPIi |
|
|
6 | { |
|
6 | { |
|
|
7 |
|
7 | ||
|
|
8 | private static $db_conn; |
|
8 | private static $db_conn; |
|
|
9 |
|
9 | ||
|
|
10 | static function construct($db) |
|
10 | static function construct($db) |
|
|
11 | { |
|
11 | { |
|
|
12 | $db_conn = $db; |
|
12 | $db_conn = $db; |
|
|
13 | return mysqli_ping($db_conn); |
|
13 | return mysqli_ping($db_conn); |
|
|
14 | } |
|
14 | } |
|
|
15 |
|
15 | ||
|
|
16 | static function destruct() |
|
16 | static function destruct() |
|
|
17 | { |
|
17 | { |
|
|
18 | $db_conn = NULL; |
|
18 | $db_conn = NULL; |
|
|
19 | } |
|
19 | } |
|
|
20 |
|
20 | ||
|
|
21 | #This just returns the current maximum comic |
|
21 | #This just returns the current maximum comic |
|
|
22 | static function getNumStrips() |
|
22 | static function getNumStrips() |
|
|
23 | { |
|
23 | { |
| @@ -36,7 +36,7 class MTAPIi | |||||
|
|
36 | die("Invalid args: $comic $panel\n"); |
|
36 | die("Invalid args: $comic $panel\n"); |
|
|
37 | return false; |
|
37 | return false; |
|
|
38 | } |
|
38 | } |
|
|
39 |
|
39 | ||
|
|
40 | $script = build_panel_transcript($comic, $panel); |
|
40 | $script = build_panel_transcript($comic, $panel); |
|
|
41 | if(!$xml) |
|
41 | if(!$xml) |
|
|
42 | { |
|
42 | { |
| @@ -88,9 +88,9 class MTAPIi | |||||
|
|
88 | { |
|
88 | { |
|
|
89 | return false; |
|
89 | return false; |
|
|
90 | } |
|
90 | } |
|
|
91 |
|
91 | ||
|
|
92 | $panels = MTAPIi::getNumPanels($comic); |
|
92 | $panels = MTAPIi::getNumPanels($comic); |
|
|
93 |
|
93 | ||
|
|
94 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; |
|
94 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; |
|
|
95 | $query .= ' AND panel = '.(int)$panel; |
|
95 | $query .= ' AND panel = '.(int)$panel; |
|
|
96 | $query .= ' AND speaker NOT LIKE "#%" '; |
|
96 | $query .= ' AND speaker NOT LIKE "#%" '; |
| @@ -99,7 +99,7 class MTAPIi | |||||
|
|
99 | $query .= " AND search != '' "; |
|
99 | $query .= " AND search != '' "; |
|
|
100 | } |
|
100 | } |
|
|
101 | $query .= 'ORDER BY speaker'; |
|
101 | $query .= 'ORDER BY speaker'; |
|
|
102 |
|
102 | ||
|
|
103 | return query_to_array($query); |
|
103 | return query_to_array($query); |
|
|
104 | } |
|
104 | } |
|
|
105 |
|
105 | ||
| @@ -109,7 +109,7 class MTAPIi | |||||
|
|
109 | { |
|
109 | { |
|
|
110 | return false; |
|
110 | return false; |
|
|
111 | } |
|
111 | } |
|
|
112 |
|
112 | ||
|
|
113 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; |
|
113 | $query = 'SELECT DISTINCT speaker FROM transcript WHERE strip = '.(int)$comic; |
|
|
114 | $query .= ' AND speaker NOT LIKE "#%" '; |
|
114 | $query .= ' AND speaker NOT LIKE "#%" '; |
|
|
115 | if($speakersOnly) |
|
115 | if($speakersOnly) |
| @@ -117,7 +117,7 class MTAPIi | |||||
|
|
117 | $query .= " AND search != '' "; |
|
117 | $query .= " AND search != '' "; |
|
|
118 | } |
|
118 | } |
|
|
119 | $query .= 'ORDER BY speaker'; |
|
119 | $query .= 'ORDER BY speaker'; |
|
|
120 |
|
120 | ||
|
|
121 | return query_to_array($query); |
|
121 | return query_to_array($query); |
|
|
122 | } |
|
122 | } |
|
|
123 |
|
123 | ||
| @@ -161,7 +161,7 class MTAPIi | |||||
|
|
161 | $query = 'SELECT description FROM strip_t |
|
161 | $query = 'SELECT description FROM strip_t |
|
|
162 | JOIN strip ON strip.type = strip_t.id |
|
162 | JOIN strip ON strip.type = strip_t.id |
|
|
163 | WHERE strip.id = '.(int)$comic; |
|
163 | WHERE strip.id = '.(int)$comic; |
|
|
164 |
|
164 | ||
|
|
165 | $qr = query_to_array($query); |
|
165 | $qr = query_to_array($query); |
|
|
166 | return $qr[0]; |
|
166 | return $qr[0]; |
|
|
167 | } |
|
167 | } |
| @@ -178,11 +178,11 class MTAPIi | |||||
|
|
178 | JOIN strip_t ON meta.type = strip_t.id |
|
178 | JOIN strip_t ON meta.type = strip_t.id |
|
|
179 | JOIN strip ON strip.type = strip_t.id |
|
179 | JOIN strip ON strip.type = strip_t.id |
|
|
180 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.id'; |
|
180 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.id'; |
|
|
181 |
|
181 | ||
|
|
182 | $qr = query_to_array($query); |
|
182 | $qr = query_to_array($query); |
|
|
183 | return $qr; |
|
183 | return $qr; |
|
|
184 | } |
|
184 | } |
|
|
185 |
|
185 | ||
|
|
186 | static function getStrip($comic) |
|
186 | static function getStrip($comic) |
|
|
187 | { |
|
187 | { |
|
|
188 | if(!validate_comic_id($comic)) |
|
188 | if(!validate_comic_id($comic)) |
| @@ -192,26 +192,26 class MTAPIi | |||||
|
|
192 | $strip = load_strip($comic); |
|
192 | $strip = load_strip($comic); |
|
|
193 | $strip['type'] = self::getStripTypeName($strip['type']); |
|
193 | $strip['type'] = self::getStripTypeName($strip['type']); |
|
|
194 | $strip['number'] = self::getStripNumberInType($comic); |
|
194 | $strip['number'] = self::getStripNumberInType($comic); |
|
|
195 |
|
195 | ||
|
|
196 | unset($strip['udate']); |
|
196 | unset($strip['udate']); |
|
|
197 |
|
197 | ||
|
|
198 | return $strip; |
|
198 | return $strip; |
|
|
199 | } |
|
199 | } |
|
|
200 |
|
200 | ||
|
|
201 | static function getStripNumberInType($comic) |
|
201 | static function getStripNumberInType($comic) |
|
|
202 | { |
|
202 | { |
|
|
203 | if(!validate_comic_id($comic)) |
|
203 | if(!validate_comic_id($comic)) |
|
|
204 | { |
|
204 | { |
|
|
205 | return false; |
|
205 | return false; |
|
|
206 | } |
|
206 | } |
|
|
207 |
|
207 | ||
|
|
208 | $type = self::getStripType($comic); |
|
208 | $type = self::getStripType($comic); |
|
|
209 |
|
209 | ||
|
|
210 | $query = "SELECT count(*) |
|
210 | $query = "SELECT count(*) |
|
|
211 | FROM strip_t JOIN strip ON strip_t.id = strip.type |
|
211 | FROM strip_t JOIN strip ON strip_t.id = strip.type |
|
|
212 | WHERE strip.id < {$comic}+1 |
|
212 | WHERE strip.id < {$comic}+1 |
|
|
213 | AND strip.type = {$type}"; |
|
213 | AND strip.type = {$type}"; |
|
|
214 |
|
214 | ||
|
|
215 | $qr = query_to_array($query); |
|
215 | $qr = query_to_array($query); |
|
|
216 | return $qr[0]; |
|
216 | return $qr[0]; |
|
|
217 | } |
|
217 | } |
| @@ -227,7 +227,7 class MTAPIi | |||||
|
|
227 | JOIN strip_t ON meta.type = strip_t.id |
|
227 | JOIN strip_t ON meta.type = strip_t.id |
|
|
228 | JOIN strip ON strip.type = strip_t.id |
|
228 | JOIN strip ON strip.type = strip_t.id |
|
|
229 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.name'; |
|
229 | WHERE strip.id = '.(int)$comic.' ORDER BY meta_t.name'; |
|
|
230 |
|
230 | ||
|
|
231 | $qr = query_to_array($query); |
|
231 | $qr = query_to_array($query); |
|
|
232 | return $qr; |
|
232 | return $qr; |
|
|
233 | } |
|
233 | } |
| @@ -238,12 +238,12 class MTAPIi | |||||
|
|
238 | { |
|
238 | { |
|
|
239 | return false; |
|
239 | return false; |
|
|
240 | } |
|
240 | } |
|
|
241 |
|
241 | ||
|
|
242 | $query = 'SELECT meta_t.id FROM meta_t |
|
242 | $query = 'SELECT meta_t.id FROM meta_t |
|
|
243 | JOIN meta ON meta_t.id = meta.meta |
|
243 | JOIN meta ON meta_t.id = meta.meta |
|
|
244 | JOIN strip_t ON meta.type = strip_t.id |
|
244 | JOIN strip_t ON meta.type = strip_t.id |
|
|
245 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.id'; |
|
245 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.id'; |
|
|
246 |
|
246 | ||
|
|
247 | $qr = query_to_array($query); |
|
247 | $qr = query_to_array($query); |
|
|
248 | return $qr; |
|
248 | return $qr; |
|
|
249 | } |
|
249 | } |
| @@ -254,12 +254,12 class MTAPIi | |||||
|
|
254 | { |
|
254 | { |
|
|
255 | return false; |
|
255 | return false; |
|
|
256 | } |
|
256 | } |
|
|
257 |
|
257 | ||
|
|
258 | $query = 'SELECT meta_t.name FROM meta_t |
|
258 | $query = 'SELECT meta_t.name FROM meta_t |
|
|
259 | JOIN meta ON meta_t.id = meta.meta |
|
259 | JOIN meta ON meta_t.id = meta.meta |
|
|
260 | JOIN strip_t ON meta.type = strip_t.id |
|
260 | JOIN strip_t ON meta.type = strip_t.id |
|
|
261 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.name'; |
|
261 | WHERE strip_t.id = '.(int)$type.' ORDER BY meta_t.name'; |
|
|
262 |
|
262 | ||
|
|
263 | $qr = query_to_array($query); |
|
263 | $qr = query_to_array($query); |
|
|
264 | return $qr; |
|
264 | return $qr; |
|
|
265 | } |
|
265 | } |
| @@ -270,7 +270,7 class MTAPIi | |||||
|
|
270 | { |
|
270 | { |
|
|
271 | return false; |
|
271 | return false; |
|
|
272 | } |
|
272 | } |
|
|
273 |
|
273 | ||
|
|
274 | $query = 'SELECT strip.id FROM strip WHERE strip.type = '.(int)$type.' ORDER BY strip.id'; |
|
274 | $query = 'SELECT strip.id FROM strip WHERE strip.type = '.(int)$type.' ORDER BY strip.id'; |
|
|
275 | $qr = query_to_array($query); |
|
275 | $qr = query_to_array($query); |
|
|
276 | return $qr; |
|
276 | return $qr; |
| @@ -283,7 +283,7 class MTAPIi | |||||
|
|
283 | { |
|
283 | { |
|
|
284 | return false; |
|
284 | return false; |
|
|
285 | } |
|
285 | } |
|
|
286 |
|
286 | ||
|
|
287 | $query = 'SELECT strip.id FROM strip |
|
287 | $query = 'SELECT strip.id FROM strip |
|
|
288 | JOIN strip_t ON strip.type = strip_t.id |
|
288 | JOIN strip_t ON strip.type = strip_t.id |
|
|
289 | JOIN meta ON strip_t.id = meta.type |
|
289 | JOIN meta ON strip_t.id = meta.type |
| @@ -40,7 +40,7 function get_num_panels($comic) | |||||
|
|
40 | { |
|
40 | { |
|
|
41 | return false; |
|
41 | return false; |
|
|
42 | } |
|
42 | } |
|
|
43 |
|
43 | ||
|
|
44 | $rs = mysqli_query($link,'SELECT MAX(panel) FROM transcript WHERE strip = '.(int)$comic); |
|
44 | $rs = mysqli_query($link,'SELECT MAX(panel) FROM transcript WHERE strip = '.(int)$comic); |
|
|
45 | return current(mysqli_fetch_row($rs)); |
|
45 | return current(mysqli_fetch_row($rs)); |
|
|
46 | } |
|
46 | } |
| @@ -48,9 +48,9 function get_num_panels($comic) | |||||
|
|
48 | function build_panel_transcript($comic, $panel) |
|
48 | function build_panel_transcript($comic, $panel) |
|
|
49 | { |
|
49 | { |
|
|
50 | $query = 'SELECT speaker, speech FROM transcript |
|
50 | $query = 'SELECT speaker, speech FROM transcript |
|
|
51 |
WHERE strip = '.(int)$comic.' AND panel = '.(int)$panel.' |
|
51 | WHERE strip = '.(int)$comic.' AND panel = '.(int)$panel.' |
|
|
52 | AND speaker NOT LIKE "#%" ORDER BY line'; |
|
52 | AND speaker NOT LIKE "#%" ORDER BY line'; |
|
|
53 |
|
53 | ||
|
|
54 | $qr = query_to_nested($query); |
|
54 | $qr = query_to_nested($query); |
|
|
55 | return $qr; |
|
55 | return $qr; |
|
|
56 | } |
|
56 | } |
| @@ -65,7 +65,7 function query_to_nested($query) | |||||
|
|
65 | $ret[]= $row; |
|
65 | $ret[]= $row; |
|
|
66 | } |
|
66 | } |
|
|
67 | mysqli_free_result($rs); |
|
67 | mysqli_free_result($rs); |
|
|
68 |
|
68 | ||
|
|
69 | return $ret; |
|
69 | return $ret; |
|
|
70 | } |
|
70 | } |
|
|
71 |
|
71 | ||
| @@ -81,7 +81,7 function query_to_array($query, $col=0) | |||||
|
|
81 | $ret[]= $row[0]; |
|
81 | $ret[]= $row[0]; |
|
|
82 | } |
|
82 | } |
|
|
83 | mysqli_free_result($rs); |
|
83 | mysqli_free_result($rs); |
|
|
84 |
|
84 | ||
|
|
85 | return $ret; |
|
85 | return $ret; |
|
|
86 | } |
|
86 | } |
|
|
87 |
|
87 | ||
| @@ -141,7 +141,7 function conditional_exit($mtime) | |||||
|
|
141 | { |
|
141 | { |
|
|
142 | if(!PERFORM_CONDITIONAL_CACHE) |
|
142 | if(!PERFORM_CONDITIONAL_CACHE) |
|
|
143 | return; |
|
143 | return; |
|
|
144 |
|
144 | ||
|
|
145 | $f_date = gmdate( 'D, d M Y H:i:s T', $mtime ); |
|
145 | $f_date = gmdate( 'D, d M Y H:i:s T', $mtime ); |
|
|
146 | header("Last-Modified: $f_date"); |
|
146 | header("Last-Modified: $f_date"); |
|
|
147 |
|
147 | ||
| @@ -183,17 +183,17 function mtdie($errno, $errstr, $errfile, $errline, $errcontext) { | |||||
|
|
183 | } |
|
183 | } |
|
|
184 |
|
184 | ||
|
|
185 | error_log( $message, 0 ); // Log to Syslog |
|
185 | error_log( $message, 0 ); // Log to Syslog |
|
|
186 |
|
186 | ||
|
|
187 | $message .= "\r\n\r\nBacktrace:"; |
|
187 | $message .= "\r\n\r\nBacktrace:"; |
|
|
188 | $backtrace = array_reverse(debug_backtrace()); |
|
188 | $backtrace = array_reverse(debug_backtrace()); |
|
|
189 | $i=2; |
|
189 | $i=2; |
|
|
190 | $message .= "\r\n1: " . $err_context . " at $errfile:$errline"; |
|
190 | $message .= "\r\n1: " . $err_context . " at $errfile:$errline"; |
|
|
191 | foreach($backtrace as $k=>$call) { |
|
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']; |
|
192 | $message .= "\r\n" . str_pad("$i:", $i+4 ) . $call['function'] . '( ' . implode(', ', $call['args']) . ' ) at ' . $call['file'] . ':' . $call['line']; |
|
|
193 | $i++; |
|
193 | $i++; |
|
|
194 | } |
|
194 | } |
|
|
195 | $message .= "\r\n"; |
|
195 | $message .= "\r\n"; |
|
|
196 |
|
196 | ||
|
|
197 | $message .= "\r\nRequest Details:" |
|
197 | $message .= "\r\nRequest Details:" |
|
|
198 | . "\r\nscript_url: " . $_SERVER["SCRIPT_URL"] |
|
198 | . "\r\nscript_url: " . $_SERVER["SCRIPT_URL"] |
|
|
199 | . "\r\nquery_string: " . $_SERVER["QUERY_STRING"] |
|
199 | . "\r\nquery_string: " . $_SERVER["QUERY_STRING"] |
| @@ -287,7 +287,7 function pagehead($caller, $title = 'relax, we understand j00', $style='') | |||||
|
|
287 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
287 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
|
288 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
288 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|
|
289 | <head> |
|
289 | <head> |
|
|
290 | <meta charset="utf-8" /> |
|
290 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
|
291 | <meta name="description" content="MegaTokyo the Comic" /> |
|
291 | <meta name="description" content="MegaTokyo the Comic" /> |
|
|
292 | <meta name="author" content="Frederick M. Gallagher III" /> |
|
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 !!)" /> |
|
293 | <meta name="generator" content="Alan J Castonguay, Robert Sherby, Jeremy Wagner-Kaiser, Shawn Morford (!! nathanbp, jrl !!)" /> |
| @@ -299,7 +299,7 function pagehead($caller, $title = 'relax, we understand j00', $style='') | |||||
|
|
299 | <link type="image/x-icon" rel="shortcut icon" href="favicon.ico" /> |
|
299 | <link type="image/x-icon" rel="shortcut icon" href="favicon.ico" /> |
|
|
300 | <link type="text/css" rel="stylesheet" href="styles/main.css" /> |
|
300 | <link type="text/css" rel="stylesheet" href="styles/main.css" /> |
|
|
301 | <link type="text/css" rel="stylesheet" href="styles/<?php echo $caller ?>.css" /> |
|
301 | <link type="text/css" rel="stylesheet" href="styles/<?php echo $caller ?>.css" /> |
|
|
302 |
|
302 | ||
|
|
303 | <?php |
|
303 | <?php |
|
|
304 | if($style != '') |
|
304 | if($style != '') |
|
|
305 | { |
|
305 | { |
| @@ -311,10 +311,10 function pagehead($caller, $title = 'relax, we understand j00', $style='') | |||||
|
|
311 | <link type="application/rss+xml" rel="alternate" title="Strips Only" href="rss/strips.xml" /> |
|
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" /> |
|
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" /> |
|
313 | <link type="application/rss+xml" rel="alternate" title="Strips and Rants" href="rss/megatokyo.xml" /> |
|
|
314 |
|
314 | ||
|
|
315 | <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> |
|
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> |
|
316 | <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> |
|
|
317 |
|
317 | ||
|
|
318 | <script type="text/javascript" src="index.js"></script><?php /* |
|
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> */ ?> |
|
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> |
|
320 | <script type="text/javascript" src="resources.js"></script> |
| @@ -360,7 +360,7 function pagefoot() | |||||
|
|
360 | all rights reserved.</p> |
|
360 | all rights reserved.</p> |
|
|
361 | <p>'megatokyo' is a registered trademark of |
|
361 | <p>'megatokyo' is a registered trademark of |
|
|
362 | <a href="http://www.fredart.com">fredart studios llc</a>.</p> |
|
362 | <a href="http://www.fredart.com">fredart studios llc</a>.</p> |
|
|
363 |
</div><?php |
|
363 | </div><?php |
|
|
364 | } |
|
364 | } |
|
|
365 |
|
365 | ||
|
|
366 |
|
366 | ||
| @@ -94,11 +94,11 else | |||||
|
|
94 | $tmp = explode(':', $qr[0]); |
|
94 | $tmp = explode(':', $qr[0]); |
|
|
95 | $tooltip .= $tmp[0].", Number ".$qr[1].", ".$STRIP['pubdate']; |
|
95 | $tooltip .= $tmp[0].", Number ".$qr[1].", ".$STRIP['pubdate']; |
|
|
96 | } |
|
96 | } |
|
|
97 |
|
97 | ||
|
|
98 | $alttext = "Strip ".$EFFECTIVE_ID; |
|
98 | $alttext = "Strip ".$EFFECTIVE_ID; |
|
|
99 | if($STRIP['book']) |
|
99 | if($STRIP['book']) |
|
|
100 | $alttext .= ", Volume ".$STRIP['book']; |
|
100 | $alttext .= ", Volume ".$STRIP['book']; |
|
|
101 |
|
101 | ||
|
|
102 | if($STRIP['page']) |
|
102 | if($STRIP['page']) |
|
|
103 | $alttext .= ", Page ".$STRIP['page']; |
|
103 | $alttext .= ", Page ".$STRIP['page']; |
|
|
104 |
|
104 | ||
| @@ -25,7 +25,7 function toXML($data) | |||||
|
|
25 | } |
|
25 | } |
|
|
26 | } |
|
26 | } |
|
|
27 | write($xml, $data); |
|
27 | write($xml, $data); |
|
|
28 |
|
28 | ||
|
|
29 | $xml->endElement(); |
|
29 | $xml->endElement(); |
|
|
30 | return $xml->outputMemory(true); |
|
30 | return $xml->outputMemory(true); |
|
|
31 | } |
|
31 | } |
| @@ -35,7 +35,7 $API = new ReflectionClass('MTAPIi'); | |||||
|
|
35 | if( $API->hasMethod($_GET['method']) ) { |
|
35 | if( $API->hasMethod($_GET['method']) ) { |
|
|
36 | $method = $API->getMethod($_GET['method']); |
|
36 | $method = $API->getMethod($_GET['method']); |
|
|
37 | $parameters = $method->getParameters(); |
|
37 | $parameters = $method->getParameters(); |
|
|
38 |
|
38 | ||
|
|
39 | $method_parameters = Array(); |
|
39 | $method_parameters = Array(); |
|
|
40 | foreach($parameters as $parameter) { |
|
40 | foreach($parameters as $parameter) { |
|
|
41 | $param = (Array) $parameter; |
|
41 | $param = (Array) $parameter; |
| @@ -51,9 +51,9 if( $API->hasMethod($_GET['method']) ) { | |||||
|
|
51 | printf( 'Parameter %s is required but not supplied', $parameter_name ); |
|
51 | printf( 'Parameter %s is required but not supplied', $parameter_name ); |
|
|
52 | } |
|
52 | } |
|
|
53 | } |
|
53 | } |
|
|
54 |
|
54 | ||
|
|
55 | $result = $method->invokeArgs($API, $method_parameters); |
|
55 | $result = $method->invokeArgs($API, $method_parameters); |
|
|
56 |
|
56 | ||
|
|
57 | switch($_GET['output-type']) { |
|
57 | switch($_GET['output-type']) { |
|
|
58 | case 'json': |
|
58 | case 'json': |
|
|
59 | $result = json_encode($result); |
|
59 | $result = json_encode($result); |
| @@ -17,13 +17,13 function navinit() { | |||||
|
|
17 | f = document.getElementById('searchprevnext'); |
|
17 | f = document.getElementById('searchprevnext'); |
|
|
18 | f.style.display="none"; |
|
18 | f.style.display="none"; |
|
|
19 |
|
19 | ||
|
|
20 |
b = document.getElementById('q'); |
|
20 | b = document.getElementById('q'); |
|
|
21 | for( i=0; i<b.form.elements.length; i++ ) { |
|
21 | for( i=0; i<b.form.elements.length; i++ ) { |
|
|
22 | if( b.form.elements[i].type=="checkbox" ) { |
|
22 | if( b.form.elements[i].type=="checkbox" ) { |
|
|
23 | b.form.elements[i].onclick = navrecheck; |
|
23 | b.form.elements[i].onclick = navrecheck; |
|
|
24 | } |
|
24 | } |
|
|
25 | } |
|
25 | } |
|
|
26 |
|
26 | ||
|
|
27 | b.onblur = navrecheck; |
|
27 | b.onblur = navrecheck; |
|
|
28 | b.onchange = navrecheck; |
|
28 | b.onchange = navrecheck; |
|
|
29 | b.onkeyup = navrecheck; |
|
29 | b.onkeyup = navrecheck; |
| @@ -35,7 +35,7 function navrecheck() { | |||||
|
|
35 | b = document.getElementById('q'); |
|
35 | b = document.getElementById('q'); |
|
|
36 | n = document.getElementById('normalprevnext'); |
|
36 | n = document.getElementById('normalprevnext'); |
|
|
37 | f = document.getElementById('searchprevnext'); |
|
37 | f = document.getElementById('searchprevnext'); |
|
|
38 |
|
38 | ||
|
|
39 | find = b.value; |
|
39 | find = b.value; |
|
|
40 | if(!find ) { |
|
40 | if(!find ) { |
|
|
41 | for( i=0; i<b.form.elements.length; i++ ) { |
|
41 | for( i=0; i<b.form.elements.length; i++ ) { |
| @@ -43,9 +43,9 function navrecheck() { | |||||
|
|
43 | find = 1; |
|
43 | find = 1; |
|
|
44 | break; |
|
44 | break; |
|
|
45 | } |
|
45 | } |
|
|
46 | } |
|
46 | } |
|
|
47 | } |
|
47 | } |
|
|
48 |
|
48 | ||
|
|
49 | if( find ) { |
|
49 | if( find ) { |
|
|
50 | n.style.display="none"; |
|
50 | n.style.display="none"; |
|
|
51 | f.style.display=""; |
|
51 | f.style.display=""; |
| @@ -53,7 +53,7 function navrecheck() { | |||||
|
|
53 | n.style.display=""; |
|
53 | n.style.display=""; |
|
|
54 | f.style.display="none"; |
|
54 | f.style.display="none"; |
|
|
55 | } |
|
55 | } |
|
|
56 |
|
56 | ||
|
|
57 | } |
|
57 | } |
|
|
58 |
|
58 | ||
|
|
59 | navwait('q'); |
|
59 | navwait('q'); |
| @@ -30,13 +30,13 if(isset($_REQUEST['list_by']) && $_REQUEST['list_by'] == "date") | |||||
|
|
30 | AND rant.status = 'published' ORDER BY rant.published") or die(mysqli_error($link)); |
|
30 | AND rant.status = 'published' ORDER BY rant.published") or die(mysqli_error($link)); |
|
|
31 |
|
31 | ||
|
|
32 | echo '<div class="content"><h2>Rants by Date</h2><div><ol>'; |
|
32 | echo '<div class="content"><h2>Rants by Date</h2><div><ol>'; |
|
|
33 |
|
33 | ||
|
|
34 | while($rant = mysqli_fetch_assoc($rants)) |
|
34 | while($rant = mysqli_fetch_assoc($rants)) |
|
|
35 | { |
|
35 | { |
|
|
36 | printf('<li><a title="%s" name="%d" href="./rant/%d">%s - %s</a></li>', $rant['pubdate'], $rant['id'], $rant['id'], |
|
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'])); |
|
37 | $rant['author'], utfentities($rant['title'])); |
|
|
38 | } |
|
38 | } |
|
|
39 |
|
39 | ||
|
|
40 | echo '</ol></div></div>'; |
|
40 | echo '</ol></div></div>'; |
|
|
41 | } |
|
41 | } |
|
|
42 | else |
|
42 | else |
| @@ -55,7 +55,7 else | |||||
|
|
55 | ?></ul></div> |
|
55 | ?></ul></div> |
|
|
56 | </div> |
|
56 | </div> |
|
|
57 | <?php |
|
57 | <?php |
|
|
58 |
|
58 | ||
|
|
59 | mysqli_data_seek($AUTHORS, 0); |
|
59 | mysqli_data_seek($AUTHORS, 0); |
|
|
60 | while ($author = mysqli_fetch_assoc($AUTHORS)) { |
|
60 | while ($author = mysqli_fetch_assoc($AUTHORS)) { |
|
|
61 | $rants = mysqli_query($link,"SELECT distinct id, title, |
|
61 | $rants = mysqli_query($link,"SELECT distinct id, title, |
| @@ -64,7 +64,7 else | |||||
|
|
64 | if (mysqli_num_rows($rants) <= 0) |
|
64 | if (mysqli_num_rows($rants) <= 0) |
|
|
65 | continue; |
|
65 | continue; |
|
|
66 | echo '<div class="content"><h2><a id="', $author['name'], '">', utfentities($author['name']), '</a></h2><div><ol>'; |
|
66 | echo '<div class="content"><h2><a id="', $author['name'], '">', utfentities($author['name']), '</a></h2><div><ol>'; |
|
|
67 |
|
67 | ||
|
|
68 | while($rant = mysqli_fetch_assoc($rants)) |
|
68 | while($rant = mysqli_fetch_assoc($rants)) |
|
|
69 | { |
|
69 | { |
|
|
70 | printf('<li><a title="%s" name="%d" href="./rant/%d">%s</a></li>', $rant['pubdate'], $rant['id'], $rant['id'], |
|
70 | printf('<li><a title="%s" name="%d" href="./rant/%d">%s</a></li>', $rant['pubdate'], $rant['id'], $rant['id'], |
| @@ -10,7 +10,7 while(match = metarx.exec(textbox.value)) { | |||||
|
|
10 | var t = checks[4].checked; |
|
10 | var t = checks[4].checked; |
|
|
11 | checks[4].checked = true; |
|
11 | checks[4].checked = true; |
|
|
12 | checks[4].checked = false; |
|
12 | checks[4].checked = false; |
|
|
13 |
checks[4].checked = t; |
|
13 | checks[4].checked = t; |
|
|
14 |
|
14 | ||
|
|
15 | for(i=0; i<checks.length; i++) { |
|
15 | for(i=0; i<checks.length; i++) { |
|
|
16 | if( checks[i].value == match[1] ) { |
|
16 | if( checks[i].value == match[1] ) { |
| @@ -36,7 +36,7 function _query( $s, $byid = false ) { | |||||
|
|
36 | $r = mysqli_query($link, $s ) or die( mysqli_error($link) ); |
|
36 | $r = mysqli_query($link, $s ) or die( mysqli_error($link) ); |
|
|
37 | $ret=array(); |
|
37 | $ret=array(); |
|
|
38 | $i=0; |
|
38 | $i=0; |
|
|
39 |
|
39 | ||
|
|
40 | if( $byid ) { |
|
40 | if( $byid ) { |
|
|
41 | while ($row = mysqli_fetch_object($r) ) |
|
41 | while ($row = mysqli_fetch_object($r) ) |
|
|
42 | $ret[$row->id] = $row; |
|
42 | $ret[$row->id] = $row; |
| @@ -64,7 +64,7 $f_desc = 'News and Comics from Megatokyo.'; | |||||
|
|
64 | foreach( $s as $k=>$v ) { |
|
64 | foreach( $s as $k=>$v ) { |
|
|
65 | $s[$k]->link = 'http://www.megatokyo.com/'; |
|
65 | $s[$k]->link = 'http://www.megatokyo.com/'; |
|
|
66 | $s[$k]->title = "Update: $v->percentage%: " . htmlentities($v->text, ENT_COMPAT, ini_get('default_charset')); |
|
66 | $s[$k]->title = "Update: $v->percentage%: " . htmlentities($v->text, ENT_COMPAT, ini_get('default_charset')); |
|
|
67 |
|
67 | ||
|
|
68 | $d = date( 'l F jS, H:i', $v->eta ); |
|
68 | $d = date( 'l F jS, H:i', $v->eta ); |
|
|
69 | $dd = (int) (( $v->eta - $v->udate )/3600); |
|
69 | $dd = (int) (( $v->eta - $v->udate )/3600); |
|
|
70 |
|
70 | ||
| @@ -121,7 +121,7 if( $type == '' ) | |||||
|
|
121 | { |
|
121 | { |
|
|
122 | $f_title = 'Megatokyo Comics and News'; |
|
122 | $f_title = 'Megatokyo Comics and News'; |
|
|
123 | $s = _query("SELECT UNIX_TIMESTAMP(published) as udate, body, url FROM rss_comment ORDER BY published DESC LIMIT 5"); |
|
123 | $s = _query("SELECT UNIX_TIMESTAMP(published) as udate, body, url FROM rss_comment ORDER BY published DESC LIMIT 5"); |
|
|
124 |
|
124 | ||
|
|
125 | foreach($s as $k=>$v) |
|
125 | foreach($s as $k=>$v) |
|
|
126 | { |
|
126 | { |
|
|
127 | $s[$k]->link = $v->url; |
|
127 | $s[$k]->link = $v->url; |
| @@ -169,7 +169,7 echo '<?xml version="1.0" encoding="utf-8"?>', "\n"; | |||||
|
|
169 | <pubDate><?php echo $f_date; ?></pubDate> |
|
169 | <pubDate><?php echo $f_date; ?></pubDate> |
|
|
170 | <lastBuildDate><?php echo $f_date; ?></lastBuildDate> |
|
170 | <lastBuildDate><?php echo $f_date; ?></lastBuildDate> |
|
|
171 | <ttl>15</ttl> |
|
171 | <ttl>15</ttl> |
|
|
172 |
|
172 | ||
|
|
173 | <?php if( count( $f_items )) foreach( $f_items as $v ): ?> |
|
173 | <?php if( count( $f_items )) foreach( $f_items as $v ): ?> |
|
|
174 | <item> |
|
174 | <item> |
|
|
175 | <title><?php echo $v->title; ?></title> |
|
175 | <title><?php echo $v->title; ?></title> |
| @@ -180,4 +180,4 echo '<?xml version="1.0" encoding="utf-8"?>', "\n"; | |||||
|
|
180 | </item> |
|
180 | </item> |
|
|
181 | <?php endforeach; ?> |
|
181 | <?php endforeach; ?> |
|
|
182 | </channel> |
|
182 | </channel> |
|
|
183 |
</rss> |
|
183 | </rss> |
| @@ -36,7 +36,7 function _query( $s, $byid = false ) { | |||||
|
|
36 | $r = mysqli_query($link, $s ) or die( mysqli_error($link) ); |
|
36 | $r = mysqli_query($link, $s ) or die( mysqli_error($link) ); |
|
|
37 | $ret=array(); |
|
37 | $ret=array(); |
|
|
38 | $i=0; |
|
38 | $i=0; |
|
|
39 |
|
39 | ||
|
|
40 | if( $byid ) { |
|
40 | if( $byid ) { |
|
|
41 | while ($row = mysqli_fetch_object($r) ) |
|
41 | while ($row = mysqli_fetch_object($r) ) |
|
|
42 | $ret[$row->id] = $row; |
|
42 | $ret[$row->id] = $row; |
| @@ -64,7 +64,7 $f_desc = 'News and Comics from Megatokyo.'; | |||||
|
|
64 | foreach( $s as $k=>$v ) { |
|
64 | foreach( $s as $k=>$v ) { |
|
|
65 | $s[$k]->link = 'http://www.megatokyo.com/'; |
|
65 | $s[$k]->link = 'http://www.megatokyo.com/'; |
|
|
66 | $s[$k]->title = "Update: $v->percentage%: " . htmlentities($v->text, ENT_COMPAT, ini_get('default_charset')); |
|
66 | $s[$k]->title = "Update: $v->percentage%: " . htmlentities($v->text, ENT_COMPAT, ini_get('default_charset')); |
|
|
67 |
|
67 | ||
|
|
68 | $d = date( 'l F jS, H:i', $v->eta ); |
|
68 | $d = date( 'l F jS, H:i', $v->eta ); |
|
|
69 | $dd = (int) (( $v->eta - $v->udate )/3600); |
|
69 | $dd = (int) (( $v->eta - $v->udate )/3600); |
|
|
70 |
|
70 | ||
| @@ -123,7 +123,7 if( $type == '' ) | |||||
|
|
123 | { |
|
123 | { |
|
|
124 | $f_title = 'Megatokyo Comics and News'; |
|
124 | $f_title = 'Megatokyo Comics and News'; |
|
|
125 | $s = _query("SELECT UNIX_TIMESTAMP(published) as udate, body, url FROM rss_comment ORDER BY published DESC LIMIT 5"); |
|
125 | $s = _query("SELECT UNIX_TIMESTAMP(published) as udate, body, url FROM rss_comment ORDER BY published DESC LIMIT 5"); |
|
|
126 |
|
126 | ||
|
|
127 | foreach($s as $k=>$v) |
|
127 | foreach($s as $k=>$v) |
|
|
128 | { |
|
128 | { |
|
|
129 | $s[$k]->link = $v->url; |
|
129 | $s[$k]->link = $v->url; |
| @@ -173,7 +173,7 echo '<?xml version="1.0" encoding="utf-8"?>', "\n"; | |||||
|
|
173 | <pubDate><?php echo $f_date; ?></pubDate> |
|
173 | <pubDate><?php echo $f_date; ?></pubDate> |
|
|
174 | <lastBuildDate><?php echo $f_date; ?></lastBuildDate> |
|
174 | <lastBuildDate><?php echo $f_date; ?></lastBuildDate> |
|
|
175 | <ttl>15</ttl> |
|
175 | <ttl>15</ttl> |
|
|
176 |
|
176 | ||
|
|
177 | <?php if( count( $f_items )) foreach( $f_items as $v ): ?> |
|
177 | <?php if( count( $f_items )) foreach( $f_items as $v ): ?> |
|
|
178 | <item> |
|
178 | <item> |
|
|
179 | <title><?php echo $v->title; ?></title> |
|
179 | <title><?php echo $v->title; ?></title> |
| @@ -184,5 +184,4 echo '<?xml version="1.0" encoding="utf-8"?>', "\n"; | |||||
|
|
184 | </item> |
|
184 | </item> |
|
|
185 | <?php endforeach; ?> |
|
185 | <?php endforeach; ?> |
|
|
186 | </channel> |
|
186 | </channel> |
|
|
187 |
</rss> |
|
187 | </rss> |
|
|
188 |
|
|||
| @@ -68,4 +68,4 out for the ninjas.<br><br> | |||||
|
|
68 |
|
68 | ||
|
|
69 | <?php pagefoot(); ?> |
|
69 | <?php pagefoot(); ?> |
|
|
70 | </body> |
|
70 | </body> |
|
|
71 | </html> No newline at end of file |
|
71 | </html> |
| @@ -55,19 +55,19 if($date_f && $date) | |||||
|
|
55 | if(isset($_REQUEST['q'])) |
|
55 | if(isset($_REQUEST['q'])) |
|
|
56 | { |
|
56 | { |
|
|
57 |
|
57 | ||
|
|
58 |
if( isset($_GET['method-fp_x']) || isset($_GET['method-fp_y']) |
|
58 | if( isset($_GET['method-fp_x']) || isset($_GET['method-fp_y']) |
|
|
59 | || 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'); |
|
60 | array_push($magic, 'max'); |
|
|
61 | array_push($value, $_GET['current'] - 1); |
|
61 | array_push($value, $_GET['current'] - 1); |
|
|
62 |
|
62 | ||
|
|
63 | array_push($magic, 'method'); |
|
63 | array_push($magic, 'method'); |
|
|
64 |
array_push($value, 'Find Previous'); |
|
64 | array_push($value, 'Find Previous'); |
|
|
65 | } |
|
65 | } |
|
|
66 |
if( isset($_GET['method-fn_x']) || isset($_GET['method-fn_y']) |
|
66 | if( isset($_GET['method-fn_x']) || isset($_GET['method-fn_y']) |
|
|
67 | || 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'); |
|
68 | array_push($magic, 'min'); |
|
|
69 | array_push($value, $_GET['current'] + 1); |
|
69 | array_push($value, $_GET['current'] + 1); |
|
|
70 |
|
70 | ||
|
|
71 | array_push($magic, 'method'); |
|
71 | array_push($magic, 'method'); |
|
|
72 | array_push($value, 'Find Next'); |
|
72 | array_push($value, 'Find Next'); |
|
|
73 | } |
|
73 | } |
| @@ -85,15 +85,15 if(isset($_REQUEST['q'])) | |||||
|
|
85 | $_REQUEST['q'] = trim("$_REQUEST[q] $k:\"$v\""); |
|
85 | $_REQUEST['q'] = trim("$_REQUEST[q] $k:\"$v\""); |
|
|
86 | } |
|
86 | } |
|
|
87 | } |
|
87 | } |
|
|
88 |
|
88 | ||
|
|
89 | if(get_magic_quotes_gpc()) |
|
89 | if(get_magic_quotes_gpc()) |
|
|
90 | $_REQUEST['q'] = stripslashes($_REQUEST['q']); |
|
90 | $_REQUEST['q'] = stripslashes($_REQUEST['q']); |
|
|
91 |
|
91 | ||
|
|
92 | $tokens = tpw_parse_line('\s+', $_REQUEST['q']); |
|
92 | $tokens = tpw_parse_line('\s+', $_REQUEST['q']); |
|
|
93 |
|
93 | ||
|
|
94 | # Protect against SQL injection in the event of Register Globals being on. |
|
94 | # Protect against SQL injection in the event of Register Globals being on. |
|
|
95 | $SEARCH_MIN = $SEARCH_MAX = null; |
|
95 | $SEARCH_MIN = $SEARCH_MAX = null; |
|
|
96 |
|
96 | ||
|
|
97 | foreach($tokens as $token) { |
|
97 | foreach($tokens as $token) { |
|
|
98 | $token = strtolower($token); |
|
98 | $token = strtolower($token); |
|
|
99 |
|
99 | ||
| @@ -108,17 +108,17 if(isset($_REQUEST['q'])) | |||||
|
|
108 | } |
|
108 | } |
|
|
109 |
|
109 | ||
|
|
110 | $subtokens = preg_match('/(?:\w+|[#*]):/', $token) ? preg_split('/:/', $token, 2) : Array( false, $token ); |
|
110 | $subtokens = preg_match('/(?:\w+|[#*]):/', $token) ? preg_split('/:/', $token, 2) : Array( false, $token ); |
|
|
111 |
|
111 | ||
|
|
112 | # Magic values are easy, just throw them on the list |
|
112 | # Magic values are easy, just throw them on the list |
|
|
113 | array_push($loop_magic, $subtokens[0]); |
|
113 | array_push($loop_magic, $subtokens[0]); |
|
|
114 |
|
114 | ||
|
|
115 | # Values, however, need a bit more cleaning up first |
|
115 | # Values, however, need a bit more cleaning up first |
|
|
116 | if('""' == $subtokens[1]) |
|
116 | if('""' == $subtokens[1]) |
|
|
117 | array_push($loop_value, '""'); |
|
117 | array_push($loop_value, '""'); |
|
|
118 | else |
|
118 | else |
|
|
119 | array_push($loop_value, preg_replace('/[[:punct:]]|(?<=\s)\s+/', '', $subtokens[1])); |
|
119 | array_push($loop_value, preg_replace('/[[:punct:]]|(?<=\s)\s+/', '', $subtokens[1])); |
|
|
120 | } |
|
120 | } |
|
|
121 |
|
121 | ||
|
|
122 | #DEBUG |
|
122 | #DEBUG |
|
|
123 | #print_r($magic); |
|
123 | #print_r($magic); |
|
|
124 | #echo "<br>"; |
|
124 | #echo "<br>"; |
| @@ -139,9 +139,9 if(isset($_REQUEST['q'])) | |||||
|
|
139 | WHERE (strip.published < NOW()) |
|
139 | WHERE (strip.published < NOW()) |
|
|
140 | AND (transcript.speaker NOT LIKE \"#%\" |
|
140 | AND (transcript.speaker NOT LIKE \"#%\" |
|
|
141 | OR transcript.speaker IS NULL) "; |
|
141 | OR transcript.speaker IS NULL) "; |
|
|
142 |
|
142 | ||
|
|
143 | $flag = false; |
|
143 | $flag = false; |
|
|
144 |
|
144 | ||
|
|
145 | if($m) #attempt to short-circuit on no magic |
|
145 | if($m) #attempt to short-circuit on no magic |
|
|
146 | { |
|
146 | { |
|
|
147 | # well, we have magic |
|
147 | # well, we have magic |
| @@ -177,7 +177,7 if(isset($_REQUEST['q'])) | |||||
|
|
177 | $flag = true; |
|
177 | $flag = true; |
|
|
178 | } |
|
178 | } |
|
|
179 | } |
|
179 | } |
|
|
180 |
|
180 | ||
|
|
181 | #now, handle the $value portion of the string |
|
181 | #now, handle the $value portion of the string |
|
|
182 | # first, handle for "" |
|
182 | # first, handle for "" |
|
|
183 | switch($sub_value[$i]) { |
|
183 | switch($sub_value[$i]) { |
| @@ -199,21 +199,21 if(isset($_REQUEST['q'])) | |||||
|
|
199 | } |
|
199 | } |
|
|
200 | $query.=") "; |
|
200 | $query.=") "; |
|
|
201 | } |
|
201 | } |
|
|
202 |
|
202 | ||
|
|
203 | array_push($sub_queries, $query); |
|
203 | array_push($sub_queries, $query); |
|
|
204 | } |
|
204 | } |
|
|
205 |
|
205 | ||
|
|
206 | foreach($sub_queries as $q) |
|
206 | foreach($sub_queries as $q) |
|
|
207 | { |
|
207 | { |
|
|
208 | #DEBUG: run the search |
|
208 | #DEBUG: run the search |
|
|
209 | #echo $q; |
|
209 | #echo $q; |
|
|
210 | $result = mysqli_query($link,$q); |
|
210 | $result = mysqli_query($link,$q); |
|
|
211 |
|
211 | ||
|
|
212 | if(!$result) |
|
212 | if(!$result) |
|
|
213 | { |
|
213 | { |
|
|
214 | continue; |
|
214 | continue; |
|
|
215 | } |
|
215 | } |
|
|
216 |
|
216 | ||
|
|
217 | while($row = mysqli_fetch_row($result)) |
|
217 | while($row = mysqli_fetch_row($result)) |
|
|
218 | { |
|
218 | { |
|
|
219 | #and put all the hits onto an array |
|
219 | #and put all the hits onto an array |
| @@ -232,9 +232,9 if(isset($_REQUEST['q'])) | |||||
|
|
232 | WHERE (strip.published < NOW()) |
|
232 | WHERE (strip.published < NOW()) |
|
|
233 | AND (transcript.speaker NOT LIKE \"#%\" |
|
233 | AND (transcript.speaker NOT LIKE \"#%\" |
|
|
234 | OR transcript.speaker IS NULL) "; |
|
234 | OR transcript.speaker IS NULL) "; |
|
|
235 |
|
235 | ||
|
|
236 | $flag = false; |
|
236 | $flag = false; |
|
|
237 |
|
237 | ||
|
|
238 | if($m) #attempt to short-circuit on no magic |
|
238 | if($m) #attempt to short-circuit on no magic |
|
|
239 | { |
|
239 | { |
|
|
240 | # well, we have magic |
|
240 | # well, we have magic |
| @@ -319,7 +319,7 if(isset($_REQUEST['q'])) | |||||
|
|
319 | $flag = true; |
|
319 | $flag = true; |
|
|
320 | } |
|
320 | } |
|
|
321 | } |
|
321 | } |
|
|
322 |
|
322 | ||
|
|
323 | #now, handle the $value portion of the string |
|
323 | #now, handle the $value portion of the string |
|
|
324 | # first, handle for "" |
|
324 | # first, handle for "" |
|
|
325 | switch($value[$i]) { |
|
325 | switch($value[$i]) { |
| @@ -341,10 +341,10 if(isset($_REQUEST['q'])) | |||||
|
|
341 | } |
|
341 | } |
|
|
342 | $query.=") "; |
|
342 | $query.=") "; |
|
|
343 | } |
|
343 | } |
|
|
344 |
|
344 | ||
|
|
345 | array_push($queries, $query); |
|
345 | array_push($queries, $query); |
|
|
346 | } |
|
346 | } |
|
|
347 |
|
347 | ||
|
|
348 | if(count($queries) == 0) |
|
348 | if(count($queries) == 0) |
|
|
349 | { |
|
349 | { |
|
|
350 | array_push($queries, $query); |
|
350 | array_push($queries, $query); |
| @@ -364,7 +364,7 if(isset($_REQUEST['q'])) | |||||
|
|
364 | #second, collapse them into one clause |
|
364 | #second, collapse them into one clause |
|
|
365 | $modifier .= " AND (" . implode(" OR ", $SEARCH_TEMP) . ") "; |
|
365 | $modifier .= " AND (" . implode(" OR ", $SEARCH_TEMP) . ") "; |
|
|
366 | } |
|
366 | } |
|
|
367 |
|
367 | ||
|
|
368 | #now the metatypes, just like the types |
|
368 | #now the metatypes, just like the types |
|
|
369 | if(count($META_TYPES) > 0) |
|
369 | if(count($META_TYPES) > 0) |
|
|
370 | { |
|
370 | { |
| @@ -377,7 +377,7 if(isset($_REQUEST['q'])) | |||||
|
|
377 | #second, collapse them into one clause |
|
377 | #second, collapse them into one clause |
|
|
378 | $modifier .= " AND (" . implode(" OR ", $META_TEMP) . ") "; |
|
378 | $modifier .= " AND (" . implode(" OR ", $META_TEMP) . ") "; |
|
|
379 | } |
|
379 | } |
|
|
380 |
|
380 | ||
|
|
381 | #now do min and max |
|
381 | #now do min and max |
|
|
382 | if(isset($SEARCH_MIN)) |
|
382 | if(isset($SEARCH_MIN)) |
|
|
383 | { |
|
383 | { |
| @@ -387,7 +387,7 if(isset($_REQUEST['q'])) | |||||
|
|
387 | { |
|
387 | { |
|
|
388 | $modifier .= "AND (strip.id <= $SEARCH_MAX) "; |
|
388 | $modifier .= "AND (strip.id <= $SEARCH_MAX) "; |
|
|
389 | } |
|
389 | } |
|
|
390 |
|
390 | ||
|
|
391 | #and now book and page |
|
391 | #and now book and page |
|
|
392 | if(isset($BOOK)) |
|
392 | if(isset($BOOK)) |
|
|
393 | { |
|
393 | { |
| @@ -397,7 +397,7 if(isset($_REQUEST['q'])) | |||||
|
|
397 | { |
|
397 | { |
|
|
398 | $modifier .= $PAGE; |
|
398 | $modifier .= $PAGE; |
|
|
399 | } |
|
399 | } |
|
|
400 |
|
400 | ||
|
|
401 | foreach($queries as $q) |
|
401 | foreach($queries as $q) |
|
|
402 | { |
|
402 | { |
|
|
403 | #apply modifiers |
|
403 | #apply modifiers |
| @@ -408,12 +408,12 if(isset($_REQUEST['q'])) | |||||
|
|
408 | continue; |
|
408 | continue; |
|
|
409 | } |
|
409 | } |
|
|
410 | $result = mysqli_query($link,$q); |
|
410 | $result = mysqli_query($link,$q); |
|
|
411 |
|
411 | ||
|
|
412 | if(!$result) |
|
412 | if(!$result) |
|
|
413 | { |
|
413 | { |
|
|
414 | continue; |
|
414 | continue; |
|
|
415 | } |
|
415 | } |
|
|
416 |
|
416 | ||
|
|
417 | while($row = mysqli_fetch_row($result)) |
|
417 | while($row = mysqli_fetch_row($result)) |
|
|
418 | { |
|
418 | { |
|
|
419 | #and put all the hits onto an array |
|
419 | #and put all the hits onto an array |
| @@ -423,7 +423,7 if(isset($_REQUEST['q'])) | |||||
|
|
423 |
|
423 | ||
|
|
424 | #so, now all the raw hits are in the same spot |
|
424 | #so, now all the raw hits are in the same spot |
|
|
425 | #now comes The Magic |
|
425 | #now comes The Magic |
|
|
426 |
|
426 | ||
|
|
427 | # if book and page are used, break out |
|
427 | # if book and page are used, break out |
|
|
428 | if(isset($BOOK) && isset($PAGE) && count($rhits) != 0) |
|
428 | if(isset($BOOK) && isset($PAGE) && count($rhits) != 0) |
|
|
429 | { |
|
429 | { |
| @@ -431,16 +431,16 if(isset($_REQUEST['q'])) | |||||
|
|
431 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$rhits[0]"); |
|
431 | header('Location: ' . SITE_HOST . SITE_PATH . "/strip/$rhits[0]"); |
|
|
432 | exit(0); |
|
432 | exit(0); |
|
|
433 | } |
|
433 | } |
|
|
434 |
|
434 | ||
|
|
435 | #first, reverse sort and uniquify a copy |
|
435 | #first, reverse sort and uniquify a copy |
|
|
436 | rsort($rhits); |
|
436 | rsort($rhits); |
|
|
437 | $uhits = array_unique($rhits); |
|
437 | $uhits = array_unique($rhits); |
|
|
438 | #do the same for the subtraction hits |
|
438 | #do the same for the subtraction hits |
|
|
439 | $sub_uhits = array_unique($sub_rhits); |
|
439 | $sub_uhits = array_unique($sub_rhits); |
|
|
440 |
|
440 | ||
|
|
441 | #now... the subtraction! |
|
441 | #now... the subtraction! |
|
|
442 | $uhits = array_diff($uhits, $sub_uhits); |
|
442 | $uhits = array_diff($uhits, $sub_uhits); |
|
|
443 |
|
443 | ||
|
|
444 | #if we're redirecting, break out of the normal search logic here |
|
444 | #if we're redirecting, break out of the normal search logic here |
|
|
445 | if(isset($METHOD) && count($uhits) > 0) |
|
445 | if(isset($METHOD) && count($uhits) > 0) |
|
|
446 | { |
|
446 | { |
| @@ -453,26 +453,26 if(isset($_REQUEST['q'])) | |||||
|
|
453 | { |
|
453 | { |
|
|
454 | $target = $rhits[0]; |
|
454 | $target = $rhits[0]; |
|
|
455 | } |
|
455 | } |
|
|
456 |
|
456 | ||
|
|
457 | //die($METHOD); |
|
457 | //die($METHOD); |
|
|
458 |
|
458 | ||
|
|
459 | header('HTTP/1.0 301 Moved Permanently'); |
|
459 | header('HTTP/1.0 301 Moved Permanently'); |
|
|
460 | header('Location: ' . SITE_HOST . SITE_PATH . "/index.php?strip_id=$target" . "&q=" . urlencode($_REQUEST['q'])); |
|
460 | header('Location: ' . SITE_HOST . SITE_PATH . "/index.php?strip_id=$target" . "&q=" . urlencode($_REQUEST['q'])); |
|
|
461 | exit(0); |
|
461 | exit(0); |
|
|
462 | } |
|
462 | } |
|
|
463 |
|
463 | ||
|
|
464 | $revhits = array_reverse($rhits); |
|
464 | $revhits = array_reverse($rhits); |
|
|
465 | #now create a count for each unique hit |
|
465 | #now create a count for each unique hit |
|
|
466 | foreach($uhits as $key => $value) |
|
466 | foreach($uhits as $key => $value) |
|
|
467 | { |
|
467 | { |
|
|
468 | $first = array_search($value, $rhits); |
|
468 | $first = array_search($value, $rhits); |
|
|
469 | $last = array_search($value, $revhits); |
|
469 | $last = array_search($value, $revhits); |
|
|
470 |
|
470 | ||
|
|
471 | $numhits = count($rhits) - $first - $last; |
|
471 | $numhits = count($rhits) - $first - $last; |
|
|
472 |
|
472 | ||
|
|
473 | array_push($hcount, $numhits); |
|
473 | array_push($hcount, $numhits); |
|
|
474 | } |
|
474 | } |
|
|
475 |
|
475 | ||
|
|
476 | if(count($uhits) > 0) { |
|
476 | if(count($uhits) > 0) { |
|
|
477 | if($random) |
|
477 | if($random) |
|
|
478 | { |
|
478 | { |
| @@ -486,7 +486,7 if(isset($_REQUEST['q'])) | |||||
|
|
486 | $entry.= " - ". htmlentities($result[1]) . "</a></li>"; |
|
486 | $entry.= " - ". htmlentities($result[1]) . "</a></li>"; |
|
|
487 | array_push($strings, $entry); |
|
487 | array_push($strings, $entry); |
|
|
488 | } |
|
488 | } |
|
|
489 |
|
489 | ||
|
|
490 | #now, a clever multisort... |
|
490 | #now, a clever multisort... |
|
|
491 | array_multisort($hcount, SORT_DESC, SORT_NUMERIC, |
|
491 | array_multisort($hcount, SORT_DESC, SORT_NUMERIC, |
|
|
492 | $uhits, SORT_DESC, SORT_NUMERIC, |
|
492 | $uhits, SORT_DESC, SORT_NUMERIC, |
| @@ -502,7 +502,7 pagehead('search', 'Search'); | |||||
|
|
502 | <input type="submit" value="Search" /> |
|
502 | <input type="submit" value="Search" /> |
|
|
503 | </div></form> |
|
503 | </div></form> |
|
|
504 |
|
504 | ||
|
|
505 |
<?php if(count($uhits) > 0) { |
|
505 | <?php if(count($uhits) > 0) { |
|
|
506 | echo '<div class="content"><div><ol class="results">'; |
|
506 | echo '<div class="content"><div><ol class="results">'; |
|
|
507 | /*$qsearch = mysqli_query($link,'SELECT id, title FROM strip WHERE id IN(' . implode(', ', $uhits) . ')'); |
|
507 | /*$qsearch = mysqli_query($link,'SELECT id, title FROM strip WHERE id IN(' . implode(', ', $uhits) . ')'); |
|
|
508 | while($result = mysqli_fetch_array($qsearch)) |
|
508 | while($result = mysqli_fetch_array($qsearch)) |
| @@ -514,12 +514,12 pagehead('search', 'Search'); | |||||
|
|
514 | } |
|
514 | } |
|
|
515 | echo '</ol></div>'; |
|
515 | echo '</ol></div>'; |
|
|
516 | echo '<div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; |
|
516 | echo '<div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; |
|
|
517 |
|
517 | ||
|
|
518 | ?> |
|
518 | ?> |
|
|
519 | <form class="search" action="search.php" method="get"><div> |
|
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']) ); } ?> /> |
|
520 | <input type="text" name="q" <?php if( $_REQUEST['q'] ) { printf('value="%s"', utfentities($_REQUEST['q']) ); } ?> /> |
|
|
521 | <input type="submit" value="Search" /> |
|
521 | <input type="submit" value="Search" /> |
|
|
522 |
</div></form> |
|
522 | </div></form> |
|
|
523 | <?php |
|
523 | <?php |
|
|
524 | } elseif(isset($_REQUEST['q']) && (strlen($_REQUEST['q']) > 0)) { |
|
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>'; |
|
525 | echo '<div class="content"><div><p class="results">So sorry. Search ninjas obey without fail, yet find nothing.</p></div>'; |
| @@ -529,7 +529,7 pagehead('search', 'Search'); | |||||
|
|
529 | echo '<div class="content"><div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; |
|
529 | echo '<div class="content"><div><p class="results"><a href="search_help">Learn to direct search ninjas!</a></p></div></div>'; |
|
|
530 | } |
|
530 | } |
|
|
531 | #search_help(); |
|
531 | #search_help(); |
|
|
532 |
|
532 | ||
|
|
533 | ?> |
|
533 | ?> |
|
|
534 |
|
534 | ||
|
|
535 | <?php pagefoot() ?> |
|
535 | <?php pagefoot() ?> |
Comments 0
You need to be logged in to leave comments.
Login now
