Skip to content

Commit

Permalink
PHP7 Project. Commit 14. Fixed deprecated methods, take 5.
Browse files Browse the repository at this point in the history
Most recent commit included from practiceprovider/php7-deprecated-methods branch is:
225d5c5

With fixes by bradymiller in following 2 commits:
bradymiller@524afda
bradymiller@732a43d
  • Loading branch information
Dev2-PracticeProvider authored and bradymiller committed Feb 13, 2016
1 parent 9e582f3 commit 82f0943
Show file tree
Hide file tree
Showing 58 changed files with 180 additions and 171 deletions.
6 changes: 3 additions & 3 deletions contrib/forms/example2/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

/* remove the time-of-day from the date fields */
if ($record['form_date'] != "") {
$dateparts = split(" ", $record['form_date']);
$dateparts = explode(" ", $record['form_date']);
$record['form_date'] = $dateparts[0];
}
if ($record['dob'] != "") {
$dateparts = split(" ", $record['dob']);
$dateparts = explode(" ", $record['dob']);
$record['dob'] = $dateparts[0];
}
if ($record['sig_date'] != "") {
$dateparts = split(" ", $record['sig_date']);
$dateparts = explode(" ", $record['sig_date']);
$record['sig_date'] = $dateparts[0];
}
?>
Expand Down
6 changes: 3 additions & 3 deletions contrib/forms/example2/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

/* remove the time-of-day from the date fields */
if ($record['form_date'] != "") {
$dateparts = split(" ", $record['form_date']);
$dateparts = explode(" ", $record['form_date']);
$record['form_date'] = $dateparts[0];
}
if ($record['dob'] != "") {
$dateparts = split(" ", $record['dob']);
$dateparts = explode(" ", $record['dob']);
$record['dob'] = $dateparts[0];
}
if ($record['sig_date'] != "") {
$dateparts = split(" ", $record['sig_date']);
$dateparts = explode(" ", $record['sig_date']);
$record['sig_date'] = $dateparts[0];
}
?>
Expand Down
12 changes: 6 additions & 6 deletions contrib/forms/hp_tje_primary/FormHpTjePrimary.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,39 +137,39 @@ function get_activity() {
}

function get_date_of_onset_y() {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
return $ymd[0];
}

function set_date_of_onset_y($year) {
if (is_numeric($year)) {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
$ymd[0] = $year;
$this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
}
}

function get_date_of_onset_m() {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
return $ymd[1];
}

function set_date_of_onset_m($month) {
if (is_numeric($month)) {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
$ymd[1] = $month;
$this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
}
}

function get_date_of_onset_d() {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
return $ymd[2];
}

function set_date_of_onset_d($day) {
if (is_numeric($day)) {
$ymd = split("-",$this->date_of_onset);
$ymd = explode("-",$this->date_of_onset);
$ymd[2] = $day;
$this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
}
Expand Down
5 changes: 3 additions & 2 deletions controllers/C_BillingContact.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function __construct($template_mod = "general") {
$this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . $_SERVER['QUERY_STRING']);
$this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
$this->assign("STYLE", $GLOBALS['style']);
$this->InsuranceCompany = new InsuranceCompany();
}

