define("HOST","localhost");
define("USER","studi_old");
define("PASSWORD","L8$l7x2i");
define("DBNAME","studio-eu_old");
function DBConnect($DBName)
{
$sql = mysql_connect (HOST,USER,PASSWORD );
if ($sql==false) return false;
mysql_select_db($DBName);
mysql_query("SET NAMES 'utf8'");
return $sql;
}
DBConnect(DBNAME);
function dodaj_reckord($tabela, $pole, $wartosc)
{
$res=mysql_query("INSERT INTO $tabela ($pole) values('$wartosc')");
return mysql_insert_id();
}
function dodaj_reckordy($tabela, $pola, $wartosci)
{
$ilosc=count($pola);
$i=0;
foreach($pola as $wartosc)
{
$i++;
if($ilosc!=$i){$pole.=$wartosc.",";}
else{$pole.=$wartosc;}
}
$ilosc=count($wartosci);
$i=0;
foreach($wartosci as $wartosc)
{
$i++;
if($ilosc!=$i){$var.="'".$wartosc."',";}
else{$var.="'".$wartosc."'";}
}
//echo" POLA: ".$pole." WARTOSCI: ".$var;
mysql_query("INSERT INTO $tabela ($pole) values($var)");
return mysql_insert_id();
}
function modyfikuj_reckord($tabela, $pole, $wartosc, $where, $where_wart)
{
mysql_query("UPDATE $tabela SET $pole='$wartosc' WHERE $where='$where_wart'");
}
function modyfikuj_reckord_where($tabela, $pole, $wartosc, $where)
{
mysql_query("UPDATE $tabela SET $pole='$wartosc' WHERE $where");
}
function insert_reckords($tabela, $set, $where, $where_wart)
{
mysql_query("UPDATE $tabela SET $set WHERE $where='$where_wart'");
}
function modyfikuj_reckordy($tabela, $pole, $wartosc, $where, $where_wart)
{
$ilosc=count($pole);
$i=0;
foreach($pole as $var)
{
$i++;
$nr=$i-1;
if($ilosc!=$i){$set.=$var."='".$wartosc[$nr]."',";}
else{$set.=$var."='".$wartosc[$nr]."'";}
}
$res=mysql_query("UPDATE $tabela SET $set WHERE $where='$where_wart'");
return $res;
}
function modyfikuj_reckordy_where($tabela, $pole, $wartosc, $where)
{
$ilosc=count($pole);
$i=0;
foreach($pole as $var)
{
$i++;
$nr=$i-1;
if($ilosc!=$i){$set.=$var."='".$wartosc[$nr]."',";}
else{$set.=$var."='".$wartosc[$nr]."'";}
}
$res=mysql_query("UPDATE $tabela SET $set WHERE $where");
return $res;
}
function usun_reckord($tabela, $where, $where_wart)
{
$res=mysql_query("DELETE FROM $tabela WHERE $where='$where_wart'");
return $res;
}
function usun_reckord_where($tabela, $where)
{
$res=mysql_query("DELETE FROM $tabela WHERE $where");
return $res;
}
?>
$dostepnosc_tab=array(
0 => '24 h'
,1 => '48 h'
,2 => '3 dni'
,3 => '5 dni'
,4 => '7 dni'
,5 => '14 dni'
,6 => '28 dni'
);
function pole_select($name, $val, $tablica, $style='',$zerowy='- - -',$js='',$size=1,$show_id=true)
{
if($show_id){$id=" id='".$name."'";}
$res="\n";
if($zerowy!=false){$res.="$zerowy \n";}
if(is_array($tablica))
{
foreach ($tablica as $pol => $wrt)
{
if($val==$pol)
{
$res.="".$wrt." \n";
}
else
{
$res.="".$wrt." \n";
}
}
}
$res.=" \n";
return $res;
}
/*
function pole_select($name, $val, $tablica, $style='',$zerowy='- - -',$js='',$size=1,$show_id=true)
{
if($show_id){$id=" id='".$name."'";}
$res="\n";
if($zerowy!=false){$res.="$zerowy \n";}
if(is_array($tablica))
{
foreach ($tablica as $pol => $wrt)
{
if($val==$pol)
{
$res.="".$wrt." \n";
}
else
{
$res.="".$wrt." \n";
}
}
}
$res.=" \n";
return $res;
}
*/
function pole_select_label($tablica, $name, $sel, $style='', $zerowy='- - -', $js='')
{
/* while (@$wiersz = mysql_fetch_array($Result))
{
$kategoria[$wiersz[1]][$wiersz[$val]]=$wiersz[$opc];
} */
$res="";
if($zerowy!=false){$res.="$zerowy \n";}
if(is_array($tablica))
{
foreach($tablica as $key => $val)
{
if(is_array($val))
{
$res.="";
foreach($val as $klucz => $wart)
{
if($sel==$klucz){$selected='selected';}else{$selected='';}
if($wart!=''){
$res.="$wart ";
}
}
$res.=" ";
}
else
{
if($sel==$key){$selected='selected';}else{$selected='';}
$res.="$val ";
}
}
}
$res .= " ";
return $res;
}
function pozycja($name, $pos, $maxpos, $style='')
{
$res="\n";
for ($i=1;$i<=$maxpos;$i++)
{
if($i==$pos)
{
$res.="".$i." \n";
}
else
{
$res.="".$i." \n";
}
}
$res.=" \n";
return $res;
}
function pozycja2($name, $pos, $maxpos, $param='')
{
$res="\n";
for ($i=1;$i<=$maxpos;$i++)
{
if($i==$pos)
{
$res.="".$i." \n";
}
else
{
$res.="".$i." \n";
}
}
$res.=" \n";
return $res;
}
function send_plik($zmienna,$name,$path,$chck_name=true)
{
$uchwyt=$_FILES[$zmienna];
//echo" FILE: ".$_FILES[$zmienna]['tmp_name']." ";
$file=$uchwyt['tmp_name'];
//echo" FILE: ".$file." ";
$foto=explode(".",$uchwyt['name']);
if(trim($name)==''){
$name=make_filename($foto[0]);
}
else{$name=make_filename($name);}
$rozszerzenie=strtolower(array_pop($foto));
if($chck_name){$name=check_filename($path,$name.".".$rozszerzenie);}//uwaga
if($name!='')
{
//echo"NAME $name ";
//if(! move_uploaded_file($file, $path.$name.".".$rozszerzenie))
if(! move_uploaded_file($file, $path.$name))
{$info_o_pliku="Bł±d plik nie został skopiowany ";return false;}
else
{
$info_o_pliku="Plik został skopiowany
Informacje o skopiowanym pliku:
Nazwa pliku: ".$uchwyt['name']."
Wielko¶ć pliku: ".$uchwyt['size']."
Nowa nazwa pliku: ".make_filename($name).".".$rozszerzenie." " ;
//$name=$name.".".$rozszerzenie; //echo$info_o_pliku;
chmod ($path.$name, 0644);
return $name;
}
}
}
function make_filename($string) {
$string = mb_strtolower($string,'utf-8');
$polskie = array(',', ' - ',' ','ę', 'Ę', 'ó', 'Ó', 'Ą', 'ą', 'Ś', 's', 'ł', 'Ł', 'ż', 'Ż', 'Ź', 'ź', 'ć', 'Ć', 'ń', 'Ń','-',"'","/","?", '"', ":", 'ś', '!','.', '&', '&', '#', ';', '[',']','domena.pl', '(', ')', '`', '%', '”', '„', '…');
$miedzyn = array('-','-','-','e', 'e', 'o', 'o', 'a', 'a', 's', 's', 'l', 'l', 'z', 'z', 'z', 'z', 'c', 'c', 'n', 'n','-',"","","","","",'s','','', '', '', '', '', '', '', '', '', '', '', '', '');
$string = str_replace($polskie, $miedzyn, $string);
// usuń wszytko co jest niedozwolonym znakiem
$string = preg_replace('/[^0-9a-z\-_]+/', '', $string);
// zredukuj liczbę myślników do jednego obok siebie
$string = preg_replace('/[\-]+/', '-', $string);
// usuwamy możliwe myślniki na początku i końcu
$string = trim($string, '-');
$string = stripslashes($string);
// na wszelki wypadek
$string = urlencode($string);
return $string;
}
function make_filename_old2($userfile_name){
// ustalamy nazwe pliku
// generujemy cos randomize
// konwersja polskich znakow na male i na ascii
$userfile_name = mb_strtolower($userfile_name,'utf-8');
$userfile_name = strtr($userfile_name, " ¶¦Ľ¬±ˇäö·±±ĆćĘꣳŃńÓ󦦶¶¬ˇˇŻżĄ/\\.","+sszzaaaoaaacceellnnoosssszzzzzz____");
return $userfile_name;
}
function make_filename_old($userfile_name){
// ustalamy nazwe pliku
// generujemy cos randomize
// konwersja polskich znakow na male i na ascii
$userfile_name = strtolower($userfile_name);
$userfile_name = strtr($userfile_name, " ¶¦Ľ¬±ˇäö·±±ĆćĘꣳŃńÓ󦦶¶¬ˇˇŻżĄ()/\\.","+sszzaaaoaaacceellnnoosssszzzzzz______");
return $userfile_name;
}
function check_filename($path,$name,$lev='0'){
if($lev=='0'){$newname=$name;}
else{
$plik=explode(".",$name);
$rozszerzenie=array_pop($plik);
$newname=$plik[0]."(".$lev.").".$rozszerzenie;
//echo"name=$name rozszerzenie=$rozszerzenie newname=$newname ";
}
//echo"name: ".$newname." ";
if(is_file($path.$newname))
{
$lev=$lev+1;
return check_filename($path,$name,$lev);
}
else
{
//echo"new name: ".$newname." ";
return $newname;
}
//return $newname;
}
function option_db_res($Result, $name, $val, $opc, $selected='', $style='' ,$js='',$zero='true')
{
$res="";
if($zero=='true'){$res .= "--- ";}
while (@$wiersz = mysql_fetch_array($Result))
{
if($wiersz[$val] == $selected)
$res .= "".ucwords(urldecode($wiersz[$opc]))." ";
else
$res .= "".ucwords(urldecode($wiersz[$opc]))." ";
}
$res .= " ";
return $res;
}
function option_db_res_label($Result, $name, $val, $opc, $selected='', $style='' ,$js='')
{
while (@$wiersz = mysql_fetch_array($Result))
{
$kategoria[$wiersz[1]][$wiersz[$val]]=$wiersz[$opc];
}
$res="";
$res .= "--- ";
if(is_array($kategoria))
{
foreach($kategoria as $key => $val)
{
$res.="";
foreach($val as $klucz => $wart)
{
if($wart!=''){
$res.="$wart ";
}
}
$res.=" ";
}
}
$res .= " ";
return $res;
}
function option_db_tab($tab, $val, $opc, $name, $selected='', $selected_val='', $style='', $qwhere='', $awhere='')
{
$res="";
if($awhere != '' && $qwhere != '')
{$aResult = mysql_query("SELECT * FROM $tab WHERE $qwhere='$awhere'");}
else
{$aResult = mysql_query("SELECT * FROM $tab");}
while ($wiersz = mysql_fetch_array($aResult))
{
if($wiersz[$val] == $selected_val)
{
$res .= "".ucwords(urldecode($selected))." ";
}
else
{
$res .= "".ucwords(urldecode($wiersz[$opc]))." ";
}
}
$res .= " ";
return $res;
}
function skr_dane($tekst, $il_znakow)
{
if (strlen($tekst) > $il_znakow)
return substr($tekst, 0, strrpos(substr($tekst, 0, $il_znakow), " ")).' ...';
else return $tekst;
}
function pokaz_date($data){
/*$res=$data[0].$data[1].$data[2].$data[3]."-".$data[4].$data[5]."-".$data[6].$data[7]." ".$data[8].$data[9].":".$data[10].$data[11];*/
$res=$data[0].$data[1].$data[2].$data[3].$data[4].$data[5].$data[6].$data[7].$data[8].$data[9].$data[10].$data[11].$data[12].$data[13].$data[14].$data[15];
return $res;
}
function show_data()
{
require('data.inc.php');
$dzientyg=DzienTygodnia($dzien);
$dzien=date("j");
$miesiac=date("m");
$nazwa_miesiaca=Miesiac($miesiac);
$rok=date("Y");
$imieniny=file("imieniny/$miesiac.txt");
$imiona=$imieniny[$dzien-1];
echo ("Dzisiaj jest $dzientyg $dzien $nazwa_miesiaca $rok r. imieniny $imiona");
}
function plXSL($string) {
$chArray = array(
"\x42\x01" => "\xB3", "\x7b\x01" => "\xAF",
"\x44\x01" => "\xF1", "\x41\x01" => "\xA3",
"\x5b\x01" => "\xB6", "\x19\x01" => "\xEA",
"\x05\x01" => "\xB1", "\x7c\x01" => "\xBF",
"\x7a\x01" => "\xBC", "\x07\x01" => "\xE6",
"\x44\x01" => "\xF1", "\x18\x01" => "\xCA",
"\x04\x01" => "\xA1", "\x5a\x01" => "\xA6",
"\x41\x01" => "\xA3", "\x7b\x01" => "\xAF",
"\x79\x01" => "\xAC", "\x06\x01" => "\xC6",
"\x43\x01" => "\xD1", "\x00" => ''
);
return strtr($string, $chArray);
}
function pokaz_pliki($katalog,$name,$size=1,$func='',$selected='')
{
if($size>1){$size_par='size='.$size;}else{$size_par='';};
$sciezka = opendir($katalog);
while ($foto = readdir($sciezka))
{
if (($foto!=".")&&($foto!=".."))
{
$l_fot++;
$tablica_obrazkow[]=$foto;
}
}
closedir($sciezka);
if(isset($tablica_obrazkow))
{
sort($tablica_obrazkow);
$res='';
$res.='- - - - - ';
foreach($tablica_obrazkow as $index => $foto)
{
if($selected==$foto){$res.=''.$foto.' ';}else{$res.=''.$foto.' ';}
}
$res.=' ';
}
return $res;
}
function pokaz_pliki_w_kat($katalog,$selected,$abs_kat=false)
{
$sciezka = opendir($katalog);
while ($foto = readdir($sciezka))
{
if (($foto!=".")&&($foto!="..")&&!is_dir($katalog.$foto))
{
$l_fot++;
$tablica_obrazkow[]=$foto;
}
/*else if(($foto!=".")&&($foto!="..")&&is_dir($katalog.$foto))
{
$folder=$foto;
}*/
}
closedir($sciezka);
if(isset($tablica_obrazkow))
{
sort($tablica_obrazkow);
//$res.='- - - - - ';
foreach($tablica_obrazkow as $index => $foto)
{
//if(trim($katalog)!=''){$katalog=$katalog."/";}
if($abs_kat)
{
if($selected==$abs_kat.'/'.$foto){$res.=''.$foto.' ';}
else{$res.=''.$foto.' ';}
}
else
{
if($selected==$katalog.''.$foto){$res.=''.$foto.' ';}
else{$res.=''.$foto.' ';}
}
}
}
return $res;
}
function pokaz_katalogi_pliki($katalog,$name,$size=1,$func='',$selected='',$abs_kat=false)
{
if($size>1){$size_par='size='.$size;}else{$size_par='';};
$sciezka = opendir($katalog);
while ($foto = readdir($sciezka))
{
if(is_file($katalog.'/'.$foto) && ($foto!=".")&&($foto!=".."))
{
$l_fot++;
$tablica_obrazkow[]=$foto;
}
if(is_dir($katalog.'/'.$foto) && ($foto!=".")&&($foto!="..")&&($foto!="cache"))
{
$l_kat++;
$tablica_katalogow[]=$foto;
}
}
closedir($sciezka);
$res='';
$res.='- - - - - ';
if(isset($tablica_katalogow))
{
sort($tablica_katalogow);
foreach($tablica_katalogow as $index => $foto)
{
//if($selected==$foto){$res.=''.$foto.' ';}else{$res.=''.$foto.' ';}
$res.="";
if($abs_kat)
{
$res.=pokaz_pliki_w_kat($katalog.'/'.$foto.'/',$selected,$abs_kat.'/'.$foto);
}
else
{
$res.=pokaz_pliki_w_kat($katalog.'/'.$foto.'/',$selected,$abs_kat);
}
$res.=" ";
}
}
$res.="";
$res.=pokaz_pliki_w_kat($katalog.'/',$selected,$abs_kat);
$res.=" ";
$res.=' ';
//}
return $res;
}
function pokaz_pliki_w_kat2($katalog,$selected,$abs_kat=false)
{
$sciezka = opendir($katalog);
while ($foto = readdir($sciezka))
{
if (($foto!=".")&&($foto!="..")&&!is_dir($katalog.$foto))
{
$l_fot++;
$tablica_obrazkow[]=$foto;
}
/*else if(($foto!=".")&&($foto!="..")&&is_dir($katalog.$foto))
{
$folder=$foto;
}*/
}
closedir($sciezka);
if(isset($tablica_obrazkow))
{
sort($tablica_obrazkow);
//$res.='- - - - - ';
foreach($tablica_obrazkow as $index => $foto)
{
//if(trim($katalog)!=''){$katalog=$katalog."/";}
if($abs_kat)
{
if($selected==$abs_kat.'/'.$foto){$res.=''.$foto.' ';}
else{$res.=''.$foto.' ';}
}
else
{
if($selected==$katalog.''.$foto){$res.=''.$foto.' ';}
else{$res.=''.$foto.' ';}
}
}
}
return $res;
}
function pokaz_katalogi_pliki2($katalog,$name,$size=1,$func='',$selected='',$abs_kat=false)
{
if($size>1){$size_par='size='.$size;}else{$size_par='';};
$sciezka = opendir($katalog);
while ($foto = readdir($sciezka))
{
if(is_file($katalog.'/'.$foto) && ($foto!=".")&&($foto!=".."))
{
$l_fot++;
$tablica_obrazkow[]=$foto;
}
if(is_dir($katalog.'/'.$foto) && ($foto!=".")&&($foto!="..")&&($foto!="cache"))
{
$l_kat++;
$tablica_katalogow[]=$foto;
}
}
closedir($sciezka);
if(isset($tablica_katalogow))
{
sort($tablica_katalogow);
$res='';
$res.='- - - - - ';
foreach($tablica_katalogow as $index => $foto)
{
//if($selected==$foto){$res.=''.$foto.' ';}else{$res.=''.$foto.' ';}
$res.="";
if($abs_kat)
{
$res.=pokaz_pliki_w_kat2($katalog.'/'.$foto.'/',$selected,$abs_kat.'/'.$foto);
}
else
{
$res.=pokaz_pliki_w_kat2($katalog.'/'.$foto.'/',$selected,$abs_kat);
}
$res.=" ";
}
$res.="";
$res.=pokaz_pliki_w_kat2($katalog.'/',$selected,$abs_kat);
$res.=" ";
$res.=' ';
}
return $res;
}
function Utf8ToIso($str)
{
return iconv("utf-8", "iso-8859-2", $str);
//return $str;
}
function make_select($kategoria, $key, $id_kat, $id_parent, $nazwa='id_kat',$class='hierarchia',$max_lev=0,$lev=0)
{
$res.="
";
if(is_array($kategoria[$key]) AND $key!=$id_kat)
{
foreach($kategoria[$key] as $key2 => $value2)
{
if($key2==$id_parent){$params='style="color:red;";';}else{$params='';}
if($key2!=$id_kat)
{
$res.="$value2 ";
//if(is_array($kategoria[$key2]) AND $key2!=$id_kat)
//{
if($max_lev>$lev OR $lev==0)
{
$res.= make_select($kategoria, $key2, $id_kat, $id_parent, $nazwa, $class, $max_lev, $lev+1);
}
//return $res;
//}
$res.=" ";
}
/* else
{
return $res;
} */
}
}
$res.=" ";
return $res;
}
function make_select_checkbox($kategoria, $checked, $key, $id_kat, $id_parent, $nazwa='id_kat',$class='hierarchia')
{
$res.="";
return $res;
}
function make_simple_select_checkbox($kategoria, $checked, $nazwa='id_kat',$class='hierarchia')
{
$res.="";
return $res;
}
function make_simple_select_table_checkbox($kategoria, $checked, $nazwa='id_kat',$class='hierarchia')
{
$res.="";
return $res;
}
function make_select_par($kategoria, $checked, $key, $id_kat, $id_parent, $nazwa='id_kat',$class='hierarchia')
{
$res.="";
return $res;
}
function make_tree($kategoria, $key, $nazwa='node',$a=true, $parametry=true,$lev=0)
{
//if($lev==0){$rel=" rel='nodelete'";}
if(isset($kategoria[0][$key])){$rel=" rel='nodelete'";}
//elseif(isset($kategoria[-1][$key])){$rel=" rel='nodelete'";}
else{$rel='';}
$res.="";
if(is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $key2 => $value2)
{
if($key=='1' AND $parametry=true){$params=" noDrag='false' noSiblings='true' noDelete='true' noRename='true' noChildren='false'";}
if($a==true){$res.="$value2 ";}
else{$res.="$value2
";}
if(is_array($kategoria[$key2]))
{
$res.= make_tree($kategoria, $key2, $nazwa, $a, $parametry,$lev+1);
//return $res;
}
$res.=" ";
/* else
{
return $res;
} */
}
}
$res.=" ";
return $res;
}
function make_static_tree($kategoria, $key)
{
$res.="";
if(is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $key2 => $value2)
{
$res.="$value2 ";
if(is_array($kategoria[$key2]))
{
$res.= make_static_tree($kategoria, $key2);
//return $res;
}
$res.=" ";
/* else
{
return $res;
} */
}
}
$res.=" ";
return $res;
}
function make_litree($kategoria, $key, $nr='nr')
{
$res.="";
if(is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $key2 => $value2)
{
$res.="$value2 ";
if(is_array($kategoria[$key2]))
{
$res.= make_litree($kategoria, $key2);
//return $res;
}
$res.=" ";
/* else
{
return $res;
} */
}
}
$res.=" ";
return $res;
}
function litree_level($rodzic,$key,$lev=0)
{
//można zrobić if(!isset($rodzic[$key]))
if($rodzic[$key]!=0){return litree_level($rodzic,$rodzic[$key],($lev+1));}
//if($rodzic[$key]!=0){return litree_level($rodzic,$rodzic[$key],($lev+1));}
else{$res=$lev; return $res;}
}
function litree_parent($kategoria,$key,$lev,$all='all')
{
$par_id=$key;
$res=$key;
if($lev>0)
{
for($p=1;$p<=$lev;$p++)
{
if($all=='all'){$res.=",".$kategoria[$par_id];}
elseif($all=='grand'){$res=$kategoria[$par_id];}
$par_id=$kategoria[$par_id];
}
}
return $res;
}
function litree_child($modules,$kategoria,$key)
{
if($modules[$key]=='' AND is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $mkey => $mval)
{
$i++;
if($i==1){return litree_child($modules,$kategoria,$mkey);}
}
}
else
{
return $key;
}
}
function make_litree2($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$strona='',$clear=false,$lnk='',$zaznacz='',$maxlev='-1',$br=false,$plink=false)
{
//echo"pokaz: $pokaz => lev: $lev ";
/*if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}*/
if($lev==0){$lev0=$key;/* $show="style='display:block;'"; */}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$show="style='display:none;'";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){ $show="style='display:block;'"; $klshow=" aktywne";}
else{$klshow="";}
}
}
if($maxlev!='-1' AND $lev==$maxlev)
{
$show="style='display:none;'";
}
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev].$klshow."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)].$klshow."'";}
}
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
$res.="\n";
foreach($kategoria[$key] as $key2 => $value2)
{
if($br){$value2=str_replace(" "," ",$value2);}
$i++;
$zaznacz_tab = explode(",", $zaznacz);
//print_rf($zaznacz);
if(is_array($zaznacz_tab))
{
//if($key2==$_GET[$id])
if (in_array($key2, $zaznacz_tab))
{
$style="style='/*text-decoration:underline;*/font-weight:bold;/*color:#000;*/'";}else{$style='';}
}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
//$res.="$value2 \n";
//if(is_array($kategoria[$key2]) AND $klshow==" aktywne"){$plus="- ";}
/**************** dodawanie plusika **************************/
//if(is_array($kategoria[$key2])){$plus="+ ";}
//else{$plus='';}
/**************** dodawanie plusika end **********************/
if(isset($lnk[$key2]))
{
$res.="$value2 ".$plus."\n";
}
else
{
if($plink)
{
if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="$value2 ".$plus."\n";
}
else
{
$res.="$value2 ".$plus."\n";
}
}
if(is_array($kategoria[$key2]))
{
$res.= make_litree2($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz,$strona,$clear,$lnk,$zaznacz,$maxlev,$br,$plink);
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=" \n";
if($clear){$res.="
";}
}
return $res;
}
function make_litree2_sm($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$strona='',$clear=false,$lnk='',$zaznacz='',$maxlev='-1',$br=false,$plink=false)
{
//echo"pokaz: $pokaz => lev: $lev ";
/*if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}*/
if($lev==0){$lev0=$key;/* $show="style='display:block;'"; */}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$show="style='display:block;'";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){ $show="style='display:block;'"; $klshow=" aktywne";}
else{$klshow="";}
}
}
if($maxlev!='-1' AND $lev==$maxlev)
{
$show="style='display:block;'";
}
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev].$klshow."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)].$klshow."'";}
}
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
$res.="\n";
foreach($kategoria[$key] as $key2 => $value2)
{
if($br){$value2=str_replace(" "," ",$value2);}
$i++;
$zaznacz_tab = explode(",", $zaznacz);
//print_rf($zaznacz);
if(is_array($zaznacz_tab))
{
//if($key2==$_GET[$id])
if (in_array($key2, $zaznacz_tab))
{
$style="style='/*text-decoration:underline;*/font-weight:bold;/*color:#000;*/'";}else{$style='';}
}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
//$res.="$value2 \n";
//if(is_array($kategoria[$key2]) AND $klshow==" aktywne"){$plus="- ";}
/**************** dodawanie plusika **************************/
//if(is_array($kategoria[$key2])){$plus="+ ";}
//else{$plus='';}
/**************** dodawanie plusika end **********************/
if(isset($lnk[$key2]))
{
$res.="$value2 ".$plus."\n";
}
else
{
if($plink)
{
if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="$value2 ".$plus."\n";
}
else
{
$res.="$value2 ".$plus."\n";
}
}
if(is_array($kategoria[$key2]))
{
$res.= make_litree2_sm($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz,$strona,$clear,$lnk,$zaznacz,$maxlev,$br,$plink);
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=" \n";
if($clear){$res.="
";}
}
return $res;
}
function make_menubar($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='')
{
//echo"$pokaz : $lev, ";
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){/* $show="style='display:block;'"; */}
}
}
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
$i++;
//if($key2==$_GET['nid']){$style="style='text-decoration:underline;'";}else{$style='';}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
if(is_array($kategoria[$key2]))
{
$res.="$value2 \n";
$res.= make_menubar($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz);
}
else
{
$res.="$value2 \n";
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=$po." \n";
}
return $res;
}
function make_menubar2($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$pomin='',$id_ul='',$plink=false,$separator="")
{
//echo"$pokaz : $lev, ";
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";$idul="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){$show="style='display:block;'";}
$hov_class[$pid]='h';
}
}
$pomintab = explode(",", $pomin);
if(is_array($pomintab))
{
foreach($pomintab as $pid)
{
if(isset($kategoria[$key][$pid])){
//echo $pid." => ".$kategoria[$key][$pid];
unset($kategoria[$key][$pid]);
}
}
}
//print_rf($hov_class);
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
//echo"$key2 => $value2 ";
$i++;
//if($key2==$_GET['nid']){$style="style='text-decoration:underline;'";}else{$style='';}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
if(is_array($kategoria[$key2]))
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
else
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
$res.= make_menubar2($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz, $przed='',$po='',$pomin='',$id_ul='',$plink);
}
else
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
else
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=$po." \n";
}
return $res;
}
function print_rf($array) {
echo"";
print_r($array);
echo" ";
return $res;
}
function print_ar($array, $count=0) {
$i=0;
$tab ='';
while($i != $count) {
$i++;
$tab .= " | ";
}
foreach($array as $key=>$value){
if(is_array($value)){
echo $tab."[$key ] ";
$count++;
print_ar($value, $count);
$count--;
}
else{
$tab2 = substr($tab, 0, -12);
echo "$tab2~ $key: $value ";
}
$k++;
}
$count--;
}
function dane_szablonu($param,$key,$rodzic,$modules='')
{
$moduly = explode("|", $param[$key]);
if(is_array($moduly))
{
array_pop($moduly);
foreach($moduly as $mod)
{
$art = explode(":", $mod);
//$mod_list.=" |$art[0]| => |$art[1]| ";
//if($modules['k']=='' AND $art[0]=='k'){$modules['k']=$art[1];}
if($modules[$art[0]]=='' OR ($modules['b']=='0' AND $art[0]=='b') OR ($modules['t']=='0' AND $art[0]=='t')) //to działa
//if($modules[$art[0]]=='' OR ($modules['b']=='0' AND $art[0]=='b') OR ($modules['t']=='0' AND $art[0]=='t' AND $modules['k']==''))// nie pokazuje bg
{$modules[$art[0]]=$art[1];}
//if(isset($art[2]) and trim($art[2])!=''){$values[$art[0]]=$art[2];}
$kolor_tla=$modules['k'];
if($modules['t']!='0'){$obrazek_tla=$modules['t'];}
$powtorz_tlo=$modules['r'];
$baner=$modules['b'];
$buttony=$modules['but'];
}
}
//OR $obrazek_tla=='' OR $powtorz_tlo=='' OR $baner=='' OR $buttony==''
if((!is_array($moduly) OR $modules['k']=='' OR $modules['b']=='' OR $modules['b']=='0' OR $modules['but']=='' OR $modules['but2']=='') AND ($rodzic[$key]!='0'))
{
return dane_szablonu($param,litree_parent($rodzic,$key,1,$all='grand'),$rodzic,$modules);
}
else
{
//$rkat='kategoria: '.$key.' ';
//$res=$rkat."kolor tła: ".$kolor_tla." obrazek tła: ".$obrazek_tla." powtórz tło: ".$powtorz_tlo." baner: ".$baner." buttony: ".$buttony." ";
$res=$modules;
return $res;
}
}
function check_modules($kategoria,$id_kat)
{
$Result=mysql_query("SELECT * FROM gdzie WHERE id_kat='$id_kat' ORDER BY pos");
//$wiersz=mysql_fetch_array($Result);
if(mysql_num_rows($Result)<=0)
{
if(is_array($kategoria[$id_kat]))
{
$t=0;
foreach($kategoria[$id_kat] as $kk => $vv)
{
$t++;
if($t==1)
{
return check_modules($kategoria,$kk);
//return $id_kat=$_GET['kat']=$kk;
}
//echo"$kk ";
}
}
else
{
return $id_kat;
}
}
else
{
return $id_kat;
//return $Result;
}
}
function make_menubar3($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$zew)
{
//echo"$pokaz : $lev, ";
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){/* $show="style='display:block;'"; */}
}
}
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
$i++;
if($_GET[$id]==$key2){$over=" class='over'";}else{$over="";}
//echo $_GET[$id];
//if($key2==$_GET['nid']){$style="style='text-decoration:underline;'";}else{$style='';}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
//echo"$key2 => $value2 => ".$zew[$key2]." ";
//ereg("[\*]*[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9]*[\*]",$value2,$regs);
//$value2=ereg_replace("[\*]*[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ0-9]*[\*]", "".str_replace('*', '', $regs[0])." ", $value2);
$value2=preg_replace("/\*([^\*]+)\*/e", "span('\\1')", $value2);
if(isset($zew[$key2])){$res.="$value2 \n";}
else{$res.="$value2 \n";}
if(is_array($kategoria[$key2]))
{
//$res.="$value2 \n";
$res.= make_menubar3($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz,'','',$zew);
}
else
{
//$res.="$value2 \n";
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=$po." \n";
}
return $res;
}
function span($zaw)
{
return "$zaw ";
}
function js_escape($s) {
return preg_replace_callback('/[\x00-\x1F\x22\x27\x5c]/', '_js_escape', $s);
}
function _js_escape($s){
return sprintf("\x%02X",ord($s[0]));
}
function pokaz_tab_dzieci($kategoria,$key,$wynik=null)
{
if(is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $mkey => $mval)
{
//echo"$mkey => $mval ";
$wynik[]=$mkey;
if(is_array($kategoria[$mkey]))
{
//echo"wszedlem: $mkey ";
$wynik=pokaz_tab_dzieci($kategoria,$mkey,$wynik);
//array_merge ($wynik, $tab);
}
}
}
return $wynik;
}
function zmien_pozycje($table, $id_kat, $pos, $old_pos, $warunek='',$res=false)
{
//np: $warunek='id_parent=1,gdzie>5'
if(trim($warunek)!=''){$warunek = explode(",", $warunek);}
if(is_array($warunek))
{
foreach($warunek as $k => $v)
{
//$tmp_array[]=$k.'='.$v;
$tmp_array[]=$v;
}
$param = " AND ".implode ( " AND ", $tmp_array );
}
if($pos<$old_pos)
{
mysql_query("UPDATE $table SET pos=pos+1 WHERE pos>=$pos AND pos<$old_pos".$param);
}
if($pos>$old_pos)
{
mysql_query("UPDATE $table SET pos=pos-1 WHERE pos>$old_pos AND pos<=$pos".$param);
}
mysql_query("UPDATE $table SET pos=$pos WHERE id=$id_kat");
if($res)
{
$Result = mysql_query("SELECT * FROM $table ORDER BY pos");
return $Result;
}
}
function Odmiana($x,$a,$b,$c) {
if ($x==1) return $a;
elseif (
($x%10>1) && ($x%10<5) &&
!(($x%100>=10) && ($x%100<=21))
) return $b;
return $c;
}
function get_languages( $feature, $spare='' )
{
// get the languages
$a_languages = languages();
$index = '';
$complete = '';
$found = false;// set to default value
//prepare user language array
$user_languages = array();
//check to see if language is set
if ( isset( $_SERVER["HTTP_ACCEPT_LANGUAGE"] ) )
{
$languages = strtolower( $_SERVER["HTTP_ACCEPT_LANGUAGE"] );
// $languages = ' fr-ch;q=0.3, da, en-us;q=0.8, en;q=0.5, fr;q=0.3';
// need to remove spaces from strings to avoid error
$languages = str_replace( ' ', '', $languages );
$languages = explode( ",", $languages );
//$languages = explode( ",", $test);// this is for testing purposes only
foreach ( $languages as $language_list )
{
// pull out the language, place languages into array of full and primary
// string structure:
$temp_array = array();
// slice out the part before ; on first step, the part before - on second, place into array
$temp_array[0] = substr( $language_list, 0, strcspn( $language_list, ';' ) );//full language
$temp_array[1] = substr( $language_list, 0, 2 );// cut out primary language
//place this array into main $user_languages language array
$user_languages[] = $temp_array;
}
//start going through each one
for ( $i = 0; $i < count( $user_languages ); $i++ )
{
foreach ( $a_languages as $index => $complete )
{
if ( $index == $user_languages[$i][0] )
{
// complete language, like english (canada)
$user_languages[$i][2] = $complete;
// extract working language, like english
$user_languages[$i][3] = substr( $complete, 0, strcspn( $complete, ' (' ) );
}
}
}
}
else// if no languages found
{
$user_languages[0] = array( '','','','' ); //return blank array.
}
// print_r($user_languages);
// return parameters
if ( $feature == 'data' )
{
return $user_languages;
}
// this is just a sample, replace target language and file names with your own.
elseif ( $feature == 'header' )
{
switch ( $user_languages[0][1] )// get default primary language, the first one in array that is
{
case 'en':
$location = 'english.php';
$found = true;
break;
case 'sp':
$location = 'spanish.php';
$found = true;
break;
default:
break;
}
if ( $found )
{
header("Location: $location");
}
else// make sure you have a default page to send them to
{
header("Location: default.php");
}
}
}
function languages()
{
// pack abbreviation/language array
// important note: you must have the default language as the last item in each major language, after all the
// en-ca type entries, so en would be last in that case
$a_languages = array(
'af' => 'Afrikaans',
'sq' => 'Albanian',
'ar-dz' => 'Arabic (Algeria)',
'ar-bh' => 'Arabic (Bahrain)',
'ar-eg' => 'Arabic (Egypt)',
'ar-iq' => 'Arabic (Iraq)',
'ar-jo' => 'Arabic (Jordan)',
'ar-kw' => 'Arabic (Kuwait)',
'ar-lb' => 'Arabic (Lebanon)',
'ar-ly' => 'Arabic (libya)',
'ar-ma' => 'Arabic (Morocco)',
'ar-om' => 'Arabic (Oman)',
'ar-qa' => 'Arabic (Qatar)',
'ar-sa' => 'Arabic (Saudi Arabia)',
'ar-sy' => 'Arabic (Syria)',
'ar-tn' => 'Arabic (Tunisia)',
'ar-ae' => 'Arabic (U.A.E.)',
'ar-ye' => 'Arabic (Yemen)',
'ar' => 'Arabic',
'hy' => 'Armenian',
'as' => 'Assamese',
'az' => 'Azeri',
'eu' => 'Basque',
'be' => 'Belarusian',
'bn' => 'Bengali',
'bg' => 'Bulgarian',
'ca' => 'Catalan',
'zh-cn' => 'Chinese (China)',
'zh-hk' => 'Chinese (Hong Kong SAR)',
'zh-mo' => 'Chinese (Macau SAR)',
'zh-sg' => 'Chinese (Singapore)',
'zh-tw' => 'Chinese (Taiwan)',
'zh' => 'Chinese',
'hr' => 'Croatian',
'cs' => 'Czech',
'da' => 'Danish',
'div' => 'Divehi',
'nl-be' => 'Dutch (Belgium)',
'nl' => 'Dutch (Netherlands)',
'en-au' => 'English (Australia)',
'en-bz' => 'English (Belize)',
'en-ca' => 'English (Canada)',
'en-ie' => 'English (Ireland)',
'en-jm' => 'English (Jamaica)',
'en-nz' => 'English (New Zealand)',
'en-ph' => 'English (Philippines)',
'en-za' => 'English (South Africa)',
'en-tt' => 'English (Trinidad)',
'en-gb' => 'English (United Kingdom)',
'en-us' => 'English (United States)',
'en-zw' => 'English (Zimbabwe)',
'en' => 'English',
'us' => 'English (United States)',
'et' => 'Estonian',
'fo' => 'Faeroese',
'fa' => 'Farsi',
'fi' => 'Finnish',
'fr-be' => 'French (Belgium)',
'fr-ca' => 'French (Canada)',
'fr-lu' => 'French (Luxembourg)',
'fr-mc' => 'French (Monaco)',
'fr-ch' => 'French (Switzerland)',
'fr' => 'French (France)',
'mk' => 'FYRO Macedonian',
'gd' => 'Gaelic',
'ka' => 'Georgian',
'de-at' => 'German (Austria)',
'de-li' => 'German (Liechtenstein)',
'de-lu' => 'German (Luxembourg)',
'de-ch' => 'German (Switzerland)',
'de' => 'German (Germany)',
'el' => 'Greek',
'gu' => 'Gujarati',
'he' => 'Hebrew',
'hi' => 'Hindi',
'hu' => 'Hungarian',
'is' => 'Icelandic',
'id' => 'Indonesian',
'it-ch' => 'Italian (Switzerland)',
'it' => 'Italian (Italy)',
'ja' => 'Japanese',
'kn' => 'Kannada',
'kk' => 'Kazakh',
'kok' => 'Konkani',
'ko' => 'Korean',
'kz' => 'Kyrgyz',
'lv' => 'Latvian',
'lt' => 'Lithuanian',
'ms' => 'Malay',
'ml' => 'Malayalam',
'mt' => 'Maltese',
'mr' => 'Marathi',
'mn' => 'Mongolian (Cyrillic)',
'ne' => 'Nepali (India)',
'nb-no' => 'Norwegian (Bokmal)',
'nn-no' => 'Norwegian (Nynorsk)',
'no' => 'Norwegian (Bokmal)',
'or' => 'Oriya',
'pl' => 'Polish',
'pt-br' => 'Portuguese (Brazil)',
'pt' => 'Portuguese (Portugal)',
'pa' => 'Punjabi',
'rm' => 'Rhaeto-Romanic',
'ro-md' => 'Romanian (Moldova)',
'ro' => 'Romanian',
'ru-md' => 'Russian (Moldova)',
'ru' => 'Russian',
'sa' => 'Sanskrit',
'sr' => 'Serbian',
'sk' => 'Slovak',
'ls' => 'Slovenian',
'sb' => 'Sorbian',
'es-ar' => 'Spanish (Argentina)',
'es-bo' => 'Spanish (Bolivia)',
'es-cl' => 'Spanish (Chile)',
'es-co' => 'Spanish (Colombia)',
'es-cr' => 'Spanish (Costa Rica)',
'es-do' => 'Spanish (Dominican Republic)',
'es-ec' => 'Spanish (Ecuador)',
'es-sv' => 'Spanish (El Salvador)',
'es-gt' => 'Spanish (Guatemala)',
'es-hn' => 'Spanish (Honduras)',
'es-mx' => 'Spanish (Mexico)',
'es-ni' => 'Spanish (Nicaragua)',
'es-pa' => 'Spanish (Panama)',
'es-py' => 'Spanish (Paraguay)',
'es-pe' => 'Spanish (Peru)',
'es-pr' => 'Spanish (Puerto Rico)',
'es-us' => 'Spanish (United States)',
'es-uy' => 'Spanish (Uruguay)',
'es-ve' => 'Spanish (Venezuela)',
'es' => 'Spanish (Traditional Sort)',
'sx' => 'Sutu',
'sw' => 'Swahili',
'sv-fi' => 'Swedish (Finland)',
'sv' => 'Swedish',
'syr' => 'Syriac',
'ta' => 'Tamil',
'tt' => 'Tatar',
'te' => 'Telugu',
'th' => 'Thai',
'ts' => 'Tsonga',
'tn' => 'Tswana',
'tr' => 'Turkish',
'uk' => 'Ukrainian',
'ur' => 'Urdu',
'uz' => 'Uzbek',
'vi' => 'Vietnamese',
'xh' => 'Xhosa',
'yi' => 'Yiddish',
'zu' => 'Zulu' );
return $a_languages;
}
function utf8RawUrlDecode ($source) {
$decodedStr = "";
$pos = 0;
$len = strlen ($source);
while ($pos < $len) {
$charAt = substr ($source, $pos, 1);
if ($charAt == '%') {
$pos++;
$charAt = substr ($source, $pos, 1);
if ($charAt == 'u') {
// we got a unicode character
$pos++;
$unicodeHexVal = substr ($source, $pos, 4);
$unicode = hexdec ($unicodeHexVal);
$entity = "". $unicode . ';';
$decodedStr .= utf8_encode ($entity);
$pos += 4;
}
else {
// we have an escaped ascii character
$hexVal = substr ($source, $pos, 2);
$decodedStr .= chr (hexdec ($hexVal));
$pos += 2;
}
} else {
$decodedStr .= $charAt;
$pos++;
}
}
return $decodedStr;
}
function zmien_format_daty($data)
{
$tmp=explode("-",$data);
$res=$tmp[2].".".$tmp[1].".".$tmp[0];
return $res;
}
function make_select_old($kategoria, $key, $id_kat, $id_parent, $nazwa='id_kat',$class='hierarchia',$class_repeat=true)
{
if(is_array($kategoria[$key]) AND $key!=$id_kat)
{
$res.="";
foreach($kategoria[$key] as $key2 => $value2)
{
if($key2==$id_parent){$params='class="red"';}else{$params='';}
if($key2!=$id_kat)
{
$res.="$value2 ";
//if(is_array($kategoria[$key2]) AND $key2!=$id_kat)
//{
if($class_repeat===true){$class=$class;}else{$class='';}
$res.= make_select_old($kategoria, $key2, $id_kat, $id_parent, $nazwa,$class,$class_repeat);
//return $res;
//}
$res.=" ";
}
/* else
{
return $res;
} */
}
$res.=" ";
}
return $res;
}
function usun_kategorie($kategoria, $key, $tabela, $rel, $rel_id)
{
if(is_array($kategoria[$key]))
{
foreach($kategoria[$key] as $key2 => $value2)
{
usun_reckord($tabela, 'id', $key2);
usun_reckord($rel, $rel_id, $key2);
if(is_array($kategoria[$key2]))
{
$res.= usun_kategorie($kategoria, $key2, $tabela, $rel, $rel_id);
}
}
}
return $res;
}
function przenos_spojniki($tekst)
{
$from = array(" i ", " w ", " z ", " lub ", " ale ", " za ", " na ", " do ", " o ", " a "," I ", " W ", " Z ", " Lub ", " Ale ", " Za ", " Na ", " Do ", " O ", " A ");
$to = array(" i ", " w ", " z ", " lub ", " ale ", " za ", " na ", " do ", " o ", " a "," I ", " W ", " Z ", " Lub ", " Ale ", " Za ", " Na ", " Do ", " O ", " A ");
return str_replace ( $from, $to, $tekst );
}
/*
function GenerateSwich($swich)
{
global $url;
$r = 'Strona: ';
if(isset($swich['prev']['link'])) $r .= '
« ';
$iles = count($swich['pages']);
$pl = $nl = $al = array();
$sw = true;
for($i=0;$i<$iles;$i++) {
if($sw && !isset($swich['pages'][$i]['link'])) {
$al[] = '
'.$swich['pages'][$i]['num'].' ';
$sw = false;
}elseif($sw) $pl[] = '
'.$swich['pages'][$i]['num'].' ';
else $nl[] = '
'.$swich['pages'][$i]['num'].' ';
}
$inl = $ipl = 4;
if(count($pl)<5) $ipl += (4 - count($pl));
elseif(count($nl)<5) $inl += (4 - count($nl));
while(count($pl)>$inl) array_shift($pl);
while(count($nl)>$ipl) array_pop($nl);
$r .= implode('',$pl).implode('',$al).implode('',$nl);
if(isset($swich['next']['link'])) $r .= '
» ';
$r .= '
';
return $r;
}
*/
function GenerateSwich($swich)
{
//print_rf($swich);
//global $url;
$r='';
//$r = "';
return $r;
}
function PageSwicher($sw,$ile)
{
global $url;
//$is = ($ile/RECORDSONPAGE);
$is=$ile;
//$ile*=RECORDSONPAGE;
if($is!=(round($is))) $is = ceil($is);
$ret = $pag = Array();
if($sw>0) $ret['prev'] = Array('link'=>$sw);
if($sw<($is-1)) $ret['next'] = Array('link'=>($sw+2));
for($i=0;$i<$is;$i++) {
if($i==$sw) $ret['pages'][count($ret['pages'])] = Array('num'=>($i+1));
else $ret['pages'][count($ret['pages'])] = Array('num'=>($i+1),'link'=>($i+1));
}
$ret['from'] = $sw*RECORDSONPAGE+1;
if((($sw+1)*RECORDSONPAGE)<$ile) $ret['to'] = ($sw+1)*RECORDSONPAGE;
else $ret['to'] = $ile;
return $ret;
}
function pokaz_gety($get,$val,$pomin='',$strict=false)
{
if(trim($pomin!=''))
{
$pomin=explode(",",$pomin);
}
else
{
$pomin=array('');
}
/*if($strict AND trim($get)!='')
{
$get=explode(",",$get);
$val=explode(",",$val);
$res.="?".$get[0]."=".$val[0];
}
else */
if(trim($get)!='')
{
$get=explode(",",$get);
$val=explode(",",$val);
//$res=basename($_SERVER['REQUEST_URI']);
//$res.="?".$get[0]."=".$val[0];
if(trim($val[0])!=''){$res.="?".$get[0]."=".$val[0];}else{$res.="&".$get[0]."=".$_GET[$get[0]];}
foreach($get as $k => $v)
{
if($k>0)
{
if(trim($val[$k])!=''){$res.="&".$get[$k]."=".$val[$k];}elseif(isset($_GET[$get[$k]])){$res.="&".$get[$k]."=".$_GET[$get[$k]];}
}
}
foreach($_GET as $k => $v)
{
//if($k!=$get AND trim($v)!='' AND $k!=$pomin)
//if(!in_array($k, $get) AND trim($v)!='' AND $k!=$pomin)
//echo "------------------------> $k => $v ";
//if((!in_array($k, $get) AND !is_array($v) AND trim($v)!='' AND !in_array($k, $pomin) AND $strict==false) OR (!in_array($k, $get) /*AND trim($v)!=''*/ AND !in_array($k, $pomin) AND $strict==true AND in_array($k, $get)))
if((!in_array($k, $get) AND !in_array($k, $pomin) AND $strict==false) OR (!in_array($k, $get) /*AND trim($v)!=''*/ AND !in_array($k, $pomin) AND $strict==true AND in_array($k, $get)))
{
if(!is_array($v) AND trim($v)!='')
{
$res.="&".$k."=".$v;
}
else if(!empty($v))
{
foreach($v as $k1 => $v1)
{
$res.="&".$k."[".$k1."]=".$v1;
}
}
}
}
}
else
{
$i=0;
//$res=basename($_SERVER['REQUEST_URI']);
foreach($_GET as $k => $v)
{
//if($k!=$get AND trim($v)!='' AND $k!=$pomin)
//if(trim($v)!='' AND $k!=$pomin)
if(!in_array($k, $pomin))
{
if(!is_array($v) AND trim($v)!='')
{
$i++;
if($i==1){$res.="?".$k."=".$v;}
else{$res.="&".$k."=".$v;}
}
else if(!empty($v))
{
foreach($v as $k1 => $v1)
{
$i++;
if($i==1){$res.="?".$k."[".$k1."]=".$v1;}
else{$res.="&".$k."[".$k1."]=".$v1;}
}
}
}
}
}
if($res==''){$res="?";}
return $res;
}
function make_menubar_checkbox($kategoria, $kategoria2, $checked, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$pomin='',$id_ul='',$plink=false)
{
//echo"$pokaz : $lev, ";
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";$idul="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){/* $show="style='display:block;'"; */}
}
}
$pomintab = explode(",", $pomin);
if(is_array($pomintab))
{
foreach($pomintab as $pid)
{
if(isset($kategoria[$key][$pid])){
//echo $pid." => ".$kategoria[$key][$pid];
unset($kategoria[$key][$pid]);
}
}
}
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
//echo"$key2 => $value2 ";
$i++;
//if($key2==$_GET['nid']){$style="style='text-decoration:underline;'";}else{$style='';}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
if(is_array($kategoria[$key2]))
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="$value2 \n";
}
else
{
$res.="$value2 \n";
}
$res.= make_menubar_checkbox($kategoria, $kategoria2, $checked, ($lev+1), $key2, $id, $ulclass, $pokaz, $przed='',$po='',$pomin='',$id_ul='',$plink);
}
else
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
$res.="$value2 \n";
}
else
{
$res.="$value2 \n";
}
}
$res.=make_simple_select_checkbox($kategoria2[$key2], $checked, $nazwa='id_kat',$class='hierarchia');
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=$po." \n";
}
return $res;
}
function show_children($tablica,$key,$typ='string',$lev=0)
{
//$typ: string, lub array
//if($lev==0){$res=$key;}
$res.=$key;
if(is_array($tablica[$key]))
{
foreach($tablica[$key] as $k => $v)
{
$res.=",".show_children($tablica,$k,$typ,($lev+1));
/* if(isset($tablica[$v])){
$res.=show_children($tablica,$k,$typ)
} */
}
}
if($typ=='array'){$res=explode(",",$res);}
return $res;
}
//make_simple_select_checkbox($kategoria, $checked, $nazwa='id_kat',$class='hierarchia')
function pole_select_parent($name, $val, $tablica, $parent, $lev='0', $zerowy='- - -', $style='', $js='', $size=1, $padding=10, $show_id=false)
{
if($show_id){$id=" id='".$show_id."'";}
if($lev==0){$res="\n";}
if($zerowy!=false){$res.="$zerowy \n";}
if(is_array($tablica[$parent]))
{
foreach ($tablica[$parent] as $pol => $wrt)
{
if($val==$pol)
{
$res.="".$wrt." \n";
}
else
{
$res.="".$wrt." \n";
}
if(isset($tablica[$pol])){
$res.=pole_select_parent($name, $val, $tablica, $pol, ($lev+1), false, $style, $js, $size, $padding, $show_id);
}
}
}
if($lev==0){$res.=" \n";}
return $res;
}
/*
function chckbox_radio_li($kategoria, $lev=0, $key, $ulclass='',$rsel='',$chsel='',$rname='radio',$chname='checkbox')
{
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if(is_array($kategoria[$key]))
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n";
}
return $res;
}
*/
function chckbox_radio_li($kategoria, $lev=0, $key, $ulclass='',$rsel='',$chsel='',$rname='radio',$chname='checkbox', $pomin_input=false)
{
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($pomin_input)
{
$pominTab=explode(",",$pomin_input);
}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n";
}
return $res;
}
function komunikat_na_stronie($komunikaty,$tag='h3')
{
if(is_array($komunikaty))
{
foreach($komunikaty as $k => $v)
{
if(is_array($v))
{
foreach($v as $k1 => $v1)
{
echo"<$tag class='$k'>$v1$tag>";
}
}
}
}
}
function create_link($href,$content,$target='',$class='',$id='',$style='',$rel='')
{
$res="$content ";
return $res;
}
function create_href($href,$name,$plink=false)
{
if($plink)
{
if(is_object($plink))
{
$res = $plink -> codeLink($href,$name);
}
else
{
$href=str_replace("&","&",$href);
$href_tab=explode("?",$href);
$href_tab2=explode("&",$href_tab[1]);
if(is_array($href_tab2))
{
foreach($href_tab2 as $k => $v)
{
$get=explode("=",$v);
$res.=$get[0]."-".$get[1].",";
}
}
$res.=make_filename(strip_tags($name));
$res.=".html";
}
}
else
{
$res=$href;
}
return $res;
}
function pola_wg_typu($typ,$name,$value,$wymagany=false,$opcje=false)
{
switch ($typ)
{
case 1:
$tresc=" ";
break;
case 2:
$tresc=" ";
break;
case 3:
$tresc=" ";
break;
case 4:
$tresc="";
break;
case 5:
$tresc=" ";
break;
case 6:
$tresc=" ";
break;
case 0:
default:
$tresc="zły typ pola,lub pole nie istnieje";
break;
}
return $tresc;
}
function pola_wg_typu_strona($typ,$value)
{
switch ($typ)
{
case 1:
$tresc=stripslashes($value);
break;
case 2:
$tresc=stripslashes($value);
break;
case 3:
$tresc=stripslashes($value);
break;
case 4:
$tresc=nl2br(stripslashes($value));
break;
case 5:
$tresc=''.stripslashes($value).' ';
break;
case 6:
$tresc=''.stripslashes($value).' ';
break;
case 0:
default:
$tresc="";
break;
}
return $tresc;
}
function array_non_empty_items($input) {
// If it is an element, then just return it
if (!is_array($input)) {
return $input;
}
$non_empty_items = array();
foreach ($input as $key => $value) {
// Ignore empty cells
if($value) {
// Use recursion to evaluate cells
$non_empty_items[$key] = array_non_empty_items($value);
}
}
// Finally return the array without empty items
return $non_empty_items;
}
function arraytostyle($item, $key)
{
//ob_start();
echo $res = $key." : ".$item.";";
//$res = ob_get_contents();
//ob_end_clean();
//return $res;
}
function combine_array_key_value($array,$sep=":",$end=";")
{
if(is_array($array))
{
foreach($array as $k => $v)
{
$res.=$k.$sep.$v.$end;
}
}
return $res;
}
function create_a($kategorie,$k,$v,$id_kat,$plink,$kat='kat',$params='',$type='a')
{
//$pathinfo = pathinfo($_SERVER['REQUEST_URI']);//$pathinfo['dirname']
$url = parse_url($_SERVER['REQUEST_URI']);
if($kategorie['param'][$k]['lnk_typ']==4 AND trim($kategorie['param'][$k]['lnk'])!='')
{
$href = 'mailto:'.str_replace("mailto:","",$kategorie['param'][$k]['lnk']);
$res = ''.$v.' ';
}
else if($kategorie['param'][$k]['lnk_typ']==3 AND trim($kategorie['param'][$k]['lnk'])!='')
{
$href = 'http://'.str_replace("http://","",$kategorie['param'][$k]['lnk']);
$res = ''.$v.' ';
}
else if($kategorie['param'][$k]['lnk_typ']==2 AND trim($kategorie['param'][$k]['lnk'])!='')
{
$href = create_href($kategorie['param'][$k]['lnk'],$v);
$res = ''.$v.' ';
}
else
{
$href = create_href($url['path']."?blog=blog&".(($_SESSION['lng']!='pl')?'lng='.$_SESSION['lng'].'&':'')."$kat=$k",$v,$plink).'/';
$res = ''.$v.' ';
}
if($type == 'href')
{
return $href;
}
else
{
return $res;
}
}
function make_menuprod($kategoria_prod, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$pomin='',$id_ul='',$plink=false,$separator="",$pomin_kat=false)
{
$kategoria = $kategoria_prod['kategorie_left'];
//echo"$pokaz : $lev, ";
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";$idul="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){$show="style='display:block;'";}
$hov_class[$pid]='h';
}
}
$pomintab = explode(",", $pomin);
if(is_array($pomintab))
{
foreach($pomintab as $pid)
{
if(isset($kategoria[$key][$pid])){
//echo $pid." => ".$kategoria[$key][$pid];
unset($kategoria[$key][$pid]);
}
}
}
//print_rf($hov_class);
//if($key==$pokaz){echo"$pokaz : $lev, ";}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
$value2 = mb_convert_case($value2, MB_CASE_UPPER, "UTF-8");
//echo"$key2 => $value2 ";
$i++;
//if($key2==$_GET['nid']){$style="style='text-decoration:underline;'";}else{$style='';}
//if($i==1){$res.="\n";}
//$res.="$value2 \n";
if(is_array($kategoria[$key2]))
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
//create_a($kategoria,$k,$v,((isset($hov_class[$key2]))?$k:''),$plink,$kat='kat',$params='',$type='a')
//".create_a($kategoria,$key2,$value2,((isset($hov_class[$key2]))?$k:''),$plink,'kp','','a')."
if($pomin_kat)
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
else
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
if($lev==0){$res.=$separator;}
}
else
{
//$res.="$value2 \n";
if($pomin_kat)
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
else
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
if($lev==0){$res.=$separator;}
}
$res.= make_menuprod($kategoria_prod, ($lev+1), $key2, $id, $ulclass, $pokaz, $przed='',$po='',$pomin='',$id_ul='',$plink,'',$pomin_kat);
}
else
{
if($plink)
{
//if(trim($strona)!=''){$katalog=explode(".",$strona);$katalog=$katalog[0]."/";}else{$katalog='';}
//$res.="$value2 \n";
if($pomin_kat)
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
else
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
if($lev==0){$res.=$separator;}
}
else
{
//$res.="$value2 \n";
if($pomin_kat)
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
else
{
$res.="".create_a($kategoria_prod,$key2,$value2,((isset($hov_class[$key2]))?$key2:''),$plink,'kp','','a')."
\n";
}
if($lev==0){$res.=$separator;}
}
}
$res.=" \n";
//if($i==sizeof($kategoria[$key])){$res.=" \n";}
}
$res.=$po." \n";
}
return $res;
}
function make_menu_left($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$pomin='',$id_ul='',$plink=false,$separator="",$param="")
{
//global $id_kat;
//echo"$pokaz : $lev, ";
$id_kat = $_GET['kp'];
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa=" class='".$ulclass[$lev]."'";}
else{$klasa=" class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli=" class='main'";if(trim($id_ul)!=''){$idul=" id='".$id_ul."'";}}
//elseif($key==$pokaz){$show="style='display:block;'";}
else{$showli="";$idul="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){$show=" style='display:block;'";}
$hov_class[$pid]='h';
}
}
$pomintab = explode(",", $pomin);
if(is_array($pomintab))
{
foreach($pomintab as $pid)
{
if(isset($kategoria[$key][$pid])){
//echo $pid." => ".$kategoria[$key][$pid];
unset($kategoria[$key][$pid]);
}
}
}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
$i++;
$res.="";
$v = $value2;
$res.= create_a($kategoria,$key2,$v,$id_kat,$plink,$id);
if($lev==0){$res.=$separator;}
if(is_array($kategoria[$key2]))
{
$res.= make_menu_left($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz, $przed='',$po='',$pomin='',$id_ul='',$plink,$separator,$param);
}
$res.=" ";
}
$res.=$po." ";
}
return $res;
}
function make_menu_kp($kategoria, $lev=0, $key, $id='nid', $ulclass='', $pokaz=1,$przed='',$po='',$pomin='',$id_ul='',$plink=false,$separator="",$only=false)
{
if(is_array($ulclass))
{
if(isset($ulclass[$lev])){$klasa="class='".$ulclass[$lev]."'";}
else{$klasa="class='".$ulclass[(sizeof($ulclass)-1)]."'";}
}
if($lev==0){$lev0=$key;$showli="class='main'";if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}}
else{$showli="";$idul="";}
$pokaztab = explode(",", $pokaz);
if(is_array($pokaztab))
{
foreach($pokaztab as $pid)
{
if($key==$pid){$show="style='display:block;'";}
$hov_class[$pid]='h';
}
}
$pomintab = explode(",", $pomin);
if(is_array($pomintab))
{
foreach($pomintab as $pid)
{
if(isset($kategoria[$key][$pid]))
{
unset($kategoria[$key][$pid]);
}
}
}
if(is_array($kategoria[$key])/* AND $key==$lev0 OR $key==$pokaz */)
{
$i=0;
if(trim($id_ul)!=''){$idul="id='".$id_ul."'";}
$res.="\n".$przed;
foreach($kategoria[$key] as $key2 => $value2)
{
if(!$only OR (is_array($only) AND in_array($key2,$only)))
{
$i++;
if(is_array($kategoria[$key2]))
{
if($plink)
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
else
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
$res.= make_menu_kp($kategoria, ($lev+1), $key2, $id, $ulclass, $pokaz, $przed='',$po='',$pomin='',$id_ul='',$plink,$separator='',$only);
}
else
{
if($plink)
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
else
{
$res.="".przenos_spojniki($value2)." \n";
if($lev==0){$res.=$separator;}
}
}
$res.=" \n";
}
}
$res.=$po." \n";
}
return $res;
}
function CheckPESEL($str)
{
if (!preg_match('/^[0-9]{11}$/',$str)) //sprawdzamy czy ciąg ma 11 cyfr
{
return false;
}
$arrSteps = array(1, 3, 7, 9, 1, 3, 7, 9, 1, 3); // tablica z odpowiednimi wagami
$intSum = 0;
for ($i = 0; $i < 10; $i++)
{
$intSum += $arrSteps[$i] * $str[$i]; //mnożymy każdy ze znaków przez wagć i sumujemy wszystko
}
$int = 10 - $intSum % 10; //obliczamy sumć kontrolną
$intControlNr = ($int == 10)?0:$int;
if ($intControlNr == $str[10]) //sprawdzamy czy taka sama suma kontrolna jest w ciągu
{
return true;
}
return false;
}
function compressPage($buffer) {
$search = array('/\n/','/\>[^\S ]+/s','/[^\S ]+\','<','\\1');
return preg_replace($search, $replace, $buffer);
}
function cena_wysylki($typ_wysylki)
{
$wartosc_koszyka = $_SESSION['koszyk']['wartosc'];
if(is_array($_SESSION['typ_wysylki']['zakres_cena'][$typ_wysylki]))
{
ksort($_SESSION['typ_wysylki']['zakres_cena'][$typ_wysylki]);
foreach($_SESSION['typ_wysylki']['zakres_cena'][$typ_wysylki] as $k => $v)
{
if($wartosc_koszyka >= (float)$k)
{
$res = (float)$v;
}
else
{
break;
}
}
}
else
{
$res = (int)$_SESSION['typ_wysylki']['zakres_cena_tab'][$typ_wysylki][0];
}
return $res;
}
function remove_accent($str)
{
$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ');
$b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o');
return str_replace($a, $b, $str);
}
?>
/* require_once("class/class.xmltoarray.php");
$filename="config.xml";
$xml_data = implode("", file($filename));
$xmlObj = new XmlToArray($xml_data);
$config = $xmlObj->createArray();
print_rf($config); */
?>