GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (423)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

system/database/drivers/sqlite3/sqlite3_driver.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 53 and the first side effect is on line 38.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * CodeIgniter
4
 *
5
 * An open source application development framework for PHP
6
 *
7
 * This content is released under the MIT License (MIT)
8
 *
9
 * Copyright (c) 2014 - 2015, British Columbia Institute of Technology
10
 *
11
 * Permission is hereby granted, free of charge, to any person obtaining a copy
12
 * of this software and associated documentation files (the "Software"), to deal
13
 * in the Software without restriction, including without limitation the rights
14
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
 * copies of the Software, and to permit persons to whom the Software is
16
 * furnished to do so, subject to the following conditions:
17
 *
18
 * The above copyright notice and this permission notice shall be included in
19
 * all copies or substantial portions of the Software.
20
 *
21
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
 * THE SOFTWARE.
28
 *
29
 * @package	CodeIgniter
30
 * @author	EllisLab Dev Team
31
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
32
 * @copyright	Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
33
 * @license	http://opensource.org/licenses/MIT	MIT License
34
 * @link	http://codeigniter.com
35
 * @since	Version 3.0.0
36
 * @filesource
37
 */
38
defined('BASEPATH') OR exit('No direct script access allowed');
39
40
/**
41
 * SQLite3 Database Adapter Class
42
 *
43
 * Note: _DB is an extender class that the app controller
44
 * creates dynamically based on whether the query builder
45
 * class is being used or not.
46
 *
47
 * @package		CodeIgniter
48
 * @subpackage	Drivers
49
 * @category	Database
50
 * @author		Andrey Andreev
51
 * @link		http://codeigniter.com/user_guide/database/
52
 */
