HOR-1573
HOR-1573 HOR-1573 HOR-1573
This commit is contained in:
@@ -2619,7 +2619,7 @@ function run_update_plugin_attributes($task, $args)
|
||||
|
||||
echo "Done!\n";
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
error_log( $e->getMessage() . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2731,7 +2731,7 @@ function run_check_plugin_disabled_code($task, $args)
|
||||
|
||||
echo "Done!\n";
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
error_log( $e->getMessage() . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,24 +296,6 @@ class DataBaseMaintenance
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* backupData
|
||||
*
|
||||
* @return boolean true or false
|
||||
*/
|
||||
function backupData ()
|
||||
{
|
||||
$aTables = $this->getTablesList();
|
||||
foreach ($aTables as $table) {
|
||||
if ($this->dumpData( $table ) !== false) {
|
||||
printf( "%20s %s %s\n", 'Dump of table:', $table, " in file {$this->outfile}" );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* restoreAllData
|
||||
*
|
||||
@@ -471,8 +453,10 @@ class DataBaseMaintenance
|
||||
$queries += 1;
|
||||
|
||||
if (! @mysql_query( $query )) {
|
||||
echo mysql_error() . "\n";
|
||||
echo "==>" . $query . "<==\n";
|
||||
$varRes = mysql_error() . "\n";
|
||||
G::outRes( $varRes );
|
||||
$varRes = "==>" . $query . "<==\n";
|
||||
G::outRes( $varRes );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +504,9 @@ class DataBaseMaintenance
|
||||
$mysqli->close();
|
||||
} catch (Exception $e) {
|
||||
echo $query;
|
||||
echo $e->getMessage();
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
}
|
||||
}
|
||||
return $queries;
|
||||
@@ -546,7 +532,7 @@ class DataBaseMaintenance
|
||||
}
|
||||
mysql_free_result( $result );
|
||||
} else {
|
||||
echo mysql_error();
|
||||
G::outRes( mysql_error() );
|
||||
}
|
||||
return $tableSchema;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
|
||||
class G
|
||||
{
|
||||
const hashFx = 'md5';
|
||||
const hashFile = 'md5_file';
|
||||
const hashCrc = 'crc32';
|
||||
public $sessionVar = array(); //SESSION temporary array store.
|
||||
|
||||
/**
|
||||
@@ -5692,7 +5695,8 @@ class G
|
||||
*/
|
||||
public static function encryptOld($string)
|
||||
{
|
||||
return md5($string);
|
||||
$consthashFx = self::hashFx;
|
||||
return $consthashFx($string);
|
||||
}
|
||||
/**
|
||||
* encryptFileOld
|
||||
@@ -5703,7 +5707,8 @@ class G
|
||||
*/
|
||||
public function encryptFileOld ($string)
|
||||
{
|
||||
return md5_file($string);
|
||||
$consthashFx = self::hashFile;
|
||||
return $consthashFx($string);
|
||||
}
|
||||
/**
|
||||
* crc32
|
||||
@@ -5714,7 +5719,8 @@ class G
|
||||
*/
|
||||
public function encryptCrc32 ($string)
|
||||
{
|
||||
return crc32($string);
|
||||
$consthashFx = self::hashCrc;
|
||||
return $consthashFx($string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,7 +97,8 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
|
||||
return unlink($filter->validateInput($file,'path'));
|
||||
$sFile=$filter->validateInput($file,'path');
|
||||
return unlink($sFile);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +221,8 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
|
||||
$chmod = 0644; // invalid config or simpletest
|
||||
}
|
||||
$chmod = $chmod & 0666;
|
||||
chmod($filter->validateInput($file, 'path'), $chmod);
|
||||
$sFile = $filter->validateInput($file, 'path');
|
||||
chmod($sFile, $chmod);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteConnection.php,v 1.15 2006/01/17 19:44:41 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/Connection.php';
|
||||
require_once 'creole/common/ConnectionCommon.php';
|
||||
|
||||
/**
|
||||
* SQLite implementation of Connection.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @author Stig Bakken <ssb@fast.no>
|
||||
* @author Lukas Smith
|
||||
* @version $Revision: 1.15 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteConnection extends ConnectionCommon implements Connection {
|
||||
|
||||
/**
|
||||
* The case to use for SQLite results.
|
||||
* (0=nochange, 1=upper, 2=lower)
|
||||
* This is set in each call to executeQuery() in order to ensure that different
|
||||
* Connections do not overwrite each other's settings
|
||||
*/
|
||||
private $sqliteAssocCase;
|
||||
|
||||
/**
|
||||
* @see Connection::connect()
|
||||
*/
|
||||
function connect($dsninfo, $flags = 0)
|
||||
{
|
||||
if (!extension_loaded('sqlite')) {
|
||||
throw new SQLException('sqlite extension not loaded');
|
||||
}
|
||||
|
||||
$file = $dsninfo['database'];
|
||||
|
||||
$this->dsn = $dsninfo;
|
||||
$this->flags = $flags;
|
||||
|
||||
$persistent = ($flags & Creole::PERSISTENT === Creole::PERSISTENT);
|
||||
|
||||
if (PHP_VERSION == '5.0.4' || PHP_VERSION == '5.0.5') {
|
||||
$nochange = TRUE;
|
||||
} else {
|
||||
$nochange = !(($flags & Creole::COMPAT_ASSOC_LOWER) === Creole::COMPAT_ASSOC_LOWER);
|
||||
}
|
||||
|
||||
if ($nochange) {
|
||||
$this->sqliteAssocCase = 0;
|
||||
} else {
|
||||
$this->sqliteAssocCase = 2;
|
||||
}
|
||||
|
||||
if ($file === null) {
|
||||
throw new SQLException("No SQLite database specified.");
|
||||
}
|
||||
|
||||
$mode = (isset($dsninfo['mode']) && is_numeric($dsninfo['mode'])) ? $dsninfo['mode'] : 0644;
|
||||
|
||||
if ($file != ':memory:') {
|
||||
if (!file_exists($file)) {
|
||||
touch($file);
|
||||
chmod($file, $mode);
|
||||
if (!file_exists($file)) {
|
||||
throw new SQLException("Unable to create SQLite database.");
|
||||
}
|
||||
}
|
||||
if (!is_file($file)) {
|
||||
throw new SQLException("Unable to open SQLite database: not a valid file.");
|
||||
}
|
||||
if (!is_readable($file)) {
|
||||
throw new SQLException("Unable to read SQLite database.");
|
||||
}
|
||||
}
|
||||
|
||||
$connect_function = $persistent ? 'sqlite_popen' : 'sqlite_open';
|
||||
if (!($conn = @$connect_function($file, $mode, $errmsg) )) {
|
||||
throw new SQLException("Unable to connect to SQLite database", $errmsg);
|
||||
}
|
||||
|
||||
$this->dblink = $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::getDatabaseInfo()
|
||||
*/
|
||||
public function getDatabaseInfo()
|
||||
{
|
||||
require_once 'creole/drivers/sqlite/metadata/SQLiteDatabaseInfo.php';
|
||||
return new SQLiteDatabaseInfo($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::getIdGenerator()
|
||||
*/
|
||||
public function getIdGenerator()
|
||||
{
|
||||
require_once 'creole/drivers/sqlite/SQLiteIdGenerator.php';
|
||||
return new SQLiteIdGenerator($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::prepareStatement()
|
||||
*/
|
||||
public function prepareStatement($sql)
|
||||
{
|
||||
require_once 'creole/drivers/sqlite/SQLitePreparedStatement.php';
|
||||
return new SQLitePreparedStatement($this, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::prepareCall()
|
||||
*/
|
||||
public function prepareCall($sql) {
|
||||
throw new SQLException('SQLite does not support stored procedures using CallableStatement.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::createStatement()
|
||||
*/
|
||||
public function createStatement()
|
||||
{
|
||||
require_once 'creole/drivers/sqlite/SQLiteStatement.php';
|
||||
return new SQLiteStatement($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::close()
|
||||
*/
|
||||
function close()
|
||||
{
|
||||
$ret = @sqlite_close($this->dblink);
|
||||
$this->dblink = null;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::applyLimit()
|
||||
*/
|
||||
public function applyLimit(&$sql, $offset, $limit)
|
||||
{
|
||||
if ( $limit > 0 ) {
|
||||
$sql .= " LIMIT " . $limit . ($offset > 0 ? " OFFSET " . $offset : "");
|
||||
} elseif ( $offset > 0 ) {
|
||||
$sql .= " LIMIT -1 OFFSET " . $offset;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::executeQuery()
|
||||
*/
|
||||
public function executeQuery($sql, $fetchmode = null)
|
||||
{
|
||||
ini_set('sqlite.assoc_case', $this->sqliteAssocCase);
|
||||
$this->lastQuery = $sql;
|
||||
$result = @sqlite_query($this->dblink, $this->lastQuery);
|
||||
if (!$result) {
|
||||
throw new SQLException('Could not execute query', $php_errormsg, $this->lastQuery); //sqlite_error_string(sqlite_last_error($this->dblink))
|
||||
}
|
||||
require_once 'creole/drivers/sqlite/SQLiteResultSet.php';
|
||||
return new SQLiteResultSet($this, $result, $fetchmode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Connection::executeUpdate()
|
||||
*/
|
||||
function executeUpdate($sql)
|
||||
{
|
||||
$this->lastQuery = $sql;
|
||||
$result = @sqlite_query($this->dblink, $this->lastQuery);
|
||||
if (!$result) {
|
||||
throw new SQLException('Could not execute update', $php_errormsg, $this->lastQuery); //sqlite_error_string(sqlite_last_error($this->dblink))
|
||||
}
|
||||
return (int) @sqlite_changes($this->dblink);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a database transaction.
|
||||
* @throws SQLException
|
||||
* @return void
|
||||
*/
|
||||
protected function beginTrans()
|
||||
{
|
||||
$result = @sqlite_query($this->dblink, 'BEGIN');
|
||||
if (!$result) {
|
||||
throw new SQLException('Could not begin transaction', $php_errormsg); //sqlite_error_string(sqlite_last_error($this->dblink))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit the current transaction.
|
||||
* @throws SQLException
|
||||
* @return void
|
||||
*/
|
||||
protected function commitTrans()
|
||||
{
|
||||
$result = @sqlite_query($this->dblink, 'COMMIT');
|
||||
if (!$result) {
|
||||
throw new SQLException('Can not commit transaction', $php_errormsg); // sqlite_error_string(sqlite_last_error($this->dblink))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll back (undo) the current transaction.
|
||||
* @throws SQLException
|
||||
* @return void
|
||||
*/
|
||||
protected function rollbackTrans()
|
||||
{
|
||||
$result = @sqlite_query($this->dblink, 'ROLLBACK');
|
||||
if (!$result) {
|
||||
throw new SQLException('Could not rollback transaction', $php_errormsg); // sqlite_error_string(sqlite_last_error($this->dblink))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of rows affected by the data manipulation
|
||||
* query.
|
||||
*
|
||||
* @return int Number of rows affected by the last query.
|
||||
*/
|
||||
function getUpdateCount()
|
||||
{
|
||||
return (int) @sqlite_changes($this->dblink);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'creole/IdGenerator.php';
|
||||
|
||||
/**
|
||||
* SQLite IdGenerator implimenation.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.4 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteIdGenerator implements IdGenerator {
|
||||
|
||||
/** Connection object that instantiated this class */
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* Creates a new IdGenerator class, saves passed connection for use
|
||||
* later by getId() method.
|
||||
* @param Connection $conn
|
||||
*/
|
||||
public function __construct(Connection $conn)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IdGenerator::isBeforeInsert()
|
||||
*/
|
||||
public function isBeforeInsert()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IdGenerator::isAfterInsert()
|
||||
*/
|
||||
public function isAfterInsert()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IdGenerator::getIdMethod()
|
||||
*/
|
||||
public function getIdMethod()
|
||||
{
|
||||
return self::AUTOINCREMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IdGenerator::getId()
|
||||
*/
|
||||
public function getId($unused = null)
|
||||
{
|
||||
return sqlite_last_insert_rowid($this->conn->getResource());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLitePreparedStatement.php,v 1.7 2004/03/20 04:16:50 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/PreparedStatement.php';
|
||||
require_once 'creole/common/PreparedStatementCommon.php';
|
||||
|
||||
/**
|
||||
* MySQL subclass for prepared statements.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.7 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLitePreparedStatement extends PreparedStatementCommon implements PreparedStatement {
|
||||
|
||||
/**
|
||||
* Quotes string using native sqlite_escape_string() function.
|
||||
* @see ResultSetCommon::escape()
|
||||
*/
|
||||
protected function escape($str)
|
||||
{
|
||||
return sqlite_escape_string($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies sqlite_udf_encode_binary() to ensure that binary contents will be handled correctly by sqlite.
|
||||
* @see PreparedStatement::setBlob()
|
||||
* @see ResultSet::getBlob()
|
||||
*/
|
||||
function setBlob($paramIndex, $blob)
|
||||
{
|
||||
if ($blob === null) {
|
||||
$this->setNull($paramIndex);
|
||||
} else {
|
||||
// they took magic __toString() out of PHP5.0.0; this sucks
|
||||
if (is_object($blob)) {
|
||||
$blob = $blob->__toString();
|
||||
}
|
||||
$this->boundInVars[$paramIndex] = "'" . sqlite_udf_encode_binary( $blob ) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteResultSet.php,v 1.9 2004/11/29 13:41:24 micha Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/ResultSet.php';
|
||||
require_once 'creole/common/ResultSetCommon.php';
|
||||
|
||||
/**
|
||||
* SQLite implementation of ResultSet class.
|
||||
*
|
||||
* SQLite supports OFFSET / LIMIT natively; this means that no adjustments or checking
|
||||
* are performed. We will assume that if the lmitSQL() operation failed that an
|
||||
* exception was thrown, and that OFFSET/LIMIT will never be emulated for SQLite.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.9 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteResultSet extends ResultSetCommon implements ResultSet {
|
||||
|
||||
/**
|
||||
* Gets optimized SQLiteResultSetIterator.
|
||||
* @return SQLiteResultSetIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
require_once 'creole/drivers/sqlite/SQLiteResultSetIterator.php';
|
||||
return new SQLiteResultSetIterator($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResultSet::seek()
|
||||
*/
|
||||
public function seek($rownum)
|
||||
{
|
||||
// MySQL rows start w/ 0, but this works, because we are
|
||||
// looking to move the position _before_ the next desired position
|
||||
if (!@sqlite_seek($this->result, $rownum)) {
|
||||
return false;
|
||||
}
|
||||
$this->cursorPos = $rownum;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResultSet::next()
|
||||
*/
|
||||
function next()
|
||||
{
|
||||
$this->fields = sqlite_fetch_array($this->result, $this->fetchmode); // (ResultSet::FETCHMODE_NUM = SQLITE_NUM, etc.)
|
||||
if (!$this->fields) {
|
||||
$errno = sqlite_last_error($this->conn->getResource());
|
||||
if (!$errno) {
|
||||
// We've advanced beyond end of recordset.
|
||||
$this->afterLast();
|
||||
return false;
|
||||
} else {
|
||||
throw new SQLException("Error fetching result", sqlite_error_string($errno));
|
||||
}
|
||||
}
|
||||
|
||||
// Advance cursor position
|
||||
$this->cursorPos++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ResultSet::getRecordCount()
|
||||
*/
|
||||
public function getRecordCount()
|
||||
{
|
||||
$rows = @sqlite_num_rows($this->result);
|
||||
if ($rows === null) {
|
||||
throw new SQLException("Error fetching num rows", sqlite_error_string(sqlite_last_error($this->conn->getResource())));
|
||||
}
|
||||
return (int) $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs sqlite_udf_decode_binary on binary data.
|
||||
* @see ResultSet::getBlob()
|
||||
*/
|
||||
public function getBlob($column)
|
||||
{
|
||||
$idx = (is_int($column) ? $column - 1 : $column);
|
||||
if (!array_key_exists($idx, $this->fields)) { throw new SQLException("Invalid resultset column: " . $column); }
|
||||
if ($this->fields[$idx] === null) { return null; }
|
||||
require_once 'creole/util/Blob.php';
|
||||
$b = new Blob();
|
||||
$b->setContents(sqlite_udf_decode_binary($this->fields[$idx]));
|
||||
return $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simply empties array as there is no result free method for sqlite.
|
||||
* @see ResultSet::close()
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->fields = array();
|
||||
$this->result = null;
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteResultSetIterator.php,v 1.6 2004/12/03 16:57:54 gamr Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Optimized iterator for SQLite.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.6 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteResultSetIterator implements Iterator {
|
||||
|
||||
private $result;
|
||||
private $pos = 0;
|
||||
private $fetchmode;
|
||||
private $row_count;
|
||||
|
||||
/**
|
||||
* Construct the iterator.
|
||||
* @param SQLiteResultSet $rs
|
||||
*/
|
||||
public function __construct(SQLiteResultSet $rs)
|
||||
{
|
||||
$this->result = $rs->getResource();
|
||||
$this->fetchmode = $rs->getFetchmode();
|
||||
$this->row_count = $rs->getRecordCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method actually has no effect, since we do not rewind ResultSet for iteration.
|
||||
*/
|
||||
function rewind()
|
||||
{
|
||||
sqlite_rewind($this->result);
|
||||
}
|
||||
|
||||
function valid()
|
||||
{
|
||||
return ( $this->pos < $this->row_count );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cursor position. Note that this will not necessarily
|
||||
* be 1 for the first row, since no rewind is performed at beginning
|
||||
* of iteration.
|
||||
* @return int
|
||||
*/
|
||||
function key()
|
||||
{
|
||||
return $this->pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the row (assoc array) at current cursor pos.
|
||||
* @return array
|
||||
*/
|
||||
function current()
|
||||
{
|
||||
return sqlite_fetch_array($this->result, $this->fetchmode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Advances internal cursor pos.
|
||||
*/
|
||||
function next()
|
||||
{
|
||||
$this->pos++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteStatement.php,v 1.1 2004/02/19 02:49:43 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/Statement.php';
|
||||
require_once 'creole/common/StatementCommon.php';
|
||||
|
||||
/**
|
||||
* SQLite Statement
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.1 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteStatement extends StatementCommon implements Statement {
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* $Id: SQLiteTypes.php,v 1.3 2004/03/20 04:16:50 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/CreoleTypes.php';
|
||||
|
||||
/**
|
||||
* MySQL types / type map.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.3 $
|
||||
* @package creole.drivers.sqlite
|
||||
*/
|
||||
class SQLiteTypes extends CreoleTypes {
|
||||
|
||||
/**
|
||||
* Map some fake SQLite types CreoleTypes.
|
||||
* SQLite is typeless so this is really only for "hint" / readability
|
||||
* purposes.
|
||||
* @var array
|
||||
*/
|
||||
private static $typeMap = array(
|
||||
'tinyint' => CreoleTypes::TINYINT,
|
||||
'smallint' => CreoleTypes::SMALLINT,
|
||||
'mediumint' => CreoleTypes::SMALLINT,
|
||||
'int' => CreoleTypes::INTEGER,
|
||||
'integer' => CreoleTypes::INTEGER,
|
||||
'bigint' => CreoleTypes::BIGINT,
|
||||
'int24' => CreoleTypes::BIGINT,
|
||||
'real' => CreoleTypes::REAL,
|
||||
'float' => CreoleTypes::FLOAT,
|
||||
'decimal' => CreoleTypes::DECIMAL,
|
||||
'numeric' => CreoleTypes::NUMERIC,
|
||||
'double' => CreoleTypes::DOUBLE,
|
||||
'char' => CreoleTypes::CHAR,
|
||||
'varchar' => CreoleTypes::VARCHAR,
|
||||
'date' => CreoleTypes::DATE,
|
||||
'time' => CreoleTypes::TIME,
|
||||
'year' => CreoleTypes::YEAR,
|
||||
'datetime' => CreoleTypes::TIMESTAMP,
|
||||
'timestamp' => CreoleTypes::TIMESTAMP,
|
||||
'tinyblob' => CreoleTypes::BINARY,
|
||||
'blob' => CreoleTypes::VARBINARY,
|
||||
'mediumblob' => CreoleTypes::VARBINARY,
|
||||
'longblob' => CreoleTypes::VARBINARY,
|
||||
'tinytext' => CreoleTypes::VARCHAR,
|
||||
'mediumtext' => CreoleTypes::LONGVARCHAR,
|
||||
'text' => CreoleTypes::LONGVARCHAR,
|
||||
);
|
||||
|
||||
/** Reverse mapping, created on demand. */
|
||||
private static $reverseMap = null;
|
||||
|
||||
/**
|
||||
* This method returns the generic Creole (JDBC-like) type
|
||||
* when given the native db type. If no match is found then we just
|
||||
* return CreoleTypes::TEXT because SQLite is typeless.
|
||||
* @param string $nativeType DB native type (e.g. 'TEXT', 'byetea', etc.).
|
||||
* @return int Creole native type (e.g. CreoleTypes::LONGVARCHAR, CreoleTypes::BINARY, etc.).
|
||||
*/
|
||||
public static function getType($nativeType)
|
||||
{
|
||||
$t = strtolower($nativeType);
|
||||
if (isset(self::$typeMap[$t])) {
|
||||
return self::$typeMap[$t];
|
||||
} else {
|
||||
return CreoleTypes::TEXT; // because SQLite is typeless
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return a native type that corresponds to the specified
|
||||
* Creole (JDBC-like) type. Remember that this is really only for "hint" purposes
|
||||
* as SQLite is typeless.
|
||||
*
|
||||
* If there is more than one matching native type, then the LAST defined
|
||||
* native type will be returned.
|
||||
*
|
||||
* @param int $creoleType
|
||||
* @return string Native type string.
|
||||
*/
|
||||
public static function getNativeType($creoleType)
|
||||
{
|
||||
if (self::$reverseMap === null) {
|
||||
self::$reverseMap = array_flip(self::$typeMap);
|
||||
}
|
||||
return @self::$reverseMap[$creoleType];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteDatabaseInfo.php,v 1.3 2004/03/20 04:16:50 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/metadata/DatabaseInfo.php';
|
||||
|
||||
/**
|
||||
* SQLite implementation of DatabaseInfo.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.3 $
|
||||
* @package creole.drivers.sqlite.metadata
|
||||
*/
|
||||
class SQLiteDatabaseInfo extends DatabaseInfo {
|
||||
|
||||
/**
|
||||
* @throws SQLException
|
||||
* @return void
|
||||
*/
|
||||
protected function initTables()
|
||||
{
|
||||
include_once 'creole/drivers/sqlite/metadata/SQLiteTableInfo.php';
|
||||
|
||||
$sql = "SELECT name FROM sqlite_master WHERE type='table' UNION ALL SELECT name FROM sqlite_temp_master WHERE type='table' ORDER BY name;";
|
||||
$result = sqlite_query($this->dblink, $sql);
|
||||
|
||||
if (!$result) {
|
||||
throw new SQLException("Could not list tables", sqlite_last_error($this->dblink));
|
||||
}
|
||||
|
||||
while ($row = sqlite_fetch_array($result)) {
|
||||
$this->tables[strtoupper($row[0])] = new SQLiteTableInfo($this, $row[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SQLite does not support sequences.
|
||||
*
|
||||
* @return void
|
||||
* @throws SQLException
|
||||
*/
|
||||
protected function initSequences()
|
||||
{
|
||||
// throw new SQLException("MySQL does not support sequences natively.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: SQLiteTableInfo.php,v 1.8 2005/10/18 02:27:50 hlellelid Exp $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://creole.phpdb.org>.
|
||||
*/
|
||||
|
||||
require_once 'creole/metadata/TableInfo.php';
|
||||
|
||||
/**
|
||||
* MySQL implementation of TableInfo.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @version $Revision: 1.8 $
|
||||
* @package creole.drivers.sqlite.metadata
|
||||
*/
|
||||
class SQLiteTableInfo extends TableInfo {
|
||||
|
||||
/** Loads the columns for this table. */
|
||||
protected function initColumns()
|
||||
{
|
||||
|
||||
include_once 'creole/metadata/ColumnInfo.php';
|
||||
include_once 'creole/metadata/PrimaryKeyInfo.php';
|
||||
include_once 'creole/drivers/sqlite/SQLiteTypes.php';
|
||||
|
||||
// To get all of the attributes we need, we'll actually do
|
||||
// two separate queries. The first gets names and default values
|
||||
// the second will fill in some more details.
|
||||
|
||||
$sql = "PRAGMA table_info('".$this->name."')";
|
||||
|
||||
$res = sqlite_query($this->conn->getResource(), $sql);
|
||||
|
||||
|
||||
while($row = sqlite_fetch_array($res, SQLITE_ASSOC)) {
|
||||
|
||||
$name = $row['name'];
|
||||
|
||||
$fulltype = $row['type'];
|
||||
$size = null;
|
||||
$precision = null;
|
||||
$scale = null;
|
||||
|
||||
if (preg_match('/^([^\(]+)\(\s*(\d+)\s*,\s*(\d+)\s*\)$/', $fulltype, $matches)) {
|
||||
$type = $matches[1];
|
||||
$precision = $matches[2];
|
||||
$scale = $matches[3]; // aka precision
|
||||
} elseif (preg_match('/^([^\(]+)\(\s*(\d+)\s*\)$/', $fulltype, $matches)) {
|
||||
$type = $matches[1];
|
||||
$size = $matches[2];
|
||||
} else {
|
||||
$type = $fulltype;
|
||||
}
|
||||
// If column is primary key and of type INTEGER, it is auto increment
|
||||
// See: http://sqlite.org/faq.html#q1
|
||||
$is_auto_increment = ($row['pk'] == 1 && $fulltype == 'INTEGER');
|
||||
$not_null = $row['notnull'];
|
||||
$is_nullable = !$not_null;
|
||||
|
||||
$default_val = $row['dflt_value'];
|
||||
|
||||
$this->columns[$name] = new ColumnInfo($this, $name, SQLiteTypes::getType($type), $type, $size, $precision, $scale, $is_nullable, $default_val);
|
||||
|
||||
if (($row['pk'] == 1) || (strtolower($type) == 'integer primary key')) {
|
||||
if ($this->primaryKey === null) {
|
||||
$this->primaryKey = new PrimaryKeyInfo($name);
|
||||
}
|
||||
$this->primaryKey->addColumn($this->columns[ $name ]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->colsLoaded = true;
|
||||
}
|
||||
|
||||
/** Loads the primary key information for this table. */
|
||||
protected function initPrimaryKey()
|
||||
{
|
||||
// columns have to be loaded first
|
||||
if (!$this->colsLoaded) $this->initColumns();
|
||||
// keys are loaded by initColumns() in this class.
|
||||
$this->pkLoaded = true;
|
||||
}
|
||||
|
||||
/** Loads the indexes for this table. */
|
||||
protected function initIndexes() {
|
||||
|
||||
include_once 'creole/metadata/IndexInfo.php';
|
||||
|
||||
// columns have to be loaded first
|
||||
if (!$this->colsLoaded) $this->initColumns();
|
||||
|
||||
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
|
||||
$docuroot = explode( '/', $realdocuroot );
|
||||
array_pop( $docuroot );
|
||||
$pathhome = implode( '/', $docuroot ) . '/';
|
||||
array_pop( $docuroot );
|
||||
$pathTrunk = implode( '/', $docuroot ) . '/';
|
||||
require_once($pathTrunk.'gulliver/system/class.inputfilter.php');
|
||||
$filter = new InputFilter();
|
||||
|
||||
$sql = "PRAGMA index_list('".$this->name."')";
|
||||
$res = sqlite_query($this->conn->getResource(), $sql);
|
||||
|
||||
while($row = sqlite_fetch_array($res, SQLITE_ASSOC)) {
|
||||
$name = $row['name'];
|
||||
$name = $filter->validateInput($name);
|
||||
$this->indexes[$name] = new IndexInfo($name);
|
||||
|
||||
// get columns for that index
|
||||
$var = "PRAGMA index_info('".$name."')";
|
||||
$res2 = sqlite_query($this->conn->getResource(), $var);
|
||||
while($row2 = sqlite_fetch_array($res2, SQLITE_ASSOC)) {
|
||||
$colname = $row2['name'];
|
||||
$this->indexes[$name]->addColumn($this->columns[ $colname ]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->indexesLoaded = true;
|
||||
}
|
||||
|
||||
/** Load foreign keys (unsupported in SQLite). */
|
||||
protected function initForeignKeys() {
|
||||
|
||||
// columns have to be loaded first
|
||||
if (!$this->colsLoaded) $this->initColumns();
|
||||
|
||||
// No fkeys in SQLite
|
||||
|
||||
$this->fksLoaded = true;
|
||||
}
|
||||
|
||||
}
|
||||
3
gulliver/thirdparty/html2ps_pdf/box.php
vendored
3
gulliver/thirdparty/html2ps_pdf/box.php
vendored
@@ -494,7 +494,8 @@ function &create_pdf_pseudoelement($root, $pe_type, &$pipeline) {
|
||||
$pipeline);
|
||||
break;
|
||||
default:
|
||||
die('Unsupported "display" value: '.$display_handler->get($css_state->getState()));
|
||||
error_log('Unsupported display value: '.$display_handler->get($css_state->getState()));
|
||||
die;
|
||||
}
|
||||
|
||||
// Check if this box needs a block wrapper (for example, floating button)
|
||||
|
||||
3
gulliver/thirdparty/pear/Net/FTP.php
vendored
3
gulliver/thirdparty/pear/Net/FTP.php
vendored
@@ -1433,7 +1433,8 @@ class Net_FTP extends PEAR
|
||||
}
|
||||
|
||||
if (!@is_dir($filter->validatePath($local_p))) {
|
||||
$res = @mkdir($filter->validatePath($local_p));
|
||||
$sLocal_p = $filter->validatePath($local_p);
|
||||
$res = @mkdir($sLocal_p);
|
||||
if (!$res) {
|
||||
return $this->raiseError("Could not create dir '$local_p'",
|
||||
NET_FTP_ERR_CREATELOCALDIR_FAILED);
|
||||
|
||||
@@ -366,7 +366,7 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
|
||||
$command = $filter->validateInput($command);
|
||||
|
||||
if (empty($options['dry-run'])) {
|
||||
$fp = popen($command, "r");
|
||||
$fp = popen($command, 'r');
|
||||
while ($line = fgets($fp, 1024)) {
|
||||
$this->output .= rtrim($line)."\n";
|
||||
}
|
||||
@@ -429,7 +429,7 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
|
||||
$this->output .= "+ $cmd\n";
|
||||
}
|
||||
if ($execute) {
|
||||
$fp = popen($cmd, "r");
|
||||
$fp = popen($cmd, 'r');
|
||||
while ($line = fgets($fp, 1024)) {
|
||||
$this->output .= rtrim($line)."\n";
|
||||
}
|
||||
@@ -544,7 +544,7 @@ Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
|
||||
$input = $this->ui->userDialog($command,
|
||||
array('GnuPG Passphrase'),
|
||||
array('password'));
|
||||
$gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/package.xml 2>/dev/null", "w");
|
||||
$gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/package.xml 2>/dev/null", 'w');
|
||||
if (!$gpg) {
|
||||
return $this->raiseError("gpg command failed");
|
||||
}
|
||||
|
||||
6
gulliver/thirdparty/phing/Phing.php
vendored
6
gulliver/thirdparty/phing/Phing.php
vendored
@@ -60,6 +60,8 @@ include_once 'phing/system/util/Register.php';
|
||||
*/
|
||||
class Phing {
|
||||
|
||||
const inclDir = 'include_path';
|
||||
|
||||
/** The default build file name */
|
||||
const DEFAULT_BUILD_FILENAME = "build.xml";
|
||||
|
||||
@@ -858,7 +860,9 @@ class Phing {
|
||||
}
|
||||
$firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
|
||||
if (is_dir($firstPath[0])) {
|
||||
ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
|
||||
$sPath = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts))
|
||||
$inclDir = self::inclDir;
|
||||
ini_set($inclDir, $sPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
7
gulliver/thirdparty/phing/lib/Capsule.php
vendored
7
gulliver/thirdparty/phing/lib/Capsule.php
vendored
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
class Capsule {
|
||||
|
||||
const inclDir = 'include_path';
|
||||
/**
|
||||
* Look for templates here (if relative path provided).
|
||||
* @var string
|
||||
@@ -126,11 +127,13 @@ class Capsule {
|
||||
if(strpos($path,":")>0){
|
||||
$firstPath = explode(":", $path);
|
||||
if (is_dir($firstPath[0])) {
|
||||
ini_set('include_path', $path);
|
||||
$inclDir = self::inclDir;
|
||||
ini_set($inclDir, $path);
|
||||
}
|
||||
} else {
|
||||
if(is_dir($path)) {
|
||||
ini_set('include_path', $path);
|
||||
$inclDir = self::inclDir;
|
||||
ini_set($inclDir, $path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ include_once 'phing/types/Path.php';
|
||||
*/
|
||||
class IncludePathTask extends TaskPhing {
|
||||
|
||||
const inclDir = 'include_path';
|
||||
|
||||
/**
|
||||
* Classname of task to register.
|
||||
* This can be a dot-path -- relative to a location on PHP include_path.
|
||||
@@ -109,7 +111,9 @@ class IncludePathTask extends TaskPhing {
|
||||
if ($new_parts) {
|
||||
$this->log("Prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts), PROJECT_MSG_VERBOSE);
|
||||
if(is_dir(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)))) {
|
||||
set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
|
||||
$sPath = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts));
|
||||
$inclDir = self::inclDir;
|
||||
ini_set($inclDir, $sPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -526,7 +526,7 @@ class PHPMailer {
|
||||
if ($this->Debugoutput == "error_log") {
|
||||
error_log($str);
|
||||
} else {
|
||||
echo $str;
|
||||
error_log($str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
gulliver/thirdparty/tcpdf/tcpdf.php
vendored
3
gulliver/thirdparty/tcpdf/tcpdf.php
vendored
@@ -18281,7 +18281,7 @@ class TCPDF {
|
||||
* @author Nicola Asuni
|
||||
* @since 4.6.005 (2009-04-24)
|
||||
*/
|
||||
public function setSignature($signing_cert='', $private_key='', $private_key_p='', $extracerts='', $cert_type=2, $info=array()) {
|
||||
public function setSignature($signing_cert='', $private_key='', $private_key_p='tcpdfdemo', $extracerts='', $cert_type=2, $info=array()) {
|
||||
// to create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
|
||||
// to export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
|
||||
// to convert pfx certificate to pem: openssl
|
||||
@@ -18293,7 +18293,6 @@ class TCPDF {
|
||||
$this->signature_data = array();
|
||||
if (strlen($signing_cert) == 0) {
|
||||
$signing_cert = 'file://'.dirname(__FILE__).'/tcpdf.crt';
|
||||
$private_key_p = 'tcpdfdemo';
|
||||
}
|
||||
if (strlen($private_key) == 0) {
|
||||
$private_key = $signing_cert;
|
||||
|
||||
@@ -228,6 +228,8 @@ try {
|
||||
|
||||
echo 'Done!' . "\n";
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . "\n" );
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,9 @@ try {
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . "\n" );
|
||||
|
||||
eprintln('Problem in workspace: ' . $workspace . ' it was omitted.', 'red');
|
||||
}
|
||||
@@ -325,7 +327,9 @@ try {
|
||||
unlink(PATH_CORE . 'config' . PATH_SEP . '_databases_.php');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . "\n";
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . "\n" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,10 +59,10 @@ function run_create_translation($args, $opts)
|
||||
CLI::logging("Updating labels Mafe ...\n");
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n";
|
||||
G::outRes( "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
||||
$translation->generateTransaltionMafe($lang);
|
||||
} catch (Exception $e) {
|
||||
echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error(G::getErrorMessage($e)) . "\n";
|
||||
G::outRes( "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error(G::getErrorMessage($e)) . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ function run_workspace_upgrade($args, $opts) {
|
||||
$workspace->upgrade($first, false, $workspace->name, $lang);
|
||||
$first = false;
|
||||
} catch (Exception $e) {
|
||||
echo "Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,11 +335,11 @@ function run_translation_upgrade($args, $opts) {
|
||||
$first = true;
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
echo "Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n";
|
||||
G::outRes( "Upgrading translation for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
||||
$workspace->upgradeTranslation($first);
|
||||
$first = false;
|
||||
} catch (Exception $e) {
|
||||
echo "Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "Errors upgrading translation of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,14 +353,13 @@ function run_cacheview_upgrade($args, $opts) {
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
foreach ($workspaces as $workspace) {
|
||||
try {
|
||||
echo "Upgrading cache view for " . pakeColor::colorize($workspace->name, "INFO") . "\n";
|
||||
G::outRes( "Upgrading cache view for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
||||
$workspace->upgradeCacheView(true, false, $lang);
|
||||
} catch (Exception $e) {
|
||||
echo "Errors upgrading cache view of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "Errors upgrading cache view of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function run_plugins_database_upgrade($args, $opts) {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
@@ -441,7 +440,7 @@ function database_upgrade($command, $args) {
|
||||
echo "> OK\n";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,10 +672,10 @@ function run_database_generate_self_service_by_value($args, $opts)
|
||||
$workspace = $value;
|
||||
|
||||
try {
|
||||
echo "Generating the table \"self-service by value\" for " . pakeColor::colorize($workspace->name, "INFO") . "\n";
|
||||
G::outRes( "Generating the table \"self-service by value\" for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
||||
$workspace->appAssignSelfServiceValueTableGenerateData();
|
||||
} catch (Exception $e) {
|
||||
echo "Errors generating the table \"self-service by value\" of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "Errors generating the table \"self-service by value\" of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
@@ -684,7 +683,7 @@ function run_database_generate_self_service_by_value($args, $opts)
|
||||
|
||||
echo "Done!\n";
|
||||
} catch (Exception $e) {
|
||||
echo CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,7 +753,7 @@ function run_migrate_itee_to_dummytask($args, $opts){
|
||||
$ws = new workspaceTools($workspace->name);
|
||||
$res = $ws->migrateIteeToDummytask($workspace->name);
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -813,7 +812,7 @@ function run_check_workspace_disabled_code($args, $opts)
|
||||
echo "The workspace it's OK\n\n";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "Errors to check disabled code: " . CLI::error($e->getMessage()) . "\n\n";
|
||||
G::outRes( "Errors to check disabled code: " . CLI::error($e->getMessage()) . "\n\n" );
|
||||
}
|
||||
|
||||
$workspace->close();
|
||||
@@ -821,7 +820,7 @@ function run_check_workspace_disabled_code($args, $opts)
|
||||
|
||||
echo "Done!\n";
|
||||
} catch (Exception $e) {
|
||||
echo CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +837,7 @@ function migrate_new_cases_lists($command, $args, $opts) {
|
||||
$workspace->migrateList($workspace->name, true, $lang);
|
||||
echo "> List tables are done\n";
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -854,7 +853,7 @@ function migrate_counters($command, $args) {
|
||||
|
||||
echo "> Counters are done\n";
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,7 +871,7 @@ function migrate_list_unassigned($command, $args, $opts) {
|
||||
$workspace->regenerateListUnassigned();
|
||||
echo "> Unassigned List is done\n";
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,9 @@ if (! defined ('SYS_SYS')) {
|
||||
processWorkspace ();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage ();
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
eprintln ("Problem in workspace: " . $sObject . ' it was omitted.', 'red');
|
||||
}
|
||||
eprintln ();
|
||||
|
||||
@@ -173,7 +173,9 @@ class Dashboard extends Controller
|
||||
//G::pr($this->pmDashlet->setup( $width ));die;
|
||||
} catch (Exception $error) {
|
||||
//ToDo: Show the error message
|
||||
echo $error->getMessage();
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($error, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -343,8 +343,6 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
case 'showEncodes':
|
||||
//G::LoadThirdParty( 'pear/json', 'class.json' );
|
||||
//$oJSON =
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$engine = $_POST['engine'];
|
||||
@@ -352,10 +350,10 @@ switch ($action) {
|
||||
if ($engine != "0") {
|
||||
$dbs = new dbConnections();
|
||||
$var = Bootstrap::json_encode($dbs->getEncondeList($filter->xssFilterHard($engine)));
|
||||
echo $var;
|
||||
G::outRes($var);
|
||||
|
||||
} else {
|
||||
echo '[["0","..."]]';
|
||||
G::outRes('[["0","..."]]');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,10 @@ if (isset( $_REQUEST['action'] )) {
|
||||
$varEcho = '{success: true}';
|
||||
G::outRes( $varEcho );
|
||||
} catch (Exception $ex) {
|
||||
echo '{success: false, error: ' . $ex->getMessage() . '}';
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($ex, $token);
|
||||
$resJson = '{success: false, error: ' . G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . '}';
|
||||
G::outRes( $resJson );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -993,6 +993,9 @@ try {
|
||||
die($sOutput);
|
||||
}
|
||||
} catch (Exception $oException) {
|
||||
die($oException->getMessage() . "\n" . $oException->getTraceAsString());
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($oException, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,9 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
||||
}
|
||||
//End plugin
|
||||
} catch (Exception $e) {
|
||||
print ($e->getMessage()) ;
|
||||
$token = strtotime("now");
|
||||
PMException::registerErrorLog($e, $token);
|
||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,12 +92,12 @@ try {
|
||||
switch ((int) $_POST['TU_RELATION']) {
|
||||
case 1:
|
||||
$resh = htmlentities($oTasks->assignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']), ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
echo $res;
|
||||
G::outRes($resh);
|
||||
G::auditlog("AssignUserTask","Assign a User to a Task -> ".$_POST['TAS_UID'].' User UID -> '.$_POST['USR_UID']);
|
||||
break;
|
||||
case 2:
|
||||
$resh = htmlentities($oTasks->assignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']), ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
echo $resh;
|
||||
G::outRes($resh);
|
||||
G::auditlog("AssignGroupTask","Assign a Group to a Task -> ".$_POST['TAS_UID'].' User UID -> '.$_POST['USR_UID']);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user