SCDNG PELER
Server IP : 162.241.126.129  /  Your IP : 18.118.166.45
Web Server : Apache
System : Linux 162-241-126-129.cprapid.com 4.18.0-477.27.2.el8_8.x86_64 #1 SMP Fri Sep 29 08:21:01 EDT 2023 x86_64
User : rvway5nu4 ( 1018)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/rvway5nu4/www/phplib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/rvway5nu4/www/phplib//functions.lib.php
<?php    
#-------------------------------------------------------------
// Function	: ReadTemplate
// Description	: Reads Template File and return the Content of the File 


function call_logo($db)
{
global $logo, $APPL_NAME, $SITE_URL;
echo $query="select * from tbl_settings where v_variable= 'SGWebsiteName'";
$db->query($query);
	if ($db->num_rows())
	{
		$row        = $db->fetch_array();
		$websitename = $row['v_value'];
	}
$filename = $_SERVER['DOCUMENT_ROOT'].$MAP_VROOT_PATH.'/images/'.LOGO_NAME;
//echo $filename;
if (file_exists($filename)== true) 
{
    $logo = '<a href="'.$SITE_URL.'/admin/static_pages/index.php?action=view"><img border=0 src="'.$SITE_URL.'/images/'.LOGO_NAME.'" alt="'.$APPL_NAME.'" width="351" height="121" /></a>';
} else {
    $logo = '<a href="'.$SITE_URL.'/admin/static_pages/index.php?action=view"><h3>'.$websitename.'</h3></a>';
}
} 



function ReadTemplate($fileName) {
	$fd	=	fopen($fileName, "r");
	return fread($fd, filesize ($fileName));
}

#-------------------------------------------------------------
// Function		: isadminLoggedIn
// Description	: this is to check that admin is logged in or not if logged in then send to admin page.
function isadminLoggedIn() {
	global $SITE_URL,$USER,$LINK,$OPTIONS,$LAST_LOGIN;
	$USER		=	"Guest";
	//$LINK		=	"<a href='$SITE_URL/cms/' class='logoutlink'>Log in</a>";
	$LINK		=	"";
	$OPTIONS	=	"";
	$LAST_LOGIN	=	"";

	if($_SESSION['SESS_adminLoggedIn']	== '1' && $_SESSION['SESS_i_uid']	!= '' && $_SESSION['SESS_v_login']	!= '') {   
		header("Location: $SITE_URL/admin/static_pages/index.php?action=view");
		exit;
	} 
}                                     

#-------------------------------------------------------------
// Function		: isadminLoggedOut
// Description	: this is to check that admin is logged in or not if not logged in then send to login page .
function isadminLoggedOut($SGAddPages) {          

	global $addpages,$SITE_URL,$USER,$CHANGE_PASS,$LINK,$OPTIONS,$LAST_LOGIN;
	
	$USER			=	$_SESSION["SESS_v_login"];

	$LINK			=	"<a href='$SITE_URL/admin/logout.php' class='logoutlink'>Logout</a>"; 
	$CHANGE_PASS	=	"<a href='$SITE_URL/admin/change_pass.php?action=edit' class='logoutlink'>Change Password</a>";
	$lastLogin		=	getLastLoginTime();
	$LAST_LOGIN		=	"Last Login : ".$lastLogin;
	if($_SESSION['SESS_adminLoggedIn']	!= '1' || $_SESSION['SESS_i_uid']	== '' || $_SESSION['SESS_v_login']	== '') {
		header("Location: $SITE_URL/admin/index.php");
		exit;
	}
}

function cms_menu($SGAddPages)
{
global $OPTIONS, $IMG_DIR_ADMIN, $SITE_URL;  
if($SGAddPages == 'yes')
	{
  $addpages = "<li><a href='$SITE_URL/admin/static_pages/add_static_pages.php?action=add'>Add Pages</a></li>";
  }
  else
  {
  $addpages = " ";
  }
$OPTIONS		=	"<div id='middle'>
	<div class='left'>
		<div class='left_tab'>					
					<div class='left_heading'> 
						<img src='$IMG_DIR_ADMIN/documents-manager.jpg' width='21' height='26' border='0' alt='' /> Page Manager</div>
						<div class='left_content'>
							<ul>
								<li><a href='$SITE_URL/admin/static_pages/manage_pages.php?action=view'>Manage Pages</a></li>
								<li><a href='$SITE_URL/admin/static_pages/add_static_pages.php?action=add'>Add Pages</a></li>
								<li><a href='$SITE_URL/admin/static_pages/home_page_images.php?action=view'>Home Page Images</a></li>
								<li><a href='$SITE_URL/admin/static_pages/home_page_links.php?action=view'>Home Page Links/Logos</a></li>
							</ul>								
						</div>
					</div>
          <div class='left_tab'>					
					<div class='left_heading'> 
						<img src='$IMG_DIR_ADMIN/trial.png' width='21' height='26' border='0' alt='' /> News Manager</div>
						<div class='left_content'>
							<ul>
								<li><a href='$SITE_URL/admin/news.php?action=view'>Manage News</a></li>
								<li><a href='$SITE_URL/admin/add_news.php?action=add'>Add news</a></li>
							</ul>								
						</div>
					</div>
					
        
					<div class='left_tab'>
						<div class='left_heading'>
						<img src='$IMG_DIR_ADMIN/trial.png' width='26' height='22' border='0' alt='' /> Contact Manager</div>
						<div class='left_content'>
							<ul>
							<li><a href='$SITE_URL/admin/manage_contact.php'>Manage Contacts </a></li>
							      
							</ul>							
						</div>
					</div>

					<div class='left_tab'>					
					<div class='left_heading'> 
						<img src='$IMG_DIR_ADMIN/trial.png' width='21' height='26' border='0' alt='' /> Project Manager</div>
						<div class='left_content'>
							<ul>
								<li><a href='$SITE_URL/admin/manage_projects.php?action=view'>Manage Project</a></li>
								<li><a href='$SITE_URL/admin/add_projects.php?action=add'>Add Project</a></li>
							</ul>								
						</div>
					</div>

					<div class='left_tab'>
						<div class='left_heading'>
						<img src='$IMG_DIR_ADMIN/client-manger.jpg' width='21' height='26' border='0' alt='' /> Profile Manager
						</div>
						<div class='left_content'>
							<ul>
							<li> <a href='$SITE_URL/admin/admin_users/add_admin_users.php?action=edit'>Admin Profile </a></li>
							     
							           <li><a href='$SITE_URL/admin/change_pass.php?action=edit'>Change Password</a></li>							      
							</ul>							
						</div>
					</div>
					
          <div class='left_tab_bottom'>
						<div class='left_heading'>
						<img src='$IMG_DIR_ADMIN/service-manager.jpg' width='21' height='26' border='0' alt='' /> System Settings</div>
						<div class='left_content'>						
							<ul>
								<li><a href='$SITE_URL/admin/system_settings/global_parameters.php?action=view'>System Settings</a></li>
							  <li><a href='$SITE_URL/admin/static_pages/change_log.php'>System Logs</a></li>
							  <!--li><a href='$SITE_URL/admin/manage_contact.php'>Manage Contacts</a></li-->
							  <li><a href='$SITE_URL/admin/event_mailer.php'>Event Mailer</a></li>
							</ul>
						</div>
					</div>
				<br \>
			</div>";
}
function getLastLoginTime() {
	global $DB_HOST, $DB_USERNAME, $DB_PASSWORD, $DB_NAME, $DB_REPORT_ERROR, $DB_PERSISTENT_CONN;

	$db	=	new DbConnect($DB_HOST, $DB_USERNAME, $DB_PASSWORD, $DB_NAME, $DB_REPORT_ERROR, $DB_PERSISTENT_CONN);
	$db->open() or die($db->error());

	$select	=	"select d_lastlogin from tbl_admin_users where i_uid='".$_SESSION['SESS_i_uid']."'";
	$db->query($select);
	$record	=	$db->fetch_array();

	$datetime	=	date_create($record['d_lastlogin']);
	return date_format($datetime, 'd F Y, h:i:s A');
}
#-------------------------------------------------------------
// Function	: ReplaceContent
// Description	: Replace Content in Templates with Equivalent Variables

