$v){ $ext = pathinfo($v, PATHINFO_EXTENSION); $ext = strtolower($ext); if($ext == $ex){ $fls[] = $v; } } return $fls; } ///// FUNDI I FILLIMIT /// GJENERIMI I MENU-ve function menu($niveli,$sub,$subi=0){ global $titi; global $custom; $subi++; if($niveli == ""){ return false; } global $menulist; $menulist2 = implode(" ",$menulist); $q = mysql_query("select * from pages where pid='$niveli' and h='0' order by ordi"); while($l = mysql_fetch_array($q)){ if($custom[0] !=""){ $selc = $custom[0]; }else{ $selc = "selected"; } if(eregi(" $l[id] ",$menulist2)){ $sel = "class='".$selc."' "; }else{ $sel = ""; } if($custom[1] =="li"){ $litag = $sel; }else{ $atag = $sel; } if(eregi(" $l[id] ",$menulist2)){ $sel = "class='".$selc."' "; }else{ $sel = ""; } echo "
  • "; if($l[urli] !=""){ echo "".$l[$titi].""; }else{ echo "".$l[$titi].""; } if($sub >= $subi){ $q2 = mysql_query("select * from pages where pid='$l[id]' and h='0'"); if(mysql_num_rows($q2) > 0 ){ echo "
  • "; } } echo ""; } } /// URL FRIENDLY function friendlyURL($string){ $string = preg_replace("`\[.*\]`U","",$string); $string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string); $string = htmlentities($string, ENT_COMPAT, 'utf-8'); $string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string ); $string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $string); return strtolower(trim($string, '-')); } /// MATRICA E MENUSE function ndiqmenu($id){ global $menulist; if($menulist == NULL){ $menulist = array(); } $q = mysql_query("select pid,id,h from pages where id='$id' and h='0' limit 0,1"); while($l = mysql_fetch_array($q)){ $menulist[] = " ".$l[id]." "; ndiqmenu($l[pid]); } } // FUNKSIONI PAGES function pages($niveli,$fill=NULL,$sa=NULL){ global $titi; global $ordi; if($fill == NULL){ $fill = 0; } if($sa == NULL){ $sa = 100; } if($ordi !=""){ $order = $ordi; }else{ $order = "datepub desc"; } $go = array(); $q = mysql_query("select * from pages where pid='$niveli' and h='0' order by $order limit $fill,$sa"); while($l = mysql_fetch_array($q)){ $l[files] = files($l[id]); $go[] = $l; } return $go; } /// FUNKSIONI FILES function files($id){ $files = array(); $dir = "media/pages/".$id."/"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { $ext = pathinfo($file, PATHINFO_EXTENSION); $ext = strtolower($ext); if($file !="." and $file !=".." and eregi("thumb",$file)==false){ $files[] = $file; } } closedir($dh); } } return $files; } /// FAQE OUT function faqe($id){ global $titi; global $subtiti; global $descpi; global $files; if($id == ""){ $q = mysql_query("select * from pages order by id limit 0,1"); while($l = mysql_fetch_array($q)){ $id = $l[id]; } } $q = mysql_query("select * from pages where id='$id'"); while($l = mysql_fetch_array($q)){ $o = $l; $o[files] = files($l[id]); } $files = $o[files]; return $o; } ///// ADMINISTRIMI function hierarki($s,$sel,$niveliiz){ $q2 = mysql_query("select * from pages where pid='$s' order by ordi limit 0,50 "); while($l2 = mysql_fetch_array($q2)){ ?> $v){ $f = faqe($v); echo "
  • ".$f[$titi]."
  • "; } } function logit($log){ global $udata; $fp = fopen("user_log.txt",'a+'); fwrite($fp,date("h:i d/m/Y")." - ".$udata[rname]." - ".$log."\n"); fclose($fp); } function validate_username($username) { $check = eregi_replace('([a-zA-Z0-9_]+)', "", $username); if(empty($check)) { return true; } else { return false; } } function getDomain(){ $dimi = str_replace("www.","",$_SERVER['HTTP_HOST']); $dom = explode(".",$dimi); if(count($dom)>1){ $dom = $dom[0].".".$dom[1]; }else{ $dom = $dom[0]; } return $dom; } ?>