Not Reviewed
Show More
Add another comment
| @@ -9,7 +9,7 if ( !defined('USER_COOKIE') ) | |||
|
|
9 | 9 | define('USER_COOKIE', 'megatokyoadmin_user_'. COOKIEHASH); |
|
|
10 | 10 | if ( !defined('PASS_COOKIE') ) |
|
|
11 | 11 | define('PASS_COOKIE', 'megatokyoadmin_pass_'. COOKIEHASH); |
|
|
12 | ||
|
|
12 | ||
|
|
13 | 13 | if ( !defined('COOKIEPATH') ) |
|
|
14 | 14 | define('COOKIEPATH', ADMIN_PATH . '/' ); |
|
|
15 | 15 | if ( !defined('COOKIE_DOMAIN') ) |
| @@ -49,4 +49,4 function mt_clearcookie() { | |||
|
|
49 | 49 | setcookie(PASS_COOKIE, ' ', time() - 36000, COOKIEPATH ); |
|
|
50 | 50 | } |
|
|
51 | 51 | |
|
|
52 | ?> No newline at end of file | |
|
|
52 | ?> | |
| @@ -28,7 +28,7 function adminlog($msg, $section, $action, $level=E_USER_NOTICE, $email=false) | |||
|
|
28 | 28 | |
|
|
29 | 29 | $sql = sprintf('INSERT INTO admin_log (contributor, section, action, level, message) VALUES (%s, %d, "%s", %d, "%s")', |
|
|
30 | 30 | (is_numeric($currentuser->id) ? $currentuser->id : "NULL"), $section, mysqli_real_escape_string($mtdb->link, $action), $level, mysqli_real_escape_string($mtdb->link, $msg)); |
|
|
31 | $mtdb->query( $sql ) or die($sql."<br>".mysqli_error()."<br>\n".var_export(debug_backtrace())); | |
|
|
31 | $mtdb->query( $sql ) or die($sql."<br>".mysqli_error($mtdb->link)."<br>\n".var_export(debug_backtrace())); | |
|
|
32 | 32 | |
|
|
33 | 33 | // Log all important sorts of messages in the Apache log |
|
|
34 | 34 | if( $level & (E_USER_WARNING | E_USER_ERROR) ) { |
| @@ -16,9 +16,9 function extra_sort_file_objects($a, $b) { | |||
|
|
16 | 16 | |
|
|
17 | 17 | function extra_handle_upload() { |
|
|
18 | 18 | global $info,$error,$dir; |
|
|
19 | ||
|
|
19 | ||
|
|
20 | 20 | if( !$_FILES['extra_file'] ) return false; |
|
|
21 | ||
|
|
21 | ||
|
|
22 | 22 | if( '' == $_FILES['extra_file']['name'] ) return false; |
|
|
23 | 23 | if( UPLOAD_ERR_NO_FILE == $_FILES['extra_file']['error'] ) return false; |
|
|
24 | 24 | if( 0 == $_FILES['extra_file']['size'] ) return false; |
| @@ -27,10 +27,10 function extra_handle_upload() { | |||
|
|
27 | 27 | |
|
|
28 | 28 | if(isset( $_POST['name'] )) $dest = $_POST['name']; |
|
|
29 | 29 | $dest = extra_sanitize_filename($dest); |
|
|
30 | ||
|
|
30 | ||
|
|
31 | 31 | if( !is_uploaded_file( $_FILES['extra_file']['tmp_name'] )) return false; |
|
|
32 | 32 | if( move_uploaded_file($_FILES['extra_file']['tmp_name'], $dir.'/'.$dest) ) return $true; |
|
|
33 | ||
|
|
33 | ||
|
|
34 | 34 | return false; |
|
|
35 | 35 | } |
|
|
36 | 36 | |
| @@ -51,15 +51,15 function extra_sanitize_filename( $raw_filename ) { | |||
|
|
51 | 51 | function extra_get_directory_list($dir) { |
|
|
52 | 52 | if( !is_dir( $dir ) ) return false; |
|
|
53 | 53 | if( ! $handle = opendir( $dir ) ) return false; |
|
|
54 | ||
|
|
54 | ||
|
|
55 | 55 | $files = array(); |
|
|
56 | ||
|
|
56 | ||
|
|
57 | 57 | class ExtraFile { |
|
|
58 | 58 | var $name; |
|
|
59 | 59 | var $rwx; |
|
|
60 | 60 | var $mtime; |
|
|
61 | 61 | var $inode; |
|
|
62 | ||
|
|
62 | ||
|
|
63 | 63 | function ExtraFile($path, $file) { |
|
|
64 | 64 | $this->name = $file; |
|
|
65 | 65 | $this->fullpath = $path . $file; |
| @@ -69,14 +69,14 function extra_get_directory_list($dir) { | |||
|
|
69 | 69 | $this->mtime = filemtime($this->fullpath); |
|
|
70 | 70 | $this->inode = fileinode($this->fullpath); |
|
|
71 | 71 | } |
|
|
72 | ||
|
|
72 | ||
|
|
73 | 73 | } |
|
|
74 | ||
|
|
74 | ||
|
|
75 | 75 | while (false !== ($file = readdir($handle))) { |
|
|
76 | 76 | if( is_file( $dir.'/'.$file )) $files[] = new ExtraFile($dir.'/', $file); |
|
|
77 | 77 | } |
|
|
78 | 78 | |
|
|
79 |
return $files; |
|
|
|
79 | return $files; | |
|
|
80 | 80 | } |
|
|
81 | 81 | |
|
|
82 | ?> No newline at end of file | |
|
|
82 | ?> | |
| @@ -27,14 +27,14 function clean_url( $url, $protocols = null ) { | |||
|
|
27 | 27 | $url = str_replace($strip, '', $url); |
|
|
28 | 28 | if ( strpos($url, '://') === false && substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
|
29 | 29 | $url = 'http://' . $url; |
|
|
30 | ||
|
|
30 | ||
|
|
31 | 31 | $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); |
|
|
32 | 32 | return $url; |
|
|
33 | 33 | } |
|
|
34 | 34 | |
|
|
35 | 35 | // Like htmlspecialchars except don't double-encode HTML entities |
|
|
36 | 36 | function mt_specialchars( $text, $quotes = false ) { |
|
|
37 | ||
|
|
37 | ||
|
|
38 | 38 | $text = str_replace('&&', '&&', $text); |
|
|
39 | 39 | $text = str_replace('&&', '&&', $text); |
|
|
40 | 40 | $text = preg_replace('/&(?:$|([^#])(?![a-z1-4]{1,8};))/', '&$1', $text); |
| @@ -72,7 +72,7 function sanitize_type_name( $name ) { | |||
|
|
72 | 72 | |
|
|
73 | 73 | function check_type_name( $name ) { |
|
|
74 | 74 | global $error; |
|
|
75 | ||
|
|
75 | ||
|
|
76 | 76 | if( $name == '' ) |
|
|
77 | 77 | $error.='A type must be supplied with a name, but none was given. Valid characters include letters, numbers, apostrophes, colons, and whitespace.'; |
|
|
78 | 78 | elseif ( $name !== sanitize_type_name($name) ) |
| @@ -88,4 +88,4 function _objectInArrayWithIdExists( $id, $arrobj ) { | |||
|
|
88 | 88 | return false; |
|
|
89 | 89 | } |
|
|
90 | 90 | |
|
|
91 | ?> No newline at end of file | |
|
|
91 | ?> | |
| @@ -4,7 +4,7 function getimagefromfile($filename) | |||
|
|
4 | 4 | { |
|
|
5 | 5 | $img_data = getimagesize($filename); |
|
|
6 | 6 | $ext = image_type_to_extension($img_data[2]); |
|
|
7 | ||
|
|
7 | ||
|
|
8 | 8 | switch($ext) |
|
|
9 | 9 | { |
|
|
10 | 10 | case '.gif': |
| @@ -31,21 +31,21 function crop_resize($filename, $dest_file) | |||
|
|
31 | 31 | return false; |
|
|
32 | 32 | } |
|
|
33 | 33 | $dest = imagecreatetruecolor(300, 245); |
|
|
34 | ||
|
|
34 | ||
|
|
35 | 35 | #attempt to determine scaling factor |
|
|
36 | 36 | $data = getimagesize($filename); |
|
|
37 | 37 | #300x245 reduces to 60x49 |
|
|
38 | 38 | $factor = min(floor($data[0]/60), floor($data[1]/49)); |
|
|
39 | 39 | #well, that should give us a good scaling factor |
|
|
40 | ||
|
|
40 | ||
|
|
41 | 41 | #now we have to determine what point to start from |
|
|
42 | 42 | $src_x = floor(($data[0]/2) - ($factor*30)); |
|
|
43 | 43 | $src_y = floor(($data[1]/2) - ($factor*24.5)); |
|
|
44 | ||
|
|
44 | ||
|
|
45 | 45 | #make sure we don't fuck things up |
|
|
46 | 46 | if($src_x < 0) $src_x=0; |
|
|
47 | 47 | if($src_y < 0) $src_y=0; |
|
|
48 | ||
|
|
48 | ||
|
|
49 | 49 | #now resample |
|
|
50 | 50 | imagecopyresampled($dest, $source, 0, 0, $src_x, $src_y, 300, 245, $factor*60, $factor*49); |
|
|
51 | 51 | #and output |
| @@ -11,7 +11,7 class MysqlStore { | |||
|
|
11 | 11 | |
|
|
12 | 12 | function query($sql, $showerror = true ) { |
|
|
13 | 13 | $r = mysqli_query( $this->link, $sql ); |
|
|
14 | if( false === $r && $showerror ) echo mysqli_error(); | |
|
|
14 | if( false === $r && $showerror ) echo mysqli_error($this->link); | |
|
|
15 | 15 | return $r; |
|
|
16 | 16 | } |
|
|
17 | 17 | |
| @@ -28,7 +28,7 class MysqlStore { | |||
|
|
28 | 28 | function getRow($sql) { |
|
|
29 | 29 | if( $r = $this->query( $sql ) ) { |
|
|
30 | 30 | if( false === $r ) { |
|
|
31 | echo mysqli_error(); | |
|
|
31 | echo mysqli_error($this->link); | |
|
|
32 | 32 | return false; |
|
|
33 | 33 | } |
|
|
34 | 34 | if( mysqli_num_rows( $r ) == 0 ) return false; |
| @@ -76,16 +76,16 function mt_explain_nonce($action) { | |||
|
|
76 | 76 | global $mtdb; |
|
|
77 | 77 | $c = explode('-',$action); |
|
|
78 | 78 | $i = (int)$c[2]; |
|
|
79 | ||
|
|
79 | ||
|
|
80 | 80 | $message = array(); |
|
|
81 | 81 | $message['rant']['new'] = 'Are you sure you want to create a new rant?'; |
|
|
82 | 82 | $message['rant']['save'] = 'Are you sure you want to save changes to the rant "%s"?'; |
|
|
83 | 83 | $message['rant']['delete'] = 'Are you sure you want to delete the rant "%s"? This is a destructive action, and cannot be undone!'; |
|
|
84 | ||
|
|
84 | ||
|
|
85 | 85 | $message['type']['new'] = 'Are you sure you want to create a new type?'; |
|
|
86 | 86 | $message['type']['save'] = 'Are you sure you want to save changes to the type "%s"?'; |
|
|
87 | 87 | $message['type']['delete'] = 'Are you sure you want to delete the type "%s"? This is a destructive action, and cannot be undone!'; |
|
|
88 | ||
|
|
88 | ||
|
|
89 | 89 | $message['metatype']['new'] = 'Are you sure you want to create a new metatype?'; |
|
|
90 | 90 | $message['metatype']['save'] = 'Are you sure you want to save changes to the metatype "%s"?'; |
|
|
91 | 91 | $message['metatype']['delete'] = 'Are you sure you want to delete the metatype "%s"? This is a destructive action, and cannot be undone!'; |
| @@ -94,21 +94,21 function mt_explain_nonce($action) { | |||
|
|
94 | 94 | $message['strip']['save'] = 'Are you sure you want to save changes to the strip "%s"?'; |
|
|
95 | 95 | $message['strip']['delete'] = 'Are you sure you want to delete the comic strip "%1$s"? This will break site navigation, which can be fixed by changing other strip numbers. This is a destructive action, and cannot be undone! It is far better to <a href="edit-comic.php?strip_id=%1$s">edit the existing strip</a>.'; |
|
|
96 | 96 | $message['strip']['swap'] = 'Are you sure you want to swap these two strips? This is a destructive action, and cannot be undone!'; |
|
|
97 | ||
|
|
97 | ||
|
|
98 | 98 | $message['statusbox']['update'] = 'Are you sure you want to update the statusbox information?'; |
|
|
99 | 99 | $message['scratchpad']['new'] = 'Are you sure you want to update the scratchpad information?'; |
|
|
100 | 100 | $message['twitter']['new'] = 'Are you sure you want to update the Twitter feed?'; |
|
|
101 | ||
|
|
101 | ||
|
|
102 | 102 | $message['extra']['new'] = 'Are you sure you want to upload a new file to /extra?'; |
|
|
103 | 103 | $message['extra']['delete'] = 'Are you sure you want to delete the file from /extra named "%s"?'; |
|
|
104 | ||
|
|
104 | ||
|
|
105 | 105 | $message['twitteruser']['delete'] = 'Are you sure you want to delete the twitter user "%s"?'; |
|
|
106 | ||
|
|
106 | ||
|
|
107 | 107 | if( isset( $message[ $c[1] ][ $c[0] ] )) { |
|
|
108 | 108 | $t = $message[ $c[1] ][ $c[0] ]; |
|
|
109 | ||
|
|
109 | ||
|
|
110 | 110 | if( false !== strpos( $t, '%' ) ) { |
|
|
111 | ||
|
|
111 | ||
|
|
112 | 112 | switch( $c[1] ) { |
|
|
113 | 113 | case 'rant': $v = $mtdb->getOne('SELECT title FROM rant WHERE id=' . $i); break; |
|
|
114 | 114 | case 'strip': $v = $mtdb->getOne('SELECT id FROM strip WHERE id=' . $i); break; |
| @@ -118,11 +118,11 function mt_explain_nonce($action) { | |||
|
|
118 | 118 | case 'twitteruser': $v = $mtdb->getOne('SELECT username FROM twitter_user WHERE id=' . $i); break; |
|
|
119 | 119 | default: $v = $i; |
|
|
120 | 120 | } |
|
|
121 | ||
|
|
121 | ||
|
|
122 | 122 | return sprintf( $t, mt_specialchars($v,true) ); |
|
|
123 | 123 | } |
|
|
124 | 124 | |
|
|
125 |
return $t; |
|
|
|
125 | return $t; | |
|
|
126 | 126 | } |
|
|
127 | 127 | return "Are you sure you want to perform the action $action?"; |
|
|
128 | 128 | } |
| @@ -131,4 +131,4 function nonce_field($action) { | |||
|
|
131 | 131 | echo '<input type="hidden" name="_mtnonce" value="' . create_nonce($action) . '" />'; |
|
|
132 | 132 | } |
|
|
133 | 133 | |
|
|
134 | ?> No newline at end of file | |
|
|
134 | ?> | |
| @@ -121,7 +121,7 function savetranscript( &$strip ) { | |||
|
|
121 | 121 | |
|
|
122 | 122 | if( $insert_sql && false === $mtdb->query( $insert_sql ) ) { |
|
|
123 | 123 | $mtdb->query('ROLLBACK'); |
|
|
124 | mtdie (mysqli_error(), 'Error inserting transcript.'); | |
|
|
124 | mtdie (mysqli_error($mtdb->link), 'Error inserting transcript.'); | |
|
|
125 | 125 | } |
|
|
126 | 126 | } |
|
|
127 | 127 | |
| @@ -129,7 +129,7 function savetranscript( &$strip ) { | |||
|
|
129 | 129 | $insert_sql = sprintf($inserter, (int)$strip->id, $i, $j, mysqli_real_escape_string($mtdb->link, $speaker), '', ''); |
|
|
130 | 130 | if( false === $mtdb->query( $insert_sql ) ) { |
|
|
131 | 131 | $mtdb->query('ROLLBACK'); |
|
|
132 | mtdie (mysqli_error(), 'Error inserting transcript.'); | |
|
|
132 | mtdie (mysqli_error($mtdb->link), 'Error inserting transcript.'); | |
|
|
133 | 133 | } |
|
|
134 | 134 | } |
|
|
135 | 135 | } |
| @@ -164,7 +164,7 function savetranscript( &$strip ) { | |||
|
|
164 | 164 | mysqli_real_escape_string($mtdb->link, $spoken[1]), mysqli_real_escape_string($mtdb->link, $spoken[2]) ); |
|
|
165 | 165 | if( false === $mtdb->query( $insert_sql ) ) { |
|
|
166 | 166 | $mtdb->query('ROLLBACK'); |
|
|
167 | mtdie (mysqli_error(), 'Error inserting transcript.'); | |
|
|
167 | mtdie (mysqli_error($mtdb->link), 'Error inserting transcript.'); | |
|
|
168 | 168 | } |
|
|
169 | 169 | } |
|
|
170 | 170 | } |
| @@ -6,7 +6,7 function get_typeByID( $id ) { | |||
|
|
6 | 6 | global $mtdb; |
|
|
7 | 7 | $id = (int)$id; |
|
|
8 | 8 | $r = $mtdb->getRow( 'SELECT id, name, description FROM strip_t WHERE id=' . $id ); |
|
|
9 |
$r->meta = $mtdb->getAll( 'SELECT meta as id from meta where type=' . $id); |
|
|
|
9 | $r->meta = $mtdb->getAll( 'SELECT meta as id from meta where type=' . $id); | |
|
|
10 | 10 | return $r; |
|
|
11 | 11 | } |
|
|
12 | 12 | |
| @@ -24,4 +24,4 function _getMetaNameFromObject($obj) { | |||
|
|
24 | 24 | return $obj->name; |
|
|
25 | 25 | } |
|
|
26 | 26 | |
|
|
27 | ?> No newline at end of file | |
|
|
27 | ?> | |
Comments 0
You need to be logged in to leave comments.
Login now