function ReplaceContent($VarList) {
	//echo '<pre>';
	//echo '<code>';
	
	//print_r($VarList);
	//echo '</code>';
	//echo '</pre>';
	
	for($i=0; $i<count($VarList); $i++) {
		//global $$VarList[$i];
		//$$VarList[$i]	=	preg_replace("/__(\w+)__/e","\$GLOBALS['$1']",$$VarList[$i]);     
	}
	return 1;
	// For Future Refrence :  $RIGHT_HOME_CONTENT=preg_replace("/__(\w+)__/e","$$1",$RIGHT_HOME_CONTENT);
}

#-------------------------------------------------------------
// Function	: placeScripts
// Description	: Replace Content in Templates with Equivalent Variables

function placeScripts($ScriptList) {
	global $SCRIPTS;
	$SCRIPTS	=	"";
	for($i=0; $i<count($ScriptList); $i++) {
		$SCRIPTS	.=	"<script language=JavaScript src=\"".$ScriptList[$i]."\"></script>\n";
	}
	return 1;
}
function placeStyle($StyleList) {
	global $STYLESHEET;
	$STYLESHEET = "";
	for($i=0; $i<count($StyleList); $i++) {
		
		$STYLESHEET .= "<link rel='stylesheet' href=\"".$StyleList[$i]."\">\n";
		

	}
	return 1;
}
function GetModuleVars($MODULE, $db) {
	$SETTINGS	=	Array();
	$query		=	"select v_variable, v_value  from tbl_settings where 1"; 
	$db->query($query);
	if ($db->num_rows()) {
		while ($row = $db->fetch_array()) {
			$v_variable				=	$row['v_variable'];
			$v_value				=	$row['v_value'];	
			$SETTINGS[$v_variable]	=	$v_value;
		}
	}
	return $SETTINGS;
}

function GetMailTemplate($TEMPLATE, $db) {  
	$MAIL_DATA	=	Array();
	$query		=	"select * from tbl_email_templates where v_templatetitle='$TEMPLATE'";
	$db->query($query);
	if ($db->num_rows()) {
		$row					=	$db->fetch_array();
		$v_subject				=	$row['v_subject'];
		$t_message				=	$row['t_message'];	
		$MAIL_DATA['subject']	=	$v_subject;
		$MAIL_DATA['message']	=	$t_message;		
	} 
	return $MAIL_DATA;
}

function addTags($values){
	$newValue	=	str_replace(' ','_',$values);
	$newValue	=	str_replace('&','and',$newValue);
	return $newValue;
}

function removeTags($values) {
	$newValue	=	str_replace('_',' ',$values);
	$newValue	=	str_replace('and','&',$newValue);
	return $newValue;
}

function getTimeStamp($date){
	//  using the format dd-mm-yyyy
	if($date=='')
		return mktime();
	else {
		$dateArr	=	explode("/",$date);
		return mktime(0,0,0,$dateArr[1],$dateArr[0],$dateArr[2]);
	}
}

function createUserPassword($passLength,$user_name){
	$charStr	=	"abcdefghijklmnopqrstuvwxyz";
	$DigitStr	=	"0123456789";
	$strPass	=	"";
	$digitPass	=	"";

	for($i=0;  $i<4; $i++) {
		$randStrIndex	=	rand(0,25);
		$strPass		.=	substr($charStr, $randStrIndex, 1);

		$randDigitIndex	=	rand(0,9);
		$digitPass		.=	substr($DigitStr, $randDigitIndex, 1);
	}

	$userPass	=	$strPass.$digitPass;

	if($userPass==$user_name) {
		createUserPassword($passLength,$user_name);
	} else {
		return $userPass;
	}
}


function randomPassword() {
    $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 8; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}
// function is used to upload images

function copyImage($fileLocation,$image,$width=100,$height=100,$id="") {
	$iname	=	time();
	if($image['name']) {
		$ext	=	substr($image['name'], strrpos($image['name'], '.') + 1);
		if($id!="")
			$newFile	=	$id."_".$iname.'_'.$image['name'];
		else
			$newFile	=	$iname.'_'.$image['name'];
    
		$newFilePath	=	$fileLocation.'/'.$newFile;
		// chmod($fileLocation, 0777);
		move_uploaded_file($image['tmp_name'], $newFilePath);
		chmod($newFilePath, 0777);

		$imgAttributes	=	getimagesize($newFilePath);

		if($imgAttributes[0]!=237 && $imgAttributes[1]==282) {
			createthumb($newFilePath,$newFilePath,$width,$height);
			chmod($newFilePath, 0777);
		}
	}
	return $newFile;
}
// function to create thumbs of images

function createthumb($name,$filename,$new_w,$new_h){
	$pos		=	strrpos($name, '.');
	$system[1]	=	substr($name,$pos,strlen($name));

	if (preg_match('/jpg|jpeg/',$system[1])) {
		//echo'jpg '.$name." file ".$filename;
		$src_img	=	imagecreatefromjpeg($name);
	}

	if (preg_match('/png/',$system[1])) {
		//echo'png '.$name." file ".$filename; 
		$src_img	=	imagecreatefrompng($name);
	}

	if(preg_match('/gif/',$system[1])) {
		//echo'gif '.$name." file ".$filename;
		$src_img	=	ImageCreateFromGIF($name);
	}
   
	if(preg_match('/bmp/',$system[1])) {
		//echo'gif '.$name." file ".$filename;
		// convert bmp to png using shell command
		rename($name, "$name.bmp");
		$command	=	"bmptoppm $name.bmp | pnmtopng > $name";
		exec($command);
		// remove original bmp
		unlink("$name.bmp");
		// check png image by loading and saving the file
		//  to prevent wrong uploaded files and errors
		$src_img	=	@imagecreatefrompng($name);
		//imagepng($img, $filename);
		//imagedestroy($img);
		//ImageWbmp ($name, "test.wbmp", 0);
		// $src_img=imagecreatefromwbmp("test.wbmp"); 
	}

	$old_x	=	@imageSX($src_img); 
	$old_y	=	@imageSY($src_img);
	if ($old_x > $old_y) { 
		$thumb_w	=	$new_w;
		$thumb_h	=	$old_y*($new_h/$old_x);
	}

	if ($old_x < $old_y) {
		$thumb_w	=	$old_x*($new_w/$old_y);
		$thumb_h	=	$new_h;
	}

	if ($old_x == $old_y) {
		$thumb_w	=	$new_w; 
		$thumb_h	=	$new_h;
	}
 
	$dst_img	=	ImageCreateTrueColor($thumb_w,$thumb_h);

	imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); 
	if (preg_match("/png/",$system[1])) {
		imagepng($dst_img,$filename); 
	}
	if (preg_match('/jpg|jpeg/',$system[1])) {
		imagejpeg($dst_img,$filename); 
	}
	if (preg_match('/gif/',$system[1])) {
		ImageGIF($dst_img,$filename); 
	}
	if (preg_match('/bmp/',$system[1])) {
		imagepng($dst_img,$filename); 
	}
	imagedestroy($dst_img); 
	imagedestroy($src_img); 
}

function display_message() {
	global $PROMPT,$PROMPT_CLASS;
	if($_SESSION['sess_msg']!='') {
		$PROMPT			=	$_SESSION['sess_msg'];
		$PROMPT_CLASS	=	$_SESSION['sess_class'];
	}
	$_SESSION['sess_msg']	=	"";
	$_SESSION['sess_class']	=	""; 
}

function XMLSpecialChars($stage1) {
	$stage1	=	str_replace('&nbsp;', '&#160;', $stage1);
	$stage1	=	str_replace('&nquot;', '"', $stage1);
	$stage1	=	str_replace('&apos;', "'", $stage1);
	$stage1	=	str_replace('&gt;', ">", $stage1);
	$stage1	=	str_replace('&lt;', "<", $stage1);
	return $stage1;
}
// function to add in site log

function addIntoLog($string, $db) {
	//	if getenv results in something, proxy detected
	if (getenv('HTTP_X_FORWARDED_FOR')) {
		$ip_str	=	"v_ipaddress		=	'".getenv('HTTP_X_FORWARDED_FOR')."'";
	}
	//	otherwise no proxy detected
	else {
		$ip_str	=	"v_ipaddress		=	'".getenv('REMOTE_ADDR')."', ";
	}
	  $insert	=	"insert into tbl_site_log 
				 set v_logtype		=	'CMS', 
					 v_addedby		=	'".$_SESSION['SESS_v_login']."', 
					 t_description	=	'".$string."', 
					 ".$ip_str.",
					 d_time			=	NOW() ";
	$db->query($insert);
}

