if (!$db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not update user's points", '', __LINE__, __FILE__, $sql); } else { adr_previous(Adr_cell_admin_celled_edited_ok, admin_adr_cell_users, ''); } } else { if ($update) { $sql = "SELECT * FROM " . USERS_TABLE . "\n\t\tWHERE user_cell_time > 0\n\t\tORDER BY username"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain celled list', '', __LINE__, __FILE__, $sql); } $celleds = $db->sql_fetchrowset($result); $sql = array(); while (list(, $celled) = @each($celleds)) { if (isset($_POST[$celled['user_id']])) { adr_cell_free_user($celled['user_id'], 2); } } adr_previous(Adr_cell_admin_uncelled_ok, admin_adr_cell_users, ''); } else { if ($manual_update) { $free = ''; $free = adr_cell_update_users(); $free = $free == '' ? $lang['None'] : $free; message_die(GENERAL_MESSAGE, $lang['Adr_cell_admin_celled_manual_update_ok'] . '<br />' . $free); } else { $sql = "SELECT * FROM " . USERS_TABLE . "\n\t\tWHERE user_cell_time > 0\n\t\tAND user_id > 1\n\t\tORDER by username"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain celled list', '', __LINE__, __FILE__, $sql); } $celled = $db->sql_fetchrowset($result);
$sql = "SELECT vote_result FROM " . ADR_JAIL_VOTES_TABLE . "\r\t\t WHERE vote_id = '{$celled_id}'\r\t\t AND voter_id = '{$user_id}'"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not check for previous vote', '', __LINE__, __FILE__, $sql); } $vote_check = $db->sql_fetchrow($result); if (is_numeric($vote_check['vote_result'])) { adr_previous(Adr_cell_vote_only_once, adr_courthouse, ''); } $sql = "INSERT INTO " . ADR_JAIL_VOTES_TABLE . "\r\t\t\t( vote_id , voter_id , vote_result )\r\t\t\tVALUES ( " . $celled_id . " , " . $user_id . " , " . $vote . " )"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not update user points', '', __LINE__, __FILE__, $sql); } $sql = "SELECT count(*) AS total_votes FROM " . ADR_JAIL_VOTES_TABLE . "\r\t\t\tWHERE vote_id = " . $celled_id; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not update user points', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $total = $row['total_votes']; $votes = 0; if ($total >= $adr_general['cell_user_judge_voters']) { $sql = "SELECT * FROM " . ADR_JAIL_VOTES_TABLE . "\r\t\t\tWHERE vote_id = {$celled_id} "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not update user points', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrowset($result); for ($i = 0; $i < count($row); $i++) { $votes = $votes + $row[$i]['vote_result']; } $medium = floor($adr_general['cell_user_judge_voters'] / 2); if ($votes > $medium) { adr_cell_free_user($celled_id, 2);