Example #1
0
function account_select(&$state, &$HTML, $rec = -1)
{
    if ($rec < 0) {
        //checking returned
        if (!isset($_GET["row"])) {
            return;
        }
        $rec = $_GET["row"];
        //get row number
    }
    account_list($state);
    //restore the record list
    if (!array_key_exists($rec, $state->records)) {
        throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid accounting id " . $rec, true);
    }
    $record = $state->records[$rec];
    if ($record[1] != "") {
        $inactive = new DateTime($record[1]);
        $diff = date_diff($state->from_date, $inactive)->days;
        if ($diff < $state->columns[COL_INACTIVE]) {
            $state->columns[COL_INACTIVE] = $diff;
            $state->columns[COL_AGENT] = "account";
        }
        $record[0] .= "<br>(inactive as of " . $record[1] . ")";
    }
    $state->account_id = $rec;
    $state->msgStatus = "";
    $HTML .= "cell = document.getElementById('AC_" . $state->row . "');\n";
    $HTML .= "cell.innerHTML = '" . $record[0] . "';\n";
}
Example #2
0
function account_select($ID = -1)
{
    global $_STATE;
    if ($ID < 0) {
        //not yet selected
        account_list();
        //restore the record list
        if (!array_key_exists(strval($_POST["selAccount"]), $_STATE->records)) {
            throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid account id " . $_POST["selAccount"]);
            //we're being spoofed
        }
        $ID = intval($_POST["selAccount"]);
    }
    $_STATE->record_id = $ID;
}
Example #3
0
            //更新会员余额数量
            log_account_change($account['user_id'], $amount, 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING);
        } elseif ($is_paid == '0') {
            /* 否则更新信息 */
            $sql = "UPDATE " . $ecs->table('user_account') . " SET " . "admin_user    = '******'admin_name']}', " . "admin_note    = '{$admin_note}', " . "is_paid       = 0 WHERE id = '{$id}'";
            $db->query($sql);
        }
        /* 记录管理员日志 */
        admin_log('(' . addslashes($_LANG['check']) . ')' . $admin_note, 'edit', 'user_surplus');
        /* 提示信息 */
        $link[0]['text'] = $_LANG['back_list'];
        $link[0]['href'] = 'user_account.php?act=list&' . list_link_postfix();
        sys_msg($_LANG['attradd_succed'], 0, $link);
    }
} elseif ($_REQUEST['act'] == 'query') {
    $list = account_list();
    $smarty->assign('list', $list['list']);
    $smarty->assign('filter', $list['filter']);
    $smarty->assign('record_count', $list['record_count']);
    $smarty->assign('page_count', $list['page_count']);
    $sort_flag = sort_flag($list['filter']);
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    make_json_result($smarty->fetch('user_account_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count']));
} elseif ($_REQUEST['act'] == 'remove') {
    /* 检查权限 */
    check_authz_json('surplus_manage');
    $id = @intval($_REQUEST['id']);
    $sql = "SELECT u.user_name FROM " . $ecs->table('users') . " AS u, " . $ecs->table('user_account') . " AS ua " . " WHERE u.user_id = ua.user_id AND ua.id = '{$id}' ";
    $user_name = $db->getOne($sql);
    $sql = "DELETE FROM " . $ecs->table('user_account') . " WHERE id = '{$id}'";
    if ($db->query($sql, 'SILENT')) {
Example #4
0
function account_select(&$state, &$HTML, $rec = -1)
{
    if ($rec < 0) {
        //checking returned
        if (!isset($_GET["row"])) {
            return;
        }
        $rec = strval($_GET["row"]);
    }
    account_list($state);
    //restore the record list
    if (!array_key_exists($rec, $state->records)) {
        throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid accounting id " . $rec, true);
    }
    $record = $state->records[$rec];
    if ($record[1] != "") {
        $inactive = new DateTime($record[1]);
        if ($inactive < $state->inactive_date) {
            $state->inactive_date = $inactive;
            $state->max_column = date_diff($state->from_date, $inactive)->days - 1;
            //0 rel
        }
        $record[0] .= "<br>(inactive as of " . $record[1] . ")";
    }
    $state->account_id = $rec;
    $state->msgStatus = "";
    $HTML .= "cell = document.getElementById('AC_0');\n";
    $HTML .= "cell.innerHTML = '" . $record[0] . "';\n";
}
Example #5
0
function change_account(&$state)
{
    global $_DB;
    include_once "lib/callback/account.php";
    account_list($state);
    //restore the record list
    if (!array_key_exists($state->account_id, $state->records)) {
        throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid accounting id " . $state->account_id, true);
    }
    log_list($state, $state->row);
    //find this row's records
    $record = reset($state->records);
    if ($state->account_id == $record["account_id"]) {
        return;
    }
    foreach ($state->records as $ID => $record) {
        if ($record["column"] < $state->columns[COL_OPEN]) {
            continue;
        }
        $sql = "UPDATE " . $_DB->prefix . "b00_timelog\n\t\t\t\tSET account_idref=" . $state->account_id . " WHERE timelog_id=" . $ID . ";";
        $_DB->exec($sql);
    }
}
Example #6
0
        // Deleting is just changing the label to "Deleted"
        case 'hard-delete':
            unlink($app->path);
            redirect('/list/' . $app->p->name);
            break;
    }
    render('err404', null, false);
});
// Users
// --------------------------------------------------------------------------------
get('/users', function () {
    if (!is_reviewer()) {
        render('err403', null, false);
        return;
    }
    $users = account_list();
    uasort($users, 'account_group_cmp');
    render('user_list', array('head_title' => 'Users', 'users' => $users));
});
// The url router wasn't matching "/users/:email" probably something to do with the @ and the dots in emails
if (startsWith(request_uri(), '/users/') && strlen(trim(request_uri(), '/')) > 5) {
    $email = remove_first(request_uri(), '/users/');
    if (!account_exists($email)) {
        render('err404', null, false);
        die;
    }
    if ($email !== user_email() && !is_reviewer()) {
        render('err403', null, false);
        die;
    }
    $data = account_data($email);