function return_whitelist_6() { require_once 'c-pdo.php'; $db = new dbHelper(); $rows = $db->select_whitelist("whitelist", array('type' => 'ipv6')); $counter = 0; $dummy = array(); if (count($rows['data']) > 0) { foreach ($rows['data'] as $array) { $network_and_cidr = $rows['data'][$counter]['network']; /* push to temporary array */ array_push($dummy, $network_and_cidr); unset($network_and_cidr); $counter++; } } else { /* fallback in case DB gets wiped */ // ADD YOUR OWN IPv6 NETWORKS IN THIS SECTION array_push($dummy, 'fc00::/7'); array_push($dummy, 'fe80::/10'); array_push($dummy, 'fec0::/10'); array_push($dummy, 'ff00::/8'); } return $dummy; }
/** * @static * @return mixed */ public static function setGlobals() { $conn = new dbHelper(); $conn->setSQL("SELECT gl_name, gl_value FROM globals"); foreach ($conn->execStatement(PDO::FETCH_ASSOC) as $setting) { $_SESSION['global_settings'][$setting['gl_name']] = $setting['gl_value']; } return; }
/** * @static * @return mixed */ public static function setGlobals() { $conn = new dbHelper(); $conn->setSQL("SELECT gl_name, gl_value FROM globals"); foreach ($conn->fetchRecords(PDO::FETCH_ASSOC) as $setting) { $_SESSION['global_settings'][$setting['gl_name']] = $setting['gl_value']; } $_SESSION['global_settings']['timezone_offset'] = -14400; $_SESSION['global_settings']['date_time_display_format'] = $_SESSION['global_settings']['date_display_format'] . ' ' . $_SESSION['global_settings']['time_display_format']; return $_SESSION['site']['path']; }
public function logoutInactiveUsers() { $now = time(); $foo = $now - $_SESSION['inactive']['time']; $users = array(); $this->db->setSQL("SELECT id, uid FROM users_sessions WHERE last_request < {$foo} AND logout IS NULL"); foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $user) { $id = $user['id']; $users[] = array('uid' => $user['uid']); $this->db->setSQL("UPDATE users_sessions SET logout = '{$now}' WHERE id = '{$id}'"); $this->db->execOnly(); } return $users; }
public function getTemplatesTypes() { $this->db->setSQL("SELECT DISTINCT title, body\n \t FROM documents_templates\n \t WHERE template_type ='documenttemplate'"); $records = $this->db->fetchRecords(PDO::FETCH_ASSOC); $records[] = array('title' => 'Empty'); return $records; }
public function getPatientFutureEventsByPid($pid) { $date = Time::getLocalTime(); $tomorrow = date('Y-m-d 0000:00:00', strtotime($date . ' + 1 days')); $this->db->setSQL("SELECT * FROM calendar_events WHERE patient_id = '{$pid}' AND start >= '{$tomorrow}'"); return $this->db->fetchRecords(PDO::FETCH_ASSOC); }
public function updatePreventiveCareDismissedAlertsByPid(stdClass $params) { $data = get_object_vars($params); unset($data['id'], $data['description']); $this->db->setSQL($this->db->sqlBind($data, 'preventive_care_inactive_patient', 'U', array('id' => $params->id))); $this->db->execLog(); return $params; }
/** * Function: getPatientBalanceByPid */ public function getPatientBalanceByPid($pid) { // Declare all the variables that we are gone to use. (array) ($balance_total = ''); $this->db->setSQL("SELECT SUM(amount) as balance FROM payment_transactions WHERE payer_id = '{$pid}'"); $balance_total = $this->db->fetchRecord(); return $balance_total['balance']; }
public function updatePatientDisclosure(stdClass $params) { $data = get_object_vars($params); unset($data['id']); $this->db->setSQL($this->db->sqlBind($data, 'patient_disclosures', 'U', array('id' => $params->id))); $this->db->execLog(); return $params; }
public function getLabsLiveSearch(stdClass $params) { $this->db->setSQL("SELECT id,\n\t\t\t\t\t\t\t\t parent_loinc,\n\t\t\t\t\t\t\t\t loinc_number,\n\t\t\t\t\t\t\t\t loinc_name\n\t\t\t\t\t\t\tFROM labs_panels\n\t\t\t\t\t\t\tWHERE parent_loinc <> loinc_number\n\t\t\t\t\t\t\t AND loinc_name LIKE'{$params->query}%'"); $records = $this->db->fetchRecords(PDO::FETCH_ASSOC); $total = count($records); $records = array_slice($records, $params->start, $params->limit); return array('totals' => $total, 'rows' => $records); }
public function updateDocumentsTitle(stdClass $params) { $data = get_object_vars($params); $id = $data['id']; unset($data['id'], $data['date']); $this->db->setSQL($this->db->sqlBind($data, 'patient_documents', 'U', array('id' => $id))); $this->db->execLog(); return $params; }
public function getMedicationAttributesByCODE($CODE) { $this->db->setSQL("\n SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DST' AND `SAB` = 'MMSL'\n UNION\n SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DRT' AND `SAB` = 'MMSL'\n UNION\n SELECT `ATV`, `ATN` FROM rxnsat WHERE `CODE` = '{$CODE}' AND `ATN` = 'DDF' AND `SAB` = 'MMSL'\n "); $foo = array(); foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $fo) { $foo[$fo['ATN']] = $fo['ATV']; } return $foo; }
public function logEmergency() { $data['pid'] = $this->pid; $data['eid'] = $this->eid; $data['uid'] = $_SESSION['user']['id']; $data['date_created'] = Time::getLocalTime(); $this->db->setSQL($this->db->sqlBind($data, 'emergencies', 'I')); $this->db->execLog(); $this->emergencyId = $this->db->lastInsertId; }
/** * @param stdClass $params * @return stdClass * NOTES: Update contact address to who? * Naming: "updatePatientAddress" */ public function updateAddress(stdClass $params) { $data = get_object_vars($params); unset($data['id'], $data['fullname'], $data['fulladdress']); $sql = $this->db->sqlBind($data, "users", "U", "id='" . $params->id . "'"); $this->db->setSQL($sql); $this->db->execLog(); $params->fullname = Person::fullname($params->fname, $params->mname, $params->lname); $params->fulladdress = Person::fulladdress($params->street, $params->streetb, $params->city, $params->state, $params->zip); return $params; }
public function removeAllowBlank($table) { $this->db->setSQL("Select id, options FROM {$table}"); foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) { $options = json_decode($row['options'], true); if (isset($options['allowBlank'])) { unset($options['allowBlank']); $id = $row['id']; $data['options'] = json_encode($options); $this->db->setSQL($this->db->sqlBind($data, $table, 'U', "id='{$id}'")); $this->db->execOnly(); } } }
private function getGraphCurves($type, $sex) { $this->db->setSQL("SELECT * FROM vector_graphs WHERE type = '{$type}' AND sex = '{$sex}'"); $records = array(); foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) { unset($row['type'], $row['sex'], $row['L'], $row['M'], $row['S']); foreach ($row as $key => $val) { if ($val == null) { unset($row[$key]); } } $records[] = $row; } return $records; }
/** * The return of this function is use for testing only * * @param $list_id * @return string */ function getStore($list_id) { $params = new stdClass(); $params->list_id = $list_id; $options = $this->cb->getOptionsByListId($params); $buff = "Ext.create('Ext.data.Store',{fields:['option_name','option_value'],data:["; foreach ($options as $option) { $option_name = $option['option_name']; $option_value = $option['option_value']; $buff .= "{option_name:'{$option_name}',option_value:'{$option_value}'},"; } $buff = rtrim($buff, ','); $buff .= "]})"; return $buff; }
/** * this method performs both insert and update * this only runs a query if data has changed * this updates dbData through the orig refrence * saving behavior is determined by the contents of the orig array * if empty orig insert else update * after a save all objects that refrence this orig data will be refcrenced to the new data * * @return bool or int affected rows */ public function save() { $res = true; $changedData = $this->changedData(); if (count($changedData)) { if (!empty($this->orig)) { $res = dbHelper::updateQry($this->tableName, $changedData, array($this->primaryKey => $this->data[$this->primaryKey])) ? true : false; $this->orig = $this->data; } else { //if this row has been deleted but someone else saves data to it this will automatically restore the row from $data $res = dbHelper::insertQry($this->tableName, $this->data) ? true : false; $this->data[$this->primaryKey] = db::insertID(); dbData::addRow($this->tableName, $this->primaryKey, $this->data); $this->orig =& dbData::rowRefrence($this->tableName, $this->primaryKey, $this->data[$this->primaryKey]); } } return $res; }
/** * @internal param $user_id * @return array */ public function getUserPerms() { $this->conn->setSQL("SELECT * FROM acl_user_perms WHERE user_id = '{$this->user_id}' ORDER BY add_date ASC"); $perms = array(); foreach ($this->conn->fetchRecords(PDO::FETCH_ASSOC) as $row) { $pK = strtolower($row['perm_key']); if ($pK == '') { continue; } if ($row['value'] == '1') { $hP = true; } else { $hP = false; } $perms[$pK] = array('perm' => $pK, 'inheritted' => false, 'value' => $hP, 'Name' => $this->getPermNameByPermKey($row['perm_key']), 'id' => $row['id']); } return $perms; }
/** * @param $user_id * @return array */ private function getUserPerms($user_id) { $strSQL = "SELECT * FROM acl_user_perms WHERE user_id = " . floatval($user_id) . " ORDER BY add_date ASC"; $this->conn->setSQL($strSQL); $perms = array(); foreach ($this->conn->execStatement(PDO::FETCH_ASSOC) as $row) { $pK = strtolower($this->getperm_keyFromid($row['perm_id'])); if ($pK == '') { continue; } if ($row['value'] == '1') { $hP = true; } else { $hP = false; } $perms[$pK] = array('perm' => $pK, 'inheritted' => false, 'value' => $hP, 'Name' => $this->getperm_nameFromid($row['perm_id']), 'id' => $row['perm_id']); } return $perms; }
/** * Checks the status of a digital latch, or the status of an operation given as a parameter */ public static function checkLatchStatus() { $status = ""; global $wgUser; //mediawiki global var to get the userID that is currently logged into mediawiki $accountId = dbHelper::getAccountId($wgUser->getId()); if (isset($accountId) && !empty($accountId)) { $api = dbHelper::getLatchApi(); //create a Latch API instance $status = $api->status($accountId); //get the status of the latch for current user if (!empty($status) && $status->getData() != null) { $operations = $status->getData()->operations; $operation = $operations->{LatchConfig::appId}; $toRet = $operation->status; $toRet = (string) $toRet; return $toRet; //return $operation->status; } } return "on"; //other case return the latch status is open << if there's conectivity problems better to let it open than lock the user out }
session_cache_limiter('private'); include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; include_once $_SESSION['site']['root'] . "/classes/I18n.class.php"; require_once $_SESSION['site']['root'] . "/classes/dataExchange.class.php"; //****************************************************************************** // Reset session count 10 secs = 1 Flop //****************************************************************************** $_SESSION['site']['flops'] = 0; // ************************************************************************************* // Parce the data generated by EXTJS witch is JSON // ************************************************************************************* $data = json_decode($_REQUEST['row']); //------------------------------------------ // Database class instance //------------------------------------------ $mitos_db = new dbHelper(); // ************************************************************************************* // Validate and pass the POST variables to an array // This is the moment to validate the entered values from the user // although Sencha EXTJS make good validation, we could check again // just in case // ************************************************************************************* $row['list_id'] = dataEncode($data->list_id); $row['option_id'] = dataEncode($data->option_id); $row['title'] = dataEncode($data->title); $row['seq'] = dataEncode($data->seq); $row['is_default'] = trim($data->is_default) == 'true' ? 1 : 0; $row['option_value'] = dataEncode($data->option_value); $row['mapping'] = dataEncode($data->mapping); $row['notes'] = dataEncode($data->notes); // *************************************************************************************
//-------------------------------------------------------------------------------------------------------------------------- // data_create.ejs.php / new_patient // v0.0.2 // Under GPLv3 License // // Integrated by: GI Technologies Inc. in 2011 // // Remember, this file is called via the Framework Store, this is the AJAX thing. //-------------------------------------------------------------------------------------------------------------------------- session_name("MitosEHR"); session_start(); session_cache_limiter('private'); include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; include_once $_SESSION['site']['root'] . "/repo/global_functions/global_functions.php"; $_SESSION['site']['flops'] = 0; $mitos_db = new dbHelper(); $data = $_POST; foreach ($data as $key => $val) { if ($val == null) { unset($data[$key]); } if ($val == 'off') { $data[$key] = 0; } if ($val == 'on') { $data[$key] = 1; } } $sql = $mitos_db->sqlBind($data, "form_data_demographics", "I"); $mitos_db->setSQL($sql); $ret = $mitos_db->execLog();
/** * delete all rows from this table matching where clause * @param array $where * @see dbHelper::joinWhere() for $where formatting * @param mixed $andor * @see dbHelper::andOr() for more info on $setor formatting * @param string $bypasswhere this is a flag to prevent delete all if you pass an empty $where array * @see dbHelper::deleteQry() for more info * * @return bool or int (affected rows) */ public function deleteRowsWhere($where, $andor = 'AND', $bypassWhere = 'DONT_DELETE_EVERYTHING') { $ret = dbHelper::deleteQry($this->tableName, $where, $andor, $bypassWhere); if ($ret) { dbData::emptyTable($this->tableName); } return $ret; }
// Integrated by: Ernesto Rodriguez in 2011 // // Remember, this file is called via the Framework Store, this is the AJAX thing. //-------------------------------------------------------------------------------------------------------------------------- session_name("MitosEHR"); session_start(); session_cache_limiter('private'); include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; //****************************************************************************** // Reset session count 10 secs = 1 Flop //****************************************************************************** $_SESSION['site']['flops'] = 0; //------------------------------------------ // Database class instance //------------------------------------------ $mitos_db = new dbHelper(); // ************************************************************************************* // Parce the data generated by EXTJS witch is JSON // ************************************************************************************* $data = json_decode($_POST['row'], true); //------------------------------------------ // get the current user name //------------------------------------------ $user = $_SESSION['user']['name']; // ************************************************************************************* // Validate and pass the POST variables to an array // This is the moment to validate the entered values from the user // although Sencha EXTJS make good validation, we could check again // just in case // ************************************************************************************* $row['date'] = $data['date'];
//-------------------------------------------------------------------------------------------------------------------------- // listOrganization.json.php // // v0.0.1 // Under GPLv3 License // // Integrated by: Gi Technologies. in 2011 // // Remember, this file is called via the Framework Store, this is the AJAX thing. //-------------------------------------------------------------------------------------------------------------------------- session_name("MitosEHR"); session_start(); session_cache_limiter('private'); include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; // ************************************************************************************** // Reset session count 10 secs = 1 Flop // ************************************************************************************** $_SESSION['site']['flops'] = 0; // ************************************************************************************** // Database class instance // ************************************************************************************** $mitos_db = new dbHelper(); $mitos_db->setSQL("SELECT \n\t\t\t\t\t\t*\n\t\t\t\t\tFROM\n \t\t\t\t\t\tusers\n\t\t\t\t\tHAVING\n \t\t\t\t\t\torganization <> ''"); $total = $mitos_db->rowCount(); $rows = array(); foreach ($mitos_db->execStatement(PDO::FETCH_ASSOC) as $row) { $row['cName'] = $row['fname'] . " " . $row['mname'] . " " . $row['lname']; array_push($rows, $row); } print json_encode(array('totals' => $total, 'row' => $rows));
/** * @return array */ public function getCptUsedByClinic() { $this->db->setSQL("SELECT DISTINCT cpt.code, cpt.code_text, cpt.code_text_medium, cpt.code_text_short\n FROM encounter_codes_cpt AS ecc\n left JOIN cpt_codes AS cpt ON ecc.code = cpt.code\n ORDER BY cpt.code DESC"); $records = $this->db->fetchRecords(PDO::FETCH_ASSOC); return array('totals' => count($records), 'rows' => $records); }
// Integrated by: Ernesto Rodriguez in 2011 // // Remember, this file is called via the Framework Store, this is the AJAX thing. //-------------------------------------------------------------------------------------------------------------------------- session_name("MitosEHR"); session_start(); session_cache_limiter('private'); include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; //****************************************************************************** // Reset session count 10 secs = 1 Flop //****************************************************************************** $_SESSION['site']['flops'] = 0; //------------------------------------------ // Database class instance //------------------------------------------ $mitos_db = new dbHelper(); // ************************************************************************************* // Parce the data generated by EXTJS witch is JSON // ************************************************************************************* $data = json_decode($_POST['row'], true); // ************************************************************************************* // Validate and pass the POST variables to an array // This is the moment to validate the entered values from the user // although Sencha EXTJS make good validation, we could check again // just in case // ************************************************************************************* $row['user'] = $_SESSION['user']['name']; $row['date'] = $data['date']; $row['body'] = $data['body']; $row['groupname'] = $data['groupname']; $row['activity'] = '1';
* *-------------------------------------------- * Deny direct access if requested *-------------------------------------------- * */ define('DIRECT_ACCESS', 1); if (!defined('DIRECT_ACCESS')) { // if our flag is not defined, // user is accessing our file directly die('ERR: access denied'); exit; } require_once 'f-settings.php'; require_once 'c-pdo.php'; $db = new dbHelper(); $rows = $db->select6("whitelist", array()); ?> <!doctype html> <html lang="en-US"> <head> <meta charset="utf-8" /> <meta name="description" content="RTBH"> <link rel="shortcut icon" href="/common/favicon.ico" /> <title>RTBH</title> <link href="common/main-2.css" rel="stylesheet" type="text/css"> <link href="common/styles.css" rel="stylesheet" type="text/css"> <link href="common/hint.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" href="./media/css/jquery.dataTables.css">
<?php /** * Created by JetBrains PhpStorm. * User: Ernesto J. Rodriguez (Certun) * File: data.php * Date: 10/30/11 * Time: 10:53 AM */ session_name("MitosEHR"); session_start(); session_cache_limiter('private'); $_SESSION['site']['flops'] = 0; include_once $_SESSION['site']['root'] . "/classes/dbHelper.php"; include_once $_SESSION['site']['root'] . "/classes/formLayoutBuilder.php"; $mitos_db = new dbHelper(); $formLayoutBuilder = new formLayoutBuilder(); $rawData = file_get_contents("php://input"); $foo = json_decode($rawData, true); $data = $foo['row']; /** * This File handles the sencha request diferent. It use a normal POST do to the * the wat the TreeStpre is setup. The TreeStore is use to pull the fields ans their * proerties aut of the database, but can not save the data. For that reason we * are using a normal POST request from direcly from the FormPanel url. * * This is a map of how the request are handle * * if($_REQUEST['task'] == 'treeRequest'){ * ( SELECT ) <<------------------------------------// Send TreeStore json Back * }elseif($_REQUEST['task'] == 'optionsRequest'){