-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathactive_init.php
executable file
·77 lines (59 loc) · 2.27 KB
/
active_init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/* DOCUMENTOPIA.COM
******************************************************************************************
* This software is provided "as is", without warranty of any kind, express or implied,
* including but not limited to the warranties of merchantability, fitness for a particular
* purpose and noninfringement. In no event shall Documentopia.com LLC be liable for any
* claim, damages or other liability, whether in an action of contract, tort or otherwise,
* arising from, out of or in connection with Documentopia.com LLC or the use or other
* dealings with Documentopia.com LLC.
*
* Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* @link http://www.documentopia.com/licensing
*
* @author David Dula <coding@documentopia.com>
* @copyright - 2012 - Documentopia.com
******************************************************************************************
*/
define('DB_DEBUG', true);
define('DB_LOAD_FORGE', true);
error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT));
// This should be the base path to the database folder
if ( ! defined('BASEPATH')) {
define('BASEPATH', pathinfo(__FILE__, PATHINFO_DIRNAME).'/');
}
function get_instance() {
global $db;
if (isset($db)) {
$item->db = $db;
return ($item);
} else {
return (null);
}
}
function log_message($level = 'error', $message, $php_error = FALSE) {
if (DB_DEBUG) echo $message . "\n";
}
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') {
if (DB_DEBUG) echo $message . "\n";
}
// Open the configfile
include_once ('database.php');
require_once (BASEPATH . 'database/DB.php');
// Create The DB var
$db = DB($db['default']);
if (DB_LOAD_FORGE) {
require_once (BASEPATH . 'database/DB_forge.php');
require_once (BASEPATH . 'database/DB_utility.php');
require_once (BASEPATH . 'database/drivers/' . $db->dbdriver . '/' . $db->dbdriver . '_utility.php');
require_once (BASEPATH . 'database/drivers/' . $db->dbdriver . '/' . $db->dbdriver . '_forge.php');
$class = 'CI_DB_' . $db->dbdriver . '_forge';
$dbforge = new $class();
}
// At this point $db is set to the databaes adnd $dbforge is set to dbforge
$query = $db->get('table_name');
$row = $query->result_array();
print_r($row);
?>