-
Notifications
You must be signed in to change notification settings - Fork 0
/
community-redirect.php
86 lines (69 loc) · 2.36 KB
/
community-redirect.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
<?php
include 'classes/classes.php';
session_start();
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
foreach ($_GET as $key => $value) {
if ($key == 'filter' || $key == 'facet') {
$vars[$key] = filter_var_array($value);
} else {
$vars[$key] = filter_var(rawurldecode($value), FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
}
}
//print_r($vars);
if (isset($vars['errorID'])) {
$errorID = new Error();
$errorID->getByID($vars['errorID']);
}
if (!$vars['type'])
$vars['type'] = 'home';
if (!$vars['page'] && $vars['type'] != 'account')
$vars['page'] = 1;
if (!$vars['q'])
$vars['q'] = '*';
if (!isset($_SESSION['communities']) || !isset($_SESSION['communities'][$vars['portalName']])) {
$community = new Community();
$community->getByPortalName($vars['portalName']);
if (!$community->id && $community->id != 0) {
header('location:/404/' . $vars['portalName']);
exit();
}
$community->getCategories();
$holder = new Component();
$components = $holder->getByCommunity($community->id);
$community->components = $components;
$_SESSION['communities'][$vars['portalName']] = $community;
} else {
$community = $_SESSION['communities'][$vars['portalName']];
}
if ($vars['editmode']) {
if (!isset($_SESSION['user']) || $_SESSION['user']->levels[$community->id] < 2)
$vars['editmode'] = false;
}
if ($community->private == 1 && (!isset($_SESSION['user']) || $_SESSION['user']->levels[$community->id] < 1)) {
header('location:/private/' . $vars['portalName']);
exit();
}
if ($vars['type'] == 'home')
include 'communities/home.php';
elseif ($vars['type'] == 'account')
include 'communities/profile.php';
elseif ($vars['type'] == 'search')
include 'communities/search.php';
elseif ($vars['type'] == 'about') {
if ($vars['title'] == 'resource')
include 'communities/resource.php';
elseif ($vars['title'] == 'faq')
include 'communities/faqs.php';
elseif ($vars['title'] == 'sources')
include 'communities/pages.php';
elseif ($vars['title'] == 'registry')
include 'communities/registry.php';
elseif ($vars['title'] == 'search')
include 'communities/content-search.php';
else
include 'communities/component-data.php';
} elseif ($vars['type'] == 'join') {
include 'communities/join.php';
}
?>