function listLogs($myDir) { $aDirectory = dir($myDir); $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; # if ((is_file($path)) && (preg_match("/.txt/i", $path))) { $c = checkFile($path); if ($c == 1) { $entries[$index] = $anEntry; $index++; } } aDirectory . closedir(); sort($entries); if ($index < 0) { echo "<br>There are no test logs for this build."; return; } for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $updateLine = 0; $updateLine = checkPlatform($anEntry); if ($updateLine == 0 && preg_match("/\\//", $myDir)) { $linktext = $myDir . "_" . $anEntry; # remove the directory name from the link to the log $dir = substr(strrchr($linktext, "/"), 1); $line = "<td><a href=\"{$myDir}/{$anEntry}\">{$dir}</a></td>"; } else { $line = "<td><a href=\"{$myDir}/{$anEntry}\">{$anEntry}</a></td>"; } echo "<li>{$line}</li>"; } }
/** * processes the installer */ function process($argv) { // Determine ANSI output from --ansi and --no-ansi flags setUseAnsi($argv); if (in_array('--help', $argv)) { displayHelp(); exit(0); } $check = in_array('--check', $argv); $help = in_array('--help', $argv); $force = in_array('--force', $argv); $quiet = in_array('--quiet', $argv); $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable'); $disableTls = in_array('--disable-tls', $argv); $installDir = getOptValue('--install-dir', $argv, false); $version = getOptValue('--version', $argv, false); $filename = getOptValue('--filename', $argv, 'composer.phar'); $cafile = getOptValue('--cafile', $argv, false); if (!checkParams($installDir, $version, $cafile)) { exit(1); } $ok = checkPlatform($quiet, $disableTls); if (true === $disableTls) { out("You have instructed the Installer not to enforce SSL/TLS security on remote HTTPS requests.", 'info'); out("This will leave all downloads during installation vulnerable to Man-In-The-Middle (MITM) attacks.", 'info'); } if ($check) { exit($ok ? 0 : 1); } if ($ok || $force) { installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel); exit(0); } exit(1); }
function listLogs($myDir) { $entries = array(); $aDirectory = dir($myDir); if ($aDirectory === NULL || $aDirectory === FALSE) { return; } $index = 0; $cdir = getcwd(); while ($anEntry = $aDirectory->read()) { $path = $cdir . "/" . $myDir . "/" . $anEntry; # if ((is_file($path)) && (preg_match("/.txt/i", $path))) { $c = checkFile($path); if ($c == 1) { $entries[$index] = $anEntry; $index++; } } $aDirectory->close(); if (count($entries) > 0) { sort($entries); } if ($index < 0) { echo "<p>There are no test logs for this build.</p>\n"; return; } echo "<ul>\n"; for ($i = 0; $i < $index; $i++) { $anEntry = $entries[$i]; $updateLine = 0; $updateLine = checkPlatform($anEntry); if ($updateLine == 0 && preg_match("/\\//", $myDir)) { $linktext = $myDir . "_" . $anEntry; # remove the directory name from the link to the log $dir = substr(strrchr($linktext, "/"), 1); $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $dir . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } else { $line = "<a href=\"" . "{$myDir}/{$anEntry}" . "\">" . $anEntry . "</a> " . fileSizeForDisplay("{$myDir}/{$anEntry}"); } echo "<li>{$line}</li>\n"; } echo "</ul>\n"; }
/** * processes the installer */ function process($argv) { // Determine ANSI output from --ansi and --no-ansi flags setUseAnsi($argv); if (in_array('--help', $argv)) { displayHelp(); exit(0); } $check = in_array('--check', $argv); $help = in_array('--help', $argv); $force = in_array('--force', $argv); $quiet = in_array('--quiet', $argv); $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable'); $disableTls = in_array('--disable-tls', $argv); $installDir = getOptValue('--install-dir', $argv, false); $version = getOptValue('--version', $argv, false); $filename = getOptValue('--filename', $argv, 'composer.phar'); $cafile = getOptValue('--cafile', $argv, false); if (!checkParams($installDir, $version, $cafile)) { exit(1); } $ok = checkPlatform($warnings, $quiet, $disableTls); if ($check) { // Only show warnings if we haven't output any errors if ($ok) { showWarnings($warnings); showSecurityWarning($disableTls); } exit($ok ? 0 : 1); } if ($ok || $force) { installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel); showWarnings($warnings); showSecurityWarning($disableTls); exit(0); } exit(1); }
function process($argv) { $check = in_array('--check', $argv); $help = in_array('--help', $argv); $force = in_array('--force', $argv); $quiet = in_array('--quiet', $argv); $disableTls = in_array('--disable-tls', $argv); $installDir = FALSE; $version = FALSE; $filename = 'slicer.phar'; $cafile = FALSE; // --no-ansi wins over --ansi if (in_array('--no-ansi', $argv)) { define('USE_ANSI', FALSE); } elseif (in_array('--ansi', $argv)) { define('USE_ANSI', TRUE); } else { // On Windows, default to no ANSI, except in ANSICON and ConEmu. // Everywhere else, default to ANSI if stdout is a terminal. define('USE_ANSI', DIRECTORY_SEPARATOR == '\\' ? FALSE !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') : function_exists('posix_isatty') && posix_isatty(1)); } foreach ($argv as $key => $val) { if (0 === strpos($val, '--install-dir')) { if (13 === strlen($val) && isset($argv[$key + 1])) { $installDir = trim($argv[$key + 1]); } else { $installDir = trim(substr($val, 14)); } } if (0 === strpos($val, '--version')) { if (9 === strlen($val) && isset($argv[$key + 1])) { $version = trim($argv[$key + 1]); } else { $version = trim(substr($val, 10)); } } if (0 === strpos($val, '--filename')) { if (10 === strlen($val) && isset($argv[$key + 1])) { $filename = trim($argv[$key + 1]); } else { $filename = trim(substr($val, 11)); } } if (0 === strpos($val, '--cafile')) { if (8 === strlen($val) && isset($argv[$key + 1])) { $cafile = trim($argv[$key + 1]); } else { $cafile = trim(substr($val, 9)); } } } if ($help) { displayHelp(); exit(0); } $ok = checkPlatform($quiet, $disableTls); if (FALSE !== $installDir && !is_dir($installDir)) { out("The defined install dir ({$installDir}) does not exist.", 'info'); $ok = FALSE; } if (FALSE !== $version && 1 !== preg_match('/^\\d+\\.\\d+\\.\\d+(\\-(alpha|beta)\\d+)*$/', $version)) { out("The defined install version ({$version}) does not match release pattern.", 'info'); $ok = FALSE; } if (FALSE !== $cafile && (!file_exists($cafile) || !is_readable($cafile))) { out("The defined Certificate Authority (CA) cert file ({$cafile}) does not exist or is not readable.", 'info'); $ok = FALSE; } if (TRUE === $disableTls) { out("You have instructed the Installer not to enforce SSL/TLS security on remote HTTPS requests.", 'info'); out("This will leave all downloads during installation vulnerable to Man-In-The-Middle (MITM) attacks.", 'info'); } if ($check) { exit($ok ? 0 : 1); } if ($ok || $force) { installSlicer($version, $installDir, $filename, $quiet, $disableTls, $cafile); exit(0); } exit(1); }