コード例 #1
0
ファイル: store.php プロジェクト: robertpyke/tiddly-speck
        $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();
コード例 #2
0
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);
}