=========================== */ ?> =')) { $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $path); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); if (is_string($file_contents)) { return $file_contents; } else { return false; } } else { $data = parse_url($path); if (!$data['host'] || $data['scheme'] != "http") { return false; } $f = @fsockopen($data['host'], ($data['port']) ? $data['port'] : 80, $e1, $e2, 3); if (!$f) { return false; } $q = "GET " . $data['path'] . (isset($data['query'])?'?'.$data['query']:'') . " HTTP/1.1\r\n"; $q .= "Host: " . $data['host'] . "\r\n"; $q .= "Connection: close\r\n"; $q .= "Referer: http://www.gelatocms.com/\r\n\r\n"; $recv = ""; fwrite($f, $q); while (!feof($f)) { $recv .= fread($f, 1024); } $request = $q; $response = substr($recv, 0, strpos($recv, "\r\n\r\n")); $body = substr($recv, strpos($recv, "\r\n\r\n") + 4); if (preg_match('/http\/1\\.[0|1] ([0-9]{3})/i', $response, $res)) { if ($res[1][0] != "2") { return false; } } else { return false; } if (preg_match('/transfer-encoding:\s*chunked/i', $response)) { $tmp_body = $body; $new = ""; $exit = false; while (!$exit) { if (preg_match('/^([0-9a-f]+).*?\r\n/i', $tmp_body, $res)) { $len = hexdec($res[1]); if ($len == "0") { $exit = true; break; } $new .= substr($tmp_body, strlen($res[0]), $len); $tmp_body = substr($tmp_body, strlen($res[0]) + $len + strlen("\r\n")); } else { $exit = true; } } $body = $new; } return $body; } } } function get_curl_version() { $curl = 0; if (is_array(curl_version())) { $curl = curl_version(); $curl = $curl['version']; } else { $curl = curl_version(); $curl = explode(' ', $curl); $curl = explode('/', $curl[0]); $curl = $curl[1]; } return $curl; } function transform_offset($offset){ $sp = strpos($offset , ".")? explode("." , $offset) : false; if(is_array($sp)){ $minutes = strval($sp[1]); $off_h = $sp[0]*3600; $off_m = (($minutes*60)/100)*60; $off = $off_h+$off_m; } else { $off = ($offset*3600); } return $off; } function getLangs() { $langs_dir = "languages"; $dirs = array(); $path = getcwd(); $dir = (substr(PHP_OS, 0, 3) == 'WIN') ? $path."\\".$langs_dir : $path."/".$langs_dir; $dir = str_replace("admin\\", "", $dir); $dir = str_replace("admin/", "", $dir); $i=0; $cls_lang_dir = @ dir($dir); while (($directory = $cls_lang_dir->read()) !== false) { if($directory != "." && $directory != "..") { $dir2 = (substr(PHP_OS, 0, 3) == 'WIN') ? $path."\\".$langs_dir."\\".$directory : $path."/".$langs_dir."/".$directory; $dir2 = str_replace("admin\\", "", $dir2); $dir2 = str_replace("admin/", "", $dir2); if(is_dir($dir2)){ $cls_lang_dir2 = @ dir($dir2); while (($directory2 = $cls_lang_dir2->read()) !== false) { if($directory2 != "." && $directory2 != "..") { if (preg_match('|^\.+$|', $directory2)){ continue; } if (preg_match('|\.mo$|', $directory2)){ if(!in_array($directory2,$dirs)){ $dirs[$directory]=util::displayLanguage(trim($directory)); $i++; } } } } } } } $dirs = array_unique($dirs); return $dirs; } function removeBadTags($source,$secure=false) { if($secure){ $validTags ='
'; } else { $validTags ='