Beispiel #1
0
        $fileContent = replaceJSContentIn($fileContent);
        if (!($handle = fopen($destfile, 'w'))) {
            echo "Cannot open file ({$destfile})";
            exit;
        }
        if (fwrite($handle, $fileContent) === FALSE) {
            echo "Cannot write to file ({$destfile})";
            exit;
        }
        fclose($handle);
    }
    chmod($destfile, 0644);
    if ($DEBUG) {
        echo "Debug mode \n\n";
    }
    if (!$backupError) {
        echo "0 - File successfully loaded in " . $destfile . "\n";
    } else {
        echo "BackupError : {$backupError} - File successfully loaded in " . $destfile . "\n";
    }
    echo "destfile:{$destfile} \n";
    if ($backupFilename && !$backupError) {
        echo "backupfile:{$backupFilename}\n";
    }
    $mtime = filemtime($destfile);
    echo "mtime:{$mtime}";
} else {
    echo "Error : " . $_FILES['error'] . " - File NOT uploaded !\n";
}
toExit();
function readTiddlyWiki($tw)
{
    if (preg_match("/(.*?<div id=\"storeArea\">.*?)(<div.*)/ms", $tw, $matches)) {
        $head = $matches[1];
        $h = $matches[2];
        $tiddlers = array();
        while (preg_match("/(.*?)(<div title=\"(.*?)\".*?<\\/div>)(.*)/ms", $h, $matches)) {
            $h = $matches[4];
            $tiddlers[$matches[3]] = $matches[2];
        }
        $tail = ltrim($h);
    } else {
        echo "The file '{$file}' isn't a valid TiddlyWiki";
        toExit();
    }
    return array($head, $tiddlers, $tail);
}