function getCategory($pid,$db) {
	$select		=	"select v_pg_name from tbl_static_pages where i_id='$pid'";
	$db->query($select);
	if ($db->num_rows()) {
		$row	=	$db->fetch_array();
		$parent	=	$row['v_pg_name'];
	}
	return $parent;
} 
/*
function getcategory($selected_id,$i_id,$db)
{
global $PMENU;
$sql="select * from tbl_category where e_status='L' order by i_sort_order";
$rs=$db->query($sql);
$PMENU .= "<ul>";
$count= $db->affected_rows();
$i=1;
while($row=$db->fetch_array($rs))
      { 
      
      $category_id = addslashes($row['i_id']);
      if($category_id == $selected_id)
            $class='active';
      else
            $class='';    
      if($i == 4)
          $class=last_link;              
      $v_catname=addslashes($row['v_catname']);
      $PMENU .= "<li class='$class'><a href='portfolio.php?action=view&i_id=$i_id&selected_id=$category_id'>$v_catname</a></li>";
      $i++;
      }
$PMENU .= "</ul>";

}
  */
function getPageNameId($pgName,$db) {
	$select		=	"select i_id from tbl_static_pages where v_pg_name='$pgName'";
	$db->query($select);
	if ($db->num_rows()) {
		$row	=	$db->fetch_array();
		$i_id	=	$row['i_id'];
	}
	return $i_id;
}

function showParameters($module, $db) {
  global $yes_status, $no_status;
	$query	=	"select v_variable,v_value,d_datemodified from tbl_settings where 1";
	$db->query($query);
	if ($db->num_rows()) {
		while ($row = $db->fetch_array()) {
			$v_variable		=	trim($row['v_variable']);
			global $$v_variable;
			$$v_variable	=	trim($row['v_value']);	
			$wef_var		=	$v_variable."_WEF";
			global $$wef_var;
			$$wef_var		=	$row['d_datemodified']!=0 ? $row['d_datemodified']  : '-';
			if($v_variable == 'SGAddPages')
			   {     
			     if($$v_variable == 'yes')
			         $yes_status = 'checked';
			     else
			         $no_status  = 'checked';
         }
		}
			
		if ($SGDisplayContactInfo == FLAG_YES){
			$checked_var	=	"SGDisplayContactInfo_CHECKED";
			global $$checked_var;
			$$checked_var	=	"CHECKED";
		}
	}
	return true;
}

function updateParameters($module,   $db){
	global $PROMPT, $HTTP_POST_VARS, $SITE_URL;
	$resetDone			=	false;
  
    $updatedTime        =	date('Y-m-d H:i:s');
  	$SGWebmasterEmail	=	trim($_POST["SGWebmasterEmail"]);
  	$SGEmailHelpDesk	=	trim($_POST["SGEmailHelpDesk"]);
  	$SGPhoneHelpDesk	=	trim($_POST["SGPhoneHelpDesk"]);
  	$SGMailSenderName	=	trim($_POST["SGMailSenderName"]);
    $SGMailSenderEmail	=	trim($_POST["SGMailSenderEmail"]);
    $SGLogRetentionPd	=	trim($_POST["SGLogRetentionPd"]);
    $SGWebsiteName    =trim($_POST["SGWebsiteName"]);
    $SGFacebookUrl    =trim($_POST["SGFacebookUrl"]);
	$SGTwitterUrl    =trim($_POST["SGTwitterUrl"]);
	$SGMySpaceUrl    =trim($_POST["SGMySpaceUrl"]);
    $SGAddPages       =trim($_POST["SGAddPages"]); 

    if($SGAddPages == 'yes')
            $SGAddPages = 'yes';
    else
            $SGAddPages = 'no';
    $update	=	"update tbl_settings set v_value='$SGWebmasterEmail' where v_variable='SGWebmasterEmail'";
  	$db->query($update);
  	if ($db->affected_rows()) {
		$resetDone	=	true;
  		$update		=	"update tbl_settings set d_datemodified='$updatedTime' where v_variable='SGWebmasterEmail'";
  		$db->query($update);
  	}

	$update	=	"update tbl_settings set v_value='$SGMailSenderEmail' where v_variable='SGMailSenderEmail'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified = '$updatedTime' where v_variable = 'SGMailSenderEmail'";
		$db->query($update);
	}
		
    $update	=	"update tbl_settings set v_value  = '$SGMailSenderName' where v_variable = 'SGMailSenderName'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGMailSenderName'";
		$db->query($update);
	}
			
	$update	=	"update tbl_settings set v_value  = '$SGLogRetentionPd' where v_variable = 'SGLogRetentionPd'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGLogRetentionPd'";
		$db->query($update);
	}
	
	$update	=	"update tbl_settings set v_value  = '$SGEmailHelpDesk' where v_variable = 'SGEmailHelpDesk'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGEmailHelpDesk'";
		$db->query($update);
	}
			
	$update	=	"update tbl_settings set v_value  = '$SGPhoneHelpDesk' where v_variable = 'SGPhoneHelpDesk'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGPhoneHelpDesk'";
		$db->query($update);
	}
	
  $update	=	"update tbl_settings set v_value  = '$SGWebsiteName' where v_variable = 'SGWebsiteName'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGWebsiteName'";
		$db->query($update);
	}

	$update	=	"update tbl_settings set v_value  = '$SGFacebookUrl' where v_variable = 'SGFacebookUrl'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGFacebookUrl'";
		$db->query($update);
	} 

	$update	=	"update tbl_settings set v_value  = '$SGTwitterUrl' where v_variable = 'SGTwitterUrl'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGTwitterUrl'";
		$db->query($update);
	} 

	$update	=	"update tbl_settings set v_value  = '$SGMySpaceUrl' where v_variable = 'SGMySpaceUrl'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGMySpaceUrl'";
		$db->query($update);
	} 

	 $update	=	"update tbl_settings set v_value  = '$SGAddPages' where v_variable = 'SGAddPages'";
	$db->query($update);
	if ($db->affected_rows()) {
		$resetDone	=	true;
		$update		=	"update tbl_settings set d_datemodified   = '$updatedTime' where v_variable = 'SGAddPages'";
		$db->query($update);
	} 
	
	if($resetDone) {
		header("location:$SITE_URL/admin/action_taken.php?siteMsgs=15&back=$SITE_URL/admin/system_settings/global_parameters.php?action=view");
	} else {
		$_SESSION['sess_msg']	=	"No status updated.";
		header("location:$SITE_URL/admin/system_settings/global_parameters.php?action=view");
		exit;
	}
	return true;
}

function getMetaInfo($v_pg_name,$db){
	global $APPL_NAME,$PAGE_NAME,$PAGE_URL,$META_TITLE,$META_KEYWORD,$META_DESCRIPTION,$SUB_DOMAIN;

	$select		=	"select * 
					 from tbl_static_pages 
					 where v_pg_name='$v_pg_name' 
						and e_status='".STATUS_LIVE."'";
	$res		=	$db->query($select);
	$row		=	$db->fetch_array();

	$pg_name    =	stripslashes($row[v_pg_name]);
	$pg_url     =	stripslashes($row[v_pg_url]);
	$meta_title =	stripslashes($row[v_meta_title]);
	$meta_key   =	stripslashes($row[v_meta_keyword]);
	$meta_desc  =	stripslashes($row[v_meta_desc]);

	if($meta_title  ==  "") {
		$meta_title	=	$APPL_NAME;
	}
	if($meta_key  ==  "") {
		$meta_key	=	$APPL_NAME;
	}
	if($meta_desc  ==  "") {
		$meta_desc	=	$APPL_NAME;
	}

	$PAGE_NAME         =	"TAXIBOX - ".$SUB_DOMAIN." - ".$pg_name;
	$PAGE_URL          =	$pg_url;
	$META_TITLE        =	$meta_title;
	$META_KEYWORD      =	$meta_key;
	$META_DESCRIPTION  =	$meta_desc;

	#$metaInfoArr	=	array($pg_name,$pg_url,$meta_title,$meta_key,$meta_desc);
	#return $metaInfoArr;
}


