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