1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19:
20: 21: 22:
23: if (!function_exists('_')) {
24: function _($s) { return $s; }
25: }
26:
27: class Horde_Test
28: {
29: 30: 31: 32: 33:
34: protected $_phpver;
35:
36: 37: 38: 39: 40:
41: protected $_supported = array(
42: '5.2', '5.3'
43: );
44:
45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:
62: protected $_moduleList = array(
63: 'ctype' => array(
64: 'descrip' => 'Ctype Support',
65: 'error' => 'The ctype functions are required by the help system, the weather portal blocks, and a few Horde applications.'
66: ),
67: 'dom' => array(
68: 'descrip' => 'DOM XML Support',
69: 'error' => 'Horde will not run without the dom extension. Don\'t compile PHP with <code>--disable-all/--disable-dom</code>, or enable the dom extension individually before continuing.',
70: 'fatal' => true
71: ),
72: 'fileinfo' => array(
73: 'descrip' => 'MIME Magic Support (fileinfo)',
74: 'error' => 'The fileinfo PECL module is used to provide MIME Magic scanning on unknown data. See horde/docs/INSTALL for information on how to install PECL extensions.'
75: ),
76: 'fileinfo_check' => array(
77: 'descrip' => 'MIME Magic Support (fileinfo) - Configuration',
78: 'error' => 'The fileinfo module could not open the default MIME Magic database location. You will need to manually specify the MIME Magic database location in the config file.',
79: 'function' => '_checkFileinfo'
80: ),
81: 'ftp' => array(
82: 'descrip' => 'FTP Support',
83: 'error' => 'FTP support is only required if you want to authenticate against an FTP server, upload your configuration files with FTP, or use an FTP server for file storage.'
84: ),
85: 'gd' => array(
86: 'descrip' => 'GD Support',
87: 'error' => 'Horde will use the GD extension to perform manipulations on image data. You can also use either the ImageMagick software or Imagick extension to do these manipulations instead.'
88: ),
89: 'gettext' => array(
90: 'descrip' => 'Gettext Support',
91: 'error' => 'Horde will not run without gettext support. Compile PHP with <code>--with-gettext</code> before continuing.',
92: 'fatal' => true
93: ),
94: 'geoip' => array(
95: 'descrip' => 'GeoIP Support (PECL extension)',
96: 'error' => 'Horde can optionally use the GeoIP extension to provide faster country name lookups.'
97: ),
98: 'hash' => array(
99: 'descrip' => 'Hash Support',
100: 'error' => 'Horde will not run without the hash extension. Don\'t compile PHP with <code>--disable-all/--disable-hash</code>, or enable the hash extension individually before continuing.',
101: 'fatal' => true
102: ),
103: 'iconv' => array(
104: 'descrip' => 'Iconv Support',
105: 'error' => 'If you want to take full advantage of Horde\'s localization features and character set support, you will need the iconv extension.'
106: ),
107: 'iconv_libiconv' => array(
108: 'descrip' => 'GNU Iconv Support',
109: 'error' => 'For best results make sure the iconv extension is linked against GNU libiconv.',
110: 'function' => '_checkIconvImplementation'
111: ),
112: 'intl' => array(
113: 'descrip' => 'Internationalization Support',
114: 'error' => 'Horde requires the intl module to handle Internationalized Domain Names. This module can either be compiled with PHP 5.3.0+ (requires <code>--enable-intl</code>) or can be installed via PECL.'
115: ),
116: 'imagick' => array(
117: 'descrip' => 'Imagick Library',
118: 'error' => 'Horde can make use of the Imagick Library, if it is installed on your system. It is highly recommended to use either ImageMagick\'s convert utility or the Imagick php library for faster results.'
119: ),
120: 'json' => array(
121: 'descrip' => 'JSON Support',
122: 'error' => 'Horde will not run without the json extension. Don\'t compile PHP with <code>--disable-all/--disable-json</code>, or enable the json extension individually before continuing.',
123: 'fatal' => true
124: ),
125: 'ldap' => array(
126: 'descrip' => 'LDAP Support',
127: 'error' => 'LDAP support is only required if you want to use an LDAP server for anything like authentication, address books, or preference storage.'
128: ),
129: 'lzf' => array(
130: 'descrip' => 'LZF Compression Support (PECL extension)',
131: 'error' => 'If the lzf PECL module is available, Horde can compress some cached data in your session to make your session size smaller.'
132: ),
133: 'mbstring' => array(
134: 'descrip' => 'Mbstring Support',
135: 'error' => 'If you want to take full advantage of Horde\'s localization features and character set support, you will need the mbstring extension.'
136: ),
137: 'memcache' => array(
138: 'descrip' => 'memcached Support (memcache) (PECL extension)',
139: 'error' => 'The memcache PECL module is only needed if you are using a memcached server for caching or sessions. See horde/docs/INSTALL for information on how to install PECL/PHP extensions.'
140: ),
141: 'mysql' => array(
142: 'descrip' => 'MySQL Support',
143: 'error' => 'The MySQL extension is only required if you want to use a MySQL database server for data storage.'
144: ),
145: 'openssl' => array(
146: 'descrip' => 'OpenSSL Support',
147: 'error' => 'The OpenSSL extension is required for any kind of S/MIME support.'
148: ),
149: 'pam' => array(
150: 'descrip' => 'PAM Support',
151: 'error' => 'The PAM extension is required to allow PAM authentication to be used.',
152: 'function' => '_checkPam'
153: ),
154: 'pcre' => array(
155: 'descrip' => 'PCRE Support',
156: 'error' => 'Horde will not run without the pcre extension. Don\'t compile PHP with <code>--disable-all/--without-pcre-regex</code>, or enable the pcre extension individually before continuing.',
157: 'fatal' => true
158: ),
159: 'pdo' => array(
160: 'descrip' => 'PDO',
161: 'error' => 'The PDO extension is required if you plan on using a database backend other than mysql or mysqli with Horde_Db.',
162: ),
163: 'pgsql' => array(
164: 'descrip' => 'PostgreSQL Support',
165: 'error' => 'The PostgreSQL extension is only required if you want to use a PostgreSQL database server for data storage.'
166: ),
167: 'session' => array(
168: 'descrip' => 'Session Support',
169: 'fatal' => true
170: ),
171: 'SimpleXML' => array(
172: 'descrip' => 'SimpleXML support',
173: 'error' => 'Horde will not run without the SimpleXML extension. Don\'t compile PHP with <code>--disable-all/--disable-simplexml</code>, or enable the SimpleXML extension individually before continuing.',
174: 'fatal' => true
175: ),
176: 'tidy' => array(
177: 'descrip' => 'Tidy support',
178: 'error' => 'The tidy PHP extension is used to sanitize HTML data.'
179: ),
180: 'xml' => array(
181: 'descrip' => 'XML Parser support',
182: 'error' => 'Horde will not run without the xml extension. Don\'t compile PHP with <code>--disable-all/--without-xml</code>, or enable the xml extension individually before continuing.',
183: 'fatal' => true,
184: 'function' => '_checkLibxmlVersion'
185: ),
186: 'zlib' => array(
187: 'descrip' => 'Zlib Support',
188: 'error' => 'The zlib module is highly recommended for use with Horde. It allows page compression and handling of ZIP and GZ data. Compile PHP with <code>--with-zlib</code> to activate.'
189: )
190: );
191:
192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206:
207: protected $_settingsList = array(
208: 'allow_url_include' => array(
209: 'setting' => false,
210: 'error' => 'This is a security hazard. Horde will attempt to disable automatically, but it is best to manually disable also.'
211: ),
212: 'magic_quotes_runtime' => array(
213: 'setting' => false,
214: 'error' => 'magic_quotes_runtime may cause problems with database inserts, etc. Horde will attempt to disable automatically, but it is best to manually disable also.'
215: ),
216: 'magic_quotes_sybase' => array(
217: 'setting' => false,
218: 'error' => 'magic_quotes_sybase may cause problems with database inserts, etc. Horde will attempt to disable automatically, but it is best to manually disable also.'
219: ),
220: 'memory_limit' => array(
221: 'setting' => 'value',
222: 'error' => 'If PHP\'s internal memory limit is not set high enough Horde will not be able to handle large data items. It is recommended to set the value of memory_limit in php.ini to at least 64M.',
223: 'function' => '_checkMemoryLimit'
224: ),
225: 'register_globals' => array(
226: 'setting' => false,
227: 'error' => 'Register globals has been deprecated in PHP 5. Horde will fatally exit if it is set. Turn it off.'
228: ),
229: 'safe_mode' => array(
230: 'setting' => false,
231: 'error' => 'If safe_mode is enabled, Horde cannot set enviroment variables, which means Horde will be unable to translate the user interface into different languages.'
232: ),
233: 'session.auto_start' => array(
234: 'setting' => false,
235: 'error' => 'Horde won\'t work with automatically started sessions, because it explicitly creates new session when necessary to protect against session fixations.'
236: ),
237: 'session.gc_divisor' => array(
238: 'setting' => 'value',
239: 'error' => 'PHP automatically garbage collects old session information, as long as this setting (and session.gc_probability) are set to non-zero. It is recommended that this value be "10000" or higher (see docs/INSTALL).',
240: 'function' => '_checkGcDivisor'
241: ),
242: 'session.gc_probability' => array(
243: 'setting' => 'value',
244: 'error' => 'PHP automatically garbage collects old session information, as long as this setting (and session.gc_divisor) are set to non-zero. It is recommended that this value be "1".',
245: 'function' => '_checkGcProbability'
246: ),
247: 'session.use_trans_sid' => array(
248: 'setting' => false,
249: 'error' => 'Horde will work with session.use_trans_sid turned on, but you may see double session-ids in your URLs, and if the session name in php.ini differs from the session name configured in Horde, you may get two session ids and see other odd behavior. The URL-rewriting that use_trans_sid does also tends to break XHTML compliance. In short, you should really disable this.'
250: ),
251: 'tidy.clean_output' => array(
252: 'setting' => false,
253: 'error' => 'This will break output of any dynamically created, non-HTML content. Horde will attempt to disable automatically, but it is best to manually disable also.'
254: ),
255: 'zend_accelerator.compress_all' => array(
256: 'setting' => false,
257: 'error' => 'You should not enable output compression unconditionally because some browsers and scripts don\'t work well with output compression. Enable compression in Horde\'s configuration instead, so that we have full control over the conditions where to enable and disable it.'
258: ),
259: 'zend.ze1_compatibility_mode' => array(
260: 'setting' => false,
261: 'error' => 'Unneeded, deprecated PHP 4 compatibility option. Horde will attempt to disable automatically, but it is best to manually disable also.'
262: ),
263: 'zlib.output_compression' => array(
264: 'setting' => false,
265: 'error' => 'You should not enable output compression unconditionally because some browsers and scripts don\'t work well with output compression. Enable compression in Horde\'s configuration instead, so that we have full control over the conditions where to enable and disable it.'
266: )
267: );
268:
269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284:
285: protected $_pearList = array(
286: 'Auth_SASL' => array(
287: 'error' => 'Horde will work without the Auth_SASL class, but if you use Access Control Lists in IMP you should be aware that without this class passwords will be sent to the IMAP server in plain text when retrieving ACLs.'
288: ),
289: 'Cache' => array(
290: 'error' => 'Cache is used by the Services_Weather module on the weather applet/block on the portal page.'
291: ),
292: 'Crypt_Blowfish' => array(
293: 'error' => 'Crypt_Blowfish is required to store authentication credentials securely within the session data.',
294: 'required' => true
295: ),
296: 'Date' => array(
297: 'path' => 'Date/Calc.php',
298: 'error' => 'Horde requires the Date_Calc class for Kronolith to calculate dates.'
299: ),
300: 'HTTP_Request' => array(
301: 'error' => 'Parts of Horde (Jonah, the XML-RPC client/server) use the HTTP_Request library to retrieve URLs and do other HTTP requests.'
302: ),
303: 'HTTP_WebDAV_Server' => array(
304: 'error' => 'The HTTP_WebDAV_Server is required if you want to use the WebDAV interface of Horde, e.g. to access calendars or tasklists with external clients.'
305: ),
306: 'MDB2' => array(
307: 'error' => 'You will need MDB2 if you are using the SQL driver for Shares.',
308: ),
309: 'Net_DNS2' => array(
310: 'error' => 'Net_DNS2 can speed up hostname lookups against broken DNS servers.'
311: ),
312: 'Net_SMTP' => array(
313: 'error' => 'Make sure you are using the Net_SMTP module if you want "smtp" to work as a mailer option.'
314: ),
315: 'Net_Socket' => array(
316: 'error' => 'Make sure you are using a version of PEAR which includes the Net_Socket class, or that you have installed the Net_Socket package seperately. See the INSTALL file for instructions on installing Net_Socket.'
317: ),
318: 'Services_Weather' => array(
319: 'error' => 'Services_Weather is used by the weather applet/block on the portal page.'
320: ),
321: 'XML_Serializer' => array(
322: 'error' => 'XML_Serializer is used by the Services_Weather module on the weather applet/block on the portal page.'
323: )
324: );
325:
326: 327: 328: 329: 330: 331: 332: 333: 334:
335: protected $_fileList = array(
336: 'config/conf.php' => null,
337: );
338:
339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349:
350: protected $_appList = array();
351:
352: 353: 354:
355: public function __construct()
356: {
357:
358: $this->_phpver = $this->_splitPhpVersion(PHP_VERSION);
359:
360:
361: error_reporting(E_ALL);
362:
363:
364: header('Content-type: text/html; charset=UTF-8');
365: header('Vary: Accept-Language');
366: }
367:
368: 369: 370: 371: 372: 373: 374: 375:
376: protected function _splitPhpVersion($version)
377: {
378:
379: if ((strlen($version) >= 3) && ($version[1] == '.')) {
380: $phpver['major'] = substr($version, 0, 3);
381: $version = substr(strtolower($version), 3);
382: } else {
383: $phpver['major'] = $version;
384: $phpver['class'] = 'unknown';
385: return $phpver;
386: }
387:
388: if ($version[0] == '.') {
389: $version = substr($version, 1);
390: }
391:
392: 393:
394: $s = strspn($version, '0123456789');
395: if ($s == 0) {
396: $phpver['subminor'] = $version;
397: $phpver['class'] = 'beta';
398: return $phpver;
399: }
400:
401: 402: 403:
404: $phpver['minor'] = substr($version, 0, $s);
405: if ((strlen($version) > $s) &&
406: (($version[$s] == '.') || ($version[$s] == '-'))) {
407: ++$s;
408: }
409: $phpver['subminor'] = substr($version, $s);
410: if (($phpver['subminor'] == 'cvs') ||
411: ($phpver['subminor'] == 'dev') ||
412: (substr($phpver['subminor'], 0, 2) == 'rc')) {
413: unset($phpver['subminor']);
414: $phpver['class'] = 'dev';
415: } else {
416: if (!$phpver['subminor']) {
417: unset($phpver['subminor']);
418: }
419: $phpver['class'] = 'release';
420: }
421:
422: return $phpver;
423: }
424:
425: 426: 427: 428: 429:
430: public function phpModuleCheck()
431: {
432: $output = '';
433:
434: foreach ($this->_moduleList as $key => $val) {
435: $error_msg = $mod_test = $status_out = $fatal = null;
436: $test_function = null;
437: $entry = array();
438:
439: if (is_array($val)) {
440: $descrip = $val['descrip'];
441: $fatal = !empty($val['fatal']);
442: if (isset($val['phpver']) &&
443: (version_compare(PHP_VERSION, $val['phpver']) == -1)) {
444: $mod_test = true;
445: $status_out = 'N/A';
446: }
447: if (isset($val['error'])) {
448: $error_msg = $val['error'];
449: }
450: if (isset($val['function'])) {
451: $test_function = $val['function'];
452: }
453: } else {
454: $descrip = $val;
455: }
456:
457: if (is_null($status_out)) {
458: if (is_null($test_function)) {
459: $mod_test = extension_loaded($key);
460: } else {
461: $mod_test = call_user_func(array($this, $test_function));
462: if (is_string($mod_test)) {
463: $error_msg = $mod_test;
464: $mod_test = false;
465: }
466: }
467: $status_out = $this->_status($mod_test, $fatal);
468: }
469:
470: $entry[] = $descrip;
471: $entry[] = $status_out;
472:
473: if (!is_null($error_msg) && !$mod_test) {
474: $entry[] = $error_msg;
475: if (!$fatal) {
476: $entry[] = 1;
477: }
478: }
479:
480: $output .= $this->_outputLine($entry);
481:
482: if ($fatal && !$mod_test) {
483: echo $output;
484: exit;
485: }
486: }
487:
488: return $output;
489: }
490:
491: 492: 493: 494: 495:
496: protected function _checkIconvImplementation()
497: {
498: return extension_loaded('iconv') &&
499: in_array(ICONV_IMPL, array('libiconv', 'glibc'));
500: }
501:
502: 503: 504: 505: 506:
507: protected function _checkLibxmlVersion()
508: {
509: if (!extension_loaded('xml')) {
510: return false;
511: }
512: if (LIBXML_VERSION < 20700) {
513: return 'The libxml version is too old. libxml 2.7 or later is required.';
514: }
515: return true;
516: }
517:
518: 519: 520: 521: 522:
523: protected function _checkFileinfo()
524: {
525: if (extension_loaded('fileinfo') &&
526: ($res = @finfo_open())) {
527: finfo_close($res);
528: return true;
529: }
530:
531: return false;
532: }
533:
534: 535:
536: protected function _checkPam()
537: {
538: if (extension_loaded('pam')) {
539: return true;
540: }
541:
542: if (extension_loaded('pam_auth')) {
543: return 'The PAM extension is required to allow PAM authentication to be used. You have an improper PAM extension loaded. Some installations (e.g. Debian, Ubuntu) ship with an altered version of the PAM extension. You must uninstall this extension and reinstall from PECL.';
544: }
545:
546: return false;
547: }
548:
549: 550: 551: 552: 553: 554: 555:
556: public function phpSettingCheck($settings = null)
557: {
558: $output = '';
559:
560: if (is_null($settings)) {
561: $settings = $this->_settingsList;
562: }
563:
564: foreach ($settings as $key => $val) {
565: $entry = array();
566: if (is_bool($val['setting'])) {
567: $result = (ini_get($key) == $val['setting']);
568: $entry[] = $key . ' ' . (($val['setting'] === true) ? 'enabled' : 'disabled');
569: $entry[] = $this->_status($result);
570: if (!$result &&
571: (!isset($val['function']) ||
572: call_user_func(array($this, $val['function'])))) {
573: $entry[] = $val['error'];
574: }
575: } elseif ($val['setting'] == 'value') {
576: $entry[] = $key . ' value';
577: $entry[] = ini_get($key);
578: if (!empty($val['error']) &&
579: (!isset($val['function']) ||
580: call_user_func(array($this, $val['function'])))) {
581: $entry[] = $val['error'];
582: $entry[] = 1;
583: }
584: }
585: $output .= $this->_outputLine($entry);
586: }
587:
588: return $output;
589: }
590:
591: 592: 593: 594: 595:
596: public function pearModuleCheck()
597: {
598: $output = '';
599:
600:
601: ini_set('track_errors', 1);
602:
603:
604: $output .= $this->_outputLine(array("<strong>PEAR Search Path (PHP's include_path)</strong>", ' <tt>' . ini_get('include_path') . '</tt>'));
605:
606:
607: $entry = array();
608: $entry[] = 'PEAR';
609: $entry[] = $this->_status(!isset($php_errormsg));
610: if (isset($php_errormsg)) {
611: $entry[] = 'Check your PHP include_path setting to make sure it has the PEAR library directory.';
612: $output .= $this->_outputLine($entry);
613: ini_restore('track_errors');
614: return $output;
615: }
616: $output .= $this->_outputLine($entry);
617:
618:
619: $succeeded = array();
620: foreach ($this->_pearList as $key => $val) {
621: $entry = array();
622:
623: 624:
625: if (!empty($val['depends']) && empty($succeeded[$val['depends']])) {
626: $result = false;
627: } elseif (empty($val['path'])) {
628: $result = @class_exists($key);
629: } else {
630: $result = @include_once $val['path'];
631: }
632: $error_msg = $val['error'];
633: if ($result && isset($val['function'])) {
634: $func_output = call_user_func(array($this, $val['function']));
635: if ($func_output) {
636: $result = false;
637: $error_msg = $func_output;
638: }
639: }
640: $entry[] = $key;
641: $entry[] = $this->_status($result, !empty($val['required']));
642:
643: if ($result) {
644: $succeeded[$key] = true;
645: } else {
646: if (!empty($val['required'])) {
647: $error_msg .= ' THIS IS A REQUIRED MODULE!';
648: }
649: $entry[] = $error_msg;
650: if (empty($val['required'])) {
651: $entry[] = 1;
652: }
653: }
654:
655: $output .= $this->_outputLine($entry);
656: }
657:
658:
659: ini_restore('track_errors');
660:
661: return $output;
662: }
663:
664: 665: 666: 667: 668:
669: protected function _checkMemoryLimit()
670: {
671: $memlimit = trim(ini_get('memory_limit'));
672: switch (strtolower(substr($memlimit, -1))) {
673: case 'g':
674: $memlimit *= 1024;
675:
676:
677: case 'm':
678: $memlimit *= 1024;
679:
680:
681: case 'k':
682: $memlimit *= 1024;
683:
684: }
685:
686: return ($memlimit < 67108864);
687: }
688:
689: 690: 691: 692: 693:
694: protected function _checkGcDivisor()
695: {
696: return (ini_get('session.gc_divisor') < 10000);
697: }
698:
699: 700: 701: 702: 703:
704: protected function _checkGcProbability()
705: {
706: return !(ini_get('session.gc_probability') &&
707: ini_get('session.gc_divisor'));
708: }
709:
710: 711: 712: 713: 714:
715: public function requiredFileCheck()
716: {
717: $output = '';
718: $filedir = $GLOBALS['registry']->get('fileroot');
719:
720: foreach ($this->_fileList as $key => $val) {
721: $entry = array();
722: $result = file_exists($filedir . '/' . $key);
723:
724: $entry[] = $key;
725: $entry[] = $this->_status($result);
726:
727: if (!$result) {
728: if (empty($val)) {
729: $text = 'The file <code>' . $key . '</code> appears to be missing.';
730: if ($key == 'config/conf.php') {
731: $text .= ' You need to login to Horde as an administrator and create the initial configuration file.';
732: } else {
733: $text .= ' You probably just forgot to copy <code>' . $key . '.dist</code> over. While you do that, take a look at the settings and make sure they are appropriate for your site.';
734: }
735:
736: $entry[] = $text;
737: } else {
738: $entry[] = $val;
739: }
740: }
741:
742: $output .= $this->_outputLine($entry);
743: }
744:
745: return $output;
746: }
747:
748: 749: 750: 751: 752:
753: public function requiredAppCheck()
754: {
755: $output = '';
756:
757: $horde_apps = $GLOBALS['registry']->listApps(null, true, null);
758:
759: foreach ($this->_appList as $key => $val) {
760: $entry = array();
761: $entry[] = $key;
762:
763: if (!isset($horde_apps[$key])) {
764: $entry[] = $this->_status(false, false);
765: $entry[] = $val['error'];
766: $entry[] = 1;
767: } else {
768:
769: $origver = $GLOBALS['registry']->getVersion($key);
770: $appver = preg_replace('/(H\d) \((.*)\)/', '$2', str_replace('-git', '', $origver));
771: if (version_compare($val['version'], $appver) === 1) {
772: $entry[] = $this->_status(false, false) . ' (Have version: ' . $origver . '; Need version: ' . $val['version'] . ')';
773: $entry[] = $val['error'];
774: $entry[] = 1;
775: } else {
776: $entry[] = $this->_status(true) . ' (Version: ' . $origver . ')';
777: }
778: }
779: $output .= $this->_outputLine($entry);
780: }
781:
782: return $output;
783: }
784:
785: 786: 787: 788: 789:
790: public function getPhpVersionInformation()
791: {
792: $output = new stdClass;
793: $vers_check = true;
794:
795: $testscript = Horde::selfUrl(true);
796: $output->phpinfo = $testscript->copy()->add('mode', 'phpinfo');
797: $output->extensions = $testscript->copy()->add('mode', 'extensions');
798: $output->version = PHP_VERSION;
799: $output->major = $this->_phpver['major'];
800: if (isset($this->_phpver['minor'])) {
801: $output->minor = $this->_phpver['minor'];
802: }
803: if (isset($this->_phpver['subminor'])) {
804: $output->subminor = $this->_phpver['subminor'];
805: }
806: $output->class = $this->_phpver['class'];
807:
808: $output->status_color = 'red';
809: if ($output->major < '5.2') {
810: $output->status = 'This version of PHP is not supported. You need to upgrade to a more recent version.';
811: $vers_check = false;
812: } elseif (in_array($output->major, $this->_supported)) {
813: $output->status = 'You are running a supported version of PHP.';
814: $output->status_color = 'green';
815: } else {
816: $output->status = 'This version of PHP has not been fully tested with this version of Horde.';
817: $output->status_color = 'orange';
818: }
819:
820: if (!$vers_check) {
821: $output->version_check = 'Horde requires PHP 5.2.0 or greater.';
822: }
823:
824: return $output;
825: }
826:
827: 828: 829: 830: 831: 832: 833: 834:
835: protected function _status($bool, $required = true)
836: {
837: if ($bool) {
838: return '<strong style="color:green">Yes</strong>';
839: } elseif ($required) {
840: return '<strong style="color:red">No</strong>';
841: }
842:
843: return '<strong style="color:orange">No</strong>';
844: }
845:
846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858:
859: protected function _outputLine($entry)
860: {
861: $output = '<li>' . array_shift($entry) . ': ' . array_shift($entry);
862: if (!empty($entry)) {
863: $msg = array_shift($entry);
864: $output .= '<br /><strong style="color:' . (empty($entry) || !array_shift($entry) ? 'red' : 'orange') . '">' . $msg . "</strong>\n";
865: }
866:
867: return $output . "</li>\n";
868: }
869:
870: 871: 872: 873: 874:
875: public function appTests()
876: {
877:
878: $upload_check = $this->phpSettingCheck(array(
879: 'file_uploads' => array(
880: 'error' => 'file_uploads must be enabled for some features like sending emails with IMP.',
881: 'setting' => true
882: )
883: ));
884: $upload_tmp_dir = ($dir = ini_get('upload_tmp_dir'))
885: ? '<li>upload_tmp_dir: <strong style="color:"' . (is_writable($dir) ? 'green' : 'red') . '">' . $dir . '</strong></li>'
886: : '';
887:
888: $ret = '<h1>File Uploads</h1><ul>' .
889: $upload_check .
890: $upload_tmp_dir .
891: '<li>upload_max_filesize: ' . ini_get('upload_max_filesize') . '</li>'.
892: '<li>post_max_size: ' . ini_get('post_max_size') . '<br />' .
893: 'This value should be several times the expect largest upload size (notwithstanding any upload limits present in an application). Any upload that exceeds this size will cause any state information sent along with the uploaded data to be lost. This is a PHP limitation and can not be worked around.'.
894: '</li></ul>';
895:
896:
897: $ret .= '<h1>Local File Permissions</h1><ul>' .
898: '<li>Is <tt>' . htmlspecialchars(HORDE_BASE) . '/static</tt> writable by the web server user? ';
899: $ret .= is_writable(HORDE_BASE . '/static')
900: ? '<strong style="color:green">Yes</strong>'
901: : "<strong style=\"color:red\">No</strong><br /><strong style=\"color:orange\">If caching javascript and CSS files by storing them in static files (HIGHLY RECOMMENDED), this directory must be writable as the user the web server runs as.</strong>";
902:
903: if (extension_loaded('imagick')) {
904: $im = new Imagick();
905: $imagick = is_callable(array($im, 'getIteratorIndex'));
906: $ret .= '</li></ul><h1>Imagick</h1><ul>' .
907: '<li>Imagick compiled against current ImageMagick version: ' . ($imagick ? 'Yes' : 'No');
908: }
909:
910: return $ret . '</li></ul>';
911: }
912:
913: }
914: