users_menu.php
2.5 KB
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
<?php
/*
function users_menu($options){
global $MAIN_USER;
$t = new PHPTAL( false );
if ( MAIN_USER>0 ){
// пользователь
$t -> setSource(TMPL_USER_MENU);
}else{
$t -> setSource(TMPL_GUEST_MENU);
}
$t -> B_USER_REGISTER_AS = sprintf(B_USER_REGISTER_AS, sys_url(URL_USER_REGISTER),sys_url(URL_USER_REGISTER_ORG),sys_url(URL_USER_RECOVER_PASS) );
$login = $MAIN_USER -> login();
$t -> profile_url = sprintf(URL_USER_PROFILE,$login );
$t -> login = $login;
$t -> blog_url = sprintf(URL_USER_BLOGS,$login );
$t -> count_posts = $MAIN_USER -> count_blog_posts();
$t -> edit_profile_url = sprintf(URL_USER_PROFILE_EDIT);
$t -> admin_url= sprintf(URL_USER_ADMIN);
$t -> exit_url= sprintf(URL_USER_EXIT);
$t -> points = $MAIN_USER -> points();
$t -> is_admin = $MAIN_USER -> is_admin();
return $t -> execute();
}
define("TMPL_GUEST_MENU",
'
<p class="top_enter"><a class="tf_link js" onclick="login_wnd()">${B_USER_INPUT_WITH_PASS}</a></p>
<script type="text/javascript">
function login_wnd(){
wnd.set_title("${B_USER_INPUT_WITH_PASS}");
wnd.set_content( o.$("login_form").innerHTML );
wnd.show(510,210);
}
</script>
<div id="login_form" style="display:none">
<form action="/?p_name=users_profile" method="post">
<input type="hidden" name="act" value="login" />
<input type="hidden" name="send" value="1" />
<input
class="in_text"
value="${B_USER_LOGIN}"
onfocus="if(this.value==\'${B_USER_LOGIN}\')this.value=\'\';"
onblur="if(this.value==\'\')this.value=\'${B_USER_LOGIN}\';"
type="text" name="login" />
<input class="in_text" value="*****" type="password"
onfocus="if(this.value==\'*****\')this.value=\'\';"
onblur="if(this.value==\'\')this.value=\'*****\';"
name="pass" />
<input type="submit" class="button_s" value="${B_USER_INPUT}" />
<div tal:omit-tag="MAIN_URL" tal:content="structure B_USER_REGISTER_AS" />
</form>
</div>'
);
define("TMPL_USER_MENU",
'
<ul class="usr_in">
<li>${B_USER_YOU_INPUT_AS}</li>
<li class="usr"><a href="${profile_url}">${login}</a> ${points}</li>
<li><a href="${profile_url}">${B_USER_PROFILE}</a> </li>
<li><a href="${blog_url}">${B_USER_BLOG}</a> (${count_posts})</li>
<li><a href="${edit_profile_url}">${B_USER_MOD_PROFILE}</a></li>
<li tal:condition="is_admin"><a target="_blank" href="${admin_url}" style="color:red;">${B_USER_ADMIN}</a></li>
<li><a href="${exit_url}">${B_USER_EXIT}</a></li>
</ul>
'
);*/
?>