Jump to content

3-4 error


Guest AmeFa

Recommended Posts

Well, I did the manual update exactly like it said and i got the following error:

Fatal error: Call to undefined function: treatget() in /home/amefasco/public_html/clothes/includes/functions.inc.php on line 402

Someone take a look at this? I didnt do ANYTHING...weird weird weird

<?php

/*

+--------------------------------------------------------------------------

|   CubeCart v3.0.3

|   ========================================

|   by Alistair Brookbanks

|	CubeCart is a Trade Mark of Devellion Limited

|   (c) 2005 Devellion Limited

|   Devellion Limited,

|   Westfield Lodge,

|   Westland Green,

|   Little Hadham,

|   Nr Ware, HERTS.

|   SG11 2AL

|   UNITED KINGDOM

|   http://www.devellion.com

|	UK Private Limited Company No. 5323904

|   ========================================

|   Web: http://www.cubecart.com

|   Date: Thursday, 22 September 2005

|   Email: info (at) cubecart (dot) com

|	License Type: CubeCart is NOT Open Source Software and Limitations Apply 

|   Licence Info: http://www.cubecart.com/site/faq/license.php

+--------------------------------------------------------------------------

|	functions.inc.php

|   ========================================

|	Core Frontend Functions	

+--------------------------------------------------------------------------

*//////////////////////////////////

// treat GET vars stop XSS

////////

