/** * Checks work local redirect via http. * @param integer $status * @return boolean * @static * @final */ public static final function LocalRedirect($status = 301) { $statuses = array(300, 301, 302, 303, 304, 305, 307); if (Server::PHPInterface() == 'cli' || FileSystem::FileDeletion() === false || in_array($status, $statuses) == false) { return false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php"); } $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php", 'wb'); @fputs($file, "<?php\n" . "if (\$_GET['local'] != 'Y') {\n" . " header('Location: ' . dirname(\$_SERVER['PHP_SELF']) . '/test_redirect.php?local=Y', true, {$status});\n" . "}\n" . '?>'); @fclose($file); $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80; $host = ($port == 443 ? 'https://' : 'http://') . ($_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost'); $result = file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php") ? get_headers($host . dirname($_SERVER['PHP_SELF']) . '/test_redirect.php') : false; if (is_array($result)) { $result = stripos(reset($result), $status) ? true : false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_redirect.php"); } return $result; }
/** * Checking upload big files to the server. * @param integer $size * @return boolean * @static * @final */ public static final function UploadsBigFile($size = 1024) { global $count, $js; if (Server::PHPInterface() == 'cli' || Server::PHPFileUploads() === false || FileSystem::FileDeletion() === false) { return false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php"); } $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php", 'wb'); @fputs($file, "<?php\n" . "if (isset(\$_FILES['filename']) && is_uploaded_file(\$_FILES['filename']['tmp_name'])) {\n" . " @move_uploaded_file(\$_FILES['filename']['tmp_name'], \$_REQUEST['root'] . '/test_big.dat');\n" . " echo file_exists(\$_REQUEST['root'] . '/test_big.dat');\n" . "}\n" . "@unlink(__FILE__);\n" . '?>'); @fclose($file); $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_big_uploader.php", 'wb'); @fputs($file, "<?php\n" . "ini_set('display_errors', false);\n" . "@error_reporting(-1);\n\n" . "\$text = str_repeat(str_repeat('*', 1023) . \"\\n\", {$size});\n" . "\$boundary = sha1(1);\n" . "\$file = \"--\$boundary\\r\\n\" .\n" . " \"Content-Disposition: form-data; name=\\\"filename\\\"; filename=\\\"test_big.dat\\\"\\r\\n\" .\n" . " \"Content-Type: text/plain; charset=us-ascii\\r\\n\" .\n" . " \"Content-Length: \" . (1024 * {$size}) . \"\\r\\n\" .\n" . " \"Content-Type: application/octet-stream\\r\\n\\r\\n\" .\n" . " \"\$text\\r\\n\" .\n" . " \"--\$boundary--\";\n\n" . "\$body = \"POST " . dirname($_SERVER['PHP_SELF']) . "/test_big_upload.php?root={$_SERVER['DOCUMENT_ROOT']} HTTP/1.1\\r\\n\" .\n" . " \"Host: " . Tools::getHost() . "\\r\\n\" .\n" . " \"Content-Type: multipart/form-data; boundary=\$boundary\\r\\n\" .\n" . " 'Content-Length: ' . strlen(\$file) . \"\\r\\n\" .\n" . " \"Connection: Close\\r\\n\\r\\n\" .\n" . " \$file;\n\n" . "if (file_exists(\"{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php\")) { \n" . " \$res = @fsockopen('" . Tools::getHost() . "', " . ($_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80) . ", \$errno, \$errstr, 3);\n" . " if (\$res) {\n" . " \$time = explode(' ', microtime());\n" . " \$time = (float) \$time[0] + (float) \$time[1];\n" . " fputs(\$res, \$body);\n" . " \$result = end(explode(\"\\n\", fread(\$res, 4096)));\n" . " fclose(\$res);\n" . " \$finishtime = explode(' ', microtime());\n" . " \$finishtime = (float) \$finishtime[0] + (float) \$finishtime[1];\n" . " \$time = round(\$finishtime - \$time, 2);\n" . " echo \$result == '1' ? \"Yes \$time s\" : 'No';\n" . " } else {\n" . " echo 'No';\n" . " }\n" . "} else {\n" . " echo 'No';\n" . "}\n" . "@unlink('{$_SERVER['DOCUMENT_ROOT']}/test_big_upload.php');\n" . "@unlink('{$_SERVER['DOCUMENT_ROOT']}/test_big.dat');\n" . "@unlink(__FILE__);\n" . '?>'); @fclose($file); $cnt = $count + 1; $js .= "\$('#value-{$cnt}').parent('tr').removeClass().addClass('active');\n" . "\$('#value-{$cnt}').siblings('.loader').html('<img src=\"https://www.crazydogtshirts.com/skin/frontend/mtcolias/default/images/loader.gif\"/>');\n" . "\$.get( \"" . dirname($_SERVER['PHP_SELF']) . "/test_big_uploader.php\", function(data) {\n" . " \$('#value-{$cnt}').siblings('.loader').children().remove();\n" . " \$('#value-{$cnt}').parent('tr').removeClass();\n" . " if (data == 'No' || data == '') {\n" . " \$('#value-{$cnt}').html(data);\n" . " \$('#value-{$cnt}').parent('tr').addClass('danger');\n\n" . " } else {\n" . " \$('#value-{$cnt}').html(data);\n" . " \$('#value-{$cnt}').parent('tr').addClass('success');\n\n" . " }\n" . "})\n" . ".fail(function() {\n" . " \$('#value-{$cnt}').siblings('.loader').children().remove();\n" . " \$('#value-{$cnt}').html('No');\n" . " \$('#value-{$cnt}').parent('tr').addClass('danger');\n" . "})\n"; return 'Wait'; }
$b->add('Map', $provider->Map(), null, null, 'Will receive a link to Google Maps.'); $b->addHeader('JavaScript.'); $b->add('Jquery', JavaScript::Jquery(), null, null, 'Finds Jquery.'); $b->add('Jquery Form', JavaScript::JqueryForm(), null, null, 'Finds Jquery plugin Form.'); $b->add('Jquery Cycle2', JavaScript::JqueryCycle2(), null, null, 'Finds Jquery plugin Cycle2.'); $b->add('Jquery Scrollspy', JavaScript::JqueryScrollspy(), null, null, 'Finds Jquery plugin Scrollspy.'); $b->add('Bootstrap', JavaScript::Bootstrap(), null, null, 'Finds Bootstrap.'); $b->add('Less', JavaScript::Less(), null, null, 'Finds Less.'); $b->add('Angularjs', JavaScript::Angularjs(), null, null, 'Finds Angularjs.'); $b->add('Backbone', JavaScript::Backbone(), null, null, 'Finds Backbone.'); $b->add('Knockout', JavaScript::Knockout(), null, null, 'Finds Knockout.'); $b->add('React', JavaScript::React(), null, null, 'Finds React.'); $b->add('Requirejs', JavaScript::Requirejs(), null, null, 'Finds Requirejs.'); $b->add('Ember', JavaScript::Ember(), null, null, 'Finds Ember.'); $b->addHeader('Main.'); $b->add('PHP Interface', Server::PHPInterface(), null, null, 'Finds interface php.'); $b->add('PHP Version', Server::PHPVersion(), null, null, 'Finds version of php.'); $b->add('PHP Accelerator', Server::PHPAccelerator(), null, null, 'Finds accelerator php.'); $b->add('Safe Mode', Server::SafeMode(), null, null, 'Checking Safe Mode.'); $b->add('Short Open Tag', Server::ShortOpenTag(), null, null, 'Checking Short Open Tag.'); $b->add('Shared Memory', Server::SharedMemory(), null, null, 'Checking Shared Memory.'); $b->add('Posix', Server::Posix(), null, null, 'Checking posix.'); $b->add('Pcntl', Server::Pcntl(), null, null, 'Checking pcntl.'); $b->add('Email Sending', Server::EmailSending(), null, null, 'Checking Messages.'); $b->add('Mcrypt', Server::Mcrypt(), null, null, 'Checking mcrypt.'); $b->add('Sockets', Server::Sockets(), null, null, 'Checking sockets.'); $b->add('PHP Regex', Server::PHPRegex(), null, null, 'Checking php regex.'); $b->add('Perl Regex', Server::PerlRegex(), null, null, 'Checking perl regex.'); $b->add('Zlib', Server::Zlib(), null, null, 'Checking zlib.'); $b->add('GDlib', Server::GDlib(), null, null, 'Checking gdlib.'); $b->add('Free Type', Server::FreeType(), null, null, 'Checking free type.');
/** * Checking upload files to the server. * @return boolean * @static * @final */ public static final function FileUploads() { if (Server::PHPInterface() == 'cli' || Server::PHPFileUploads() === false || self::FileDeletion() === false) { return false; } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php"); } $file = @fopen("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php", 'wb'); @fputs($file, "<?php\n" . "if (isset(\$_FILES['filename']) && is_uploaded_file(\$_FILES['filename']['tmp_name'])) {\n" . " @move_uploaded_file(\$_FILES['filename']['tmp_name'], \$_REQUEST['root'] . '/test.dat');\n" . " echo file_exists(\$_REQUEST['root'] . '/test.dat');\n" . "}\n" . '?>'); @fclose($file); $text = 'Test upload'; $boundary = sha1(1); $file = "--{$boundary}\r\n" . "Content-Disposition: form-data; name=\"filename\"; filename=\"test.dat\"\r\n" . "Content-Type: text/plain; charset=us-ascii\r\n" . "Content-Length: 11\r\n" . "Content-Type: application/octet-stream\r\n\r\n" . "{$text}\r\n" . "--{$boundary}--"; $body = 'POST ' . dirname($_SERVER['PHP_SELF']) . "/test_upload.php?root={$_SERVER['DOCUMENT_ROOT']} HTTP/1.1\r\n" . 'Host: ' . Tools::getHost() . "\r\n" . "Content-Type: multipart/form-data; boundary={$boundary}\r\n" . 'Content-Length: ' . strlen($file) . "\r\n" . "Connection: Close\r\n\r\n" . $file; $result = file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php") ? Tools::CreateRequest($body) : false; if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test.dat")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test.dat"); } if (file_exists("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php")) { @unlink("{$_SERVER['DOCUMENT_ROOT']}/test_upload.php"); } return $result; }
/** * Searches for java scripts on the site * @param string $regxHtml * @param string $regxFind * @param string $regxVersion * @return array|boolean * @final */ private static final function search($regxHtml, $regxFind, $regxVersion = null) { global $docroot; if (Server::PHPInterface() == 'cli' || Server::PerlRegex() == false) { return false; } $root = $docroot && empty($docroot) === false ? $docroot : $_SERVER['DOCUMENT_ROOT']; $content = false; $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80; $html = file_get_contents(($port == 443 ? 'https://' : 'http://') . Tools::getHost()); if (preg_match($regxHtml, $html, $regx)) { if (stripos($regx[1], 'http') === false) { if (stripos($regx[1], '//') === false) { $regx[1] = ($port == 443 ? 'https://' : 'http://') . Tools::getHost() . "/"; } else { $regx[1] = "http:{$regx[1]}"; } } $content = file_get_contents($regx[1]); } if ($content == false && function_exists('exec')) { exec("find {$root} -name \"*.js\" -exec grep \"{$regxFind}\" {} \\; | head -n 1", $out); $content = reset($out); } if (is_null($regxVersion) == false && preg_match($regxVersion, substr($content, 0, 2000), $regx)) { return array('value' => true, 'version' => empty($regx[1]) == false ? reset(explode(' ', $regx[1])) : ''); } elseif ($content !== false) { return true; } return false; }