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