function treatGet($text){

	

	$text = preg_replace("/(\<script)(.*?)(script>)/si", "", "$text");

	$text = strip_tags($text);

	$text = str_replace(array("'","\"",">","<","\\"), "", $text);

	return $text;







/

//////////////////////////////////

// Fetch the config info

////////

function fetchDbConfig($confName) {

	

	global $glob, $db;

	

	$result = $db->select("SELECT array FROM ".$glob['dbprefix']."CubeCart_config WHERE name = ".$db->mySQLSafe($confName));

	

  if($result==TRUE){

  

 	 $base64Encoded = unserialize($result[0]['array']);

 	 

 	 foreach($base64Encoded as $key => $value){

    $base64Decoded[base64_decode($key)] = stripslashes(base64_decode($value));

 	 }

 	 

 	 return $base64Decoded;

 	 

  } else {

  

 	 return FALSE;

 	 

  }

	

}

//////////////////////////////////

// Format file size to be friendly

////////

function format_size($rawSize) {

	if ($rawSize / 1048576 > 1)

  return round($rawSize/1048576, 1) . ' MB';

	else if ($rawSize / 1024 > 1)

  return round($rawSize/1024, 1) . ' KB';

	else

  return round($rawSize, 1) . ' Bytes';

}

//////////////////////////////////

// Get Category Directory 

////////

function getCatDir($catName, $cat_father_id, $catId, $link=FALSE){

	

	global $sessId,$db,$config,$glob,$lang_folder;

	

	// get category array for cat dir

	$query = "SELECT cat_id, cat_name, cat_father_id FROM ".$glob['dbprefix']."CubeCart_category ORDER BY cat_id DESC";

	$catArray = $db->select($query);

	

	// get category array in foreign innit

	$resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'");

	

	$dirArray[0] = $config['dirSymbol'].$catName;

	

	for ($i=0; $i<=count($catArray); $i++) {

  

  if(is_array($resultsForeign)){



 	 for ($k=0; $k<count($resultsForeign); $k++){



    if($resultsForeign[$k]['cat_id'] == $catArray[$i]['cat_id']){

    

   	 $catArray[$i]['cat_name'] = $resultsForeign[$k]['cat_name'];

    

    }

    

 	 }

  

  }

  

  if(isset($catArray[$i]['cat_id']) && $catArray[$i]['cat_id']==$cat_father_id) {

 	 

 	 if($link == TRUE){

 	 

    $dirArray[$i+1] = $config['dirSymbol']."<a href='".$GLOBALS['rootRel']."index.php?ccUser=".$sessId."&amp;catId=".$catArray[$i]['cat_id']."&amp;act=viewCat' class='txtLocation'>".$catArray[$i]['cat_name']."</a>";

 	 

 	 } else {

 	 

 	 $dirArray[$i+1]= $config['dirSymbol'].$catArray[$i]['cat_name'];

 	 

 	 }

 	 

 	 $cat_father_id = $catArray[$i]['cat_father_id'];

  

  }

	

	}

  

	krsort($dirArray);

	reset($dirArray);

	

	$dir = "";

	

	foreach($dirArray as $key => $value){

 	 $dir.= $value;

	}



	return $dir;

}

//////////////////////////////////

// Change table data class alternately 

////////

function cellColor($i, $tdEven="tdEven", $tdOdd="tdOdd"){

  

	$cellColor = "";

	

	if(is_double($i/2)){

  $cellColor = $tdOdd;

	} else {

  $cellColor = $tdEven;

	} 

	

	return $cellColor;

}

//////////////////////////////////

// Sale Price

////////

function salePrice($normPrice, $salePrice){

	

	global $config;

	

	if($config['saleMode']==1){

  

 	 if($salePrice<$normPrice && $salePrice>0){

  

    return $salePrice;

 	 

 	 } else {

 	 

    return FALSE;

 	 

 	 } 

	

	} elseif($config['saleMode']==2) {

  

  $saleValue = $normPrice * ((100-$config['salePercentOff'])/100);

  

 	 if($saleValue<$normPrice && $saleValue>0){ 

    return $saleValue; 

 	 } else { 

    return FALSE; 

 	 }

   

	} else {

  return FALSE;

	}

}

//////////////////////////////////

// Format Price

////////

function priceFormat($price, $dispNull = FALSE){

	

	if($price == TRUE){

	

  global $currencyVars;

  

  $price = $price * $currencyVars[0]['value'];

  

  return $currencyVars[0]['symbolLeft'].sprintf("%.".$currencyVars[0]['decimalPlaces']."f", $price).$currencyVars[0]['symbolRight'];

	

	} elseif($dispNull == TRUE) {

  global $currencyVars;

  return $currencyVars[0]['symbolLeft'].sprintf("%.".$currencyVars[0]['decimalPlaces']."f", 0.00).$currencyVars[0]['symbolRight'];

	

	} else {

	

  return FALSE;

  

	}

}



//////////////////////////////////

// Walk through files and folders in directory

////////

function walk_dir($path, $oneLevel=1) {



	$retval = array();



	if ($dir = opendir($path)) {

  

  while (false !== ($file = readdir($dir)))

  {

 	 

 	 if ($file[0]==".") { continue; }

 	 

    if (is_dir($path."/".$file) AND  $oneLevel==1) {

      

   	 $retValMerge = walk_dir($path."/".$file);

	

   	 if(is_array($retValMerge)){

      $retval = array_merge($retval,$retValMerge);

   	 }

   	 

    } else if (is_file($path."/".$file)) {

   	 

   	 $retval[]=$path."/".$file;

    

    }

 	 

 	 }

  

  closedir($dir);

  

  }

  

	return $retval;

	

}

//////////////////////////////////

// List Modules

////////

function listModules($path){

	

	if ($handle = opendir($path)) {

	

    while (false !== ($folder = readdir($handle))) {

 	 

 	 if(!eregi("[.]", $folder)){

     	 

    $folders[] = $folder;

 	 

 	 }

    

    }

	

    closedir($handle);

	}

	

	return $folders;



}

//////////////////////////////////

// Check image extention

////////

function CheckImgExt($filename) {

	$img_exts = array("gif","jpg", "jpeg","png");

	foreach($img_exts as $this_ext) {

  if (preg_match("/\.$this_ext$/", $filename)) {

 	 return TRUE;

  }

	}

	return FALSE;

}

//////////////////////////////////

// Make time from time()

////////

function formatTime ($timestamp, $format=FALSE) {

	

	global $config;



	if($format == FALSE){

  $format = $config['timeFormat'];

	} 

	

	$sign = substr($config['timeOffset'],0,1);

	$value = substr($config['timeOffset'],1);

	

	if($sign=="+"){

  $seconds = $timestamp+$value;

	} elseif($sign=="-"){

  $seconds = $timestamp-$value;

	} else {

  $seconds = $timestamp;

	}

	return strftime($format,$seconds);

}

//////////////////////////////////

// Admin Permissions

////////

// define variables

function permission ($section,$permission) {

	global $ccAdminData;

	

	// check if index exists and if not create it

	if(!isset($ccAdminData[$section][$permission])){

  $ccAdminData[$section][$permission] = "";

	}

	

	if($ccAdminData[$section][$permission]==1 OR $ccAdminData[0]['isSuper']==1){

  $result = TRUE;

	} else {

  $result = FALSE;

	}

	return $result;

}

//////////////////////////////////

// Make Random Password

////////

function randomPass() {

  $chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J", "k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T", "u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9","0");

	

  $max_chars = count($chars) - 1;

  srand((double)microtime()*1000000);

	

  for($i = 0; $i < 8; $i++)	{

 	 $newPass = ($i == 0) ? $chars[rand(0, $max_chars)] : $newPass . $chars[rand(0, $max_chars)];

  }

  

  return $newPass;

}

//////////////////////////////////

// Recover Post Variables as hidden fields

////////

function recoverPostVars($array, $skipKey){

  

  $hiddenFields = "";

  

  foreach($array as  $key => $value) {

 	 

 	 if($key==$skipKey){

    

    $hiddenFields .= "<input type='hidden' name='".$key."' value='".stripslashes($value)."' />\r\n";

 	 } else {

    $hiddenFields .= "<input type='hidden' name='".$key."' value='".htmlspecialchars($value)."' />\r\n";

 	 }

 	 

  }

  

  return $hiddenFields;

}

//////////////////////////////////

// Seconds to human readable time

////////

function readableSeconds($time = 0) {

	

	$hours    = (int)floor($time/3600);

	$minutes  = (int)floor($time/60)%60;

	$seconds  = (int)$time%60;

	$output   = ""; 

	

	if($hours==1) $output  = $hours." hour";       

 

	else if($hours>1) $output  = $hours." hours";   



	if($output and $minutes>0 and $seconds>0) $output .= ", ";



	else if($output and $minutes>0 and $seconds==0) $output .= " and ";



	$s = ($minutes>1)  ? "s" : NULL;



	if($minutes>0) $output .= $minutes." minute$s"; 



	$s = ($seconds>1) ? "s" : NULL;



	if($output and $seconds>0) $output .= " and ";   



	if($seconds>0) $output .= $seconds." second".$s; 



	else if(!$output and $seconds==0) $output  = "0 seconds";



	return $output;

}

//////////////////////////////////

// Get current page

////////

function currentPage(){

	

	$currentPage = $_SERVER['PHP_SELF'];

	

	if (isset($_SERVER['QUERY_STRING'])) {

 	 

  $currentPage .= "?" . htmlentities(treatGet($_SERVER['QUERY_STRING']));

	

	}

	

	return $currentPage;



}

//////////////////////////////////

// make session id

////////

function makeSessId(){

	srand((double)microtime()*1000000);

	return md5(uniqid(rand()));

}

//////////////////////////////////

// make session id

////////

function c(){



	global $config;

  

  if(isset($config['lkv']) && $config['lkv']>0 && ereg("^([0-9]{6})+[-]+([0-9])+[-]+([0-9]{4})$",$config['lk'])){

 	 

 	 return FALSE;

 	 

  } else {

  

 	 return base64_decode("IChQb3dlcmVkIGJ5IEN1YmVDYXJ0KQ==");

  

  }

  

}

//////////////////////////////////

// get country by Id

////////

function countryName($id){

	

	global $db,$glob;

	

	$country = $db->select("SELECT id, printable_name FROM ".$glob['dbprefix']."CubeCart_iso_countries WHERE id = ".$db->mySQLSafe($id));

	

	if($country == TRUE) {

	

  return $country[0]['printable_name'];

  

	} else {

	

  return FALSE;

	

	}



}

//////////////////////////////////

// get country ISO by Id

////////

function countryIso($id){

	

	global $db,$glob;

	

	$country = $db->select("SELECT iso FROM ".$glob['dbprefix']."CubeCart_iso_countries WHERE id = ".$db->mySQLSafe($id));

	

	if($country == TRUE) {

	

  return $country[0]['iso'];

  

	} else {

	

  return FALSE;

	

	}



}

//////////////////////////////////

// get tax by Id

////////

function taxRate($id){

	

	global $db,$glob;

	

	$tax = $db->select("SELECT percent FROM ".$glob['dbprefix']."CubeCart_taxes WHERE id = ".$db->mySQLSafe($id));

	

	if($tax == TRUE) {

	

  return $tax[0]['percent'];

  

	} else {

	

  return FALSE;

	

	}



}

//////////////////////////////////

// get order status by Id

////////

function orderStatus($id){

	

	global $lang;

	

	return $lang['orderState'][$id];

	

}

//////////////////////////////////

// validate email address

////////

function validateEmail($email){



	if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5})$",$email)){

	

  return TRUE;

	

	} else {

	

  return FALSE;

	

	}



}

