forked from jupiter126/hackits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
116 lines (97 loc) · 3.95 KB
/
settings.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
<?
///////////////////////////////////////////////////////////////////////////////////
// 888 888 d8888 .d8888b. 888 d8P 8888888 88888888888 .d8888b. //
// 888 888 d88888 d88P Y88b 888 d8P 888 888 d88P Y88b //
// 888 888 d88P888 888 888 888 d8P 888 888 Y88b. //
// 8888888888 d88P 888 888 888d88K 888 888 "Y888b. //
// 888 888 d88P 888 888 8888888b 888 888 "Y88b. //
// 888 888 d88P 888 888 888 888 Y88b 888 888 "888 //
// 888 888 d8888888888 Y88b d88P 888 Y88b 888 888 Y88b d88P //
// 888 888 d88P 888 "Y8888P" 888 Y88b 8888888 888 "Y8888P" //
///////////////////////////////////////////////////////////////////////////////////
// //
// File: settings.php //
// Version: 0.1 //
// Date: 13-10-2012 //
// Author(s): Sling //
// //
// Description: Site-wide settings //
// //
// Input: - //
// //
///////////////////////////////////////////////////////////////////////////////////
/* add ipv4 ranges where debug mode should be enabled */
$__DEVS = array(
'192.168.0.0/16',
'172.16.0.0/12',
'10.0.0.0/8',
);
require_once('scripts/init.php');
define('DOC_ROOT', dirname(__FILE__));
// MySQL settings
$dbhost = "localhost";
$dbport = 3306;
$dbname = "hackits";
$dbwriteuser = "hackits-write";
$dbreaduser = "hackits-read";
// Messages
$wrongpasserror = "Computer says no.";
$msg_notloggedin = "Not logged in";
// Course- and challenge-ID ranges
$minchallengeid = 0;
$maxchallengeid = 100000;
$mincourseid = 0;
$maxcourseid = 100000;
// Course system
$successpercentage = 75; // % of answers that need to be correct to 'pass' an examn
$retrytimeout = 3600; // seconds a user has to wait until retrying an examn
//////////////////////
// Private settings //
//////////////////////
// MySQL passwords
$dbwritepass = "";
$dbreadpass = "";
// Form passwords for staff
$challengeaddpass = "";
$courseaddpass = "";
// Fill private settings with secret data
require("private_settings.php");
$db = new PDOMySQL(array(
'host' => $dbhost,
'port' => $dbport,
'db' => $dbname,
'readuser' => $dbreaduser,
'readpass' => $dbreadpass,
'writeuser' => $dbwriteuser,
'writepass' => $dbwritepass,
));
require_once('getsmfuser.php');
//////////////////////
// Paths settings //
//////////////////////
//TODO: rewrite those using define();
$rootdir = '/var/www/hackits';
$subdir = '/hackits';
$forumdir = $subdir . '/forum';
$coursesdir = $subdir . '/courses';
$challengesdir = $subdir . '/challenges';
$frontdir = $subdir . '/frontpage';
$imgdir = $frontdir . '/img';
$cssdir = $frontdir . '/css';
$jsdir = $frontdir . '/js';
$shareddir = $frontdir . '/shared';
//////////////////////
// Useful methods //
//////////////////////
function isCurrentPage($path) {
$currentPath = pathinfo( $_SERVER['PHP_SELF'] );
$currentPath = $currentPath['dirname'].'/'.$currentPath['basename'];
$path = pathinfo($path);
$path = $path['dirname'].'/'.$path['basename'];
return $currentPath===$path;
}
function renameTitle($title) {
$title = strtolower($title);
$title = str_replace(" ","_", $title);
return $title;
}