Ejemplo n.º 1
0
/**
 * @param $path
 * @return array
 */
function analyse_file_path($path)
{
    global $thirdpartyLibs, $safePaths;
    $type = 'unknown';
    $name = basename($path);
    if (strpos($name, '.') !== false) {
        $extension = substr($name, strrpos($name, '.') + 1);
    } else {
        $extension = false;
    }
    if (strpos($path, '/CVS/') !== false) {
        $type = 'cvs';
    } elseif (strpos($path, './templates_c/') === 0) {
        $type = 'cache';
    } elseif (regex_match($path, $safePaths)) {
        $type = 'safe';
    } elseif ($extension == 'php' || $extension == 'inc') {
        if ($name == 'index.php') {
            $type = 'blocker';
        } elseif ($name == 'language.php') {
            $type = 'lang';
        } elseif (strpos($path, './lib/wiki-plugins') === 0) {
            $type = 'wikiplugin';
        } elseif (strpos($path, './lib/') === 0) {
            if (regex_match($path, $thirdpartyLibs)) {
                $type = '3dparty';
            } else {
                $type = 'lib';
            }
        } elseif (strpos($path, './tiki-') === 0) {
            $type = 'public';
        } elseif (strpos($path, './modules/') === 0) {
            $type = 'module';
        } else {
            $type = "include";
        }
    } elseif (in_array($extension, array('txt', 'png', 'jpg', 'html', 'css', 'sql', 'gif', 'afm', 'js'))) {
        $type = 'static';
    } elseif (strpos($path, './doc/devtools/') === 0) {
        $type = 'script';
    } elseif (strpos($path, './files/') === 0) {
        $type = 'user';
    } elseif ($extension == 'sh') {
        $type = 'system';
    } elseif (strpos($path, '_htaccess') !== false) {
        $type = 'system';
    } elseif (in_array(basename($path), array('INSTALL', 'README'))) {
        $type = 'doc';
    } elseif ($extension == 'tpl') {
        $type = 'template';
    }
    return array('filename' => basename($path), 'path' => $path, 'type' => $type, 'extension' => $extension, 'features' => array(), 'permissions' => array(), 'includeonce' => false, 'noweb' => false, 'tikisetup' => false, 'unsafeextract' => false);
}
Ejemplo n.º 2
0
$str = "I like PHP Programing";
if (ereg($pattern, $str)) {
    echo "Found pattern..";
} else {
    echo "Not Found pattern..";
}
function regex_match($pattern, $str)
{
    if (ereg($pattern, $str)) {
        echo "Found pattern..";
    } else {
        echo "Not Found pattern..";
    }
}
$p = "[0-9]";
$str1 = "Anuwat";
regex_match($p, $str1);
echo "<br>";
$attack = mktime(0, 0, 0, 9, 11, 2001);
$now = time();
echo $attack;
echo "<br>";
echo $now;
echo "<br>";
echo date("l j F Y H:i:s T", $now);
echo "<br>";
echo strftime("%B");
?>
    </body>
</html>