function getPageUrl($pid,$db) {
	$select	=	"select v_pg_url from tbl_static_pages where i_id='$pid'";
	$db->query($select);
	if ($db->num_rows()) {
		$row		=	$db->fetch_array();
		$v_pg_url	=	$row['v_pg_url'];
	}
	return $v_pg_url;
}



function getAncestorImmediateChild($id, $child_id, $db){
	global $SITE_URL, $BREAD_CRUMB;

	if($id==0 || $id=="") {
		$parent	=	0;
		$child	=	0;
	} else {
		$select	=	"select i_parent_id,v_pg_name from tbl_static_pages where i_id='$id'";
		$db->query($select);
		if($db->num_rows()>0){
			$res			=	$db->fetch_array();
			$i_parent_id	=	$res['i_parent_id'];
			$v_pg_name		=	$res['v_pg_name'];

			if($i_parent_id>0){
				$db1	=	clone $db;
				$child	=	$id;

				$parent	=	getAncestorImmediateChild($i_parent_id, $child, $db1);
			} else {
				$parent	=	$id;
				$child	=	$child_id;
			}
		} else {
			$parent	=	0;
			$child	=	0;
		}
	}
	return "$parent,$child";
}

function getAncestorID($child_id, $db) {
	if($child_id==0 || $child_id=="") {
		$pid	=	0;
	} else {
		$select	=	"select i_parent_id,v_pg_name from tbl_static_pages where v_pg_name='$child_id'";
		$db->query($select);
		if($db->num_rows()>0){
			$res			=	$db->fetch_array();
			$i_parent_id	=	$res['i_parent_id'];
			$v_pg_name		=	$res['v_pg_name'];
			if($res['i_parent_id']>0) {
				$db1	=	clone $db;
				$pid	=	getAncestorID($i_parent_id, $db1);
			} else {
				$pid	=	$child_id;
			}
		} else {
			$pid	=	0;
		}
	}
	return $pid;
}

function getAncestorName($child_name, $db) {
	
		$select	=	"select i_parent_id from tbl_static_pages where v_pg_name='$child_name'";
		$db->query($select);
		if($db->num_rows()>0){
			$res			=	$db->fetch_array();
			$i_parent_id	=	$res['i_parent_id'];
		}
		$select	=	"select v_pg_name from tbl_static_pages where i_id='$i_parent_id'";
		$db->query($select);
		if($db->num_rows()>0){
			$res			=	$db->fetch_array();
			$v_pg_name		=	$res['v_pg_name'];
		}
		return $v_pg_name;
		
}

function getPageUrlData($page_url, $db) {
	$select	=	"select i_id,v_pg_name,i_parent_id from tbl_static_pages where v_pg_url='$page_url'";
	$db->query($select);
	if ($db->num_rows()) {
		$row		=	$db->fetch_array();
		$i_id		=	$row['i_id'];
		$v_pg_name	=	$row['v_pg_name'];
		//$i_parent_id	=	$row['i_parent_id'];
		$i_parent_id=	getAncestorID($row['i_parent_id'], $db);
	}

	return array('i_id'=>$i_id, 'pageName'=>$v_pg_name, 'parentID'=>$i_parent_id);
}

function printArr($arr) {
	print "<pre>";
	print_r($arr);
	print "</pre>";
}

function getChilds($i_id,$db) {
	$sel	=	"select count(*) as total from tbl_static_pages where i_parent_id='".$i_id."' ";
	$db->query($sel);
	$row	=	$db->fetch_array();
	$total	=	$row['total'];
	return $total;
}

/*
function breadcrump($BREADCRUMP,$p_id,$db) {
	global $BREADCRUMP;

	$sel	=	"select * from tbl_static_pages where i_id='".$p_id."' ";
	$db->query($sel);
	if($db->num_rows()) {
		while($row=$db->fetch_array()) {
			$db1		=	clone $db;
			$BREADCRUMP	.=	LINK_DIV.$row['v_pg_name'];
			if($row['i_parent_id']=='0') {
			}//	return $BREADCRUMP;
			else
				breadcrump($BREADCRUMP,$row['i_parent_id'],$db1);
		}
	}
}*/


function getBreadcrump($LocationID,$db) {
	global $SITE_URL;

	$BREADCRUMP	=	"";
	if($LocationID) {
		$last	=	"false";
  		$LocID;
  		$LocName;
  		$i		=	0;
  		$k		=	0;
		$flg	=	true;
  		while($flg) {
			$categories_query	=	"select * from tbl_static_pages where i_id='".$LocationID."' ";
			$db->query($categories_query);
			if($db->num_rows()) {
				while($t_link=$db->fetch_array()) {
					//$LocID[$i]	=	"manageCategory/".$t_link["i_id"];
					
					$LocID[$i]		=	$SITE_URL."/".$t_link["v_pg_url"].".php";

					$LocName[$i]	=	$t_link["v_pg_name"];
  					$LocationID		=	(int)$t_link["i_parent_id"];
  					$i				=	$i+1;
					if (!$LocationID) {
						$flg	=	false;
					}
				}
			}
			else {
				$flg	=	false;
			}
		}

		//	$BREADCRUMP	=	LINK_DIV;
		for($k=sizeof($LocName) -1;$k>=0;$k--) {
			if ($k!=0) {
				$BREADCRUMP	.=	" > <a class='darkpink' href='".$LocID[$k]."'>$LocName[$k]</a>";
			}
  			else {
				if ($last=="false") {
					$BREADCRUMP	.=	" > ".$LocName[$k]."<br>";
				}
  				else {
					$BREADCRUMP	.=	" > "."<a href='".$LocID[$k]."'>".$LocName[$k]."</a>";
				}
			}
		}
	}
	return $BREADCRUMP;
}

function displaylink($LocationID,$db) {
	global $SITE_URL;

	$BREADCRUMP	=	"";

	//echo $LocationID."ddd";exit;

	if($LocationID) {
		$last	=	"false";
  		$LocID;
  		$LocName;
  		$i		=	0;
  		$k		=	0;
		$flg	=	true;
  		while($flg) {
			$categories_query	=	"select * from tbl_static_pages where i_id='".$LocationID."' ";
			$db->query($categories_query);
			if($db->num_rows()) {
				while($t_link=$db->fetch_array()) {
					//$LocID[$i]	=	"manageCategory/".$t_link["i_id"];

					$LocID[$i]		=	$SITE_URL."/admin/static_pages/child_pages.php?action=view&p_id=".$t_link["i_id"];
					
					$LocName[$i]	=	$t_link["v_pg_name"];
					$LocationID		=	(int)$t_link["i_parent_id"];
					$i				=	$i+1;
					if (!$LocationID) {
						$flg	=	false;
					}
				}
			}
			else {
				$flg	=	false;
			}
		}

		//	$BREADCRUMP	=	LINK_DIV;
  		for($k=sizeof($LocName) -1;$k>=0;$k--){
			if ($k!=0) {
				$BREADCRUMP	.=	LINK_DIV."<a class='darkpink' href='".$LocID[$k]."'>$LocName[$k]</a>";
			}
			else {
				if ($last=="false") {
					$BREADCRUMP	.=	LINK_DIV.$LocName[$k]."<br>";
				}
				else {
					$BREADCRUMP	.=	LINK_DIV."<a href='".$LocID[$k]."'>".$LocName[$k]."</a>";
				}
			}
		}
	}
	return $BREADCRUMP;
}