53
class CI_DB_sqlite3_driver extends CI_DB {
54
55
	/**
56
	 * Database driver
57
	 *
58
	 * @var	string
59
	 */
60
	public $dbdriver = 'sqlite3';
61
62
	// --------------------------------------------------------------------
63
64
	/**
65
	 * ORDER BY random keyword
66
	 *
67
	 * @var	array
68
	 */
69
	protected $_random_keyword = array('RANDOM()', 'RANDOM()');
70
71
	// --------------------------------------------------------------------
72
73
	/**
74
	 * Non-persistent database connection
75
	 *
76
	 * @param	bool	$persistent
77
	 * @return	SQLite3
78
	 */
79
	public function db_connect($persistent = FALSE)
80
	{
81
		if ($persistent)
82
		{
83
			log_message('debug', 'SQLite3 doesn\'t support persistent connections');
84
		}
85
86
		try
87
		{
88
			return ( ! $this->password)
89
				? new SQLite3($this->database)
90
				: new SQLite3($this->database, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, $this->password);
91
		}
92
		catch (Exception $e)
93
		{
94
			return FALSE;
95
		}
96
	}
97
98
	// --------------------------------------------------------------------
99
100
	/**
101
	 * Database version number
102
	 *
103
	 * @return	string
104
	 */
105
	public function version()
106
	{
107
		if (isset($this->data_cache['version']))
108
		{
109
			return $this->data_cache['version'];
110
		}
111
112
		$version = SQLite3::version();
113
		return $this->data_cache['version'] = $version['versionString'];
114
	}
115
116
	// --------------------------------------------------------------------
117
118
	/**
119
	 * Execute the query
120
	 *
121
	 * @todo	Implement use of SQLite3::querySingle(), if needed
122
	 * @param	string	$sql
123
	 * @return	mixed	SQLite3Result object or bool
124
	 */
125
	protected function _execute($sql)
126
	{
127
		return $this->is_write_type($sql)
128
			? $this->conn_id->exec($sql)
129
			: $this->conn_id->query($sql);
130
	}
131
132
	// --------------------------------------------------------------------
133
134
	/**
135
	 * Begin Transaction
136
	 *
137
	 * @return	bool
138
	 */
139
	protected function _trans_begin()
140
	{
141
		return $this->conn_id->exec('BEGIN TRANSACTION');
142
	}
143
144
	// --------------------------------------------------------------------
145
146
	/**
147
	 * Commit Transaction
148
	 *
149
	 * @return	bool
150
	 */
151
	protected function _trans_commit()
152
	{
153
		return $this->conn_id->exec('END TRANSACTION');
154
	}
155
156
	// --------------------------------------------------------------------
157
158
	/**
159
	 * Rollback Transaction
160
	 *
161
	 * @return	bool
162
	 */
163
	protected function _trans_rollback()
164
	{
165
		return $this->conn_id->exec('ROLLBACK');
166
	}
167
168
	// --------------------------------------------------------------------
169
170
	/**
171
	 * Platform-dependant string escape
172
	 *
173
	 * @param	string
174
	 * @return	string
175
	 */
176
	protected function _escape_str($str)
177
	{
178
		return $this->conn_id->escapeString($str);
179
	}
180
181
	// --------------------------------------------------------------------
182
183
	/**
184
	 * Affected Rows
185
	 *
186
	 * @return	int
187
	 */
188
	public function affected_rows()
189
	{
190
		return $this->conn_id->changes();
191
	}
192
193
	// --------------------------------------------------------------------
194
195
	/**
196
	 * Insert ID
197
	 *
198
	 * @return	int
199
	 */
200
	public function insert_id()
201
	{
202
		return $this->conn_id->lastInsertRowID();
203
	}
204
205
	// --------------------------------------------------------------------
206
207
	/**
208
	 * Show table query
209
	 *
210
	 * Generates a platform-specific query string so that the table names can be fetched
211
	 *
212
	 * @param	bool	$prefix_limit
213
	 * @return	string
214
	 */
215
	protected function _list_tables($prefix_limit = FALSE)
216
	{
217
		return 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\''
218
			.(($prefix_limit !== FALSE && $this->dbprefix != '')
219
				? ' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix).'%\' '.sprintf($this->_like_escape_str, $this->_like_escape_chr)
220
				: '');
221
	}
222
223
	// --------------------------------------------------------------------
224
225
	/**
226
	 * Fetch Field Names
227
	 *
228
	 * @param	string	$table	Table name
229
	 * @return	array
230
	 */
231 View Code Duplication
	public function list_fields($table)
232
	{
233
		// Is there a cached result?
234
		if (isset($this->data_cache['field_names'][$table]))
235
		{
236
			return $this->data_cache['field_names'][$table];
237
		}
238
239
		if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
240
		{
241
			return FALSE;
242
		}
243
244
		$this->data_cache['field_names'][$table] = array();
245
		foreach ($result->result_array() as $row)
246
		{
247
			$this->data_cache['field_names'][$table][] = $row['name'];
248
		}
249
250
		return $this->data_cache['field_names'][$table];
251
	}
252
253
	// --------------------------------------------------------------------
254
255
	/**
256
	 * Returns an object with field data
257
	 *
258
	 * @param	string	$table
259
	 * @return	array
260
	 */
261 View Code Duplication
	public function field_data($table)
262
	{
263
		if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
264
		{
265
			return FALSE;
266
		}
267
268
		$query = $query->result_array();
269
		if (empty($query))
270
		{
271
			return FALSE;
272
		}
273
274
		$retval = array();
275
		for ($i = 0, $c = count($query); $i < $c; $i++)
276
		{
277
			$retval[$i]			= new stdClass();
278
			$retval[$i]->name		= $query[$i]['name'];
279
			$retval[$i]->type		= $query[$i]['type'];
280
			$retval[$i]->max_length		= NULL;
281
			$retval[$i]->default		= $query[$i]['dflt_value'];
282
			$retval[$i]->primary_key	= isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0;
283
		}
284
285
		return $retval;
286
	}
287
288
	// --------------------------------------------------------------------
289
290
	/**
291
	 * Error
292
	 *
293
	 * Returns an array containing code and message of the last
294
	 * database error that has occured.
295
	 *
296
	 * @return	array
297
	 */
298
	public function error()
299
	{
300
		return array('code' => $this->conn_id->lastErrorCode(), 'message' => $this->conn_id->lastErrorMsg());
301
	}
302
303
	// --------------------------------------------------------------------
304
305
	/**
306
	 * Replace statement
307
	 *
308
	 * Generates a platform-specific replace string from the supplied data
309
	 *
310
	 * @param	string	$table	Table name
311
	 * @param	array	$keys	INSERT keys
312
	 * @param	array	$values	INSERT values
313
	 * @return	string
314
	 */
315
	protected function _replace($table, $keys, $values)
316
	{
317
		return 'INSERT OR '.parent::_replace($table, $keys, $values);
318
	}
319
320
	// --------------------------------------------------------------------
321
322
	/**
323
	 * Truncate statement
324
	 *
325
	 * Generates a platform-specific truncate string from the supplied data
326
	 *
327
	 * If the database does not support the TRUNCATE statement,
328
	 * then this method maps to 'DELETE FROM table'
329
	 *
330
	 * @param	string	$table
331
	 * @return	string
332
	 */
333
	protected function _truncate($table)
334
	{
335
		return 'DELETE FROM '.$table;
336
	}
337
338
	// --------------------------------------------------------------------
339
340
	/**
341
	 * Close DB Connection
342
	 *
343
	 * @return	void
344
	 */
345
	protected function _close()
346
	{
347
		$this->conn_id->close();
348
	}
349
350
}
351