<?php

error_reporting(E_ALL );

$phplib=getenv("SURGEMAIL_ROOT")."/phplib";
$cal_log="cal.log";
require_once "$phplib/netwin_v3/debug.php";
dbg_init($cal_log);

dbg("NETWIN NetWin Info Test BEGIN");


print("<html><body>");
print("<h2>TEST of NetWin Calendaring PHP Environment</h2>");
print("<p>NetWin Test for PHP, SabreDAV, and other related implementation:");

print("<blockquote>SERVER_NAME = ".getenv("SERVER_NAME")."</blockquote>");
print("<blockquote>Debug log file = ".getenv("PATH_TRANSLATED")."/$cal_log</blockquote>");
print("<blockquote>SabreDAV root = $phplib/".getenv("SABRE_VERSION")."</blockquote>");

print("<p>PHP ENVIRONMENT:<br>");
print("<blockquote>PHP version = ".PHP_VERSION."</blockquote>");

print("<blockquote>");
if(extension_loaded('imap')){
    print('IMAP module = <span style="color:green;">INSTALLED</span><br>');
} else {
    print('IMAP module = <span style="color:red;">NEEDS TO BE INSTALLED</span> <br> eg. "apt-get install php-imap"<br>');
}
if(extension_loaded('pdo')){
    print('PDO database module = <span style="color:green;">INSTALLED</span><br>');
} else {
    print('PDO database module = <span style="color:red;">NEEDS TO BE INSTALLED</span><br>');
}
if(extension_loaded('pdo_sqlite')){
    print('PDO_SQLITE database module = <span style="color:green;">INSTALLED</span><br>');
} else {
    print('PDO_SQLITE database module = <span style="color:red;">NEEDS TO BE INSTALLED</span><br>');
}
if(extension_loaded('mbstring')){
    print('MBSTRING module = <span style="color:green;">INSTALLED</span><br>');
} else {
    print('MBSTRING module = <span style="color:red;">NEEDS TO BE INSTALLED</span><br>');
}
if(extension_loaded('dom')){
    print('XML (DOM) module = <span style="color:green;">INSTALLED</span><br>');
} else {
    print('XML (DOM) module = <span style="color:red;">NEEDS TO BE INSTALLED</span><br>');
}
print("</blockquote>");
$loaded_modules = get_loaded_extensions();
print("<blockquote>Total of ".count($loaded_modules)." Modules loaded: <pre>");
foreach($loaded_modules as $module){
    print("MODULE = $module\n");
}
print("</pre></blockquote>");


print("</body></html>");

dbg("NETWIN NetWin Info Test END");
