getLastEdited() public method

getLastEdited
public getLastEdited ( $padID )
示例#1
0
    $tags = array();
    foreach ($pads->padIDs as $padID) {
        $parts = explode('$', $padID);
        $padname = $parts[1];
        $delQuery .= " AND pad_name<>" . $db->quote($padname);
        //cache content
        $result = $instance->getText($padID);
        $fn = DATA_DIR . "/index/" . urlencode($group) . "/" . urlencode($padname) . ".txt";
        @mkdir(DATA_DIR . "/index");
        @mkdir(dirname($fn));
        file_put_contents($fn, $result->text);
        if ($verbose) {
            echo ".";
        }
        $insertQ->execute(array($group, $groupID, $padname, isset($passwords[$padID]) ? $passwords[$padID] : null, isset($shortlinks[$padID]) ? $shortlinks[$padID] : null));
        $tmpTimest = $instance->getLastEdited($padID);
        $tmpPublic = $instance->getPublicStatus($padID);
        $updateQ->execute(array($groupID, floor($tmpTimest->lastEdited / 1000), $tmpPublic->publicStatus ? 1 : 0, $group, $padname));
        $getTagsQ->execute(array($group, $padname));
        $tagstr = trim($getTagsQ->fetchColumn());
        if ($tagstr) {
            $thistags = explode(" ", $tagstr);
            $tags = array_merge($tags, $thistags);
        }
    }
    $db->exec($delQuery);
    $insertGroupQ->execute(array($group, $groupID, implode(" ", array_unique($tags))));
    if ($verbose) {
        echo " OK \n";
    }
}
示例#2
0
}
// Export as wikitext for MediaWiki
if (isset($_GET['pad_id']) && isset($_GET['export'])) {
    require "showmediawiki.php";
    exit;
}
// JSON API
if (count($_POST)) {
    require "showapi.php";
    exit;
}
if (isset($_GET['list_pads'])) {
    $pads = $instance->listPads($groupmap[$group]);
    $pad_lastedited = array();
    foreach ($pads->padIDs as $padID) {
        $tmp = $instance->getLastEdited($padID);
        $pad_lastedited[$padID] = (int) $tmp->lastEdited / 1000;
    }
    asort($pad_lastedited);
    $pad_lastedited = array_reverse($pad_lastedited);
    echo '<div class="table-responsive"><table class="table table-hover">';
    echo '<thead><tr><th width=30></th><th>Name</th><th width=350>Passwort</th><th width=100></th></tr></thead><tbody>';
    foreach ($pad_lastedited as $padID => $last_edited) {
        $PAD = array("id" => $padID, "last_edited" => $last_edited, "group" => $group);
        $tmp = $instance->getPublicStatus($padID);
        $PAD["shortname"] = substr($padID, strpos($padID, "\$") + 1);
        $PAD["icon_html"] = "";
        $PAD["className"] = "";
        if ($tmp->publicStatus) {
            $PAD["icon_html"] = '<span class="glyphicon glyphicon-globe"></span> ';
            $PAD["public"] = "true";