Example #1
0
    $prio = (int) _post('prio');
    if ($prio < -1000000) {
        $prio = -1000000;
    } elseif ($prio > 1000000) {
        $prio = 1000000;
    }
    $db->ex("UPDATE {mytinytodo_todos} SET prio={$prio},d_edited=? WHERE id={$id}", array(time()));
    $t = array();
    $t['total'] = 1;
    $r = array('id' => $id, 'prio' => $prio);
    module_invoke_all('mytinytodo_set_prio', $r);
    $t['list'][] = $r;
    jsonExit($t);
} elseif (isset($_GET['tagCloud'])) {
    $listId = (int) _get('list');
    check_read_access($listId);
    $q = $db->dq("SELECT name,tag_id,COUNT(tag_id) AS tags_count FROM {mytinytodo_tag2task} INNER JOIN {mytinytodo_tags} ON tag_id=id " . "WHERE list_id={$listId} GROUP BY (tag_id) ORDER BY tags_count ASC");
    $at = array();
    $ac = array();
    while ($r = $q->fetch_assoc()) {
        $at[] = array('name' => $r['name'], 'id' => $r['tag_id']);
        $ac[] = $r['tags_count'];
    }
    $t = array();
    $t['total'] = 0;
    $count = sizeof($at);
    if (!$count) {
        jsonExit($t);
    }
    $qmax = max($ac);
    $qmin = min($ac);
Example #2
0
    stop_gpc($_POST);
    $password = _post('password');
    if ($password == $config['password']) {
        $t['logged'] = 1;
        session_regenerate_id(1);
        $_SESSION['logged'] = 1;
    }
    echo json_encode($t);
    exit;
} elseif (isset($_POST['logout'])) {
    $_SESSION = array();
    $t = array('logged' => 0);
    echo json_encode($t);
    exit;
} elseif (isset($_GET['suggestTags'])) {
    check_read_access();
    $listId = (int) _get('list');
    $begin = trim(_get('q'));
    $limit = (int) _get('limit');
    if ($limit < 1) {
        $limit = 8;
    }
    $q = $db->dq("SELECT name,id FROM tags WHERE list_id={$listId} AND name LIKE " . $db->quoteForLike('%s%%', $begin) . " AND tags_count>0 ORDER BY name LIMIT {$limit}");
    $s = '';
    while ($r = $q->fetch_row()) {
        $s .= "{$r['0']}|{$r['1']}\n";
    }
    echo htmlarray($s);
    exit;
} elseif (isset($_GET['setPrio'])) {
    check_write_access();