function headerList($arrName)
{
	global $Header,$IMG_DIR,$TEMPLATE_DIR,$HEADER_CELL_TEXT,$HEADER_CELL_IMG,$HEADER_CELL_HREF,$H1;
	//header_cell.html
	$H1=$H2= ReadTemplate("$TEMPLATE_DIR/admin/common/header_cell.html");
	//,$sort_order,$sort_by
	$Header="";
	
	foreach($arrName as $HEADER_CELL_TEXT =>$key)
	{
		$HEADER_CELL_IMG="";
		$THIS_SORT_ORDER='desc';
		if($key==$_REQUEST[sort_by] && $key )
		{
			if($_REQUEST[sort_order]=='asc')
			{
			$HEADER_CELL_IMG= "<img src=$IMG_DIR/sort_up.gif border=0>";
				$THIS_SORT_ORDER='desc';
			}
			else
			{
					$HEADER_CELL_IMG= "<img src=$IMG_DIR/sort_down.gif border=0>";
				$THIS_SORT_ORDER='asc';
			}
		}
		
		if($key)
		{
			$HREF="$PHP_SELF?sort_order=$THIS_SORT_ORDER&sort_by=$key";
			foreach($_REQUEST as $k=>$v)
			{
				if(in_array($k,array('sort_order','sort_by','PHPSESSID')))continue;
				if($_COOKIE && array_key_exists($k,$_COOKIE))continue;
				$HREF.="&$k=$v";
			}
			$HEADER_CELL_HREF="<a class='td_color' href='$HREF' >"; 
		}
		else
		{
			$HEADER_CELL_HREF="";
		}
		
		if($HEADER_CELL_TEXT=="X")
		{
			$HEADER_CELL_TEXT="<input type='checkbox'  id='SELECT_ALL' onclick=\"with(this.form)for(i = 0; i < elements.length; i++){if (elements[i].type == 'checkbox'){elements[i].checked =(this.checked)?true:false; }}  if(this.checked == true){color_all();}else{color_all();}\">";
		}
		
		ReplaceContent(Array("H1"));
		$Header.=$H1;
		$H1=$H2;
		$THIS_SORT_ORDER='desc';
	}
	return $Header;
}




function getpage($i_id,$db)
{
    global $CONTENT, $PAGE_TITLE, $META_KEYWORD, $META_TITLE, $META_DESC; 
	$sql			=	"select * from tbl_static_pages where i_id='".$i_id."' and e_status='L'";
	$db->query($sql);
	$row			=	$db->fetch_assoc();
	$CONTENT		=	stripslashes($row['t_pg_desc'])."<br \>"; 
	$PAGE_TITLE		=	$row['v_pg_title'];
	$META_KEYWORD	=  $row['v_meta_keyword'];
	$META_TITLE		=  $row['v_meta_title'];  
	$META_DESC		=  $row['v_meta_desc'];    
}

function get_mail_data($db,$title)
{
global $title, $desc, $subject, $datecreated, $datemodified, $message, $variables;
$sql1= "select * from tbl_email_templates";
$db->query($sql1);
while($row = $db->fetch_assoc())
      {       
      if($title == $row['v_templatetitle'])
          {
          $desc         = $row['v_description'];
          $subject      = $row['v_subject'];
          $message      = $row['t_message'];
		  //echo $message;
		  //exit;
          $datecreated  = $row['d_datecreated'];
          $datemodified = $row['d_datemodified'];
          $variables    = $row['t_templatevars'];
          }
      }
}              
function firstOfMonth() {   $bool++;
return date("d-m-Y H:m:s", strtotime(date('m').'/01/'.date('Y').' 00:00:00')); 
} 
 
function lastOfMonth() {    $bool++;
return date("d-m-Y H:m:s", strtotime('-1 second',strtotime('+1 month',strtotime(date('m').'/01/'.date('Y').' 00:00:00')))); 
}

function floatingfooter($db,$i_pid,$i_id)
{
global $SITE_URL, $FLOAT_FOOTER;
if($i_pid == $i_id || $i_pid != 'Services')
       {
       $sql ="select * from tbl_static_pages where i_parent_id='2' order by i_sortorder";
       $rs=$db->query($sql);
       $count=$db->affected_rows();
       $i=1;
       while($row=$db->fetch_array($rs))
       { 
       if($i == 1)
          $delimiter="";
       elseif($i == $count)
          $delimiter=" and ";
       else
          $delimiter=", ";
       $pg_name = (trim($row['v_pg_name']));
       
       $pg_title = strtolower($row['v_pg_title']);
       $pg_id = $row['i_id'];
       $FLOAT_FOOTER .=$delimiter."<a href=".$SITE_URL."/$pg_name.html>$pg_title</a>";
       $i++;
       }
       }
else
       {
       $sql ="select * from tbl_static_pages where i_parent_id='2' and v_pg_name != '$i_id' order by i_sortorder";
       $rs=$db->query($sql);
       $count=$db->affected_rows();
       $i=1;
       while($row=$db->fetch_array($rs))
       { 
       if($i == 1)
          $delimiter="";
       elseif($i == $count)
          $delimiter=" and ";
       else                                                
          $delimiter=", ";
       $pg_name = trim($row['v_pg_name']);
       $pg_title = strtolower($row['v_pg_title']);
       $pg_id = $row['i_id'];
       $FLOAT_FOOTER .=$delimiter."<a href=".$SITE_URL."/$pg_name.html>$pg_title</a>";
       $i++;
       }
       }
}

