public function __construct($row) { $row['id'] = $row['id'] ?: -1; $row['data_source'] = $row['data_source'] ?: 'judicial'; $row['detail_code'] = $row['detail_code'] ?: static::$default_detail_code; $row['entry_date'] = $row['entry_date'] ?: date('Y-m-d H:i:s'); $row['username'] = \PSU::nvl($row['username'], $_SESSION['username'], 'script'); parent::__construct($row); }
public function __construct($row) { $row['id'] = $row['id'] ?: -1; $row['data_source'] = $row['data_source'] ?: 'library'; $row['detail_code'] = $row['detail_code'] ?: static::$default_detail_code; $row['entry_date'] = $row['entry_date'] ?: date('Y-m-d H:i:s'); $row['username'] = \PSU::nvl($row['username'], $_SESSION['username'], 'script'); parent::__construct($row); if (!$this->meta('description')) { $this->set_meta('description', 'Library Billing Fee'); } //end if }
/** * constructor */ public function __construct($data = null) { // in the event that 'source' wasn't passed in, // prepare a default source user $default_user = \PSU::nvl($_SESSION['wp_id'], 'script'); $defaults = array('phone_type' => 'CE', 'source' => 'USER:'******'area'] ?: '603'; $this->number = $data['number']; } //end if }
$reason = isset($_GET['reason']) ? $_GET['reason'] : null; try { if ($action == 'impersonate') { if (!$GLOBALS['ape']->canResetPassword()) { throw new Exception('You are not allowed to modify account locks.'); } $person = new PSUPerson($identifier); $redirect_id = PSU::nvl($person->wp_id, $person->id); $GLOBALS['LOG']->write('Impersonating account: ' . $reason, $person->login_name); $_SESSION['impersonate'] = TRUE; $_SESSION['impersonate_store'] = array('wp_id' => $_SESSION['wp_id'], 'username' => $_SESSION['username'], 'pidm' => $_SESSION['pidm'], 'fullname' => $_SESSION['fullname']); $_SESSION['wp_id'] = $person->wp_id; $_SESSION['username'] = PSU::nvl($person->login_name, $person->wp_id); $_SESSION['pidm'] = $person->pidm; $_SESSION['fullname'] = $person->formatName('f m l'); $_SESSION['phpCAS']['user'] = PSU::nvl($person->login_name, $person->wp_id); unset($_SESSION['AUTHZ']); if ($_SESSION['pidm']) { PSU::get('idmobject')->loadAuthZ($_SESSION['pidm']); } //end if unset($_SESSION['AUTHZ']['admin']); foreach ((array) $_SESSION['AUTHZ']['permission'] as $key => $value) { if (strpos($key, 'ape_') === 0) { unset($_SESSION['AUTHZ']['permission'][$key]); } //end if } //end foreach $message = 'Now impersonating: ' . $_SESSION['username'] . ' (' . $_SESSION['wp_id'] . ')'; $_SESSION['messages'][] = $message;
function getOpenCalls($options = array()) { /* Options include the following: which: all - all open calls mygroup - all open calls in groups that option['calllog_username'] is in unassigned - calls that are currently not assigned to a user or group caller - open calls for $option['caller_user_name'] today - calls opened today my_opened - calls that I opened my - calls assigned to me, or opted into seeing via high priority groups setting who: should contain the the username of the person you are searching on (could be caller or calllog_user) what: a comma separated list of fields to fetch, defaults to * if not provided sort_by: call_date - when the call was created call_updated - when the call was last updated */ $options['what'] = $options['what'] ?: '*'; $query = "SELECT {$options['what']} \n\t\t\t\tFROM call_log, \n\t\t\t\t\t call_history \n\t\t\t\tWHERE call_log.call_id = call_history.call_id \n\t\t\t\t\tAND call_history.call_status='open'"; switch ($options['which']) { case '': case 'none': case 'all': $query = "SELECT {$options['what']} \n\t\t\t\t\t\tFROM call_log \n\t\t\t\t\t\t\tLEFT JOIN call_history ON call_log.call_id = call_history.call_id \n\t\t\t\t\t\t\tLEFT JOIN itsgroups ON its_assigned_group = itsgroups.itsgroupid \n\t\t\t\t\t\tWHERE call_history.call_status = 'open' \n\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\thide_in_all_calls != '1' \n\t\t\t\t\t\t\t\tOR hide_in_all_calls IS NULL\n\t\t\t\t\t\t\t\t)"; break; case 'mygroup': $query = "SELECT {$options['what']} \n\t\t\t\t\t\tFROM call_log, call_history \n\t\t\t\t\t\tWHERE call_log.call_id = call_history.call_id \n\t\t\t\t\t\t\tAND call_history.its_assigned_group='{$options['who']}' \n\t\t\t\t\t\t\tAND call_history.call_status='open'"; break; case 'unassigned': $query .= " AND tlc_assigned_to='unassigned' AND (its_assigned_group='0' || its_assigned_group='unassigned' || its_assigned_group='')"; break; case 'caller': $person = new PSUPerson($options['who']); $query .= " AND (call_log.wp_id = '{$person->wp_id}' OR call_log.pidm = {$person->pidm} OR call_log.caller_username='******'who']}')"; break; case 'today': $query .= " AND call_log.call_date=NOW()"; break; case 'my_opened': $query .= " AND call_log.calllog_username='******'who']}' AND call_history.call_status='open'"; break; case 'my': $query .= " AND ( call_history.tlc_assigned_to='{$options['who']}'"; $high_priority_groups = implode(',', User::getHighPriorityGroups(false, $options['who'])); if ($high_priority_groups) { $query .= " OR ( call_history.its_assigned_group IN ({$high_priority_groups}) AND call_history.call_priority = 'high' )"; } $query .= " )"; break; default: $query .= " AND call_history.tlc_assigned_to='{$options['who']}'"; break; } // end switch $query .= " AND call_history.current='1'"; if (!$options['sort_by'] || $options['sort_by'] == 'call_date') { $options['sort_by'] = 'call_date, call_time'; } elseif ($options['sort_by'] == 'call_updated') { $options['sort_by'] = 'date_assigned, time_assigned'; } $query .= " ORDER BY {$options['sort_by']} ASC"; $calls = PSU::db('calllog')->GetAll($query); foreach ($calls as &$call) { // needed for the template, but a bit redundant $call['call_title'] = $call['title']; // determine an assigned_to that combines person and queue/group $groupArray = getGroupInfo($call['its_assigned_group']); if ($call['its_assigned_group'] != 0 || $groupArray[1] != '') { if ($call['tlc_assigned_to'] != 'unassigned') { $call['assigned_to']['group'] = $groupArray[1]; $call['assigned_to'][] = $call['tlc_assigned_to']; } else { $call['assigned_to']['group'] = $groupArray[1]; } } elseif ($call['tlc_assigned_to'] != '') { $call['assigned_to'][] = $call['tlc_assigned_to']; } else { $call['assigned_to'][] = 'None'; } $call['building_name'] = getBuildingName($call['location_building_id']); if ($call['date_assigned']) { $assign_datetime = $call['date_assigned'] . ' ' . $call['time_assigned']; $call['activity_datetime'] = time() - strtotime($assign_datetime); $call['date_assigned'] = date('M j, Y', strtotime($assign_datetime)); $call['time_assigned'] = date('g:i a', strtotime($assign_datetime)); } //end if $call['call_activity_diff'] = \PSU::date_diff(time(), strtotime($assign_datetime), 'simple'); $call['call_summary'] = substr($call['comments'], 0, 100) . (strlen($call['comments']) > 100 ? '...' : ''); $call['show_comments'] = str_replace("\"", """, addslashes(substr(strip_tags(str_replace(array("\n", "\t", "\r"), '', $call['comments'])), 0, 30))); $call_datetime = $call['call_date'] . ' ' . $call['call_time']; $call['call_open_time'] = time() - strtotime($call_datetime); $call['call_date'] = date('M j, Y', strtotime($call_datetime)); $call['call_time'] = date('g:i a', strtotime($call_datetime)); if ($call['feelings_face']) { $call['feelings_face'] = '<br/><img src="/webapp/feedback/templates/images/feedback-' . $call['feelings_face'] . '.png" class="feedback-face" title="' . $call['feelings'] . '"/>'; } //end if // If the time that the call has been open (call_open_time) is greater than one week (604800 seconds) if ($call['call_open_time'] > 604800) { // Set a call age status variable and mark it as old $call['call_age_status'] = 'old'; } else { // Otherwise, mark it as normal $call['call_age_status'] = 'normal'; } // If the time since the call has been updated (activity_datetime) is greater than one week (604800 seconds) if ($call['activity_datetime'] > 604800) { // Set an activity age status variable and mark it as old $call['activity_age_status'] = 'old'; } else { // Otherwise, mark it as normal $call['activity_age_status'] = 'normal'; } $identifier = PSU::nvl($call['caller_username'], $call['wp_id'], $call['pidm']); //grabs the person data for the call $person = (array) $GLOBALS['user']->getCallerData($identifier); //overrides the username that was saved in the call with the username that was found from PSUPerson //this is to prevent ~500 calls displaying improper information //that were created with wp_ids instead of usernames as the username identifier $call['caller_username'] = $person['username'] ?: $person['identifier']; //merges the person array and single call(row) array $call = array_merge($call, $person); } // end foreach return $calls; }
/** * sanitize the object properties so we don't get h4xx0r3d */ public function sanitize() { // fields are ordered the same as in gb_telephone package $fields = array('pidm' => FILTER_SANITIZE_NUMBER_INT, 'seqno' => FILTER_SANITIZE_NUMBER_INT, 'tele_code' => FILTER_SANITIZE_STRING, 'phone_area' => FILTER_SANITIZE_STRING, 'phone_number' => FILTER_SANITIZE_STRING, 'phone_ext' => FILTER_SANITIZE_STRING, 'status_ind' => FILTER_SANITIZE_STRING, 'atyp_code' => FILTER_SANITIZE_STRING, 'addr_seqno' => FILTER_SANITIZE_NUMBER_INT, 'primary_ind' => FILTER_SANITIZE_STRING, 'unlist_ind' => FILTER_SANITIZE_STRING, 'comment' => FILTER_SANITIZE_STRING, 'intl_access' => FILTER_SANITIZE_STRING, 'data_origin' => FILTER_SANITIZE_STRING, 'user_id' => FILTER_SANITIZE_STRING, 'ctry_code_phone' => FILTER_SANITIZE_STRING); $data = array(); // build the data array for inserts/updates foreach ($fields as $field => $filter) { $data[$field] = filter_var($this->{$field}, $filter) ?: null; } //end foreach // attempt to use the session username as the user that updated the phone // failover to the user defined in the object // failover to hostname // failover to script $data['user_id'] = strtoupper(\PSU::nvl($_SESSION['username'], $data['user_id'], $_SERVER['REMOTE_HOST'], 'script')); return $data; }
function addNewCall($new_call_form_vars, $call_location = '') { $query_status = ''; // Gets new call form variables from add_new_call.html $call_log = array(); $call_history = array(); // Vars going to addToCallLog--I laid them out in a way that matched the database. $call_log['call_id'] = ''; $person = new PSUPerson($new_call_form_vars['caller_user_name']); $call_log['wp_id'] = $person->wp_id; $call_log['pidm'] = $person->pidm ? $person->pidm : 0; $call_log['caller_username'] = PSU::nvl($person->username, $person->wp_id, $new_call_form_vars['caller_user_name']); //required $call_log['caller_first_name'] = stripslashes($person->formatName('f')); //required $call_log['caller_last_name'] = stripslashes($person->formatName('l')); //required $call_log['caller_phone_number'] = $new_call_form_vars['caller_phone_number']; //required $call_log['calllog_username'] = $_SESSION['username']; //required $call_log['call_type'] = $new_call_form_vars['resnet_check']; $call_log['call_time'] = 'NOW()'; $call_log['call_date'] = 'NOW()'; $call_log['keywords'] = stripslashes($new_call_form_vars['keywords_list']); $call_log['location_building_id'] = $new_call_form_vars['location_building_id']; $call_log['location_building_room_number'] = $new_call_form_vars['location_building_room_number']; $call_log['location_call_logged_from'] = $call_location; $call_log['title'] = stripslashes($new_call_form_vars['title']); $call_log['feelings'] = stripslashes($new_call_form_vars['feelings']); $call_log['feelings_face'] = $new_call_form_vars['feelings_face']; // If the new auto-incremented call_id was returned if ($new_call_id = $this->addToCallLog($call_log)) { // Vars going to addToCallHistory $call_history['id'] = ''; $call_history['call_id'] = $new_call_id; $call_history['updated_by'] = $_SESSION['username']; $call_history['tlc_assigned_to'] = $new_call_form_vars['tlc_assigned_to']; if ($call_history['tlc_assigned_to'] != "" && $call_history['tlc_assigned_to'] == "helpdesk") { $call_history['tlc_assigned_to'] = ""; } $call_history['its_assigned_group'] = $new_call_form_vars['its_assigned_group']; if ($call_history['its_assigned_group'] != "") { } $call_history['comments'] = stripslashes($new_call_form_vars['problem_details']); //required $call_history['date_assigned'] = 'NOW()'; $call_history['time_assigned'] = 'NOW()'; $call_history['call_status'] = $new_call_form_vars['call_status']; //required $call_history['call_priority'] = $new_call_form_vars['call_priority']; //required $call_history['call_state'] = $new_call_form_vars['call_state']; //required $call_history['current'] = 1; $status = $this->addToCallHistory($call_history); if (!$status) { $_SESSION['user_message'] = 'Error inserting new call into call_history table.'; } } else { $_SESSION['user_message'] = 'Error retrieving new auto-incremented call_id.'; } return $new_call_id; }
function sendOpenCallMail($call_info, $action) { global $db; $person_cache = array(); $call = $db->GetRow("SELECT * FROM call_log WHERE call_id = ?", array($call_info['call_id'])); $call_info['call_date'] = $call['call_date'] . ' ' . $call['call_time']; $headers = array(); $headers['content-type'] = 'text/html'; $caller = PSU::nvl($call_info['caller_wp_id'], $call_info['caller_pidm'], $call_info['call_log_username']); $caller_data = $GLOBALS['user']->getCallerData($caller); $logger = $person_cache[$call_info['call_log_username']] = PSUPerson::get($call_info['call_log_username']); $groupInfo = getGroupInfo($call_info['its_group_assigned_to']); $call_log_employee = checkEmployee($call_info['call_log_username']); $assigned_employee = checkEmployee($call_info['tlc_assigned_to']); $to = array(); // always send to the submitter if the submitter is an employee if ($call_log_employee) { if ($logger->system_account_exists) { $to[] = $logger->wp_email; } //end } else { $end_user_to = $logger->wp_email; } //end else if ($action == "its_staff") { $call_info['call_id'] = $call_info['new_call_id'] . $call_info['call_id']; $call_info['comments'] = $call_info['problem_details'] . $call_info['comments']; if ($call_info['tlc_assigned_to'] != "unassigned") { if ($assigned_employee) { $to[] = PSUPerson::get($call_info['tlc_assigned_to'])->wp_email; } elseif ($call_info['tlc_assigned_to'] == 'caller' && $call_info['call_id']) { $sql = "SELECT caller_username \n\t\t\t\t\t\t\t\t\tFROM call_log \n\t\t\t\t\t\t\t\t WHERE call_log.call_id = ?"; $end_user_to = $db->GetOne($sql, array($call_info['call_id'])); if ($end_user_to) { $end_user = PSUPerson::get($end_user_to); if ($end_user) { $end_user_to = $end_user->wp_email; } } //end if } else { $end_user = PSUPerson::get($call_info['tlc_assigned_to']); $end_user_to = $end_user->wp_email; } //end if } //end if if ($call_info['its_assigned_group'] != 0) { $sql = "SELECT email_to \n\t\t\t\t\t\t\t\tFROM itsgroups\n\t\t\t\t\t\t\t\t , call_log \n\t\t\t\t\t\t\t\t\t\t , call_history \n\t\t\t\t\t\t\t WHERE itsgroups.deleted = 0 \n\t\t\t\t\t\t\t\t AND call_log.call_id = call_history.call_id \n\t\t\t\t\t\t\t\t AND itsgroups.itsgroupid = ?\n\t\t\t AND call_log.call_id = ?"; $email_to = $db->GetOne($sql, array($call_info['its_assigned_group'], $call_info['call_id'])); if ($email_to == 'all') { $sql = "SELECT user_name\n\t\t\t\t\t\t\t\t\tFROM itsgroups\n\t\t\t\t\t\t\t\t\t , its_employee_groups\n\t\t\t\t\t\t\t\t\t , call_log_employee\n\t\t\t\t\t\t\t\t\tWHERE itsgroups.deleted = 0 \n\t\t\t\t\t\t\t\t\t\tAND call_log_employee.call_log_user_id = its_employee_groups.employee_id \n\t\t\t\t\t\t\t\t\t\tAND its_employee_groups.group_id = ?\n\t\t\t\t\t\t\t\t\t\tAND itsgroups.itsgroupid = its_employee_groups.group_id \n\t\t\t\t\t\t\t\t\t\tAND call_log_employee.status = 'active' \n\t\t\t\t AND its_employee_groups.option_id = '2'"; $email_list = $db->GetCol($sql, array($call_info['its_assigned_group'])); } else { $email_list = explode(',', $email_to); } //end else foreach ((array) $email_list as $identifier) { $user = PSUPerson::get($identifier); $to[] = $user->wp_email; } //end foreach } //end if if ($call_info['its_group_assigned_to'] != 0) { $subject = '[Call Log] [' . $groupInfo[1] . '] ' . $caller_data['name_full']; } else { $subject = '[Call Log] ' . $caller_data['name_full']; } $subject .= ' (#' . $call_info['call_id'] . ')'; if ($call_info['call_status'] == 'closed') { $subject .= ' [CLOSED]'; // always send close to the owner, if they are allowed to see the // full history $caller_identifier = $db->GetOne("SELECT calllog_username FROM call_log WHERE call_log.call_id = '{$call_info['call_id']}'"); $caller_user = PSUPerson::get($caller_identifier); if ($GLOBALS['end_user_email']) { $closing_user = PSUPerson::get($_SESSION['wp_id']); if ($caller_user->wp_email == $closing_user->wp_email) { $end_user_to = $closing_user->wp_email; } //end if } elseif (checkEmployee($caller_to)) { $to[] = $caller_user->wp_email; } //end else } $sql = "SELECT * \n\t\t\t\t\t\t\tFROM call_log\n\t\t\t\t\t\t\t , call_history \n\t\t\t\t\t\t WHERE call_log.call_id = ?\n\t\t\t\t\t\t\t AND call_log.call_id = call_history.call_id\n\t\t\t\t\t\t ORDER BY date_assigned DESC\n\t\t , time_assigned DESC"; $call_info_query = $db->Execute($sql, array($call_info['call_id'])); foreach ($call_info_query as $call_info2) { $group_name = getGroupInfo($call_info2['its_assigned_group']); if ($group_name[0] == '') { $group_name = 'Unassigned'; } else { $group_name = $group_name[0]; } $call_info2['group_name'] = $group_name; $call_info2['update_date'] = $call_info2['date_assigned'] . ' ' . $call_info2['time_assigned']; if ($call_info2['tlc_assigned_to'] && $call_info2['tlc_assigned_to'] != 'unassigned') { if (!$person_cache[$call_info2['tlc_assigned_to']]) { $person_cache[$call_info2['tlc_assigned_to']] = PSUPerson::get($call_info2['tlc_assigned_to']); } //end else $call_info2['assigned_to'] = $call_info2['tlc_assigned_to']; } //end if if ($call_info2['updated_by']) { if (!$person_cache[$call_info2['updated_by']]) { $person_cache[$call_info2['updated_by']] = PSUPerson::get($call_info2['updated_by']); } //end else $call_info2['logger'] = $call_info2['updated_by']; } //end if $history[] = $call_info2; } $caller_id = $caller_data['identifier']; if (!$person_cache[$caller_id]) { $person_cache[$caller_id] = PSUPerson::get($caller_id); } //end else $current = array_slice($history, 0, 1); $current = $current[0]; // email ITS $tpl = new PSUTemplate(); $tpl->assign('caller', $caller_data); $tpl->assign('caller_id', $caller_id); $tpl->assign('pcache', $person_cache); $tpl->assign('call', $call_info); $tpl->assign('current', $current); $tpl->assign('history', array_slice($history, 1)); $text_message = $tpl->fetch('email.ticket.text.tpl'); $html_message = $tpl->fetch('email.ticket.html.tpl'); $to = implode(',', array_unique($to)); if ($to) { $headers['from'] = $logger->formatName('f l') . ' <' . $logger->wp_email . '>'; PSU::mail($to, $subject, array($text_message, $html_message), $headers); } //end if // email user if ($end_user_to) { $headers['from'] = 'Support Tickets <*****@*****.**>'; $tpl->assign('is_caller', true); $tpl->assign('history', array()); $text_message = $tpl->fetch('email.ticket.text.tpl'); $html_message = $tpl->fetch('email.ticket.html.tpl'); PSU::mail($end_user_to, $subject, array($text_message, $html_message), $headers); } //end if } }
/** * sanitize the object properties so we don't get h4xx0r3d */ public function sanitize() { // fields are ordered the same as in gb_address package $fields = array('pidm' => FILTER_SANITIZE_NUMBER_INT, 'atyp_code' => FILTER_SANITIZE_STRING, 'seqno' => FILTER_SANITIZE_NUMBER_INT, 'from_date' => FILTER_SANITIZE_STRING, 'to_date' => FILTER_SANITIZE_STRING, 'street_line1' => FILTER_SANITIZE_STRING, 'street_line2' => FILTER_SANITIZE_STRING, 'street_line3' => FILTER_SANITIZE_STRING, 'city' => FILTER_SANITIZE_STRING, 'stat_code' => FILTER_SANITIZE_STRING, 'zip' => FILTER_SANITIZE_STRING, 'cnty_code' => FILTER_SANITIZE_STRING, 'natn_code' => FILTER_SANITIZE_STRING, 'status_ind' => FILTER_SANITIZE_STRING, 'user' => FILTER_SANITIZE_STRING, 'asrc_code' => FILTER_SANITIZE_STRING, 'delivery_point' => FILTER_SANITIZE_NUMBER_INT, 'correction_digit' => FILTER_SANITIZE_NUMBER_INT, 'carrier_route' => FILTER_SANITIZE_STRING, 'gst_tax_id' => FILTER_SANITIZE_STRING, 'reviewed_ind' => FILTER_SANITIZE_STRING, 'reviewed_user' => FILTER_SANITIZE_STRING, 'data_origin' => FILTER_SANITIZE_STRING, 'ctry_code_phone' => FILTER_SANITIZE_STRING, 'house_number' => FILTER_SANITIZE_STRING, 'street_line4' => FILTER_SANITIZE_STRING); $data = array(); // build the data array for inserts/updates foreach ($fields as $field => $filter) { if ($field == 'to_date' || $field == 'from_date') { $function = $field . '_timestamp'; $data[$field] = $this->{$function}() ? \PSU::db('banner')->BindDate($this->{$function}()) : null; } else { $data[$field] = filter_var($this->{$field}, $filter) ?: null; } //end else } //end foreach // attempt to use the session username as the user that updated the address // failover to the user defined in the object // failover to hostname // failover to script $data['user'] = strtoupper(\PSU::nvl($_SESSION['username'], $data['user'], $_SERVER['REMOTE_HOST'], 'script')); return $data; }
<?php /** * Tool for account locking in the post Luminis world. * NOTE - This tool will not handle user spoofing. */ $pidm = (int) $_GET['pidm']; $redirect_id = $pidm; $lock = (bool) $_GET['lock']; $reason = isset($_GET['reason']) ? $_GET['reason'] : null; try { if (!$GLOBALS['ape']->canResetPassword()) { throw new Exception('You are not allowed to modify account locks.'); } $person = new PSUPerson($pidm); $redirect_id = PSU::nvl($person->id, $person->wp_id); if ($lock) { $GLOBALS['LOG']->write('Locking account', $person->login_name); $message = "Account for {$person->login_name} has been locked."; $reason .= ' (auto-opened via APE)'; if ($call_id = APE::create_ticket($person->login_name, 'Account Locked', $reason, array('call_source' => 'APE Locked Account'))) { $message .= ' Ticket #<a href="http://go.plymouth.edu/log/' . $call_id . '">' . $call_id . '</a> opened.'; } //end if $_SESSION['messages'][] = $message; $keys = array('added', 'sourced_id', 'password', 'pidm', 'login_name', 'fullname', 'reason', 'locker_pidm'); $values = array('NOW()', '?', '?', '?', '?', '?', '?', '?'); $args = array($person->sourced_id, ' ', $pidm, $person->login_name, $person->formatName('f l'), $reason, $_SESSION['pidm']); $sql = "\n\t\t INSERT INTO ape_support_locks (" . implode(', ', $keys) . ")\n\t\t VALUES (" . implode(', ', $values) . ")\n\t\t"; if (!PSU::db('myplymouth')->Execute($sql, $args)) { throw new Exception(PSU::db('myplymouth')->errorMsg());
public function total_undisbursed() { $total = 0; foreach ($this->records() as $record) { $total += \PSU::nvl($record->funds_not_disbursed, 0); } //end foreach return $total; }
public function url($user) { $person = PSUPerson::get($user); if (!$person->pidm) { throw new ECommerceException(ECommerceException::INVALID_PIDM); } $processor = 'UG Tuition/Housing Deposit'; $server = $_SERVER['URANUS'] ? 'test' : 'prod'; $term_code_entry = PSU::db('banner')->GetOne("SELECT term_code_entry FROM v_ug_app WHERE pidm = :pidm", array('pidm' => $person->pidm)); if ($person->isActiveStudent() || $term_code_entry) { $this->setURLParam('userChoice2', PSU::nvl($person->student->ug->term_code_admit, $term_code_entry, \PSU\Student::getCurrentTerm('UG'))); $this->setURLParam('orderType', $processor); $this->setURLParam('orderNumber', $person->id); $this->setURLParam('orderName', $person->formatName('l, f m')); $this->setURLParam('orderDescription', $processor); return $this->_url($server); } else { throw new ECommerceException(ECommerceException::INVALID_STUDENT); } //end else }
/** * sanitize the object properties so we don't get h4xx0r3d */ public function sanitize() { // fields are ordered the same as in gb_email package $fields = array('pidm' => FILTER_SANITIZE_NUMBER_INT, 'emal_code' => FILTER_SANITIZE_STRING, 'email_address' => FILTER_SANITIZE_STRING, 'status_ind' => FILTER_SANITIZE_STRING, 'preferred_ind' => FILTER_SANITIZE_STRING, 'user_id' => FILTER_SANITIZE_STRING, 'comment' => FILTER_SANITIZE_STRING, 'disp_web_ind' => FILTER_SANITIZE_STRING, 'data_origin' => FILTER_SANITIZE_STRING); $data = array(); // build the data array for inserts/updates foreach ($fields as $field => $filter) { $data[$field] = filter_var($this->{$field}, $filter) ?: null; } //end foreach // attempt to use the session username as the user that updated the email // failover to the user defined in the object // failover to hostname // failover to script $data['user_id'] = strtoupper(\PSU::nvl($_SESSION['username'], $data['user_id'], $_SERVER['REMOTE_HOST'], 'script')); return $data; }