RedJumpsuit

jobberBase custom development and support

 

Code School

A Better URL Fix

this is my second take to fixing the URL problem in jobberBase. i originally posted a fix back in November called The elusive http:// but later on realized that it would be tiring to keep adding the script/code everytime you have a URL field that you want to fix. so now i created a function instead, that you would just call everytime you want a URL field fixed.

open /_includes/functions.php and add this function

function fixurl($url)
{
	if ($url == '') {
		$fixedurl = '';
	} elseif ((substr($url,0,7) == "http://" OR substr($url,0,7) == "https://") AND strpos($url, ".")) {
		$fixedurl = $url;
	} elseif (substr($url,0,7) != "http://" AND strpos($url, ".")) {
		$fixedurl = 'http://'. $url;
	}
	return $fixedurl;
}

how to use this? as an example, you can open /_includes/class.Job.php and look for the blocks like

public function Create($params)
{
...
}

and use it like this

"' . fixurl($params['url']) . '",

and in

public function Edit($params)
{
...
}

and you will use the function like this

url = "' . fixurl($params['url']) . '",

note: this should work for all jobberBase versions.

Support RedJumpsuit and make a donation at www.pledgie.com !

Tagged as: , , , , , ,

Leave a Response