OSDN Git Service

Small update
[idb/iDB-Extras.git.git] / vercheck / index.php
index b0e4100..af0eeeb 100644 (file)
@@ -8,8 +8,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     Revised BSD License for more details.
 
-    Copyright 2009-2011 iDB Support - http://idb.berlios.de/
-    Copyright 2009-2011 Game Maker 2k - http://gamemaker2k.org/
+    Copyright 2009-2014 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
+    Copyright 2009-2014 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
 
     $FileInfo: index.php - Last Update: 07/18/2014 Ver 3.1.2 - Author: cooldude2k $
 */
@@ -44,7 +44,7 @@ $site_url = "http://localhost/vercheck/";
 $agent_site_url = $site_url."?act=vercheck";
 $site_name = "iDB Version checker";
 $appname = "iDB VerCheck";
-$download_url = $site_url."download.php";
+$download_url = "https://github.com/GameMaker2k/iDB/releases/latest";
 $site_version = "3.1.2";
 $ver_exp = explode(".",$site_version);
 if(!isset($ver_exp[3])) { $ver_exp[3] = null; }
@@ -213,11 +213,9 @@ if(!isset($_GET['name'])&&!isset($_GET['bid'])) {
 <meta name="distribution" content="global">
 <link rel="icon" href="favicon.ico" type="image/icon">
 <link rel="shortcut icon" href="favicon.ico" type="image/icon">
-<!-- Katarzyna O_o -->
 </head>
 
 <body>
-<!-- Renee Sabonis ^_^ -->
 <form method="get" action="?act=vercheck&amp;vercheck=newtype&amp;encoded=false">
 <div>
 <input type="hidden" id="act" name="act" value="vercheck" />
@@ -229,8 +227,7 @@ if(!isset($_GET['name'])&&!isset($_GET['bid'])) {
 </div>
 </form>
 
-<div class="copyright"><br />Powered by <a href="http://idb.berlios.de/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://idb.berlios.de/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
-<!-- Stephanie Braun o_O -->
+<div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
 </body>
 </html>
 <?php exit(); } }
@@ -325,7 +322,7 @@ if(isset($_GET['bid'])) {
        $prequote2 = preg_quote("\" />", '/');
        preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum); }
        if(!isset($GetVerNum[1][0])) { 
-       $prequote1 = preg_quote("<a href=\"http://idb.berlios.de/\" title=\"", '/');
+       $prequote1 = preg_quote("<a href=\"http://ja.gamemaker2k.org/\" title=\"", '/');
        $prequote2 = preg_quote("\" onclick=\"window.open(this.href);return false;\">", '/');
        preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum); }
        if(!isset($GetVerNum[1][0])) { $GetVerNum[1][0] = null; }
