OSDN Git Service

ver 0.8.1
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 6 Mar 2007 03:47:44 +0000 (03:47 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 6 Mar 2007 03:47:44 +0000 (03:47 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@535 1ca29b6e-896d-4ea0-84a5-967f57386b96

trunk/sqlite/extra/sqlite/readme-ja.txt
trunk/sqlite/nucleus/sqlite/sqlite.php
trunk/sqlite/nucleus/sqlite/sqliteconfig.php
trunk/sqlite/readme-en.txt
trunk/sqlite/readme-ja.txt

index a8e225d..a955bb4 100644 (file)
@@ -23,34 +23,9 @@ nucleus_mysql_xxxx() 
 \8fC\90³\82³\82ê\81A\88ê\95\94\82ÌMySQL\93Á\88Ù\93I\82È\83I\83v\83V\83\87\83\93\82É\81wdummy\81x\82ª\8ew
 \92è\82³\82ê\82é\82æ\82¤\82É\95Ï\8dX\82³\82ê\82Ü\82·\81B
 
-
-\81\96\81\96\81\96\81\96\81\96\81@\8eè\93®\82Å\95Ï\8dX\82µ\82È\82¢\82Æ\82¢\82¯\82È\82¢\8e\96\8d\80\81@\81\96\81\96\81\96\81\96\81\96
-
-\81@installsqlite.php \82Ì\8eÀ\8ds\82Å\95K\97v\82È\95Ï\8dX\82Ì\82¤\82¿\8fd\97v\82È\95¨\82É
-\82Â\82¢\82Ä\82Í\96w\82Ç\8ds\82í\82ê\82Ü\82·\82ª\81A\88ê\95\94\8eè\93®\82Å\95Ï\8dX\82µ\82È\82¯\82ê\82Î\82È\82ç
-\82È\82¢\95\94\95ª\82ª\82 \82è\82Ü\82·\81B
-
-\81@SQLite \82Å\82Í\81A\83N\83G\83\8a\81[\82Å\81wSELECT i.itime FROM ....\81x\82Æ
-\82µ\82Ä\82à\81Aitime \82ð sql_fetch_xxx \82Å\83L\83\83\83b\83`\82Å\82«\82Ü\82¹\82ñ\81B\82»
-\82±\82Å\81A\82±\82ê\82ç\82Ì\95\\8c»\82ð\81wSELECT i.itime as itime FROM ....\81x
-\82Ì\97l\82É\95Ï\8dX\82µ\82Ü\82·\81B\82Ç\82±\82ð\95Ï\8dX\82·\82ê\82Î\97Ç\82¢\82©\82Í\81Asqlite.php 
-\82Å\81w$SQLITECONF['DEBUGMODE']=true;\81x\82¨\82æ\82Ñ
-\81w$SQLITECONF['DEBUGREPORT']=true;\81x\82ð\8ew\92è\82·\82ê\82Î\81A\83u\83\8d\83O
-\82Ì\83\\81[\83X\83R\81[\83h\82É\81w<!--sqlite_DebugMessage .... 
-sqlite_DebugMessage-->\81x\82Å\95\\8e¦\82³\82ê\82é\83R\83\81\83\93\83g\95\82ð\8eQ\8fÆ\82·\82é
-\82±\82Æ\82Å\8c©\82Â\82¯\82ç\82ê\82é\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81BNucleus3.22\82Å\82Í\81A\88È
-\89º\82Ì\95¨\82ª\82±\82ê\82É\91\8a\93\96\82µ\82Ü\82·\81B
-
-\81EBLOG.php\82Ì\82S\82T\82U\8ds\96Ú\95t\8bß\82Æ\82T\82O\82S\8ds\96Ú\95t\8bß\82Ì"i.itime,"\81B
-\81EITEM.php \82S\82O\8ds\96Ú\95t\8bß\82Ì\82Ì"i.itime,"\81B
-\81ECOMMENTS.php \82V\82V\8ds\96Ú\95t\8bß\82Ì"c.ctime,"\81B
-
-(\92Ç\8bL\81Fver 0.65b \82æ\82è\81A\81w$SQLITECONF['DEBUGMODE']=true;\81x
-\82É\82Ä\91Î\8f\88\82µ\82Ä\82¢\82Ü\82·\81B)
-
-\81@\82³\82ç\82É\81Ainstall.sql \82Ì nucleus_plugin_option \83e\81[\83u\83\8b
-\8dì\90¬\95\94\95ª\82Ì\83N\83G\83\8a\81[\95\82ð\88È\89º\82Ì\82æ\82¤\82É\95Ï\8dX\82µ\82Ü\82·\81iauto_increment
-\82ð\8dí\8f\9c\82µ\82Ü\82·\81j\81B
+\81@install.sql \82Ì nucleus_plugin_option \83e\81[\83u\83\8b\8dì\90¬\95\94\95ª\82Ì
+\83N\83G\83\8a\81[\95\82ª\88È\89º\82Ì\82æ\82¤\82É\95Ï\8dX\82³\82ê\82Ü\82·\81iauto_increment\82ª\8dí\8f\9c
+\82³\82ê\82Ü\82·\81j\81B
 
 CREATE TABLE `nucleus_plugin_option` (
   `ovalue` text NOT NULL,
@@ -59,5 +34,12 @@ CREATE TABLE `nucleus_plugin_option` (
   PRIMARY KEY  (`oid`,`ocontextid`)
 ) TYPE=MyISAM;
 
-\81@ver 0.70b \88È\8d~\81Anucleus/libs/backup.php \82Í\81A\8e©\93®\82Å\95Ï\8dX
-\82³\82ê\82é\82æ\82¤\82É\82È\82è\82Ü\82µ\82½\81B
+
+\81\96\81\96\81\96\81\96\81\96\81@\8eè\93®\82Å\95Ï\8dX\82µ\82È\82¢\82Æ\82¢\82¯\82È\82¢\8e\96\8d\80\81@\81\96\81\96\81\96\81\96\81\96
+
+\81@installsqlite.php \82Ì\8eÀ\8ds\82Å\95K\97v\82È\95Ï\8dX\82Ì\82¤\82¿\8fd\97v\82È\95¨\82É
+\82Â\82¢\82Ä\82Í\96w\82Ç\8ds\82í\82ê\82Ü\82·\82ª\81A\88ê\95\94\8eè\93®\82Å\95Ï\8dX\82µ\82È\82¯\82ê\82Î\82È\82ç
+\82È\82¢\95\94\95ª\82ª\82 \82é\89Â\94\\90«\82ª\82 \82è\82Ü\82·\81B
+
+\81@SQLite wrapper 0.81 \82Å\82Í\81ANucleus 3.2x\82ÆNucleus3.3\82ð
+\95Ï\8dX\82·\82é\8fã\82Å\81A\8eè\93®\82Å\82Ì\95Ï\8dX\82Í\95K\97v\82 \82è\82Ü\82¹\82ñ\81B
index 6cf91dd..204b32c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
     /***************************************
     * SQLite-MySQL wrapper for Nucleus     *
-    *                           ver 0.8.0  *
+    *                           ver 0.8.1  *
     * Written by Katsumi                   *
     ***************************************/
 //
 //
 // Release note:
 //  Version 0.8.0
-//    This is the first established version.  This is
-//    exactly the same as ver 0.7.8b.
+//    -This is the first established version and
+//     exactly the same as ver 0.7.8b.
 //
+//  Version 0.8.1
+//    -Execute "PRAGMA short_column_names=1" first.
+//    -Avoid loading outside php file in some specfic environment.
+//    -Avoid executing multiple queries using ";" as delimer.
+
+global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES, $HTTP_SESSION_VARS;
+$aVarsToCheck = array('HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS', 'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS', 'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES', 'DIR_LIBS');
+
+foreach ($aVarsToCheck as $varName)
+{
+       if (phpversion() >= '4.1.0')
+       {
+               if (   isset($_GET[$varName])
+                       || isset($_POST[$varName])
+                       || isset($_COOKIE[$varName])
+                       || isset($_ENV[$varName])
+                       || isset($_SESSION[$varName])
+                       || isset($_FILES[$varName])
+               ){
+                       die('Sorry. An error occurred.');
+               }
+       } else {
+               if (   isset($HTTP_GET_VARS[$varName])
+                       || isset($HTTP_POST_VARS[$varName])
+                       || isset($HTTP_COOKIE_VARS[$varName])
+                       || isset($HTTP_ENV_VARS[$varName])
+                       || isset($HTTP_SESSION_VARS[$varName])
+                       || isset($HTTP_POST_FILES[$varName])
+               ){
+                       die('Sorry. An error occurred.');
+               }
+       }
+}
 
 // Initializiation stuff
 if (!isset($DIR_NUCLEUS)) $DIR_NUCLEUS=realpath('nucleus/');
 if (substr($DIR_NUCLEUS,-1)!='/') $DIR_NUCLEUS.='/';
+if (!file_exists($DIR_NUCLEUS.'sqlite/sqliteconfig.php')) exit;
 include ($DIR_NUCLEUS.'sqlite/sqliteconfig.php');
 $SQLITE_DBHANDLE=sqlite_open($SQLITECONF['DBFILENAME']);
+if (!file_exists($DIR_NUCLEUS.'sqlite/sqlitequeryfunctions.php')) exit;
 include ($DIR_NUCLEUS.'sqlite/sqlitequeryfunctions.php');
-$SQLITECONF['VERSION']='0.8.0';
+$SQLITECONF['VERSION']='0.8.1';
 
 function sqlite_createQueryFunction($queryf,$globalf){
        global $SQLITE_DBHANDLE;
@@ -118,6 +153,8 @@ function nucleus_mysql_connect($p1=null,$p2=null,$p3=null,$p4=null,$p5=null){
        // All prameters are ignored.
        global $SQLITE_DBHANDLE,$SQLITECONF;
        if (!$SQLITE_DBHANDLE) $SQLITE_DBHANDLE=sqlite_open($SQLITECONF['DBFILENAME']);
+       // Initialization queries.
+       foreach($SQLITECONF['INITIALIZE'] as $value) nucleus_mysql_query($value);
        return $SQLITE_DBHANDLE;
 }
 
@@ -340,13 +377,15 @@ function sqlite_changeQuote(&$query){
                if (($i2=strpos($query,"'",$i))===false) $i2=$qlen;
                if (($i3=strpos($query,'`',$i))===false) $i3=$qlen;
                if ($i1==$qlen && $i2==$qlen && $i3==$qlen) {
-                       $ret.=substr($query,$i);
+                       $ret.=($temp=substr($query,$i));
+                       if (strstr($temp,';')) exit('Warning: try to use more than two queries?');
                        break;
                }
                if ($i2<($j=$i1)) $j=$i2;
                if ($i3<$j) $j=$i3;
-               $ret.=substr($query,$i,$j-$i);
+               $ret.=($temp=substr($query,$i,$j-$i));
                $c=$query[($i=$j)]; // $c keeps the type of quote.
+               if (strstr($temp,';')) exit('Warning: try to use more than two queries?');
                
                // Check between quotes.
                // $j shows the begging positioin.
@@ -697,6 +736,7 @@ function sqlite_showFieldsFrom($tname,$dbhandle){
 function sqlite_mysql_query_debug(&$query){
        // The debug mode is so far used for checking query difference like "SELECT i.itime, ....".
        // This must be chaged to "SELECT i.itime as itime,..." for SQLite.
+       // (This feature is not needed any more after the version 0.8.1 (see intialization query))
        $uquery=strtoupper($query);
        if (strpos($uquery,"SELECT ")!==0) return $query;
        if (($i=strpos($uquery," FROM "))===false) return $query;
index fad4339..a78a062 100644 (file)
@@ -6,8 +6,9 @@ $SQLITECONF=array();
 $SQLITECONF['DBFILENAME']=$DIR_NUCLEUS.'sqlite/.dbsqlite';
 
 // Options
-$SQLITECONF['DEBUGMODE']=true;
+$SQLITECONF['DEBUGMODE']=false;
 $SQLITECONF['DEBUGREPORT']=false;
 $SQLITECONF['MEASURESPEED']=false;
+$SQLITECONF['INITIALIZE']=array('PRAGMA short_column_names=1;');
 
 ?>
\ No newline at end of file
index 08895bf..408e83e 100644 (file)
@@ -2,7 +2,7 @@
 * MySQL-SQLite wrapper for Nucleus ver 0.8      *
 *************************************************
 
-Copyright (C) 2006  Katsumi
+Copyright (C) 2006-2007  Katsumi
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
index 296483e..6afe98d 100644 (file)
@@ -2,7 +2,7 @@
 * MySQL-SQLite wrapper for Nucleus ver 0.8   *
 **********************************************
  
-Copyright (C) 2006\94N\81AKatsumi
+Copyright (C) 2006-2007\94N\81AKatsumi
 
 \82±\82Ì\83v\83\8d\83O\83\89\83\80\82Í\83t\83\8a\81[\83\\83t\83g\83E\83F\83A\82Å\82·\81B\82 \82È\82½\82Í\82±\82ê\82ð\81A\83t\83\8a\81[\83\\83t\83g\83E\83F
 \83A\8dà\92c\82É\82æ\82Á\82Ä\94­\8ds\82³\82ê\82½ GNU \88ê\94Ê\8cö\8fO\97\98\97p\8b\96\91ø\8c_\96ñ\8f\91(\83o\81[\83W\83\87\83\932\82©\81A\8aó