This repository has been archived by the owner on May 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_page.php
72 lines (61 loc) · 1.73 KB
/
admin_page.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
<?php
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
$pageId = $_GET['id'];
//Check if selected pages exist
if(!pageIdExists($pageId)){
header("Location: admin_pages.php"); die();
}
$pageDetails = fetchPageDetails($pageId); //Fetch information specific to page
//Forms posted
if(!empty($_POST)){
$update = 0;
if(!empty($_POST['private'])){ $private = $_POST['private']; }
//Toggle private page setting
if (isset($private) AND $private == 'Yes'){
if ($pageDetails['private'] == 0){
if (updatePrivate($pageId, 1)){
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("private"));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
}
elseif ($pageDetails['private'] == 1){
if (updatePrivate($pageId, 0)){
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("public"));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove permission level(s) access to page
if(!empty($_POST['removePermission'])){
$remove = $_POST['removePermission'];
if ($deletion_count = removePage($pageId, $remove)){
$successes[] = lang("PAGE_ACCESS_REMOVED", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
//Add permission level(s) access to page
if(!empty($_POST['addPermission'])){
$add = $_POST['addPermission'];
if ($addition_count = addPage($pageId, $add)){
$successes[] = lang("PAGE_ACCESS_ADDED", array($addition_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
$pageDetails = fetchPageDetails($pageId);
}
$pagePermissions = fetchPagePermissions($pageId);
$permissionData = fetchAllPermissions();
require_once("models/header.php");
include("models/menu.php");
include("include/html-templates/admin_page.php");
include("models/plugins.php");
?>