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