Exemple #1
0
if (!Auth::isTeacher()) {
    echo "Study more!";
    exit(0);
}
$file = $_GET["file"];
$word = $_GET["word"];
$around = 100;
if (isset($_GET["around"])) {
    $around = $_GET["around"];
}
$class = Auth::curClass();
if (strpos($file, $class) === FALSE) {
    echo "Research more! {$file} {$class}";
    exit(0);
}
$fs = new NativeFS("./log/");
if ($fs->exists("{$file}-data.txt")) {
    plain($file);
} else {
    if ($fs->exists("{$file}-data.log")) {
        json($file);
    }
}
function plain($file)
{
    global $fs, $word;
    $lines = explode("\n", $fs->getContent("{$file}-data.txt"));
    $a = array();
    $found = FALSE;
    foreach ($lines as $line) {
        array_push($a, "<code>" . mkTimeLink(preg_replace("/ /", "&nbsp;", htmlspecialchars($line))) . "\n</code><BR>");
Exemple #2
0
<?php

require_once "NativeFS.php";
require_once "PathUtil.php";
require_once "Permission.php";
require_once "SFile.php";
require_once "AuthInfo.php";
require_once "../ErrorHandler.php";
$class = "classA";
$user = "******";
$ap = new Permission(new AuthInfo($class, $user));
$ap = null;
$fs = new NativeFS("../../fs/", $ap);
$fs->mv("/kesunayo/", "/kesitemoii/");
echo join(", ", $fs->ls("/"));
/*$root=new SFile($fs,"/");
$home=$root->rel("home/")->rel($class)->rel($user);
$txt=$home->rel("myprj/test.txt");
$txt->text("tesutou!!");
print "Wrote to ".$txt->path()." Actual: ".$fs->resolve($txt->path());
$otherHome=$home->rel("../userA2/");
print $otherHome->rel("topsecret.txt")->text();*/
//$otherHome->text("hack!!");
//echo "txtpath= ".$txt->path()."<BR>";
/*if (isset($_POST["con"])) {
    $txt->setText($_POST["con"]);
}*/
?>
<form action="test.php" method="POST">
<textarea name="con" rows=10 cols=40><?php 
//echo $txt->getText();
Exemple #3
0
<?php

require_once __DIR__ . "/dtl/Dtl.php";
require_once __DIR__ . "/json.php";
//require_once __DIR__."/dtlfs/DtlFS.php";
require_once __DIR__ . "/ErrorHandler.php";
require_once __DIR__ . "/dtlfs/DtlShell.php";
require_once __DIR__ . "/fs/NativeFS.php";
if ($argc == 0) {
    print "dtlShell.php file.dtlvm\n";
    exit(1);
}
$f = new NativeFS();
$scr = $f->getContent($argv[1]);
$j = new Services_JSON();
$vmc = $j->decode($scr);
$root = Dtl::createEmptyRoot();
Dtl::initRoot($root);
$root->Shell = new DtlShell();
//DtlFS::initRoot($root);
echo $j->encode(DtlUtil::unwrap(Dtl::run($root, $vmc)));
Exemple #4
0
if (!Auth::isTeacher()) {
    echo "<script>alert('study more!');</script>";
    exit(0);
}
date_default_timezone_set("Asia/Tokyo");
$min = date('Y-m-d\\TH:i:s', strtotime("-4 week"));
$max = date('Y-m-d\\TH:i:s');
if (isset($_GET["min"])) {
    $min = $_GET["min"];
}
if (isset($_GET["max"])) {
    $max = $_GET["max"];
}
$class = Auth::curClass();
echo "<script>setRange('{$min}','{$max}');\n</script>";
$fs = new NativeFS("./log/");
foreach ($fs->ls("/") as $n) {
    $n = "/{$n}";
    if (strpos($n, $class) != FALSE) {
        if (preg_match("/-data-time/", $n)) {
            $er = preg_replace("/-data-time/", "-data-error", $n);
            if ($fs->exists($er)) {
                readLog($n, $er);
            }
        } else {
            if (preg_match("/-data.log/", $n)) {
                readJSONLog($n);
            }
        }
    }
}