[ Index ] |
|
Code source de Dotclear 2.0-beta6 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of DotClear. 4 # Copyright (c) 2005 Olivier Meunier and contributors. All rights 5 # reserved. 6 # 7 # DotClear is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # DotClear is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with DotClear; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # ***** END LICENSE BLOCK ***** 22 23 require dirname(__FILE__).'/../inc/admin/prepend.php'; 24 25 dcPage::check('usage,contentadmin'); 26 27 # Check if post exists and is online 28 $id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : null; 29 30 $post = null; 31 $tb_excerpt = $tb_urls = ''; 32 $auto_link = ''; 33 $can_view_page = true; 34 35 # Check if post exists 36 if ($id !== null) 37 { 38 $params['post_id'] = $id; 39 $params['post_status'] = 1; 40 $post = $core->blog->getPosts($params); 41 42 if ($post->isEmpty()) { 43 $core->error->add(__('This entry does not exist or is not published')); 44 $can_view_page = false; 45 } else { 46 $TB = new dcTrackback($core); 47 $tb_excerpt = $post->post_excerpt_xhtml.' '.$post->post_content_xhtml; 48 $post_title = $post->post_title; 49 $post_url = $post->getURL(); 50 } 51 } 52 else 53 { 54 $core->error->add(__('This entry does not exist.')); 55 $can_view_page = false; 56 } 57 58 # Change excerpt 59 if (!empty($_POST['tb_excerpt'])) { 60 $tb_excerpt = $_POST['tb_excerpt']; 61 } 62 63 # Sanitize excerpt 64 $tb_excerpt = html::clean($tb_excerpt); 65 $tb_excerpt = html::decodeEntities($tb_excerpt); 66 $tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt),255); 67 $tb_excerpt = preg_replace('/\s+/ms',' ',$tb_excerpt); 68 69 # Send pings 70 if ($post && !$post->isEmpty() && !empty($_POST['tb_urls'])) 71 { 72 $tb_urls = $_POST['tb_urls']; 73 $tb_urls = str_replace("\r",'',$tb_urls); 74 75 $post_title = html::escapeHTML(trim(html::clean($post_title))); 76 77 foreach (explode("\n",$tb_urls) as $tb_url) 78 { 79 try { 80 $TB->ping($tb_url,$id,$post_title,$tb_excerpt,$post_url); 81 } catch (Exception $e) { 82 $core->error->add($e->getMessage()); 83 } 84 } 85 86 if (!$core->error->flag()) { 87 http::redirect('trackbacks.php?id='.$id.'&sent=1'); 88 } 89 } 90 91 $page_title = __('Ping blogs'); 92 93 /* DISPLAY 94 -------------------------------------------------------- */ 95 dcPage::open($page_title,dcPage::jsLoad('js/_trackbacks.js')); 96 97 # Exit if we cannot view page 98 if (!$can_view_page) { 99 dcPage::close(); 100 exit; 101 } 102 103 if (!empty($_GET['sent'])) { 104 echo '<p class="message">'.__('All pings sent.').'</p>'; 105 } 106 107 echo '<h2>'.$core->blog->name.' > '.$page_title.'</h2>'; 108 109 echo '<p><a href="post.php?id='.$id.'">« '.__('Back to entry').'</a></p>'; 110 111 echo 112 '<h3 id="entry-preview-title">'. 113 html::escapeHTML($post->post_title).'</h3>'. 114 '<div class="frame-shrink" id="entry-preview">'. 115 ($post->post_excerpt_xhtml ? $post->post_excerpt_xhtml.'<hr />' : ''). 116 $post->post_content_xhtml. 117 '</div>'; 118 119 if (!empty($_GET['auto'])) { 120 flush(); 121 $tb_urls = implode("\n",$TB->discover($post->post_excerpt_xhtml.' '.$post->post_content_xhtml)); 122 } else { 123 $auto_link = '<strong><a href="trackbacks.php?id='.$id.'&auto=1">'. 124 __('Auto discover ping URLs').'</a></strong>'. 125 dcPage::help('post','t_discover'); 126 } 127 128 echo 129 '<h3>'.__('Ping blogs').'</h3>'. 130 '<form action="trackbacks.php" id="trackback-form" method="post">'. 131 '<p><label class="area">'.__('URLs to ping:'). 132 dcPage::help('post','t_url'). 133 form::textarea('tb_urls',60,5,$tb_urls). 134 '</label></p>'. 135 136 '<p><label class="area">'.__('Send excerpt:').dcPage::help('post','t_excerpt'). 137 form::textarea('tb_excerpt',60,3,$tb_excerpt). 138 '</label></p>'. 139 140 '<p>'.form::hidden('id',$id). 141 '<input type="submit" value="'.__('Ping blogs').'" /> '. 142 $auto_link.'</p>'. 143 '</form>'; 144 145 $pings = $TB->getPostPings($id); 146 147 if (!$pings->isEmpty()) 148 { 149 echo '<h3>'.__('Previously sent pings').'</h3>'; 150 151 echo '<ul class="nice">'; 152 while ($pings->fetch()) { 153 echo 154 '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'),$pings->ping_dt).' - '. 155 $pings->ping_url.'</li>'; 156 } 157 echo '</ul>'; 158 } 159 160 dcPage::close(); 161 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Feb 23 22:16:06 2007 | par Balluche grâce à PHPXref 0.7 |