-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
executable file
·177 lines (134 loc) · 7.38 KB
/
install.php
File metadata and controls
executable file
·177 lines (134 loc) · 7.38 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env php
<?php
# install.php the CLI script to obtain the configuration details and then
# call the modules/tracker/setup.php script
#
# created 2015/03/10 by Dave Henderson (dhenderson@cliquesoft.org or support@cliquesoft.org)
# updated 2019/11/19 by Dave Henderson (dhenderson@cliquesoft.org or support@cliquesoft.org)
#
# Unless a valid Cliquesoft Proprietary License (CPLv1) has been purchased
# for this device, this software is licensed under the Cliquesoft Public
# License (CPLv2) as found on the Cliquesoft website at www.cliquesoft.org
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the appropriate Cliquesoft License for details.
#
# NOTES:
# - readline was not used due to it not being standard in php builds
# Variables typically found in config.php
$gbl_errs=array();
$gbl_info=array();
$linkDB;
$info=array();
$exit=0;
# ask all the install questions below before handing over control to the setup.php script
echo "\nGeneral\n";
echo "--------------------------------------------------------------------------------\n";
echo " Please provide the 'No Reply Name': ";
$txtNoReplyName = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'No Reply Email': ";
$txtNoReplyEmail = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Hacker Name': ";
$txtHackersName = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Hacker Email': ";
$txtHackersEmail = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Cracker Name': ";
$txtCrackersName = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Cracker Email': ";
$txtCrackersEmail = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Terms URI': ";
$txtTermsURI = rtrim(fgets(STDIN), "\n");
echo " Please provide the 'Wiki URI': ";
$txtWikiURI = rtrim(fgets(STDIN), "\n");
echo " Would you like to allow anonymous posting of issues? [Y/N]: ";
$cmbAnonIssues = rtrim(fgets(STDIN), "\n");
if (strtolower($cmbAnonIssues) == 'y') { $cmbAnonIssues='true'; } else { $cmbAnonIssues='false'; }
echo " Would you like to enable the use of captchas? [Y/N]: ";
$cmbCaptchas = rtrim(fgets(STDIN), "\n");
if (strtolower($cmbCaptchas) == 'y') { $cmbCaptchas='true'; } else { $cmbCaptchas='false'; }
echo " Would you like to host as a service to others? [Y/N]: ";
$cmbHosted = rtrim(fgets(STDIN), "\n");
if (strtolower($cmbHosted) == 'y') { $cmbHosted='true'; } else { $cmbHosted='false'; }
echo "\nSQL Server\n";
echo "--------------------------------------------------------------------------------\n";
echo " Please provide the full URI for the SQL server: ";
$txtAppSQLHost = rtrim(fgets(STDIN), "\n");
echo " Please provide the name of the database storing the data: ";
$txtAppSQLName = rtrim(fgets(STDIN), "\n");
echo " Please provide the username to access the database (as r/o): ";
$txtAppSQLUserRO = rtrim(fgets(STDIN), "\n");
echo " Please provide the password to access the database (as r/o): ";
$txtAppSQLPassRO = rtrim(fgets(STDIN), "\n");
echo " Please provide the username to access the database (as r/w): ";
$txtAppSQLUserRW = rtrim(fgets(STDIN), "\n");
echo " Please provide the password to access the database (as r/w): ";
$txtAppSQLPassRW = rtrim(fgets(STDIN), "\n");
echo "\nSQL Tables\n";
echo "--------------------------------------------------------------------------------\n";
echo " Please provide the prefix to apply to the DB tables used by this software:\n";
echo " ";
$txtAppSQLPrefix = rtrim(fgets(STDIN), "\n");
echo " Please provide the optional name of an existing DB table containing your user\n";
echo " accounts: ";
$txtAppSQLTable = rtrim(fgets(STDIN), "\n");
if ($txtAppSQLTable == '') { # if the user did NOT specify an 'Accounts' table mapping, then store blank values for these variables...
$txtAppSQLFirst = '';
$txtAppSQLLast = '';
$txtAppSQLAlias = '';
$txtAppSQLUsername = '';
$txtAppSQLEmail = '';
$txtAppSQLUID = '';
$txtAppSQLSID = '';
} else { # otherwise, we need to get the values for these variables, so lets ask the user!
echo "\nDB Mappings\n";
echo "--------------------------------------------------------------------------------\n";
echo " Please provide the existing DB field name containing the users first name:\n";
echo " ";
$txtAppSQLFirst = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users last name:\n";
echo " ";
$txtAppSQLLast = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users alias:\n";
echo " ";
$txtAppSQLAlias = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users username:\n";
echo " ";
$txtAppSQLUsername = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users email address:\n";
echo " ";
$txtAppSQLEmail = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users primary key:\n";
echo " ";
$txtAppSQLUID = rtrim(fgets(STDIN), "\n");
echo " Please provide the existing DB field name containing the users session id(s):\n";
echo " ";
$txtAppSQLSID = rtrim(fgets(STDIN), "\n");
}
echo "\n--------------------------------------------------------------------------------\n";
echo "At this point, no changes have been made to the system. Do you wish to install\n";
echo "the software using the above configuration? [Y/N]: ";
$install = rtrim(fgets(STDIN), "\n");
if (strtolower($install) != 'y') {
echo "\n The installation has been cancelled.\n\n";
exit();
}
# LEFT OFF - test that the ERROR code below is triggered instead of 'successfully installed...'
# add in the EMAIL config.tracker.php variable in the above questions
if (! @chdir('code')) { # change into the 'code' directory so the following code works right
echo "\n*** ERROR ***\n";
echo "There was a problem changing into the 'code' directory, exiting.\n\n";
exit();
}
# now start the installation
$gbl_errs['error'] = '';
exec("php -f tracker.setup.php action=install target=software txtNoReplyName=\"$txtNoReplyName\" txtNoReplyEmail=\"$txtNoReplyEmail\" txtHackersName=\"$txtHackersName\" txtHackersEmail=\"$txtHackersEmail\" txtCrackersName=\"$txtCrackersName\" txtCrackersEmail=\"$txtCrackersEmail\" txtTermsURI=\"$txtTermsURI\" txtWikiURI=\"$txtWikiURI\" cmbAnonIssues=\"$cmbAnonIssues\" cmbCaptchas=\"$cmbCaptchas\" cmbHosted=\"$cmbHosted\" txtAppSQLHost=\"$txtAppSQLHost\" txtAppSQLName=\"$txtAppSQLName\" txtAppSQLUserRO=\"$txtAppSQLUserRO\" txtAppSQLPassRO=\"$txtAppSQLPassRO\" txtAppSQLUserRW=\"$txtAppSQLUserRW\" txtAppSQLPassRW=\"$txtAppSQLPassRW\" txtAppSQLPrefix=\"$txtAppSQLPrefix\" txtAppSQLTable=\"$txtAppSQLTable\" txtAppSQLFirst=\"$txtAppSQLFirst\" txtAppSQLLast=\"$txtAppSQLLast\" txtAppSQLAlias=\"$txtAppSQLAlias\" txtAppSQLUsername=\"$txtAppSQLUsername\" txtAppSQLEmail=\"$txtAppSQLEmail\" txtAppSQLUID=\"$txtAppSQLUID\" txtAppSQLSID=\"$txtAppSQLSID\"", $info, $exit);
if ($exit == 0) { # if there was NOT a problem with the installation, then...
echo "\nThe software has been installed successfully!\n\n";
} else { # otherwise, show the error message!
echo "\n*** ERROR ***\n";
# LEFT OFF - replace the $gbl_errs[] below with a generic message to check your email for the complete erro
echo preg_replace("(\</*f\>|\</*msg\>)", '', $gbl_errs['error']."\n\n");
# $info[0]
}
?>