-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_config_vars.php
104 lines (91 loc) · 3.05 KB
/
get_config_vars.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
<?php
# ------------------------------------------------
# License and copyright:
# See license.txt for license information.
# ------------------------------------------------
# Check config.php vars
if ($MySQL_server == '') { die('$MySQL_server not set in config.php'); }
if ($MySQL_user == '') { die('$MySQL_user not set in config.php'); }
if ($MySQL_password == '') { die('$MySQL_password not set in config.php'); }
if ($MySQL_database == '') { die('$MySQL_database not set in config.php'); }
# Include the includes
include('evilness-filter.php');
include('functions.php');
# Set the siteURL
if ((isEmpty($_SERVER['HTTPS'])) || ((strtolower($_SERVER['HTTPS'])) == "off")) {
$siteURL = "http://" . $_SERVER['SERVER_NAME'];
}
else {
$siteURL = "https://" . $_SERVER['SERVER_NAME'];
}
# Set the responder directory
$directory_array = explode('/',$_SERVER['SCRIPT_NAME']);
if (sizeof($directory_array) <= 2) {
$ResponderDirectory = "/";
}
else {
$ResponderDirectory = "";
for ($i=1; $i < (sizeof($directory_array)-1); $i++) {
$ResponderDirectory = $ResponderDirectory . "/" . $directory_array[$i];
}
$max_i = sizeof($directory_array) - 1;
$this_file = $directory_array[$max_i];
}
# Figure out the newline character
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$newline = "\r\n";
}
elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$newline = "\r";
}
else {
$newline = "\n";
}
# Connect to the DB
$DB_LinkID = 0;
DB_connect();
# Ensure UTF8
mysql_query("SET NAMES 'utf8'");
# Check the table install
include_once('check_install.php');
# Check the config
$query = "SELECT * FROM InfResp_config";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
if (mysql_num_rows($result) < 1) {
# Grab the vars
$now = time();
$str1 = generate_random_block();
$str2 = generate_random_block();
# Setup the array
$config['Max_Send_Count'] = '500';
$config['Last_Activity_Trim'] = '6';
$config['random_str_1'] = $str1;
$config['random_str_2'] = $str2;
$config['random_timestamp'] = $now;
$config['admin_user'] = 'admin';
$config['admin_pass'] = '';
$config['charset'] = 'UTF-8';
$config['autocall_sendmails'] = '0';
$config['add_sub_size'] = '5';
$config['subs_per_page'] = '25';
$config['site_code'] = '';
$config['check_mail'] = '1';
$config['check_bounces'] = '1';
$config['tinyMCE'] = '1';
$config['daily_limit'] = '10000';
$config['daily_count'] = '0';
$config['daily_reset'] = $now;
# Insert the data
DB_Insert_Array('InfResp_config', $config);
# Set flag
$config_row_inserted = TRUE;
}
else {
$config = mysql_fetch_assoc($result);
$config_row_inserted = FALSE;
}
# Bad, but useful, hackery
$max_send_count = $config['max_send_count'];
$last_activity_trim = $config['last_activity_trim'];
$charset = $config['charset'];
?>