Changeset 2566:9bf417837888 for admin/comment.php
- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/comment.php
r2256 r2566 36 36 { 37 37 $rs = $core->blog->getPosts(array('post_id' => $_POST['post_id'], 'post_type' => '')); 38 38 39 39 if ($rs->isEmpty()) { 40 40 throw new Exception(__('Entry does not exist.')); 41 41 } 42 42 43 43 $cur = $core->con->openCursor($core->prefix.'comment'); 44 44 45 45 $cur->comment_author = $_POST['comment_author']; 46 46 $cur->comment_email = html::clean($_POST['comment_email']); … … 48 48 $cur->comment_content = $core->HTMLfilter($_POST['comment_content']); 49 49 $cur->post_id = (integer) $_POST['post_id']; 50 50 51 51 # --BEHAVIOR-- adminBeforeCommentCreate 52 52 $core->callBehavior('adminBeforeCommentCreate',$cur); 53 53 54 54 $comment_id = $core->blog->addComment($cur); 55 55 56 56 # --BEHAVIOR-- adminAfterCommentCreate 57 57 $core->callBehavior('adminAfterCommentCreate',$cur,$comment_id); 58 58 59 59 dcPage::addSuccessNotice(__('Comment has been successfully created.')); 60 60 http::redirect($core->getPostAdminURL($rs->post_type,$rs->post_id,false).'&co=1'); … … 67 67 { 68 68 $params['comment_id'] = $_REQUEST['id']; 69 69 70 70 try { 71 71 $rs = $core->blog->getComments($params); … … 97 97 { 98 98 $can_edit = $can_delete = $can_publish = $core->auth->check('contentadmin',$core->blog->id); 99 99 100 100 if (!$core->auth->check('contentadmin',$core->blog->id) && $core->auth->userID() == $rs->user_id) { 101 101 $can_edit = true; … … 107 107 } 108 108 } 109 109 110 110 # update comment 111 111 if (!empty($_POST['update']) && $can_edit) 112 112 { 113 113 $cur = $core->con->openCursor($core->prefix.'comment'); 114 114 115 115 $cur->comment_author = $_POST['comment_author']; 116 116 $cur->comment_email = html::clean($_POST['comment_email']); 117 117 $cur->comment_site = html::clean($_POST['comment_site']); 118 118 $cur->comment_content = $core->HTMLfilter($_POST['comment_content']); 119 119 120 120 if (isset($_POST['comment_status'])) { 121 121 $cur->comment_status = (integer) $_POST['comment_status']; 122 122 } 123 123 124 124 try 125 125 { 126 126 # --BEHAVIOR-- adminBeforeCommentUpdate 127 127 $core->callBehavior('adminBeforeCommentUpdate',$cur,$comment_id); 128 128 129 129 $core->blog->updComment($comment_id,$cur); 130 130 131 131 # --BEHAVIOR-- adminAfterCommentUpdate 132 132 $core->callBehavior('adminAfterCommentUpdate',$cur,$comment_id); 133 133 134 134 dcPage::addSuccessNotice(__('Comment has been successfully updated.')); 135 135 http::redirect('comment.php?id='.$comment_id); … … 140 140 } 141 141 } 142 142 143 143 if (!empty($_POST['delete']) && $can_delete) 144 144 { … … 146 146 # --BEHAVIOR-- adminBeforeCommentDelete 147 147 $core->callBehavior('adminBeforeCommentDelete',$comment_id); 148 148 149 149 $core->blog->delComment($comment_id); 150 150 151 151 dcPage::addSuccessNotice(__('Comment has been successfully deleted.')); 152 152 http::redirect($core->getPostAdminURL($rs->post_type,$rs->post_id).'&co=1',false); … … 155 155 } 156 156 } 157 157 158 158 if (!$can_edit) { 159 159 $core->error->add(__("You can't edit this comment.")); … … 193 193 dcPage::success(__('Comment has been successfully updated.')); 194 194 } 195 195 196 196 $comment_mailto = ''; 197 197 if ($comment_email) … … 210 210 '<p>'.__('IP address:').' '. 211 211 '<a href="comments.php?ip='.$comment_ip.'">'.$comment_ip.'</a></p>'. 212 212 213 213 '<p>'.__('Date:').' '. 214 214 dt::dt2str(__('%Y-%m-%d %H:%M'),$comment_dt).'</p>'. 215 215 '</div>'. 216 216 217 '<h3>'.__('Comment submitted').'</h3>'. 217 '<h3>'.__('Comment submitted').'</h3>'. 218 218 '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr>'.__('Author:').'</label>'. 219 219 form::field('comment_author',30,255,html::escapeHTML($comment_author)). 220 220 '</p>'. 221 221 222 222 '<p><label for="comment_email">'.__('Email:').'</label>'. 223 223 form::field('comment_email',30,255,html::escapeHTML($comment_email)). 224 224 '<span>'.$comment_mailto.'</span>'. 225 225 '</p>'. 226 226 227 227 '<p><label for="comment_site">'.__('Web site:').'</label>'. 228 228 form::field('comment_site',30,255,html::escapeHTML($comment_site)). 229 229 '</p>'. 230 230 231 231 '<p><label for="comment_status">'.__('Status:').'</label>'. 232 232 form::combo('comment_status',$status_combo,$comment_status,'','',!$can_publish). 233 233 '</p>'. 234 234 235 235 # --BEHAVIOR-- adminAfterCommentDesc 236 236 $core->callBehavior('adminAfterCommentDesc', $rs). 237 237 238 238 '<p class="area"><label for="comment_content">'.__('Comment:').'</label> '. 239 239 form::textarea('comment_content',50,10,html::escapeHTML($comment_content)). 240 240 '</p>'. 241 241 242 242 '<p>'.form::hidden('id',$comment_id). 243 243 $core->formNonce(). 244 244 '<input type="submit" accesskey="s" name="update" value="'.__('Save').'" /> '; 245 245 246 246 if ($can_delete) { 247 247 echo '<input type="submit" class="delete" name="delete" value="'.__('Delete').'" />'; … … 254 254 dcPage::helpBlock('core_comments'); 255 255 dcPage::close(); 256 ?>
Note: See TracChangeset
for help on using the changeset viewer.