Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
f792ae3
Merge pull request #159 from HackThis/admin-dashboard
lwward Sep 29, 2014
f5719c7
Merge pull request #160 from HackThis/admin-dashboard
lwward Sep 30, 2014
aff6159
Removed no-margin from contributer header
lwward Sep 30, 2014
418e96a
Added parsing to name in profile
Oct 25, 2014
5bbd51d
Fix isPackageInstalled false positives
alexeypetrenko Oct 29, 2014
6a5e3a1
Merge pull request #163 from alexeypetrenko/master
lwward Oct 30, 2014
b1974b9
Fixing bug #139 - Moving from message dropdown to full view
Nov 17, 2014
b643817
Merge pull request #164 from doronlinder/master
lwward Nov 21, 2014
63021d1
Changed socket URI
lwward Nov 21, 2014
05b5501
#164 tweaks
Nov 21, 2014
e85e17d
Removed debug code in notifications.js
lwward Nov 21, 2014
4fee3f4
Fixed spacing in inbox.js
lwward Nov 21, 2014
f371543
Removed unneeded code from notifications.js
lwward Nov 21, 2014
55b8a22
Fixed modal position on mobile devices
lwward Dec 2, 2014
72b7343
Fixed modal position on mobile devices
lwward Dec 2, 2014
296a9ce
Live levels class
Dec 8, 2014
e5a266d
Bug fix for incorrect level checking code
lwward Dec 8, 2014
861604e
Added block for users with score 0 and karma < 0
lwward Jan 5, 2015
3f81c81
Fixed level checks with actual answers
Jan 5, 2015
5dd37ea
Fixed modal position
Jan 5, 2015
a9129e9
Level and modal fixes
Jan 5, 2015
a931fc5
Updated API access
Feb 20, 2015
cc348d7
Added ability to remove flags from admin panel. Flags are now marked …
Feb 20, 2015
605328b
Added clickable links to admin sections
Feb 20, 2015
ba97846
Added stats to forum sidebar
Feb 20, 2015
ac7eef8
Fixed merge conflict interaction.scss
lwward Feb 23, 2015
2917f8a
Logout users when account is deleted
Apr 9, 2015
934ad16
Removed call to WeChal from level complete
Apr 9, 2015
68968fa
Merge branch 'master' of github.com:HackThis/hackthis.co.uk
Apr 9, 2015
a8beb8d
Set position absolute for modal in mobile view
Apr 9, 2015
42943b9
Added wechall back in to levels script
lwward Apr 13, 2015
a92d1d0
Remove invalid co
lwward Apr 25, 2015
ba9f6fe
Fixed profile history links to forum posts to use GET variable instea…
May 1, 2015
93fbcd7
Update terms.php
Rex-Mundi May 8, 2015
ffe4db2
Fix a little spelling mistake.
MrCyph3r May 8, 2015
d9f1c84
Merge pull request #168 from Rex-Mundi/master
lwward May 8, 2015
35eb8a3
Merge pull request #169 from MrCyph3r/spelling
lwward May 8, 2015
94699fd
Update register.php
Rex-Mundi May 11, 2015
5dc536f
Merge pull request #170 from Rex-Mundi/patch-2
lwward May 18, 2015
ebce6eb
Fix a little spelling mistake.
MrCyph3r Jun 3, 2015
7b343f5
Merge pull request #171 from MrCyph3r/spelling
lwward Jun 5, 2015
5dbb158
Add LDAP as the primary authentication model. MySQL kept as backup
Jun 12, 2015
0df217c
Fixed mathematical error in class.cache.php
Jun 12, 2015
7a45eed
Fixed SSL error when connecting to paypal via curl
Jun 12, 2015
7915ca6
Limit site news to only be visible on the homepage for 2 weeks
Jun 12, 2015
d3c32e8
Removing old elements from home articles
Jun 12, 2015
06a4dcc
Tweaked home intro
Jun 12, 2015
c6694d1
Changed advert sections and where they are included
Jun 12, 2015
8b7c547
Fixed forum completed level sections check
Jun 12, 2015
f8304c5
Removed unused files
Jun 12, 2015
3ce38de
Added styles for forum sidebar stats section
Jun 12, 2015
7964dbf
Fixed gramatical error in ticker
Jun 12, 2015
48788dc
Removed fallback Gravatar image
Jun 12, 2015
d657e1b
Removing unused files
Jun 12, 2015
3bd376c
Removed t-shirt unavailability message from donation page
Jun 12, 2015
af5417b
Added override for console.log to obfuscate level answers a little
Jun 12, 2015
62d0394
Added number formating to IRC stats template
Jun 12, 2015
2fd75c1
Check for minifier before adding wysiwyg.js
Jun 12, 2015
2aa9370
Moved majority of static resources to CDN
Jun 12, 2015
ad9cc69
Removing project status image, service seems to be buggy
lwward Jun 12, 2015
61fd8b0
Changed README test
lwward Jun 12, 2015
5eef461
Added Google Authentication
lwward Jun 12, 2015
891772c
Fixed errors with 2FA
Jun 12, 2015
3ab3152
Tweaked wording on enter 2FA code login box
lwward Jun 12, 2015
32db154
Added title to entry on Google Auth
lwward Jun 12, 2015
2429ff0
Changed 2FA field to number for easier input on mobile devices
Jun 15, 2015
f670a94
Added extra forum checks
lwward Jun 15, 2015
cf977ec
Fixed mistake in forum verification
lwward Jun 15, 2015
59b0df7
Moved fetch outside if, fixing problem restricting all users posting …
lwward Jun 15, 2015
b0a96ec
Make user.googleAuth function more flexible
lwward Jun 16, 2015
fa3bd7e
Disable old users from using expired password hashes
lwward Jun 16, 2015
e2fbebe
Added online status indicator to levels that need it
Jun 22, 2015
5b19cf3
Remove ability to use old password hashes
Jun 22, 2015
a10f6e9
Remove ability to use old password hashes
Jun 22, 2015
0ec28f1
Fixed merge
Jun 22, 2015
3bfb8c8
Fixed warnings on level pages
lwward Jun 23, 2015
6dba153
Fixed warnings on levels
lwward Jun 23, 2015
926412f
Fixed warning on forum pages
lwward Jun 23, 2015
18c96dc
fix(cache): cache wasn't loading the file contents of cache files
lwward Jun 23, 2015
e26eb40
fix(levels): caching wasn't working correctly
lwward Jun 23, 2015
070ad4f
fix(levels): cache wasn't working
lwward Jun 23, 2015
bae7a3d
fix(levels): level caching
lwward Jun 26, 2015
b44a010
fix(settings): fixing warning
lwward Jun 29, 2015
9dd6b54
Added fields to SQL to track details on moderator flags
Jul 19, 2015
e2be11b
feat(admin): Improved admin access to user access controls
Jul 19, 2015
eed342d
fix(admin) timestamps in moderator logs
Jul 22, 2015
beef012
Fixing mod_reports table definition to pass installation
Jul 30, 2015
63b32a5
Adding cdns to content security policy so that site will run locally …
Jul 30, 2015
9c2fe12
Installation requires ldap support for php or server won't work (no r…
Jul 30, 2015
5299f71
Merge pull request #177 from doronlinder/master
lwward Jul 31, 2015
c2cd745
Fix(install): Fixing 500 internal server error (Apache2 on Ubuntu)
LauraRozier Dec 17, 2015
05e05fb
Update view.php
xb8 Feb 22, 2016
b2015e6
Allowing use of 'data:' for pictures
Amaterasu27 Mar 8, 2016
12e9047
Merge pull request #190 from Amaterasu27/patch-2
lwward Mar 31, 2016
87b3968
Added spoiler tag
L3gand Jun 15, 2016
b4235ef
Bug fix on user name
L3gand Jun 15, 2016
d932d32
Bug fix on user name #2
L3gand Jun 15, 2016
c45d510
Bug fix on user name #3
L3gand Jun 15, 2016
314df40
Update wysiwyg.php
L3gand Jun 16, 2016
5ba5a5e
Update faq.php
AgraFL Jul 1, 2016
568a5ba
Update faq.php
AgraFL Jul 1, 2016
78f2882
Merge pull request #1 from ChrononGit/ChrononGit-patch-1
AgraFL Jul 1, 2016
934c0d4
Merge pull request #196 from ChrononGit/master
lwward Jul 1, 2016
6995d68
Merge pull request #195 from L3gand/patch-1
lwward Jul 1, 2016
761b3a1
Merge pull request #194 from L3gand/patch-4
lwward Jul 1, 2016
e241c26
Merge pull request #193 from L3gand/patch-3
lwward Jul 1, 2016
32ff82b
Merge pull request #192 from L3gand/patch-2
lwward Jul 1, 2016
afcb3cc
Merge pull request #186 from xenob8/patch-1
lwward Jul 1, 2016
46f8392
Update class.admin.php
RichardBrook Jul 3, 2016
b342540
Merge pull request #198 from RichardBrook/patch-1
lwward Jul 5, 2016
120d4ed
Merge pull request #182 from thibmo/UbuntuInstall
lwward Jul 5, 2016
e9cca2f
Update class.admin.php
prockallsyms Aug 29, 2016
161cbe2
Fixed mismatched close thread CSRF key
lwward Sep 10, 2016
6530b44
Updated install_hackthis_windows.sh
Oct 20, 2016
9d63124
Update version_history.md
prockallsyms Nov 20, 2016
cc56727
Merge pull request #209 from Dom-1/patch-6
lwward Nov 21, 2016
3e42603
Dynamic label attribute "for"
May 23, 2017
a42b200
Added an option to mark messages as seen.
roun512 Jun 7, 2017
72e4c28
Update contact.php
x2600 Oct 21, 2017
3a628fc
Create hackers.txt
DIDIx13 Oct 29, 2017
2419596
Minus change
DIDIx13 Nov 13, 2017
fb9d4ba
Merge pull request #1 from DIDIx13/patch-2
DIDIx13 Nov 13, 2017
fc08268
Update more.php
DIDIx13 Nov 13, 2017
6f6d672
Update git.php
DIDIx13 Nov 13, 2017
bee0b19
Update version_history.md
DIDIx13 Nov 13, 2017
4b8d753
Update terms.php
DIDIx13 Dec 5, 2017
4459165
Fixed Grammar and corrected spelling
DIDIx13 Feb 26, 2018
7afedb6
Update robots.txt
DIDIx13 Feb 26, 2018
4bd0fdd
Update footer.php with link to Status
DIDIx13 Mar 16, 2018
11715fa
Merge pull request #227 from DIDIx13/patch-3
lwward May 15, 2018
432e21b
Merge pull request #235 from DIDIx13/patch-4
lwward May 15, 2018
995d16d
Merge pull request #226 from DIDIx13/patch-2
lwward May 15, 2018
75e241f
Merge pull request #216 from DIDIx13/master
lwward May 15, 2018
0e5d5a3
Merge pull request #215 from DIDIx13/patch-1
lwward May 15, 2018
a9b9fb9
Merge pull request #214 from x2600/patch-1
lwward May 15, 2018
5dacf62
Merge pull request #213 from roun512/master
lwward May 15, 2018
0e3376c
Merge pull request #212 from Felix-Pichard/master
lwward May 15, 2018
5025464
Merge pull request #206 from gala0sup/patch-1
lwward May 15, 2018
09db0ab
Merge pull request #204 from Dom-1/patch-5
lwward May 15, 2018
075dc4f
WYSIWYG spoiler button
May 15, 2018
89990c8
Updated CSP rules
May 15, 2018
76b5e66
Removed article comments
May 15, 2018
79687d6
Minor tweaks
May 15, 2018
95ec848
Fixed merge
May 15, 2018
2313411
Fixed syntax error
May 15, 2018
5870b28
Apache does not allow whitespaces in Order directive
r4v463 May 16, 2018
6b81f0a
Merge pull request #236 from r4v463/master
lwward May 18, 2018
9bdd38d
Fix error when password change
sekortest Aug 31, 2018
71f42ac
Merge pull request #237 from sekortest/master
lwward Aug 31, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
HackThis
========
[![project status](http://stillmaintained.com/HackThis/hackthis.co.uk.png)](http://stillmaintained.com/HackThis/hackthis.co.uk)

This repository contains all code for http://www.hackthis.co.uk.
This repository contains the majority of the code for security challenge site http://www.hackthis.co.uk.

## Installation Instructions

You can set up the site on your own local machine and help the development.
The specific instructions differ depending on your operating system.
Following are instructions for Windows and Ubuntu. In the end you can find a general description of the process for any other OS.
Following are instructions for Windows and Ubuntu. In the end, you can find a general description of the process for any other OS.

### Ubuntu Installation

Expand All @@ -17,7 +15,7 @@ Following are instructions for Windows and Ubuntu. In the end you can find a gen
git clone http://github.com/HackThis/hackthis.co.uk
```

2. Run the the installation script by using the following command
2. Run the installation script by using the following command
```
sudo ./install_hackthis_ubuntu.sh
```
Expand Down Expand Up @@ -55,7 +53,7 @@ Following are instructions for Windows and Ubuntu. In the end you can find a gen
Follow the instructions of the script until it's done.
If an error occurs, the script will let you know what to do.
Fix what's wrong and re-run the script until it ends successfully.
6. Open your broswer and navigate to
6. Open your browser and navigate to

```
http://localhost/hackthis/?generate
Expand Down Expand Up @@ -115,13 +113,13 @@ Following are instructions for Windows and Ubuntu. In the end you can find a gen
nano html/.htaccess
```

8. Create and configure config file. Change path to the path of your hackthis.co.uk directory, without trailing slash. Next set MySQL credentials to match those used in setup, database is `hackthis`. Facebook, twitter and lastfm API keys are not required but some features will not work correctly.
8. Create and configure config file. Change path to the path of your hackthis.co.uk directory, without trailing slash. Next set MySQL credentials to match those used in setup, database is `hackthis`. Facebook, Twitter and Lastfm API keys are not required but some features will not work correctly.
```
cp files/example.config.php files/config.php
nano files/config.php
```

9. Create and set new folder privilages
9. Create and set new folder privileges
```
mkdir html/files/css/min
mkdir html/files/css/min/light
Expand Down
129 changes: 126 additions & 3 deletions files/cache/version_history.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,125 @@
## 09-07-2016
* Fixed missing userbar image in user settings

## 06-07-2016
* Added Real level 7

## 30-06-2016
* Fixed Intermediate level 5
* Added spoiler tag to WYSIWYG editor - [L3gand](/user/L3gand)

## 16-06-2015
* Disabled users from logging in with old password hashes, forcing password reset

## 15-06-2015
* Added online indicators to levels that rely on external services
* Stricted forum checks added for newly registered users

## 12-06-2015
* Added two-factor authentication using Google Authenticator - [CygnusH33L](/user/CygnusH33L)

## 07-06-2015
* Spelling mistake in forum email - [MrCyph3r](/user/MrCyph3r)

## 06-06-2015
* Main authentication method switched to LDAP

## 08-05-2015
* Error in privacy document - [MrCyph3r](/user/MrCyph3r)
* Spelling mistake in Terms - [Rex-Mundi](/user/Rex_Mundi)

## 03-05-2015
* Hide latest news article from homepage after 2 weeks

## 01-05-2015
* Changed user profile history links for forum posts to go to the correct page

## 09-03-2015
* Tweaked IRC stats to format numbers and dates

## 15-02-2015
* Added basic forum stats

## 19-01-2015
* Grammatical fix - [tl0tr](/user/tl0tr)

## 21-11-2014
* Allow transition from dropdown message creator to full view - [singleton](/user/singleton)

## 25-09-2014
* Fixed XSS on profile - [darkl33ch](/user/darkl33ch)

## 20-09-2014
* Added Crypt 9
* Improved forum flagging

## 11-09-2014
* Notifications are automatically marked as read when viewing thread

## 09-09-2014
* Fixed profile level details
* Fixed access to solutions forum sections
* Fixed levels dropdown menu

## 07-09-2014
* Changed level layout

## 24-08-2014
* Switched emails to Mandrell

## 22-08-2014
* Fixed Basic+ forum links on level pages

## 16-08-2014
* Added privacy controls to show/hide users in online and scoreboard lists
* Added website field to user profile
* Converted more pages to be rendered by Twig

## 05-08-2014
* Added statuses to contact tickets

## 04-08-2014
* Trigger added to handle changes in medal rewards across all users

## 30-07-2014
* Added regex solutions to levels

## 29-07-2014
* Allow new threads to be created outside of leaf nodes
* Fixed solutions showing up to non-authorized users

## 28-07-2014
* Basic+ Level 6 added

## 26-07-2014
* Auto-login added

## 24-07-2014
* Solved spacing in BBCode blocks
* Fixed double spacing in BBCode code blocks - [DJDavid98](/user/djdavid98)
* Changed styling of home forum widget, added section details and created date
* Fixed missing breadcrumbs on forum thread list
* Added restricted solution discussion forum sections

## 23-07-2014
* Added the year to short dates not for the current year - [DJDavid98](/user/djdavid98)

## 21-07-2014
* Crypt Level 8 added - [sabretooth](/user/sabretooth)

## 19-07-2014
* Fixed bug in account deletion

## 02-07-2014
* Karma controls are now still accessible when a post is hidden

## 29-06-2014
* Added min length and filtered special characters in AJAX search - [verath](/user/verath)
* Made WeChall user scores depend only on solved levels - [dloser](/user/dloser)
* Navbar fix when no levels added - [dloser](/user/dloser)

## 22-06-2014
* Real Level 6 added
* Repaired friend removal from settings menu - [dloser](/user/dloser)

## 10-06-2014
Expand All @@ -13,7 +129,7 @@
* Added WeChall API pages

## 08-06-2014
* Fixed gramatical error in privacy statement - [sabretooth](/user/sabretooth)
* Fixed grammatical error in privacy statement - [sabretooth](/user/sabretooth)

## 09-05-2014
* Added H3 tag to BBCode
Expand Down Expand Up @@ -75,7 +191,7 @@
* W3C validation fixes - [DJDavid98](/user/djdavid98)
* Styling fix for invisible select elements - [DJDavid98](/user/djdavid98)

## 23-02-2104
## 23-02-2014
* Code added to handle plural articles on article contributors - [DJDavid98](/user/djdavid98)
* Footer grammar fix - [kamzhik](/user/kamzhik)

Expand Down Expand Up @@ -105,4 +221,11 @@
* Included a detailed list of changes for each new version
* Added slimdown, a markdown parser
* Added contributor medal
* Uploaded wider background image to match new site width
* Uploaded wider background image to match new site width



# Vulnerability disclosures
* [Pseudonym](/user/pseudonym) - 12/01/2013 - XSS, search results for forum title
* [Pseudonym](/user/pseudonym) - 05/01/2013 - PM subject showing up over multiple lines in navigation using script comments
* [Pseudonym](/user/pseudonym) - 05/01/2013 - Forum title, showing up in latest and feed
121 changes: 101 additions & 20 deletions files/class.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ class admin {
private $forum_reasons_posts = array('This post is not relevant to the thread. If you need help or want to post something that has not been discussed then please create a new thread. If you want to ask a user a specific question unrelated to the current topic please use the PM system.',
'This post is primarily an answer or has far more detail than is necessary to be helpful.',
'This post is primarily an advertisement with no disclosure. It is not useful or relevant, but promotional. If you are interested in advertising on our platform please contact us.',
'This post has severe formatting or content problems. Please be more considered when posting in future.',
'The communities first and only language is English. If you are feel you need to talk in another language please find another member who can speak that language and contact them directly via PM.',
'This post refers to a post that longer exists and is being removed just to tidy things up. Don\'t worry about this report.');
'This post has severe formatting or content problems. Please be more cautious when posting in future.',
'The communities first and only language is English. If you feel you need to talk in another language please find another member who can speak that language and contact them directly via PM.',
'This post refers to a post that no longer exists and is being removed just to tidy things up. Don\'t worry about this report.');
private $forum_reasons_threads = array('This thread is not relevant to this site. If you want to ask a user a specific question unrelated to the site topic please use the PM system.',
'This thread is primarily an answer or has far more detail than is necessary to be helpful.',
'This thread is primarily an advertisement with no disclosure. It is not useful or relevant, but promotional. If you are interested in advertising on our platform please contact us.',
'This thread has severe formatting or content problems. Please be more considered when posting in future.',
'The communities first and only language is English. If you are feel you need to talk in another language please find another member who can speak that language and contact them directly via PM.',
'This thread has severe formatting or content problems. Please be more cautious when posting in future.',
'The communities first and only language is English. If you feel you need to talk in another language please find another member who can speak that language and contact them directly via PM.',
'This thread has been removed to tidy things up. Don\'t worry about this report.');

public function __construct($app) {
$this->app = $app;
}

/******* TICKETS *******/
public function getUnreadTickets() {
$sql = "SELECT `mod_contact`.*, COUNT(a.message_id) AS `replies` FROM `mod_contact`
LEFT JOIN `mod_contact` a
Expand All @@ -32,27 +33,27 @@ public function getUnreadTickets() {
return $count;
}

public function getLatestForumFlags($limit = true) {
$sql = "SELECT MAX(forum_posts_flags.time) AS `latest`, COUNT(forum_posts_flags.post_id) AS `flags`, forum_posts_flags.reason, users.username, forum_threads.thread_id, forum_threads.slug, forum_threads.title, forum_posts.post_id, forum_posts.body
FROM forum_posts_flags
INNER JOIN forum_posts
ON forum_posts_flags.post_id = forum_posts.post_id
INNER JOIN forum_threads
ON forum_posts.thread_id = forum_threads.thread_id
INNER JOIN users
ON users.user_id = forum_posts.author
WHERE forum_posts.deleted = 0 AND forum_threads.deleted = 0
GROUP BY forum_posts_flags.post_id
ORDER BY `flags` DESC, `latest` DESC";
if ($limit) $sql .= " LIMIT 5";


/******* LOGS *******/
public function getModeratorLogs($limit = true) {
$sql = "SELECT `report_id`, `type`, `subject`, username, `time`
FROM mod_reports
INNER JOIN `users`
ON `users`.user_id = `mod_reports`.user_id
ORDER BY `report_id` DESC";
if ($limit) $sql .= " LIMIT 5";

$st = $this->app->db->prepare($sql);
$st->execute();
$result = $st->fetchAll();

return $result;
}



/******* ARTICLES *******/
public function getLatestArticleSubmissions($limit = true) {
$sql = "SELECT articles_draft.article_id, articles_draft.title, articles_draft.time, articles_categories.title AS `category`, users.username
FROM articles_draft
Expand All @@ -71,10 +72,48 @@ public function getLatestArticleSubmissions($limit = true) {
return $result;
}

public function getLatestArticleComments() {
$sql = "SELECT users.username, articles.title, articles_comments.time, articles_comments.comment
FROM articles_comments
INNER JOIN users
ON users.user_id = articles_comments.user_id
INNER JOIN articles
ON articles.article_id = articles_comments.article_id
WHERE articles_comments.deleted IS NULL
ORDER BY `time` DESC
LIMIT 5";

$st = $this->app->db->prepare($sql);
$st->execute();
$result = $st->fetchAll();

return $result;
}



// Forum
/******* FORUM *******/
public function getLatestForumFlags($limit = true) {
$sql = "SELECT MAX(forum_posts_flags.time) AS `latest`, COUNT(forum_posts_flags.post_id) AS `flags`, forum_posts_flags.reason, users.username, forum_threads.thread_id, forum_threads.slug, forum_threads.title, forum_posts.post_id, forum_posts.body
FROM forum_posts_flags
INNER JOIN forum_posts
ON forum_posts_flags.post_id = forum_posts.post_id
INNER JOIN forum_threads
ON forum_posts.thread_id = forum_threads.thread_id
INNER JOIN users
ON users.user_id = forum_posts.author
WHERE forum_posts.deleted = 0 AND forum_threads.deleted = 0 AND forum_posts_flags.response = 0
GROUP BY forum_posts_flags.post_id
ORDER BY `flags` DESC, `latest` DESC";
if ($limit) $sql .= " LIMIT 5";

$st = $this->app->db->prepare($sql);
$st->execute();
$result = $st->fetchAll();

return $result;
}

public function removeForumThread($thread_id, $reason, $extra) {
// Delete post
$deleted = $this->app->forum->deleteThread($thread_id);
Expand Down Expand Up @@ -147,5 +186,47 @@ public function removeForumPost($post_id, $reason, $extra) {

return true;
}



/******* USER MANAGEMENT *******/
public function getModerators() {
$query = "SELECT username, users.user_id AS `uid`, users_priv.*
FROM users_priv
INNER JOIN users
ON users.user_id = users_priv.user_id
WHERE users_priv.site_priv > 1 OR
users_priv.pm_priv > 1 OR
users_priv.forum_priv > 1 OR
users_priv.pub_priv > 1";

$st = $this->app->db->prepare($query);
$st->execute();
$result = $st->fetchAll();

return $result;
}

public function setModeratorPriv($user_id, $priv, $priv_value) {
// Check user has privilages
if ($this->app->user->site_priv < 2 || $user_id == '69') {
echo "No";
return;
}

if ($priv != 'site' && $priv != 'pm' && $priv != 'forum' && $priv != 'pub') {
return;
}

$priv = $priv.'_priv';

$this->app->db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

$st = $this->app->db->prepare("INSERT INTO users_priv (`user_id`, ".$priv.") VALUES (:uid, :priv_value) ON DUPLICATE KEY UPDATE ".$priv."=:priv_value");
$status = $st->execute(array(':uid'=>$user_id, ':priv_value'=>$priv_value));

print_r($status);
}

}
?>
?>
Loading