|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Read-Only connection to a MySQL database. |
|
14
|
|
|
* |
|
15
|
|
|
* This class allows only SELECT queries to be performed through its |
|
16
|
|
|
* query() method for security reasons. |
|
17
|
|
|
* |
|
18
|
|
|
* PHP version 5.3 |
|
19
|
|
|
* |
|
20
|
|
|
* @category Xoops\Class\Database\MySQLDatabaseProxy |
|
21
|
|
|
* @package MySQLDatabaseProxy |
|
22
|
|
|
* @author Kazumi Ono <[email protected]> |
|
23
|
|
|
* @author readheadedrod <[email protected]> |
|
24
|
|
|
* @author Richard Griffith <[email protected]> |
|
25
|
|
|
* @copyright 2013 XOOPS Project (http://xoops.org) |
|
26
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
27
|
|
|
* @version Release: 2.6 |
|
28
|
|
|
* @link http://xoops.org |
|
29
|
|
|
* @since 2.6.0 |
|
30
|
|
|
* @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector. |
|
31
|
|
|
*/ |
|
32
|
|
|
|
|
33
|
|
|
class XoopsMySQLDatabaseProxy extends XoopsMySQLDatabase |
|
|
|
|
|
|
34
|
|
|
{ |
|
35
|
|
|
/** |
|
36
|
|
|
* perform a query on the database |
|
37
|
|
|
* |
|
38
|
|
|
* this method allows only SELECT queries for safety. |
|
39
|
|
|
* |
|
40
|
|
|
* @param string $sql a valid MySQL query |
|
41
|
|
|
* @param int $limit number of records to return |
|
42
|
|
|
* @param int $start offset of first record to return |
|
43
|
|
|
* |
|
44
|
|
|
* @return resource query result or FALSE if unsuccessful |
|
45
|
|
|
* @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector. |
|
46
|
|
|
*/ |
|
47
|
|
|
public function query($sql, $limit = 0, $start = 0) |
|
48
|
|
|
{ |
|
49
|
|
|
$this->deprecated(); |
|
50
|
|
|
$sql = ltrim($sql); |
|
51
|
|
|
if (!$this->allowWebChanges && strtolower(substr($sql, 0, 6)) !== 'select') { |
|
52
|
|
|
//trigger_error('Database updates are not allowed during processing of a GET request', E_USER_WARNING); |
|
53
|
|
|
return false; |
|
54
|
|
|
} |
|
55
|
|
|
return $this->queryF($sql, $limit, $start); |
|
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|