Skip to content

Commit 811ea56

Browse files
committed
fix setup and groups
1 parent 3899608 commit 811ea56

File tree

9 files changed

+17
-32
lines changed

9 files changed

+17
-32
lines changed

includes/class/cardinal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function __construct() {
2828
$sek = md5(time() . time() . time());
2929

3030
$db = require(ABSPATH . 'includes/database_info.php');
31-
$this->db = new Mysqlidb($db['server_name'], $db['username'], $db['password'], $db['name'], $db['port'], true);
31+
$this->db = new Mysqlidb($db['server_name'], $db['username'], $db['password'], $db['name'], $db['port']);
3232
$this->db->setTrace (true);
3333

3434
// get current page | not very secure method

includes/class/loginSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function getUserPermissions($groupID)
154154

155155
function getGroupPermissions($groupId)
156156
{
157-
$user_permissions = $this->db->where('group_id', $groupId)->getOne('groups');
157+
$user_permissions = $this->db->where('group_id', $groupId)->getOne('user_groups');
158158

159159
return $user_permissions;
160160
} // getGroupPermissions

includes/class/oclass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function mes_all()
469469
} //$_POST
470470
}
471471

472-
function sendMessageToRanks($ranks = array(), $message, $title, $org_id = false)
472+
function sendMessageToRanks($ranks = [], $message = '', $title = '', $org_id = false)
473473
{
474474
if (count($ranks)) {
475475
if (!$org_id) $org_id = $this->organization['id'];

includes/install/DB.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ CREATE TABLE `friend_requests` (
371371
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
372372

373373

374-
CREATE TABLE `groups` (
374+
CREATE TABLE `user_groups` (
375375
`group_id` smallint(6) NOT NULL,
376376
`name` varchar(255) NOT NULL DEFAULT '',
377377
`view_debug` tinyint(1) DEFAULT NULL,
@@ -394,7 +394,7 @@ CREATE TABLE `groups` (
394394
`noRank` int(11) NOT NULL
395395
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
396396

397-
INSERT INTO `groups` (`group_id`, `name`, `view_debug`, `wikiManager`, `questManager`, `userList`, `cardinal`, `instant_tasks`, `manageUsers`, `manageDuality`, `adminNav`, `manageAchievements`, `dailyRep`, `maxBlogs`, `levelManager`, `dataManager`, `forumManager`, `globalQuestManager`, `emailTemplatesManager`, `noRank`) VALUES
397+
INSERT INTO `user_groups` (`group_id`, `name`, `view_debug`, `wikiManager`, `questManager`, `userList`, `cardinal`, `instant_tasks`, `manageUsers`, `manageDuality`, `adminNav`, `manageAchievements`, `dailyRep`, `maxBlogs`, `levelManager`, `dataManager`, `forumManager`, `globalQuestManager`, `emailTemplatesManager`, `noRank`) VALUES
398398
(1, 'Alpha CEO (Admin)', 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 4, 127, 1, 1, 1, 1, 1, 1),
399399
(2, 'Hacker', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, NULL, 0, 0, 0, 0),
400400
(10, '(MM) Mission Manager', 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 4, 2, 0, 0, 0, 0, 0, 0),
@@ -3010,7 +3010,7 @@ ALTER TABLE `friendships`
30103010
ALTER TABLE `friend_requests`
30113011
ADD PRIMARY KEY (`request_id`);
30123012

3013-
ALTER TABLE `groups`
3013+
ALTER TABLE `user_groups`
30143014
ADD PRIMARY KEY (`group_id`);
30153015

30163016
ALTER TABLE `hackdown_arena`
@@ -3303,7 +3303,7 @@ ALTER TABLE `friendships`
33033303
ALTER TABLE `friend_requests`
33043304
MODIFY `request_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
33053305

3306-
ALTER TABLE `groups`
3306+
ALTER TABLE `user_groups`
33073307
MODIFY `group_id` smallint(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
33083308

33093309
ALTER TABLE `hackdown_arena`

includes/modules/admin/manageUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$cardinal->redirect(URL_C);
2121

2222
} //$_POST
23-
$groups = $db->get('groups', null, 'group_id, name');
23+
$groups = $db->get('user_groups', null, 'group_id, name');
2424
$tVars['groups'] = $groups;
2525
$tVars['load'] = 'credentials';
2626

includes/modules/cron/rankings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
/******
144144
HANDLE NO RANK GROUPS
145145
*******/
146-
$noRankGroups = $db->where('noRank', 1)->get('groups', null, 'group_id');
146+
$noRankGroups = $db->where('noRank', 1)->get('user_groups', null, 'group_id');
147147
$noRankGroupsIds = array();
148148
foreach ($noRankGroups as $g) $noRankGroupsIds[] = $g['group_id'];
149149

includes/modules/setup.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,11 @@
1010
die('DB.sql is missing - expected in: ' . $dbFile);
1111
}
1212

13-
require("../includes/class/registrationSystem.php");
13+
require "../includes/class/registrationSystem.php";
1414

1515
if ($_POST['DB_HOST']) {
16-
if ($_POST['data'] == 'yes') {
17-
try {
18-
file_get_contents('http://api.nenuadrian.com/?sr3install=true');
19-
} catch (Exception $ex) {
20-
21-
}
22-
}
2316
try {
24-
$dbTest = new Mysqlidb($_POST['DB_HOST'], $_POST['DB_USER'], $_POST['DB_PASS'], $_POST['DB_NAME'], $_POST['DB_PORT'], true);
17+
$dbTest = new Mysqlidb($_POST['DB_HOST'], $_POST['DB_USER'], $_POST['DB_PASS'], $_POST['DB_NAME'], $_POST['DB_PORT']);
2518
$dbTest->rawQuery('SHOW TABLES');
2619
} catch (Exception $ex) {
2720
echo $ex->getMessage();
@@ -30,7 +23,7 @@
3023
// create database_info.php
3124
$configs = file_get_contents(ABSPATH . '/includes/database_info.php.template');
3225
echo $configs;
33-
foreach($_POST as $k => $v) {
26+
foreach ($_POST as $k => $v) {
3427
$configs = str_replace($k, $v, $configs);
3528
}
3629
file_put_contents(ABSPATH . '/includes/database_info.php', $configs);
@@ -40,10 +33,10 @@
4033

4134
// import database
4235
$db = require(ABSPATH . '/includes/database_info.php');
43-
$db = new Mysqlidb($db['server_name'], $db['username'], $db['password'], $db['name'], $db['port'], true);
36+
$db = new Mysqlidb($db['server_name'], $db['username'], $db['password'], $db['name'], $db['port']);
4437

4538
try {
46-
foreach($sqls as $sql) {
39+
foreach ($sqls as $sql) {
4740
if ($sql) {
4841
$db->rawQuery($sql);
4942
}
@@ -53,15 +46,15 @@
5346
echo $ex->getMessage();
5447
die();
5548
}
56-
49+
5750
// create admin account
5851
$cardinal = new Cardinal();
5952
$registrationSystem = new RegistrationSystem;
6053
$uid = $registrationSystem->addUser($_POST['ADMIN_USER'], $_POST['ADMIN_PASS'], $_POST['ADMIN_EMAIL'], 1, 1, false);
6154
$db->where('uid', $uid)->update('user_credentials', array(
6255
'group_id' => 1,
6356
'email_confirmed' => 1
64-
));
57+
));
6558
$cardinal->redirect(URL);
6659
}
6760

public_html/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
if(!ob_start("ob_gzhandler")) ob_start();
55
error_reporting(E_ALL ^E_NOTICE);
6-
ini_set( 'display_errors','1');
6+
ini_set( 'display_errors','0');
77
ini_set("pcre.jit", "0");
88

99
date_default_timezone_set("Europe/London");

templates/setup.tpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
<input type="text" placeholder="ADMIN PASS" value="" name="ADMIN_PASS" required/>
1313
<input type="email" placeholder="ADMIN EMAIL" value="" name="ADMIN_EMAIL" required/>
1414
<br/><br/>
15-
<p>Send anonymous minimal data to Adrian Nenu usage statistics server?</p>
16-
<p><small>This will send a ping to notify me of you installing the game without any IP information being recorded.</small></p>
17-
<br/>
18-
<select name="data" required>
19-
<option value="yes">YES</option>
20-
<option value="no">NO</option>
21-
</select>
22-
<br/><br/>
2315
<button type="submit" style="border-top:0;">SETUP</button>
2416
</div>
2517
</div>

0 commit comments

Comments
 (0)