check(1); include DC_BASE_DIR . '/ecrire/inc/connexion.php'; $list_url = (!empty($_POST['list_url'])) ? $_POST['list_url'] : ''; $tb_content = (!empty($_POST['tb_content'])) ? util::cutString($_POST['tb_content'],255) : ''; $is_editable = false; $ping_res = array(); $post_id = (!empty($_REQUEST['post_id'])) ? (integer) $_REQUEST['post_id'] : ''; # Vérifications d'usage if ($post_id != '') { $post = $blog->getPostByID($post_id); if (!$post->isEmpty()) { # Post éditable que par un admin ou son créateur if ($post->f('user_id') == $_SESSION['sess_user_id'] || $_SESSION['sess_user_level'] >= 9) { $is_editable = true; } } } # Création des trackback if ($is_editable && $list_url != '') { $list_url = str_replace("\r",'',$list_url); $turi = array_unique(explode("\n",$list_url)); foreach ($turi as $uri) { if ($blog->postTbPingURL($post_id,$uri,dc_blog_name,$tb_content) !== false) { $ping_res[$uri]['status'] = true; } else { $ping_error = $blog->error(); $ping_res[$uri]['status'] = false; $ping_res[$uri]['error'] = $ping_error[0][1]; $blog->resetError(); } } } # Sous menu if ($post_id) { $mySubMenu->addItem( __('Back to entry'),'poster.php?post_id='.$post_id, 'images/ico_retour.png',false); } openPage(__('Pings')); ?>

'.__('Error(s)').' :

'. '

'.__('No entry').'

'; } else { $chapo = $post->f('post_chapo'); $content = $post->f('post_content'); if ($tb_content == '') { $tb_content = util::cutString(strip_tags($post->f('post_content')),252).'...'; } echo '
'. '

'.$post->f('post_titre').'

'. (($chapo != '') ? $chapo.'
' : ''). $content.'
'; if (!empty($_GET['auto']) && $_GET['auto'] == 1) { $autodisc = new autodiscover(); $list_url = implode("\n",$autodisc->autoDiscovery($chapo."\n".$content)); } if (empty($_GET['auto'])) { echo '

'. __('Auto discovery of ping URLs').'

'; } echo '
'. '

'. form::textArea('list_url',30,5, htmlspecialchars($list_url),'','class="max"'). '

'. '

'. form::textArea('tb_content',30,3, htmlspecialchars($tb_content),'','class="max" '. 'onkeypress="limitArea(this,255);" onkeyup="limitArea(this,255);"'). '

'. '

'. form::hidden('post_id',$post_id). dcNonce::form(). '

'. '
'; if (!empty($_POST['list_url'])) { echo '

'.__('Result').'

'; foreach ($ping_res as $k => $v) { if ($v['status']) { $img = 'OK'; } else { $img = 'ERROR'; } echo '

'.$img.' '.$k.'
'. ''.((!$v['status']) ? $v['error'] : 'Ping OK').''; '

'; } } echo '

'.__('Previous pings sent').'

'; $rs = $blog->postGetPings($post_id); if ($rs->isEmpty()) { echo '

'.__('No ping yet').'

'; } else { echo ''; } } closePage(); ?>