-
Notifications
You must be signed in to change notification settings - Fork 10
/
_common.php
137 lines (109 loc) · 5.38 KB
/
_common.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
/****************************************************************************\
* TaskFreak! *
* multi user *
******************************************************************************
* Version: 0.6.3 *
* Authors: Stan Ozier <[email protected]> *
* License: http://www.gnu.org/licenses/gpl.txt (GPL) *
******************************************************************************
* This file is part of "TaskFreak! multi user" program. *
* *
* TaskFreak! multi user is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; either version 2 of the License, or (at *
* your option) any later version. *
* *
* TaskFreak! multi user is distributed in the hope that it will be *
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
\****************************************************************************/
include './_include.php';
include PRJ_CLASS_PATH.'tzn_generic.php';
include PRJ_CLASS_PATH.TZN_DB_CLASS;
include PRJ_CLASS_PATH.'tzn_user.php';
include PRJ_CLASS_PATH.'pkg_member.php';
include PRJ_CLASS_PATH.'pkg_project.php';
header("Content-type: text/html; charset=".FRK_CHARSET);
session_start();
$objUser = new Member();
// === USER LOGIN ===================================================
if (!$pPageIsPublic) {
if ($pUserIsLogged = $objUser->isLogged($pLevel)) {
if ($objUser->load() != $_SESSION["tznUserId"]) {
// user is logged in but user ID is not same in session and in cookie
$objUser->logout();
$pUserIsLogged = false;
Tzn::redirect('login.php','ERROR:Session invalid, please log in again');
}
} else {
if ($pUserIsLogged = $objUser->checkAutoLogin()) {
// user is automatically logged in
} else {
// user is not logged in and tries to access private page
Tzn::redirect('login.php','ERROR:Please log in to access your account');
}
}
}
// === ANY MESSAGE ? ===============================================
if ($_SESSION['tznMessage']) {
$pMessageStatus = $_SESSION['tznMessage'];
unset($_SESSION['tznMessage']);
}
// === USER PREFERENCES =============================================
$pProjectId = 0;
if ($pUserIsLogged) {
// --- DEFAULTS -------------------------------------------------
$pDefaultUserId = ($_SESSION['selUser'])?$_SESSION['selUser']:$objUser->id;
// --- USER PROJECTS --------------------------------------------
$objUserProjectList = new ProjectStats();
$objUserProjectList->addOrder('statusKey ASC, name ASC');
// $objUserProjectList->addWhere('ps.statusKey < 40');
$objUserProjectList->addHaving('projectStatus_statusKey < 40');
$objUserProjectList->loadList($objUser->id,(!$objUser->checkLevel(6)));
// decide which is current project
if ($pProject = intval($_REQUEST['sProject'])) {
if (!$objUser->checkLevel(6)) {
// user can not see all projects
$objProjectCheck = new MemberProject();
if (!$objProjectCheck->loadPosition($pProject,$objUser->id))
{
// user is not a member this project
$pProject = 0;
$pMessageStatus = 'ERROR:No access to this project';
}
unset($objProjectCheck);
}
} else /* if ($_SESSION['sProject']) {
$pProject = $_SESSION['sProject'];
} else */ {
$pProject = 0;
}
// save team ID in session
//$_SESSION['sProject'] = $pProject;
// --- USER LIST ------------------------------------------------
$objUserList = new Member();
if (!$objUser->checkLevel(1)) {
$objUserList->addWhere($objUserList->gTable().'.memberId='.$objUser->id);
}
$objUserList->addOrder('level DESC,lastName ASC');
$objUserList->loadList();
}
define('FRK_LANGUAGE',FRK_DEFAULT_LANGUAGE);
define('FRK_SKIN_FOLDER',FRK_DEFAULT_SKIN_FOLDER);
define('FRK_NO_DEADLINE_TOO',FRK_DEFAULT_NO_DEADLINE_TOO);
define('FRK_NO_DEADLINE_KEEP',FRK_DEFAULT_NO_DEADLINE_KEEP);
define('FRK_DATEDIFF_MODE',FRK_DEFAULT_DATEDIFF_MODE);
define('FRK_DATEDIFF_TOMORROW',FRK_DEFAULT_DATEDIFF_TOMORROW);
define('FRK_CONTEXT_LONG',FRK_DEFAULT_CONTEXT_LONG);
define('FRK_RSS_SIZE',FRK_DEFAULT_RSS_SIZE);
define('FRK_SORT_COLUMN',FRK_DEFAULT_SORT_COLUMN);
define('FRK_SORT_ORDER',FRK_DEFAULT_SORT_ORDER);
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/common.php';
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/freak.php';
include PRJ_INCLUDE_PATH.'language/'.FRK_LANGUAGE.'/options.php';