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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
class qa_html_theme extends qa_html_theme_base
{
// use new ranking layout
protected $ranking_block_layout = true;
protected $theme = 'snow';
// outputs login form if user not logged in
public function nav_user_search()
{
if (!qa_is_logged_in()) {
if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
$login = $this->content['navigation']['user']['login'];
$this->output(
'<form class="qam-login-form" action="'.$login['url'].'" method="post">',
'<input type="text" class="qam-login-text" name="emailhandle" dir="auto" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'"/>',
'<input type="password" class="qam-login-text" name="password" dir="auto" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'"/>',
'<div class="qam-rememberbox"><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>',
'<label for="qam-rememberme" class="qam-remember">'.qa_lang_html('users/remember').'</label></div>',
'<input type="hidden" name="code" value="'.qa_html(qa_get_form_security_code('login')).'"/>',
'<input type="submit" value="' . qa_lang_html('users/login_button') . '" class="qa-form-tall-button qa-form-tall-button-login" name="dologin"/>',
'</form>'
);
// remove regular navigation link to log in page
unset($this->content['navigation']['user']['login']);
}
}
qa_html_theme_base::nav_user_search();
}
public function logged_in()
{
require_once QA_INCLUDE_DIR . 'app/format.php';
if (qa_is_logged_in()) // output user avatar to login bar
$this->output(
'<div class="qa-logged-in-avatar">',
QA_FINAL_EXTERNAL_USERS
? qa_get_external_avatar_html(qa_get_logged_in_userid(), 24, true)
: qa_get_user_avatar_html(qa_get_logged_in_flags(), qa_get_logged_in_email(), qa_get_logged_in_handle(),
qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'),
24, true),
'</div>'
);
qa_html_theme_base::logged_in();
if (qa_is_logged_in()) { // adds points count after logged in username
$userpoints=qa_get_logged_in_points();
$pointshtml=($userpoints==1)
? qa_lang_html_sub('main/1_point', '1', '1')
: qa_lang_html_sub('main/x_points', qa_html(qa_format_number($userpoints)));
$this->output(
'<span class="qa-logged-in-points">',
'('.$pointshtml.')',
'</span>'
);
}
}
// adds login bar, user navigation and search at top of page in place of custom header content
public function body_header()
{
$this->output('<div class="qam-login-bar"><div class="qam-login-group">');
$this->nav_user_search();
$this->output('</div></div>');
}
// allows modification of custom element shown inside header after logo
public function header_custom()
{
if (isset($this->content['body_header'])) {
$this->output('<div class="header-banner">');
$this->output_raw($this->content['body_header']);
$this->output('</div>');
}
}
// removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
public function header()
{
$this->output('<div class="qa-header">');
$this->logo();
$this->header_clear();
$this->header_custom();
$this->output('</div> <!-- END qa-header -->', '');
$this->output('<div class="qa-main-shadow">', '');
$this->output('<div class="qa-main-wrapper">', '');
$this->nav_main_sub();
}
// removes sidebar for user profile pages
public function sidepanel()
{
if ($this->template!='user')
qa_html_theme_base::sidepanel();
}
// prevent display of regular footer content (see body_suffix()) and replace with closing new <div>s
public function footer()
{
$this->output('</div> <!-- END main-wrapper -->');
$this->output('</div> <!-- END main-shadow -->');
}
// add RSS feed icon after the page title
public function favorite()
{
parent::favorite();
$feed = @$this->content['feed'];
if (!empty($feed)) {
$this->output('<a href="'.$feed['url'].'" title="'.@$feed['label'].'"><img src="'.$this->rooturl.'images/rss.jpg" alt="" width="16" height="16" class="qa-rss-icon"/></a>');
}
}
// add view count to question list
public function q_item_stats($q_item)
{
$this->output('<div class="qa-q-item-stats">');
$this->voting($q_item);
$this->a_count($q_item);
qa_html_theme_base::view_count($q_item);
$this->output('</div>');
}
// prevent display of view count in the usual place
public function view_count($q_item)
{
if ($this->template=='question')
qa_html_theme_base::view_count($q_item);
}
// to replace standard Q2A footer
public function body_suffix()
{
$this->output('<div class="qa-footer-bottom-group">');
qa_html_theme_base::footer();
$this->output('</div> <!-- END footer-bottom-group -->', '');
}
public function attribution()
{
$this->output(
'<div class="qa-attribution">',
' | Snow Theme by <a href="http://www.q2amarket.com">Q2A Market</a>',
'</div>'
);
qa_html_theme_base::attribution();
}
}