// Arno Esterhuizen // and Romain Bourdon // and Hervé Leclerc // Icons by Mark James // Version 2.5 -> 3.2.6 by Dominique Ottello aka Otomatic $server_dir = "../"; require $server_dir.'scripts/config.inc.php'; require $server_dir.'scripts/wampserver.lib.php'; //path to alias files $aliasDir = $server_dir.'alias/'; //Works if you have ServerSignature On and ServerTokens Full in httpd.conf $server_software = $_SERVER['SERVER_SOFTWARE']; $error_content = ''; // we get the versions of the applications $phpVersion = $wampConf['phpVersion']; $apacheVersion = $wampConf['apacheVersion']; $doca_version = 'doca'.substr($apacheVersion,0,3); $mysqlVersion = $wampConf['mysqlVersion']; //We get the value of VirtualHostMenu $VirtualHostMenu = $wampConf['VirtualHostSubMenu']; //we get the value of apachePortUsed $port = $wampConf['apachePortUsed']; $UrlPort = $port !== "80" ? ":".$port : ''; //We get the value(s) of the listening ports in Apache $ListenPorts = implode(' - ',listen_ports($c_apacheConfFile)); //We get the value of mysqlPortUsed $Mysqlport = $wampConf['mysqlPortUsed']; //Directories to ignore in projects $projectsListIgnore = array ('.','..','wampthemes','wamplangues'); //Search for available themes $styleswitcher = ''."\n"; //Displaying phpinfo if(isset($_GET['phpinfo'])) { $type_info = intval(trim($_GET['phpinfo'])); if($type_info < -1 || $type_info > 64) $type_info = -1; phpinfo($type_info); exit(); } //Displaying xdebug_info(); $xdebug_info = ''; if(function_exists('xdebug_info')) { if(isset($_GET['xdebuginfo'])) { xdebug_info(); exit(); } $xdebug_info = '
  • xdebug_info()
  • '; } // Language $langue = $wampConf['language']; $i_langues = glob('wamplangues/index_*.php'); $languages = array(); foreach($i_langues as $value) { $languages[] = str_replace(array('wamplangues/index_','.php'), '', $value); } $langueget = (!empty($_GET['lang']) ? strip_tags(trim($_GET['lang'])) : ''); if(in_array($langueget,$languages)) $langue = $langueget; // Search for available languages $langueswitcher = '
    '; include 'wamplangues/index_english.php'; if(file_exists('wamplangues/index_'.$langue.'.php')) { $langue_temp = $langues; include 'wamplangues/index_'.$langue.'.php'; $langues = array_merge($langue_temp, $langues); } // MySQL retrieval if supported $nbDBMS = 0; $MySQLdb = ''; if(isset($wampConf['SupportMySQL']) && $wampConf['SupportMySQL'] =='on') { $nbDBMS++; $defaultDBMSMySQL = ($wampConf['mysqlPortUsed'] == '3306') ? " - ".$langues['defaultDBMS'] : ""; $MySQLdb = <<< EOF
    {$langues['versm']}
    ${mysqlVersion} - {$langues['mysqlportUsed']}{$Mysqlport}{$defaultDBMSMySQL} -  {$langues['documentation-of']} MySQL
    EOF; } // MariaDB retrieval if supported $MariaDB = ''; if(isset($wampConf['SupportMariaDB']) && $wampConf['SupportMariaDB'] =='on') { $nbDBMS++; $defaultDBMSMaria = ($wampConf['mariaPortUsed'] == '3306') ? " - ".$langues['defaultDBMS'] : ""; $MariaDB = <<< EOF
    {$langues['versmaria']}
    ${c_mariadbVersion} - {$langues['mariaportUsed']}{$wampConf['mariaPortUsed']}{$defaultDBMSMaria} -  {$langues['documentation-of']} MariaDB
    EOF; } /* Help MySQL - MariaDB popup */ $popupLink = ''; if($nbDBMS > 1) { $popupLink = <<< EOF - MySQL - MariaDB{$langues['HelpMySQLMariaDB']} EOF; } //Default DBMS in first position if(empty($defaultDBMSMySQL)) $DBMSTypes = $MariaDB.str_replace('',$popupLink.'',$MySQLdb); else $DBMSTypes = $MySQLdb.str_replace('',$popupLink.'',$MariaDB); // No Database Mysql System $noDBMS = (empty($MySQLdb) && empty($MariaDB)) ? true : false; $aliasContents = ''; // alias retrieval GetPhpMyAdminVersions(); if(is_dir($aliasDir)) { $handle=opendir($aliasDir); while (false !== ($file = readdir($handle))) { if(is_file($aliasDir.$file) && strstr($file, '.conf')) { $href = $file = str_replace('.conf','',$file); if(stripos($file,'phpmyadmin') !== false || stripos($file,'adminer') !== false) { if(!$noDBMS) { if(stripos($file,'phpmyadmin') !== false) { foreach($phpMyAdminAlias as $key => $value) { if($phpMyAdminAlias[$key]['alias'] == $file) { $href = $phpMyAdminAlias[$key]['alias']; $file = 'PhpMyAdmin '.$phpMyAdminAlias[$key]['version']; $aliasContents .= '
  • '.$file.'
  • '; if($phpMyAdminAlias[$key]['compat'] !== true) { $aliasContents .= '
  • '.$phpMyAdminAlias[$key]['notcompat'].'
  • '; } } } } else { $aliasContents .= '
  • '.$file.'
  • '; } } } elseif(stripos($file,'phpsysinfo') === false){ $aliasContents .= '
  • '.$file.'
  • '; } } } closedir($handle); } if(empty($aliasContents)) $aliasContents = "
  • ".$langues['txtNoAlias']."
  • \n"; $phpsysinfo = file_exists($aliasDir.'phpsysinfo.conf') ? '
  • PhpSysInfo
  • ' : ''; //Retrieving ServerName from httpd-vhosts.conf $addVhost = "
  • ".$langues['txtAddVhost']."
  • "; if($VirtualHostMenu == "on") { $vhostError = false; $vhostErrorCorrected = true; $error_message = array(); $allToolsClass = "four-columns"; $virtualHost = check_virtualhost(); $vhostsContents = ''; if($virtualHost['include_vhosts'] === false) { $vhostsContents = "
  • Error Include Apache
  • "; $vhostError = true; $error_message[] = sprintf($langues['txtNoIncVhost'],$wampConf['apacheVersion']); } else { if($virtualHost['vhosts_exist'] === false) { $vhostsContents = "
  • No vhosts file
  • "; $vhostError = true; $error_message[] = sprintf($langues['txtNoVhostFile'],$virtualHost['vhosts_file']); } else { if($virtualHost['nb_Server'] > 0) { $port_number = true; $nb_Server = $virtualHost['nb_Server']; $nb_Virtual = $virtualHost['nb_Virtual']; $nb_Document = $virtualHost['nb_Document']; $nb_Directory = $virtualHost['nb_Directory']; $nb_End_Directory = $virtualHost['nb_End_Directory']; foreach($virtualHost['ServerName'] as $key => $value) { if($virtualHost['ServerNameValid'][$value] === false) { $vhostError = true; $vhostErrorCorrected = false; $vhostsContents .= '
  • '.$value.' - syntax error
  • '; $error_message[] = sprintf($langues['txtServerName'],"".$value."",$virtualHost['vhosts_file']); } elseif($virtualHost['ServerNameValid'][$value] === true) { $UrlPortVH = ($virtualHost['ServerNamePort'][$value] != '80') ? ':'.$virtualHost['ServerNamePort'][$value] : ''; if(!$virtualHost['port_listen'] && $virtualHost['ServerNamePortListen'][$value] !== true || $virtualHost['ServerNamePortApacheVar'][$value] !== true) { $value_url = ((strpos($value, ':') !== false) ? strstr($value,':',true) : $value); $vhostsContents .= '
  • '.$value_url.$UrlPortVH.' - Not a Listen port
  • '; if($virtualHost['ServerNamePortListen'][$value] !== true) $msg_error = ' not an Apache Listen port'; elseif($virtualHost['ServerNamePortApacheVar'][$value] !== true) $msg_error = ' not an Apache define variable'; if(!$vhostError) { $vhostError = true; $vhostErrorCorrected = false; $error_message[] = "Port ".$UrlPortVH." used for the VirtualHost is ".$msg_error; } } elseif($virtualHost['ServerNameIp'][$value] !== false) { $vh_ip = $virtualHost['ServerNameIp'][$value]; if($virtualHost['ServerNameIpValid'][$value] !== false) { $vhostsContents .= '
  • '.$vh_ip.' ('.$value.')
  • '; } else { $vhostError = true; $vhostErrorCorrected = false; $vhostsContents .= '
  • '.$vh_ip.' for '.$value.' - IP not valid
  • '; $error_message[] = sprintf($langues['txtServerNameIp'],"".$vh_ip."","".$value."",$virtualHost['vhosts_file']); } } elseif($virtualHost['DocRootNotwww'][$value] === false) { $vhostError = true; $vhostErrorCorrected = false; $vhostsContents .= '
  • '.$value.' - DocumentRoot error
  • '; $error_message[] = sprintf($langues['txtDocRoot'],"".$value."","".$wwwDir.""); } elseif($virtualHost['ServerNameDev'][$value] === true) { $vhostError = true; $vhostErrorCorrected = false; $vhostsContents .= '
  • '.$value.' - TLD error
  • '; $error_message[] = sprintf($langues['txtTLDdev'],"".$value."",".dev"); } elseif($virtualHost['ServerNameIntoHosts'][$value] === false) { $vhostError = true; $vhostErrorCorrected = false; $vhostsContents .= '
  • '.$value.' - hosts file error
  • '; $error_message[] = sprintf($langues['txtNoHosts'],"".$value.""); } else { $value_url = ((strpos($value, ':') !== false) ? strstr($value,':',true) : $value); $valueaff = ($virtualHost['ServerNameIDNA'][$value] === true) ? "

    IDNA-> ".$virtualHost['ServerNameUTF8'][$value]."

    " : ''; $vhostsContents .= '
  • '.$value.''.$valueaff.'
  • '; } } else { $vhostError = true; $error_message[] = sprintf($langues['txtVhostNotClean'],$virtualHost['vhosts_file']); } } //Check number of ".$value."", "DocumentRoot", $virtualHost['vhosts_file']); break; } } } //Check validity of Directory Path if($virtualHost['directory'] === false) { foreach($virtualHost['directoryPath'] as $value) { if($virtualHost['directoryPathValid'][$value] === false) { $documentPathError = $value; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtNoPath'],"".$value."", "<Directory ...", $virtualHost['vhosts_file']); break; } } } //Check number of to number of ServerName if($nb_Server != $nb_Virtual && $wampConf['NotCheckDuplicate'] == 'off') { $port_number = false; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtNbNotEqual'],"<VirtualHost","ServerName",$virtualHost['vhosts_file']); } //Check number of port definition of equals to number of ServerName if($virtualHost['nb_Virtual_Port'] != $nb_Virtual && $wampConf['NotCheckDuplicate'] == 'off') { $port_number = false; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtNbNotEqual'],"port definition of <VirtualHost *:xx>","ServerName",$virtualHost['vhosts_file']); } //Check validity of port number if($port_number && $virtualHost['port_number'] === false) { $port_number = false; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtPortNumber'],"<VirtualHost *:port>",$virtualHost['vhosts_file']); } //Check if duplicate ServerName if($virtualHost['nb_duplicate'] > 0) { $DuplicateNames = ''; foreach($virtualHost['duplicate'] as $NameValue) $DuplicateNames .= " ".$NameValue; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = "Duplicate ServerName ".$DuplicateNames." into ".$virtualHost['vhosts_file']; } //Check if duplicate Server IP if($virtualHost['nb_duplicateIp'] > 0) { $DuplicateNames = ''; foreach($virtualHost['duplicateIp'] as $NameValue) $DuplicateNames .= " ".$NameValue; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = "Duplicate IP ".$DuplicateNames." into ".$virtualHost['vhosts_file']; } } } } if(empty($vhostsContents)) { $vhostsContents = "
  • No VirtualHost
  • "; $vhostError = true; $error_message[] = sprintf($langues['txtNoVhost'],$wampConf['apacheVersion']); } if(!$c_hostsFile_writable){ $vhostError = true; $error_message[] = sprintf($langues['txtNotWritable'],$c_hostsFile)."
    ".nl2br($WarningMsg); } if($vhostError) { $vhostsContents .= "
  • Error(s) See below
  • "; $error_content .= "

    "; foreach($error_message as $value) { $error_content .= $value."
    "; } $error_content .= "

    \n"; if($vhostErrorCorrected) $addVhost = "
  • ".$langues['txtAddVhost']." ".$langues['txtCorrected']."
  • "; } } else { $allToolsClass = "three-columns"; } //End retrieving ServerName from httpd-vhosts.conf // Project recovery $handle=opendir("."); $projectContents = ''; while (false !== ($file = readdir($handle))) { if(is_dir($file) && !in_array($file,$projectsListIgnore)){ $projectContents .= ($wampConf['LinksOnProjectsHomePage'] == 'on') ? "
  • ".$file."
  • " : '
  • '.$file.'
  • '; } } closedir($handle); if(empty($projectContents)) $projectContents = "
  • ".$langues['txtNoProjet']."
  • \n"; else { if($wampConf['LinksOnProjectsHomePage'] == 'off' && strpos($projectContents,"http://localhost/") !== false) { $projectContents .= "
  • Warning: See below
  • "; if(!isset($error_content)) $error_content = ''; $error_content .= "

    ".sprintf($langues['nolocalhost'],$wampConf['apacheVersion'])."

    "; } else { $projectContents .= "
  • ".sprintf($langues['txtProjects'],$wwwDir)."
  • "; } } //initialisation $phpExtContents = ''; // Retrieving PHP extensions $loaded_extensions = get_loaded_extensions(); // alphabetical order of extensions setlocale(LC_ALL,"{$langues['locale']}"); sort($loaded_extensions,SORT_LOCALE_STRING); foreach ($loaded_extensions as $extension) $phpExtContents .= "
  • ${extension}
  • "; //Miscellaneous checks - Which php.ini is loaded? $phpini = strtolower(trim(str_replace("\\","/",php_ini_loaded_file()))); $c_phpConfFileOri = strtolower($c_phpVersionDir.'/php'.$wampConf['phpVersion'].'/'.$phpConfFileForApache); $c_phpCliConf = strtolower($c_phpVersionDir.'/php'.$wampConf['phpVersion'].'/'.$wampConf['phpConfFile']); if($phpini != strtolower($c_phpConfFile) && $phpini != $c_phpConfFileOri) { $error_content .= "

    *** ERROR *** The PHP configuration loaded file is: ".$phpini." - should be: ".$c_phpConfFile." or ".$c_phpConfFileOri; $error_content .= "
    You must perform: Right-click icon Wampmanager -> Refresh
    "; if($phpini == $c_phpCliConf || $phpini == $c_phpCliConfFile) $error_content .= " - This file is only for PHP in Command Line."; $error_content .= "

    "; } if($filelist = php_ini_scanned_files()) { if(strlen($filelist) > 0) { $error_content .= "

    *** ERROR *** There are too many php.ini files

    "; $files = explode(',', $filelist); foreach ($files as $file) { $error_content .= "

    *** ERROR *** There are other php.ini files: ".trim(str_replace("\\","/",$file))."

    "; } } } $pageContents = <<< EOPAGE {$langues['titreHtml']}

    {$langues['titreConf']}

    {$langues['versa']}
    ${apacheVersion}  - {$langues['documentation-of']} Apache
    {$langues['server']}
    ${server_software} - {$langues['portUsed']}{$ListenPorts}
    {$langues['versp']}
    ${phpVersion}  - {$langues['documentation-of']} PHP
    {$langues['phpExt']}
      ${phpExtContents}
    ${DBMSTypes}
     

    {$langues['titrePage']}

    • phpinfo()
    • {$xdebug_info} {$phpsysinfo} {$addVhost}

    {$langues['txtProjet']}

      ${projectContents}

    {$langues['txtAlias']}

      ${aliasContents}
    EOPAGE; if($VirtualHostMenu == "on") { $pageContents .= <<< EOPAGEA

    {$langues['txtVhost']}

      ${vhostsContents}
    EOPAGEA; } if(!empty($error_content)) { $pageContents .= <<< EOPAGEB
    ${error_content} EOPAGEB; } $pageContents .= <<< EOPAGEC
     
    EOPAGEC; echo $pageContents; ?>