-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathindex.php
96 lines (81 loc) · 2.84 KB
/
index.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
87
88
89
90
91
92
93
94
95
96
<?php
require 'header.php';
//If config.php doesn't exist, probably not installed
if ((!file_exists("config.php"))) {
require_once(__DIR__ . "/install/install.php");
$install = new install(getFullURL());
exit();
} else if (vanshavali::firstTime() or vanshavali::firstTimeFamily()) {
//installation still imcomplete
require_once(__DIR__ . "/install/install.php");
$install = new install(getFullURL());
exit();
}
//Now that the things are installed
global $template, $user;
//Check if config.php is readable if not then tell user to set the permissions manually
if (!is_readable("config.php")) {
$template->header();
$template->display("config.error.tpl");
exit();
}
//Check for wordpress id and redirect if not
if (vanshavali::$wp_login && $user->is_authenticated()) {
$wpid = $user->user['wordpress_user'];
if (empty($wpid)) {
$_SESSION['redirect_to'] = "index.php?set_wordpress_id=true";
header("Location:oauthlogin.php");
}
}
//If they have come back from the page with the wpid
if (vanshavali::$wp_login && $_GET['set_wordpress_id'] == "true") {
$current_user = vanshavali::getmember($_SESSION['id']);
$current_user->set("wordpress_user", $_SESSION['wpid']);
}
//Display the header and basic contents
$template->header();
$template->assign(array(
'authenticated' => $user->is_authenticated(),
'membername' => $_SESSION['membername']
));
// $template->display("user.main.new.tpl");
//$template->display("infovis.tpl");
$template->assign(array(
'authenticated' => $user->is_authenticated()
));
if ($user->is_authenticated()) {
if (is_null($user->user['sonof'])) {
$template->assign(array("user_not_connected" => true,
"userimage" => (empty($user->user['profilepic']) ? "common.png" : $user->user['proilepic'])));
} else {
$template->assign("id", $user->user['id']);
$template->display("showuser.tpl");
}
} else {
$template->assign(array("userimage" => "common.png"));
}
//Show this when the user has arrived from change password page
if ($_GET['passwordchanged']) {
$template->display("forgotpassword.success.tpl");
}
$template->display("newlayout.tpl");
//Check if all the members have wordpress ID
if ($user::check_all_wordpress()) {
$template->assign("wp_login", vanshavali::$wp_login);
}
else
{
$template->assign("wp_login", false);
}
$template->display("login.form.tpl");
$template->display('forgotpassword.modal.tpl');
//$template->display('search.form.tpl');
$template->display("feedback.form.tpl");
if ($user->is_authenticated()) {
$template->display('operations.add.form.tpl');
$template->display('operations.remove.tpl');
$template->display('operations.edit.tpl');
$template->display('operations.addspouse.tpl');
$template->display('operations.addparents.form.tpl');
$template->display("suggest.tpl");
}