OSDN Git Service

Small update to hash system and install system.
authorKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Tue, 13 Apr 2010 00:47:34 +0000 (00:47 +0000)
committerKazuki Przyborowski <kazuki.przyborowski@gmail.com>
Tue, 13 Apr 2010 00:47:34 +0000 (00:47 +0000)
git-svn-id: svn://svn.code.sf.net/p/intdb/svn/trunk@466 2b68903e-0b30-0410-9a39-a2e4f3c5be39

inc/function.php
inc/misc/functions.php
inc/versioninfo.php
settings.php [deleted file]
settingsbak.php [deleted file]
setup/setup.php
sql.php

index 86d2244..06a684a 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: function.php - Last Update: 03/18/2010 SVN 459 - Author: cooldude2k $
+    $FileInfo: function.php - Last Update: 04/12/2010 SVN 466 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="function.php"||$File3Name=="/function.php") {
@@ -73,13 +73,27 @@ function output_error($message, $level=E_USER_ERROR) {
   function uuid($useold = false,$more_entropy = false,$mtrand = false,$hash = 'sha1',$prefix = '') 
   {
     if($useold===true&&$mtrand===false) {
+       if (function_exists('hash')) {
+       $prehash = hash($hash, rand()); }
+       if (!function_exists('hash')) {
+       $prehash = $hash(rand()); }
        $chars = uniqid($hash(rand()),$more_entropy); }
     if($useold===false&&$mtrand===false) {
-       $chars = $hash(uniqid(rand(),$more_entropy)); }
+       if (function_exists('hash')) {
+       $chars = hash($hash, uniqid(rand(),$more_entropy)); }
+       if (!function_exists('hash')) {
+       $chars = $hash(uniqid(rand(),$more_entropy)); } }
     if($useold===true&&$mtrand===true) {
+       if (function_exists('hash')) {
+       $prehash = hash($hash, mt_rand()); }
+       if (!function_exists('hash')) {
+       $prehash = $hash(mt_rand()); }
        $chars = uniqid($hash(mt_rand()),$more_entropy); }
     if($useold===false&&$mtrand===true) {
-       $chars = $hash(uniqid(mt_rand(),$more_entropy)); }
+       if (function_exists('hash')) {
+       $chars = hash($hash, uniqid(mt_rand(),$more_entropy)); }
+       if (!function_exists('hash')) {
+       $chars = $hash(uniqid(mt_rand(),$more_entropy)); } }
     $uuid  = substr($chars,0,8) . '-';
     $uuid .= substr($chars,8,4) . '-';
     $uuid .= substr($chars,12,4) . '-';
index c068479..0e80edb 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: functions.php - Last Update: 04/10/2010 SVN 465 - Author: cooldude2k $
+    $FileInfo: functions.php - Last Update: 04/12/2010 SVN 466 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="functions.php"||$File3Name=="/functions.php") {
@@ -317,11 +317,17 @@ return $UsersInfo; }
 function hmac($data,$key,$hash='sha1',$blocksize=64) {
   if (!function_exists('hash_hmac')) {
   if (strlen($key)>$blocksize) {
-  $key=pack('H*',$hash($key)); }
+  if (function_exists('hash')) {
+  $key=pack('H*',hash($hash, $key)); }
+  if (!function_exists('hash')) {
+  $key=pack('H*',$hash($key)); } }
   $key=str_pad($key, $blocksize, chr(0x00));
   $ipad=str_repeat(chr(0x36),$blocksize);
   $opad=str_repeat(chr(0x5c),$blocksize);
-  return $hash(($key^$opad).pack('H*',$hash(($key^$ipad).$data))); }
+  if (function_exists('hash')) {
+  return hash($hash, ($key^$opad).pack('H*',hash($hash, ($key^$ipad).$data))); }
+  if (!function_exists('hash')) {
+  return $hash(($key^$opad).pack('H*',$hash(($key^$ipad).$data))); } }
   if (function_exists('hash_hmac')) { 
   return hash_hmac($hash,$data,$key); } }
 // b64hmac hash function
