query("select id from dictionar_limbi where default".($zone=='front'?'Front':'Back')."='1'"); return $query[0]['id']; } function lang_prefix(){ global $obj; $pref=$obj->query("select prefix from dictionar_limbi where id='2'",0); return strtolower($pref[0]['prefix']); } function getMsg($id){ global $texte; global $rsTexte; for ($i=0; $i<$rsTexte; $i++) if ($texte[$i]['id_msg']==$id) return $texte[$i]['valoare']; return $id; } //transofrma link ul din adress bar in $_GET function getVar(){ $tmp=parse_url($_SERVER['REQUEST_URI']); $pairs=explode("&",$tmp['query']); foreach ($pairs as $key=>$val){ $vars=explode("=",$val); $_GET[$vars[0]]=$vars[1]; } } //functiile children & parent sunt folosite in form de inregistrare function children($id){ global $obj; $tmp=$obj->query("select * from continut where public=1 and parent='".$id."' and id_lang='2' order by ordine asc",0); return $tmp; } function _parent($id){ global $obj; $tmp=$obj->query("select id,parent,titlu from continut where public=1 and id='".$id."'",0); if ($tmp[0]['parent']<>0) return _parent($tmp[0]['parent']); return $tmp; } // Gennereaza numele html pentru textul trimis ca parametru, pt mod_rewrite function makeLink($name,$ext=0){ $name=html_entity_decode($name); $search=array("ã","Ã","î","Î","â","Â","º","ª","þ","Þ","á","é","í","ó","o","ö","u","ú","û","Á","É","Í","Ó","O","Ö","U","Ú","Û"); $repl =array("a","a","i","i","a","a","s","s","t","t","a","e","i","o","o","o","u","u","u","a","e","i","o","o","o","u","u","u"); $name=str_replace($search,$repl,$name); //lista caracterelor care treb inlocuite la generarea unui link html $search=array('/"/','/&.+;/','/[^a-zA-Z0-9-]/','/--/'); $repl=array('-','-','-','-'); $name=preg_replace($search,$repl,$name); $name=trim($name,'-'); return strtolower($name).($ext<>''?$ext.'.html':''); } function preselect($v1,$v2,$tip='select'){ switch($tip){ case "select": if (is_array($v2)){ if (in_array($v1,$v2)) return 'selected="selected"'; } elseif ($v1==$v2) return 'selected="selected"'; break; case "checkbox": if (is_array($v2)){ if (in_array($v1,$v2)) return 'checked="checked"'; } elseif ($v1==$v2) return 'checked="checked"'; break; } } function lista_produse($tmp){ for ($i=0; $i0) echo '
'; mostra($tmp[$i]); } } function mostra($detalii){ //template afisare produs echo '

'.$detalii['model'].'

Status: '.status($detalii['of_spec']).'
'.$detalii['body'].'
'."\n"; } //transforma un sir de caractere in cuvinte function t2w($tmp,$separator=" "){ $tmp=strtolower($tmp); $tmp=explode($separator,$tmp); $tmp=array_unique($tmp); return $tmp; } //evidentiere cuvinte function highlightText($text,$words){ //protectie impotriva recursivitatii (repetarii) cuvintelor $words=array_unique($words); //text inserat pt marcare $start=''; $stop=''; for ($i=0; $iaparitie de mai multe ori a cuvantului if (count($caseWord)>0) $caseWord=array_unique($caseWord); $rsCaseWord=count($caseWord); for ($j=0; $j<$rsCaseWord; $j++){ $pattern='/'.$caseWord[$j].'/'; $replacement='/{[('.$caseWord[$j].')]}\\'; $text=preg_replace($pattern,$replacement,$text); } } $text=str_replace('/{[(',$start,$text); $text=str_replace(')]}\\',$stop,$text); return $text; } function setHeaders($id){ global $obj; $hVal=$obj->query("select cc.title,cc.description,cc.keyword from continut c LEFT JOIN continut_keywords cc ON cc.id_categ=c.id WHERE c.id=".$id); $header=ob_get_contents(); ob_end_clean(); $path=new cale($id); if ($hVal[0]['title']=='') $title=$path->title(); else $title=$hVal[0]['title']; $header=str_replace("{[(title)]}",config('titlu').": ".stripslashes($title),$header); $header=str_replace("{[(description)]}",config('titlu').": ".stripslashes($hVal[0]['description']),$header); $header=str_replace("{[(keywords)]}",stripslashes($hVal[0]['keyword']),$header); echo $header; } function categ($sectiune){ global $obj; $id=$obj->query("select id,titlu from continut where id in (select valoare from config where optiune='$sectiune' and id_lang='2')",0); return makeLink(stripslashes($id[0]['titlu'])).'-'.$id[0]['id'].'.html'; } function config($optiune){ global $obj; $val=$obj->query("select valoare from config where optiune='$optiune' and id_lang='2'",0); //print_r($val); return $val[0]['valoare']; } function status($id){ switch($id){ case "0": return "offline"; case "1": return "online"; } } ?>