OSDN Git Service

tag: sqlite0904
[nucleus-jp/nucleus-plugins.git] / sqlite / tags / sqlite0904 / extra / sqlite / installsqlite.php
diff --git a/sqlite/tags/sqlite0904/extra/sqlite/installsqlite.php b/sqlite/tags/sqlite0904/extra/sqlite/installsqlite.php
new file mode 100644 (file)
index 0000000..f0c4c9d
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+/*******************************************
+* mysql_xxx => nucleus_mysql_xxx converter *
+*                              for Nucleus *
+*     ver 0.6.1b  Written by Katsumi       *
+*******************************************/
+
+// The license of this script is GPL
+
+// Check lanuage
+if (strpos(strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']),'ja')===0) {
+       $charset='EUC-JP';
+} else {
+       $charset='iso-8859-1';
+}
+header("Content-Type: text/html; charset=$charset");
+
+if (!file_exists('./nucleus/sqlite/convert.php')) exit;
+include('./nucleus/sqlite/convert.php');
+
+?><html><body><?php 
+
+$myself='installsqlite.php';
+if ((@$_GET['go'])!='yes') {
+
+       if ($charset=='EUC-JP') {
+               ?>¤³¤Î¥Ú¡¼¥¸¤Ç¤Ï¡¢SQLite ¤Ç»ÈÍѤ¹¤ë¤¿¤á¤Î Nucleus ¤Î³Æ¥Õ¥¡¥¤¥ë¤ÎÊѹ¹¤ò¹Ô¤¤¤Þ¤¹¡£<br /><br />
+               ¤¹¤Ù¤Æ¤Î &quot;mysql_xxx&quot; ´Ø¿ô¸Æ¤Ó½Ð¤·¤Îɽµ­¤¬ &quot;nucleus_mysql_xxx&quot;¤ËÊѹ¹¤µ¤ì¤Þ¤¹.<br /><br />
+               <?php if (!function_exists('mysql_query')) {?>
+                       ¤³¤ÎÊѹ¹¤Ï¡¢MySQL ´Ø¿ô¤¬ PHP ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢É¬¿Ü¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£<br />
+                       ¤³¤Î¾ì¹ç &quot;install.php&quot; ¤È &quot;config.php&quot; ¤À¤±¤ËÊѹ¹¤¬É¬ÍפǤ¹¡£<br />
+                       ¤â¤·MySQL ´Ø¿ô¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤ª¤é¤º¡¢¾­ÍèŪ¤Ë¤â¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Ê¤¤¤³¤È¤¬³Î¼Â¤Ê¾ì¹ç¡¢<br />
+                       <a href="?go=yes&amp;modify=no">¤³¤³¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤</a>(install.php ¤È config.php ¤¬Êѹ¹¤µ¤ì¤Þ¤¹)¡£<br /><br />
+                       ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢²¼¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br /><br />
+               <?php } ?>
+               <a href="?go=yes&amp;modify=yes">Êѹ¹¤ò³«»Ï</a>(¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤¹¤Ù¤Æ¤Î PHP ¥Õ¥¡¥¤¥ë¤¬Êѹ¹¤µ¤ì¤Þ¤¹)¡£<br /><br />
+               »Ï¤á¤ëÁ°¤Ë¡¢Êѹ¹¤µ¤ì¤ë¤Ù¤­ PHP ¥Õ¥¡¥¤¥ë¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤¬¡¢Æɤ߽ñ¤­²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
+               </body></html><?php
+       } else {
+               ?>This page is to modify Nucleus core files for using SQLite as database engine.<br /><br />
+               All the &quot;mysql_xxx&quot; functions will be converted to &quot;nucleus_mysql_xxx&quot;.<br /><br />
+               <?php if (!function_exists('mysql_query')) {?>
+                       This modification is not required if MySQL functions of PHP are not installed in the server.<br />
+                       In this case, only the &quot;install.php&quot; and &quot;config.php&quot; must be modified.<br />
+                       If you are sure that the MySQL function is never (now and in future) installed, <br />
+                       <a href="?go=yes&amp;modify=no">please click here</a>(install.php and config.php will be changed).<br /><br />
+                       Otherwise, please click following link.<br /><br />
+               <?php } ?>
+               <a href="?go=yes&amp;modify=yes">Start modification</a>(all the PHP files in this directory will be changed).<br /><br />
+               Please make sure that all PHP files to be modified are readable and writable.
+               </body></html><?php
+       }
+       exit;
+}
+
+if ((@$_GET['modify'])=='yes') {
+       // Obtain all PHP files in current and child directories.
+       $phpfiles=array();
+       seekPhpFiles('./',$phpfiles,$myself);
+       
+       // Modify all PHP files; mysql_xxxx is replaced by nucleus_mysql_XXXX.
+       $allok=true;
+       foreach ($phpfiles as $file) $allok=$allok && changeFunctions($file);
+       if (!$allok) ExitWithError();
+}
+
+// Modify config.php, install.php and backup.php
+modifyConfigInstall();
+
+if ($charset=='EUC-JP') {
+       ?>¤¹¤Ù¤Æ¤ÎÊѹ¹¤¬½ªÎ»¤·¤Þ¤·¤¿¡£<hr />
+       <a href="install.php">¤³¤³¤ò¥¯¥ê¥Ã¥¯¤·¤Æ Nucleus w/SQLite ¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ò³«»Ï¤·¤Æ¤¯¤À¤µ¤¤¡£</a><br />
+       <?php
+} else {
+       ?>All modificatios are sccesfully done.<hr />
+       <a href="install.php">Click here to install Nucleus w/SQLite</a><br />
+       <?php
+}
+if (@rename('installsqlite.php','installsqlite.php~')) {
+       if ($charset=='EUC-JP') {
+               echo '(&quot;installsqlite.php&quot; ¤Ï &quot;installsqlite.php~&quot; ¤Ë¥Õ¥¡¥¤¥ë̾¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£)';
+       } else {
+               echo '(&quot;installsqlite.php&quot; has been renamed to &quot;installsqlite.php~&quot;.)';
+       }
+}
+?></body></html>
\ No newline at end of file