function new_info(&$db, &$state) { if (!isset($_POST["recID"])) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid POST", true); } if (!audit_counts($db, $state)) { return false; } $recID = $_POST["recID"]; if ($recID == 0) { //adding add_log($db, $state); return true; } log_list($db, $state); if (!array_key_exists(strval($recID), $state->records)) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid recID " . $recID, true); } if ($state->records[$recID]["event_id"] != $_POST["event"]) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true); } if ($_POST["sessions"] == 0) { delete_log($db, $state); } else { update_log($db, $state); } return true; }
function new_info(&$state) { $state->recID = 0; if ($state->row > 0) { //0 is add row log_list($state); foreach ($state->records as $recID => $record) { $state->recID = $recID; if ($record["row"] == $state->row) { break; } } if ($state->recID == 0) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid POST", true); } } if (!audit_counts($state)) { return false; } if (substr($_POST["comments"], 0, 1) == "\n") { $_POST["comments"] = "---"; } $logdate = clone $state->from_date; if ($state->recID == 0) { //adding if (!audit_date($state, $logdate)) { return false; } add_log($state); return; } if ($state->records[$state->recID]["event_id"] != $_POST["event"] || $state->records[$state->recID]["account_id"] != $_POST["account"]) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true); } if ($_POST["sessions"] == 0) { delete_log($state); } else { update_log($state); } }
function new_counts(&$state) { log_list($state, $state->row); //find this row's records $state->recID = 0; if ($state->row > 0) { //updating (0 is add row) $record = reset($state->records); if ($record["ID"] == 0) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid POST 1", true); } $state->recID = $record["ID"]; } if (!audit_counts($state)) { return; } if (substr($_POST["comments"], 0, 1) == "\n") { $_POST["comments"] = "---"; } $logdate = clone $state->from_date; if ($state->row == 0) { //adding add_log($state, $state->logdate); return; } if ($record["event_id"] != $_POST["event"] || $record["account_id"] != $_POST["account"]) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true); } if ($_POST["sessions"] == 0) { delete_log($state); } else { update_log($state); } }
function new_info(&$state) { global $_DB; $state->recID = 0; if ($state->process == "u") { log_list($state); foreach ($state->records as $recID => $record) { $state->recID = $recID; if ($record["row"] == $state->row) { break; } } if ($state->recID == 0) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid POST", true); } } if (!audit_counts($state)) { return false; } if (substr($_POST["comments"], 0, 1) == "\n") { $_POST["comments"] = "---"; } if ($state->recID == 0) { //adding add_log($state); return true; } if ($state->records[$state->recID]["event_id"] != $_POST["event"]) { throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true); } if ($_POST["sessions"] == 0) { delete_log($state); } else { update_log($state); } return true; }