//////////////////////////////////

// get alternate language of product

////////

function prodAltLang($productId){

	

	global $db, $lang_folder, $glob, $config;

	

	if($lang_folder !== $config['defaultLang']){

	

  $foreignVal = $db->select("SELECT name, description FROM ".$glob['dbprefix']."CubeCart_inv_lang WHERE prod_master_id = ".$db->mySQLSafe($productId)." AND prod_lang=".$db->mySQLSafe($lang_folder));

  

  if($foreignVal==TRUE){

  

 	 return $foreignVal[0];

 	 

  } else {

  

 	 return FALSE;

  

  }

	

	} else {

	

  return FALSE;

  

	}



}

?>

Link to comment
Share on other sites

double post:

and in the /admin.php i get the following error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/amefasco/public_html/clothes/includes/functions.inc.php:551) in /home/amefasco/public_html/clothes/admin/includes/auth.inc.php on line 36

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/amefasco/public_html/clothes/includes/functions.inc.php:551) in /home/amefasco/public_html/clothes/admin/includes/auth.inc.php on line 36

Link to comment
Share on other sites

1: You've forgotten the } at the end of

function treatGet($text){



$text = preg_replace("/(\<script)(.*?)(script>)/si", "", "$text");

$text = strip_tags($text);

$text = str_replace(array("'","\"",">","<","\\"), "", $text);

return $text;



}

