Révision | 363 (tree) |
---|---|
l'heure | 2017-10-24 09:09:21 |
Auteur | kmorimatsu |
error -> jerror
@@ -36,10 +36,10 @@ | ||
36 | 36 | switch($_POST['action']){ |
37 | 37 | case 'admin.batch.deletecomments': |
38 | 38 | case 'admin.batch.deletemedia': |
39 | - if (!member::logged_in()) error::quit($warning); | |
39 | + if (!member::logged_in()) jerror::quit($warning); | |
40 | 40 | break; |
41 | 41 | default: |
42 | - if (!member::is_admin()) error::quit($warning); | |
42 | + if (!member::is_admin()) jerror::quit($warning); | |
43 | 43 | break; |
44 | 44 | } |
45 | 45 | } |
@@ -122,7 +122,7 @@ | ||
122 | 122 | $row=sql::query($checkquery,$id)->fetch(); |
123 | 123 | if ($row['result']) { |
124 | 124 | $note=self::translate('_ADMIN_BATCH_ITEM_COMMENTS_EXIST'); |
125 | - error::note($note.': #<%0%>',$id); | |
125 | + jerror::note($note.': #<%0%>',$id); | |
126 | 126 | continue; |
127 | 127 | } |
128 | 128 | } |
@@ -132,7 +132,7 @@ | ||
132 | 132 | $note=self::translate('_ADMIN_BATCH_DELETEITEM'); |
133 | 133 | sql::query($commentquery,$id); |
134 | 134 | } else $note=self::translate('_ADMIN_BATCH_DELETEITEM_FALIED'); |
135 | - error::note($note.': #<%0%>',$id); | |
135 | + jerror::note($note.': #<%0%>',$id); | |
136 | 136 | sql::commit(); |
137 | 137 | } |
138 | 138 | } |
@@ -140,13 +140,13 @@ | ||
140 | 140 | // This method is placed here because this cannot be placed in admin_comments class. |
141 | 141 | if (member::is_admin()) $query='DELETE FROM jeans_comment WHERE id=<%id%>'; |
142 | 142 | elseif (member::logged_in()) $query='DELETE FROM jeans_comment WHERE id=<%id%> AND author=<%author%>'; |
143 | - else error::quit(_ADMIN_NO_PERMISSION); | |
143 | + else jerror::quit(_ADMIN_NO_PERMISSION); | |
144 | 144 | sql::begin(); |
145 | 145 | foreach (self::$ids as $id) { |
146 | 146 | $res=sql::query($query,array('id'=>$id,'author'=>member::setting('id'))); |
147 | 147 | if (0<$res->rowCount()) $note=self::translate('_ADMIN_BATCH_DELETECOMMENT'); |
148 | 148 | else $note=self::translate('_ADMIN_BATCH_DELETECOMMENT_FALIED'); |
149 | - error::note($note.': #<%0%>',$id); | |
149 | + jerror::note($note.': #<%0%>',$id); | |
150 | 150 | } |
151 | 151 | sql::commit(); |
152 | 152 | } |
@@ -159,7 +159,7 @@ | ||
159 | 159 | $res=sql::query($countquery,$id)->fetch(); |
160 | 160 | if ($res['result']) { |
161 | 161 | $note=self::translate('_ADMIN_BATCH_GROUP_NOT_EMPTY'); |
162 | - error::note($note.': #<%0%>',$id); | |
162 | + jerror::note($note.': #<%0%>',$id); | |
163 | 163 | continue; |
164 | 164 | } |
165 | 165 | sql::begin(); |
@@ -170,7 +170,7 @@ | ||
170 | 170 | $note=self::translate('_ADMIN_BATCH_DELETEGROUP'); |
171 | 171 | } else $note=self::translate('_ADMIN_BATCH_DELETEGROUP_FALIED'); |
172 | 172 | sql::commit(); |
173 | - error::note($note.': #<%0%>',$id); | |
173 | + jerror::note($note.': #<%0%>',$id); | |
174 | 174 | } |
175 | 175 | } |
176 | 176 | static public function action_post_deleteplugins(){ |
@@ -191,7 +191,7 @@ | ||
191 | 191 | $note=self::translate('_ADMIN_BATCH_DELETEPLUGIN'); |
192 | 192 | } |
193 | 193 | } |
194 | - error::note($note.': <%0%>',$id); | |
194 | + jerror::note($note.': <%0%>',$id); | |
195 | 195 | } |
196 | 196 | sql::commit(); |
197 | 197 | $res=sql::query('SELECT id FROM jeans_plugin ORDER BY sequence ASC'); |
@@ -212,10 +212,10 @@ | ||
212 | 212 | } |
213 | 213 | if ($_POST['direction']=='up' && count($upper)) { |
214 | 214 | array_unshift($lower,array_pop($upper)); |
215 | - error::note(self::translate('_ADMIN_BATCH_MOVEPLUGINS_UP')); | |
215 | + jerror::note(self::translate('_ADMIN_BATCH_MOVEPLUGINS_UP')); | |
216 | 216 | } elseif ($_POST['direction']=='down' && count($lower)) { |
217 | 217 | array_push($upper,array_shift($lower)); |
218 | - error::note(self::translate('_ADMIN_BATCH_MOVEPLUGINS_DOWN')); | |
218 | + jerror::note(self::translate('_ADMIN_BATCH_MOVEPLUGINS_DOWN')); | |
219 | 219 | } |
220 | 220 | $query='UPDATE jeans_plugin SET sequence=<%i%> WHERE id=<%id%>'; |
221 | 221 | $i=0; |
@@ -240,7 +240,7 @@ | ||
240 | 240 | $ids=array(); |
241 | 241 | while ($row=$res->fetch()) $ids[]=$row['id']; |
242 | 242 | $res=sql::query('DELETE FROM jeans_binary WHERE id IN (<%ids%>)',array('ids'=>$ids)); |
243 | - if (0<$res->rowCount()) error::note('_ADMIN_BATCH_DELETEMEDIA_DONE'); | |
244 | - else error::note('_ADMIN_BATCH_DELETEMEDIA_FAILED'); | |
243 | + if (0<$res->rowCount()) jerror::note('_ADMIN_BATCH_DELETEMEDIA_DONE'); | |
244 | + else jerror::note('_ADMIN_BATCH_DELETEMEDIA_FAILED'); | |
245 | 245 | } |
246 | 246 | } |
\ No newline at end of file |
@@ -10,14 +10,14 @@ | ||
10 | 10 | // if self::$itemdata remains as false, edit/add comment isn't accepted. |
11 | 11 | if (!empty($_GET['cid'])) { |
12 | 12 | $row=sql::query('SELECT itemid, author from jeans_comment WHERE id=<%0%>',$_GET['cid'])->fetch(); |
13 | - if (!$row) return error::fatal('_ADMIN_COMMENT_NO_SUCH_COMMENT'); | |
14 | - if ($row['author']!=member::setting('id') && !member::is_admin()) return error::fatal('_ADMIN_NO_PERMISSION'); | |
13 | + if (!$row) return jerror::fatal('_ADMIN_COMMENT_NO_SUCH_COMMENT'); | |
14 | + if ($row['author']!=member::setting('id') && !member::is_admin()) return jerror::fatal('_ADMIN_NO_PERMISSION'); | |
15 | 15 | $itemid=$row['itemid']; |
16 | 16 | } elseif (!empty($_POST['itemid'])) $itemid=(int)$_POST['itemid']; |
17 | 17 | elseif (!empty($_GET['itemid'])) $itemid=(int)$_GET['itemid']; |
18 | - else return error::fatal('_ADMIN_COMMENT_NO_SUCH_ITEM'); | |
18 | + else return jerror::fatal('_ADMIN_COMMENT_NO_SUCH_ITEM'); | |
19 | 19 | self::$itemdata=sql::query('SELECT gid,id FROM jeans_item WHERE id=<%0%>',$itemid)->fetch(); |
20 | - if (!self::$itemdata) return error::fatal('_ADMIN_COMMENT_NO_SUCH_ITEM'); | |
20 | + if (!self::$itemdata) return jerror::fatal('_ADMIN_COMMENT_NO_SUCH_ITEM'); | |
21 | 21 | } |
22 | 22 | static public function enabled(){ |
23 | 23 | if (!self::$itemdata) return false; |
@@ -24,7 +24,7 @@ | ||
24 | 24 | return comments::if_enabled(self::$itemdata); |
25 | 25 | } |
26 | 26 | static public function action_post_add(){ |
27 | - if (!self::enabled()) return error::note('_ADMIN_COMMENT_NOT_ACCEPTED'); | |
27 | + if (!self::enabled()) return jerror::note('_ADMIN_COMMENT_NOT_ACCEPTED'); | |
28 | 28 | // prepare XML |
29 | 29 | $xml=new SimpleXMLElement(_XML_BLANC); |
30 | 30 | if (member::logged_in()) { |
@@ -32,11 +32,11 @@ | ||
32 | 32 | $xml->web= member::setting('web'); |
33 | 33 | $xml->email= member::setting('email'); |
34 | 34 | } else { |
35 | - if (strlen($_POST['user_text'])==0) return error::note('_ADMIN_COMMENT_VALID_USER_NAME_RQUIRED'); | |
35 | + if (strlen($_POST['user_text'])==0) return jerror::note('_ADMIN_COMMENT_VALID_USER_NAME_RQUIRED'); | |
36 | 36 | if (constant('_CONF_PROTECT_MEMBER_NAMES')) { |
37 | 37 | $query='SELECT COUNT(*) as result FROM jeans_member WHERE name LIKE <%0%>'; |
38 | 38 | $row=sql::query($query,$_POST['user_text'])->fetch(); |
39 | - if ($row['result']) return error::note('_ADMIN_COMMENT_VALID_USER_NAME_RQUIRED'); | |
39 | + if ($row['result']) return jerror::note('_ADMIN_COMMENT_VALID_USER_NAME_RQUIRED'); | |
40 | 40 | } |
41 | 41 | $xml->user= $_POST['user_text']; |
42 | 42 | $xml->web= $_POST['web_url']; |
@@ -46,7 +46,7 @@ | ||
46 | 46 | $xml->time=_NOW; |
47 | 47 | // prepare row |
48 | 48 | $row=array('author'=>(int)member::setting('id'), 'xml'=>$xml->asXML()); |
49 | - if (empty($_POST['body_text'])) return error::note('_ADMIN_COMMENT_NO_EMPTY_COMMENT'); | |
49 | + if (empty($_POST['body_text'])) return jerror::note('_ADMIN_COMMENT_NO_EMPTY_COMMENT'); | |
50 | 50 | else $row['body']=$_POST['body_text']; |
51 | 51 | $row['itemid']=self::$itemdata['id']; |
52 | 52 | // update SQL table |
@@ -63,7 +63,7 @@ | ||
63 | 63 | // use $_GET['commentid'] and $_POST['body_text'] |
64 | 64 | if (member::is_admin()) $query='UPDATE jeans_comment SET body=<%body%>, flags=<%flags%> WHERE id=<%id%>'; |
65 | 65 | elseif (member::logged_in()) $query='UPDATE jeans_comment SET body=<%body%>, flags=<%flags%> WHERE id=<%id%> AND author=<%author%>'; |
66 | - else return error::fatal('_ADMIN_NO_PERMISSION'); | |
66 | + else return jerror::fatal('_ADMIN_NO_PERMISSION'); | |
67 | 67 | // prepare data array |
68 | 68 | $post=admin::item_from_post('jeans_comment'); |
69 | 69 | $array=array('body'=>$post['body'],'id'=>$_GET['cid'],'author'=>member::setting('id'),'flags'=>$post['flags']); |
@@ -14,8 +14,8 @@ | ||
14 | 14 | if (!member::is_admin()) { |
15 | 15 | $query='SELECT author FROM jeans_comment WHERE id=<%0%>'; |
16 | 16 | $row=sql::query($query,$_GET['cid'])->fetch(); |
17 | - if (!$row) error::quit($warning); | |
18 | - if ($row['author']!=member::setting('id')) error::quit($warning); | |
17 | + if (!$row) jerror::quit($warning); | |
18 | + if ($row['author']!=member::setting('id')) jerror::quit($warning); | |
19 | 19 | } |
20 | 20 | self::$mode='comment'; |
21 | 21 | self::$id=$_GET['cid']; |
@@ -24,8 +24,8 @@ | ||
24 | 24 | if (!member::is_admin()) { |
25 | 25 | $query='SELECT author FROM jeans_item WHERE id=<%0%>'; |
26 | 26 | $row=sql::query($query,$_GET['itemid'])->fetch(); |
27 | - if (!$row) error::quit($warning); | |
28 | - if ($row['author']!=member::setting('id')) error::quit($warning); | |
27 | + if (!$row) jerror::quit($warning); | |
28 | + if ($row['author']!=member::setting('id')) jerror::quit($warning); | |
29 | 29 | } |
30 | 30 | self::$mode='item'; |
31 | 31 | self::$id=$_GET['itemid']; |
@@ -32,13 +32,13 @@ | ||
32 | 32 | } elseif (!empty($_GET['mid'])) { |
33 | 33 | // Owner and superadmin can go ahead |
34 | 34 | if (!member::is_admin()) { |
35 | - if (member::setting('id')!=$_GET['mid']) error::quit($warning); | |
35 | + if (member::setting('id')!=$_GET['mid']) jerror::quit($warning); | |
36 | 36 | } |
37 | 37 | self::$mode='member'; |
38 | 38 | self::$id=$_GET['mid']; |
39 | 39 | } elseif (!empty($_GET['gid'])) { |
40 | 40 | // Only superadmin can go ahead |
41 | - if (!member::is_admin()) error::quit($warning); | |
41 | + if (!member::is_admin()) jerror::quit($warning); | |
42 | 42 | self::$mode='group'; |
43 | 43 | self::$id=$_GET['gid']; |
44 | 44 | } |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | } |
14 | 14 | static public function tag_conflist(&$data,$skin=false){ |
15 | 15 | static $cache; |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | } |
14 | 14 | static private function _groupsetting($data,$skin,$type){ |
15 | 15 | static $cache=array(); |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | } |
14 | 14 | static public function tag_edititemform(&$data,$skin=false){ |
15 | 15 | // TODO: support using extended values defined by plugin as XML values. |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | } |
14 | 14 | static public function tag_list(&$data,$skin=false,$limit=100){ |
15 | 15 | $offset=isset($_GET['offset'])?(int)$_GET['offset']:0; |
@@ -35,13 +35,13 @@ | ||
35 | 35 | } |
36 | 36 | static public function action_post_delete(){ |
37 | 37 | sql::query('DELETE FROM jeans_log'); |
38 | - error::note('_ADMIN_LOG_DELETED'); | |
38 | + jerror::note('_ADMIN_LOG_DELETED'); | |
39 | 39 | if (!empty($_POST['vacuum'])) { |
40 | 40 | foreach (sql::pdo_objects() as $mode=>$pdo) { |
41 | 41 | sql::select_pdo($mode); |
42 | 42 | sql::query('VACUUM;'); |
43 | 43 | } |
44 | - error::note('_ADMIN_VACUUM_DONE'); | |
44 | + jerror::note('_ADMIN_VACUUM_DONE'); | |
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
\ No newline at end of file |
@@ -15,7 +15,7 @@ | ||
15 | 15 | case 'admin.mail.reactivate': |
16 | 16 | break; |
17 | 17 | default: |
18 | - error::quit($warning); | |
18 | + jerror::quit($warning); | |
19 | 19 | } |
20 | 20 | } |
21 | 21 | // Reactivation keys are valid for 2 days. |
@@ -80,7 +80,7 @@ | ||
80 | 80 | $text.=self::translate('_ADMIN_MAIL_REACTIVATE_ACCOUNT_TEXT2')."\n"; |
81 | 81 | $text.=_CONF_URL_ADMIN.'?mid='.$id.'&reactivate='.$key."\n"; |
82 | 82 | // Send e-mail |
83 | - if (!self::send($id,$subject,$text)) return error::note('_ADMIN_MAIL_FAILED'); | |
83 | + if (!self::send($id,$subject,$text)) return jerror::note('_ADMIN_MAIL_FAILED'); | |
84 | 84 | // Store reactivation key to DB |
85 | 85 | $row=array('memberid'=>$id,'key'=>hash('sha512',_HASH_SALT.$key),'timestamp'=>time()); |
86 | 86 | sql::select_pdo('member'); |
@@ -94,7 +94,7 @@ | ||
94 | 94 | $text.=self::translate('_ADMIN_MAIL_REACTIVATE_BAD_ACCOUNT_TEXT2')."\n"; |
95 | 95 | $text.='IP: '.$_SERVER['REMOTE_ADDR']."\nID: ".$_POST['loginname']."\n"; |
96 | 96 | // Send e-mail |
97 | - if (!self::send($id,$subject,$text)) return error::note('_ADMIN_MAIL_FAILED'); | |
97 | + if (!self::send($id,$subject,$text)) return jerror::note('_ADMIN_MAIL_FAILED'); | |
98 | 98 | } |
99 | 99 | core::set_cookie('note_text',self::translate('_ADMIN_MAIL_FORGOTPASSWORD_DONE'),0); |
100 | 100 | core::redirect_local(_CONF_URL_ADMIN); |
@@ -104,10 +104,10 @@ | ||
104 | 104 | $array=array('id'=>$_GET['mid'],'key'=>hash('sha512',_HASH_SALT.$_GET['reactivate'])); |
105 | 105 | sql::select_pdo('member'); |
106 | 106 | $row=sql::query('SELECT memberid as id FROM jeans_reactivate WHERE memberid=<%id%> AND key=<%key%> LIMIT 1',$array)->fetch(); |
107 | - if (!$row) return error::note('_ADMIN_MAIL_REACTIVATE_INVALID_KEY'); | |
107 | + if (!$row) return jerror::note('_ADMIN_MAIL_REACTIVATE_INVALID_KEY'); | |
108 | 108 | // Check if passwords matches and are good. |
109 | - if ($_POST['password1_text']!=$_POST['password2_text']) return error::note(self::translate('_ADMIN_MEMBERINFO_PASSWORD_MISMATCH')); | |
110 | - if (strlen($_POST['password1_text'])<6) return error::note(self::translate('_ADMIN_MEMBERINFO_PASSWORD_TOO_SHORT')); | |
109 | + if ($_POST['password1_text']!=$_POST['password2_text']) return jerror::note(self::translate('_ADMIN_MEMBERINFO_PASSWORD_MISMATCH')); | |
110 | + if (strlen($_POST['password1_text'])<6) return jerror::note(self::translate('_ADMIN_MEMBERINFO_PASSWORD_TOO_SHORT')); | |
111 | 111 | // Update DB |
112 | 112 | $array=array('id'=>$row['id'],'password'=>hash('sha512',_HASH_SALT.$_POST['password1_text'])); |
113 | 113 | sql::select_pdo('member'); |
@@ -121,7 +121,7 @@ | ||
121 | 121 | } |
122 | 122 | static public function action_post_sendmessage(){ |
123 | 123 | if (strlen($_POST['message_text'])==0) { |
124 | - error::note(self::translate('_ADMIN_MAIL_NO_EMPTY_MESSAGE')); | |
124 | + jerror::note(self::translate('_ADMIN_MAIL_NO_EMPTY_MESSAGE')); | |
125 | 125 | return; |
126 | 126 | } |
127 | 127 | $from_member=!empty($_POST['frommember']); |
@@ -132,10 +132,10 @@ | ||
132 | 132 | $message.=_CONF_URL_INDEX.'?memberid='.self::setting('id')."\n"; |
133 | 133 | $message.="-----\n".$_POST['message_text']; |
134 | 134 | if (self::send($_POST['mid'],$subject,$message,$from_member)) { |
135 | - error::note('_ADMIN_MAIL_PRIVATE_MESSAGE_SUCESS'); | |
135 | + jerror::note('_ADMIN_MAIL_PRIVATE_MESSAGE_SUCESS'); | |
136 | 136 | unset($_POST['message_text']); |
137 | 137 | } else { |
138 | - error::note('_ADMIN_MAIL_PRIVATE_MESSAGE_FAILED'); | |
138 | + jerror::note('_ADMIN_MAIL_PRIVATE_MESSAGE_FAILED'); | |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
\ No newline at end of file |
@@ -10,7 +10,7 @@ | ||
10 | 10 | // Authority check for the action. |
11 | 11 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
12 | 12 | $mid=isset($_GET['mid']) ? intval($_GET['mid']) : member::setting('id'); |
13 | - if (!_CONF_ALLOW_FILE_UPLOAD || !member::logged_in()) error::quit($warning); | |
13 | + if (!_CONF_ALLOW_FILE_UPLOAD || !member::logged_in()) jerror::quit($warning); | |
14 | 14 | if (member::is_admin()) { |
15 | 15 | self::$max_size=_CONF_MAX_UPLOAD_SIZE; |
16 | 16 | } elseif ($mid==member::setting('id')) { |
@@ -19,7 +19,7 @@ | ||
19 | 19 | $res=sql::query('SELECT binsize FROM jeans_binary WHERE type="media" AND contextid=<%0%>',member::setting('id')); |
20 | 20 | while ($row=$res->fetch()) $max_total=$max_total-$row['binsize']; |
21 | 21 | if ($max_total < $max_size) $max_size=$max_total; |
22 | - } else error::quit($warning); | |
22 | + } else jerror::quit($warning); | |
23 | 23 | self::member_id($mid); |
24 | 24 | self::$accepted=preg_split('/[^a-zA-Z0-9]+/',strtolower(_CONF_ALLOW_FILE_TYPES),-1,PREG_SPLIT_NO_EMPTY); |
25 | 25 | // Thumbnail |
@@ -32,7 +32,7 @@ | ||
32 | 32 | } |
33 | 33 | static public function action_post_upload(){ |
34 | 34 | // Get information of uploaded file |
35 | - if (!isset($_FILES['binfile'])) return error::note('_ADMIN_MEDIA_FILE_NOT_FOUND'); | |
35 | + if (!isset($_FILES['binfile'])) return jerror::note('_ADMIN_MEDIA_FILE_NOT_FOUND'); | |
36 | 36 | $file=&$_FILES['binfile']; |
37 | 37 | switch ($file['error']) { |
38 | 38 | case UPLOAD_ERR_OK: |
@@ -39,30 +39,30 @@ | ||
39 | 39 | break; |
40 | 40 | case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: |
41 | 41 | @unlink($file['tmp_name']); |
42 | - return error::note('_ADMIN_MEDIA_FILE_TOO_LARGE'); | |
42 | + return jerror::note('_ADMIN_MEDIA_FILE_TOO_LARGE'); | |
43 | 43 | default: |
44 | 44 | @unlink($file['tmp_name']); |
45 | - return error::note('_ADMIN_MEDIA_UNKNOWN_ERROR'); | |
45 | + return jerror::note('_ADMIN_MEDIA_UNKNOWN_ERROR'); | |
46 | 46 | } |
47 | 47 | // Check if upload is accepted to this file. |
48 | 48 | $size=filesize($file['tmp_name']); |
49 | 49 | if (self::$max_size < $size) { |
50 | 50 | @unlink($file['tmp_name']); |
51 | - return error::note(self::translate('_ADMIN_MEDIA_FILE_TOO_LARGE').'(max: '.self::$max_size.')'); | |
51 | + return jerror::note(self::translate('_ADMIN_MEDIA_FILE_TOO_LARGE').'(max: '.self::$max_size.')'); | |
52 | 52 | } |
53 | 53 | if (!preg_match('/^(.+\.)([a-zA-Z0-9]+)$/',trim($file['name']),$m)) { |
54 | 54 | @unlink($file['tmp_name']); |
55 | - return error::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
55 | + return jerror::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
56 | 56 | } |
57 | 57 | $m[2]=strtolower($m[2]); |
58 | 58 | if (!in_array($m[2],self::$accepted)) { |
59 | 59 | @unlink($file['tmp_name']); |
60 | - return error::note('_ADMIN_MEDIA_INVALID_FILE_TYPE'); | |
60 | + return jerror::note('_ADMIN_MEDIA_INVALID_FILE_TYPE'); | |
61 | 61 | } |
62 | 62 | $m[1]=self::utf8($m[1]); |
63 | 63 | if (strlen($m[1])==0) { |
64 | 64 | @unlink($file['tmp_name']); |
65 | - return error::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
65 | + return jerror::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
66 | 66 | } |
67 | 67 | // Get image information and thumbnail if possible |
68 | 68 | $file_name=$m[1].$m[2]; |
@@ -105,7 +105,7 @@ | ||
105 | 105 | sql::query($query,array('row'=>$row)); |
106 | 106 | } |
107 | 107 | if ($res->rowCount()) { |
108 | - error::note('_ADMIN_MEDIA_UPLOAD_DONE'); | |
108 | + jerror::note('_ADMIN_MEDIA_UPLOAD_DONE'); | |
109 | 109 | $array=array('name'=>$file_name,'size'=>$size,'mime'=>$mime,'time'=>_NOW); |
110 | 110 | foreach($xml as $key=>$value) $array[$key]=$value; |
111 | 111 | $array['type']=isset($array['width']) ? 'image':'media'; |
@@ -112,7 +112,7 @@ | ||
112 | 112 | // Set information of the uploaded file |
113 | 113 | self::uploaded_file($array); |
114 | 114 | } else { |
115 | - error::note('_ADMIN_MEDIA_UPLOAD_FAILED'); | |
115 | + jerror::note('_ADMIN_MEDIA_UPLOAD_FAILED'); | |
116 | 116 | } |
117 | 117 | } |
118 | 118 | static public function uploaded_file($info=false){ |
@@ -13,8 +13,8 @@ | ||
13 | 13 | // The member also can use this class, but only for own information. |
14 | 14 | self::$mid=empty($_GET['mid'])? false:(int)$_GET['mid']; |
15 | 15 | if (!member::is_admin()) { |
16 | - if (!member::logged_in()) error::quit($warning); | |
17 | - if (self::$mid!=member::setting('id')) error::quit($warning); | |
16 | + if (!member::logged_in()) jerror::quit($warning); | |
17 | + if (self::$mid!=member::setting('id')) jerror::quit($warning); | |
18 | 18 | } |
19 | 19 | } |
20 | 20 | static public function data($key,$mid=false){ |
@@ -94,7 +94,7 @@ | ||
94 | 94 | $array=array('name'=>$post['name'],'id'=>$_GET['mid']); |
95 | 95 | if (sql::query($query,$array)->fetch()) { |
96 | 96 | // The name is already used. |
97 | - error::note(_ADMIN_MEMBERINFO_NAME_USED); | |
97 | + jerror::note(_ADMIN_MEMBERINFO_NAME_USED); | |
98 | 98 | return; |
99 | 99 | } |
100 | 100 | $xml=new SimpleXMLElement(_XML_BLANC); |
@@ -145,7 +145,7 @@ | ||
145 | 145 | if (!isset($post['password'])) return; |
146 | 146 | // Check if password is correct |
147 | 147 | if (!member::try_login(member::setting('loginname'),$post['password'])){ |
148 | - error::note('_ADMIN_MEMBERINFO_WRONG_PASSWORD'); | |
148 | + jerror::note('_ADMIN_MEMBERINFO_WRONG_PASSWORD'); | |
149 | 149 | return; |
150 | 150 | } |
151 | 151 | // Set authority flags |
@@ -174,8 +174,8 @@ | ||
174 | 174 | 'password'=>hash('sha512',_HASH_SALT.$post['password1']), |
175 | 175 | 'flags'=>$post['flags']); |
176 | 176 | // Let's check the authority here again for security though it's checked in init() method. |
177 | - if (!member::logged_in()) error::quit(_ADMIN_NO_PERMISSION); | |
178 | - if (member::setting('id')!=self::$mid && !member::is_admin()) error::quit(_ADMIN_NO_PERMISSION); | |
177 | + if (!member::logged_in()) jerror::quit(_ADMIN_NO_PERMISSION); | |
178 | + if (member::setting('id')!=self::$mid && !member::is_admin()) jerror::quit(_ADMIN_NO_PERMISSION); | |
179 | 179 | sql::select_pdo('member'); |
180 | 180 | $res=sql::query($query,$array); |
181 | 181 | // Everything is done. Show the information. |
@@ -190,7 +190,7 @@ | ||
190 | 190 | } |
191 | 191 | static private function add_member($post){ |
192 | 192 | // Let's check the authority here again for security though it's checked in init() method. |
193 | - if (!member::is_admin()) error::quit(_ADMIN_NO_PERMISSION); | |
193 | + if (!member::is_admin()) jerror::quit(_ADMIN_NO_PERMISSION); | |
194 | 194 | // Check if loginname, e-mail, and name are OK. |
195 | 195 | $query='SELECT id FROM jeans_login WHERE email=<%email%> OR loginname=<%loginname%>'; |
196 | 196 | sql::select_pdo('member'); |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | // Register SQL function |
14 | 14 | sql::pdo()->sqliteCreateFunction('libs_admin_plugin_deleteunusedplugins',array('admin_plugin','cb_action_post_deleteunusedoptions'),1); |
15 | 15 | } |
@@ -89,8 +89,8 @@ | ||
89 | 89 | } |
90 | 90 | static public function action_post_install(){ |
91 | 91 | $plugin=$_POST['plugin']; |
92 | - if (!preg_match('/^[jp_[a-zA-Z0-9]+$/',$plugin)) return error::note('Invalid plugin name'); | |
93 | - if (!self::local_file_exists(_DIR_PLUGINS,"$plugin.php")) return error::note('Plugin file not found.'); | |
92 | + if (!preg_match('/^[jp_[a-zA-Z0-9]+$/',$plugin)) return jerror::note('Invalid plugin name'); | |
93 | + if (!self::local_file_exists(_DIR_PLUGINS,"$plugin.php")) return jerror::note('Plugin file not found.'); | |
94 | 94 | plugin::set_install($plugin); |
95 | 95 | if (class_exists($plugin)) { |
96 | 96 | self::refresh_plugin_info($plugin); |
@@ -97,7 +97,7 @@ | ||
97 | 97 | core::set_cookie('note_text',_ADMIN_PLUGIN_INSTALL_SUCESS,0); |
98 | 98 | core::redirect_local(_CONF_SELF.'?page=plugin'); |
99 | 99 | } |
100 | - error::note(_ADMIN_PLUGIN_INSTALL_FAILED); | |
100 | + jerror::note(_ADMIN_PLUGIN_INSTALL_FAILED); | |
101 | 101 | |
102 | 102 | } |
103 | 103 | static public function action_post_deleteunusedoptions(){ |
@@ -117,7 +117,7 @@ | ||
117 | 117 | sql::query($query); |
118 | 118 | } |
119 | 119 | sql::commit(); |
120 | - error::note('_ADMIN_PLUGIN_DELETEUNUSEDOPTIONS_DONE'); | |
120 | + jerror::note('_ADMIN_PLUGIN_DELETEUNUSEDOPTIONS_DONE'); | |
121 | 121 | } |
122 | 122 | static public function cb_action_post_deleteunusedoptions(&$xmltext){ |
123 | 123 | static $plugins; |
@@ -12,15 +12,15 @@ | ||
12 | 12 | $plugin=$_GET['guest_padmin']; |
13 | 13 | $skin='guest_skin.inc'; |
14 | 14 | } elseif (isset($_GET['member_padmin'])) { |
15 | - if (!member::if_loggedin()) error::quit('_ADMIN_NO_PERMISSION'); | |
15 | + if (!member::if_loggedin()) jerror::quit('_ADMIN_NO_PERMISSION'); | |
16 | 16 | $plugin=$_GET['member_padmin']; |
17 | 17 | $skin='member_skin.inc'; |
18 | 18 | } elseif (isset($_GET['padmin']) && member::is_admin()) { |
19 | - if (!member::is_admin()) error::quit('_ADMIN_NO_PERMISSION'); | |
19 | + if (!member::is_admin()) jerror::quit('_ADMIN_NO_PERMISSION'); | |
20 | 20 | $plugin=$_GET['padmin']; |
21 | 21 | $skin='skin.inc'; |
22 | 22 | } else return; |
23 | - if (substr($plugin,0,3)!='jp_' || !plugin::plugin_list($plugin)) error::quit('_ADMIN_PLUGIN_NOT_FOUND'); | |
23 | + if (substr($plugin,0,3)!='jp_' || !plugin::plugin_list($plugin)) jerror::quit('_ADMIN_PLUGIN_NOT_FOUND'); | |
24 | 24 | view::tag_parse($data,'/jp/'.substr($plugin,3)."/$skin"); |
25 | 25 | } |
26 | 26 | } |
\ No newline at end of file |
@@ -9,7 +9,7 @@ | ||
9 | 9 | // Load the language file |
10 | 10 | $warning=self::translate('_ADMIN_NO_PERMISSION'); |
11 | 11 | // Only superadmin can use this class |
12 | - if (!member::is_admin()) error::quit($warning); | |
12 | + if (!member::is_admin()) jerror::quit($warning); | |
13 | 13 | // Register function to be used in query |
14 | 14 | sql::pdo()->sqliteCreateFunction('get_table_index',array('admin_sql','get_table_index'),1); |
15 | 15 | } |
@@ -43,7 +43,7 @@ | ||
43 | 43 | sql::select_pdo($mode); |
44 | 44 | sql::query('VACUUM;'); |
45 | 45 | } |
46 | - error::note('_ADMIN_VACUUM_DONE'); | |
46 | + jerror::note('_ADMIN_VACUUM_DONE'); | |
47 | 47 | } |
48 | 48 | static private $query=''; |
49 | 49 | static public function action_post_query(){ |
@@ -223,8 +223,8 @@ | ||
223 | 223 | $query=sql::fill_query($query,array('table'=>$table)); |
224 | 224 | sql::query($query,array('id'=>$id,'row'=>$row)); |
225 | 225 | $array=array('id'=>$id,'table'=>$table); |
226 | - if (!$id) error::note('New item on <%table%> table was created.', $array); | |
227 | - elseif ($delete) error::note('The item (id: <%id%>) on <%table%> table was deleted.', $array); | |
228 | - else error::note('The item (id: <%id%>) on <%table%> table was saved.', $array); | |
226 | + if (!$id) jerror::note('New item on <%table%> table was created.', $array); | |
227 | + elseif ($delete) jerror::note('The item (id: <%id%>) on <%table%> table was deleted.', $array); | |
228 | + else jerror::note('The item (id: <%id%>) on <%table%> table was saved.', $array); | |
229 | 229 | } |
230 | 230 | } |
\ No newline at end of file |
@@ -49,6 +49,6 @@ | ||
49 | 49 | $dir=dirname(_CONF_DB_MAIN); |
50 | 50 | if (is_writable($dir)) return $dir; |
51 | 51 | } |
52 | - error::quit('Cannot create temporary file'); | |
52 | + jerror::quit('Cannot create temporary file'); | |
53 | 53 | } |
54 | 54 | } |
\ No newline at end of file |
@@ -46,7 +46,7 @@ | ||
46 | 46 | break; |
47 | 47 | } |
48 | 48 | $page='main'; |
49 | - error::note(_ADMIN_FEATURE_NOT_IMPLEMENTED); | |
49 | + jerror::note(_ADMIN_FEATURE_NOT_IMPLEMENTED); | |
50 | 50 | } |
51 | 51 | switch($page){ |
52 | 52 | case 'main': case 'reactivate': case 'forgotpassword': |
@@ -55,13 +55,13 @@ | ||
55 | 55 | case 'commentlist': case 'batch': case 'membersetting': case 'loginsetting': case 'media': |
56 | 56 | case 'editcomment': |
57 | 57 | // Accept admin and member |
58 | - if (!member::logged_in()) error::quit(_ADMIN_NO_PERMISSION); | |
58 | + if (!member::logged_in()) jerror::quit(_ADMIN_NO_PERMISSION); | |
59 | 59 | break; |
60 | 60 | default: |
61 | 61 | if (substr($page,0,6)=='guest_') break; |
62 | 62 | elseif (substr($page,0,7)=='member_' && member::logged_in()) break; |
63 | 63 | // Only superadmin can go ahead |
64 | - if (!member::is_admin()) error::quit(_ADMIN_NO_PERMISSION); | |
64 | + if (!member::is_admin()) jerror::quit(_ADMIN_NO_PERMISSION); | |
65 | 65 | } |
66 | 66 | $template=array('libs'=>array('admin'=>array( |
67 | 67 | 'page'=>$page, |
@@ -32,7 +32,7 @@ | ||
32 | 32 | $template='index'; |
33 | 33 | if (class_exists('error',false)) { |
34 | 34 | // Note that the class 'error' exists when $_COOKIE['note_text'] is set. |
35 | - if (error::fatal() || isset($_GET['error'])) $template='error'; | |
35 | + if (jerror::fatal() || isset($_GET['error'])) $template='error'; | |
36 | 36 | } |
37 | 37 | $category=isset($_GET['sgid'])?$_GET['sgid']:0; |
38 | 38 | if ($template=='error') { |
@@ -42,7 +42,7 @@ | ||
42 | 42 | $category=parent::sgsetting('id'); |
43 | 43 | if (item::setting('flags') & sql::FLAG_INVALID) { |
44 | 44 | $template='error'; |
45 | - error::fatal('_JEANS_ERROR_ITEM_NOT_EXIST'); | |
45 | + jerror::fatal('_JEANS_ERROR_ITEM_NOT_EXIST'); | |
46 | 46 | } |
47 | 47 | } elseif (isset($_GET['archive'])) { |
48 | 48 | $template='archive'; |
@@ -62,13 +62,13 @@ | ||
62 | 62 | if (!parent::setting('id')) { |
63 | 63 | $template='error'; |
64 | 64 | parent::set_id(_CONF_DEFAULT_GROUP); |
65 | - error::fatal('_JEANS_ERROR_BLOG_NOT_EXIST'); | |
65 | + jerror::fatal('_JEANS_ERROR_BLOG_NOT_EXIST'); | |
66 | 66 | } |
67 | 67 | if ($category && $template!='error') { |
68 | 68 | self::set_sgid($category); |
69 | 69 | if (!parent::sgsetting('id')) { |
70 | 70 | $template='error'; |
71 | - error::fatal('_JEANS_ERROR_CATEGORY_NOT_EXIST'); | |
71 | + jerror::fatal('_JEANS_ERROR_CATEGORY_NOT_EXIST'); | |
72 | 72 | } |
73 | 73 | } |
74 | 74 | $skin=parent::setting('group_skin'); |
@@ -15,8 +15,8 @@ | ||
15 | 15 | self::$subgroupid=$row['id']; |
16 | 16 | if ($row['gid']) self::$groupid=(int)$row['gid']; |
17 | 17 | elseif ($row['sgid']==0) self::$groupid=(int)$row['id']; |
18 | - else error::fatal('_JEANS_ERROR_SUBGROUP_NOT_EXIST'); | |
19 | - } else error::fatal('_JEANS_ERROR_SUBGROUP_NOT_EXIST'); | |
18 | + else jerror::fatal('_JEANS_ERROR_SUBGROUP_NOT_EXIST'); | |
19 | + } else jerror::fatal('_JEANS_ERROR_SUBGROUP_NOT_EXIST'); | |
20 | 20 | } elseif (isset($_GET['itemid'])) { |
21 | 21 | $query='SELECT gid,sgid FROM jeans_item WHERE id=<%itemid%>'; |
22 | 22 | $array=array('itemid'=>(int)$_GET['itemid']); |
@@ -24,7 +24,7 @@ | ||
24 | 24 | if ($row) { |
25 | 25 | self::$groupid=(int)$row['gid']; |
26 | 26 | self::$subgroupid=(int)$row['sgid']; |
27 | - } else error::fatal('_JEANS_ERROR_ITEM_NOT_EXIST'); | |
27 | + } else jerror::fatal('_JEANS_ERROR_ITEM_NOT_EXIST'); | |
28 | 28 | } |
29 | 29 | if (!isset(self::$groupid)) self::$groupid=(int)_CONF_DEFAULT_GROUP; |
30 | 30 | } |
@@ -114,7 +114,7 @@ | ||
114 | 114 | } |
115 | 115 | static public final function local_file_exists($dir,$file){ |
116 | 116 | // Check null byte |
117 | - if (preg_match('/[\x00]/',$dir) || preg_match('/[\x00]/',$file)) error::quit('Null byte attack attempt for file function.'); | |
117 | + if (preg_match('/[\x00]/',$dir) || preg_match('/[\x00]/',$file)) jerror::quit('Null byte attack attempt for file function.'); | |
118 | 118 | // Support Windows |
119 | 119 | $dir=str_replace('\\','/',$dir); |
120 | 120 | $file=str_replace('\\','/',$file); |
@@ -135,7 +135,7 @@ | ||
135 | 135 | if (is_dir($fullpath) && substr($fullpath,-1)!='/') $fullpath.='/'; |
136 | 136 | if (strpos(realpath($fullpath),realpath($dir))===0) return false; |
137 | 137 | } |
138 | - error::quit('Directory traversal attempt by file: <%1%><br /> in directory: <%0%>',array($dir,$file)); | |
138 | + jerror::quit('Directory traversal attempt by file: <%1%><br /> in directory: <%0%>',array($dir,$file)); | |
139 | 139 | exit; |
140 | 140 | } |
141 | 141 | static public final function local_file_contents($dir,$file){ |
@@ -214,7 +214,7 @@ | ||
214 | 214 | } |
215 | 215 | static private function find_emulator(){ |
216 | 216 | if (!function_exists('hash')){ |
217 | - if (!class_exists('misc_hash')) error::quit('Available hash() function was not found.'); | |
217 | + if (!class_exists('misc_hash')) jerror::quit('Available hash() function was not found.'); | |
218 | 218 | } |
219 | 219 | } |
220 | 220 | static private function check_input(&$data,$stop_mode=false,$orgkey=''){ |
@@ -222,7 +222,7 @@ | ||
222 | 222 | foreach ($data as $key=>$value) { |
223 | 223 | if ($stop_mode) { |
224 | 224 | if ((string)$key!==self::utf8($key) || !preg_match(_PREG_SAFE_TEXT,$key)) { |
225 | - error::quit('Invalid input!'); | |
225 | + jerror::quit('Invalid input!'); | |
226 | 226 | } |
227 | 227 | } |
228 | 228 | if (!is_numeric($key)) $orgkey=$key; |
@@ -248,7 +248,7 @@ | ||
248 | 248 | break; |
249 | 249 | } |
250 | 250 | } elseif (preg_match(_PREG_SAFE_TEXT,$data) && (string)$data===self::utf8($data)) return; |
251 | - error::quit('Invalid input(<%key%>)!',array('key'=>$orgkey)); | |
251 | + jerror::quit('Invalid input(<%key%>)!',array('key'=>$orgkey)); | |
252 | 252 | } else { |
253 | 253 | $data=self::utf8($data); |
254 | 254 | } |
@@ -328,7 +328,7 @@ | ||
328 | 328 | date_default_timezone_set(_CONF_TIMEZONE); |
329 | 329 | // Set note from previous session |
330 | 330 | if (!empty($_COOKIE['note_text'])) { |
331 | - error::note('<%note_text%>',$_COOKIE); | |
331 | + jerror::note('<%note_text%>',$_COOKIE); | |
332 | 332 | self::set_cookie('note_text','',0); |
333 | 333 | } |
334 | 334 | // Cancel magic_quotes_gpc (this routine will be removed after shifting to PHP6) |
@@ -381,10 +381,10 @@ | ||
381 | 381 | $mode='post'; |
382 | 382 | $action=$_POST['action']; |
383 | 383 | if (!_CONF_DB_TYPE || !_CONF_DB_LOGIN || !self::class_exists('ticket')) { |
384 | - error::note('_ADMIN_ACTION_NOT_FOUND'); | |
384 | + jerror::note('_ADMIN_ACTION_NOT_FOUND'); | |
385 | 385 | return; |
386 | 386 | } elseif (!ticket::check()) { |
387 | - error::note('_ADMIN_INVALID_TICKET'); | |
387 | + jerror::note('_ADMIN_INVALID_TICKET'); | |
388 | 388 | return; |
389 | 389 | } |
390 | 390 | } elseif (isset($_GET['action'])) { |
@@ -412,7 +412,7 @@ | ||
412 | 412 | } |
413 | 413 | // post_action event or registration of error |
414 | 414 | if (is_string($err) && strlen($err)) { |
415 | - error::note($err); | |
415 | + jerror::note($err); | |
416 | 416 | } else { |
417 | 417 | if ($mode=='post') self::event('post_action',array('action'=>$action,'class'=>$class,'method'=>$method)); |
418 | 418 | } |
@@ -421,12 +421,12 @@ | ||
421 | 421 | static $method_exists=false; |
422 | 422 | if ($check_mode) return $method_exists=(bool)$class; |
423 | 423 | $class=strtolower($class); |
424 | - if (!preg_match('/^[a-zA-Z0-9_]+$/',$class)) error::quit('Class name error: <%0%>',$class); | |
424 | + if (!preg_match('/^[a-zA-Z0-9_]+$/',$class)) jerror::quit('Class name error: <%0%>',$class); | |
425 | 425 | // Include PHP file |
426 | 426 | $array=self::class_file($class); |
427 | 427 | if (!$array) { |
428 | 428 | if ($method_exists) return $method_exists=false; |
429 | - else error::quit('Class file does not exist or is disabled: <%0%>',$class); | |
429 | + else jerror::quit('Class file does not exist or is disabled: <%0%>',$class); | |
430 | 430 | } else $method_exists=false; |
431 | 431 | list($dir,$file,$is_plugin)=$array; |
432 | 432 | if ($is_plugin && !$file) return false; |
@@ -499,7 +499,7 @@ | ||
499 | 499 | } |
500 | 500 | static public function error_exists(){ |
501 | 501 | if (!class_exists('error',false)) return false; |
502 | - return count(error::get_note()); | |
502 | + return count(jerror::get_note()); | |
503 | 503 | } |
504 | 504 | /** |
505 | 505 | * Following method will be called when shutting down. |
@@ -533,7 +533,7 @@ | ||
533 | 533 | static public function redirect($url){ |
534 | 534 | if (!self::is_valid_url($url)) { |
535 | 535 | if (!preg_match('/^[a-zA-Z0-9\-\.]*\??[a-zA-Z0-9\-\.=&]*/',$url)) { |
536 | - error::quit('Invalied URL: <%0%>',$url); | |
536 | + jerror::quit('Invalied URL: <%0%>',$url); | |
537 | 537 | } |
538 | 538 | } |
539 | 539 | header('Location: ' . $url); |
@@ -541,7 +541,7 @@ | ||
541 | 541 | } |
542 | 542 | static public function redirect_local($url){ |
543 | 543 | if (preg_match('#^[^/\?]*//([^/]+)/#',$url,$m)) { |
544 | - if ($m[1]!=$_SERVER['HTTP_HOST']) error::quit('Invalied local URL: <%0%>',$url); | |
544 | + if ($m[1]!=$_SERVER['HTTP_HOST']) jerror::quit('Invalied local URL: <%0%>',$url); | |
545 | 545 | } |
546 | 546 | self::redirect($url); |
547 | 547 | } |
@@ -623,7 +623,7 @@ | ||
623 | 623 | try { |
624 | 624 | $pdo=new PDO($dsn,$user,$passwd); |
625 | 625 | } catch (PDOException $e) { |
626 | - //error::quit('DB-connection falied.'); | |
626 | + //jerror::quit('DB-connection falied.'); | |
627 | 627 | $pdo=new dummy_pdo; |
628 | 628 | } |
629 | 629 | // register user functions |
@@ -754,7 +754,7 @@ | ||
754 | 754 | if (!is_object($obj)) { |
755 | 755 | $e=self::$pdo->errorInfo(); |
756 | 756 | $e['query']=$query; |
757 | - if (error_reporting() & E_WARNING) error::show('<%query%><br /><%2%> (<%0%> <%1%>)<br />',$e); | |
757 | + if (error_reporting() & E_WARNING) jerror::show('<%query%><br /><%2%> (<%0%> <%1%>)<br />',$e); | |
758 | 758 | } else { |
759 | 759 | $obj->setFetchMode($mode); |
760 | 760 | $obj->execute($data); |
@@ -0,0 +1,98 @@ | ||
1 | +<?php | |
2 | +/* | |
3 | + * Jeans CMS (GPL license) | |
4 | + * $Id$ | |
5 | + */ | |
6 | + | |
7 | + | |
8 | +class jerror extends jeans { | |
9 | + static private function debug_mode(){ | |
10 | + if (!defined('_CONF_DEBUG_MODE')) return false; | |
11 | + if ($_SERVER['REMOTE_ADDR']=='127.0.0.1') return true; | |
12 | + if (_CONF_DEBUG_MODE==='admin') return member::is_admin(); | |
13 | + return true; | |
14 | + } | |
15 | + static public function quit($text,$data=array()){ | |
16 | + self::show($text,$data,'quit'); | |
17 | + exit; | |
18 | + } | |
19 | + static public function show($text,$data=array(),$log='show'){ | |
20 | + if (preg_match('/^_([A-Z][A-Z0-9]*)_([A-Z0-9]*)(?:_[A-Z0-9]*)*$/',$text,$m)) $text=self::translate($text); | |
21 | + // Leave log | |
22 | + $row=sql::query("SELECT count(*) as result FROM sqlite_master WHERE name='jeans_log'")->fetch(); | |
23 | + if ($row['result']==1) core::log(self::fill_html($text,$data),__CLASS__,$log); | |
24 | + // Redirect, if possible | |
25 | + if (!self::debug_mode()) { | |
26 | + if (error_reporting() & E_WARNING) { | |
27 | + $text=self::fill_html($text,$data); | |
28 | + if (headers_sent() || isset($_GET['error'])) { | |
29 | + self::echo_html('<!--\'"--><%0%>',$text); | |
30 | + } else { | |
31 | + core::set_cookie('note_text',$text); | |
32 | + core::redirect_local('?error'); | |
33 | + } | |
34 | + } | |
35 | + return; | |
36 | + } | |
37 | + if (!is_array($data)) $data=array($data); | |
38 | + self::echo_html('<!--\'"-->'.$text,$data); | |
39 | + $db=debug_backtrace(); | |
40 | + self::echo_html('<!--'); | |
41 | + ob_start(); | |
42 | + print_r($db); | |
43 | + self::p(ob_get_clean()); | |
44 | + self::echo_html('-->'); | |
45 | + for ($i=0;$i<count($db);$i++) { | |
46 | + if ($db[$i]['class']=='error') continue; | |
47 | + $db=$db[$i-1]; | |
48 | + break; | |
49 | + } | |
50 | + $db['file']=@preg_replace('/^.*[\/\\\\]([a-z0-9_]+\.php)$/i','$1',$db['file']); | |
51 | + self::echo_html("<br />\r\nError occured at line <%line%> in <%file%>",$db); | |
52 | + } | |
53 | + static private $note=array(); | |
54 | + static public function note($text,$data=false){ | |
55 | + if ($data===false) { | |
56 | + self::$note[]=self::quote_html($text); | |
57 | + } else { | |
58 | + if (preg_match('/^_([A-Z][A-Z0-9]*)_([A-Z0-9]*)(?:_[A-Z0-9]*)*$/',$text)) $text=self::translate($text); | |
59 | + self::$note[]=self::fill_html($text,$data); | |
60 | + } | |
61 | + } | |
62 | + static public function fatal($text=false,$data=false){ | |
63 | + static $fatal=false; | |
64 | + if ($text===false) return $fatal; | |
65 | + $fatal=true; | |
66 | + self::note($text,$data); | |
67 | + } | |
68 | + static public function get_note(){ | |
69 | + foreach (self::$note as $key=>$error) { | |
70 | + if (preg_match('/^_([A-Z][A-Z0-9]*)_([A-Z0-9]*)(?:_[A-Z0-9]*)*$/',$error)) self::$note[$key]=self::translate($error); | |
71 | + } | |
72 | + return self::$note; | |
73 | + } | |
74 | + static public function tag_note(&$data,$skin){ | |
75 | + $array=array(); | |
76 | + foreach (self::get_note() as $error) { | |
77 | + $array[]=array('error'=>$error); | |
78 | + } | |
79 | + view::show_using_array($data,$array,$skin); | |
80 | + } | |
81 | + // From view.php | |
82 | + static public function compile_error($source,$compiled){ | |
83 | + if (self::debug_mode()) { | |
84 | + $array=array(&$source,&$compiled); | |
85 | + foreach($array as &$temp) { | |
86 | + $temp=preg_split('/(\r\n|\r|\n)/',$temp); | |
87 | + foreach($temp as $key=>$line) $temp[$key]=substr(' '.($key+1).':',-4).$line; | |
88 | + $temp=implode("\n",$temp); | |
89 | + } | |
90 | + self::echo_html('<hr /><pre><%0%><hr /><%1%></pre><hr />',array($source,$compiled),'hsc'); | |
91 | + } | |
92 | + return create_function('','return false;'); | |
93 | + } | |
94 | + // From core.php | |
95 | + static public function set_error($mode,$error,$array=array()){ | |
96 | + | |
97 | + } | |
98 | +} | |
\ No newline at end of file |
@@ -67,13 +67,13 @@ | ||
67 | 67 | // Check authority |
68 | 68 | if ($row && !($row['authority']&self::MEMBER_CAN_LOGIN)) { |
69 | 69 | $row=false; |
70 | - error::note('_JEANS_LOGIN_NOT_ALLOWED'); | |
70 | + jerror::note('_JEANS_LOGIN_NOT_ALLOWED'); | |
71 | 71 | } |
72 | 72 | // Check multiple failure (blute fource attack?) |
73 | 73 | $ip16=preg_replace('/\.[0-9]+\.[0-9]+$/','',$_SERVER['REMOTE_ADDR']); |
74 | 74 | $stop=self::anti_blute_fource($name,$ip16); |
75 | 75 | if ($stop) { |
76 | - error::note('Account is invalid for <%0%> seconds.',$stop); | |
76 | + jerror::note('Account is invalid for <%0%> seconds.',$stop); | |
77 | 77 | $row=false; |
78 | 78 | } |
79 | 79 |
@@ -89,7 +89,7 @@ | ||
89 | 89 | } else { |
90 | 90 | // fail |
91 | 91 | self::setting(array('id'=>0)); |
92 | - error::note('_JEANS_LOGIN_FAILED'); | |
92 | + jerror::note('_JEANS_LOGIN_FAILED'); | |
93 | 93 | if (isset($_POST['login'])) { |
94 | 94 | core::event('login_failed',array('user'=>$_POST['login'])); |
95 | 95 | $text=self::fill_html('Login Failed <%0%>',$ip16); |
@@ -43,7 +43,7 @@ | ||
43 | 43 | foreach ($hosts as $host) { |
44 | 44 | if ($host && preg_match("#^(http|https)://$host/#",$referer)) return; |
45 | 45 | } |
46 | - error::quit(self::translate('_ADMIN_INVALID_REFERER_FOR_POST')); | |
46 | + jerror::quit(self::translate('_ADMIN_INVALID_REFERER_FOR_POST')); | |
47 | 47 | } |
48 | 48 | static private $tickets=array(); |
49 | 49 | static public function buy_ticket($action=''){ |
@@ -115,7 +115,7 @@ | ||
115 | 115 | if (!isset($cache[$skin])) { |
116 | 116 | // Determine the file name (note that skin may be inherited) |
117 | 117 | $filename=self::find_skin_file($skin); |
118 | - if (!$filename) error::quit('Skin file not found: <%0%>',$skin); | |
118 | + if (!$filename) jerror::quit('Skin file not found: <%0%>',$skin); | |
119 | 119 | $file=self::local_file_contents(_DIR_SKINS,$filename); |
120 | 120 | if ($file===false && preg_match('#^/jp/([a-zA-Z0-9_]+)/(.*)$#',$skin,$m)) { |
121 | 121 | $file=self::local_file_contents(_DIR_PLUGINS,"$m[1]/$m[2]"); |
@@ -141,7 +141,7 @@ | ||
141 | 141 | if (!$lambda) return $compiled; |
142 | 142 | // Create lambda |
143 | 143 | $code=create_function('&$data','?>'.$compiled.'<?php return true;'); |
144 | - if (!is_callable($code)) return error::compile_error($source,$compiled); | |
144 | + if (!is_callable($code)) return jerror::compile_error($source,$compiled); | |
145 | 145 | return $code; |
146 | 146 | } |
147 | 147 | static private $compile_using=array(); |
@@ -171,7 +171,7 @@ | ||
171 | 171 | // If-tags. |
172 | 172 | $tag=isset($if[2]) ? $if[2]:''; |
173 | 173 | $method=self::compile_cb_method($tag,'if_'); |
174 | - if ($method===false) error::quit('If-tag not found: <%0%>',$tag); | |
174 | + if ($method===false) jerror::quit('If-tag not found: <%0%>',$tag); | |
175 | 175 | switch($if[1]){ |
176 | 176 | case 'ifnot': |
177 | 177 | return "<?php $cr if (!( $method($args) )) { ?>"; |
@@ -260,8 +260,9 @@ | ||
260 | 260 | $class=$m[0]; |
261 | 261 | $method=$prefix.$m[0]; |
262 | 262 | } |
263 | - } else error::quit('Syntax error: <%0%>',$text); | |
263 | + } else jerror::quit('Syntax error: <%0%>',$text); | |
264 | 264 | if (core::method_exists($class,$method)) return "$class::$method"; |
265 | + elseif (core::method_exists("j$class",$method)) return "j$class::$method"; // Support jerror class (etc) | |
265 | 266 | else return false; |
266 | 267 | } |
267 | 268 | /* |
@@ -10,7 +10,7 @@ | ||
10 | 10 | static private $real_dir_path='', $real_file_path=''; |
11 | 11 | static public function init(){ |
12 | 12 | // Only superadmin can use this class |
13 | - if (!member::is_admin()) error::quit('_ADMIN_NO_PERMISSION'); | |
13 | + if (!member::is_admin()) jerror::quit('_ADMIN_NO_PERMISSION'); | |
14 | 14 | // Get the path and resolve skin extension |
15 | 15 | // Note that the dir_path must end with '/' except for root path. |
16 | 16 | if (isset($_GET['dir_path'])) self::$dir_path=$_GET['dir_path']; |
@@ -42,11 +42,11 @@ | ||
42 | 42 | self::$real_dir_path=self::to_realpath(self::$dir_path); |
43 | 43 | self::$real_file_path=self::to_realpath(self::$file_path); |
44 | 44 | if (self::$real_dir_path===false) { |
45 | - error::note('_JP_SKINFILES_DIR_NOT_FOUND',self::$dir_path); | |
45 | + jerror::note('_JP_SKINFILES_DIR_NOT_FOUND',self::$dir_path); | |
46 | 46 | self::$real_dir_path=self::$dir_path=''; |
47 | 47 | self::$real_file_path=self::$file_path=self::$file=''; |
48 | 48 | } elseif (self::$real_file_path===false) { |
49 | - error::note('_JP_SKINFILES_FILE_NOT_FOUND',self::$file_path); | |
49 | + jerror::note('_JP_SKINFILES_FILE_NOT_FOUND',self::$file_path); | |
50 | 50 | self::$real_dir_path=self::$dir_path=''; |
51 | 51 | self::$real_file_path=self::$file_path=self::$file=''; |
52 | 52 | } |
@@ -278,14 +278,14 @@ | ||
278 | 278 | static public function action_get_thumbnail(){ |
279 | 279 | // Check the local file. |
280 | 280 | $full_path=self::local_file_exists(_DIR_SKINS,self::$real_file_path); |
281 | - if (!$full_path) error::quit('File not found'); | |
281 | + if (!$full_path) jerror::quit('File not found'); | |
282 | 282 | $time=filemtime(_DIR_SKINS.self::$real_file_path); |
283 | 283 | // Check if modified (the browser would store a cache). |
284 | 284 | media::check_if_changed($time); |
285 | 285 | // Check if the file is an image. |
286 | - if (!preg_match('/\.([^\.]+)$/',self::$file,$m)) error::quit('Not an image.'); | |
286 | + if (!preg_match('/\.([^\.]+)$/',self::$file,$m)) jerror::quit('Not an image.'); | |
287 | 287 | $mime=tables::mime($m[1]); |
288 | - if (substr($mime,0,6)!='image/') error::quit('Not an image.'); | |
288 | + if (substr($mime,0,6)!='image/') jerror::quit('Not an image.'); | |
289 | 289 | // Get the image info |
290 | 290 | list($width,$height,$new_width,$new_height)=self::image_size(self::$real_file_path); |
291 | 291 | // Return the image to browser (use tumbnail if possible. |
@@ -299,9 +299,9 @@ | ||
299 | 299 | static public function tag_thumbnail(&$data){ |
300 | 300 | $file=$data['name']; |
301 | 301 | // Check if the file is an image. |
302 | - if (!preg_match('/\.([^\.]+)$/',$file,$m)) error::quit('Not an image.'); | |
302 | + if (!preg_match('/\.([^\.]+)$/',$file,$m)) jerror::quit('Not an image.'); | |
303 | 303 | $mime=tables::mime($m[1]); |
304 | - if (substr($mime,0,6)!='image/') error::quit('Not an image.'); | |
304 | + if (substr($mime,0,6)!='image/') jerror::quit('Not an image.'); | |
305 | 305 | // Get the image info |
306 | 306 | list($width,$height,$new_width,$new_height)=self::image_size(self::to_realpath(self::$real_dir_path.$file)); |
307 | 307 | // Show the img tag |
@@ -346,33 +346,33 @@ | ||
346 | 346 | static public function action_post_newdir(){ |
347 | 347 | if (empty($_POST['newdir'])) return; |
348 | 348 | if (self::local_file_exists(_DIR_SKINS,self::$real_dir_path.$_POST['newdir'])) { |
349 | - error::note('_JP_SKINFILES_DIR_ALREADY_EXISTS'); | |
349 | + jerror::note('_JP_SKINFILES_DIR_ALREADY_EXISTS'); | |
350 | 350 | return; |
351 | 351 | } |
352 | 352 | $perms=fileperms(_DIR_SKINS.self::$real_dir_path); |
353 | 353 | if (@mkdir(_DIR_SKINS.self::$real_dir_path.$_POST['newdir'],$perms)) { |
354 | - error::note('_JP_SKINFILES_NEW_DIR_WAS_CREATED'); | |
354 | + jerror::note('_JP_SKINFILES_NEW_DIR_WAS_CREATED'); | |
355 | 355 | } else { |
356 | - error::note('_JP_SKINFILES_CREATING_NEW_DIR_FAILED'); | |
356 | + jerror::note('_JP_SKINFILES_CREATING_NEW_DIR_FAILED'); | |
357 | 357 | } |
358 | 358 | } |
359 | 359 | static public function action_post_newfile(){ |
360 | 360 | if (empty($_POST['newfile'])) return; |
361 | 361 | if (self::local_file_exists(_DIR_SKINS,self::$real_dir_path.$_POST['newfile'])) { |
362 | - error::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
362 | + jerror::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
363 | 363 | return; |
364 | 364 | } |
365 | 365 | $res=@fopen(_DIR_SKINS.self::$real_dir_path.$_POST['newfile'],'x'); |
366 | 366 | if ($res) { |
367 | 367 | fclose($res); |
368 | - error::note('_JP_SKINFILES_NEW_FILE_WAS_CREATED'); | |
368 | + jerror::note('_JP_SKINFILES_NEW_FILE_WAS_CREATED'); | |
369 | 369 | } else { |
370 | - error::note('_JP_SKINFILES_CREATING_NEW_FILE_FAILED'); | |
370 | + jerror::note('_JP_SKINFILES_CREATING_NEW_FILE_FAILED'); | |
371 | 371 | } |
372 | 372 | } |
373 | 373 | static public function action_post_upload(){ |
374 | 374 | // Get information of uploaded file |
375 | - if (!isset($_FILES['binfile'])) return error::note('_ADMIN_MEDIA_FILE_NOT_FOUND'); | |
375 | + if (!isset($_FILES['binfile'])) return jerror::note('_ADMIN_MEDIA_FILE_NOT_FOUND'); | |
376 | 376 | $file=&$_FILES['binfile']; |
377 | 377 | switch ($file['error']) { |
378 | 378 | case UPLOAD_ERR_OK: |
@@ -379,26 +379,26 @@ | ||
379 | 379 | break; |
380 | 380 | case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: |
381 | 381 | @unlink($file['tmp_name']); |
382 | - return error::note('_ADMIN_MEDIA_FILE_TOO_LARGE'); | |
382 | + return jerror::note('_ADMIN_MEDIA_FILE_TOO_LARGE'); | |
383 | 383 | default: |
384 | 384 | @unlink($file['tmp_name']); |
385 | - return error::note('_ADMIN_MEDIA_UNKNOWN_ERROR'); | |
385 | + return jerror::note('_ADMIN_MEDIA_UNKNOWN_ERROR'); | |
386 | 386 | } |
387 | 387 | // Check if upload is accepted to this file. |
388 | 388 | $size=filesize($file['tmp_name']); |
389 | 389 | if (_CONF_MAX_UPLOAD_SIZE < $size) { |
390 | 390 | @unlink($file['tmp_name']); |
391 | - return error::note(self::translate('_ADMIN_MEDIA_FILE_TOO_LARGE').'(max: '._CONF_MAX_UPLOAD_SIZE.')'); | |
391 | + return jerror::note(self::translate('_ADMIN_MEDIA_FILE_TOO_LARGE').'(max: '._CONF_MAX_UPLOAD_SIZE.')'); | |
392 | 392 | } |
393 | 393 | if (!preg_match('/^(.+\.)([a-zA-Z0-9]+)$/',trim($file['name']),$m)) { |
394 | 394 | @unlink($file['tmp_name']); |
395 | - return error::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
395 | + return jerror::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
396 | 396 | } |
397 | 397 | $m[2]=strtolower($m[2]); |
398 | 398 | $m[1]=self::utf8($m[1]); |
399 | 399 | if (strlen($m[1])==0) { |
400 | 400 | @unlink($file['tmp_name']); |
401 | - return error::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
401 | + return jerror::note('_ADMIN_MEDIA_INVALID_FILENAME'); | |
402 | 402 | } |
403 | 403 | $filename=$m[1].$m[2]; |
404 | 404 | if (self::if_mediadir() && jp_skinfiles::option()->date_prefix) { |
@@ -406,15 +406,15 @@ | ||
406 | 406 | } |
407 | 407 | // Check if destination is OK |
408 | 408 | if (self::local_file_exists(_DIR_SKINS,self::$real_dir_path.$filename)) { |
409 | - error::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
409 | + jerror::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
410 | 410 | return; |
411 | 411 | } |
412 | 412 | // Everything is file. Let's move file to skins/ directory |
413 | 413 | if (@move_uploaded_file ($file['tmp_name'],_DIR_SKINS.self::$real_dir_path.$filename)) { |
414 | - error::note('_JP_SKINFILES_FILE_IS_UPLOADED'); | |
414 | + jerror::note('_JP_SKINFILES_FILE_IS_UPLOADED'); | |
415 | 415 | } else { |
416 | 416 | @unlink($file['tmp_name']); |
417 | - error::note('_JP_SKINFILES_FILE_UPLOAD_WAS_FALIED'); | |
417 | + jerror::note('_JP_SKINFILES_FILE_UPLOAD_WAS_FALIED'); | |
418 | 418 | } |
419 | 419 | } |
420 | 420 | static public function action_get_mediamanager(){ |
@@ -431,8 +431,8 @@ | ||
431 | 431 | static public function action_post_rename(){ |
432 | 432 | $new_path=dirname(self::$real_file_path).'/'.$_POST['new_path']; |
433 | 433 | if (self::local_file_exists(_DIR_SKINS,$new_path)) { |
434 | - if (is_dir(_DIR_SKINS.$new_path)) error::note('_JP_SKINFILES_DIR_ALREADY_EXISTS'); | |
435 | - else error::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
434 | + if (is_dir(_DIR_SKINS.$new_path)) jerror::note('_JP_SKINFILES_DIR_ALREADY_EXISTS'); | |
435 | + else jerror::note('_JP_SKINFILES_FILE_ALREADY_EXISTS'); | |
436 | 436 | return; |
437 | 437 | } |
438 | 438 | if (@rename(_DIR_SKINS.self::$real_file_path,_DIR_SKINS.$new_path)) { |
@@ -439,12 +439,12 @@ | ||
439 | 439 | core::set_cookie('note_text','_JP_SKINFILES_RENAMED',0); |
440 | 440 | core::redirect_local('?padmin=jp_skinfiles&dir_path='.self::$dir_path.self::more_params()); |
441 | 441 | } else { |
442 | - error::note('_JP_SKINFILES_RENAME_WAS_FAILED'); | |
442 | + jerror::note('_JP_SKINFILES_RENAME_WAS_FAILED'); | |
443 | 443 | } |
444 | 444 | } |
445 | 445 | static public function action_post_delete(){ |
446 | 446 | if (!self::local_file_exists(_DIR_SKINS,self::$real_file_path)) { |
447 | - error::note('_JP_SKINFILES_FILE_NOT_FOUND'); | |
447 | + jerror::note('_JP_SKINFILES_FILE_NOT_FOUND'); | |
448 | 448 | return; |
449 | 449 | } |
450 | 450 | $path=_DIR_SKINS.self::$real_file_path; |
@@ -452,13 +452,13 @@ | ||
452 | 452 | core::set_cookie('note_text','_JP_SKINFILES_DELETED',0); |
453 | 453 | core::redirect_local('?padmin=jp_skinfiles&dir_path='.self::$dir_path.self::more_params()); |
454 | 454 | } else { |
455 | - error::note('_JP_SKINFILES_DELETION_WAS_FAILED'); | |
456 | - if (is_dir($path)) error::note('_JP_SKINFILES_CONFIRM_IF_EMPTY'); | |
455 | + jerror::note('_JP_SKINFILES_DELETION_WAS_FAILED'); | |
456 | + if (is_dir($path)) jerror::note('_JP_SKINFILES_CONFIRM_IF_EMPTY'); | |
457 | 457 | } |
458 | 458 | } |
459 | 459 | static public function action_post_edit(){ |
460 | 460 | if (!self::local_file_exists(_DIR_SKINS,self::$real_file_path)) { |
461 | - error::note('_JP_SKINFILES_FILE_NOT_FOUND'); | |
461 | + jerror::note('_JP_SKINFILES_FILE_NOT_FOUND'); | |
462 | 462 | return; |
463 | 463 | } |
464 | 464 | if (file_put_contents(_DIR_SKINS.self::$real_file_path,$_POST['save_text'])) { |
@@ -465,7 +465,7 @@ | ||
465 | 465 | core::set_cookie('note_text','_JP_SKINFILES_SAVED',0); |
466 | 466 | core::redirect_local('?padmin=jp_skinfiles&dir_path='.self::$dir_path); |
467 | 467 | } else { |
468 | - error::note('_JP_SKINFILES_SAVING_WAS_FAILED'); | |
468 | + jerror::note('_JP_SKINFILES_SAVING_WAS_FAILED'); | |
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
\ No newline at end of file |