connection error!
"; return;} $age=reset($plugins['all']); $version=key($plugins['all']); echo __('using revision')." $version (".bb_since($age)." ".__('old').") "; ?>
| Plugin |
Author |
Status |
Version (installed) |
Version (newest) |
$data) {
if ($status=='all' || empty($data) || !is_array($data)) {continue;}
uksort($data, 'strnatcasecmp');
if ($status=="active") {$class="active";}
elseif ($status=="autoload") {$class="autoload";}
else {$class="";} // inactive
foreach ( $data as $p => $plugin ) {
$thisclass=$class;
$filename=basename($p);
if (isset($plugins['all'][$filename])) {
$version=$plugins['all'][$filename];
if ($plugin['version']!=$version) {$thisclass="new";}
} else {$version=__("unknown");}
?>
>
|
|
|
|
'.$version; ?> |
| Total Plugins: | Authors: | [Donate] |
$plugin_name" : $plugin_name;
$author_link = ($author_name && $author_uri) ? "$author_name" : $author_name;
return array(
'name' => $plugin_name,
'uri' => $plugin_uri,
'description' => $description,
'author' => $author_name,
'author_uri' => $author_uri,
'requires' => $requires,
'tested' => $tested,
'version' => $version,
'plugin_link' => $plugin_link,
'author_link' => $author_link
);
}
function check_for_updates_pluginslist() {
global $plugins;
$plugins['current'] = (array) str_replace("user#","",bb_get_option( 'active_plugins' ));
$plugins['current'] = array_flip($plugins['current']); // speed up by key
if ( defined( 'BB_PLUGIN_DIR' ) ) {$bbplugindir=BB_PLUGIN_DIR;} elseif (defined('BBPLUGINDIR' ) ) {$bbplugindir=BBPLUGINDIR;}
if (empty($bbplugindir) || !file_exists($bbplugindir)) {$bbplugindir=BB_PATH . 'bb-plugins/';} // they are using bb-plugins instead of my-plugins
if (defined('BACKPRESS_PATH')) {require_once( BB_PATH . BB_INC . 'class.bb-dir-map.php' );}
$dir = new BB_Dir_Map( $bbplugindir, array('recurse' => 1,
'callback' => create_function('$f,$_f', '
if (".php" == substr($_f,-4) && $result=check_for_updates_plugin_details($f)) {
global $plugins;
if ("_" == substr($_f, 0, 1)) {$key="autoload";}
elseif (isset($plugins["current"][$_f])) {$key="active";}
else {$key="inactive";}
$plugins[$key][$_f]=$result;
}
')));
$dir->get_results();
unset($plugins['current']);
}
function check_for_updates_masterlist() {
// fetch master list - todo: mirrors, error checking, timeout
$url="http://plugins-svn.bbpress.org/check-for-updates/trunk/plugin-list.txt.gz";
// $url="http://bbshowcase.org/forums/my-plugins/check-for-updates/plugin-list.txt.gz";
if (function_exists('curl_exec')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER , 1);
$data = curl_exec($ch); curl_close($ch);
} else {
$url=parse_url($url);
$data=check_for_updates_fsockfetch($url['host'],80,$url['path']);
$data=$data['data'];
}
$data=gzinflate(substr($data,10));
$lines=explode("\n",$data);
unset($data);
global $plugins;
foreach ($lines as $line) {$line=trim($line); if (!empty($line)) {list($key,$version)=explode("|",$line,2); $plugins['all'][$key]=trim($version);}}
unset($lines);
}
function check_for_updates_direct($url) {
$url=parse_url($url);
$url['port']=isset($url['port']) ? $url['port'] : 80;
$result=check_for_updates_fsockfetch($url['host'],$url['port'],$url['path']);
if (!empty($result['redirect'])) {
if (strtolower(substr($result['redirect'],0,7))=='http://') {$url=parse_url($result['redirect']); $url['port']=isset($url['port']) ? $url['port'] : 80;}
else {$url['path']=$result['redirect'];}
$result=check_for_updates_fsockfetch($url['host'],$url['port'],$url['path']); // we only try to redirect once for safety + speed
}
if (!empty($result['data']) && preg_match("|\.+?\\((.+?)\)\<\/small\>\<\/h2\>|i", $result['data'], $version)) {return trim($version[1]);}
else {return __("error");}
}
function check_for_updates_fsockfetch($addr="127.0.0.1", $port="80", $path="/", $user="", $pass="", $timeout="10",$agent="Mozilla/4.0 (bbPress Check for Updates)") {
$handle = fsockopen($addr, $port, $errno, $errstr, $timeout);
if (!$handle) {
$result['code']=0;
$result['response']="$errno $errstr";
$result['headers']="";
$result['data']="";
return $result;
}
socket_set_blocking($handle, 1);
socket_set_timeout($handle, $timeout);
if ($path) {$urlString = "GET $path HTTP/1.1\r\nHost: $addr\r\nUser-Agent: $agent\r\nConnection: close\r\n";}
if ($user) {$urlString .= "Authorization: Basic ".base64_encode("$user:$pass")."\r\n";}
$urlString .= "\r\n";
fputs($handle, $urlString,strlen($urlString));
$result['response']= fgets($handle);
$result['code']=substr($result['response'],9,3);
$result['headers']="";
$result['data']="";
if (in_array($result['code'],array("200","301","302","401"))) { // Check the status of the link
$endHeader = false; // Strip initial header information
while ( !$endHeader && !feof($handle)) {
$test=fgets($handle);
if (strpos(strtolower($test),"location:")!==false) {$result['redirect']=trim(preg_replace("/location:/i","",$test));}
if ($test== "\r\n") { $endHeader = true; } else {$result['headers'].=$test;}
}
$result['data'] = ""; while ($data=fread($handle,8192)) {$result['data'].=$data;} // if (strlen($result['data'])>=8192) {break;}}
}
fclose($handle);
return $result;
}
function check_for_updates_header() {
?>