Dotclear

source: admin/trackbacks.php @ 1614:93ac2b1d52c8

Revision 1614:93ac2b1d52c8, 4.1 KB checked in by Anne Kozlika <kozlika@…>, 11 years ago (diff)

trackback page: Restore full wide textarea. Change wording in french translation.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
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
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('usage,contentadmin');
16
17# Check if post exists and is online
18$id = !empty($_REQUEST['id']) ? (integer) $_REQUEST['id'] : null;
19
20$post = null;
21$tb_excerpt = $tb_urls = '';
22$auto_link = '';
23$can_view_page = true;
24
25# Check if post exists
26if ($id !== null)
27{
28     $params['post_id'] = $id;
29     $params['post_status'] = 1;
30     $post = $core->blog->getPosts($params);
31     
32     if ($post->isEmpty()) {
33          $core->error->add(__('This entry does not exist or is not published'));
34          $can_view_page = false;
35     } else {
36          $TB = new dcTrackback($core);
37          $tb_excerpt = $post->post_excerpt_xhtml.' '.$post->post_content_xhtml;
38          $post_title = $post->post_title;
39          $post_url = $post->getURL();
40     }
41}
42else
43{
44     $core->error->add(__('This entry does not exist.'));
45     $can_view_page = false;
46}
47
48# Change excerpt
49if (!empty($_POST['tb_excerpt'])) {
50     $tb_excerpt = $_POST['tb_excerpt'];
51}
52
53# Sanitize excerpt
54$tb_excerpt = html::clean($tb_excerpt);
55$tb_excerpt = html::decodeEntities($tb_excerpt);
56$tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt),255);
57$tb_excerpt = preg_replace('/\s+/ms',' ',$tb_excerpt);
58
59# Send pings
60if ($post && !$post->isEmpty() && !empty($_POST['tb_urls']))
61{
62     $tb_urls = $_POST['tb_urls'];
63     $tb_urls = str_replace("\r",'',$tb_urls);
64     
65     $post_title = html::escapeHTML(trim(html::clean($post_title)));
66     
67     foreach (explode("\n",$tb_urls) as $tb_url)
68     {
69          try {
70               $TB->ping($tb_url,$id,$post_title,$tb_excerpt,$post_url);
71          } catch (Exception $e) {
72               $core->error->add($e->getMessage());
73          }
74     }
75     
76     if (!$core->error->flag()) {
77          http::redirect('trackbacks.php?id='.$id.'&sent=1');
78     }
79}
80
81$page_title = __('Ping blogs');
82
83/* DISPLAY
84-------------------------------------------------------- */
85if ($can_view_page) {
86     $breadcrumb = dcPage::breadcrumb(
87     array(
88          html::escapeHTML($core->blog->name) => '',
89          html::escapeHTML($post->post_title) => $core->getPostAdminURL($post->post_type,$id),
90          '<span class="page-title">'.$page_title.'</span>' => ''
91     ));
92} else {
93     $breadcrumb = '';
94}
95dcPage::open($page_title,dcPage::jsLoad('js/_trackbacks.js'),$breadcrumb);
96
97# Exit if we cannot view page
98if (!$can_view_page) {
99     dcPage::close();
100     exit;
101}
102
103if (!empty($_GET['sent'])) {
104     dcPage::message(__('All pings sent.'));
105}
106
107echo '<p><a class="back" href="'.$core->getPostAdminURL($post->post_type,$id).'">'.
108     sprintf(__('Back to "%s"'),html::escapeHTML($post->post_title)).'</a></p>';
109
110echo
111'<h3 id="entry-preview-title">'.
112html::escapeHTML($post->post_title).'</h3>'.
113'<div class="frame-shrink" id="entry-preview">'.
114($post->post_excerpt_xhtml ? $post->post_excerpt_xhtml.'<hr />' : '').
115$post->post_content_xhtml.
116'</div>';
117
118if (!empty($_GET['auto'])) {
119     flush();
120     $tb_urls = implode("\n",$TB->discover($post->post_excerpt_xhtml.' '.$post->post_content_xhtml));
121} else {
122     $auto_link = '<a class="button" href="trackbacks.php?id='.$id.'&amp;auto=1">'.
123     __('Auto discover ping URLs').'</a>';
124}
125
126echo
127'<h3>'.__('Ping blogs').'</h3>'.
128'<form action="trackbacks.php" id="trackback-form" method="post">'.
129'<p><label for="tb_urls" class="area">'.__('URLs to ping:').'</label>'.
130form::textarea('tb_urls',60,5,$tb_urls).
131'</p>'.
132
133'<p><label for="tb_excerpt" class="area">'.__('Send excerpt:').'</label>'.
134form::textarea('tb_excerpt',60,5,$tb_excerpt).'</p>'.
135
136'<p>'.form::hidden('id',$id).
137$core->formNonce().
138'<input type="submit" value="'.__('Ping blogs').'" />&nbsp;&nbsp;'.
139$auto_link.'</p>'.
140'</form>';
141
142$pings = $TB->getPostPings($id);
143
144if (!$pings->isEmpty())
145{
146     echo '<h3>'.__('Previously sent pings').'</h3>';
147     
148     echo '<ul class="nice">';
149     while ($pings->fetch()) {
150          echo
151          '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'),$pings->ping_dt).' - '.
152          $pings->ping_url.'</li>';
153     }
154     echo '</ul>';
155}
156
157dcPage::helpBlock('core_trackbacks');
158dcPage::close();
159?>
Note: See TracBrowser for help on using the repository browser.

Sites map