-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
64 lines (58 loc) · 3.61 KB
/
home.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
<?php
/******************************************************************************
Etano
===============================================================================
File: home.php
$Revision$
Software by: DateMill (http://www.datemill.com)
Copyright by: DateMill (http://www.datemill.com)
Support at: http://www.datemill.com/forum
*******************************************************************************
* See the "docs/licenses/etano.txt" file for license. *
******************************************************************************/
require 'includes/common.inc.php';
require _BASEPATH_.'/includes/user_functions.inc.php';
require _BASEPATH_.'/skins_site/'.get_my_skin().'/lang/home.php';
check_login_member('auth');
$tpl=new phemplate(_BASEPATH_.'/skins_site/'.get_my_skin().'/','remove_nonjs');
$output=array();
$query="SELECT `_photo` as `photo`,UNIX_TIMESTAMP(`date_added`) as `date_added` FROM `{$dbtable_prefix}user_profiles` WHERE `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."'";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
if (mysql_num_rows($res)) {
$output=mysql_fetch_assoc($res);
$output['date_added']=strftime($_SESSION[_LICENSE_KEY_]['user']['prefs']['date_format'],$output['date_added']+$_SESSION[_LICENSE_KEY_]['user']['prefs']['time_offset']);
}
if (empty($output['photo'])) {
$output['photo']='no_photo.gif';
}
$query="SELECT b.`m_name`,UNIX_TIMESTAMP(a.`paid_until`) as `paid_until` FROM `{$dbtable_prefix}payments` a,`{$dbtable_prefix}memberships` b WHERE a.`m_value_to`=b.`m_value` AND a.`fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' AND a.`paid_until`>'".gmdate('Ymd')."' AND a.`refunded`=0 AND a.`is_active`=1 ORDER BY a.`paid_until` DESC LIMIT 1";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
if (mysql_num_rows($res)) {
$output=array_merge($output,mysql_fetch_assoc($res));
$output['paid_until']=strftime($_SESSION[_LICENSE_KEY_]['user']['prefs']['date_format'],$output['paid_until']+$_SESSION[_LICENSE_KEY_]['user']['prefs']['time_offset']);
} else {
$query="SELECT b.`m_name` FROM `".USER_ACCOUNTS_TABLE."` a,`{$dbtable_prefix}memberships` b WHERE a.`membership`=b.`m_value` AND a.`".USER_ACCOUNT_ID."`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."'";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$output['m_name']=mysql_result($res,0,0);
$output['paid_until']=$GLOBALS['_lang'][123];
}
$my_stats=get_user_stats($_SESSION[_LICENSE_KEY_]['user']['user_id'],array('total_photos','pviews','num_friends'));
$query="SELECT count(*) FROM `{$dbtable_prefix}user_inbox` WHERE `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' AND `del`=0";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$my_stats['total_messages']=mysql_result($res,0,0);
$query="SELECT count(*) FROM `{$dbtable_prefix}user_inbox` WHERE `is_read`=0 AND `fk_user_id`='".$_SESSION[_LICENSE_KEY_]['user']['user_id']."' AND `del`=0";
if (!($res=@mysql_query($query))) {trigger_error(mysql_error(),E_USER_ERROR);}
$my_stats['new_messages']=mysql_result($res,0,0);
$tpl->set_file('content','home.html');
$tpl->set_var('output',$output);
$tpl->set_var('my_stats',$my_stats);
$tpl->process('content','content');
$tplvars['title']=$GLOBALS['_lang'][124];
$tplvars['page_title']=$GLOBALS['_lang'][124];
$tplvars['page']='home';
$tplvars['css']='home.css';
if (is_file('home_left.php')) {
include 'home_left.php';
}
unset($page_last_modified_time); // we want everything fresh on this page.
include 'frame.php';