function frontmenuhome($db,$i_id,$i_pid)
{
global $footer, $MENU, $SUBMENU, $SITE_URL;
$db1 = clone $db;
$sql = "select * from tbl_static_pages where e_status='L' and i_parent_id=0 and e_show_menu='Y' order by i_sortorder";
$rs=$db->query($sql);
$MENU = '<div id="glowmenu" class="glowingtabs"><ul>';
$i=1;
while($row=$db->fetch_array($rs))
{ 
      
    $id=$row['i_id'];
	  $v_pg_name  = $row['v_pg_name'];
      if($i_id == $v_pg_name || ($i_id == '' && $v_pg_name == 'Home'))
		    {//echo "<br>".$i_id." - ".$i_pid." - ".$v_pg_name;
    			if($i_pid != 'Contact')
    				{$class='active';$img='-bold'; $footer=" also";}
    			if($i_pid == 'Contact' && $v_pg_name == 'Contact')
    				
    				{$class='active';$img='-bold'; $footer="";}
			
		    }
      else
          {$class='';$img=''; }  
      switch($i)
          {
          case 1: $val='one'; break;
          case 2: $val='two'; break;
          case 3: $val='three'; $style='z-index:3';break;
          case 4: $val='four'; $style='z-index:2';break;
          case 5: $val='five'; $style='z-index:1';break;
          case 6: $val='six'; break;
          }         
      $v_pg_title  = $row['v_pg_title'];
      $sql1 = "select * from tbl_static_pages where e_status='L' and i_parent_id=$id order by i_sortorder";
      $rs1=$db1->query($sql1);  
      if($v_pg_name == "Home")
          $MENU .= '<li onclick="javascript:document.location.href=\''.$SITE_URL.'/index.php\'"><a class="'.$val.' '.$class.'" href="'.$SITE_URL.'/index.php" rel=""><span class="left">&nbsp;</span><span class="right"><img src="'.$SITE_URL.'/images/home'.$img.'.gif" alt="HOME" border="0" /></span></a></li>';
			elseif($v_pg_name == "Contact")
          $MENU .= '<li onclick="javascript:document.location.href=\''.$SITE_URL.'/contact.php\'"><a class="'.$val.' '.$class.'" style="'.$style.'" href="'.$SITE_URL.'/contact.php"'.$img.' rel=""><span class="left">&nbsp;</span><span class="right"><img src="'.$SITE_URL.'/images/contact'.$img.'.gif" alt="CONTACT" border="0" /></span></a></li>';
			else
          {
          $class_count=$db1->affected_rows();
          if($db1->affected_rows()>0)
              {
              if($v_pg_name == "FAQ")
                      $MENU .= '<li><a class="'.$val.' '.$class.'" style="'.$style.'" href="#" rel="dropmenu'.$i.'_d"><span class="left">&nbsp;</span><span class="right"><img src="'.$SITE_URL.'/images/faq'.$img.'.gif" alt="FAQ" border="0" /></span></a></li>';
			        if($v_pg_name == "About")
                      $MENU .= '<li><a class="'.$val.' '.$class.'" style="'.$style.'" href="#" rel="dropmenu'.$i.'_d"><span class="left">&nbsp;</span><span class="right"><img src="'.$SITE_URL.'/images/about'.$img.'.gif" alt="ABOUT" border="0" /></span></a></li>';
			        if($v_pg_name == "Services")
                      $MENU .= '<li><a class="'.$val.' '.$class.'" style="'.$style.'" href="#" rel="dropmenu'.$i.'_d"><span class="left">&nbsp;</span><span class="right"><img src="'.$SITE_URL.'/images/services'.$img.'.gif" alt="SERVICES" border="0" /></span></a></li>';
			        
              $SUBMENU .= '<div id="dropmenu'.$i.'_d" class="dropmenudiv_d" style="width:164px; margin-left:20px;">';
			        $j=1;
             
              while($row1=$db1->fetch_array($rs1))
              {
                   if($j==$class_count)
                   {
                          $class="last";
                    }
                     else
                          {
                          $class="";
                          }
                        $subid=$row1['i_id'];
                        $v_subpg_name  = trim($row1['v_pg_name']);
                        
                        if($v_subpg_name == trim($i_pid))
                        {     
                        if($v_subpg_name == "Storage-rates")
                            $footer = ""; 
                        elseif($v_subpg_name == "Storage-calculator")
                            $footer = ""; 
                        elseif($v_subpg_name == "The-TAXIBOX")
                            $footer = ""; 
                        elseif($v_subpg_name == "Get-to-know-us")
                            $footer = ""; 
                        elseif($v_subpg_name == "Areas-we-serve")
                            $footer = ""; 
                        elseif($v_subpg_name == "Testimonial")
                            $footer = "";
                                                     
                        
                                $v_subpg_title  = "<b>".trim($row1['v_pg_title'])."</b>";
                                
                          }
                        else                                
                                $v_subpg_title  = $row1['v_pg_title'];
                        $v_pg_url  = $row1['v_pg_url'];
                        if($v_pg_url)
						                  {
                            $SUBMENU .= '<a href="'.$SITE_URL.$v_pg_url.'" class="'.$class.'">'.$v_subpg_title.'</a>';
						                  }
                        else
                            $SUBMENU .= '<a href="'.$SITE_URL.'/'.$v_subpg_name.'.html" class="'.$class.'">'.$v_subpg_title.'</a>';
                  $j++;
                  }
              $SUBMENU .= '</div>';
              }
          }
      
$i++;     
}      
$MENU .= "</ul></div>";
}
/**
function frontmenuhome($db,$i_id,$i_pid)
{
	global $footer, $MENU, $SUBMENU, $SITE_URL, $MAP_VROOT_PATH;
	$alsoNoDisplayArr	=	array('Storage-rates','Storage-calculator','The-TAXIBOX','Get-to-know-us','Areas-we-serve','Testimonial');
	$db1	=	clone $db;
	$sql	=	"select * from tbl_static_pages where e_status='L' and i_parent_id=0 and e_show_menu='Y' order by i_sortorder";
	$rs		=	$db->query($sql);
	$MENU	=	'<div id="menu"><ul class="main">';
	$i		=	1;
	while($row	=	$db->fetch_array($rs))
	{ 
		$id			=	$row['i_id'];
		$v_pg_name	=	$row['v_pg_name']; 
		$v_pg_title	=	$row['v_pg_title'];

		$sql1		=	"select * from tbl_static_pages where e_status='L' and i_parent_id=$id and e_show_menu='Y' order by i_sortorder";
		$rs1		=	$db1->query($sql1);  

		$top_link	=	"#";

		if($v_pg_name == "Home") $top_link = "/index.php";
		if($v_pg_name == "Contact") $top_link = "/contact.php";


		if($i_id == $v_pg_name)
		{
			$MENU			.=	'<li class="menu_item" ><a href = "'.$SITE_URL.$top_link.'" class="main active'.$i.'" rel=""></a>';	
		}
		else
		{
			$MENU			.=	'<li class="menu_item" ><a href = "'.$SITE_URL.$top_link.'" class="main menu'.$i.'" rel=""></a>';		
		}
		$class_count	=	$db1->affected_rows();		
		if($db1->affected_rows()>0)
		{
			$MENU	.=	'<ul class="sousmenu" id="sousm'.$i.'">';
			$j = 0;
			while($row1	=	$db1->fetch_array($rs1))
			{
				$j++;

				if($j == 1){ $style_border = "border-top: none;";}
				else{$style_border = "";}

				$link			=	(empty($row1['v_pg_url']))?'/'.trim($row1['v_pg_name']).'.html':trim($row1['v_pg_url']);
				$v_subpg_name	=	trim($row1['v_pg_name']);				

				if($v_subpg_name == trim($i_pid)) 
				{
					$footer			=	(in_array($v_subpg_name, $alsoNoDisplayArr)) ? '' : '&nbsp;also' ;
					$v_subpg_title  =	"<b>".trim($row1['v_pg_title'])."</b>";
				}
				else 
				{
					$v_subpg_title  = trim($row1['v_pg_title']);
				}
				$MENU	.=	'<li style="'.$style_border.'"><a href="'.$SITE_URL.$link.'">'.$v_subpg_title.'</a></li>';
			}
			$MENU	.=	'</ul>';
		}
		$MENU .= '</li>';
		$i++;     
	}      
	$MENU	.=	"</ul></div>";

}**/

//function to display Home page tabs
function frontMenu($db,$selected_id)
{
	//ECHO "HI";
global $SHOW_MENU, $FOOTER;
$sql = "select * from tbl_static_pages where i_parent_id = '0' and e_status='L' order by i_sortorder LIMIT 8";
//echo $sql;
$rs=$db->query($sql);
while($row=$db->fetch_array($rs))
{ 
      $id=$row['i_id'];
      $v_pg_name  = $row['v_pg_name'];
	  //echo $v_pg_name;
      $e_show_menu = $row['e_show_menu'];
      if($e_show_menu=='Y')
      {
      if($id == $selected_id)
            {
            $class="top-navigation-active";
            }
      else
            $class="";
              
      if($id == 1)
            {
            $SHOW_MENU .='<li class="'.$class.'"><a href="index.php?i_id='.$id.'" title="'.$v_pg_name.'" ><span>'.$v_pg_name.'</span></a></li>';
           
            }
      elseif($id == 62)
            {  
            $SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
            
            }
      elseif($id == 57)
            {
            $SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
            
            } 
		elseif($id == 58)
		{
		$SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
		
		}             
		elseif($id == 59)
		{
		$SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
		
		} 
	elseif($id == 60)
            {
            $SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
            
            }
		elseif($id == 61)
            {
            $SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
            
            }             
      else
            {
            $SHOW_MENU .='<li class="'.$class.'"><a href="profile.php?i_id='.$id.'" title="'.$v_pg_name.'"><span>'.$v_pg_name.'</span></a></li>';
           
            }
      }  
      
}

// 
}
function getcontent($i_id,$db)
{
global $CONTENT,$TITLE,$IMAGE,$PAGE_NAME,$IMAGE_NAME,$LOGOUPLOAD;
$sql="select * from tbl_static_pages where e_status='L' and i_id=".$i_id;
//echo $sql;
$rs=$db->query($sql);
while($row=$db->fetch_array($rs))
      {
      $CONTENT  = stripslashes($row['t_pg_desc']);
      $TITLE    = stripslashes($row['v_pg_title']);
      $PAGE_NAME= stripslashes($row['v_pg_name']);
      $IMAGE_NAME    = $row['v_image'];
      if($IMAGE_NAME)
          $IMAGE    = "<img src='$SITE_URL/imageResize.php?imgName=".$IMAGE_NAME."&folderName=$LOGOUPLOAD&width=351&height=121'  border=0 alt='No Image' align='right' \>";
      }
}

function gettestimonialcontent($i_id,$db)
{  
global $CONTENT, $HEADING;
$db1 = clone $db;
$sql = "select * from tbl_static_pages where e_status='L' and i_id=$i_id";
$rs=$db->query($sql);
while($row=$db->fetch_array($rs))
{ 
      $v_pg_title=stripslashes($row['v_pg_title']);
}      
$sql1 = "select * from tbl_testimonials where e_status='L' order by d_datemodified desc";
$rs1=$db1->query($sql1);
while($row1=$db1->fetch_array($rs1))
{
    $data .="<p>".($row1['t_desc'])."<b>".ucwords($row1['v_fname'])." | ".ucwords($row1['v_lname'])."</b></p>";
}
//$data .= "<b>Have something to say? Send us an email - <a href='mailto:info@taxibox.com.au?subject=TAXIBOX feedback'>here</a></b>.";      
$t_pg_desc=$data;
$CONTENT =$t_pg_desc."<p>&nbsp;</p>";     
$HEADING =$v_pg_title;            
}      
      
function gettestimonial($db)
{
global $TESTIMONIAL_FNAME, $TESTIMONIAL_lNAME, $TESTIMONIAL_DESC;
$sql = "select * from tbl_testimonials where e_status='L' order by rand() limit 1";
$rs=$db->query($sql);
$total=$db->affected_rows();
$row=$db->fetch_array($rs);
$TESTIMONIAL_FNAME = $v_fname=($row['v_fname']);
$TESTIMONIAL_lNAME = $v_lname=($row['v_lname']);
$TESTIMONIAL_DESC  = $t_desc=($row['t_desc']);

}   

