$value) $return[$key] = object2array($value); } else { $var = get_object_vars($object); if($var) { foreach($var as $key => $value) $return[$key] = object2array($value); } else return strval($object); // strval and everything is fine } return $return; } function getid($url){ $movieid=explode('/',$url); $movieid=$movieid[count($movieid)-1]; return $movieid; }; function striper($cos){ return str_replace('\'','',$cos); } $category[0]='All'; $category[2]='Autos&Vehicles'; $category[23]='Comedy'; $category[27]='Education'; $category[24]='Entertainment'; $category[1]='Film&Animation'; $category[26]='Howto&Style'; $category[10]='Music'; $category[25]='News&Politics'; $category[22]='People&Blogs'; $category[28]='Science&Technology'; $category[17]='Sports'; $category[19]='Travel&Events'; $category[15]='Pets&Animals'; foreach($category as $key=>$value){ $linki_naglowek .= " \"".$value."\" "; }; /***************************************************/ //$database="baza957_MICRO"; //$mysql_user = "admin957_MICRO"; $database="martvin_movies"; $mysql_user = "root"; //$mysql_password = "micromail"; $mysql_password = "euro.2006"; //$mysql_host = "957.m.tld.pl"; $mysql_host = "localhost"; //"212.160.133.140"; $mysql_table_prefix = ""; //admin957_MICRO micromail baza957_MICRO $success = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die('database overload - come back later'); $success = mysql_select_db ($database); mysql_query("SET NAMES 'utf8'"); /**************************************************/ function simplexml_load_local_file($url,$nazwa='',$czas_zycia='259200'){ $rt = simplexml_load_sql_string($url,$nazwa,$czas_zycia); if($rt){ return $rt; } /* if($nazwa==''){ $zm = crc32($url).'.xml'; }else{ $zm = $nazwa.'.xml'; } if(file_exists('xml/'.$zm)){ if( filemtime('xml/'.$zm) > (time()-$czas_zycia) ){ return @simplexml_load_file('xml/'.$zm,null, LIBXML_NOCDATA); }else{ $plik = file_get_contents($url); if($plik){ file_put_contents('xml/'.$zm,$plik); } } }else{ $plik = file_get_contents($url); if($plik){ file_put_contents('xml/'.$zm,$plik); } } return @simplexml_load_file('xml/'.$zm,null, LIBXML_NOCDATA); */ } function simplexml_load_sql_string($url,$nazwa='',$czas_zycia='2592000'){ global $config; if($nazwa==''){ $zm = crc32($url); $katalog='simply-cache'; $nazwa = addslashes($url); }else{ $kat = explode('-',$nazwa); $katalog=$kat[0]; //$zm = crc32($nazwa); $zm = crc32($url); $nazwa = addslashes($nazwa); } $czas_ak = time(); $sel = "SELECT * FROM cache_movies WHERE id='$zm' "; //id xml data katalog $q = mysql_query($sel); if(mysql_num_rows($q)>'0') { $sql = mysql_fetch_array($q); if($sql['data'] > ($czas_ak-$czas_zycia)){ mysql_query("UPDATE cache_movies SET click=(click+1) WHERE id='$zm' "); return @simplexml_load_string(stripslashes(decompres($sql['xml'])),null, LIBXML_NOCDATA); }else{ $plik = compres(addslashes(file_get_contents($url))); if($plik){ mysql_query("REPLACE INTO cache_movies SET id='$zm', xml='$plik', data = '$czas_ak', katalog = '$nazwa', click = (click+1) "); } return @simplexml_load_string(stripslashes(decompres($plik)),null, LIBXML_NOCDATA); } }else{ //echo "fresh"; $plik = compres(addslashes(file_get_contents($url))); if($plik){ mysql_query("REPLACE INTO cache_movies SET id='$zm', xml='$plik', data = '$czas_ak', katalog = '$nazwa' , click = '1' "); } return @simplexml_load_string(stripslashes(decompres($plik)),null, LIBXML_NOCDATA); } } function compres($co){ $ttt = gzcompress($co,9); $co = base64_encode($ttt); return $co; } function decompres($co){ $ttt = base64_decode($co); $co = gzuncompress($ttt); return $co; } include 'template.php'; include 'BPArticles.php'; ?>