[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | |
---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
| 14 | |
---|
| 15 | dcPage::check('usage,contentadmin'); |
---|
| 16 | |
---|
| 17 | $post_id = ''; |
---|
| 18 | $cat_id = ''; |
---|
| 19 | $post_dt = ''; |
---|
| 20 | $post_format = $core->auth->getOption('post_format'); |
---|
| 21 | $post_password = ''; |
---|
| 22 | $post_url = ''; |
---|
| 23 | $post_lang = $core->auth->getInfo('user_lang'); |
---|
| 24 | $post_title = ''; |
---|
| 25 | $post_excerpt = ''; |
---|
| 26 | $post_excerpt_xhtml = ''; |
---|
| 27 | $post_content = ''; |
---|
| 28 | $post_content_xhtml = ''; |
---|
| 29 | $post_notes = ''; |
---|
| 30 | $post_status = $core->auth->getInfo('user_post_status'); |
---|
| 31 | $post_selected = false; |
---|
| 32 | $post_open_comment = $core->blog->settings->system->allow_comments; |
---|
| 33 | $post_open_tb = $core->blog->settings->system->allow_trackbacks; |
---|
| 34 | |
---|
[195] | 35 | $page_title = __('New entry'); |
---|
[0] | 36 | |
---|
| 37 | $can_view_page = true; |
---|
| 38 | $can_edit_post = $core->auth->check('usage,contentadmin',$core->blog->id); |
---|
| 39 | $can_publish = $core->auth->check('publish,contentadmin',$core->blog->id); |
---|
| 40 | $can_delete = false; |
---|
| 41 | |
---|
| 42 | $post_headlink = '<link rel="%s" title="%s" href="post.php?id=%s" />'; |
---|
| 43 | $post_link = '<a href="post.php?id=%s" title="%s">%s</a>'; |
---|
| 44 | |
---|
| 45 | $next_link = $prev_link = $next_headlink = $prev_headlink = null; |
---|
| 46 | |
---|
| 47 | # If user can't publish |
---|
| 48 | if (!$can_publish) { |
---|
| 49 | $post_status = -2; |
---|
| 50 | } |
---|
| 51 | |
---|
[1288] | 52 | # Getting categories |
---|
[1719] | 53 | $categories_combo = dcAdminCombos::getCategoriesCombo( |
---|
| 54 | $core->blog->getCategories(array('post_type'=>'post')) |
---|
| 55 | ); |
---|
[1288] | 56 | |
---|
[1719] | 57 | $status_combo = dcAdminCombos::getPostStatusesCombo(); |
---|
| 58 | |
---|
[933] | 59 | $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
[0] | 60 | |
---|
| 61 | # Formaters combo |
---|
[1719] | 62 | $formaters_combo = dcAdminCombos::getFormatersCombo(); |
---|
[0] | 63 | |
---|
| 64 | # Languages combo |
---|
| 65 | $rs = $core->blog->getLangs(array('order'=>'asc')); |
---|
[1719] | 66 | $lang_combo = dcAdminCombos::getLangsCombo($rs,true); |
---|
[0] | 67 | |
---|
[957] | 68 | # Validation flag |
---|
| 69 | $bad_dt = false; |
---|
[0] | 70 | |
---|
[1783] | 71 | # Trackbacks |
---|
| 72 | $TB = new dcTrackback($core); |
---|
| 73 | $tb_urls = $tb_excerpt = ''; |
---|
| 74 | |
---|
[0] | 75 | # Get entry informations |
---|
| 76 | if (!empty($_REQUEST['id'])) |
---|
| 77 | { |
---|
[1460] | 78 | $page_title = __('Edit entry'); |
---|
| 79 | |
---|
[0] | 80 | $params['post_id'] = $_REQUEST['id']; |
---|
| 81 | |
---|
| 82 | $post = $core->blog->getPosts($params); |
---|
| 83 | |
---|
| 84 | if ($post->isEmpty()) |
---|
| 85 | { |
---|
| 86 | $core->error->add(__('This entry does not exist.')); |
---|
| 87 | $can_view_page = false; |
---|
| 88 | } |
---|
| 89 | else |
---|
| 90 | { |
---|
| 91 | $post_id = $post->post_id; |
---|
| 92 | $cat_id = $post->cat_id; |
---|
| 93 | $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); |
---|
| 94 | $post_format = $post->post_format; |
---|
| 95 | $post_password = $post->post_password; |
---|
| 96 | $post_url = $post->post_url; |
---|
| 97 | $post_lang = $post->post_lang; |
---|
| 98 | $post_title = $post->post_title; |
---|
| 99 | $post_excerpt = $post->post_excerpt; |
---|
| 100 | $post_excerpt_xhtml = $post->post_excerpt_xhtml; |
---|
| 101 | $post_content = $post->post_content; |
---|
| 102 | $post_content_xhtml = $post->post_content_xhtml; |
---|
| 103 | $post_notes = $post->post_notes; |
---|
| 104 | $post_status = $post->post_status; |
---|
| 105 | $post_selected = (boolean) $post->post_selected; |
---|
| 106 | $post_open_comment = (boolean) $post->post_open_comment; |
---|
| 107 | $post_open_tb = (boolean) $post->post_open_tb; |
---|
| 108 | |
---|
| 109 | $can_edit_post = $post->isEditable(); |
---|
| 110 | $can_delete= $post->isDeletable(); |
---|
| 111 | |
---|
| 112 | $next_rs = $core->blog->getNextPost($post,1); |
---|
| 113 | $prev_rs = $core->blog->getNextPost($post,-1); |
---|
| 114 | |
---|
| 115 | if ($next_rs !== null) { |
---|
| 116 | $next_link = sprintf($post_link,$next_rs->post_id, |
---|
[1353] | 117 | html::escapeHTML($next_rs->post_title),__('Next entry').' »'); |
---|
[0] | 118 | $next_headlink = sprintf($post_headlink,'next', |
---|
| 119 | html::escapeHTML($next_rs->post_title),$next_rs->post_id); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | if ($prev_rs !== null) { |
---|
| 123 | $prev_link = sprintf($post_link,$prev_rs->post_id, |
---|
[1353] | 124 | html::escapeHTML($prev_rs->post_title),'« '.__('Previous entry')); |
---|
[0] | 125 | $prev_headlink = sprintf($post_headlink,'previous', |
---|
| 126 | html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); |
---|
| 127 | } |
---|
| 128 | |
---|
| 129 | try { |
---|
| 130 | $core->media = new dcMedia($core); |
---|
[1537] | 131 | } catch (Exception $e) { |
---|
| 132 | $core->error->add($e->getMessage()); |
---|
| 133 | } |
---|
[1783] | 134 | |
---|
| 135 | # Sanitize trackbacks excerpt |
---|
| 136 | $tb_excerpt = empty($_POST['tb_excerpt']) ? |
---|
| 137 | $post_excerpt_xhtml.' '.$post_content_xhtml : |
---|
| 138 | $_POST['tb_excerpt']; |
---|
| 139 | $tb_excerpt = html::decodeEntities(html::clean($tb_excerpt)); |
---|
| 140 | $tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255); |
---|
| 141 | $tb_excerpt = preg_replace('/\s+/ms', ' ', $tb_excerpt); |
---|
| 142 | } |
---|
| 143 | } |
---|
[2067] | 144 | if (isset($_REQUEST['section']) && $_REQUEST['section']=='trackbacks') { |
---|
| 145 | $anchor = 'trackbacks'; |
---|
| 146 | } else { |
---|
| 147 | $anchor = 'comments'; |
---|
| 148 | } |
---|
[2071] | 149 | |
---|
| 150 | $comments_actions_page = new dcCommentsActionsPage($core,'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); |
---|
[2067] | 151 | |
---|
| 152 | if ($comments_actions_page->process()) { |
---|
| 153 | return; |
---|
| 154 | } |
---|
[1783] | 155 | |
---|
| 156 | # Ping blogs |
---|
| 157 | if (!empty($_POST['ping'])) |
---|
| 158 | { |
---|
| 159 | if (!empty($_POST['tb_urls']) && $post_id && $post_status == 1 && $can_edit_post) |
---|
| 160 | { |
---|
| 161 | $tb_urls = $_POST['tb_urls']; |
---|
| 162 | $tb_urls = str_replace("\r", '', $tb_urls); |
---|
| 163 | $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); |
---|
| 164 | |
---|
| 165 | foreach (explode("\n", $tb_urls) as $tb_url) |
---|
| 166 | { |
---|
| 167 | try { |
---|
| 168 | $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $post_url); |
---|
| 169 | } catch (Exception $e) { |
---|
| 170 | $core->error->add($e->getMessage()); |
---|
| 171 | } |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | if (!$core->error->flag()) { |
---|
| 175 | http::redirect('post.php?id='.$post_id.'&tbsent=1&tb=1'); |
---|
| 176 | } |
---|
[0] | 177 | } |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | # Format excerpt and content |
---|
[1783] | 181 | elseif (!empty($_POST) && $can_edit_post) |
---|
[0] | 182 | { |
---|
| 183 | $post_format = $_POST['post_format']; |
---|
| 184 | $post_excerpt = $_POST['post_excerpt']; |
---|
| 185 | $post_content = $_POST['post_content']; |
---|
| 186 | |
---|
| 187 | $post_title = $_POST['post_title']; |
---|
| 188 | |
---|
| 189 | $cat_id = (integer) $_POST['cat_id']; |
---|
| 190 | |
---|
| 191 | if (isset($_POST['post_status'])) { |
---|
| 192 | $post_status = (integer) $_POST['post_status']; |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | if (empty($_POST['post_dt'])) { |
---|
| 196 | $post_dt = ''; |
---|
| 197 | } else { |
---|
[957] | 198 | try |
---|
| 199 | { |
---|
| 200 | $post_dt = strtotime($_POST['post_dt']); |
---|
| 201 | if ($post_dt == false || $post_dt == -1) { |
---|
| 202 | $bad_dt = true; |
---|
| 203 | throw new Exception(__('Invalid publication date')); |
---|
| 204 | } |
---|
| 205 | $post_dt = date('Y-m-d H:i',$post_dt); |
---|
| 206 | } |
---|
| 207 | catch (Exception $e) |
---|
| 208 | { |
---|
| 209 | $core->error->add($e->getMessage()); |
---|
| 210 | } |
---|
[0] | 211 | } |
---|
| 212 | |
---|
| 213 | $post_open_comment = !empty($_POST['post_open_comment']); |
---|
| 214 | $post_open_tb = !empty($_POST['post_open_tb']); |
---|
| 215 | $post_selected = !empty($_POST['post_selected']); |
---|
| 216 | $post_lang = $_POST['post_lang']; |
---|
| 217 | $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; |
---|
| 218 | |
---|
| 219 | $post_notes = $_POST['post_notes']; |
---|
| 220 | |
---|
| 221 | if (isset($_POST['post_url'])) { |
---|
| 222 | $post_url = $_POST['post_url']; |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | $core->blog->setPostContent( |
---|
| 226 | $post_id,$post_format,$post_lang, |
---|
| 227 | $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml |
---|
| 228 | ); |
---|
| 229 | } |
---|
| 230 | |
---|
[1068] | 231 | # Delete post |
---|
| 232 | if (!empty($_POST['delete']) && $can_delete) |
---|
| 233 | { |
---|
| 234 | try { |
---|
| 235 | # --BEHAVIOR-- adminBeforePostDelete |
---|
| 236 | $core->callBehavior('adminBeforePostDelete',$post_id); |
---|
| 237 | $core->blog->delPost($post_id); |
---|
| 238 | http::redirect('posts.php'); |
---|
| 239 | } catch (Exception $e) { |
---|
| 240 | $core->error->add($e->getMessage()); |
---|
| 241 | } |
---|
| 242 | } |
---|
| 243 | |
---|
[0] | 244 | # Create or update post |
---|
[957] | 245 | if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) |
---|
[0] | 246 | { |
---|
[1417] | 247 | # Create category |
---|
| 248 | if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { |
---|
| 249 | |
---|
| 250 | $cur_cat = $core->con->openCursor($core->prefix.'category'); |
---|
| 251 | $cur_cat->cat_title = $_POST['new_cat_title']; |
---|
| 252 | $cur_cat->cat_url = ''; |
---|
| 253 | |
---|
| 254 | $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; |
---|
| 255 | |
---|
| 256 | # --BEHAVIOR-- adminBeforeCategoryCreate |
---|
| 257 | $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); |
---|
| 258 | |
---|
| 259 | $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); |
---|
| 260 | |
---|
| 261 | # --BEHAVIOR-- adminAfterCategoryCreate |
---|
| 262 | $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); |
---|
| 263 | } |
---|
| 264 | |
---|
[0] | 265 | $cur = $core->con->openCursor($core->prefix.'post'); |
---|
| 266 | |
---|
| 267 | $cur->post_title = $post_title; |
---|
| 268 | $cur->cat_id = ($cat_id ? $cat_id : null); |
---|
| 269 | $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; |
---|
| 270 | $cur->post_format = $post_format; |
---|
| 271 | $cur->post_password = $post_password; |
---|
| 272 | $cur->post_lang = $post_lang; |
---|
| 273 | $cur->post_title = $post_title; |
---|
| 274 | $cur->post_excerpt = $post_excerpt; |
---|
| 275 | $cur->post_excerpt_xhtml = $post_excerpt_xhtml; |
---|
| 276 | $cur->post_content = $post_content; |
---|
| 277 | $cur->post_content_xhtml = $post_content_xhtml; |
---|
| 278 | $cur->post_notes = $post_notes; |
---|
| 279 | $cur->post_status = $post_status; |
---|
| 280 | $cur->post_selected = (integer) $post_selected; |
---|
| 281 | $cur->post_open_comment = (integer) $post_open_comment; |
---|
| 282 | $cur->post_open_tb = (integer) $post_open_tb; |
---|
| 283 | |
---|
| 284 | if (isset($_POST['post_url'])) { |
---|
| 285 | $cur->post_url = $post_url; |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | # Update post |
---|
| 289 | if ($post_id) |
---|
| 290 | { |
---|
| 291 | try |
---|
| 292 | { |
---|
| 293 | # --BEHAVIOR-- adminBeforePostUpdate |
---|
| 294 | $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); |
---|
| 295 | |
---|
| 296 | $core->blog->updPost($post_id,$cur); |
---|
| 297 | |
---|
| 298 | # --BEHAVIOR-- adminAfterPostUpdate |
---|
| 299 | $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); |
---|
[2181] | 300 | dcPage::addSuccessNotice (sprintf('The post "%s" has been successfully updated',html::escapeHTML($cur->post_title))); |
---|
| 301 | http::redirect('post.php?id='.$post_id); |
---|
[0] | 302 | } |
---|
| 303 | catch (Exception $e) |
---|
| 304 | { |
---|
| 305 | $core->error->add($e->getMessage()); |
---|
| 306 | } |
---|
| 307 | } |
---|
| 308 | else |
---|
| 309 | { |
---|
| 310 | $cur->user_id = $core->auth->userID(); |
---|
| 311 | |
---|
| 312 | try |
---|
| 313 | { |
---|
| 314 | # --BEHAVIOR-- adminBeforePostCreate |
---|
| 315 | $core->callBehavior('adminBeforePostCreate',$cur); |
---|
| 316 | |
---|
| 317 | $return_id = $core->blog->addPost($cur); |
---|
| 318 | |
---|
| 319 | # --BEHAVIOR-- adminAfterPostCreate |
---|
| 320 | $core->callBehavior('adminAfterPostCreate',$cur,$return_id); |
---|
| 321 | |
---|
| 322 | http::redirect('post.php?id='.$return_id.'&crea=1'); |
---|
| 323 | } |
---|
| 324 | catch (Exception $e) |
---|
| 325 | { |
---|
| 326 | $core->error->add($e->getMessage()); |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | |
---|
[1417] | 331 | # Getting categories |
---|
[1719] | 332 | $categories_combo = dcAdminCombos::getCategoriesCombo( |
---|
[1831] | 333 | $core->blog->getCategories(array('post_type'=>'post')) |
---|
[1719] | 334 | ); |
---|
[0] | 335 | /* DISPLAY |
---|
| 336 | -------------------------------------------------------- */ |
---|
| 337 | $default_tab = 'edit-entry'; |
---|
| 338 | if (!$can_edit_post) { |
---|
| 339 | $default_tab = ''; |
---|
| 340 | } |
---|
| 341 | if (!empty($_GET['co'])) { |
---|
| 342 | $default_tab = 'comments'; |
---|
| 343 | } |
---|
[1783] | 344 | elseif (!empty($_GET['tb'])) { |
---|
| 345 | $default_tab = 'trackbacks'; |
---|
| 346 | } |
---|
[0] | 347 | |
---|
[1358] | 348 | if ($post_id) { |
---|
| 349 | switch ($post_status) { |
---|
| 350 | case 1: |
---|
| 351 | $img_status = sprintf($img_status_pattern,__('Published'),'check-on.png'); |
---|
| 352 | break; |
---|
| 353 | case 0: |
---|
| 354 | $img_status = sprintf($img_status_pattern,__('Unpublished'),'check-off.png'); |
---|
| 355 | break; |
---|
| 356 | case -1: |
---|
| 357 | $img_status = sprintf($img_status_pattern,__('Scheduled'),'scheduled.png'); |
---|
| 358 | break; |
---|
| 359 | case -2: |
---|
| 360 | $img_status = sprintf($img_status_pattern,__('Pending'),'check-wrn.png'); |
---|
| 361 | break; |
---|
| 362 | default: |
---|
| 363 | $img_status = ''; |
---|
| 364 | } |
---|
| 365 | $edit_entry_str = __('“%s”'); |
---|
| 366 | $page_title_edit = sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; |
---|
[1427] | 367 | } else { |
---|
| 368 | $img_status = ''; |
---|
[1358] | 369 | } |
---|
| 370 | |
---|
| 371 | |
---|
[195] | 372 | dcPage::open($page_title.' - '.__('Entries'), |
---|
[0] | 373 | dcPage::jsDatePicker(). |
---|
| 374 | dcPage::jsToolBar(). |
---|
| 375 | dcPage::jsModal(). |
---|
| 376 | dcPage::jsMetaEditor(). |
---|
| 377 | dcPage::jsLoad('js/_post.js'). |
---|
| 378 | dcPage::jsConfirmClose('entry-form','comment-form'). |
---|
| 379 | # --BEHAVIOR-- adminPostHeaders |
---|
| 380 | $core->callBehavior('adminPostHeaders'). |
---|
| 381 | dcPage::jsPageTabs($default_tab). |
---|
[1358] | 382 | $next_headlink."\n".$prev_headlink, |
---|
| 383 | dcPage::breadcrumb( |
---|
| 384 | array( |
---|
| 385 | html::escapeHTML($core->blog->name) => '', |
---|
| 386 | __('Entries') => 'posts.php', |
---|
[2166] | 387 | ($post_id ? $page_title_edit : $page_title) => '' |
---|
[1358] | 388 | )) |
---|
[0] | 389 | ); |
---|
| 390 | |
---|
| 391 | if (!empty($_GET['upd'])) { |
---|
[1550] | 392 | dcPage::success(__('Entry has been successfully updated.')); |
---|
[0] | 393 | } |
---|
| 394 | elseif (!empty($_GET['crea'])) { |
---|
[1550] | 395 | dcPage::success(__('Entry has been successfully created.')); |
---|
[0] | 396 | } |
---|
| 397 | elseif (!empty($_GET['attached'])) { |
---|
[1550] | 398 | dcPage::success(__('File has been successfully attached.')); |
---|
[0] | 399 | } |
---|
| 400 | elseif (!empty($_GET['rmattach'])) { |
---|
[1550] | 401 | dcPage::success(__('Attachment has been successfully removed.')); |
---|
[0] | 402 | } |
---|
| 403 | |
---|
| 404 | if (!empty($_GET['creaco'])) { |
---|
[1550] | 405 | dcPage::success(__('Comment has been successfully created.')); |
---|
[907] | 406 | } |
---|
[1783] | 407 | if (!empty($_GET['tbsent'])) { |
---|
| 408 | dcPage::success(__('All pings sent.')); |
---|
| 409 | } |
---|
[0] | 410 | |
---|
| 411 | # XHTML conversion |
---|
| 412 | if (!empty($_GET['xconv'])) |
---|
| 413 | { |
---|
| 414 | $post_excerpt = $post_excerpt_xhtml; |
---|
| 415 | $post_content = $post_content_xhtml; |
---|
| 416 | $post_format = 'xhtml'; |
---|
| 417 | |
---|
[907] | 418 | dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); |
---|
[0] | 419 | } |
---|
| 420 | |
---|
| 421 | if ($post_id && $post->post_status == 1) { |
---|
[1353] | 422 | echo '<p><a class="onblog_link" href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; |
---|
[0] | 423 | } |
---|
| 424 | if ($post_id) |
---|
| 425 | { |
---|
[1333] | 426 | echo '<p class="nav_prevnext">'; |
---|
[0] | 427 | if ($prev_link) { echo $prev_link; } |
---|
[1335] | 428 | if ($next_link && $prev_link) { echo ' | '; } |
---|
[0] | 429 | if ($next_link) { echo $next_link; } |
---|
| 430 | |
---|
| 431 | # --BEHAVIOR-- adminPostNavLinks |
---|
| 432 | $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); |
---|
| 433 | |
---|
| 434 | echo '</p>'; |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | # Exit if we cannot view page |
---|
| 438 | if (!$can_view_page) { |
---|
| 439 | dcPage::helpBlock('core_post'); |
---|
| 440 | dcPage::close(); |
---|
| 441 | exit; |
---|
| 442 | } |
---|
| 443 | /* Post form if we can edit post |
---|
| 444 | -------------------------------------------------------- */ |
---|
| 445 | if ($can_edit_post) |
---|
| 446 | { |
---|
[1398] | 447 | $sidebar_items = new ArrayObject(array( |
---|
[1392] | 448 | 'status-box' => array( |
---|
| 449 | 'title' => __('Status'), |
---|
| 450 | 'items' => array( |
---|
| 451 | 'post_status' => |
---|
[1427] | 452 | '<p class="entry-status"><label for="post_status" class="ib">'.__('Entry status').' '.$img_status.'</label>'. |
---|
[1392] | 453 | form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). |
---|
[1396] | 454 | '</p>', |
---|
[1392] | 455 | 'post_dt' => |
---|
[1396] | 456 | '<p><label for="post_dt" class="ib">'.__('Publication date and hour').'</label>'. |
---|
[1392] | 457 | form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). |
---|
[1396] | 458 | '</p>', |
---|
[1392] | 459 | 'post_lang' => |
---|
[1964] | 460 | '<p><label for="post_lang" class="ib">'.__('Entry language').'</label>'. |
---|
[1392] | 461 | form::combo('post_lang',$lang_combo,$post_lang). |
---|
[1396] | 462 | '</p>', |
---|
[1392] | 463 | 'post_format' => |
---|
[1619] | 464 | '<div>'. |
---|
[1964] | 465 | '<h5 id="label_format"><label for="post_format" class="ib">'.__('Text formatting').'</label></h5>'. |
---|
[1619] | 466 | '<p>'.form::combo('post_format',$formaters_combo,$post_format,'maximal'). |
---|
[1396] | 467 | '</p>'. |
---|
[1830] | 468 | '<p class="format_control control_no_xhtml">'. |
---|
[1824] | 469 | '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&xconv=1">'. |
---|
[1812] | 470 | __('Convert to XHTML').'</a></p></div>')), |
---|
[1392] | 471 | 'metas-box' => array( |
---|
[1964] | 472 | 'title' => __('Filing'), |
---|
[1392] | 473 | 'items' => array( |
---|
| 474 | 'post_selected' => |
---|
| 475 | '<p><label for="post_selected" class="classic">'. |
---|
| 476 | form::checkbox('post_selected',1,$post_selected).' '. |
---|
| 477 | __('Selected entry').'</label></p>', |
---|
| 478 | 'cat_id' => |
---|
[1935] | 479 | '<div>'. |
---|
| 480 | '<h5 id="label_cat_id">'.__('Category').'</h5>'. |
---|
| 481 | '<p><label for="cat_id">'.__('Category:').'</label>'. |
---|
[1392] | 482 | form::combo('cat_id',$categories_combo,$cat_id,'maximal'). |
---|
[1468] | 483 | '</p>'. |
---|
| 484 | ($core->auth->check('categories', $core->blog->id) ? |
---|
[1936] | 485 | '<div>'. |
---|
[1530] | 486 | '<h5 id="create_cat">'.__('Add a new category').'</h5>'. |
---|
[1468] | 487 | '<p><label for="new_cat_title">'.__('Title:').' '. |
---|
| 488 | form::field('new_cat_title',30,255,'','maximal').'</label></p>'. |
---|
| 489 | '<p><label for="new_cat_parent">'.__('Parent:').' '. |
---|
| 490 | form::combo('new_cat_parent',$categories_combo,'','maximal'). |
---|
[1936] | 491 | '</label></p>'. |
---|
| 492 | '</div>' |
---|
[1935] | 493 | : ''). |
---|
| 494 | '</div>')), |
---|
[1392] | 495 | 'options-box' => array( |
---|
| 496 | 'title' => __('Options'), |
---|
| 497 | 'items' => array( |
---|
[1711] | 498 | 'post_open_comment_tb' => |
---|
| 499 | '<div>'. |
---|
[1941] | 500 | '<h5 id="label_comment_tb">'.__('Comments and trackbacks list').'</h5>'. |
---|
[1392] | 501 | '<p><label for="post_open_comment" class="classic">'. |
---|
| 502 | form::checkbox('post_open_comment',1,$post_open_comment).' '. |
---|
| 503 | __('Accept comments').'</label></p>'. |
---|
| 504 | ($core->blog->settings->system->allow_comments ? |
---|
| 505 | (isContributionAllowed($post_id,strtotime($post_dt),true) ? |
---|
| 506 | '' : |
---|
| 507 | '<p class="form-note warn">'. |
---|
| 508 | __('Warning: Comments are not more accepted for this entry.').'</p>') : |
---|
| 509 | '<p class="form-note warn">'. |
---|
[1711] | 510 | __('Comments are not accepted on this blog so far.').'</p>'). |
---|
[1392] | 511 | '<p><label for="post_open_tb" class="classic">'. |
---|
| 512 | form::checkbox('post_open_tb',1,$post_open_tb).' '. |
---|
| 513 | __('Accept trackbacks').'</label></p>'. |
---|
| 514 | ($core->blog->settings->system->allow_trackbacks ? |
---|
| 515 | (isContributionAllowed($post_id,strtotime($post_dt),false) ? |
---|
| 516 | '' : |
---|
| 517 | '<p class="form-note warn">'. |
---|
| 518 | __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : |
---|
[1711] | 519 | '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). |
---|
| 520 | '</div>', |
---|
[1392] | 521 | 'post_password' => |
---|
[1396] | 522 | '<p><label for="post_password" class="ib">'.__('Password').'</label>'. |
---|
[1392] | 523 | form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). |
---|
[1396] | 524 | '</p>', |
---|
[1392] | 525 | 'post_url' => |
---|
| 526 | '<div class="lockable">'. |
---|
[1396] | 527 | '<p><label for="post_url" class="ib">'.__('Edit basename').'</label>'. |
---|
[1392] | 528 | form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). |
---|
[1396] | 529 | '</p>'. |
---|
[1392] | 530 | '<p class="form-note warn">'. |
---|
| 531 | __('Warning: If you set the URL manually, it may conflict with another entry.'). |
---|
| 532 | '</p></div>' |
---|
| 533 | )))); |
---|
[1398] | 534 | |
---|
| 535 | $main_items = new ArrayObject(array( |
---|
| 536 | "post_title" => |
---|
| 537 | '<p class="col">'. |
---|
| 538 | '<label class="required no-margin"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. |
---|
| 539 | form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). |
---|
| 540 | '</p>', |
---|
| 541 | |
---|
| 542 | "post_excerpt" => |
---|
[1741] | 543 | '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').' <span class="form-note">'. |
---|
[1697] | 544 | __('Introduction to the post.').'</span></label> '. |
---|
[1398] | 545 | form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). |
---|
| 546 | '</p>', |
---|
| 547 | |
---|
| 548 | "post_content" => |
---|
[1813] | 549 | '<p class="area" id="content-area"><label class="required" '. |
---|
[1398] | 550 | 'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. |
---|
| 551 | form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). |
---|
| 552 | '</p>', |
---|
| 553 | |
---|
| 554 | "post_notes" => |
---|
[1741] | 555 | '<p class="area" id="notes-area"><label for="post_notes">'.__('Personal notes:').' <span class="form-note">'. |
---|
[1697] | 556 | __('Unpublished notes.').'</span></label>'. |
---|
[1398] | 557 | form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). |
---|
| 558 | '</p>' |
---|
| 559 | ) |
---|
| 560 | ); |
---|
| 561 | |
---|
| 562 | # --BEHAVIOR-- adminPostFormItems |
---|
| 563 | $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); |
---|
| 564 | |
---|
| 565 | echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; |
---|
[0] | 566 | echo '<form action="post.php" method="post" id="entry-form">'; |
---|
[458] | 567 | echo '<div id="entry-wrapper">'; |
---|
[536] | 568 | echo '<div id="entry-content"><div class="constrained">'; |
---|
[1398] | 569 | |
---|
[1789] | 570 | echo '<h3 class="out-of-screen-if-js">'.__('Edit post').'</h3>'; |
---|
[458] | 571 | |
---|
[1398] | 572 | foreach ($main_items as $id => $item) { |
---|
| 573 | echo $item; |
---|
| 574 | } |
---|
| 575 | |
---|
| 576 | # --BEHAVIOR-- adminPostForm (may be deprecated) |
---|
[458] | 577 | $core->callBehavior('adminPostForm',isset($post) ? $post : null); |
---|
| 578 | |
---|
| 579 | echo |
---|
[1398] | 580 | '<p class="border-top">'. |
---|
[458] | 581 | ($post_id ? form::hidden('id',$post_id) : ''). |
---|
| 582 | '<input type="submit" value="'.__('Save').' (s)" '. |
---|
[543] | 583 | 'accesskey="s" name="save" /> '; |
---|
[544] | 584 | if ($post_id) { |
---|
[543] | 585 | $preview_url = |
---|
[776] | 586 | $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. |
---|
[543] | 587 | http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). |
---|
[772] | 588 | '/'.$post->post_url); |
---|
[1139] | 589 | echo '<a id="post-preview" href="'.$preview_url.'" class="button" accesskey="p">'.__('Preview').' (p)'.'</a> '; |
---|
[1215] | 590 | } else { |
---|
| 591 | echo |
---|
| 592 | '<a id="post-cancel" href="index.php" class="button" accesskey="c">'.__('Cancel').' (c)</a>'; |
---|
[543] | 593 | } |
---|
[1215] | 594 | |
---|
[543] | 595 | echo |
---|
[458] | 596 | ($can_delete ? '<input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). |
---|
| 597 | $core->formNonce(). |
---|
| 598 | '</p>'; |
---|
| 599 | |
---|
[536] | 600 | echo '</div></div>'; // End #entry-content |
---|
[458] | 601 | echo '</div>'; // End #entry-wrapper |
---|
| 602 | |
---|
[0] | 603 | echo '<div id="entry-sidebar">'; |
---|
| 604 | |
---|
[1398] | 605 | foreach ($sidebar_items as $id => $c) { |
---|
[1741] | 606 | echo '<div id="'.$id.'" class="sb-box">'. |
---|
[1392] | 607 | '<h4>'.$c['title'].'</h4>'; |
---|
| 608 | foreach ($c['items'] as $e_name=>$e_content) { |
---|
| 609 | echo $e_content; |
---|
| 610 | } |
---|
| 611 | echo '</div>'; |
---|
| 612 | } |
---|
[0] | 613 | |
---|
[1417] | 614 | |
---|
[1398] | 615 | # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) |
---|
[0] | 616 | $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); |
---|
| 617 | echo '</div>'; // End #entry-sidebar |
---|
[458] | 618 | |
---|
[0] | 619 | echo '</form>'; |
---|
[416] | 620 | |
---|
| 621 | # --BEHAVIOR-- adminPostForm |
---|
| 622 | $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); |
---|
| 623 | |
---|
[0] | 624 | echo '</div>'; |
---|
| 625 | } |
---|
| 626 | |
---|
| 627 | if ($post_id) |
---|
| 628 | { |
---|
[1783] | 629 | /* Comments |
---|
| 630 | -------------------------------------------------------- */ |
---|
| 631 | |
---|
[0] | 632 | $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); |
---|
| 633 | |
---|
| 634 | $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); |
---|
[2063] | 635 | |
---|
[1613] | 636 | echo |
---|
[1741] | 637 | '<div id="comments" class="clear multi-part" title="'.__('Comments').'">'; |
---|
[2063] | 638 | $combo_action = $comments_actions_page->getCombo(); |
---|
[1783] | 639 | $has_action = !empty($combo_action) && !$comments->isEmpty(); |
---|
[1612] | 640 | echo |
---|
[1741] | 641 | '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; |
---|
[0] | 642 | |
---|
| 643 | if ($has_action) { |
---|
[2063] | 644 | echo '<form action="post.php" id="form-comments" method="post">'; |
---|
[0] | 645 | } |
---|
| 646 | |
---|
| 647 | echo '<h3>'.__('Comments').'</h3>'; |
---|
| 648 | if (!$comments->isEmpty()) { |
---|
| 649 | showComments($comments,$has_action); |
---|
| 650 | } else { |
---|
| 651 | echo '<p>'.__('No comment').'</p>'; |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | if ($has_action) { |
---|
| 655 | echo |
---|
| 656 | '<div class="two-cols">'. |
---|
| 657 | '<p class="col checkboxes-helpers"></p>'. |
---|
| 658 | |
---|
[96] | 659 | '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. |
---|
[0] | 660 | form::combo('action',$combo_action). |
---|
[2071] | 661 | form::hidden(array('section'),'comments'). |
---|
[2063] | 662 | form::hidden(array('id'),$post_id). |
---|
[0] | 663 | $core->formNonce(). |
---|
| 664 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
| 665 | '</div>'. |
---|
| 666 | '</form>'; |
---|
| 667 | } |
---|
[1612] | 668 | /* Add a comment |
---|
| 669 | -------------------------------------------------------- */ |
---|
[0] | 670 | |
---|
| 671 | echo |
---|
[1613] | 672 | '<div class="fieldset clear">'. |
---|
[0] | 673 | '<h3>'.__('Add a comment').'</h3>'. |
---|
| 674 | |
---|
| 675 | '<form action="comment.php" method="post" id="comment-form">'. |
---|
[536] | 676 | '<div class="constrained">'. |
---|
[1396] | 677 | '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:').'</label>'. |
---|
[0] | 678 | form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). |
---|
[1396] | 679 | '</p>'. |
---|
[0] | 680 | |
---|
[1396] | 681 | '<p><label for="comment_email">'.__('Email:').'</label>'. |
---|
[0] | 682 | form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). |
---|
[1396] | 683 | '</p>'. |
---|
[0] | 684 | |
---|
[1396] | 685 | '<p><label for="comment_site">'.__('Web site:').'</label>'. |
---|
[0] | 686 | form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). |
---|
[1396] | 687 | '</p>'. |
---|
[0] | 688 | |
---|
[70] | 689 | '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. |
---|
| 690 | __('Comment:').'</label> '. |
---|
[0] | 691 | form::textarea('comment_content',50,8,html::escapeHTML('')). |
---|
| 692 | '</p>'. |
---|
| 693 | |
---|
[2063] | 694 | '<p>'. |
---|
[2091] | 695 | form::hidden('post_id',$post_id). |
---|
[0] | 696 | $core->formNonce(). |
---|
[217] | 697 | '<input type="submit" name="add" value="'.__('Save').'" /></p>'. |
---|
[1613] | 698 | '</div>'. #constrained |
---|
| 699 | |
---|
[0] | 700 | '</form>'. |
---|
[1613] | 701 | '</div>'. #add comment |
---|
| 702 | '</div>'; #comments |
---|
[0] | 703 | } |
---|
| 704 | |
---|
[1783] | 705 | if ($post_id && $post_status == 1) |
---|
| 706 | { |
---|
| 707 | /* Trackbacks |
---|
| 708 | -------------------------------------------------------- */ |
---|
| 709 | |
---|
| 710 | $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); |
---|
| 711 | $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); |
---|
| 712 | |
---|
| 713 | # Actions combo box |
---|
[2063] | 714 | $combo_action = $comments_actions_page->getCombo(); |
---|
[1783] | 715 | $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); |
---|
| 716 | |
---|
| 717 | if (!empty($_GET['tb_auto'])) { |
---|
| 718 | $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); |
---|
| 719 | } |
---|
| 720 | |
---|
| 721 | # Display tab |
---|
| 722 | echo |
---|
| 723 | '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; |
---|
| 724 | |
---|
| 725 | # tracbacks actions |
---|
| 726 | if ($has_action) { |
---|
[2063] | 727 | echo '<form action="post.php" id="form-trackbacks" method="post">'; |
---|
[1783] | 728 | } |
---|
| 729 | |
---|
[2142] | 730 | echo '<h3>'.__('Trackbacks received').'</h3>'; |
---|
[1783] | 731 | |
---|
| 732 | if (!$trackbacks->isEmpty()) { |
---|
| 733 | showComments($trackbacks, $has_action, true); |
---|
| 734 | } else { |
---|
| 735 | echo '<p>'.__('No trackback').'</p>'; |
---|
| 736 | } |
---|
| 737 | |
---|
| 738 | if ($has_action) { |
---|
| 739 | echo |
---|
| 740 | '<div class="two-cols">'. |
---|
| 741 | '<p class="col checkboxes-helpers"></p>'. |
---|
| 742 | |
---|
| 743 | '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. |
---|
| 744 | form::combo('action', $combo_action). |
---|
[2063] | 745 | form::hidden('id',$post_id). |
---|
[2071] | 746 | form::hidden(array('section'),'trackbacks'). |
---|
[1783] | 747 | $core->formNonce(). |
---|
| 748 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
| 749 | '</div>'. |
---|
| 750 | '</form>'; |
---|
| 751 | } |
---|
| 752 | |
---|
| 753 | /* Add trackbacks |
---|
| 754 | -------------------------------------------------------- */ |
---|
| 755 | if ($can_edit_post && $post->post_status) { |
---|
| 756 | echo |
---|
| 757 | '<div class="fieldset clear">'; |
---|
| 758 | |
---|
| 759 | echo |
---|
| 760 | '<h3>'.__('Ping blogs').'</h3>'. |
---|
| 761 | '<form action="post.php?id='.$post_id.'" id="trackback-form" method="post">'. |
---|
| 762 | '<p><label for="tb_urls" class="area">'.__('URLs to ping:').'</label>'. |
---|
| 763 | form::textarea('tb_urls', 60, 5, $tb_urls). |
---|
| 764 | '</p>'. |
---|
| 765 | |
---|
[2142] | 766 | '<p><label for="tb_excerpt" class="area">'.__('Excerpt to send:').'</label>'. |
---|
[1783] | 767 | form::textarea('tb_excerpt', 60, 5, $tb_excerpt).'</p>'. |
---|
| 768 | |
---|
| 769 | '<p>'. |
---|
| 770 | $core->formNonce(). |
---|
| 771 | '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. |
---|
| 772 | (empty($_GET['tb_auto']) ? |
---|
| 773 | ' <a class="button" href="'. |
---|
| 774 | 'post.php?id='.$post_id.'&tb_auto=1&tb=1'. |
---|
| 775 | '">'.__('Auto discover ping URLs').'</a>' |
---|
| 776 | : ''). |
---|
| 777 | '</p>'. |
---|
| 778 | '</form>'; |
---|
| 779 | |
---|
| 780 | $pings = $TB->getPostPings($post_id); |
---|
| 781 | |
---|
| 782 | if (!$pings->isEmpty()) |
---|
| 783 | { |
---|
| 784 | echo '<h3>'.__('Previously sent pings').'</h3>'; |
---|
| 785 | |
---|
| 786 | echo '<ul class="nice">'; |
---|
| 787 | while ($pings->fetch()) { |
---|
| 788 | echo |
---|
| 789 | '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt).' - '. |
---|
| 790 | $pings->ping_url.'</li>'; |
---|
| 791 | } |
---|
| 792 | echo '</ul>'; |
---|
| 793 | } |
---|
| 794 | |
---|
| 795 | echo '</div>'; |
---|
| 796 | } |
---|
| 797 | |
---|
| 798 | echo '</div>'; #trackbacks |
---|
| 799 | } |
---|
| 800 | |
---|
[916] | 801 | # Controls comments or trakbacks capabilities |
---|
| 802 | function isContributionAllowed($id,$dt,$com=true) |
---|
| 803 | { |
---|
| 804 | global $core; |
---|
| 805 | |
---|
| 806 | if (!$id) { |
---|
| 807 | return true; |
---|
| 808 | } |
---|
| 809 | if ($com) { |
---|
| 810 | if (($core->blog->settings->system->comments_ttl == 0) || |
---|
| 811 | (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { |
---|
| 812 | return true; |
---|
| 813 | } |
---|
| 814 | } else { |
---|
| 815 | if (($core->blog->settings->system->trackbacks_ttl == 0) || |
---|
| 816 | (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { |
---|
| 817 | return true; |
---|
| 818 | } |
---|
| 819 | } |
---|
| 820 | return false; |
---|
| 821 | } |
---|
[0] | 822 | |
---|
| 823 | # Show comments or trackbacks |
---|
[70] | 824 | function showComments($rs,$has_action,$tb=false) |
---|
[0] | 825 | { |
---|
| 826 | echo |
---|
[2002] | 827 | '<div class="table-outer">'. |
---|
[0] | 828 | '<table class="comments-list"><tr>'. |
---|
[1508] | 829 | '<th colspan="2" class="first">'.__('Author').'</th>'. |
---|
[0] | 830 | '<th>'.__('Date').'</th>'. |
---|
| 831 | '<th class="nowrap">'.__('IP address').'</th>'. |
---|
| 832 | '<th>'.__('Status').'</th>'. |
---|
[1508] | 833 | '<th>'.__('Edit').'</th>'. |
---|
[0] | 834 | '</tr>'; |
---|
[2064] | 835 | $comments = array(); |
---|
| 836 | if (isset($_REQUEST['comments'])) { |
---|
| 837 | foreach ($_REQUEST['comments'] as $v) { |
---|
| 838 | $comments[(integer)$v]=true; |
---|
| 839 | } |
---|
| 840 | } |
---|
[0] | 841 | |
---|
| 842 | while($rs->fetch()) |
---|
| 843 | { |
---|
| 844 | $comment_url = 'comment.php?id='.$rs->comment_id; |
---|
| 845 | |
---|
| 846 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
| 847 | switch ($rs->comment_status) { |
---|
| 848 | case 1: |
---|
[1453] | 849 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
---|
[0] | 850 | break; |
---|
| 851 | case 0: |
---|
[1453] | 852 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
---|
[0] | 853 | break; |
---|
| 854 | case -1: |
---|
[1453] | 855 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
---|
[0] | 856 | break; |
---|
| 857 | case -2: |
---|
[1453] | 858 | $img_status = sprintf($img,__('Junk'),'junk.png'); |
---|
[0] | 859 | break; |
---|
| 860 | } |
---|
| 861 | |
---|
| 862 | echo |
---|
| 863 | '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. |
---|
| 864 | ' id="c'.$rs->comment_id.'">'. |
---|
| 865 | |
---|
| 866 | '<td class="nowrap">'. |
---|
[2064] | 867 | ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,isset($comments[$rs->comment_id]),'','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. |
---|
[0] | 868 | '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. |
---|
| 869 | '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. |
---|
| 870 | '<td class="nowrap"><a href="comments.php?ip='.$rs->comment_ip.'">'.$rs->comment_ip.'</a></td>'. |
---|
| 871 | '<td class="nowrap status">'.$img_status.'</td>'. |
---|
| 872 | '<td class="nowrap status"><a href="'.$comment_url.'">'. |
---|
[1508] | 873 | '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. |
---|
[0] | 874 | |
---|
| 875 | '</tr>'; |
---|
| 876 | } |
---|
| 877 | |
---|
[2002] | 878 | echo '</table></div>'; |
---|
[0] | 879 | } |
---|
| 880 | |
---|
[1459] | 881 | dcPage::helpBlock('core_post','core_trackbacks','core_wiki'); |
---|
[0] | 882 | dcPage::close(); |
---|
[1329] | 883 | ?> |
---|