function  request_quote($db)
{
global $SCRIPT, $MAIL_TEMPLATE,$MAIL_TEMPLATE1, $USER_NAME_DISPLAY, $USER_NAME, $USER_EMAIL, $SITE_URL, $DOMAIN_URL,$ROOT_DIR, $PROMPT, $TEMPLATE_DIR, $NAME, $ADDRESS, $PHONE, $EMAIL, $OPTION, $MAIL_ATTRIBUTES, $SUBJECT, $MAILDATA,$SUBJECT1, $MAILDATA1, $message1 ;
$securimage	=	new Securimage();
$chk_cap	=	"";
$admin_details = GetModuleVars('', $db);
//$arg =  explode('?',$_SERVER['REQUEST_URI']);
//$urlname = "http://".$_SERVER['SERVER_NAME'].$arg[0];
//$SCRIPT = "<script language='javascript'>var url='".$urlname."';</script>";
if ($securimage->check($_POST['captcha_code']) == false) 
{
		$chk_cap	=	"wrong";
}
if($_POST['action']=='submit') 
	{
	$USER_NAME = $_POST['name']; 
  $ADDRESS =$_POST['address'];   if(!$ADDRESS) $ADDRESS = " N/A";
	$PHONE =$_POST['phone'];   if(!$PHONE) $PHONE = " N/A";
	$USER_EMAIL=$_POST['email']; 
	$OPTION=$_POST['options'];
	if(!$USER_NAME) 
      {
      $USER_NAME = " N/A";
      $USER_NAME_DISPLAY = "";
      $NAME = $admin_details['SGMailSenderName']; 
      $EMAIL = $admin_details['SGMailSenderEmail'];
      }
  else
      {
      $NAME = $USER_NAME;
      $USER_NAME_DISPLAY = $NAME;
      $EMAIL = $USER_EMAIL;
      }      
	$MAIL_ATTRIBUTES      = GetMailTemplate('MailAdmRequestQuote', $db);
  if (count($MAIL_ATTRIBUTES) > 0){
      $v_subject	= addslashes($MAIL_ATTRIBUTES['subject']);
  		$v_message	= addslashes($MAIL_ATTRIBUTES['message']);
  		@eval ("\$t_message = \"$v_message\";");
  		@eval ("\$v_subject = \"$v_subject\";");
  		$SUBJECT	= stripslashes($v_subject);
  		$MAILDATA	= stripslashes($v_message);
    } 
  $bcc['anshu.m@dimensioninteractive.com'] = 'anshu.m@dimensioninteractive.com';
	$bcc['nivedita.s@dimensioninteractive.com'] = 'nivedita.s@dimensioninteractive.com';
	$bcc['aman.k@dimensioninteractive.com'] = 'aman.k@dimensioninteractive.com';
	$bcc['info@taxibox.com.au'] = 'info@taxibox.com.au'; 
  
	$admin_email = "info@taxibox.com.au";
  $TO[$admin_email]	=	$admin_email;
  
  $admin_name	=	'TAXIBOX Team';
  ReplaceContent(Array("MAILDATA"));
  $MAIL_TEMPLATE	=	 ReadTemplate("$TEMPLATE_DIR/mail_template.html");
  ReplaceContent(Array("MAIL_TEMPLATE"));
  if($chk_cap!="wrong") 
  {
  //$subject1='TAXIBOX - Quote Request';
	if(DiMail($SUBJECT, "", $MAIL_TEMPLATE, $EMAIL, $NAME, $TO, "", $bcc))
	{
    		$TO_ADDRESS[$USER_EMAIL]	=	$USER_EMAIL;
    		//$message1			=	ReadTemplate("$TEMPLATE_DIR/template_users.html");
    		$MAIL_ATTRIBUTES      = GetMailTemplate('MailRequestQuote', $db);
        if (count($MAIL_ATTRIBUTES) > 0){
            $v_subject	= addslashes($MAIL_ATTRIBUTES['subject']);
        		$v_message	= addslashes($MAIL_ATTRIBUTES['message']);
        		@eval ("\$t_message = \"$v_message\";");
        		@eval ("\$v_subject = \"$v_subject\";");
        		$SUBJECT1	= stripslashes($v_subject);
        		$MAILDATA	= stripslashes($v_message);
          }
    		ReplaceContent(Array("MAILDATA"));
        $MAIL_TEMPLATE1	=	 ReadTemplate("$TEMPLATE_DIR/mail_template.html");
        ReplaceContent(Array("MAIL_TEMPLATE1"));
    		if(DiMail($SUBJECT1, "", $MAIL_TEMPLATE1, $admin_email, $admin_name, $TO_ADDRESS))
    		{
    		  $sql="INSERT INTO tbl_requestQuote(v_name , t_address, v_email , v_phone, v_taxibox_option ,v_ipaddress)VALUES ('".$NAME."','".$ADDRESS."','".$EMAIL."','".$PHONE."','".$OPTION."','".$_SERVER['REMOTE_ADDR']."')";
    		  $db->query($sql);
    		  $name="";
  			  $email="";
  			  $phone="";
  			  $aboutme="";
  			  $msg="";      
    		  $_SESSION['msg']="<img src='$SITE_URL/images/success-icon.gif' alt='' vspace='2' align='absmiddle' hspace='5' /> Thank you!<br /> Your details have been sent to TAXIBOX mobile self-storage. One of our friendly staff will contact you shortly.";
          header("location:".$_server['PHP_SELF']."?popup=1");
          exit();
        }
    		else 
    		{ 
    			$_SESSION['msg']="<img src='$SITE_URL/images/warning-icon.gif' alt='' vspace='5' /><br />Some error was encountered while sending mail. Please try again. "; 
    			header("location:".$_server['PHP_SELF']."?popup=1");
    			exit();
    		}
	}
	}
	else
  {   
      $_SESSION['msg'] = "<img src='$SITE_URL/images/warning-icon.gif' alt='' vspace='5' /><br />An error has occurred. Please ensure that you fill in all fields correctly ";  
      header("location:".$_server['PHP_SELF']."?popup=1");  
	    exit();     
  }
  }
}

function menuHome($db)
{
global $MENUHOME,$ID,$LOGIN_SCRIPT,$LOGOUT_LINK, $LOGIN_LINK, $IMG_DIR;

$sql="select * from tbl_static_pages where e_status='L' and e_show_menu='Y' and i_parent_id='0' order by i_sortorder";
$rs=$db->query($sql);
$MENUHOME="<ul>";
$db->affected_rows();
while($row=$db->fetch_array($rs))
      {
      $ID= stripslashes($row['i_id']);
      $PAGE_NAME= stripslashes($row['v_pg_name']);
      $TITLE= stripslashes($row['v_pg_title']);
      $PAGE_URL= stripslashes($row['v_pg_url']);
      if($PAGE_URL)
          $url =  "$SITE_URL/$PAGE_URL";
      else  
          $url =  "$SITE_URL/$ID/$PAGE_NAME.html";  
      if($PAGE_NAME == 'Home')
		  {
            $MENUHOME.="<li id=\"class_a_$ID\"><a href=\"$url\">$PAGE_NAME</a></li>";
		  }
      elseif($PAGE_NAME == 'Login' && $_SESSION['SESS_memberLoggedIn']=='1')
            {
            $MENUHOME.="<li id=\"class_a_$ID\"><a href=\"$url\">Documents</a></li>";
            $LOGOUT_LINK			=	"<a href='$SITE_URL/logout.php'>Logout</a>";
            $LOGIN_SCRIPT = "<script type='text/javascript'>hideHeaderLogin();</script>";
			
            }      
      else
		  {
            $MENUHOME.="<li id=\"class_a_$ID\"><a href=\"$url\">$TITLE</a></li>";

		  }
      }
$MENUHOME.="</ul>";

if($_SESSION['SESS_memberLoggedIn']=='1')
	{$LOGIN_LINK = "<div class='login' id='logout'><div class='top_nav' style='padding:10px 0px ;'><h2>".$LOGOUT_LINK."</h2></div></div>";
	}
	else
	{
			$LOGIN_LINK = " <div class='login' id='login' ><div class='forget'><a href='".$SITE_URL."/forgot_password.php'>Forgot Password?</a></div>	
				<form name='frmlogin1' id='frmlogin1' action='login.php' method='post' onsubmit='return validate1();'>
			<input type='text' name='usrname' id='usrname' onclick='this.value=\"\";' onfocus='this.value=\"\";' class='input' value='- Username -' tabindex='1' /><br />
				
			<input type='password' name='pwd' id='pwd' onclick='this.value=\"\";' onfocus='this.value=\"\";' value='- Password -' class='input2' tabindex='2'>
				<input type='image' src='".$IMG_DIR."/login.gif'  value='submit' name='submit' class='login_button'/>
				<input type='hidden' name='action' value='submit'>
			</form> </div>";
	}
}