@@ -423,14 +420,14 @@ function html_tag_make($name="br",$emptytag=true,$attbvar=null,$attbval=null,$ex
        return $mytag; }
 // Start a xml document
 function xml_tag_make($type,$attbs,$retval=false) {
-       $renee1 = explode("&",$attbs);
-       $reneenum=count($renee1);
-       $reneei=0; $attblist = null;
-       while ($reneei < $reneenum) {
-       $renee2 = explode("=",$renee1[$reneei]);
-       if($renee2[0]!=null||$renee2[1]!=null) {
-       $attblist = $attblist.' '.$renee2[0].'="'.$renee2[1].'"'; }
-       ++$reneei; }
+       $melanie1 = explode("&",$attbs);
+       $melanienum=count($melanie1);
+       $melaniei=0; $attblist = null;
+       while ($melaniei < $melanienum) {
+       $melanie2 = explode("=",$melanie1[$melaniei]);
+       if($melanie2[0]!=null||$melanie2[1]!=null) {
+       $attblist = $attblist.' '.$melanie2[0].'="'.$melanie2[1].'"'; }
+       ++$melaniei; }
        if($retval!==false&&$retval!==true) { $retval=false; }
        if($retval===false) {
        echo '<?'.$type.$attblist.'?>'."\n"; }
@@ -470,25 +467,23 @@ if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
 <meta name="distribution" content="global">
 <link rel="icon" href="favicon.ico" type="image/icon">
 <link rel="shortcut icon" href="favicon.ico" type="image/icon">
-<!-- Katarzyna O_o -->
 </head>
 
 <body>
-<!-- Renee Sabonis ^_^ -->
 <?php }
 if(!isset($_GET['act'])) { $_GET['act'] = null; }
 if(!isset($_GET['redirect'])) { $_GET['redirect'] = null; }
 if(isset($_GET['act'])&&$_GET['act']=="update") {
 if (function_exists("stream_context_create")) {
     if($get_content_by=="file_get_contents") {
-       $GetNewVersion = file_get_contents("http://sourceforge.jp/projects/idb/releases/",false,$context); }
+       $GetNewVersion = file_get_contents("https://github.com/GameMaker2k/iDB/releases/latest",false,$context); }
 } else {
     if($get_content_by=="file_get_contents") {
-       $GetNewVersion = file_get_contents("http://sourceforge.jp/projects/idb/releases/"); }
+       $GetNewVersion = file_get_contents("https://github.com/GameMaker2k/iDB/releases/latest"); }
 }
 if($get_content_by=="curl") {
    $ch = curl_init(); 
-   curl_setopt($ch, CURLOPT_URL, "http://sourceforge.jp/projects/idb/releases/");
+   curl_setopt($ch, CURLOPT_URL, "https://github.com/GameMaker2k/iDB/releases/latest");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
                                               "User-Agent: ".$site_useragent,
                                               "Accept: */*",
@@ -503,20 +498,28 @@ if($get_content_by=="curl") {
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
+   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $GetNewVersion = curl_exec($ch);
    curl_close($ch); }
-preg_match_all("/([0-9])\.([0-9])\.([0-9]) ([A-Za-z]+) SVN ([0-9]+)/is", $GetNewVersion, $NewVersionPart);
-$NewSVNPart = $NewVersionPart[5][0];
+$verstart = preg_quote("<a href=\"/GameMaker2k/iDB/commit/", "/");
+$verend = preg_quote("\" class=\"muted-link\">", "/");
+preg_match_all("/".$verstart."([0-9a-zA-Z]+)".$verend."/is", $GetNewVersion, $NewVersionPart);
+$verstartnex = preg_quote("<a href=\"/GameMaker2k/iDB/releases/tag/", "/");
+$vermidnex = preg_quote("\">iDB ", "/");
+$verendnex = preg_quote("</a>", "/");
+preg_match_all("/".$verstartnex."([0-9]+)\.([0-9]+)\.([0-9]+)".$vermidnex."([0-9]+)\.([0-9]+)\.([0-9]+)".$verendnex."/is", $GetNewVersion, $NewFullVersionPart);
+$NewSVNPart = "https://raw.githubusercontent.com/GameMaker2k/iDB/".$NewVersionPart[1][0]."/inc/versioninfo.php";
 if (function_exists("stream_context_create")) {
     if($get_content_by=="file_get_contents") {
-       $GetSVNVersion = file_get_contents("http://sourceforge.net/p/intdb/svn/".$NewSVNPart."/tree/trunk/inc/versioninfo.php?format=raw",false,$context); }
+       $GetSVNVersion = file_get_contents($NewSVNPart,false,$context); }
 } else {
     if($get_content_by=="file_get_contents") {
-       $GetSVNVersion = file_get_contents("http://sourceforge.net/p/intdb/svn/".$NewSVNPart."/tree/trunk/inc/versioninfo.php?format=raw"); }
+       $GetSVNVersion = file_get_contents($NewSVNPart); }
 } 
 if($get_content_by=="curl") {
    $ch = curl_init(); 
-   curl_setopt($ch, CURLOPT_URL, "http://sourceforge.net/p/intdb/svn/".$NewSVNPart."/tree/trunk/inc/versioninfo.php?format=raw");
+   curl_setopt($ch, CURLOPT_URL, $NewSVNPart);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
                                               "User-Agent: ".$site_useragent,
                                               "Accept: */*",
@@ -526,14 +529,20 @@ if($get_content_by=="curl") {
                                               "Via: ".$_SERVER['REMOTE_ADDR'],
                                               "Forwarded: ".$_SERVER['REMOTE_ADDR'],
                                               "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
-                                             "Client-IP: ".$_SERVER['REMOTE_ADDR']));
+                                              "Client-IP: ".$_SERVER['REMOTE_ADDR']));
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
-   $GetNewVersion = curl_exec($ch);
+   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+   curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+   $GetSVNVersion = curl_exec($ch);
    curl_close($ch); }
