예제 #1
0
<?php

require_once '../lib/header_ajax.php';
require_once '../lib/lib_dict.php';
try {
    switch ($_POST['act']) {
        case 'forget':
            forget_pending_token($_POST['token_id'], $_POST['rev_id']);
            break;
        case 'update':
            update_pending_token($_POST['token_id'], $_POST['rev_id'], 0, (bool) $_POST['smart']);
            break;
        default:
            $result['error'] = 1;
    }
} catch (Exception $e) {
    $result['error'] = 1;
}
log_timing(true);
die(json_encode($result));
예제 #2
0
function update_pending_tokens($rev_id, $smart = false)
{
    check_permission(PERM_DICT);
    $res = sql_pe("SELECT token_id FROM updated_tokens WHERE dict_revision=?", array($rev_id));
    sql_begin();
    $revset_id = create_revset("Update tokens from dictionary");
    foreach ($res as $r) {
        update_pending_token($r['token_id'], $rev_id, $revset_id, $smart);
    }
    sql_commit();
}