index.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # This file is part of DotClear.
  4. # Copyright (c) 2004 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. # Contrib : Lionel MONGE.
  23. #
  24. require dirname(__FILE__).'/lib.php';
  25. $img_check_on = '<img src="images/check_on.png" alt="ok" />';
  26. $img_check_off = '<img src="images/check_off.png" alt="failed" />';
  27. $url = "http://".$_SERVER['SERVER_NAME'].dc_blog_url;
  28. $name = dc_blog_name;
  29. $feed = "http://".$_SERVER['SERVER_NAME'].dc_blog_rss;
  30. $objPing = new basicPing($name,$url);
  31. # Définition des sites à pinger et de la fonctions à utiliser
  32. $ping_sites = array(
  33. 'Weblogues.com' => array('www.weblogues.com','/RPC/',array($objPing,'weblogPing')),
  34. 'Weblogs.com' => array('rpc.weblogs.com','/RPC2',array($objPing,'weblogPing')),
  35. 'Blo.gs' => array('ping.blo.gs','/',array($objPing,'weblogPing')),
  36. 'Technorati' => array('rpc.technorati.com','/rpc/ping',array($objPing,'weblogPing')),
  37. 'Syndic8' => array('www.syndic8.com','/xmlrpc.php',array($objPing,'weblogPing')),
  38. 'RootBlog' => array('ping.rootblog.com','/rpc.php',array($objPing,'weblogPing'))
  39. );
  40. buffer::str( '<h2>Ping</h2>' );
  41. # On ping
  42. if (!empty($_POST['ping']))
  43. {
  44. foreach ($_POST['ping'] as $k => $v)
  45. {
  46. $ping_server = $ping_sites[$k][0];
  47. $ping_path = $ping_sites[$k][1];
  48. $ping_function = $ping_sites[$k][2];
  49. $res = call_user_func($ping_function,$ping_server,$ping_path);
  50. if ($res === true)
  51. {
  52. buffer::str(
  53. '<p>'.$img_check_on.' <strong>'.$k.'</strong> : '.
  54. __('ping ok').'</p>'
  55. );
  56. }
  57. else
  58. {
  59. buffer::str('<p>'.$img_check_off.' <strong>'.$k.'</strong> : '.
  60. __('ping error').' ('.$res.')</p>');
  61. }
  62. }
  63. }
  64. buffer::str( '<h3>'.__('Sites to ping').'</h3>' );
  65. buffer::str('
  66. <form id="pform" method="post" action="tools.php?p=ping">'
  67. );
  68. foreach ($ping_sites as $k => $v)
  69. {
  70. buffer::str(
  71. '<p><input type="checkbox" id="'.$k.'" name="ping['.$k.']" value="1" />'.
  72. '<label class="inline" for="'.$k.'">'.$k.'</label></p>'
  73. );
  74. }
  75. buffer::str(
  76. '<p><input type="submit" class="submit" value="'.__('Submit Pings').'" /></p>'.
  77. '</form>'
  78. );
  79. ?>