-
Notifications
You must be signed in to change notification settings - Fork 61
/
config.php
150 lines (120 loc) · 5.12 KB
/
config.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
//moodle integration (please view moodle_integration_readme.txt before use)
//The require path below is the path to the moodle installation config file
//this needs to be the path from root rather than something like ../../moodle/config.php
//e.g. this might be something like require("/home/yourdomain/public_html/config.php");
//set this same path in moodle_integration.txt also
//require("/xampp/htdocs/moodle/config.php");
/**
*
* Config page, sets up the site variable from the database
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
/**
* $xerte_toolkits_site variable
* Variable used to hold database settings
* @global object $xerte_toolkits_site
*/
// Same as error_reporting(E_ALL);
global $xerte_toolkits_site;
// Change this to FALSE for production sites.
global $development;
$development = true;
ini_set('error_reporting', 0);
if ($development) {
ini_set('error_reporting', E_ALL);
}
require_once(dirname(__FILE__) . '/functions.php');
require_once(dirname(__FILE__) . '/library/autoloader.php');
if (!isset($xerte_toolkits_site)) {
// create new generic object to hold all our config stuff in....
$xerte_toolkits_site = new StdClass();
/**
* Access the database to get the variables
*/
if (!is_file(dirname(__FILE__) . '/database.php')) {
die("please run /setup");
}
require_once(dirname(__FILE__) . '/database.php');
require_once(dirname(__FILE__) . '/website_code/php/database_library.php');
if (!database_connect("", "")) {
die("database.php isn't correctly configured; cannot connect to database; have you run /setup?");
}
$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}sitedetails");
/**
* Access the database to get the variables
* @version 1.0
* @author Patrick Lockley
* @copyright 2008,2009 University of Nottingham
*/
/**
* Include any script that is used for configuration - for moodle this might be e.g. '/xampp/htdocs/moodle/config.php'.
*/
if ($row['integration_config_path'] != "") {
require_once($row['integration_config_path']);
}
unset($row['integration_config_path']);
foreach($row as $key => $value) {
$xerte_toolkits_site->$key = $value;
}
// awkward ones.
$xerte_toolkits_site->mimetypes = explode(",", $row['mimetypes']);
$xerte_toolkits_site->name = $row['site_name'];
$xerte_toolkits_site->demonstration_page = $xerte_toolkits_site->site_url . $row['demonstration_page'];
$xerte_toolkits_site->news_text = base64_decode($row['news_text']);
$xerte_toolkits_site->pod_one = base64_decode($row['pod_one']);
$xerte_toolkits_site->pod_two = base64_decode($row['pod_two']);
$xerte_toolkits_site->copyright = utf8_decode($row['copyright']);
/**
* Set up the string for the password protected play page
*/
$xerte_toolkits_site->form_string = base64_decode($row['form_string']);
/**
* Set up the string for the peer review page
*/
$xerte_toolkits_site->peer_form_string = base64_decode($row['peer_form_string']);
$xerte_toolkits_site->basic_template_path = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->module_path;
$xerte_toolkits_site->users_file_area_full = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short;
/**
* SQL query string used by play,edit and preview pages
*/
$xerte_toolkits_site->play_edit_preview_query = base64_decode($row['play_edit_preview_query']);
/**
* Error handling settings
*/
$xerte_toolkits_site->error_log_path = $xerte_toolkits_site->root_file_path . $row['error_log_path'];
$xerte_toolkits_site->flash_flv_skin = $xerte_toolkits_site->site_url . $row['flash_flv_skin'];
/* Optional :
require_once("session_handler.php");
$session_handle = new toolkits_session_handler();
session_set_save_handler(
array($session_handle,'xerte_session_open'),
array($session_handle,'xerte_session_close'),
array($session_handle,'xerte_session_read'),
array($session_handle,'xerte_session_write'),
array($session_handle,'xerte_session_destroy'),
array($session_handle,'xerte_session_clean'));
*/
/**
*Change this to reflect the authentication mechanism you wish to use.
* Possible values: Ldap, Db, Static and Guest. (perhaps soon also Moodle).
*Guest will let anyone login as the same user, once they click 'Login'.
*
* See code in library/Xerte/Authentication/*.php - where each file should match up to the value used below.
*/
$xerte_toolkits_site->authentication_method = 'Guest';
//$xerte_toolkits_site->authentication_method = 'Ldap';
//$xerte_toolkits_site->authentication_method = 'Db';
//$xerte_toolkits_site->authentication_method = 'Static';
//$xerte_toolkits_site->authentication_method = "Moodle";
if($xerte_toolkits_site->authentication_method == "Moodle") {
// skip session_start() as we'll probably stomp on Moodle's session if we do.
}
else {
session_start();
}
}