OSDN Git Service

tag: sqlite0904
[nucleus-jp/nucleus-plugins.git] / sqlite / tags / sqlite0904 / extra / sqlite / installsqlite.php
1 <?php
2 /*******************************************
3 * mysql_xxx => nucleus_mysql_xxx converter *
4 *                              for Nucleus *
5 *     ver 0.6.1b  Written by Katsumi       *
6 *******************************************/
7
8 // The license of this script is GPL
9
10 // Check lanuage
11 if (strpos(strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']),'ja')===0) {
12         $charset='EUC-JP';
13 } else {
14         $charset='iso-8859-1';
15 }
16 header("Content-Type: text/html; charset=$charset");
17
18 if (!file_exists('./nucleus/sqlite/convert.php')) exit;
19 include('./nucleus/sqlite/convert.php');
20
21 ?><html><body><?php 
22
23 $myself='installsqlite.php';
24 if ((@$_GET['go'])!='yes') {
25
26         if ($charset=='EUC-JP') {
27                 ?>¤³¤Î¥Ú¡¼¥¸¤Ç¤Ï¡¢SQLite ¤Ç»ÈÍѤ¹¤ë¤¿¤á¤Î Nucleus ¤Î³Æ¥Õ¥¡¥¤¥ë¤ÎÊѹ¹¤ò¹Ô¤¤¤Þ¤¹¡£<br /><br />
28                 ¤¹¤Ù¤Æ¤Î &quot;mysql_xxx&quot; ´Ø¿ô¸Æ¤Ó½Ð¤·¤Îɽµ­¤¬ &quot;nucleus_mysql_xxx&quot;¤ËÊѹ¹¤µ¤ì¤Þ¤¹.<br /><br />
29                 <?php if (!function_exists('mysql_query')) {?>
30                         ¤³¤ÎÊѹ¹¤Ï¡¢MySQL ´Ø¿ô¤¬ PHP ¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢É¬¿Ü¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£<br />
31                         ¤³¤Î¾ì¹ç &quot;install.php&quot; ¤È &quot;config.php&quot; ¤À¤±¤ËÊѹ¹¤¬É¬ÍפǤ¹¡£<br />
32                         ¤â¤·MySQL ´Ø¿ô¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤ª¤é¤º¡¢¾­ÍèŪ¤Ë¤â¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Ê¤¤¤³¤È¤¬³Î¼Â¤Ê¾ì¹ç¡¢<br />
33                         <a href="?go=yes&amp;modify=no">¤³¤³¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤</a>(install.php ¤È config.php ¤¬Êѹ¹¤µ¤ì¤Þ¤¹)¡£<br /><br />
34                         ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢²¼¤Î¥ê¥ó¥¯¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£<br /><br />
35                 <?php } ?>
36                 <a href="?go=yes&amp;modify=yes">Êѹ¹¤ò³«»Ï</a>(¤³¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤¹¤Ù¤Æ¤Î PHP ¥Õ¥¡¥¤¥ë¤¬Êѹ¹¤µ¤ì¤Þ¤¹)¡£<br /><br />
37                 »Ï¤á¤ëÁ°¤Ë¡¢Êѹ¹¤µ¤ì¤ë¤Ù¤­ PHP ¥Õ¥¡¥¤¥ë¤Î¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤¬¡¢Æɤ߽ñ¤­²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
38                 </body></html><?php
39         } else {
40                 ?>This page is to modify Nucleus core files for using SQLite as database engine.<br /><br />
41                 All the &quot;mysql_xxx&quot; functions will be converted to &quot;nucleus_mysql_xxx&quot;.<br /><br />
42                 <?php if (!function_exists('mysql_query')) {?>
43                         This modification is not required if MySQL functions of PHP are not installed in the server.<br />
44                         In this case, only the &quot;install.php&quot; and &quot;config.php&quot; must be modified.<br />
45                         If you are sure that the MySQL function is never (now and in future) installed, <br />
46                         <a href="?go=yes&amp;modify=no">please click here</a>(install.php and config.php will be changed).<br /><br />
47                         Otherwise, please click following link.<br /><br />
48                 <?php } ?>
49                 <a href="?go=yes&amp;modify=yes">Start modification</a>(all the PHP files in this directory will be changed).<br /><br />
50                 Please make sure that all PHP files to be modified are readable and writable.
51                 </body></html><?php
52         }
53         exit;
54 }
55
56 if ((@$_GET['modify'])=='yes') {
57         // Obtain all PHP files in current and child directories.
58         $phpfiles=array();
59         seekPhpFiles('./',$phpfiles,$myself);
60         
61         // Modify all PHP files; mysql_xxxx is replaced by nucleus_mysql_XXXX.
62         $allok=true;
63         foreach ($phpfiles as $file) $allok=$allok && changeFunctions($file);
64         if (!$allok) ExitWithError();
65 }
66
67 // Modify config.php, install.php and backup.php
68 modifyConfigInstall();
69
70 if ($charset=='EUC-JP') {
71         ?>¤¹¤Ù¤Æ¤ÎÊѹ¹¤¬½ªÎ»¤·¤Þ¤·¤¿¡£<hr />
72         <a href="install.php">¤³¤³¤ò¥¯¥ê¥Ã¥¯¤·¤Æ Nucleus w/SQLite ¤Î¥¤¥ó¥¹¥È¡¼¥ë¤ò³«»Ï¤·¤Æ¤¯¤À¤µ¤¤¡£</a><br />
73         <?php
74 } else {
75         ?>All modificatios are sccesfully done.<hr />
76         <a href="install.php">Click here to install Nucleus w/SQLite</a><br />
77         <?php
78 }
79 if (@rename('installsqlite.php','installsqlite.php~')) {
80         if ($charset=='EUC-JP') {
81                 echo '(&quot;installsqlite.php&quot; ¤Ï &quot;installsqlite.php~&quot; ¤Ë¥Õ¥¡¥¤¥ë̾¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£)';
82         } else {
83                 echo '(&quot;installsqlite.php&quot; has been renamed to &quot;installsqlite.php~&quot;.)';
84         }
85 }
86 ?></body></html>