12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- # ***** BEGIN LICENSE BLOCK *****
- # This file is part of DotClear.
- # Copyright (c) 2004 Olivier Meunier and contributors. All rights
- # reserved.
- #
- # DotClear is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # DotClear is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with DotClear; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- #
- # ***** END LICENSE BLOCK *****
- # Contrib : Lionel MONGE.
- #
- require dirname(__FILE__).'/lib.php';
- $img_check_on = '<img src="images/check_on.png" alt="ok" />';
- $img_check_off = '<img src="images/check_off.png" alt="failed" />';
- $url = "http://".$_SERVER['SERVER_NAME'].dc_blog_url;
- $name = dc_blog_name;
- $feed = "http://".$_SERVER['SERVER_NAME'].dc_blog_rss;
- $objPing = new basicPing($name,$url);
- # Définition des sites à pinger et de la fonctions à utiliser
- $ping_sites = array(
- 'Weblogues.com' => array('www.weblogues.com','/RPC/',array($objPing,'weblogPing')),
- 'Weblogs.com' => array('rpc.weblogs.com','/RPC2',array($objPing,'weblogPing')),
- 'Blo.gs' => array('ping.blo.gs','/',array($objPing,'weblogPing')),
- 'Technorati' => array('rpc.technorati.com','/rpc/ping',array($objPing,'weblogPing')),
- 'Syndic8' => array('www.syndic8.com','/xmlrpc.php',array($objPing,'weblogPing')),
- 'RootBlog' => array('ping.rootblog.com','/rpc.php',array($objPing,'weblogPing'))
- );
- buffer::str( '<h2>Ping</h2>' );
- # On ping
- if (!empty($_POST['ping']))
- {
- foreach ($_POST['ping'] as $k => $v)
- {
- $ping_server = $ping_sites[$k][0];
- $ping_path = $ping_sites[$k][1];
- $ping_function = $ping_sites[$k][2];
-
- $res = call_user_func($ping_function,$ping_server,$ping_path);
- if ($res === true)
- {
- buffer::str(
- '<p>'.$img_check_on.' <strong>'.$k.'</strong> : '.
- __('ping ok').'</p>'
- );
- }
- else
- {
- buffer::str('<p>'.$img_check_off.' <strong>'.$k.'</strong> : '.
- __('ping error').' ('.$res.')</p>');
- }
- }
- }
- buffer::str( '<h3>'.__('Sites to ping').'</h3>' );
- buffer::str('
- <form id="pform" method="post" action="tools.php?p=ping">'
- );
- foreach ($ping_sites as $k => $v)
- {
- buffer::str(
- '<p><input type="checkbox" id="'.$k.'" name="ping['.$k.']" value="1" />'.
- '<label class="inline" for="'.$k.'">'.$k.'</label></p>'
- );
- }
- buffer::str(
- '<p><input type="submit" class="submit" value="'.__('Submit Pings').'" /></p>'.
- '</form>'
- );
- ?>
|