// Arno Esterhuizen // and Romain Bourdon // and Hervé Leclerc // Icons by Mark James // Version 2.5 -> 3.3.2 by Dominique Ottello alias Otomatic $server_dir = "../"; require $server_dir.'scripts/config.inc.php'; require $server_dir.'scripts/wampserver.lib.php'; //**** Scroll lists parameters **** //** Based on an idea by Panagiotis E. Papazoglou //General scrolling (on or off) is controlled by Wampserver parameter 'ScrollListsHomePage' // via Right-Click -> Wamp Settings -> Allow scrolling of lists on home page //To allow or not the individual scrolling of the lists Projects, Alias and VirtualHost // 'scroll' true or false to do the scroll or not // 'lines' minimum number of lines to do the scroll // Do not change anything other than the values assigned to 'scroll' and 'lines' $Scroll_List = array( 'projects' => array('scroll' => true,'lines' => 16,'name' => 'ProjectsListScroller','nbname' => 'nbProjectsLines'), 'alias' => array('scroll' => true,'lines' => 16,'name' => 'AliasListScroller', 'nbname' => 'nbAliasLines'), 'vhosts' => array('scroll' => true,'lines' => 16,'name' => 'VhostsListScroller', 'nbname' => 'nbVirtualHostLines'), ); foreach($Scroll_List as $key => $value) { ${$value['name']} = ''; ${$value['nbname']} = 0; } $nbAlias = $nbVirtualHost = $nbProjects = 0; //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']; // All php versions $phpVersionList = listDir($c_phpVersionDir,'checkPhpConf','php',true); $PhpAllVersions = implode(' - ',$phpVersionList); //--- VirtualHost Menu $VirtualHostMenu = 'on'; //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); } include 'wamplangues/help_english.php'; if(file_exists('wamplangues/help_'.$langue.'.php')) { $langue_temp = $langues; include 'wamplangues/help_'.$langue.'.php'; $langues = array_merge($langue_temp, $langues); } $PhpAllVersionsNotFcgi = ''; if(!isset($c_ApacheDefine['PHPROOT'])) { $PhpAllVersionsNotFcgi = <<< EOF
     
    [FCGI] {$langues['fcgi_not_loaded']}
    EOF; } // 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; } //**** Modal Dialogs ***** //Get PHP loaded extensions $message['phpLoadedExtensions'] = color('clean',GetPhpLoadedExtensions($c_phpVersion,6)); //Dialog modal PHP extensions $divPhpExt = <<< EOF
    X
    {$message['phpLoadedExtensions']}
    EOF; $popupPHPExtLink = "".$langues['phpExtensions'].""; $ModalDialogs = $divPhpExt; unset($message['phpLoadedExtensions']); //Get PHP versions usage $message['phpVersionsUsage'] = GetPhpVersionsUsage(); //Dialog modal PHP versions usage $divPhpUse = <<< EOF
    X
    {$message['phpVersionsUsage']}
    EOF; $popupPHPExtLink .= " - ".$langues['phpVersionsUse'].""; $ModalDialogs .= $divPhpUse; unset($message['phpVersionsUsage']); //PHP FCGI help $message = str_replace(' ','  ',$langues['fcgi_mode_help']); $message = nl2br($message); $divHelpFCGI = <<< EOF
    X
    {$message}
    EOF; $ModalDialogs .= $divHelpFCGI; $PhpAllVersions .= " - ".$langues['fcgi_mode_link'].""; unset($message); //Dialog modal MySQL - MariaDB $popupMySQLMariaDBLink = ''; if($nbDBMS > 1) { $divMySQLMariaDB = <<< EOF
    X
    {$langues['HelpMySQLMariaDB']}
    EOF; $popupMySQLMariaDBLink = " - MySQL - MariaDB"; $ModalDialogs .= $divMySQLMariaDB; } //Get Apache loaded modules require $server_dir.'files/apacheloadedmodules.php'; //Dialog modal Apache modules $divApacheMod = <<< EOF
    X
    {$ApacheLoadedModule}
    EOF; $popupApacheModLink = "".$langues['apacheLoadedModules'].""; $ModalDialogs .= $divApacheMod; //**** End of Modal Dialogs ***** //Default DBMS in first position if(empty($defaultDBMSMySQL)) $DBMSTypes = $MariaDB.str_replace('',$popupMySQLMariaDBLink.'',$MySQLdb); else $DBMSTypes = $MySQLdb.str_replace('',$popupMySQLMariaDBLink.'',$MariaDB); // No Database Mysql System $noDBMS = (empty($MySQLdb) && empty($MariaDB)) ? true : false; //Alias $aliasContents = ''; // alias retrieval // Get PhpMyAdmin versions and parameters GetAliasVersions(); // Create alias menu if(is_dir($aliasDir)) { $PMyAdNotSeen = true; $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) { if(!$PMyAdNotSeen || $noDBMS) continue; $PMyAdNotSeen = false; foreach($Alias_Contents['PMyAdVer'] as $key => $none) { $value = $Alias_Contents['PMyAd'][$key]; $href = $value; $file = 'PhpMyAdmin '.$Alias_Contents[$value]['version']; $file_sup =''; if($Alias_Contents[$value]['fcgid'] && $Alias_Contents[$value]['fcgidPHPOK']) { $file_sup .= "

    FCGI -> PHP ".$Alias_Contents[$value]['fcgidPHP']."

    "; $nbAliasLines++; } $aliasContents .= '
  • '.$file.''.$file_sup.'
  • '; $nbAlias++; $nbAliasLines++; if($Alias_Contents[$value]['compat'] !== true) { $aliasContents .= '
  • '.$Alias_Contents[$value]['notcompat'].'
  • '; $nbAliasLines++; } } } elseif(stripos($file,'adminer') !== false) { if($noDBMS) continue; $file_sup = ''; if($Alias_Contents['adminer']['fcgid'] && $Alias_Contents['adminer']['fcgidPHPOK']) { $file_sup .= "

    FCGI -> PHP ".$Alias_Contents['adminer']['fcgidPHP']."

    "; } $aliasContents .= '
  • '.$file.' '.$Alias_Contents['adminer']['version'].''.$file_sup.'
  • '; $nbAlias++; $nbAliasLines++; } //Do not show phpsysinfo in alias column elseif(stripos($file,'phpsysinfo') === false){ $file_sup = ''; if($Alias_Contents[$file]['fcgid'] && $Alias_Contents[$file]['fcgidPHPOK']) { $file_sup .= "

    FCGI -> PHP ".$Alias_Contents[$file]['fcgidPHP']."

    "; $nbAliasLines++; } $aliasContents .= '
  • '.$file.''.$file_sup.'
  • '; $nbAlias++; $nbAliasLines++; } } } closedir($handle); } if(empty($aliasContents)) $aliasContents = "
  • ".$langues['txtNoAlias']."
  • \n"; // Get PhpSysInfo version and parameters $phpsysinfo = ''; if($Alias_Contents['phpsysinfo']['OK']) { $file_sup = ''; if($Alias_Contents['phpsysinfo']['fcgid'] && $Alias_Contents['phpsysinfo']['fcgidPHPOK']) { $file_sup .= "

    FCGI -> PHP ".$Alias_Contents['phpsysinfo']['fcgidPHP']."

    "; } $phpsysinfo = '
  • PhpSysInfo '.$Alias_Contents['phpsysinfo']['version'].''.$file_sup.'
  • '; } //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(); $nbVirtualHost = $nbVirtualHostLines = $virtualHost['nb_Server']; $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['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 { $http_mode = 'http://'; $value_aff = $vh_ip = ''; $value_url = ((strpos($value, ':') !== false) ? strstr($value,':',true) : $value); $value_link = $value; if($virtualHost['ServerNameIp'][$value] !== false) { $vh_ip = $virtualHost['ServerNameIp'][$value]; $value_url = $value_link = $vh_ip; $value_aff .= ' ('.$value.')'; if($virtualHost['ServerNameIpValid'][$value] === false) { $vhostError = true; $vhostErrorCorrected = false; $value_aff .= ' IP not valid'; $error_message[] = sprintf($langues['txtServerNameIp'],"".$vh_ip."","".$value."",$virtualHost['vhosts_file']); } } if($virtualHost['ServerNameIDNA'][$value] === true){ $value_aff .= "

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

    "; $nbVirtualHostLines++; } if(isset($c_ApacheDefine['PHPROOT']) && $virtualHost['ServerNameFcgid'][$value] === true){ $value_aff .= "

    FCGI -> PHP ".$virtualHost['ServerNameFcgidPHP'][$value]."

    "; $nbVirtualHostLines++; } if($virtualHost['ServerNameFcgid'][$value] === true && $virtualHost['ServerNameFcgidPHPOK'][$value] !== true) { $value_aff .= "

    FCGI -> PHP ".$virtualHost['ServerNameFcgidPHP'][$value]." - ".$langues['phpNotExists']."

    "; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = 'Error --- VirtualHost '.$value.' - Fast CGI PHP '.$virtualHost['ServerNameFcgidPHP'][$value].' - '.$langues['phpNotExists']; } if(in_array($value,$virtualHost['ServerNameHttps'])) { $http_mode = 'https://'; $value_aff .= "

    HTTPS

    "; $UrlPortVH = ''; $nbVirtualHostLines++; } $vhostsContents .= '
  • '.$value_link.''.$value_aff.'
  • '; } } else { $vhostError = true; $error_message[] = sprintf($langues['txtVhostNotClean'],$virtualHost['vhosts_file']); } } //Check number of ".$value."", "DocumentRoot", $virtualHost['vhosts_file']); break; } elseif($virtualHost['documentPathNotSlashEnded'][$value] === false) { $documentPathError = $value; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtSlashEnd'],"".$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 Directory Path ended with a slash '/' if($virtualHost['directorySlash'] === false) { foreach($virtualHost['directoryPath'] as $value) { if($virtualHost['directoryPathSlashEnded'][$value] === false) { $documentPathError = $value; $vhostError = true; $vhostErrorCorrected = false; $error_message[] = sprintf($langues['txtPathNoSlash'],"".$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 $list_projects = array(); $handle=opendir("."); while (false !== ($file = readdir($handle))) { if(is_dir($file) && !in_array($file,$projectsListIgnore)) $list_projects[] = $file; } closedir($handle); $projectContents = ''; if(count($list_projects) > 0) { if($wampConf['LinksOnProjectsHomePage'] == 'on') { $projectContents .= "
  • http://localhost/project/
  • \n"; } foreach($list_projects as $file) { $projectContents .= ($wampConf['LinksOnProjectsHomePage'] == 'on') ? "
  • ".$file."
  • " : '
  • '.$file.'
  • '; $nbProjects++; $nbProjectsLines++; } if($wampConf['LinksOnProjectsHomeByIp'] == 'on') { $projectContents = str_replace('localhost',$c_local_ip,$projectContents); } } if(empty($projectContents)) $projectContents = "
  • ".$langues['txtNoProjet']."
  • \n"; else { if($wampConf['LinksOnProjectsHomePage'] == 'off') { $projectContents .= "
  • ".sprintf($langues['txtProjects'].'.
    '.$langues['txtProjectsLink'],$wwwDir)."
  • "; if(strpos($projectContents,"http://localhost/") !== false) { $projectContents .= "
  • Warning: See below
  • "; if(!isset($error_content)) $error_content = ''; $error_content .= "

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

    "; } } } // To scroll Projects, Alias and VirtualHost list display if($wampConf['ScrollListsHomePage'] == 'on') { foreach($Scroll_List as $value) { if($value['scroll'] && ${$value['nbname']} > $value['lines']) { ${$value['name']} = " style='height:21rem;overflow-y:scroll;padding-right:5px;'"; } } } //Miscellaneous checks - Which php.ini is loaded? $phpini = mb_strtolower(trim(str_replace("\\","/",php_ini_loaded_file()))); $c_phpConfFileOri = mb_strtolower($c_phpVersionDir.'/php'.$wampConf['phpVersion'].'/'.$phpConfFileForApache); $c_phpCliConf = mb_strtolower($c_phpVersionDir.'/php'.$wampConf['phpVersion'].'/'.$wampConf['phpConfFile']); if($phpini != mb_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 - {$popupApacheModLink}
    {$langues['server']}
    {$server_software} - {$langues['portUsed']}{$ListenPorts}
    {$langues['versp']}
    [Apache module]  {$phpVersion} - {$langues['documentation-of']} PHP - {$popupPHPExtLink}
    {$PhpAllVersionsNotFcgi}
     
    [FCGI] {$PhpAllVersions}
    {$DBMSTypes}
     

    {$langues['titrePage']}

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

    {$langues['txtProjet']} ({$nbProjects})

      {$projectContents}

    {$langues['txtAlias']} ({$nbAlias})

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

    {$langues['txtVhost']} ({$nbVirtualHost})

      {$vhostsContents}
    EOPAGEA; } if(!empty($error_content)) { $pageContents .= <<< EOPAGEB
    {$error_content} EOPAGEB; } $pageContents .= <<< EOPAGEC
     
    {$ModalDialogs} EOPAGEC; include 'wampthemes/select_themes.php'; include 'wampthemes/copy_modal.php'; $pageContents .= <<< EOPAGED EOPAGED; echo $pageContents; ?>