catID = $catID; $this->pluginFile = $pluginFile; $this->pluginName = $pluginName; $this->pluginID = substr($pluginFile,0,-4); } } class PluginVersionInfo { var $minAZVersion; var $version; var $dl_link; var $src_link; var $comments; function PluginVersionInfo($minAZVersion, $version, $dl_link, $src_link, $comments = "") { $this->minAZVersion = $minAZVersion; $this->version = $version; $this->dl_link = $dl_link; $this->src_link = $src_link; $this->comments = $comments; } function hasData() { return !empty($this->minAZVersion) || !empty($this->version) || !empty($this->dl_link) || !empty($this->src_link) || !empty($this->comments); } } function getPluginCats() { return array( array( "Uncategorized", "uncategorized" ), array( "Core", "core" ), array( "Automation", "automation" ), array( "Social", "social" ), array( "More Info & User-friendliness", "info" ), array( "Remote Access", "remote" ), array( "Networks", "networks" ), array( "Games", "games" ), array( "Developer Samples", "samples" ), array( "Research", "research" ), array( "Deprecated", "dead" ), ); } function getPluginCatByValue($value) { $cats = getPluginCats(); foreach ($cats as $cat) { if( $cat[1] == $value ) return $cat; } } /* * RSS Parser * Returns $info_array[name of the plugin][nb seeders, nb leechers] */ function createRSSArray() { // $xml_path = "http://aelitis.com:7979/"; $xml_path = "rss/"; $xml_filename = "rss_feed.xml"; // include lastRSS library include_once 'rss/lastRSS.php'; // create lastRSS object $rss = new lastRSS; // setup transparent cache $rss->cache_dir = 'rss/cache'; $rss->cache_time = 3600; // one hour // load some RSS file if ($data = $rss->get($_SERVER['DOCUMENT_ROOT'].$xml_path.$xml_filename)) { // here we can work with RSS fields if (count($data['items']) > 0) { foreach ($data['items'] as $rss_data) { if (@strtolower($rss_data['category']) == "plugins2") { $t_name = $rss_data['title']; $info_array[$t_name]['title'] = $t_name; $info_array[$t_name]['seeders'] = $rss_data['azureus:torrent_seeders']; $info_array[$t_name]['leechers'] = $rss_data['azureus:torrent_leechers']; $info_array[$t_name]['completed'] = $rss_data['azureus:torrent_completed']; $info_array[$t_name]['link'] = $rss_data['link']; } } } } else { //die ('Error: RSS file not found...'); $info_array = "no"; } return @$info_array; } /** * compare two version strings of form n.n.n.n (e.g. 1.2.3.4) * @param version_1 * @param version_2 * @return < 0 = AZ Lower, 0 = same, > 0 = AZ higher */ function compareVersion($version) { global $AZVersion; if ($AZVersion == "") return 0; // CVS is bleeding edge, more recent than any _Bnn versions. _B99 is max so treat as _B99 for compare // I'd prefer to use B100 but the crappy code below doesn't actually work... someone should fix this sometime $version1 = str_replace( "_CVS", "_B99", $AZVersion ); $version2 = str_replace( "_CVS", "_B99", $version ); $version1 = preg_replace("[^0-9.]", ".", $version1); $version2 = preg_replace("[^0-9.]", ".", $version2); for ($j=0;$jcatID - $b->catID; if ($cmp == 0) $cmp = strcmp(strtolower($a->pluginName), strtolower($b->pluginName)); return $cmp; } function createPluginArrayByCat($full_array, $catNo) { $list_array_by_cat = array(); for ($i=0; $i < count($full_array); $i++ ) { if ($catNo == $full_array[$i]->catID) { array_push($list_array_by_cat, $full_array[$i]); } } return $list_array_by_cat; } function fillDetailVarsFromArrayNoCVS($versions) { fillDetailVarsFromArray($versions, new PluginVersionInfo("", "", "", "")); } function fillDetailVarsFromArray($versions, $cvsVersionInfo) { global $min_az_version_cvs; global $version_cvs; global $dl_link_cvs; global $src_link_cvs; global $version; global $dl_link; global $src_link; global $comment; global $versions_live_index; $size = count($versions); if (is_object($cvsVersionInfo)) { $min_az_version_cvs = $cvsVersionInfo->minAZVersion; $version_cvs = $cvsVersionInfo->version; $dl_link_cvs = $cvsVersionInfo->dl_link; $src_link_cvs = $cvsVersionInfo->src_link; $version = ""; $comment = (compareVersion($cvsVersionInfo->minAZVersion) >= 0 && $cvsVersionInfo->comments != "") ? $cvsVersionInfo->comments."
" : ""; } for ($i = 0; $i < $size; $i++) { $versionInfo = $versions[$i]; $compare = compareVersion($versionInfo->minAZVersion); if ($version == "" && $compare >= 0) { $version=$versionInfo->version; $dl_link=$versionInfo->dl_link; $src_link=$versionInfo->src_link; $versions_live_index=$i; } if ($compare >= 0 && $versionInfo->comments != "") $comment = $comment . $versionInfo->comments . "
"; } } function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; $cpos = strpos( $ip, ',' ); if ( $cpos !== false ){ $ip = substr( $ip,0,$cpos); } } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } ?>