";
$x[0]=$text[$f-4].$p1;
$x[1]=$p2.$endtext[$f-4];
}else{
if($p=="right" OR $p=="center"){$p1="
$value){
if(in_array($key,$colnames) AND $value!="~NULL~"){
if($value==" ")$value="";
$cols.="$comma$key";
$save.="$comma'$value'";
$comma=",";
}
}
$cols.=")";
$save.=")";
$insert="INSERT INTO $table $cols VALUES $save";
mysql_query($insert,$db);
$out= "\$sql=$insertMySQL error: ".mysql_errno().": ".mysql_error()." ";
return $out;
}
function img_shadow($img,$bdr,$align=""){
GLOBAL $path_images;
$is=GetImageSize($img);
$trs=GetImageSize("$path_images/bdr$bdr-tr.gif");
$bls=GetImageSize("$path_images/bdr$bdr-bl.gif");
$w=round($s[0]*$expand);
$h=round($s[1]*$expand);
$sp1=space($trs[0],$is[1]-$trs[1]);
$sp1h=$is[1]-$trs[1];
$sp2=space($is[0]-$bls[0],$bls[1]);
$sp2w=$is[0]-$bls[0];
$img=format_image($img);
$tr=format_image("$path_images/bdr1-tr.gif");
$br=format_image("$path_images/bdr1-br.gif");
$bl=format_image("$path_images/bdr1-bl.gif");
if($align!="")$align=" align=\"$align\"";
$out="
$img
$tr
$sp1
$bl
$sp2
$br
";
return $out;
}
function address_line($set,$adfont,$isize){
GLOBAL $co_info,$icon;
$adlinep="Phone: ";
$adlinef="Fax: ";
$adlinec="Cell: ";
$adlinee="E-Mail: ";
$adline="$adfont[0]";
if(strstr($set,"a")){
$adline.=$co_info[address];
$sp=" ";}
if(strstr($set,"c")){
$adline.=$sp.$co_info[city];
$sp=" ";}
if(strstr($set,"s")){
$adline.=$sp.$co_info[st];
$sp=" ";}
if(strstr($set,"S")){
$adline.=$sp.$co_info[state];
$sp=" ";}
if(strstr($set,"z")){
$adline.=$sp.$co_info[zip];
$sp=" ";}
if(strstr($set,"b"))$adline.=" ";
if(strstr($set,"P")){
$adline.=$sp.format_image(array($icon[phone],"","","","","","$isize","$isize"));
$sp="";
$adlinep="";}
if(strstr($set,"p")){
$adline.=$sp.$adlinep.$co_info[phone];
$sp=" ";}
if(strstr($set,"F")){
$adline.=$sp.format_image(array($icon[fax],"","","","","","$isize","$isize"));
$sp="";
$adlinef="";}
if(strstr($set,"f")){
$adline.=$sp.$adlinef.$co_info[fax];
$sp=" ";}
if(strstr($set,"M")){
$adline.=$sp.format_image(array($icon[cell],"","","","","","$isize","$isize"));
$sp="";
$adlinec="";}
if(strstr($set,"m")){
$adline.=$sp.$adlinec.$co_info[cell];
$sp=" ";}
if(strstr($set,"E")){
$adline.=$sp.format_image(array($icon[email],"","","","","","$isize","$isize"));
$sp=" ";
$adlinee="";}
if(strstr($set,"e")){
$adline.=$sp.$adlinee."$co_info[email] ";}
$adline=$set[space][pnleft].$adline.$set[space][pnright].$adfont[1].$set[space][2];
if(strstr($set,"1"))$out[1]=" $adline";
if(strstr($set,"2"))$out[2]="$adline ";
return $out;
}
function select_date($day="",$mo="",$yr="",$name="date",$order="mdy",$sep){
if($day=="")$day=date(d);
if($mo=="")$mo=date(m);
if($yr=="")$yr=date(Y);
$cday[$day]=" SELECTED";
$cmo[$mo]=" SELECTED";
$cyr[$yr]=" SELECTED";
// echo "$day-$mo-$yr ";
$list1=array("01","02","03","04","05","06","07","08","09");
$list2=range(10,31);
$list=array("01","02","03","04","05","06","07","08","09","10","11","12");
$dlist=array_merge($list1,$list2);
$m.="\n
None \n";
foreach($list as $value){
$m.="$value \n";
}
$m.=" \n";
$d.="\n
None \n";
foreach($dlist as $value){
$d.="$value \n";
}
$d.=" \n";
$list=range(1998,2009);
$y.="\n
None \n";
foreach($list as $value){
$y.="$value \n";
}
$y.=" \n";
return $$order[0].$sep.$$order[1].$sep.$$order[2];
}
function select_time($hour="",$min="",$sec="",$name="time",$order="hms",$sep="", $interval="",$clock_style=12){
if($hour=="")$hour=date(H);
if($min=="")$min=date(i);
if($sec=="")$sec=date(s);
$chour[$hour]=" SELECTED";
$cmin[$min]=" SELECTED";
$csec[$sec]=" SELECTED";
// echo "$hour-$min-$sec ";
$list1=array("01","02","03","04","05","06","07","08","09");
$list2=range(10,23);
$hlist=array_merge($list1,$list2);
$list2=range(24,59);
$mlist=$slist=array_merge($hlist,$list2);
if($interval[1]!="")
foreach($mlist AS $k=>$v){
if($i!=$interval[1]-1){
unset($mlist[$k]);
$i++;
}else{
$i=0;
}
}
$h.="\n\n";
// $h.="00 \n";
foreach($hlist as $value){
if($clock_style==12&&$value<12)$value2=ltrim($value,"0")." AM";
elseif($clock_style==12&&$value==12)$value2="$value PM";
elseif($clock_style==12&&$value>12)$value2=$value-12 ." PM";
else $value2=$value;
$h.="$value2 \n";
}
$h.=" \n";
$m.="\n
00 \n";
foreach($mlist as $value){
$m.="$value \n";
}
$m.=" \n";
$s.="\n
00 \n";
foreach($slist as $value){
$s.="$value \n";
}
$s.=" \n";
$out= $$order[0].$sep.$$order[1];
if($order[2]!="")$out.=$sep.$$order[2];
return $out;
}
function select_state($state="",$statename="st",$country="",$select="Select"){
if($state == ""){
$select.="\n $select ";
$state=$select;
}
if($state==$select){
$stateval="";
}else{
$stateval=$state;
}
if($country==""||$country=="US"){
$st=array(
"AK"=>"Alaska",
"AL"=>"Alabama",
"AZ"=>"Arizona",
"AR"=>"Arkansas",
"CA"=>"California",
"CO"=>"Colorado",
"CT"=>"Connecticut",
"DC"=>"Washington D.C.",
"DE"=>"Delaware",
"FL"=>"Florida",
"GA"=>"Georgia",
"HI"=>"Hawaii",
"ID"=>"Idaho",
"IL"=>"Illinois",
"IN"=>"Indiana",
"IA"=>"Iowa",
"KS"=>"Kansas",
"KY"=>"Kentucky",
"LA"=>"Louisiana",
"ME"=>"Maine",
"MD"=>"Maryland",
"MA"=>"Massachusetts",
"MI"=>"Michigan",
"MN"=>"Minnesota",
"MS"=>"Mississippi",
"MO"=>"Missouri",
"MT"=>"Montana",
"NE"=>"Nebraska",
"NV"=>"Nevada",
"NH"=>"New Hampshire",
"NJ"=>"New Jersey",
"NM"=>"New Mexico",
"NY"=>"New York",
"NC"=>"North Carolina",
"ND"=>"North Dakota",
"OH"=>"Ohio",
"OK"=>"Oklahoma",
"OR"=>"Oregon",
"PA"=>"Pennsylvania",
"PR"=>"Puerto Rico",
"RI"=>"Rhode Island",
"SC"=>"South Carolina",
"SD"=>"South Dakota",
"TN"=>"Tennessee",
"TX"=>"Texas",
"UT"=>"Utah",
"VT"=>"Vermont",
"VA"=>"Virginia",
"VI"=>"Virgin Islands (U.S.)",
"WA"=>"Washington",
"WV"=>"West Virginia",
"WI"=>"Wisconsin",
"WY"=>"Wyoming"
);
}
if($country==""||$country=="CA"){
$st["AB"]="Alberta";
$st["BC"]="British Columbia";
$st["MN"]="Manatoba";
$st["NB"]="New Brunswick";
$st["NF"]="New Foundland";
$st["NWT"]="North West Territories";
$st["NS"]="Nova Scosia";
$st["ON"]="Onterio";
$st["PEI"]="Prince Edward Island";
$st["SK"]="Saskatchewan";
$st["QU"]="Quebec";
$st["YT"]="Yukon";
}
asort($st);
$selected[$state]=" SELECTED";
$out= "$select\n";
foreach($st AS $k=>$v){
$out.=" $v \n";
}
$out.=" \n";
return $out;
}
function format_paragraph($body,$prepend="",$align=""){
if($align!="")$align=" align=\"$align\"";
$body=str_replace("\n\n","",$body);
$body=str_replace("\n"," ",$body);
$body=str_replace(" "," ",$body);
$body="
$prepend$body
";
return $body;
}
function format_br_paragraph($body,$prepend=""){
$body="$prepend$body";
$body=str_replace("\n\n"," ",$body);
$body=str_replace("\n"," ",$body);
$body="$body";
return $body;
}
function select_number($selname,$compare,$list,$multi="",$use_v_for_k="",$tabindex=""){
if(!is_array($compare))$compare=array($compare);
foreach($compare AS $v){
$x[$v]=" SELECTED";
//echo "v=$v ";
}
if($multi!="")$mult=" MULTIPLE SIZE=\"$multi\"";
$out="\n\n";
if($tabindex!="")$tabindex=" TABINDEX=\"$tabindex\"";
foreach($list as $key => $value){
//echo "key=$key - value=$value - x[$key]=$x[$key] ";
if($value=="")$key="";
if($use_v_for_k=="1")$key=$value;
$out.="$value \n";
}
$out.=" \n";
return $out;
}
function input_text($name,$size,$value="",$type="t",$rows="5"){
if($value!="")$v2=" value=\"$value\"";
if($type=="t")$out=" ";
if($type=="T")$out="";
if($type=="p")$out=" ";
return $out;
}
function input_button($t,$n,$v){
switch($t){
case "s":
$t="submit";
break;
case "b":
$t="button";
break;
case "r":
$t="reset";
break;
case "h":
$t="hidden";
break;
}
$out=" ";
return $out;
}
function paragraph($txt){
$out="";
$out.=str_replace("\n\n","
",$txt);
$out=str_replace("\n"," ",$out);
$out=str_replace("\\n","\n",$out);
return $out;
}
function iscss(){
$ver=intval(trim(substr(getenv('HTTP_USER_AGENT'),8+strpos(getenv('HTTP_USER_AGENT'), "Mozilla"), 1)));
$str_css = ereg('MSIE',getenv('HTTP_USER_AGENT')) || $ver >= 5 ?true : false;
return $str_css;
}
function show_hours($file,$tbl=""){
GLOBAL $lang;
if(file_exists("$file")){
$file=file("$file");
$sun=explode(";",$file[0]);
$mon=explode(";",$file[1]);
$tue=explode(";",$file[2]);
$wed=explode(";",$file[3]);
$thu=explode(";",$file[4]);
$fri=explode(";",$file[5]);
$sat=explode(";",$file[6]);
If(!strstr($file[0],"Closed"))$sun1="$sun[0] $lang[to] $sun[1]";
else$sun1=$lang[closed];
If(!strstr($file[1],"Closed"))$mon1="$mon[0] $lang[to] $mon[1]";
else$mon1=$lang[closed];
If(!strstr($file[2],"Closed"))$tue1="$tue[0] $lang[to] $tue[1]";
else$tue1=$lang[closed];
If(!strstr($file[3],"Closed"))$wed1="$wed[0] $lang[to] $wed[1]";
else$wed1=$lang[closed];
If(!strstr($file[4],"Closed"))$thu1="$thu[0] $lang[to] $thu[1]";
else$thu1=$lang[closed];
If(!strstr($file[5],"Closed"))$fri1="$fri[0] $lang[to] $fri[1]";
else$fri1=$lang[closed];
If(!strstr($file[6],"Closed"))$sat1="$sat[0] $lang[to] $sat[1]";
else$sat1=$lang[closed];
$hours="
$lang[hoursofop]
".$lang[week][0]."
".$lang[week][1]."
".$lang[week][2]."
".$lang[week][3]."
".$lang[week][4]."
".$lang[week][5]."
".$lang[week][6]."
$sun1
$mon1
$tue1
$wed1
$thu1
$fri1
$sat1
";
if($sun[2]!="" OR $mon[2]!="" OR $tue[2]!="" OR $wed[2]!="" OR $thu[2]!="" OR $fri[2]!="" OR $sat[2]!=""){
if($sun[2]!="")$sun[2]="$sun[2] $lang[to] $sun[3]";
if($mon[2]!="")$mon[2]="$mon[2] $lang[to] $mon[3]";
if($tue[2]!="")$tue[2]="$tue[2] $lang[to] $tue[3]";
if($wed[2]!="")$wed[2]="$wed[2] $lang[to] $wed[3]";
if($thu[2]!="")$thu[2]="$thu[2] $lang[to] $thu[3]";
if($fri[2]!="")$fri[2]="$fri[2] $lang[to] $fri[3]";
if($sat[2]!="")$sat[2]="$sat[2] $lang[to] $sat[3]";
$hours.="
$sun[2]
$mon[2]
$tue[2]
$wed[2]
$thu[2]
$fri[2]
$sat[2]
";
}
$hours.="
";
return $hours;
}
}
function convert_unit($unit,$con){
switch($con){
case "im":
$out=$unit*25.4;
break;
case "ic":
$out=$unit*2.54;
break;
}
return $out;
}
if(!function_exists(errorcheck)){
function errorcheck($ec,$file=""){
GLOBAL $table_cfg,$HTTP_HOST,$cfgtable,$cfg;
if($ec==""){
echo "
Momentary Server error
File in error => $file - $HTTP_HOST
CFG Table => $table_cfg - $cfgtable
A momentary server error has occured.
If this page does not refresh in 5 seconds
please use the \"Refresh\" or \"Reload\" button on your browser to try
again.
If the problem continues please try again in a few minutes.
Thankyou for your patience.
";
exit;
}
}
}
function test_array($array, $name="", $convert=""){
$out.="========================= \nTest Array \$$name \n";
ksort($array);
foreach($array AS $k=>$v){
if(is_array($v)){
$val="ARRAY=> ";
$sep="";
foreach($v AS $k1=>$v1){
if($convert==1)$k1=htmlentities($k1);
if($convert==1)$v1=htmlentities($v1);
$val.="$sep $k1 =>$v1 ";
$sep="; ";
}
}else{
if($convert==1)$k=htmlentities($k);
if($convert==1)$v=htmlentities($v);
$val=$v;
}
$out.="$k == $val \n";
}
$out.="========================= \n";
return $out;
}
function VE_DB($sql){
GLOBAL $db;
if(!defined(DB))define("DB",$db);
$result=mysql_query($sql,DB);
//echo "\$sql=$sqlMySQL error: ".mysql_errno().": ".mysql_error()." Affected rows:".mysql_affected_rows($result).mysql_num_rows($result)." ";
return $result;
}
function test_sql($sql=""){
return "\$sql=$sqlMySQL error: ".mysql_errno().": ".mysql_error()." ";
}
function log_entry($name,$u,$c,$x=""){
GLOBAL $up_dir,$user_info;
if($user_info[REMOTE_ADDR]!=$TEST_REMOTE_ADDR&&$user_info[id]!=1){
if($x!="")$x=";$x";
$now=getdate();
$body="$u;$c$x;$now[year]:$now[mon]:$now[mday]:$now[hours]:$now[minutes]\n";
$month=date("my");
$fh=fopen($up_dir."logs/$name$month.txt","a");
fwrite($fh,$body);
fclose($fh);
}
}
function hex2bin($data) {
$len = strlen($data);
return pack("H" . $len, $data);
}
function pw_encrypt($pw) {
global $key;
$td = mcrypt_module_open(MCRYPT_BLOWFISH,"",MCRYPT_MODE_ECB,"");
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_RAND);
mcrypt_generic_init($td,$key,$iv);
$encpw=bin2hex(mcrypt_generic($td,$pw));
mcrypt_generic_end($td);
return $encpw;
}
function pw_decrypt($encpw) {
global $key;
$td = mcrypt_module_open(MCRYPT_BLOWFISH,"",MCRYPT_MODE_ECB,"");
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_RAND);
mcrypt_generic_init($td,$key,$iv);
$pw=mdecrypt_generic($td,hex2bin($encpw));
mcrypt_generic_end($td);
return $pw;
}
function simple_crypt($mode,$string,$key=""){
GLOBAL $path_private;
if($key==""){
$file="$path_private/default_short_key.key";
$fsize=filesize($file)+11;
$fp=fopen($file,"r");
$key=fread($fp,$fsize);
fclose($fp);
}
if($mode=="e" OR $mode=="E"){
//--- Encrypt string with key
$count=0;
$scount=strlen($string);
$kcount=strlen($key);
while($kcount>$count){
$kchr=substr($key,$count,1);
$karray[$kchr]=$count;
$karray2[$kcount-$count-1]=$kchr;
$count++;
}
$count=0;
$result="";
while($scount>$count){
$chr=substr($string,$count,1);
$x=$karray[$chr];
$result.=$karray2[$x];
$count++;
}
}elseif($mode=="d" OR $mode=="D"){
//--- Decrypt string with key
$count=0;
$scount=strlen($string);
$kcount=strlen($key);
while($kcount>$count){
$kchr=substr($key,$count,1);
$karray[$kchr]=$kcount-$count-1;
$karray2[$count]=$kchr;
$count++;
}
$count=0;
$result="";
while($scount>$count){
$chr=substr($string,$count,1);
$x=$karray[$chr];
$result.=$karray2[$x];
$count++;
}
}
return $result;
}
function help_words($txt, $page){
GLOBAL $Tables,$test;
$sql="SELECT * FROM $Tables[helpwd]";
$result=VE_DB($sql);
//echo "\$sql=$sqlMySQL error: ".mysql_errno().": ".mysql_error()." ";
if(mysql_errno()==1146){
$sql="CREATE TABLE `help_words` (
`def_id` varchar(64) NOT NULL default '',
`word` varchar(33) NOT NULL default '',
`coded_word` varchar(64) NOT NULL default '',
`url` tinytext NOT NULL,
`pages` tinytext NOT NULL,
`target` varchar(11) NOT NULL default '',
UNIQUE KEY `coded_word` (`coded_word`)
) TYPE=MyISAM;";
VE_DB($sql);
$sql="CREATE TABLE `help_defs` (
`id` varchar(64) NOT NULL default '',
`id2` varchar(33) NOT NULL default '',
`title` varchar(66) NOT NULL default '',
`title_align` varchar(11) NOT NULL default '',
`body_align` varchar(11) NOT NULL default '',
`body` text NOT NULL,
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM;";
VE_DB($sql);
}elseif(mysql_num_rows($result)<1){
// break;
}else{
while(@$row = mysql_fetch_array($result)){
//echo "word=$row[word] - $row[target] ";
//echo test_array($_SERVER);
if((strstr($row[pages],$page)||$row[pages]=="all")
&&!strstr($row[exclude_pages],$_SERVER[REQUEST_URI]))
switch($row[target]){
case "help_win":
$txt=str_replace($row[word],help_win($row[word],$row[def_id],"","","./"),$txt);
break;
case "new_info":
break;
case "same_info":
break;
case "new_blank":
$txt=str_replace($row[word],"$row[word] ",$txt);
break;
case "blank":
$txt=str_replace($row[word],"$row[word] ",$txt);
break;
}
}
}
return $txt;
}
function format_phone($fno,$strip=""){
GLOBAL $test;
if($fno!=""){
if($strip!=""){
$fno=str_replace("_","",$fno);
$fno=str_replace("<","",$fno);
$fno=str_replace(">","",$fno);
$fno=str_replace("/","",$fno);
$fno=str_replace("\\","",$fno);
$fno=str_replace(",","",$fno);
$fno=str_replace(".","",$fno);
$fno=str_replace("-","",$fno);
$fno=str_replace(")","",$fno);
$fno=str_replace("(","",$fno);
$fno=str_replace(" ","",$fno);
$fno=str_replace("\t","",$fno);
$fno=str_replace("\n","",$fno);
$fno=str_replace("\r","",$fno);
$fno=str_replace("\0","",$fno);
$fno=str_replace("\x0B","",$fno);
}
if($strip==2||$strip==""){
$no1=substr($fno,-4);
$no2=substr($fno,-7,3);
$no3=substr($fno,0,-7);
$fno=$no3."-".$no2."-".$no1;
}
}
return $fno;
}
function os_chek(){
if(strstr($_SERVER[HTTP_USER_AGENT],"Windows CE")||strstr($_SERVER[HTTP_USER_AGENT],"Palm"))return "PPC";
else return "DT";
}
if ( !defined( "_FUNC" ) )define("_FUNC", 1 );
?>