/wp-content/plugins/postie/postie_test.php

https://bitbucket.org/rchlmrtn/chiari · PHP · 107 lines · 97 code · 9 blank · 1 comment · 24 complexity · bf9dc12355bc39970988771119e95909 MD5 · raw file

  1. <?php
  2. // try to connect to server with different protocols/ and userids
  3. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
  4. include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . "wp-config.php");
  5. require_once("postie-functions.php");
  6. $config = config_Read();
  7. extract($config);
  8. $title = __("Postie Diagnosis");
  9. $parent_file = 'options-general.php?page=postie/postie.php';
  10. get_currentuserinfo();
  11. if (!current_user_can('manage_options')) {
  12. LogInfo("non-admin tried to set options");
  13. echo "<h2> Sorry only admin can run this file</h2>";
  14. exit();
  15. }
  16. DebugEcho("Error log: " . ini_get('error_log'));
  17. $images = array("Test.png", "Test.jpg", "Test.gif");
  18. ?>
  19. <div class="wrap">
  20. <h1>Postie Configuration Test</h1>
  21. <?php
  22. if (isMarkdownInstalled()) {
  23. ?>
  24. <h1>Warning!</h1>
  25. <p>You currently have the Markdown plugin installed. It will cause problems if you send in HTML
  26. email. Please turn it off if you intend to send email using HTML</p>");
  27. <?php
  28. }
  29. if (!isPostieInCorrectDirectory()) {
  30. EchoInfo("Warning! Postie expects to be in its own directory named postie.");
  31. } else {
  32. EchoInfo("Postie is in " . dirname(__FILE__));
  33. }
  34. ?>
  35. <br/>
  36. <h2>International support</h2>
  37. <?php
  38. if (HasIconvInstalled()) {
  39. EchoInfo("iconv: installed");
  40. } else {
  41. EchoInfo("Warning! Postie requires that iconv be enabled.");
  42. }
  43. if (function_exists('imap_mime_header_decode')) {
  44. EchoInfo("imap: installed");
  45. } else {
  46. EchoInfo("Warning! Postie requires that imap be enabled.");
  47. }
  48. if (HasMbStringInstalled()) {
  49. EchoInfo("mbstring: installed");
  50. } else {
  51. EchoInfo("Warning! Postie requires that mbstring be enabled.");
  52. }
  53. ?>
  54. <h2>Clock Tests</h2>
  55. <p>This shows what time it would be if you posted right now</p>
  56. <?php
  57. $content = "";
  58. $data = filter_Delay($content);
  59. EchoInfo("GMT: $data[1]");
  60. EchoInfo("Current: $data[0]");
  61. ?>
  62. <h2>Connect to Mail Host</h2>
  63. <?php
  64. if (!$mail_server || !$mail_server_port || !$mail_userid) {
  65. EchoInfo("NO - check server settings");
  66. }
  67. switch (strtolower($config["input_protocol"])) {
  68. case 'imap':
  69. case 'imap-ssl':
  70. case 'pop3-ssl':
  71. if (!HasIMAPSupport()) {
  72. EchoInfo("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
  73. } else {
  74. require_once("postieIMAP.php");
  75. $mail_server = &PostieIMAP::Factory($config["input_protocol"]);
  76. if (!$mail_server->connect($config["mail_server"], $config["mail_server_port"], $config["mail_userid"], $config["mail_password"])) {
  77. EchoInfo("Unable to connect. The server said:");
  78. EchoInfo($mail_server->error());
  79. } else {
  80. EchoInfo("Successful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
  81. EchoInfo("# of waiting messages: " . $mail_server->getNumberOfMessages());
  82. }
  83. }
  84. break;
  85. case 'pop3':
  86. default:
  87. require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
  88. $pop3 = &new POP3();
  89. if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
  90. EchoInfo("Unable to connect. The server said:");
  91. EchoInfo($pop3->ERROR);
  92. } else {
  93. EchoInfo("Sucessful " . strtoupper($config['input_protocol']) . " connection on port {$config["mail_server_port"]}");
  94. }
  95. break;
  96. }
  97. ?>
  98. </div>