-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP SESSION Prefix and IP check, engine constants and user_constants …
…as a function for better memory usage, add SQLite 3 driver, new loader for aditional database method, new REST HTPP method check, updated template engines: Mustache 2.13, Smarty 3.1.34, Twig 1.42.5, Twig 2.12.5, add Twig 3 support to PHP 7.2+, define Dwoo template as deprecated, Caches and captcha bugfix in PHP 5.4.x
- Loading branch information
1 parent
488ac37
commit f16eefd
Showing
1,372 changed files
with
68,496 additions
and
33,957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,3 @@ public function __destruct() { | |
$this->connection->close(); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
final class Sqlite3_db { | ||
private $connection; | ||
|
||
public function __construct($hostname, $username = null, $password = null, $database, $port = '3306', $charset = 'utf8mb4') | ||
{ | ||
$this->connection = new SQLite3($hostname.$database, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $password); | ||
|
||
if (!$this->connection) { | ||
throw new \Exception('Error: ' . $this->connection->lastErrorMsg() . '<br />Error No: ' . $this->connection->lastErrorCode()); | ||
} | ||
} | ||
|
||
public function query($sql){ | ||
//$query = $this->connection->query($sql); | ||
|
||
if ($stm = $this->connection->prepare($sql)) { | ||
|
||
$query = $stm->execute(); | ||
|
||
if (!$query instanceof \SQLite3Result || $query->numColumns() == 0) | ||
return true; | ||
|
||
|
||
$data = []; | ||
while ($row = $query->fetchArray(SQLITE3_ASSOC)) { | ||
$data[] = $row; | ||
} | ||
$result = new \stdClass(); | ||
$result->num_rows = (!empty($data)) ? count($data) : 0; | ||
$result->row = isset($data[0]) ? $data[0] : array(); | ||
$result->rows = $data; | ||
$query->finalize(); | ||
return $result; | ||
|
||
} else { | ||
throw new \Exception('Error: ' . $this->connection->lastErrorMsg() . '<br />Error No: ' . $this->connection->lastErrorCode() . '<br />' . $sql); | ||
} | ||
|
||
} | ||
|
||
public function escape($value) { | ||
return $this->connection->escapeString($value); | ||
} | ||
|
||
public function countAffected() { | ||
return $this->connection->changes(); | ||
} | ||
public function getLastId() { | ||
return $this->connection->lastInsertRowID(); | ||
} | ||
|
||
public function isConnected() { | ||
return ($this->connection) ? true : false; | ||
} | ||
|
||
public function __destruct() { | ||
$this->connection->close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.3 | ||
1.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ public function has($key) { | |
return isset($this->data[$key]); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,71 @@ | ||
<?php | ||
final class Request { | ||
public $get = array(); | ||
public $post = array(); | ||
public $cookie = array(); | ||
public $files = array(); | ||
public $server = array(); | ||
|
||
public function __construct() { | ||
$_GET = $this->clean($_GET); | ||
$_POST = $this->clean($_POST); | ||
$_REQUEST = $this->clean($_REQUEST); | ||
$_COOKIE = $this->clean($_COOKIE); | ||
$_FILES = $this->clean($_FILES); | ||
$_SERVER = $this->clean($_SERVER); | ||
|
||
$this->get = $_GET; | ||
$this->post = $_POST; | ||
$this->request = $_REQUEST; | ||
$this->cookie = $_COOKIE; | ||
$this->files = $_FILES; | ||
$this->server = $_SERVER; | ||
} | ||
|
||
public function clean($data) { | ||
if (is_array($data)) { | ||
foreach ($data as $key => $value) { | ||
unset($data[$key]); | ||
|
||
$data[$this->clean($key)] = $this->clean($value); | ||
} | ||
} else { | ||
$data = htmlspecialchars($data, ENT_COMPAT); | ||
} | ||
public $get = array(); | ||
public $post = array(); | ||
public $cookie = array(); | ||
public $files = array(); | ||
public $server = array(); | ||
public $method; | ||
|
||
return $data; | ||
} | ||
public function __construct() { | ||
$_GET = $this->clean($_GET); | ||
$_POST = $this->clean($_POST); | ||
$_REQUEST = $this->clean($_REQUEST); | ||
$_COOKIE = $this->clean($_COOKIE); | ||
$_FILES = $this->clean($_FILES); | ||
$_SERVER = $this->clean($_SERVER); | ||
|
||
$this->get = $_GET; | ||
$this->post = $_POST; | ||
$this->request = $_REQUEST; | ||
$this->cookie = $_COOKIE; | ||
$this->files = $_FILES; | ||
$this->server = $_SERVER; | ||
$this->method = (isset($this->server['REQUEST_METHOD'])) ? $this->clean($this->server['REQUEST_METHOD']) : false; | ||
} | ||
|
||
public function clean($data) { | ||
if (is_array($data)) { | ||
foreach ($data as $key => $value) { | ||
unset($data[$key]); | ||
|
||
$data[$this->clean($key)] = $this->clean($value); | ||
} | ||
} else { | ||
$data = htmlspecialchars($data, ENT_COMPAT); | ||
} | ||
|
||
return $data; | ||
} | ||
|
||
public function isPOST() { | ||
return $this->is('POST'); | ||
} | ||
public function isGET() { | ||
return $this->is('GET'); | ||
} | ||
public function isHEAD() { | ||
return $this->is('HEAD'); | ||
} | ||
public function isPUT() { | ||
return $this->is('PUT'); | ||
} | ||
public function isDELETE() { | ||
return $this->is('DELETE'); | ||
} | ||
public function isCONNECT() { | ||
return $this->is('CONNECT') ; | ||
} | ||
public function isOPTIONS() { | ||
return $this->is('OPTIONS') ; | ||
} | ||
public function isTRACE() { | ||
return $this->is('TRACE'); | ||
} | ||
public function isPATCH() { | ||
return $this->is('PATCH'); | ||
} | ||
public function is($method){ | ||
return ($this->method == $method) ? true : false; | ||
} | ||
} | ||
?> |
Oops, something went wrong.