forked from avscms/avscms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.php
executable file
·68 lines (61 loc) · 2.08 KB
/
mail.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
<?php
define('_VALID', true);
require 'include/config.php';
require 'include/function_global.php';
require 'include/function_smarty.php';
require 'classes/auth.class.php';
$auth = new Auth();
$auth->check();
$uid = intval($_SESSION['uid']);
$username = $_SESSION['username'];
$sql = "SELECT * FROM signup WHERE UID = " .$uid. " LIMIT 1";
$rs = $conn->execute($sql);
if ( $conn->Affected_Rows() != 1 ) {
VRedirect::go($config['BASE_URL']. '/notfound/user_missing');
}
$user = $rs->getrows();
$user = $user['0'];
$sql = "SELECT * FROM users_online WHERE UID = " .$uid. " AND online > " .(time()-300). " LIMIT 1";
$rs = $conn->execute($sql);
if ( $conn->Affected_Rows() == 1 )
$online = true;
else
$online = false;
$request = ( isset($_SERVER['REQUEST_URI']) ) ? $_SERVER['REQUEST_URI'] : NULL;
$request = str_replace('?' .$_SERVER['QUERY_STRING'], '', $request);
$query = explode('/', $request);
foreach ( $query as $key => $value ) {
if ( $value == 'mail' ) {
$query = array_slice($query, $key+1);
}
}
if ( isset($query['0']) && $query['0'] != '' ) {
$module = $query['0'];
$modules_allowed = array('inbox', 'outbox', 'compose', 'read');
if ( !in_array($module, $modules_allowed) ) {
$module = 'inbox';
}
}
$module = ( isset($module) ) ? $module : 'inbox';
if ( $module == 'read' ) {
$template = 'mail_read';
} elseif ( $module == 'compose' ) {
$template = 'mail_compose';
} else {
$template = 'mail';
}
require 'modules/mail/' .$module. '.php';
$smarty->assign('errors',$errors);
$smarty->assign('err',$err);
$smarty->assign('messages',$messages);
$smarty->assign('menu', 'home');
$smarty->assign('submenu', '');
$smarty->assign('username', $username);
$smarty->assign('user', $user);
$smarty->assign('online', $online);
$smarty->assign('profile', true);
$smarty->loadFilter('output', 'trimwhitespace');
$smarty->display('header.tpl');
$smarty->display($template. '.tpl');
$smarty->display('footer.tpl');
?>