function echo_pre($varArray) {
	echo "<pre>";
	print_r($varArray)."<br />";
	echo "</pre>";
}


function getPageSEOInfo($db, $page)
{	
	global $PAGE_NAME, $WINDOW_TITLE, $MENU_ITEM, $H1_KEYWORDS, $META_DESCRIPTION, $META_KEYWORD, $PAGE_HEIGHT,$IMG_DIR, $BANNER_NAME;
	global $TOPBAR_LOGIN_MEMBER_INFO, $TEMPLATE_DIR, $TOPBAR_GOOGLE_FORM;

	$query="select   *   from tbl_seo_info where v_page = '$page'";
	$db->query($query);
	$INFO = Array();
	if ($db->num_rows())
	{	$row = $db->fetch_array();
	 
		$PAGE_NAME			= $row['v_page_title'];
		$WINDOW_TITLE		= $row['v_window_title'];
		$H1_KEYWORDS		= $row['v_h1_keywords'];
		$META_DESCRIPTION	= $row['tx_meta_description'];
		$META_KEYWORD		= $row['tx_meta_keywords'];
		$PAGE_HEIGHT		= $row['i_page_height'];
		$MENU_ITEM			= $row['v_menu_item_name'];
	}

   

}


function slug($string){
    $string = strtolower(trim($string));
    $string = str_replace("'", '', $string);
    $string = preg_replace('#[^a-z\-]+#', '-', $string);
    $string = preg_replace('#_{2,}#', '_', $string);
    $string = preg_replace('#_-_#', '-', $string);
    $string = preg_replace('#(^_+|_+$)#D', '', $string);
    return preg_replace('#(^-+|-+$)#D', '', $string);
}

function dulicatePage( $i_addonID,$url, $dbi){
        $check="select * from tbl_information where i_addonID !='$i_addonID' AND URL='$url' ";
        $result=  $dbi->get_results($check);        
        if($result){return true;}else{return false;}
    }

//echo_pre($_SERVER);
/*
include_once ("$LIB_DIR/class.databasei.php");
if (class_exists('DbConnecti')) {
    $database = new DbConnecti();
}

$categoryList = fetchCategoryTree($database);
function fetchCategoryTree($database, $parent = 0, $spacing = '', $user_tree_array = '') {
	if (!is_array($user_tree_array))
	$user_tree_array = array();
    $query = "SELECT i_groupID, v_name, i_parentID, sort_order, c_status FROM tbl_group WHERE 1 AND `i_parentID` = $parent ORDER BY i_groupID ASC";
	$results = $database->get_results($query);
	
	foreach ( $results as $row) {         
		$user_tree_array[] = array("id" => $row['i_groupID'], "name" => $spacing . $row['v_name'], "i_parentID" => $row['i_parentID'],);
		$user_tree_array = fetchCategoryTree($database, $row['i_groupID'], $spacing . '&nbsp;&nbsp;', $user_tree_array);
	}
	return $user_tree_array;
}
*/

global $GroupSelectHeaderSTR ;
$GroupSelectHeaderSTR ='';
if( is_array($categoryList) && ( sizeof( $categoryList ) > 0 )){
	foreach($categoryList as $cl) {
		if( $cl['i_parentID'] == 0 ){
		 $GroupSelectHeaderSTR .='<li style="border-bottom:1px solid #cccccc;" ><a href="fltrjobs.php?prgr='.$cl['id'].'"> &raquo; '.$cl['name'].' </a></li>';
		}else{
		  $GroupSelectHeaderSTR .='<li><a href="fltrjobs.php?prgr='.$cl['id'].'"> &rsaquo; '.$cl['name'].' </a></li>';
		}
		
		
	}
}

function indTableRecord($tableName, $key, $keyValue,  $db) {
	$recordDetailArray  = array();				
    $SQLM  = " SELECT * FROM $tableName where {$key} = '$keyValue' ";
	$db->query($SQLM);  
	if( $db->num_rows() > 0 ){ 
		$ropwm = $db->fetch_assoc();
		foreach($ropwm AS $mk=>$mv ){
			$recordDetailArray[$mk] = trim($mv);
		}
		return $recordDetailArray;
	}else{
	  return false;
	}
}


function ip_visitor_country()
{
	$client  = @$_SERVER['HTTP_CLIENT_IP'];
	$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
	$remote  = $_SERVER['REMOTE_ADDR'];
	$country  = "Unknown";
	if(filter_var($client, FILTER_VALIDATE_IP))
	{
		$ip = $client;
	}
	elseif(filter_var($forward, FILTER_VALIDATE_IP))
	{
		$ip = $forward;
	}
	else
	{
		$ip = $remote;
	}
	$ip  = $_SERVER['REMOTE_ADDR'];
	
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://www.geoplugin.net/json.gp?ip=".$ip);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
	$ip_data_in = curl_exec($ch); // string
	curl_close($ch);
	$ip_data = json_decode($ip_data_in,true);
	$ip_data = str_replace('&quot;', '"', $ip_data); 
	if($ip_data && $ip_data['geoplugin_countryName'] != null) {
		$country = $ip_data['geoplugin_countryName'];
	}
	return $ip_data;
}

function getBrowser() 
{ 
	$u_agent = $_SERVER['HTTP_USER_AGENT']; 
	$bname = 'Unknown';
	$platform = 'Unknown';
	$version= "";

	//First get the platform?
	if (preg_match('/linux/i', $u_agent)) {
		$platform = 'linux';
	}
	elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
		$platform = 'mac';
	}
	elseif (preg_match('/windows|win32/i', $u_agent)) {
		$platform = 'windows';
	}

	// Next get the name of the useragent yes seperately and for good reason
	if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent)) 
	{ 
		$bname = 'Internet Explorer'; 
		$ub = "MSIE"; 
	} 
	elseif(preg_match('/Firefox/i',$u_agent)) 
	{ 
		$bname = 'Mozilla Firefox'; 
		$ub = "Firefox"; 
	}
	elseif(preg_match('/OPR/i',$u_agent)) 
	{ 
		$bname = 'Opera'; 
		$ub = "Opera"; 
	} 
	elseif(preg_match('/Chrome/i',$u_agent)) 
	{ 
		$bname = 'Google Chrome'; 
		$ub = "Chrome"; 
	} 
	elseif(preg_match('/Safari/i',$u_agent)) 
	{ 
		$bname = 'Apple Safari'; 
		$ub = "Safari"; 
	} 
	elseif(preg_match('/Netscape/i',$u_agent)) 
	{ 
		$bname = 'Netscape'; 
		$ub = "Netscape"; 
	} 

	// finally get the correct version number
	$known = array('Version', $ub, 'other');
	$pattern = '#(?<browser>' . join('|', $known) .
	')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
	if (!preg_match_all($pattern, $u_agent, $matches)) {
		// we have no matching number just continue
	}

	// see how many we have
	$i = count($matches['browser']);
	if ($i != 1) {
		//we will have two since we are not using 'other' argument yet
		//see if version is before or after the name
		if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
			$version= $matches['version'][0];
		}
		else {
			$version= $matches['version'][1];
		}
	}
	else {
		$version= $matches['version'][0];
	}

	// check if we have a number
	if ($version==null || $version=="") {$version="?";}
	$browser_detail = $u_agent.'   '.$bname.'   '.$version.'   '.$platform;
	
	return array(
		'userAgent' => $u_agent,
		'name'      => $bname,
		'version'   => $version,
		'platform'  => $platform,
		'pattern'    => $pattern,
		'browser_detail' => $browser_detail
	);
} 


?>

Anon7 - 2022
SCDN GOK