Ejemplo n.º 1
0
    require_once __DIR__ . '/versionning/directory.php';
    $to = strval(Lib::getStringBetween($path, '@', '|'));
    $commitDir = Lib::getStringBetween($path, ':', '@') . '/versionning/';
    $commits = array();
    for ($i = 1; $i <= $to; $i++) {
        $fID = (string) $i;
        if ($i < 10) {
            $fID = '0' . $fID;
        }
        if ($i < 100) {
            $fID = '0' . $fID;
        }
        try {
            $commits[] = json_decode(file_get_contents($commitDir . $fID . '.scm'), true);
        } catch (Exception $e) {
            header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
        }
    }
    $path = substr($path, strpos($path, '|') + 1);
    $v = new VersionningDirectory(null, array('versionning'), $commits);
    $commitFiles = $v->apply(array(), $to);
    UserAction::setCommitFiles($commitFiles);
    unset($commitFiles);
} else {
    // not in commit mode
}
if (method_exists('UserAction', $do)) {
    die(forward_static_call_array(array('UserAction', $do), array($path, $content)));
} else {
    die($shark['msg']['bad-request'] . ' action ' . $do . ' not found');
}