function default_action() {
Expand All @@ -36,10 +37,10 @@ function edit_action($id = "",$patient_id="",$p_obj = null) {
function list_action($sort = "") {

if (!empty($sort)) {
$this->assign("icompanies", InsuranceCompany::insurance_companies_factory("",$sort));
$this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("",$sort));
}
else {
$this->assign("icompanies", InsuranceCompany::insurance_companies_factory());
$this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
}

return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
Expand Down
5 changes: 3 additions & 2 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function __construct($template_mod = "general") {
$t = new CategoryTree(1);
//print_r($t->tree);
$this->tree = $t;
$this->Document = new Document();
}

function upload_action($patient_id,$category_id) {
Expand Down Expand Up @@ -597,7 +598,7 @@ function queue_action($patient_id="") {
if (is_file($file) && strpos(basename($file),".") !== 0) {
$file_info['filename'] = basename($file);
$file_info['mtime'] = date("m/d/Y H:i:s",filemtime($file));
$d = Document::document_factory_url("file:https://" . $file);
$d = $this->Document->document_factory_url("file:https://" . $file);
preg_match("/^([0-9]+)_/",basename($file),$patient_match);
$file_info['patient_id'] = $patient_match[1];
$file_info['document_id'] = $d->get_id();
Expand Down Expand Up @@ -977,7 +978,7 @@ function _rename_file($fname) {
$path = dirname($fname);
$file = basename($fname);

$fparts = split("\.",$file);
$fparts = explode("\.",$file);

if (count($fparts) > 1) {
if (is_numeric($fparts[count($fparts) -2]) && (count($fparts) > 2)) {
Expand Down
7 changes: 4 additions & 3 deletions controllers/C_InsuranceCompany.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function __construct($template_mod = "general") {
$this->assign("FORM_ACTION", $GLOBALS['webroot']."/controller.php?" . $_SERVER['QUERY_STRING']);
$this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&insurance_company&");
$this->assign("STYLE", $GLOBALS['style']);
$this->assign("WEB_ROOT", $GLOBALS['webroot'] );
$this->assign("WEB_ROOT", $GLOBALS['webroot'] );
$this->InsuranceCompany = new InsuranceCompany();
}

function default_action() {
Expand All @@ -42,10 +43,10 @@ function edit_action($id = "",$patient_id="",$p_obj = null) {
function list_action($sort = "") {

if (!empty($sort)) {
$this->assign("icompanies", InsuranceCompany::insurance_companies_factory("",$sort));
$this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory("",$sort));
}
else {
$this->assign("icompanies", InsuranceCompany::insurance_companies_factory());
$this->assign("icompanies", $this->InsuranceCompany->insurance_companies_factory());
}

return $this->fetch($GLOBALS['template_dir'] . "insurance_companies/" . $this->template_mod . "_list.html");
Expand Down
4 changes: 2 additions & 2 deletions controllers/C_PatientFinder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function search_by_lName($sql, $search_string) {
* @param string $search_string parsed for first name
*/
function search_by_fName($sql, $search_string) {
$name_array = split(",", $search_string);
$name_array = explode(",", $search_string);
$fName = add_escape_custom( trim($name_array[1]) );
$sql .= " WHERE fname LIKE '$fName%' ORDER BY lname, fname";
$result_array = $this->_db->GetAll($sql);
Expand All @@ -129,7 +129,7 @@ function search_by_fName($sql, $search_string) {
* @param string $search_string parsed for first, last and middle name
*/
function search_by_FullName($sql, $search_string) {
$name_array = split(",", $search_string);
$name_array = explode(",", $search_string);
$lName = add_escape_custom($name_array[0]);
$fName = add_escape_custom( trim($name_array[1]) );
$sql .= " WHERE fname LIKE '%$fName%' AND lname LIKE '$lName%' ORDER BY lname, fname";
Expand Down
5 changes: 3 additions & 2 deletions controllers/C_Pharmacy.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function __construct($template_mod = "general") {
$this->assign("CURRENT_ACTION", $GLOBALS['webroot']."/controller.php?" . "practice_settings&pharmacy&");
$this->assign("STYLE", $GLOBALS['style']);
$this->assign("WEB_ROOT", $GLOBALS['webroot'] );
$this->Pharmacy = new Pharmacy();
}

function default_action() {
Expand All @@ -41,10 +42,10 @@ function edit_action($id = "",$patient_id="",$p_obj = null) {
function list_action($sort = "") {

if (!empty($sort)) {
$this->assign("pharmacies", Pharmacy::pharmacies_factory("",$sort));
$this->assign("pharmacies", $this->Pharmacy->pharmacies_factory("",$sort));
}
else {
$this->assign("pharmacies", Pharmacy::pharmacies_factory());
$this->assign("pharmacies", $this->Pharmacy->pharmacies_factory());
}
//print_r(Prescription::prescriptions_factory($id));
return $this->fetch($GLOBALS['template_dir'] . "pharmacies/" . $this->template_mod . "_list.html");
Expand Down
3 changes: 2 additions & 1 deletion controllers/C_Prescription.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function __construct($template_mod = "general") {
$this->pconfig = $GLOBALS['oer_config']['prescriptions'];
$this->assign("CSS_HEADER", $GLOBALS['css_header'] );
$this->assign("WEB_ROOT", $GLOBALS['webroot'] );
$this->RxList = new RxList();

if ($GLOBALS['inhouse_pharmacy']) {
// Make an array of drug IDs and selectors for the template.
Expand Down Expand Up @@ -829,7 +830,7 @@ function do_lookup() {
$this->assign("drug", $_POST['drug']);
$list = array();
if (!empty($_POST['drug'])) {
$list = @RxList::get_list($_POST['drug']);
$list = $this->RxList->get_list($_POST['drug']);
}

if (is_array($list)) {
Expand Down
38 changes: 19 additions & 19 deletions gacl/soap/nusoap.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=fals
break;
}
}
if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
$i = 0;
if(is_array($val) && count($val)> 0){
foreach($val as $v){
Expand Down Expand Up @@ -445,7 +445,7 @@ function timestamp_to_iso8601($timestamp,$utc=true){
'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's

if(ereg($eregStr,$datestr,$regs)){
if(preg_match("/" . addcslashes($eregStr, '/') . "/",$datestr,$regs)){
return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
}
return false;
Expand All @@ -470,7 +470,7 @@ function iso8601_to_timestamp($datestr){
'([0-9]{2}):'. // minutes mm:
'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
'(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
if(ereg($eregStr,$datestr,$regs)){
if(preg_match("/" . addcslashes($eregStr, '/') . "/",$datestr,$regs)){
// not utc
if($regs[8] != 'Z'){
$op = substr($regs[8],0,1);
Expand Down Expand Up @@ -710,7 +710,7 @@ function schemaStartElement($parser, $name, $attrs) {
if(count($attrs) > 0){
foreach($attrs as $k => $v){
// if ns declarations, add to class level array of valid namespaces
if(ereg("^xmlns",$k)){
if(preg_match("/^xmlns/",$k)){
//$this->xdebug("$k: $v");
//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
if($ns_prefix = substr(strrchr($k,':'),1)){
Expand Down Expand Up @@ -785,7 +785,7 @@ function schemaStartElement($parser, $name, $attrs) {
$this->currentComplexType = $attrs['name'];
$this->complexTypes[$this->currentComplexType] = $attrs;
$this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
} else {
$this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
Expand Down Expand Up @@ -954,7 +954,7 @@ function serializeSchema(){
*/
function expandQname($qname){
// get element prefix
if(strpos($qname,':') && !ereg('^http:https://',$qname)){
if(strpos($qname,':') && !preg_match('@^http:https://@',$qname)){
// get unqualified name
$name = substr(strstr($qname,':'),1);
// get ns prefix
Expand Down Expand Up @@ -1442,7 +1442,7 @@ function send($data, $timeout=0) {
$data = $this->incoming_payload."\r\n\r\n\r\n\r\n";

// remove 100 header
if(ereg('^HTTP/1.1 100',$data)){
if(preg_match('@^HTTP/1.1 100@',$data)){
if($pos = strpos($data,"\r\n\r\n") ){
$data = ltrim(substr($data,$pos));
} elseif($pos = strpos($data,"\n\n") ){
Expand Down Expand Up @@ -1616,7 +1616,7 @@ function sendHTTPS($data, $timeout=0) {
//$t->setMarker('closed curl');

// remove 100 header
if(ereg('^HTTP/1.1 100',$data)){
if(preg_match('@^HTTP/1.1 100@',$data)){
if($pos = strpos($data,"\r\n\r\n") ){
$data = ltrim(substr($data,$pos));
} elseif($pos = strpos($data,"\n\n") ){
Expand Down Expand Up @@ -1854,7 +1854,7 @@ function service($data){
$qs = $QUERY_STRING;
}
// gen wsdl
if(isset($qs) && ereg('wsdl', $qs) ){
if(isset($qs) && preg_match('/wsdl/', $qs) ){
if($this->externalWSDLURL){
header('Location: '.$this->externalWSDLURL);
exit();
Expand Down Expand Up @@ -1922,7 +1922,7 @@ function parse_request($data='') {
// get the character encoding of the incoming request
if(strpos($this->headers['Content-Type'],'=')){
$enc = str_replace('"','',substr(strstr($this->headers["Content-Type"],'='),1));
if(eregi('^(ISO-8859-1|US-ASCII|UTF-8)$',$enc)){
if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/',$enc)){
$this->xml_encoding = $enc;
} else {
$this->xml_encoding = 'us-ascii';
Expand Down Expand Up @@ -2543,7 +2543,7 @@ function parseWSDL($wsdl = '')
*/
function start_element($parser, $name, $attrs)
{
if ($this->status == 'schema' || ereg('schema$', $name)) {
if ($this->status == 'schema' || preg_match('/schema$/', $name)) {
// $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
$this->status = 'schema';
$this->schemaStartElement($parser, $name, $attrs);
Expand All @@ -2555,7 +2555,7 @@ function start_element($parser, $name, $attrs)
$this->depth_array[$depth] = $pos;
$this->message[$pos] = array('cdata' => '');
// get element prefix
if (ereg(':', $name)) {
if (preg_match('/:/', $name)) {
// get ns prefix
$prefix = substr($name, 0, strpos($name, ':'));
// get ns
Expand All @@ -2567,7 +2567,7 @@ function start_element($parser, $name, $attrs)
if (count($attrs) > 0) {
foreach($attrs as $k => $v) {
// if ns declarations, add to class level array of valid namespaces
if (ereg("^xmlns", $k)) {
if (preg_match("/^xmlns/", $k)) {
if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
$this->namespaces[$ns_prefix] = $v;
} else {
Expand Down Expand Up @@ -2736,7 +2736,7 @@ function start_element($parser, $name, $attrs)
*/
function end_element($parser, $name){
// unset schema status
if (ereg('types$', $name) || ereg('schema$', $name)) {
if (preg_match('/types$/', $name) || preg_match('/schema$/', $name)) {
$this->status = "";
}
if ($this->status == 'schema') {
Expand Down Expand Up @@ -3364,7 +3364,7 @@ function start_element($parser, $name, $attrs) {
$key_localpart = $this->getLocalPart($key);
// if ns declarations, add to class level array of valid namespaces
if($key_prefix == 'xmlns'){
if(ereg('^http:https://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
if(preg_match('@^http:https://www.w3.org/[0-9]{4}/XMLSchema$@',$value)){
$this->XMLSchemaVersion = $value;
$this->namespaces['xsd'] = $this->XMLSchemaVersion;
$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
Expand Down Expand Up @@ -3397,7 +3397,7 @@ function start_element($parser, $name, $attrs) {
[6] nextDimension ::= Digit+ ','
*/
$expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
if(ereg($expr,$value,$regs)){
if(preg_match("/" . addcslashes($expr, '/') . "/",$value,$regs)){
$this->message[$pos]['typePrefix'] = $regs[1];
$this->message[$pos]['arraySize'] = $regs[3];
$this->message[$pos]['arrayCols'] = $regs[4];
Expand Down Expand Up @@ -3867,7 +3867,7 @@ function send($msg, $soapaction = '', $timeout=0) {
// detect transport
switch(true){
// http(s)
case ereg('^http',$this->endpoint):
case preg_match('/^http/',$this->endpoint):
$this->debug('transporting via HTTP');
if($this->persistentConnection && is_object($this->persistentConnection)){
$http =& $this->persistentConnection;
Expand All @@ -3887,10 +3887,10 @@ function send($msg, $soapaction = '', $timeout=0) {
$http->setEncoding($this->http_encoding);
}
$this->debug('sending message, length: '.strlen($msg));
if(ereg('^http:',$this->endpoint)){
if(preg_match('/^http:/',$this->endpoint)){
//if(strpos($this->endpoint,'http:')){
$response = $http->send($msg,$timeout);
} elseif(ereg('^https',$this->endpoint)){
} elseif(preg_match('/^https/',$this->endpoint)){
//} elseif(strpos($this->endpoint,'https:')){
//if(phpversion() == '4.3.0-dev'){
//$response = $http->send($msg,$timeout);
Expand Down
4 changes: 2 additions & 2 deletions gacl/test_suite/phpunit/phpunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function assertRegexp($regexp, $actual, $message=false) {

function assertEqualsMultilineStrings($string0, $string1,
$message="") {
$lines0 = split("\n",$string0);
$lines1 = split("\n",$string1);
$lines0 = explode("\n",$string0);
$lines1 = explode("\n",$string1);
if (sizeof($lines0) != sizeof($lines1)) {
$this->failNotEquals(sizeof($lines0)." line(s)",
sizeof($lines1)." line(s)", "expected", $message);
Expand Down
4 changes: 2 additions & 2 deletions interface/batchcom/batchEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

$email_subject=$_POST['email_subject'];
$email_body=$_POST['email_body'];
$email_subject=ereg_replace('\*{3}NAME\*{3}', $pt_name, $email_subject );
$email_body= ereg_replace('\*{3}NAME\*{3}', $pt_name, $email_body );
$email_subject=preg_replace('/\*{3}NAME\*{3}/', $pt_name, $email_subject );
$email_body= preg_replace('/\*{3}NAME\*{3}/', $pt_name, $email_body );

$headers = "MIME-Version: 1.0\r\n";
$headers .= "To: $pt_name<".$pt_email.">\r\n";
Expand Down
Loading

0 comments on commit 82f0943

Please sign in to comment.