index b2652d1..4006bf4 100644 (file)
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: versioninfo.php - Last Update: 04/10/2010 SVN 465 - Author: cooldude2k $
+    $FileInfo: versioninfo.php - Last Update: 04/12/2010 SVN 466 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="versioninfo.php"||$File3Name=="/versioninfo.php") {
@@ -27,8 +27,8 @@ function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {
        return $return_var; }
 // Version number and date stuff. :P
 $VER1[0] = 0; $VER1[1] = 3; $VER1[2] = 8; $VERFull[1] = $VER1[0].".".$VER1[1].".".$VER1[2];
-$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 465; $RName = "iDB"; $SFName = "IntDB";
-$SVNDay[0] = 04; $SVNDay[1] = 10; $SVNDay[2] = 2010; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
+$VER2[0] = "Alpha"; $VER2[1] = "Al"; $VER2[2] = "SVN"; $SubVerN = 466; $RName = "iDB"; $SFName = "IntDB";
+$SVNDay[0] = 04; $SVNDay[1] = 12; $SVNDay[2] = 2010; $SVNDay[3] = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
 $VerInfo['iDB_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,false);
 $VerInfo['iDB_Ver_SVN'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[1],$SubVerN,true);
 $VerInfo['iDB_Full_Ver'] = version_info($RName,$VER1[0],$VER1[1],$VER1[2],$VER2[0],$SubVerN,false);
diff --git a/settings.php b/settings.php
deleted file mode 100644 (file)
index 4536154..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/*
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the Revised BSD License.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    Revised BSD License for more details.
-
-    Copyright 2004-2009 iDB Support - http://idb.berlios.de/
-    Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
-    iDB Installer made by Game Maker 2k - http://idb.berlios.net/
-
-    $FileInfo: settings.php & settingsbak.php - Last Update: 11/23/2009 SVN 357 - Author: cooldude2k $
-*/
-/*     You Need to install iDB. Run install.php        */
-$File3Name = basename($_SERVER['SCRIPT_NAME']);
-if ($File3Name=="settings.php"||$File3Name=="/settings.php"||
-    $File3Name=="settingsbak.php"||$File3Name=="/settingsbak.php") {
-    header('Location: index.php');
-    exit(); }
-?>
\ No newline at end of file
diff --git a/settingsbak.php b/settingsbak.php
deleted file mode 100644 (file)
index 4536154..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/*
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the Revised BSD License.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    Revised BSD License for more details.
-
-    Copyright 2004-2009 iDB Support - http://idb.berlios.de/
-    Copyright 2004-2009 Game Maker 2k - http://gamemaker2k.org/
-    iDB Installer made by Game Maker 2k - http://idb.berlios.net/
-
-    $FileInfo: settings.php & settingsbak.php - Last Update: 11/23/2009 SVN 357 - Author: cooldude2k $
-*/
-/*     You Need to install iDB. Run install.php        */
-$File3Name = basename($_SERVER['SCRIPT_NAME']);
-if ($File3Name=="settings.php"||$File3Name=="/settings.php"||
-    $File3Name=="settingsbak.php"||$File3Name=="/settingsbak.php") {
-    header('Location: index.php');
-    exit(); }
-?>
\ No newline at end of file
index bd32bf6..1176ad9 100644 (file)
@@ -12,7 +12,7 @@
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
     iDB Installer made by Game Maker 2k - http://idb.berlios.net/
 
-    $FileInfo: setup.php - Last Update: 04/10/2010 SVN 465 - Author: cooldude2k $
+    $FileInfo: setup.php - Last Update: 04/12/2010 SVN 466 - Author: cooldude2k $
 */
 $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="setup.php"||$File3Name=="/setup.php") {
@@ -25,6 +25,21 @@ if(!isset($SetupDir['convert'])) { $SetupDir['convert'] = "setup/convert/"; }
 <td class="TableColumn3">
 <?php
 $checkfile="settings.php";
+$iDBRDate = $SVNDay[0]."/".$SVNDay[1]."/".$SVNDay[2];
+$iDBRSVN = $VER2[2]." ".$SubVerN;
+$LastUpdateS = "Last Update: ".$iDBRDate." ".$iDBRSVN;
+$pretext = "<?php\n/*\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    Revised BSD License for more details.\n\n    Copyright 2004-".$SVNDay[2]." iDB Support - http://idb.berlios.de/\n    Copyright 2004-".$SVNDay[2]." Game Maker 2k - http://gamemaker2k.org/\n    iDB Installer made by Game Maker 2k - http://idb.berlios.net/\n\n    \$FileInfo: settings.php & settingsbak.php - ".$LastUpdateS." - Author: cooldude2k \$\n*/\n";
+$pretext2 = array("/*   Board Setting Section Begins   */\n\$Settings = array();","/*   Board Setting Section Ends  \n     Board Info Section Begins   */\n\$SettInfo = array();","/*   Board Setting Section Ends   \n     Board Dir Section Begins   */\n\$SettDir = array();","/*   Board Dir Section Ends   */");
+$settcheck = "\$File3Name = basename(\$_SERVER['SCRIPT_NAME']);\nif (\$File3Name==\"settings.php\"||\$File3Name==\"/settings.php\"||\n    \$File3Name==\"settingsbak.php\"||\$File3Name==\"/settingsbak.php\") {\n    header('Location: index.php');\n    exit(); }\n";
+$BoardSettingsBak = $pretext.$settcheck;
+$BoardSettings = $pretext.$settcheck;
+$fp = fopen("settings.php","w+");
+fwrite($fp, $BoardSettings);
+fclose($fp);
+//     cp("settings.php","settingsbak.php");
+$fp = fopen("settingsbak.php","w+");
+fwrite($fp, $BoardSettingsBak);
+fclose($fp);
 if (!is_writable($checkfile)) {
    echo "<br />Settings is not writable.";
    chmod("settings.php",0755); $Error="Yes";
diff --git a/sql.php b/sql.php
index 493512b..ee328e2 100644 (file)
--- a/sql.php
+++ b/sql.php
@@ -11,7 +11,7 @@
     Copyright 2004-2010 iDB Support - http://idb.berlios.de/
     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
 
-    $FileInfo: sql.php - Last Update: 04/10/2010 SVN 465 - Author: cooldude2k $
+    $FileInfo: sql.php - Last Update: 04/12/2010 SVN 466 - Author: cooldude2k $
 */
 /* Some ini setting changes uncomment if you need them. 
    Display PHP Errors */
@@ -36,7 +36,8 @@ $File3Name = basename($_SERVER['SCRIPT_NAME']);
 if ($File3Name=="sql.php"||$File3Name=="/sql.php") {
        header('Location: index.php');
        exit(); }
-require('settings.php');
+if(file_exists('settings.php')) {
+       require_once('settings.php'); }
 if(!isset($Settings['idburl'])) { $Settings['idburl'] = null; }
 if(!isset($Settings['fixbasedir'])) { $Settings['fixbasedir'] = null; }
 if(!isset($Settings['fixpathinfo'])) { $Settings['fixpathinfo'] = null; }