2: you've got a white space AFTER ?> right at the bottom of that php file.

Link to comment
Share on other sites

thanks fiddy! That resolved the errors in /admin...but it didnt resolve the error at /index.php...Now its just a blank page....*/*

edit:

ok....the blank page was a result of the "cs_red" skin, changed to killer and it works good...now the only problem is...that in /admin the following error is here:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/amefasco/public_html/clothes/includes/functions.inc.php:551) in /home/amefasco/public_html/clothes/admin/includes/auth.inc.php on line 36

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/amefasco/public_html/clothes/includes/functions.inc.php:551) in /home/amefasco/public_html/clothes/admin/includes/auth.inc.php on line 36

lol im filled with errors.

Link to comment
Share on other sites

As a general tip, display of a blank page when you are using PHP in a file typically indicates an error was generated that is not being displayed on the page, usually for security reasons, ie you don't want users seeing any error messages, warnings, notices, etc, that PHP throws at you.

Your best bet would be to check your error log (easily found if you are using cPanel) for any specific error messages generated when trying to access that page. If you can't fix the errors yourself, I'm sure someone here can help you out.

Link to comment
Share on other sites

ACTUALLY...i had notepad on wordwrap (i was editing with notepad so that i could just hit ctrl+f to find the things to replace)...I turned off wordwrap and it worked.

Now...Ill say it here first so i dont need to make a topic....I am having a really big problem where in step3 of checkout it says "we cannot ship to your country"...I might be missing a setting...but I dont think so. Cna someone help please?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...