-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpostie_test.php
218 lines (196 loc) · 7.06 KB
/
postie_test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
// try to connect to server with different protocols/ and userids
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR ."postie-functions.php");
include_once (dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR. "wp-config.php");
require_once('admin.php');
require_once("postie-functions.php");
$config = GetConfig();
$title = __("Postie Diagnosis");
$parent_file = 'options-general.php?page=postie/postie.php';
get_currentuserinfo();
?>
<?php if ($GLOBALS["user_level"] != 10 ) :?>
<h2> Sorry only admin can run this file</h2>
<?php exit();?>
<?php endif;?>
<?
$images = array("Test.png",
"Test.jpg",
"Test.gif");
?>
<div class="wrap">
<h1>Postie Configuration Test</h1>
<?php
if (TestForMarkdown()) {
print("<h1>Warning!</h1>
<p>You currently have the Markdown plugin installed. It will cause problems if you send in HTML
email. Please turn it off if you intend to send email using HTML</p>");
}
?>
<br/>
<?php
if (!TestWPVersion()) {
print("<h1>Warning!</h1>
<p>Postie only works on on Word Press version 2.0 and above</p>");
exit();
}
?>
<br/>
<?php
if (!TestPostieDirectory()) {
print("<h1>Warning!</h1>
<p>Postie expects to be in its own directory named postie.</p>");
}
else {
print("<p>Postie is in ".dirname(__FILE__)."</p>");
}
?>
<br/>
<h2>GD Library Test<h2>
<p>
<?= HasGDInstalled();?>
</p>
<h2>Iconv Library Test<h2>
<p><i>Only required if you want to support ISO-2022-JP</i>
<?= HasIconvInstalled();?>
</p>
<br/>
<h2>Clock Tests<h2>
<p>This shows what time it would be if you posted right now</p>
<?php
$content ="";
$data = DeterminePostDate($content);
?>
<p><?php print("GMT:". $data[1]);?></p>
<p><?php print("Current:". $data[0]);?></p>
<h2>Mail Tests</h2>
<p>These try to confirm that the email configuration is correct.</p>
<table>
<tr>
<th>Test</th>
<th>Result</th>
</tr>
<tr>
<th>Connect to Mail Host</th>
<td>
<?php
switch( strtolower($config["INPUT_PROTOCOL"]) ) {
case 'imap':
case 'imap-ssl':
case 'pop3-ssl':
if (!HasIMAPSupport()) {
print("Sorry - you do not have IMAP php module installed - it is required for this mail setting.");
}
else {
require_once("postieIMAP.php");
$mail_server = &PostieIMAP::Factory($config["INPUT_PROTOCOL"]);
if (!$mail_server->connect($config["MAIL_SERVER"], $config["MAIL_SERVER_PORT"],$config["MAIL_USERID"],$config["MAIL_PASSWORD"])) {
print("Unable to connect. The server said - ".$mail_server->error());
print("<br/>Try putting in your full email address as a userid and try again.");
}
else {
print("Yes");
}
}
break;
case 'pop3':
default:
require_once(ABSPATH.WPINC.DIRECTORY_SEPARATOR.'class-pop3.php');
$pop3 = &new POP3();
if (!$pop3->connect($config["MAIL_SERVER"], $config["MAIL_SERVER_PORT"])) {
print("Unable to connect. The server said - ".$pop3->ERROR);
print("<br/>Try putting in your full email address as a userid and try again.");
}
else {
print("Yes");
}
break;
}
?>
</td>
</tr>
</table>
<h2>File Tests</h2>
<table>
<tr>
<th>Test</th>
<th>Result</th>
</tr>
<tr>
<th>Photos Directory Exists</th>
<td><?php echo (is_dir($config["REALPHOTOSDIR"]) ? "Yes" : "No"); ?></td>
</tr>
<tr>
<th>Files Directory Exists</th>
<td><?php echo (is_dir($config["REALFILESDIR"]) ? "Yes" : "No"); ?></td>
</tr>
<tr>
<th>Photos Directory Writable</th>
<td><?php echo (is_writable($config["REALPHOTOSDIR"]) ? "Yes" : "No"); ?></td>
</tr>
<tr>
<th>Files Directory Writable</th>
<td><?php echo (is_writable($config["REALFILESDIR"]) ? "Yes" : "No"); ?></td>
</tr>
<?php if ($config["USE_IMAGEMAGICK"]):?>
<tr>
<th>Convert exists</th>
<td><?php echo (file_exists($config["IMAGEMAGICK_CONVERT"]) ? "Yes" : "No"); ?></td>
</tr>
<tr>
<th>Identify exists</th>
<td><?php echo (file_exists($config["IMAGEMAGICK_IDENTIFY"]) ? "Yes" : "No"); ?></td>
</tr>
<?endif;?>
</table>
<h2>Image Tests</h2>
<p>Three images should be here - they are the test files</p>
<table>
<tr>
<td> </td>
<td>PNG</td>
<td>JPG</td>
<td>GIF</td>
</tr>
<tr>
<th>Plain Images</th>
<?php
foreach ($images as $image) {
$size = DetermineImageSize(POSTIE_ROOT . DIRECTORY_SEPARATOR . "test_files" . DIRECTORY_SEPARATOR .$image);
print("<td>$size[1] x $size[0]<br/>\n");
print("<img src='../wp-content/plugins/postie/test_files/$image' ></td>\n");
}
?>
</tr>
<tr>
<?php if($config["AUTO_SMART_SHARP"]){ ?>
<th> AutoSharpened <br/><p>WARNING-This feature takes a lot of processing power</p></th>
<?php
foreach ($images as $image) {
print("<td>");
ImageMagickSharpen(POSTIE_ROOT . DIRECTORY_SEPARATOR . "test_files" . DIRECTORY_SEPARATOR .$image,
$config["REALPHOTOSDIR"] ."Sharp-".$image);
print("<img src='".$config["URLPHOTOSDIR"]."/Sharp-".$image."'>");
print("</td>\n");
}
?>
</tr>
<?php }?>
<tr>
<th> Scaled & Rotated</th>
<?php
foreach ($images as $image) {
$result = ResizeImage(POSTIE_ROOT . DIRECTORY_SEPARATOR . "test_files" . DIRECTORY_SEPARATOR .$image,substr($image,-3,3));
RotateImages(90,array(
array(null,$config["REALPHOTOSDIR"] . $result[0],'jpg')
));
print("<td>");
$size = DetermineImageSize($config["REALPHOTOSDIR"] . DIRECTORY_SEPARATOR .$result[0]);
print("$size[1] x $size[0]<br\>\n");
print("<img src='".$config["URLPHOTOSDIR"].$result[0]."'>");
print("</td>\n");
}
?>
</tr>
</table>
</div>