-$newver['subver'] = $NewSVNPart;
+$prepreg1 = preg_quote("\$SubVerN = ","/"); 
+$prepreg2 = preg_quote(";","/");
+preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVerSubType);
+$newver['subver'] = $GetVerSubType[1][0];
+//$newver['subver'] = $NewFullVersionPart[1][0].".".$NewFullVersionPart[2][0].".".$NewFullVersionPart[3][0];
 $prepreg1 = preg_quote("\$VER1[0] = ","/"); 
 $prepreg2 = preg_quote(";","/");
 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVer0);
@@ -610,8 +619,7 @@ if(!isset($_GET['name'])||!isset($_GET['reltype'])||!isset($_GET['ver'])||
        !isset($_GET['subtype'])||!isset($_GET['subver'])) {
        echo "Sorry need more info to check version."; ?>
 
-<div class="copyright"><br />Powered by <a href="http://idb.berlios.de/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://idb.berlios.de/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
-<!-- Stephanie Braun o_O -->
+<div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
 </body>
 </html>
 <?php exit(); } }
@@ -622,7 +630,7 @@ if(!isset($_GET['name'])||!isset($_GET['reltype'])||!isset($_GET['ver'])||
 if(count($NamePart)==1) { $_GET['name'] = $NamePart[0]; }
 if(!in_array($_GET['name'],$iDBArray)) { echo "Sorry cound not find ".$_GET['name']."."; ?>
 
-<div class="copyright"><br />Powered by <a href="http://idb.berlios.de/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://idb.berlios.de/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
+<div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
 </body>
 </html>
 <?php exit(); }
@@ -819,7 +827,7 @@ if($_GET['bid']!==null) {
 $VersionJS .= "var checkingsite = 'Checking board: <a href=\"".$_GET['bid']."\" title=\"".$GetTitle."\">".$GetTitle."<\/a><br />';\n"; }
 if($_GET['bid']===null) {
 $VersionJS .= "var checkingsite = '';\n"; }
-$VersionJS .= "var copyright = '<br \/>Powered by <a href=\"http://idb.berlios.de/\" title=\"iDB-VerCheck ".$site_version."\" onclick=\"window.open(this.href);return false;\">iDB VerCheck</a> &#169; <a href=\"http://idb.berlios.de/support/category.php?act=view&amp;id=2\" title=\"Game Maker 2k\" onclick=\"window.open(this.href);return false;\">Game Maker 2k<\/a> @ ".$csryear." - ".$cryear."';\n";
+$VersionJS .= "var copyright = '<br \/>Powered by <a href=\"http://ja.gamemaker2k.org/\" title=\"iDB-VerCheck ".$site_version."\" onclick=\"window.open(this.href);return false;\">iDB VerCheck</a> &#169; <a href=\"http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2\" title=\"Game Maker 2k\" onclick=\"window.open(this.href);return false;\">Game Maker 2k<\/a> @ ".$csryear." - ".$cryear."';\n";
 if($FullRelNum<$MyFullRelNum) {
 $VersionJS .= "document.getElementById('iverinfo').innerHTML = vercheckinfo+'<img src=\"".$site_url."inc/pics/old.png\" alt=\"You seem to be using a old version.\" title=\"You seem to be using a old version.\" />&#160;Warning: A new version is available. <a href=\"".$download_url."\">Click Here<\/a><br />'+ourverinfo+checkingsite+'<br />';"; }
 if($FullRelNum==$MyFullRelNum) {
@@ -850,8 +858,7 @@ echo "</div>"; } }
 if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
 ?>
 
-<div class="copyright"><br />Powered by <a href="http://idb.berlios.de/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://idb.berlios.de/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
-<!-- Stephanie Braun o_O -->
+<div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
 </body>
 </html>
 <?php } ?>