GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/common/ |
Upload File : |
<? // /common/functions.phpinc // Setus up application variables and functions. // da() // Returns true if debugging functionallity is available for this site. ($debuggingAvailable = true) function da() { if ( isset($GLOBALS['debuggingAvailable']) ) { return $GLOBALS['debuggingAvailable']; } else { return false; } #if ((isset($_SESSION['DEBUG']['code']) && $_SESSION['DEBUG']['code']) || (isset($GLOBALS['debugOn']) && $GLOBALS['debugOn']) || (isset($debugIP) && $debugIP)) { return true; } else { return false; } } // dc() // Returns true if debug code is on. function dc() { if ( (isset($GLOBALS['debugOn']) && $GLOBALS['debugOn']) || (isset($GLOBALS['debugIP']) && $GLOBALS['debugIP']) ) { return true; } else { return false; } } require('common/functions_arraylist.phpinc'); require('common/functions_datetime.phpinc'); #if (da()) require('common/functions_debug.phpinc'); require('common/functions_debug.phpinc'); require('common/functions_query.phpinc'); require('common/functions_site.phpinc'); //CRtoBR($string) // Returns $string with all \n converted to <br> function CRtoBR($string) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $CRtoBR = str_replace(array("\r","\n"), array("","<br>"), $string); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($string)=$CRtoBR".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $CRtoBR; } // decimalIP($IPaddress) // Returns decimal ip address function decimalIP($IPaddress) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $octet = explode(".",$IPaddress); $decimalIP = $octet[0]*256*256*256 + $octet[1]*256*256 + $octet[2]*256 + $octet[3]; if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($IPaddress)=$decimalIP".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $decimalIP; } // displayError($message) // Display the $_SESSION['MESSAGE_ERROR']. function displayError($message = '') { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if ($message == '') { $message = $_SESSION['MESSAGE_ERROR']; } if ($message != '') { //if (substr($message,strlen($message)-4,4) != '<br>') { $message .= '<br>'; } ?> <div class="center"><span class="errorbold">ERROR!</span><br><span class="error"><?=$message?></span></div><audio autoplay><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/error1.wav" type="audio/wav"><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/error1.mp3" type="audio/mpeg"><img src="<?=$_SESSION['HTTP_ROOT']?>/images/sound_mute.png" alt="Your browser does not support the <audio> element." title="Your browser does not support the <audio> element."></audio> <? } $_SESSION['MESSAGE_ERROR'] = ''; if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($message)".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } // displayInformation($message) // Display the $_SESSION['MESSAGE_INFORMATION']. function displayInformation($message = '') { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if ($message == '') { $message = $_SESSION['MESSAGE_INFORMATION']; } if ($message != '') { //if (substr($message,strlen($message)-4,4) != '<br>') { $message .= '<br>'; } ?> <div class="center"><span class="bold" style="color:#FFFF00;"><?=$message?></span></div> <? } $_SESSION['MESSAGE_INFORMATION'] = ''; if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($message)".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } // displayNotice($message) // Display the $_SESSION['MESSAGE_NOTICE']. function displayNotice($message = '') { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if ($message == '') { $message = $_SESSION['MESSAGE_NOTICE']; } if ($message != '') { //if (substr($message,strlen($message)-4,4) != '<br>') { $message .= '<br>'; } ?> <div class="center"><span class="errorbold">NOTICE: </span><span class="bold"><?=$message?></span></div><audio autoplay><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/notice1.wav" type="audio/wav"><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/notice1.mp3" type="audio/mpeg"><img src="<?=$_SESSION['HTTP_ROOT']?>/images/sound_mute.png" alt="Your browser does not support the <audio> element." title="Your browser does not support the <audio> element."></audio> <? } $_SESSION['MESSAGE_NOTICE'] = ''; if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($message)".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } // displayWarning($message) // Display the $_SESSION['MESSAGE_WARNING']. function displayWarning($message = '') { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if ($message == '') { $message = $_SESSION['MESSAGE_WARNING']; } if ($message != '') { //if (substr($message,strlen($message)-4,4) != '<br>') { $message .= '<br>'; } ?> <div class="center"><span class="warningbold">WARNING!</span><br><span class="warning"><?=$message?></span></div><audio autoplay><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/warning1.wav" type="audio/wav"><source src="<?=$_SESSION['HTTP_ROOT']?>/sounds/warning1.mp3" type="audio/mpeg"><img src="<?=$_SESSION['HTTP_ROOT']?>/images/sound_mute.png" alt="Your browser does not support the <audio> element." title="Your browser does not support the <audio> element."></audio> <? } $_SESSION['MESSAGE_WARNING'] = ''; if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($message)".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } // doctype(__FILE__) // Places the doctype into the HTML page. function doctype($file) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if (!isset($_SESSION['OB_START']) || $_SESSION['OB_START'] == '') { ob_start(); $_SESSION['OB_START'] = 1; } if (!isset($_SESSION['DOCTYPE']) || $_SESSION['DOCTYPE'] == '') { //$_SESSION['DOCTYPE'] = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; //$_SESSION['HTML'] = '<html>'; //$_SESSION['DOCTYPE'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; //$_SESSION['HTML'] = '<html xmlns="http://www.w3.org/1999/xhtml">'; $_SESSION['DOCTYPE'] = '<!DOCTYPE html>'; $_SESSION['HTML'] = '<html lang="en">'; header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Mon, 2 Dec 1996 03:00:00 GMT"); // Date in the past echo $_SESSION['DOCTYPE']."\n\n"; //echo "DOCTYPE set. ".$file."<br>\n"; } else { //echo "DOCTYPE already set. ".$file."<br>\n"; } if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($file)".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } // expandHeader($string) // Return the string with _CSTRC_ and _CST_ expanded. function expandHeader($string) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $expandHeader = str_replace("_CSTRC_",$_SESSION['NAME_LONG'],str_replace("_CST_",$_SESSION['NAME_SHORT'],$string)); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."(".htmlView($string).")=$expandHeader".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $expandHeader; } // fileSafe($string) // Returns a filename safe string. function fileSafe($string) { $fileSafe = str_replace(array("'",'"',' ','/','?','%',':','>','\\'),'',$string); return $fileSafe; } // formValue($formvariable,$prefix) // Returns the $_GET or $_POST value if there is one, else returns false. function formValue($formvariable,$prefix = "f_") { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if (isset($_GET[$prefix.$formvariable])) { if (get_magic_quotes_gpc() == true) { if (!is_array($_GET[$prefix.$formvariable])) { $formValue = trim($_GET[$prefix.$formvariable]); } else { $tempArray = array(); foreach ($_GET[$prefix.$formvariable] as $temp) { $tempArray[] = trim($temp); } $formValue = $tempArray; } } else { if (!is_array($_GET[$prefix.$formvariable])) { $formValue = addslashes(trim($_GET[$prefix.$formvariable])); } else { $tempArray = array(); foreach ($_GET[$prefix.$formvariable] as $temp) { $tempArray[] = addslashes(trim($temp)); } $formValue = $tempArray; } } } else { if (isset($_POST[$prefix.$formvariable])) { if (get_magic_quotes_gpc() == true) { if (!is_array($_POST[$prefix.$formvariable])) { $formValue = trim($_POST[$prefix.$formvariable]); } else { $tempArray = array(); foreach ($_POST[$prefix.$formvariable] as $temp) { $tempArray[] = trim($temp); } $formValue = $tempArray; } } else { if (!is_array($_POST[$prefix.$formvariable])) { $formValue = addslashes(trim($_POST[$prefix.$formvariable])); } else { $tempArray = array(); foreach ($_POST[$prefix.$formvariable] as $temp) { $tempArray[] = addslashes(trim($temp)); } $formValue = $tempArray; } } } else { $formValue = false; } } if (!is_array($formValue)) { if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($formvariable,$prefix)=$formValue".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } else { if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') { $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($formvariable,$prefix)=Array"; foreach($formValue as $key=>$value) { $_SESSION['TRACK'] .= " [$key]=$value"; } $_SESSION['TRACK'] .= ": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } } return $formValue; } // headerLocation($location) // Performs the header("Location: ) call. function headerLocation($location) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; global $debugOn; global $debugIP; $_SESSION['location'] = $location; if (!isset($_SESSION['TRACK'])) $_SESSION['TRACK'] = ''; $_SESSION['TRACK'] .= "<li><font color=red>header(Location: $location);</font>\n"; #track('header("Location: ". '.$location.');'); if (dc() || $debugIP || $_SERVER['REMOTE_ADDR'] == '173.16.60.67x' ) { $pageTitle = 'header(Location: '.$location.')'; require('common/pageHeader.phpinc'); ?> <a href="<?=$location?>">header(Location: <?=$location?>);</a> called by <?=$file?>:<?=$line?> <?=$filepath?><br> <? setDebugOn(); require('common/pageFooter.phpinc'); exit; } else { header("Location: ".$location); } } //htmlCRtoBR($string) // Returns an htmlView($string) with all \n converted to <br> function htmlCRtoBR($string) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $htmlCRtoBR = str_replace("\n", "<br>", htmlView($string)); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($string)=$htmlCRtoBR".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $htmlCRtoBR; } // htmlView($string) // Returns $string with < = < and & = &. // 2020-05-03. ' replaced with ' or ' causing js error so I replaced it with ` function htmlView($string) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; #echo '$debug_backtrace='; print_r($debug_backtrace); echo "<br>\n"; $safe = array("\\\"" => """, "\"" => """, '"' => """, "\\\'" => "`", "\'" => "`", "'" => "`", "&" => "&", "<" => "<", ">" => ">", "\\\\" => '\',"\\" => '\'); $htmlView = strtr($string, $safe); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '' && isset($_SESSION['TRACK']) && !strstr($debug_backtrace['0']['file'],'functions')) $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($string)=$htmlView".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $htmlView; } // is_positivenumber($value) function is_positivenumber($value) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if(preg_match('/^[0-9]+$/', $value) && $value > 0) { $is_positivenumber= true; } else { $is_positivenumber= false; } if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') { $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($value)="; if($is_positivenumber) { $_SESSION['TRACK'] .='true'; } else { $_SESSION['TRACK'] .= 'false'; } $_SESSION['TRACK'] .=": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; } return $is_positivenumber; } /** / // query_safe($str) { // Returns a MySQL safe string. function query_safe($str) { $search=array("\\","\0","\n","\r","\x1a","'",'"'); $replace=array("\\\\","\\0","\\n","\\r","\Z","\'",'\"'); return str_replace($search,$replace,$str); } /**/ function num2words($num,$ucase = true) { $ZERO = "zero"; $MINUS = "minus"; $lowName = array( /* zero is shown as "" since it is never used in combined forms */ /* 0 .. 19 */ "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"); $tys = array( /* 0, 10, 20, 30 ... 90 */ "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"); $groupName = array( /* We only need up to a quintillion, since a long is about 9 * 10 ^ 18 */ /* American: unit, hundred, thousand, million, billion, trillion, quadrillion, quintillion */ "", "hundred", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion"); $divisor = array( /* How many of this group is needed to form one of the succeeding group. */ /* American: unit, hundred, thousand, million, billion, trillion, quadrillion, quintillion */ 100, 10, 1000, 1000, 1000, 1000, 1000, 1000) ; $num = str_replace(",","",$num); #d_Var('$num',$num); $numSplit = explode('.',$num); #d_Var('$numSplit',$numSplit); $num = $numSplit[0]; if ( isset($numSplit[1]) ) { $fraction = $numSplit[1]; } else { $fraction = 0; } #d_Var('$num',$num); #d_Var('$fraction',$fraction); $num2words = ""; if ( $num == 0 ) $num2words = $ZERO; $negative = ( $num < 0 ); if ( $negative ) $num = -$num; // Work least significant digit to most, right to left. // until high order part is all 0s. for ( $i=0; $num>0; $i++ ) { $remdr = (int)($num % $divisor[$i]); $num = $num / $divisor[$i]; // check for 1100 .. 1999, 2100..2999, ... 5200..5999 // but not 1000..1099, 2000..2099, ... // Special case written as fifty-nine hundred. // e.g. thousands digit is 1..5 and hundreds digit is 1..9 // Only when no further higher order. if ( $i == 1 /* doing hundreds */ && 1 <= $num && $num <= 5 ){ if ( $remdr > 0 ){ $remdr += $num * 10; $num = 0; } // end if } // end if if ( $remdr == 0 ){ continue; } $t = ""; if ( $remdr < 20 ) { $t = $lowName[$remdr]; } else if ( $remdr < 100 ) { $units = (int)$remdr % 10; $tens = (int)$remdr / 10; $t = $tys [$tens]; if ( $units != 0 ){ $t .= "-" . $lowName[$units]; } } else { $t = $inWords($remdr); } $num2words = $t . " " . $groupName[$i] . " " . $num2words; $num = (int)$num; } // end for $num2words = trim($num2words); if ( $negative ){ $num2words = $MINUS . " " . $num2words; } if ( $fraction ) { $num2words .= " point"; for ($i=0; $i<strlen($fraction); $i++) { $num2words .= " ".num2words($fraction[$i],false); } } if ( $ucase ) $num2words = ucfirst($num2words); return $num2words; } // end num2words // ordinalNumber($number) // Will add "th, st, nd, rd, th" after the number. function ordinalNumber($number, $sup=false){ $test_c = abs($number) % 10; $ext = ((abs($number) %100 < 21 && abs($number) %100 > 4) ? 'th' : (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th')); $ordinalNumber = $number; if ($sup) { $ordinalNumber .= '<sup>'; } $ordinalNumber .= $ext; if ($sup) { $ordinalNumber .= '</sup>'; } return $ordinalNumber; } // php_self() // return $_SERVER['PHP_SELF'] with index.php removed. function php_self() { #$_SESSION['message']['info'] = $_SERVER['PHP_SELF']; return str_replace('/index.php','/',$_SERVER['PHP_SELF']); } // ttMake($abbrText, $tooltipText, $abbrClass, $tooltipClass, $onClick) // Returns the abbr tooltip html code. // $abbrText = Text/html to show in the <abbr></abbr> tag. // If an empty string then no <abbr></abbr> tag is created, and // only the onMouseOver/onMouseOut is created. // $tooltipText = Tooltip text/html to show on hover. // $abbrClass = Class of the <abbr> tag. Default is no class. // $tooltipClass = Class of the tooltip. Default is no class. // $onClick = Javascript to execute OnClick of the abbr. function ttMake($abbrText, $tooltipText, $abbrClass='', $tooltipClass='', $onClick=false) { if ( $abbrClass ) $abbrClass = ' class="'.$abbrClass.'"'; if ( $tooltipClass ) $tooltipClass = ", '".$tooltipClass."'"; if ( $abbrText ) { $tooltip = '<abbr'.$abbrClass; } else { $tooltip = ''; } $tooltip .= ' onMouseOver="ttShow('."'".str_replace(array('"',"'","\n","\r","||"),array('"',"\\'",'~~n','','<br>'),$tooltipText)."'".$tooltipClass.');" onMouseOut="ttHide();"'; if ( $onClick ) $tooltip .= ' onClick="'.$onClick.'"'; if ( $abbrText ) $tooltip .= '>'.$abbrText.'</abbr>'; return $tooltip; } // twoDigit($number, $minLenght) // Returns $number as a two+ digit number. The number is zero padded to the left. // $number = The number to parse. // $minLenght = The minimum number length. Default is 2 (hence the function name 'twoDigit'). function twoDigit($number, $minLenght=2) { $twoDigit = $number; while ( strlen($twoDigit) < $minLenght ) { $twoDigit = '0'.$twoDigit; } #t_Func($twoDigit); return $twoDigit; } // userEmail($userId) // Return the user's email address from the userId. function userEmail($userId) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $query=sprintf("SELECT userEmail FROM user WHERE userId='%s'", get_magic_quotes_gpc() ? $userId : addslashes($userId)); $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userRow = mysqli_fetch_assoc($userResult); $userEmail = $userRow['userEmail']; } else { $userEmail = ""; } if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($userId)=$userEmail".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $userEmail; } // userFirstName($userId) // Return the user's last name from the userId. // $userId = The userId. function userFirstName($userId=0) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $query = " SELECT userFirstName FROM user WHERE userId = ".$userId." "; $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userInfo = mysqli_fetch_assoc($userResult); } else { $userInfo = array(); } if (count($userInfo)) { $userFirstName = trim($userInfo['userFirstName']); } else { $userFirstName = "N/A (".$userId.")"; } return $userFirstName; } // userLastName($userId) // Return the user's last name from the userId. // $userId = The userId. function userLastName($userId=0) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $query = " SELECT userLastName FROM user WHERE userId = ".$userId." "; $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userInfo = mysqli_fetch_assoc($userResult); } else { $userInfo = array(); } if (count($userInfo)) { $userLastname = trim($userInfo['userLastName']); } else { $userLastname = "N/A (".$userId.")"; } return $userLastname; } // userName($userId, $useNickname=true, $addMiddlename=false, $lastFirst = false) // Return the user's name from the userId. // $userId = The userId. // $useNickname = Use any nickname if true else use firstname. Default is to use nickname. function userName($userId=0, $useNickname=true, $addMiddlename=false, $lastFirst = false) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; if ( $userId ) { $query = " SELECT userFirstName , userMiddleName , userLastName , userNickname FROM `user` WHERE userId = ".$userId." "; $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userInfo = mysqli_fetch_assoc($userResult); } else { $userInfo = array(); } } else { $userInfo = array(); } if (count($userInfo)) { if (!$lastFirst) { if ( !$useNickname || !$userInfo['userNickname'] ) { $userFullName = stripslashes(stripslashes(trim($userInfo['userFirstName']))); if ( $addMiddlename && $userInfo['userMiddleName'] ) $userFullName .= " ".stripslashes(stripslashes(trim($userInfo['userMiddleName']))); if ( $userInfo['userLastName'] ) $userFullName .= " ".stripslashes(stripslashes(trim($userInfo['userLastName']))); } else { $userFullName = stripslashes(trim($userInfo['userNickname'])); if ( $userInfo['userLastName'] ) $userFullName .= " ".stripslashes(stripslashes(trim($userInfo['userLastName']))); } } else { $userFullName = ''; if ( $userInfo['userLastName'] ) $userFullName .= stripslashes(stripslashes(trim($userInfo['userLastName']))).', '; $userFullName .= stripslashes(stripslashes(trim($userInfo['userFirstName']))); if ( $addMiddlename && $userInfo['userMiddleName'] ) $userFullName .= " ".stripslashes(stripslashes(trim($userInfo['userMiddleName']))); } } else { $userFullName = "N/A (".$userId.")"; } return $userFullName; } // userNamePossessive($userId, $useNickname) // Return the user's name from the userId in possessive form. // $userId = The userId. // $useNickname = Use any nickname if true else use firstname. Default is to use nickname. function userNamePossessive($userId=0, $useNickname=true) { $userNamePossessive = userName($userId, $useNickname)."'"; if ( substr($userNamePossessive,-2) != "s'" ) $userNamePossessive = $userNamePossessive.'s'; return $userNamePossessive; } // userNickName($userId) // Return the user's nickname or first name from the userId. function userNickName($userId) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $query=sprintf("SELECT userFirstName, userNickname FROM user WHERE userId='%s'", get_magic_quotes_gpc() ? $userId : addslashes($userId)); $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userRow = mysqli_fetch_assoc($userResult); if ($userRow['userNickname'] == "") { $f_userNickName = $userRow['userFirstName']; } else { $f_userNickName = $userRow['userNickname']; } } else { if ($userId !== 0) { $f_userNickName = "N/A"; } else { $f_userNickName = "default"; } } if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($userId)=$f_userNickName".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $f_userNickName; } // userStudentId($userId) // Return the user's userStudentId from the userId. function userStudentId($userId) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $query=sprintf("SELECT userStudentId FROM user WHERE userId='%s'", get_magic_quotes_gpc() ? $userId : addslashes($userId)); $userResult = query_do($query); if ($_SESSION['qry']['count']) { $userRow = mysqli_fetch_assoc($userResult); $userStudentId = $userRow['userStudentId']; } else { $userStudentId = "?"; } if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($userId)=$userStudentId".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $userStudentId; } // uuid() // Generate a uuid for form control (used to prevent reload). function uuid() { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $uuid = md5(getmypid().uniqid(rand()).$_SERVER['SERVER_NAME']); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."()=$uuid".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $uuid; } // quot() // Change quote (") marks to ". function quot($string) { $debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK; $quot = str_replace('"', '"', str_replace('\"', '"', $string)); if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($string)=$quot".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n"; return $quot; } ?>