forked from paxed/rash-qdb-fork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basetemplate.php
executable file
·640 lines (542 loc) · 22.7 KB
/
basetemplate.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
<?php
abstract class BaseTemplate {
private $messages = array();
private $mainmenu = array();
private $adminmenu = array();
private $menu_join_str = ' | ';
private $menu_wrap_str = '<div class="site_nav_lower"><div class="site_nav_lower_linkbar">%s</div></div>';
function __constructor()
{
}
function add_message($msg)
{
$this->messages[] = $msg;
}
function get_messages()
{
if (count($this->messages) > 0) {
$str = '<ul id="page_messages">';
foreach ($this->messages as $msg) {
$str .= '<li>'.$msg;
}
$str .= '</ul>';
$this->messages = array();
return $str;
}
return '';
}
function set_menu($admin,$menudata)
{
if ($admin) {
$this->adminmenu = $menudata;
} else {
$this->mainmenu = $menudata;
}
}
function set_menu_join_str($str) { $this->menu_join_str = $str; }
function set_menu_wrap_str($str) { $this->menu_wrap_str = $str; }
function get_menu($admin = 0)
{
if ($admin) { $menudata = $this->adminmenu; } else { $menudata = $this->mainmenu; }
$str = '';
if ($menudata) {
$arr = array();
foreach ($menudata as $m) {
$arr[] = '<a href="'.$m['url'].'" id="'.$m['id'].'">'.str_replace(' ', ' ', lang($m['txt'])).'</a>';
}
$str = join('<span class="sep">'.$this->menu_join_str.'</span>', $arr);
}
return sprintf($this->menu_wrap_str, $str);
}
function rss_feed_item($title, $desc, $link)
{
$str = "<item>\n";
$str .= "<title>".$title."</title>\n";
$str .= "<description>".$desc."</description>\n";
$str .= "<link>".$link."</link>\n";
$str .= "</item>\n\n";
return $str;
}
function rss_feed($title, $desc, $link, $items)
{
$str = "<?xml version=\"1.0\" ?>\n";
$str .= "<rss version=\"0.92\">\n";
$str .= "<channel>\n";
$str .= "<title>".$title."</title>\n";
$str .= "<description>".$desc."</description>\n";
$str .= "<link>".$link."</link>\n";
$str .= $items;
$str .= "</channel></rss>";
return $str;
}
function printheader($title, $topleft=null, $topright=null)
{
$str = '<html><head><title>'.$title.'</title>
<script src="qdb.js" type="text/javascript"></script>
</head><body>';
if ($topleft) $str .= '<h1>'.$topleft.'</h1>';
if ($topright) $str .= '<h2>'.$topright.'</h2>';
if(!isset($_SESSION['logged_in'])){
print '<a href="?'.urlargs('admin').'" id="login">'.lang('menu_admin').'</a>';
} else {
print '<span class="logged_in_as">'.sprintf(lang('logged_in_as'), htmlspecialchars($_SESSION['user'])).'</span>';
}
$str .= '<div class="menu">'.$this->get_menu().'</div>';
$amenu = $this->get_menu(1);
if ($amenu) $str .= '<div class="adminmenu">'.$amenu.'</div>';
$str .= $this->get_messages();
return $str;
}
function printfooter($db_stats=null)
{
return '</body></html>';
}
function news_item($news, $date, $id=null, $mode=0)
{
if ($mode == 0) {
return '<div class="news_entry"><p class="news_date">'.$date.'</p>'.
'<div class="news_news"><span class="space"> </span>'.$news.'</div></div>';
} else {
$str = '<div class="news_entry"><p class="news_date"><a href="?'.urlargs('edit_news','edit',$id).'">'.$date.'</a></p>'.
'<div class="news_news">'.$news.'</div></div>';
if ($mode == 2) $str = '<div class="hilight_news_entry">'.$str.'</div>';
return $str;
}
}
function news_page($news)
{
$str = '<div id="news_all">';
$str .= '<h1 id="news_title">'.lang('news_title').'</h1>';
$str .= $news;
$str .= '</div>';
return $str;
}
function edit_news_form($id, $news)
{
return '<div class="edit_news_form"><form action="?'.urlargs('edit_news','update',$id).'" method="post">
<textarea cols="80" rows="5" name="news" id="edit_news_news">'.$news.'</textarea><br />
<input type="submit" value="'.lang('preview_news_btn').'" id="edit_preview" name="preview" />
<input type="submit" value="'.lang('save_news_btn').'" id="edit_news" name="submit" />
<input type="submit" value="'.lang('delete_news_btn').'" id="delete_news" name="delete" />
'.lang('delete_news_verify').'<input type="checkbox" name="verify_delete" id="verify_delete"><label for="verify_delete"></label>
</form></div><p>';
}
function edit_news_page($news)
{
$str = '<div id="editnews_all">';
$str .= '<h1 id="editnews_title">'.lang('editnews_title').'</h1>';
$str .= $news;
$str .= '</div>';
return $str;
}
function main_page($news)
{
$str = '<div id="home_all"><div id="news">'.$news;
if ($news) {
$str .= '<div class="show_all_news"><a href="?'.urlargs('news').'">'.lang('news_show_all').'</a></div>';
}
$str .= '</div>';
$str .= '<div id="home_greeting">'.lang('home_greeting').'</div></div>';
return $str;
}
function add_quote_preview($quotetxt)
{
$str = '<div id="add_outputmsg">';
$str .= '<div id="addw_outputmsg_top">'.lang('preview_outputmsg_top').'</div>';
$str .= '<div id="add_outputmsg_quote">'.$quotetxt.'</div>';
$str .= '<div id="add_outputmsg_bottom">'.lang('preview_outputmsg_bottom').'</div>';
$str .= '</div>';
return $str;
}
function add_quote_outputmsg($quotetxt)
{
$str = '<div id="add_outputmsg">';
$str .= '<div id="add_outputmsg_top">'.lang('add_outputmsg_top').'</div>';
$str .= '<div id="add_outputmsg_quote">'.$quotetxt.'</div>';
$str .= '<div id="add_outputmsg_bottom">'.lang('add_outputmsg_bottom').'</div>';
$str .= '</div>';
return $str;
}
function add_quote_page($quotetxt='', $added_quote_html='', $wasadded=null)
{
global $CAPTCHA;
$str = '<div id="add_all">';
$str .= '<h1 id="add_title">'.lang('add_title').'</h1>';
$str .= $added_quote_html;
$str .= '<form action="?'.urlargs('add','submit').'" method="post">
<textarea cols="80" rows="5" name="rash_quote" id="add_quote">'.($wasadded ? '' : $quotetxt).'</textarea><br />';
$str .= $CAPTCHA->get_CAPTCHA('add_quote');
$str .= '
<input type="submit" value="'.lang('preview_quote_btn').'" id="add_preview" name="preview" />
<input type="submit" value="'.lang('add_quote_btn').'" id="add_submit" name="submit" />
<input type="reset" value="'.lang('add_reset_btn').'" id="add_reset" />
</form>';
$str .= '</div>';
return $str;
}
function import_data_page($quotetxt='', $regex=null, $added_quote_html='', $wasadded=null)
{
global $CAPTCHA;
$str = '<div id="import_data_all">';
$str .= '<h1 id="add_title">'.lang('import_data_title').'</h1>';
$str .= $added_quote_html;
$str .= '<form action="?'.urlargs('import','submit').'" method="post">
<textarea cols="80" rows="25" name="rash_quote" id="add_quote">'.($wasadded ? '' : $quotetxt).'</textarea><br />
'.lang('import_separator_regex').' <input type="text" name="separator_regex" value="'.($regex ? $regex : '^%\s*$').'"><br />';
$str .= $CAPTCHA->get_CAPTCHA('add_quote');
$str .= '
<input type="submit" value="'.lang('import_quotes_btn').'" id="add_submit" name="submit" />
<input type="reset" value="'.lang('add_reset_btn').'" id="add_reset" />
</form>';
$str .= '</div>';
return $str;
}
function edit_quote_outputmsg($quotetxt)
{
$str = '<div id="editquote_outputmsg">';
$str .= '<div id="editquote_outputmsg_top">'.lang('editquote_outputmsg_top').'</div>';
$str .= '<div id="editquote_outputmsg_quote">'.$quotetxt.'</div>';
$str .= '<div id="editquote_outputmsg_bottom">'.lang('editquote_outputmsg_bottom').'</div>';
$str .= '</div>';
return $str;
}
function edit_quote_button($quoteid, $queue=0)
{
return '<a href="?'.urlargs(($queue ? 'editqueue' : 'edit'),'edit',$quoteid).'" class="quote_edit" title="'.lang('editquote').'"></a>';
}
function edit_quote_page($action, $quoteid, $quotetxt, $edited_quote_html='')
{
$str = '<div id="editquote_all" class="act_'.$action.'">';
$str .= '<h1 id="editquote_title">'.lang('editquote_title').'</h1>';
$str .= $edited_quote_html;
$str .= '<form action="?'.urlargs($action,'submit', $quoteid).'" method="post">
<textarea cols="80" rows="5" name="rash_quote" id="edit_quote">'.$quotetxt.'</textarea><br />
<input type="submit" value="'.lang('edit_quote_btn').'" id="edit_submit" />
<input type="reset" value="'.lang('edit_reset_btn').'" id="edit_reset" />
</form>';
$str .= '</div>';
return $str;
}
function search_quotes_page($fetched, $searchstr)
{
$str = '<div class="search_all">';
if (!$fetched) {
$str .= '<h1 id="search_title">'.lang('search_title').'</h1>';
}
$str .= '<form method="post" action="?'.urlargs('search','fetch').'">';
if ($fetched) { $str .= '<input type="submit" name="submit" value="'.lang('search_btn').'" id="search_submit-button"> '; }
$str .= '<input type="text" name="search" size="28" id="search_query-box" value="'.$searchstr.'"> ';
if (!$fetched) { $str .= '<input type="submit" name="submit" value="'.lang('search_btn').'" id="search_submit-button"> <div>'; }
$str .= lang('search_sort').': <select name="sortby" size="1" id="search_sortby-dropdown">';
$str .= '<option selected>'.lang('search_opt_rating');
$str .= '<option>'.lang('search_opt_id');
$str .= '</select>';
$str .= ' ';
$str .= lang('search_howmany').': <select name="number" size="1" id="search_limit-dropdown">
<option selected>10
<option>25
<option>50
<option>75
<option>100
</select></div>';
$str .= '</form>';
// $str .= '</div>';
return $str;
}
function flag_queue_page_iter($quoteid, $quotetxt)
{
return '<tr>
<td class="quote_delete" onclick="javascript:this.firstElementChild.click();">
<input type="radio" id="qd'.$quoteid.'" name="q'.$quoteid.'" value="d'.$quoteid.'"><label for="qd'.$quoteid.'">'.lang('flag_quote_delete').'</label>
</td>
<td>
<div class="quote_quote">'.$quotetxt.'
</div>
</td>
<td class="quote_unflag" onclick="javascript:this.firstElementChild.click();">
<input type="radio" id="qu'.$quoteid.'" name="q'.$quoteid.'" value="u'.$quoteid.'"><label for="qu'.$quoteid.'">'.lang('flag_quote_unflag').'</label>
</td>
</tr>';
}
function flag_queue_page($inner_html)
{
$str = '<div id=admin_flags_all><h1 id="admin_flag_title">'.lang('flag_quote_adminpage_title').'</h1>';
$str .= '<form action="?'.urlargs('flag_queue','judgement').'" method="post">
<table width="100%" class="admin_queue">';
$str .= $inner_html;
$str .= '</table>
<input type="submit" value="'.lang('flag_quote_adminpage_submit_btn').'" />
<input type="reset" value="Reset" />
<input type="submit" value="'.lang('flag_quote_adminpage_unflag_all_btn').'" name="unflag_all">
<input type="submit" value="'.lang('flag_quote_adminpage_delete_all_btn').'" name="delete_all">
'.lang('flag_quote_adminpage_verify').'<input type="checkbox" name="do_all" id="do_all"><label for="do_all"></label>
</form></div>';
return $str;
}
function add_news_page($previewnews, $newstxt)
{
$str = ' <div id="admin_add-news_all">
<h1 id="admin_add-news_title">'.lang('add_news_title').'</h1>';
if (isset($previewnews)) $str .= '<div class="admin_preview_news">'.$previewnews.'</div>';
$str .= '<p>'.lang('add_news_help').'
<form method="post" action="?'.urlargs('add_news','submit').'">
<textarea cols="80" rows="5" name="news" id="add_news_news">'.$newstxt.'</textarea><br />
<input type="submit" value="'.lang('preview_news_btn').'" id="add_preview" name="preview" />
<input type="submit" value="'.lang('add_news_btn').'" id="add_news" name="submit" />
</form>
</div>
';
return $str;
}
function register_user_page()
{
global $CAPTCHA;
$str = ' <div id="register-user_all">
<h1 id="register-user_title">'.lang('register_user_title').'</h1>
<form method="post" action="?'.urlargs('register','update').'">
<table>
<tr><td>'.lang('register_user_username_label').'</td><td><input type="text" name="username" id="register-user_username" /></td></tr>
<tr><td>'.lang('register_user_password_label').'</td><td><input type="password" name="password" /></td></tr>
<tr><td>'.lang('register_user_verifypassword_label').'</td><td><input type="password" name="verifypassword" /></td></tr>
<tr><td></td><td><input type="submit" value="'.lang('register_user_btn').'" id="register-user_submit" /></td></tr>
</table>'.$CAPTCHA->get_CAPTCHA('register_user').'
</form>
</div>
';
return $str;
}
function add_user_page()
{
return ' <div id="admin_add-user_all">
<h1 id="admin_add-user_title">'.lang('add_user_title').'</h1>
<form method="post" action="?'.urlargs('add_user','update').'">
<table>
<tr><td>'.lang('add_user_username_label').'</td><td><input type="text" name="username" id="admin_add-user_username" /></td></tr>
<tr><td>'.lang('add_user_randomsalt_label').'</td><td><input type="text" name="salt" value="'.str_rand(8,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789').'" id="admin_add-user_salt" /></td></tr>
<tr><td>'.lang('add_user_password_label').'</td><td><input type="text" name="password" /></td></tr>
<tr><td>'.lang('add_user_level_label').'</td><td>'.user_level_select().'</td></tr>
<tr><td></td><td><input type="submit" value="'.lang('add_user_btn').'" id="admin_add-user_submit" /></td></tr>
</table>
</form>
</div>
';
}
function change_password_page()
{
return ' <div id=admin_change-pw_all><h1 id="admin_change-pw_title">'.lang('change_password_title').'</h1>
<form action="?'.urlargs('change_pw','update',$_SESSION['userid']).'" method="post">
<table>
<tr><td>'.lang('change_password_oldpass').'</td><td><input type="password" name="old_password"></td></tr>
<tr><td>'.lang('change_password_newpass').'</td><td><input type="password" name="new_password"></td></tr>
<tr><td>'.lang('change_password_verify').'</td><td><input type="password" name="verify_password"></td></tr>
<tr><td></td><td><input type="submit" value="'.lang('change_password_submit_btn').'"></td></tr>
</table>
</form></div>';
}
function edit_user_page_form($id, $who, $username, $level)
{
return '<div id=edit_user_all><h1 id="edit_user-title">'.lang('edit_user_title').' '.$username.'</h1>
<form action="?'.urlargs('users','update',$id).'" method="post">
<table>
<tr><td>'.lang('edit_user_newname').'</td><td><input type="text" value="'.$username.'" name="user"></td></tr>
<tr><td>'.lang('edit_user_newpass').'</td><td><input type="text" name="password"> '.lang('edit_user_newpass_help').'</td></tr>
<tr><td>'.lang('edit_user_newlevel').'</td><td>'.user_level_select($level).'</td></tr>
<tr><td></td><td><input type="submit" value="'.lang('edit_user_submit_btn').'"></td></tr>
</table>
</form></div>';
}
function edit_user_page_table_row($id, $user, $password, $level, $current=0)
{
return ' <tr'.($current ? ' class="curr"' : '').'>
<td>'.$id.'</td>
<td><a href="?'.urlargs('users','edit',$id).'">'.$user.'</a></td>
<td>'.$password.'</td>
<td>'.$level.'</td>
<td><input type="checkbox" name="d'.$id.'" value="'.$id.'" id="chkbox_d'.$id.'"/><label for="chkbox_d'.$id.'"></label></td>
</tr>
';
}
function edit_user_page_table($innerhtml)
{
$str = ' <div id=admin_users_all><h1 id="admin_users_title">'.lang('users_list_title').'</h1>
<form action="?'.urlargs('users','delete').'" method="post">
<table class="users">
<tr>
<th>'.lang('users_list_id').'</th>
<th>'.lang('users_list_username').'</th>
<th>'.lang('users_list_pwhash').'</th>
<th>'.lang('users_list_level').'</th>
<th>'.lang('users_list_delete').'</th>
</tr>
';
$str .= $innerhtml;
$str .= ' </table>
<input type="submit" value="'.lang('users_list_submit_btn').'" /> '.lang('users_list_verify').' <input type="checkbox" name="verify" value="1" id="verify_submit"/><label for="verify_submit"></label>
</form></div>
';
return $str;
}
function user_login_page()
{
return '<h1 id="login_title">'.lang('login_title').'</h1>'.
'<div id="admin_all"><p>'.lang('user_login_greeting').'</p>
<form action="?'.urlargs('login','login').'" method="post">
<table>
<tr><td><label for="user_login_username-box">'.lang('login_username').'</label></td><td><input type="text" name="rash_username" size="8" id="user_login_username-box" /></td></tr>
<tr><td><label for="user_login_password-box">'.lang('login_password').'</label></td><td><input type="password" name="rash_password" size="8" id="user_login_password-box" /></td></tr>
<tr><td><label for="remember_login_input">'.lang('login_remember').'</label></td><td><input type="checkbox" name="remember_login" id="remember_login_input"><label for="remember_login_input"></label></td></tr>
<tr><td></td><td><input type="submit" value="'.lang('login_submit_btn').'" id="user_login_submit-button" /></td></tr>
</table>
</form></div>';
}
function admin_login_page()
{
return '<h1 id="login_title">'.lang('login_title').'</h1>'.
'<div id="admin_all"><p>'.lang('admin_login_greeting').'</p>
<form action="?'.urlargs('admin','login').'" method="post">
<table>
<tr><td><label for="admin_login_username-box">'.lang('login_username').'</label></td><td><input type="text" name="rash_username" size="8" id="admin_login_username-box" /></td></tr>
<tr><td><label for="admin_login_password-box">'.lang('login_password').'</label></td><td><input type="password" name="rash_password" size="8" id="admin_login_password-box" /></td></tr>
<tr><td><label for="remember_login_input">'.lang('login_remember').'</label></td><td><input type="checkbox" name="remember_login" id="remember_login_input"><label for="remember_login_input"></label></td></tr>
<tr><td></td><td><input type="submit" value="'.lang('login_submit_btn').'" id="admin_login_submit-button" /></td></tr>
</table>
</form></div>';
}
function format_possible_dupes($dupes = NULL)
{
$str = '';
if ($dupes) {
$str = ' <span class="maybe_dupe">('.lang('possible_dupe').': ';
$arr = array();
foreach ($dupes as $d) {
array_push($arr, '<a href="?'.$d.'">'.$d.'</a>');
}
$str .= join(', ', $arr).')</span>';
}
return $str;
}
function quote_queue_page_iter($quoteid, $quotetxt, $dupes=NULL)
{
return ' <tr>
<td class="quote_no" onclick="javascript:this.firstElementChild.click();">
<input type="radio" id="qn'.$quoteid.'" name="q'.$quoteid.'" value="n'.$quoteid.'"><label for="qn'.$quoteid.'">'.lang('quote_queue_no').'</label>
</td>
<td>'.$this->edit_quote_button($quoteid, 1).$this->format_possible_dupes($dupes).'
<div class="quote_quote">
'.$quotetxt.'
</div>
</td>
<td class="quote_yes" onclick="javascript:this.firstElementChild.click();">
<input type="radio" id="qy'.$quoteid.'" name="q'.$quoteid.'" value="y'.$quoteid.'" style="text-align: right"><label for="qy'.$quoteid.'">'.lang('quote_queue_yes').'</label>
</td>
</tr>
';
}
function quote_queue_page($innerhtml)
{
$str = '<div id=admin_queue_all><h1 id="admin_queue_title">'.lang('quote_queue_admin_title').'</h1>';
$str .= ' <form action="?'.urlargs('adminqueue','judgement').'" method="post">
<table width="100%" cellspacing="0" class="admin_queue">';
$str .= $innerhtml;
$str .= ' </table>
<input type="submit" value="'.lang('quote_queue_submit_btn').'" />
<input type="reset" value="'.lang('quote_queue_reset_btn').'" />
</form></div>
';
return $str;
}
function quote_upvote_button($quoteid, $canvote, $ajaxy=FALSE)
{
$s = ' class="quote_plus" id="quote_plus_'.$quoteid.'"';
if (!$canvote) {
$url = '<a href="?'.urlargs('vote',$quoteid,'plus').'" '.$s.' title="'.lang('upvote').'">▲</a>';
if ($ajaxy) {
return '<script type="text/javascript">
document.write(\'<a href="javascript:ajax_vote('.$quoteid.',1);" '.$s.' title="'.lang('upvote').'">▲</a>\');
</script><noscript>'.$url.'</noscript>';
}
return $url;
}
return '<span '.$s.' title="'.lang('cannot_vote_'.$canvote).'">+</span>';
}
function quote_downvote_button($quoteid, $canvote, $ajaxy=FALSE)
{
$s = ' class="quote_minus" id="quote_minus_'.$quoteid.'"';
if (!$canvote) {
$url = '<a href="?'.urlargs('vote',$quoteid,'minus').'" '.$s.' title="'.lang('downvote').'">▼</a>';
if ($ajaxy) {
return '<script type="text/javascript">
document.write(\'<a href="javascript:ajax_vote('.$quoteid.',-1);" '.$s.' title="'.lang('downvote').'">▼</a>\');
</script><noscript>'.$url.'</noscript>';
}
return $url;
}
return '<span '.$s.' title="'.lang('cannot_vote_'.$canvote).'">-</span>';
}
function quote_flag_button($quoteid, $canflag)
{
global $CONFIG;
if (isset($CONFIG['login_required']) && ($CONFIG['login_required'] == 1) && !isset($_SESSION['logged_in'])) return '';
if ($CONFIG['auto_flagged_quotes'] == 1) return '';
if ($canflag)
return '<a href="?'.urlargs('flag',$quoteid).'" class="quote_flag" title="'.lang('flagquote').'"></a>';
return '<span class="quote_flag" title="'.lang('quote_already_flagged').'"></span>';
}
function quote_iter($quoteid, $rating, $quotetxt, $canflag, $canvote, $date=null)
{
$str = '<div class="quote_whole" id="q'.$quoteid.'">';
$str.= ' <div class="quote_option-bar">
'.$this->quote_upvote_button($quoteid, $canvote)
.' '.'<span class="quote_rating"><span id="quote_rating_'.$quoteid.'">'.$rating.'</span></span>'
.' '.$this->quote_downvote_button($quoteid, $canvote).'</div>
<div class="quote_head">
<a href="?'.urlargs($quoteid).'" class="quote_number">'.lang('quote_nr').' #'.$quoteid.'</a>
';
if (isset($date)) {
$str .= " <span class=\"quote_date\">" . $date . "</span>\n";
}
$str .='</div> <!-- quote_head -->';
$str .= '
<div class="quote_quote">
'.$quotetxt.'
</div>
<div class=quote_bottom_bar>
';
$str .= edit_quote_button($quoteid)
.' '.$this->quote_flag_button($quoteid, $canflag);
$str.='</div>
</div>
';
return $str;
}
function quote_list($title, $pagenumbers, $quotes)
{
$str = "<div id=main_wrapper>";
if (isset($title))
$str .= '<h1 id="quote_origin-name">'.$title.'</h1>';
$str .= $pagenumbers;
$str .= '<div id="quote_list">'.$quotes.'</div>';
$str .= '<p>';
$str .= $pagenumbers;
return $str.'</div>';
}
function flag_page($quoteid, $quotetxt, $flag)
{
global $CAPTCHA;
$str = '<div id=flag_quote_all>';
$str .= '<h1>'.lang('flag_quote_title').'</h1>';
$str .= $this->get_messages();
if ($flag == 0)
$str .= '<p>'.lang('flag_quote_explanation');
$str .= '<div class="quote_quote">'.$quotetxt.'</div>';
if ($flag == 0) {
$str .= '<form action="?'.urlargs('flag',$quoteid, 'verdict').'" method="post">';
$str .= $CAPTCHA->get_CAPTCHA('flag');
$str .= '<input type="submit" value="'.lang('flag_quote_submit_btn').'" />
<input type="reset" value="'.lang('flag_quote_reset_btn').'" />
</form></div>';
}
return $str;
}
}