forked from zjutjh/NexusPHP
/
offers.php
840 lines (714 loc) · 39.8 KB
/
offers.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
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
<?php
require_once("include/bittorrent.php");
dbconn();
require_once(get_langfile_path());
require_once(get_langfile_path("",true));
loggedinorreturn();
parked();
if ($enableoffer == 'no')
permissiondenied();
function bark($msg) {
global $lang_offers;
stdhead($lang_offers['head_offer_error']);
stdmsg($lang_offers['std_error'], $msg);
stdfoot();
exit;
}
if ($_GET["category"]){
$categ = isset($_GET['category']) ? (int)$_GET['category'] : 0;
if(!is_valid_id($categ))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
if ($_GET["id"]){
$id = 0 + htmlspecialchars($_GET["id"]);
if (preg_match('/^[0-9]+$/', !$id))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//==== add offer
if ($_GET["add_offer"]){
if (get_user_class() < $addoffer_class)
permissiondenied();
$add_offer = 0 + $_GET["add_offer"];
if($add_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
stdhead($lang_offers['head_offer']);
print("<p>".$lang_offers['text_red_star_required']."</p>");
print("<div align=\"center\"><form id=\"compose\" action=\"?new_offer=1\" name=\"compose\" method=\"post\">".
"<table width=940 border=0 cellspacing=0 cellpadding=5><tr><td class=colhead align=center colspan=2>".$lang_offers['text_offers_open_to_all']."</td></tr>\n");
$s = "<select name=type>\n<option value=0>".$lang_offers['select_type_select']."</option>\n";
$cats = genrelist($browsecatmode);
foreach ($cats as $row)
$s .= "<option value=".$row["id"].">" . htmlspecialchars($row["name"]) . "</option>\n";
$s .= "</select>\n";
print("<tr><td class=rowhead align=right><b>".$lang_offers['row_type']."<font color=red>*</font></b></td><td class=rowfollow align=left> $s</td></tr>".
"<tr><td class=rowhead align=right><b>".$lang_offers['row_title']."<font color=red>*</font></b></td><td class=rowfollow align=left><input type=text name=name style=\"width: 650px;\" />".
"</td></tr><tr><td class=rowhead align=right><b>".$lang_offers['row_post_or_photo']."</b></td><td class=rowfollow align=left>".
"<input type=text name=picture style=\"width: 650px;\"><br />".$lang_offers['text_link_to_picture']."</td></tr>".
"<tr><td class=rowhead align=right valign=top><b>".$lang_offers['row_description']."<b><font color=red>*</font></td><td class=rowfollow align=left>\n");
textbbcode("compose","body",$body,false);
print("</td></tr><tr><td class=toolbox align=center colspan=2><input id=qr type=submit class=btn value=".$lang_offers['submit_add_offer']." ></td></tr></table></form><br />\n");
stdfoot();
die;
}
//=== end add offer
//=== take new offer
if ($_GET["new_offer"]){
if (get_user_class() < $addoffer_class)
permissiondenied();
$new_offer = 0 + $_GET["new_offer"];
if($new_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$userid = 0 + $CURUSER["id"];
if (preg_match("/^[0-9]+$/", !$userid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$name = $_POST["name"];
if ($name == "")
bark($lang_offers['std_must_enter_name']);
$cat = (0 + $_POST["type"]);
if (!is_valid_id($cat))
bark($lang_offers['std_must_select_category']);
$descrmain = unesc($_POST["body"]);
if (!$descrmain)
bark($lang_offers['std_must_enter_description']);
if (!empty($_POST['picture'])){
$picture = unesc($_POST["picture"]);
if(!preg_match("/^http:\/\/[^\s'\"<>]+\.(jpg|gif|png)$/i", $picture))
stderr($lang_offers['std_error'], $lang_offers['std_wrong_image_format']);
$pic = "[img]".$picture."[/img]\n";
}
$descr = $pic;
$descr .= $descrmain;
$res = sql_query("SELECT name FROM offers WHERE name =".sqlesc($_POST[name])) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if (!$arr['name']){
//===add karma //=== uncomment if you use the mod
//sql_query("UPDATE users SET seedbonus = seedbonus+10.0 WHERE id = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
//===end
$ret = sql_query("INSERT INTO offers (userid, name, descr, category, added) VALUES (" .
implode(",", array_map("sqlesc", array($CURUSER["id"], $name, $descr, 0 + $_POST["type"]))) .
", '" . date("Y-m-d H:i:s") . "')");
if (!$ret) {
if (mysql_errno() == 1062)
bark("!!!");
bark("mysql puked: ".mysql_error());
}
$id = mysql_insert_id();
write_log("offer $name was added by ".$CURUSER[username],'normal');
header("Refresh: 0; url=offers.php?id=$id&off_details=1");
stdhead($lang_offers['head_success']);
}
else{
stderr ($lang_offers['std_error'], $lang_offers['std_offer_exists']."<a class=altlink href=offers.php>".$lang_offers['text_view_all_offers']."</a>",false);
}
stdfoot();
die;
}
//==end take new offer
//=== offer details
if ($_GET["off_details"]){
$off_details = 0 + $_GET["off_details"];
if($off_details != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = 0+$_GET["id"];
if(!$id)
die();
//stderr("Error", "I smell a rat!");
$res = sql_query("SELECT * FROM offers WHERE id = $id") or sqlerr(__FILE__,__LINE__);
$num = mysql_fetch_array($res);
$s = $num["name"];
stdhead($lang_offers['head_offer_detail_for']." \"".$s."\"");
print("<h1 align=\"center\" id=\"top\">".htmlspecialchars($s)."</h1>");
print("<table width=\"940\" cellspacing=\"0\" cellpadding=\"5\">");
$offertime = gettime($num['added'],true,false);
if ($CURUSER['timetype'] != 'timealive')
$offertime = $lang_offers['text_at'].$offertime;
else $offertime = $lang_offers['text_blank'].$offertime;
tr($lang_offers['row_info'], $lang_offers['text_offered_by'].get_username($num['userid']).$offertime, 1);
if ($num["allowed"] == "pending")
$status="<font color=\"red\">".$lang_offers['text_pending']."</font>";
elseif ($num["allowed"] == "allowed")
$status="<font color=\"green\">".$lang_offers['text_allowed']."</font>";
else
$status="<font color=\"red\">".$lang_offers['text_denied']."</font>";
tr($lang_offers['row_status'], $status, 1);
//=== if you want to have a pending thing for uploaders use this next bit
if (get_user_class() >= $offermanage_class && $num["allowed"] == "pending")
tr($lang_offers['row_allow'], "<table><tr><td class=\"embedded\"><form method=\"post\" action=\"?allow_offer=1\"><input type=\"hidden\" value=\"".$id."\" name=\"offerid\" />".
"<input class=\"btn\" type=\"submit\" value=\"".$lang_offers['submit_allow']."\" /> </form></td><td class=\"embedded\"><form method=\"post\" action=\"?id=".$id."&finish_offer=1\">".
"<input type=\"hidden\" value=\"".$id."\" name=\"finish\" /><input class=\"btn\" type=\"submit\" value=\"".$lang_offers['submit_let_votes_decide']."\" /></form></td></tr></table>", 1);
$zres = sql_query("SELECT COUNT(*) from offervotes where vote='yeah' and offerid=$id");
$arr = mysql_fetch_row($zres);
$za = $arr[0];
$pres = sql_query("SELECT COUNT(*) from offervotes where vote='against' and offerid=$id");
$arr2 = mysql_fetch_row($pres);
$protiv = $arr2[0];
//=== in the following section, there is a line to report comment... either remove the link or change it to work with your report script :)
//if pending
if ($num["allowed"] == "pending"){
tr($lang_offers['row_vote'], "<b>".
"<a href=\"?id=".$id."&vote=yeah\"><font color=\"green\">".$lang_offers['text_for']."</font></a></b>".(get_user_class() >= $againstoffer_class ? " - <b><a href=\"?id=".$id."&vote=against\">".
"<font color=\"red\">".$lang_offers['text_against']."</font></a></b>" : ""), 1);
tr($lang_offers['row_vote_results'],
"<b>".$lang_offers['text_for'].":</b> $za <b>".$lang_offers['text_against']."</b> $protiv <a href=\"?id=".$id."&offer_vote=1\"><i>".$lang_offers['text_see_vote_detail']."</i></a>", 1);
}
//===upload torrent message
if ($num["allowed"] == "allowed" && $CURUSER["id"] != $num["userid"])
tr($lang_offers['row_offer_allowed'], $lang_offers['text_voter_receives_pm_note'], 1);
if ($num["allowed"] == "allowed" && $CURUSER["id"] == $num["userid"]){
tr($lang_offers['row_offer_allowed'],
$lang_offers['text_urge_upload_offer_note'], 1);
}
if ($CURUSER[id] == $num[userid] || get_user_class() >= $offermanage_class){
$edit = "<a href=\"?id=".$id."&edit_offer=1\"><img class=\"dt_edit\" src=\"pic/trans.gif\" alt=\"edit\" /> <b><font class=\"small\">".$lang_offers['text_edit_offer'] . "</font></b></a> | ";
$delete = "<a href=\"?id=".$id."&del_offer=1&sure=0\"><img class=\"dt_delete\" src=\"pic/trans.gif\" alt=\"delete\" /> <b><font class=\"small\">".$lang_offers['text_delete_offer']."</font></b></a> | ";
}
$report = "<a href=\"report.php?reportofferid=".$id."\"><img class=\"dt_report\" src=\"pic/trans.gif\" alt=\"report\" /> <b><font class=\"small\">".$lang_offers['report_offer']."</font></b></a>";
tr($lang_offers['row_action'], $edit . $delete .$report, 1);
if ($num["descr"]){
$off_bb = format_comment($num["descr"]);
tr($lang_offers['row_description'], $off_bb, 1);
}
print("</table>");
// -----------------COMMENT SECTION ---------------------//
$commentbar = "<p align=\"center\"><a class=\"index\" href=\"comment.php?action=add&pid=".$id."&type=offer\">".$lang_offers['text_add_comment']."</a></p>\n";
$subres = sql_query("SELECT COUNT(*) FROM comments WHERE offer = $id");
$subrow = mysql_fetch_array($subres);
$count = $subrow[0];
if (!$count) {
print("<h1 id=\"startcomments\" align=\"center\">".$lang_offers['text_no_comments']."</h1>\n");
}
else {
list($pagertop, $pagerbottom, $limit) = pager(10, $count, "offers.php?id=$id&off_details=1&", array(lastpagedefault => 1));
$subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE offer = " . sqlesc($id) . " ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
$allrows = array();
while ($subrow = mysql_fetch_array($subres))
$allrows[] = $subrow;
//end_frame();
//print($commentbar);
print($pagertop);
commenttable($allrows,"offer",$id);
print($pagerbottom);
}
print("<table style='border:1px solid #000000;'><tr>".
"<td class=\"text\" align=\"center\"><b>".$lang_offers['text_quick_comment']."</b><br /><br />".
"<form id=\"compose\" name=\"comment\" method=\"post\" action=\"comment.php?action=add&type=offer\" onsubmit=\"return postvalid(this);\">".
"<input type=\"hidden\" name=\"pid\" value=\"".$id."\" /><br />");
quickreply('comment', 'body',$lang_offers['submit_add_comment']);
print("</form></td></tr></table>");
print($commentbar);
stdfoot();
die;
}
//=== end offer details
//=== allow offer by staff
if ($_GET["allow_offer"]) {
if (get_user_class() < $offermanage_class)
stderr($lang_offers['std_access_denied'], $lang_offers['std_mans_job']);
$allow_offer = 0 + $_GET["allow_offer"];
if($allow_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
//=== to allow the offer credit to S4NE for this next bit :)
//if ($_POST["offerid"]){
$offid = 0 + $_POST["offerid"];
if(!is_valid_id($offid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers inner join users on offers.userid = users.id where offers.id = $offid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
$msg = "$CURUSER[username]".$lang_offers_target[get_user_lang($arr["userid"])]['msg_has_allowed']."[b][url=". get_protocol_prefix() . $BASEURL ."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b]. ".$lang_offers_target[get_user_lang($arr["userid"])]['msg_find_offer_option'].$timeoutnote;
$subject = $lang_offers_target[get_user_lang($arr["userid"])]['msg_your_offer_allowed'];
$allowedtime = date("Y-m-d H:i:s");
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], '" . $allowedtime . "', " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
sql_query ("UPDATE offers SET allowed = 'allowed', allowedtime = '".$allowedtime."' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
write_log("$CURUSER[username] allowed offer $arr[name]",'normal');
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$offid&off_details=1");
}
//=== end allow the offer
//=== allow offer by vote
if ($_GET["finish_offer"]) {
if (get_user_class() < $offermanage_class)
stderr($lang_offers['std_access_denied'], $lang_offers['std_have_no_permission']);
$finish_offer = 0 + $_GET["finish_offer"];
if($finish_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offid = 0 + $_POST["finish"];
if(!is_valid_id($offid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers inner join users on offers.userid = users.id where offers.id = $offid") or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$voteresyes = sql_query("SELECT COUNT(*) from offervotes where vote='yeah' and offerid=$offid");
$arryes = mysql_fetch_row($voteresyes);
$yes = $arryes[0];
$voteresno = sql_query("SELECT COUNT(*) from offervotes where vote='against' and offerid=$offid");
$arrno = mysql_fetch_row($voteresno);
$no = $arrno[0];
if($yes == '0' && $no == '0')
stderr($lang_offers['std_sorry'], $lang_offers['std_no_votes_yet']."<a href=offers.php?id=$offid&off_details=1>".$lang_offers['std_back_to_offer_detail']."</a>",false);
$finishvotetime = date("Y-m-d H:i:s");
if (($yes - $no)>=$minoffervotes){
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
$msg = $lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_voted_on']."[b][url=" . get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].". $lang_offers_target[get_user_lang($arr["userid"])]['msg_find_offer_option'].$timeoutnote;
sql_query ("UPDATE offers SET allowed = 'allowed',allowedtime ='".$finishvotetime."' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
}
else if(($no - $yes)>=$minoffervotes){
$msg = $lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_voted_off']."[b][url=". get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].".$lang_offers_target[get_user_lang($arr["userid"])]['msg_offer_deleted'] ;
sql_query ("UPDATE offers SET allowed = 'denied' WHERE id = $offid") or sqlerr(__FILE__,__LINE__);
}
//===use this line if you DO HAVE subject in your PM system
$subject = $lang_offers_target[get_user_lang($arr[userid])]['msg_your_offer'].$arr[name].$lang_offers_target[get_user_lang($arr[userid])]['msg_voted_on'];
sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, ".sqlesc($subject).", $arr[userid], '" . $finishvotetime . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
//===use this line if you DO NOT subject in your PM system
//sql_query("INSERT INTO messages (sender, receiver, added, msg) VALUES(0, $arr[userid], '" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")") or sqlerr(__FILE__, __LINE__);
write_log("$CURUSER[username] closed poll $arr[name]",'normal');
header("Refresh: 0; url=" . get_protocol_prefix() . "$BASEURL/offers.php?id=$offid&off_details=1");
die;
}
//===end allow offer by vote
//=== edit offer
if ($_GET["edit_offer"]) {
$edit_offer = 0 + $_GET["edit_offer"];
if($edit_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = 0 + $_GET["id"];
$res = sql_query("SELECT * FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
$timezone = $num["added"];
$s = $num["name"];
$id2 = $num["category"];
if ($CURUSER["id"] != $num["userid"] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_cannot_edit_others_offer']);
$body = htmlspecialchars(unesc($num["descr"]));
$s2 = "<select name=\"category\">\n";
$cats = genrelist($browsecatmode);
foreach ($cats as $row)
$s2 .= "<option value=\"" . $row["id"] . "\" ".($row['id'] == $id2 ? " selected=\"selected\"" : "").">" . htmlspecialchars($row["name"]) . "</option>\n";
$s2 .= "</select>\n";
stdhead($lang_offers['head_edit_offer'].": $s");
$title = htmlspecialchars(trim($s));
print("<form id=\"compose\" method=\"post\" name=\"compose\" action=\"?id=".$id."&take_off_edit=1\">".
"<table width=\"940\" cellspacing=\"0\" cellpadding=\"3\"><tr><td class=\"colhead\" align=\"center\" colspan=\"2\">".$lang_offers['text_edit_offer']."</td></tr>");
tr($lang_offers['row_type']."<font color=\"red\">*</font>", $s2, 1);
tr($lang_offers['row_title']."<font color=\"red\">*</font>", "<input type=\"text\" style=\"width: 650px\" name=\"name\" value=\"".$title."\" />", 1);
tr($lang_offers['row_post_or_photo'], "<input type=\"text\" name=\"picture\" style=\"width: 650px\" value='' /><br />".$lang_offers['text_link_to_picture'], 1);
print("<tr><td class=\"rowhead\" align=\"right\" valign=\"top\"><b>".$lang_offers['row_description']."<font color=\"red\">*</font></b></td><td class=\"rowfollow\" align=\"left\">");
textbbcode("compose","body",$body,false);
print("</td></tr>");
print("<tr><td class=\"toolbox\" style=\"vertical-align: middle; padding-top: 10px; padding-bottom: 10px;\" align=\"center\" colspan=\"2\"><input id=\"qr\" type=\"submit\" value=\"".$lang_offers['submit_edit_offer']."\" class=\"btn\" /></td></tr></table></form><br />\n");
stdfoot();
die;
}
//=== end edit offer
//==== take offer edit
if ($_GET["take_off_edit"]){
$take_off_edit = 0 + $_GET["take_off_edit"];
if($take_off_edit != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$id = 0 + $_GET["id"];
$res = sql_query("SELECT userid FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
if ($CURUSER[id] != $num[userid] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_access_denied']);
$name = $_POST["name"];
if (!empty($_POST['picture'])){
$picture = unesc($_POST["picture"]);
if(!preg_match("/^http:\/\/[^\s'\"<>]+\.(jpg|gif|png)$/i", $picture))
stderr($lang_offers['std_error'], $lang_offers['std_wrong_image_format']);
$pic = "[img]".$picture."[/img]\n";
}
$descr = "$pic";
$descr .= unesc($_POST["body"]);
if (!$name)
bark($lang_offers['std_must_enter_name']);
if (!$descr)
bark($lang_offers['std_must_enter_description']);
$cat = (0 + $_POST["category"]);
if (!is_valid_id($cat))
bark($lang_offers['std_must_select_category']);
$name = sqlesc($name);
$descr = sqlesc($descr);
$cat = sqlesc($cat);
sql_query("UPDATE offers SET category=$cat, name=$name, descr=$descr where id=".sqlesc($id));
//header("Refresh: 0; url=offers.php?id=$id&off_details=1");
}
//======end take offer edit
//=== offer votes list
if ($_GET["offer_vote"]){
$offer_vote = 0 + $_GET["offer_vote"];
if($offer_vote != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offerid = 0 + htmlspecialchars($_GET[id]);
$res2 = sql_query("SELECT COUNT(*) FROM offervotes WHERE offerid = ".sqlesc($offerid)) or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res2);
$count = $row[0];
$offername = get_single_value("offers","name","WHERE id=".sqlesc($offerid));
stdhead($lang_offers['head_offer_voters']." - \"".$offername."\"");
print("<h1 align=center>".$lang_offers['text_vote_results_for']." <a href=offers.php?id=$offerid&off_details=1><b>".htmlspecialchars($offername)."</b></a></h1>");
$perpage = 25;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?id=".$offerid."&offer_vote=1&");
$res = sql_query("SELECT * FROM offervotes WHERE offerid=".sqlesc($offerid)." ".$limit) or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) == 0)
print("<p align=center><b>".$lang_offers['std_no_votes_yet']."</b></p>\n");
else
{
echo $pagertop;
print("<table border=1 cellspacing=0 cellpadding=5><tr><td class=colhead>".$lang_offers['col_user']."</td><td class=colhead align=left>".$lang_offers['col_vote']."</td>\n");
while ($arr = mysql_fetch_assoc($res))
{
if ($arr[vote] == 'yeah')
$vote = "<b><font color=green>".$lang_offers['text_for']."</font></b>";
elseif ($arr[vote] == 'against')
$vote = "<b><font color=red>".$lang_offers['text_against']."</font></b>";
else $vote = "unknown";
print("<tr><td class=rowfollow>" . get_username($arr['userid']) . "</td><td class=rowfollow align=left >".$vote."</td></tr>\n");
}
print("</table>\n");
echo $pagerbottom;
}
stdfoot();
die;
}
//=== end offer votes list
//=== offer votes
if ($_GET["vote"]){
$offerid = 0 + htmlspecialchars($_GET["id"]);
$vote = htmlspecialchars($_GET["vote"]);
if ($vote == 'against' && get_user_class() < $againstoffer_class)
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
if ($vote =='yeah' || $vote =='against')
{
$userid = 0+$CURUSER["id"];
$res = sql_query("SELECT * FROM offervotes WHERE offerid=".sqlesc($offerid)." AND userid=".sqlesc($userid)) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$voted = $arr;
$offer_userid = get_single_value("offers", "userid", "WHERE id=".sqlesc($offerid));
if ($offer_userid == $CURUSER['id'])
{
stderr($lang_offers['std_error'], $lang_offers['std_cannot_vote_youself']);
}
elseif ($voted)
{
stderr($lang_offers['std_already_voted'],$lang_offers['std_already_voted_note']."<a href=offers.php?id=$offerid&off_details=1>".$lang_offers['std_back_to_offer_detail'] ,false);
}
else
{
sql_query("UPDATE offers SET $vote = $vote + 1 WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$res = sql_query("SELECT users.username, offers.userid, offers.name FROM offers LEFT JOIN users ON offers.userid = users.id WHERE offers.id = ".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$arr = mysql_fetch_assoc($res);
$rs = sql_query("SELECT yeah, against, allowed FROM offers WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$ya_arr = mysql_fetch_assoc($rs);
$yeah = $ya_arr["yeah"];
$against = $ya_arr["against"];
$finishtime = date("Y-m-d H:i:s");
//allowed and send offer voted on message
if(($yeah-$against)>=$minoffervotes && $ya_arr['allowed'] != "allowed")
{
if ($offeruptimeout_main){
$timeouthour = floor($offeruptimeout_main/3600);
$timeoutnote = $lang_offers_target[get_user_lang($arr["userid"])]['msg_you_must_upload_in'].$timeouthour.$lang_offers_target[get_user_lang($arr["userid"])]['msg_hours_otherwise'];
}
else $timeoutnote = "";
sql_query("UPDATE offers SET allowed='allowed', allowedtime=".sqlesc($finishtime)." WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_on']."[b][url=". get_protocol_prefix() . $BASEURL."/offers.php?id=$offerid&off_details=1]" . $arr[name] . "[/url][/b].". $lang_offers_target[get_user_lang($arr['userid'])]['msg_find_offer_option'].$timeoutnote;
$subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_your_offer_allowed'];
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
write_log("System allowed offer $arr[name]",'normal');
}
//denied and send offer voted off message
if(($against-$yeah)>=$minoffervotes && $ya_arr['allowed'] != "denied")
{
sql_query("UPDATE offers SET allowed='denied' WHERE id=".sqlesc($offerid)) or sqlerr(__FILE__,__LINE__);
$msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_off']."[b][url=" . get_protocol_prefix() . $BASEURL."/offers.php?id=$offid&off_details=1]" . $arr[name] . "[/url][/b].".$lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'] ;
$subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'];
sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[userid], " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", ".sqlesc($subject).")") or sqlerr(__FILE__, __LINE__);
write_log("System denied offer $arr[name]",'normal');
}
sql_query("INSERT INTO offervotes (offerid, userid, vote) VALUES($offerid, $userid, ".sqlesc($vote).")") or sqlerr(__FILE__,__LINE__);
KPS("+",$offervote_bonus,$CURUSER["id"]);
stdhead($lang_offers['head_vote_for_offer']);
print("<h1 align=center>".$lang_offers['std_vote_accepted']."</h1>");
print($lang_offers['std_vote_accepted_note']."<a href=offers.php?id=$offerid&off_details=1>".$lang_offers['std_back_to_offer_detail']);
stdfoot();
die;
}
}
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//=== end offer votes
//=== delete offer
if ($_GET["del_offer"]){
$del_offer = 0 + $_GET["del_offer"];
if($del_offer != '1')
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$offer = 0 + $_GET["id"];
$userid = 0 + $CURUSER["id"];
if (!is_valid_id($userid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
$res = sql_query("SELECT * FROM offers WHERE id = $offer") or sqlerr(__FILE__, __LINE__);
$num = mysql_fetch_array($res);
$name = $num["name"];
if ($userid != $num["userid"] && get_user_class() < $offermanage_class)
stderr($lang_offers['std_error'], $lang_offers['std_cannot_delete_others_offer']);
if ($_GET["sure"])
{
$sure = $_GET["sure"];
if($sure == '0' || $sure == '1')
$sure = 0 + $_GET["sure"];
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
if ($sure == 0)
stderr($lang_offers['std_delete_offer'], $lang_offers['std_delete_offer_note']."<br /><form method=post action=offers.php?id=$offer&del_offer=1&sure=1>".$lang_offers['text_reason_is']."<input type=text style=\"width: 200px\" name=reason><input type=submit value=\"".$lang_offers['submit_confirm']."\"></form>",false);
elseif ($sure == 1)
{
$reason = $_POST["reason"];
sql_query("DELETE FROM offers WHERE id=$offer");
sql_query("DELETE FROM offervotes WHERE offerid=$offer");
sql_query("DELETE FROM comments WHERE offer=$offer");
//===add karma //=== use this if you use the karma mod
//sql_query("UPDATE users SET seedbonus = seedbonus-10.0 WHERE id = $num[userid]") or sqlerr(__FILE__, __LINE__);
//===end
if ($CURUSER["id"] != $num["userid"])
{
$added = sqlesc(date("Y-m-d H:i:s"));
$subject = sqlesc($lang_offers_target[get_user_lang($num["userid"])]['msg_offer_deleted']);
$msg = sqlesc($lang_offers_target[get_user_lang($num["userid"])]['msg_your_offer'].$num[name].$lang_offers_target[get_user_lang($num["userid"])]['msg_was_deleted_by']. "[url=userdetails.php?id=".$CURUSER['id']."]".$CURUSER['username']."[/url]".$lang_offers_target[get_user_lang($num["userid"])]['msg_blank'].($reason != "" ? $lang_offers_target[get_user_lang($num["userid"])]['msg_reason_is'].$reason : ""));
sql_query("INSERT INTO messages (sender, receiver, msg, added, subject) VALUES(0, $num[userid], $msg, $added, $subject)") or sqlerr(__FILE__, __LINE__);
}
write_log("Offer: $offer ($num[name]) was deleted by $CURUSER[username]".($reason != "" ? " (".$reason.")" : ""),'normal');
header("Refresh: 0; url=offers.php");
die;
}
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//== end delete offer
//=== prolly not needed, but what the hell... basically stopping the page getting screwed up
if ($_GET["sort"])
{
$sort = $_GET["sort"];
if($sort == 'cat' || $sort == 'name' || $sort == 'added' || $sort == 'comments' || $sort == 'yeah' || $sort == 'against' || $sort == 'v_res')
$sort = $_GET["sort"];
else
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
//=== end of prolly not needed, but what the hell :P
$categ = 0 + $_GET["category"];
if ($_GET["offerorid"]){
$offerorid = 0 + htmlspecialchars($_GET["offerorid"]);
if (preg_match("/^[0-9]+$/", !$offerorid))
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
}
$search = ($_GET["search"]);
if ($search) {
$search = " AND offers.name like ".sqlesc("%$search%");
} else {
$search = "";
}
$cat_order_type = "desc";
$name_order_type = "desc";
$added_order_type = "desc";
$comments_order_type = "desc";
$v_res_order_type = "desc";
/*
if ($cat_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $cat_order_type = "asc"; } // for torrent name
if ($name_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $name_order_type = "desc"; }
if ($added_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $added_order_type = "desc"; }
if ($comments_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $comments_order_type = "desc"; }
if ($v_res_order_type == "") { $sort = " ORDER BY added " . $added_order_type; $v_res_order_type = "desc"; }
*/
if ($sort == "cat")
{
if ($_GET['type'] == "desc")
$cat_order_type = "asc";
$sort = " ORDER BY category ". $cat_order_type;
}
else if ($sort == "name")
{
if ($_GET['type'] == "desc")
$name_order_type = "asc";
$sort = " ORDER BY name ". $name_order_type;
}
else if ($sort == "added")
{
if ($_GET['type'] == "desc")
$added_order_type = "asc";
$sort = " ORDER BY added " . $added_order_type;
}
else if ($sort == "comments")
{
if ($_GET['type'] == "desc")
$comments_order_type = "asc";
$sort = " ORDER BY comments " . $comments_order_type;
}
else if ($sort == "v_res")
{
if ($_GET['type'] == "desc")
$v_res_order_type = "asc";
$sort = " ORDER BY (yeah - against) " . $v_res_order_type;
}
if ($offerorid <> NULL)
{
if (($categ <> NULL) && ($categ <> 0))
$categ = "WHERE offers.category = " . $categ . " AND offers.userid = " . $offerorid;
else
$categ = "WHERE offers.userid = " . $offerorid;
}
else if ($categ == 0)
$categ = '';
else
$categ = "WHERE offers.category = " . $categ;
$res = sql_query("SELECT count(offers.id) FROM offers inner join categories on offers.category = categories.id inner join users on offers.userid = users.id $categ $search") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
$count = $row[0];
$perpage = 25;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["PHP_SELF"] ."?" . "category=" . $_GET["category"] . "&sort=" . $_GET["sort"] . "&" );
//stderr("", $sort);
if($sort == "")
$sort = "ORDER BY added desc ";
$res = sql_query("SELECT offers.id, offers.userid, offers.name, offers.added, offers.allowedtime, offers.comments, offers.yeah, offers.against, offers.category as cat_id, offers.allowed, categories.image, categories.name as cat FROM offers inner join categories on offers.category = categories.id $categ $search $sort $limit") or sqlerr(__FILE__,__LINE__);
$num = mysql_num_rows($res);
stdhead($lang_offers['head_offers']);
begin_main_frame();
begin_frame($lang_offers['text_offers_section'], true,10,"100%","center");
print("<p align=\"left\"><b><font size=\"5\">".$lang_offers['text_rules']."</font></b></p>\n");
print("<div align=\"left\"><ul>");
print("<li>".$lang_offers['text_rule_one_one'].get_user_class_name($upload_class, false, true, true).$lang_offers['text_rule_one_two'].get_user_class_name($addoffer_class, false, true, true).$lang_offers['text_rule_one_three']."</li>\n");
print("<li>".$lang_offers['text_rule_two_one']."<b>".$minoffervotes."</b>".$lang_offers['text_rule_two_two']."</li>\n");
if ($offervotetimeout_main)
print("<li>".$lang_offers['text_rule_three_one']."<b>".($offervotetimeout_main / 3600)."</b>".$lang_offers['text_rule_three_two']."</li>\n");
if ($offeruptimeout_main)
print("<li>".$lang_offers['text_rule_four_one']."<b>".($offeruptimeout_main / 3600)."</b>".$lang_offers['text_rule_four_two']."</li>\n");
print("</ul></div>");
if (get_user_class() >= $addoffer_class)
print("<div align=\"center\" style=\"margin-bottom: 8px;\"><a href=\"?add_offer=1\">".
"<b>".$lang_offers['text_add_offer']."</b></a></div>");
print("<div align=\"center\"><form method=\"get\" action=\"?\">".$lang_offers['text_search_offers']." <input type=\"text\" id=\"specialboxg\" name=\"search\" /> ");
$cats = genrelist($browsecatmode);
$catdropdown = "";
foreach ($cats as $cat) {
$catdropdown .= "<option value=\"" . $cat["id"] . "\"";
$catdropdown .= ">" . htmlspecialchars($cat["name"]) . "</option>\n";
}
print("<select name=\"category\"><option value=\"0\">".$lang_offers['select_show_all']."</option>".$catdropdown."</select> <input type=\"submit\" class=\"btn\" value=\"".$lang_offers['submit_search']."\" /></form></div>");
end_frame();
print("<br /><br />");
$last_offer = strtotime($CURUSER['last_offer']);
if (!$num)
stdmsg($lang_offers['text_nothing_found'],$lang_offers['text_nothing_found']);
else
{
$catid = $_GET[category];
print("<table class=\"torrents\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\">");
print("<tr><td class=\"colhead\" style=\"padding: 0px\"><a href=\"?category=" . $catid . "&sort=cat&type=".$cat_order_type."\">".$lang_offers['col_type']."</a></td>".
"<td class=\"colhead\" width=\"100%\"><a href=\"?category=" . $catid . "&sort=name&type=".$name_order_type."\">".$lang_offers['col_title']."</a></td>".
"<td colspan=\"3\" class=\"colhead\"><a href=\"?category=" . $catid . "&sort=v_res&type=".$v_res_order_type."\">".$lang_offers['col_vote_results']."</a></td>".
"<td class=\"colhead\"><a href=\"?category=" . $catid . "&sort=comments&type=".$comments_order_type."\"><img class=\"comments\" src=\"pic/trans.gif\" alt=\"comments\" title=\"".$lang_offers['title_comment']."\" />".$lang_offers['col_comment']."</a></td>".
"<td class=\"colhead\"><a href=\"?category=" . $catid . "&sort=added&type=".$added_order_type."\"><img class=\"time\" src=\"pic/trans.gif\" alt=\"time\" title=\"".$lang_offers['title_time_added']."\" /></a></td>");
if ($offervotetimeout_main > 0 && $offeruptimeout_main > 0)
print("<td class=\"colhead\">".$lang_offers['col_timeout']."</td>");
print("<td class=\"colhead\">".$lang_offers['col_offered_by']."</td>".
(get_user_class() >= $offermanage_class ? "<td class=\"colhead\">".$lang_offers['col_act']."</td>" : "")."</tr>\n");
for ($i = 0; $i < $num; ++$i)
{
$arr = mysql_fetch_assoc($res);
$addedby = get_username($arr['userid']);
$comms = $arr['comments'];
if ($comms == 0)
$comment = "<a href=\"comment.php?action=add&pid=".$arr[id]."&type=offer\" title=\"".$lang_offers['title_add_comments']."\">0</a>";
else
{
if (!$lastcom = $Cache->get_value('offer_'.$arr[id].'_last_comment_content')){
$res2 = sql_query("SELECT user, added, text FROM comments WHERE offer = $arr[id] ORDER BY added DESC LIMIT 1");
$lastcom = mysql_fetch_array($res2);
$Cache->cache_value('offer_'.$arr[id].'_last_comment_content', $lastcom, 1855);
}
$timestamp = strtotime($lastcom["added"]);
$hasnewcom = ($lastcom['user'] != $CURUSER['id'] && $timestamp >= $last_offer);
if ($CURUSER['showlastcom'] != 'no')
{
if ($lastcom)
{
$title = "";
if ($CURUSER['timetype'] != 'timealive')
$lastcomtime = $lang_offers['text_at_time'].$lastcom['added'];
else
$lastcomtime = $lang_offers['text_blank'].gettime($lastcom["added"],true,false,true);
$counter = $i;
$lastcom_tooltip[$counter]['id'] = "lastcom_" . $counter;
$lastcom_tooltip[$counter]['content'] = ($hasnewcom ? "<b>(<font class='new'>".$lang_offers['text_new']."</font>)</b> " : "").$lang_offers['text_last_commented_by'].get_username($lastcom['user']) . $lastcomtime."<br />". format_comment(mb_substr($lastcom['text'],0,100,"UTF-8") . (mb_strlen($lastcom['text'],"UTF-8") > 100 ? " ......" : "" ),true,false,false,true,600,false,false);
$onmouseover = "onmouseover=\"domTT_activate(this, event, 'content', document.getElementById('" . $lastcom_tooltip[$counter]['id'] . "'), 'trail', false, 'delay', 500,'lifetime',3000,'fade','both','styleClass','niceTitle','fadeMax', 87,'maxWidth', 400);\"";
}
}
else
{
$title = " title=\"".($hasnewcom ? $lang_offers['title_has_new_comment'] : $lang_offers['title_no_new_comment'])."\"";
$onmouseover = "";
}
$comment = "<b><a".$title." href=\"?id=".$arr[id]."&off_details=1#startcomments\" ".$onmouseover.">".($hasnewcom ? "<font class='new'>" : ""). $comms .($hasnewcom ? "</font>" : "")."</a></b>";
}
//==== if you want allow deny for offers use this next bit
if ($arr["allowed"] == 'allowed')
$allowed = " <b>[<font color=\"green\">".$lang_offers['text_allowed']."</font>]</b>";
elseif ($arr["allowed"] == 'denied')
$allowed = " <b>[<font color=\"red\">".$lang_offers['text_denied']."</font>]</b>";
else
$allowed = " <b>[<font color=\"orange\">".$lang_offers['text_pending']."</font>]</b>";
//===end
if ($arr["yeah"] == 0)
$zvote = $arr[yeah];
else
$zvote = "<b><a href=\"?id=".$arr[id]."&offer_vote=1\">".$arr[yeah]."</a></b>";
if ($arr["against"] == 0)
$pvote = "$arr[against]";
else
$pvote = "<b><a href=\"?id=".$arr[id]."&offer_vote=1\">".$arr[against]."</a></b>";
if ($arr["yeah"] == 0 && $arr["against"] == 0)
{
$v_res = "0";
}
else
{
$v_res = "<b><a href=\"?id=".$arr[id]."&offer_vote=1\" title=\"".$lang_offers['title_show_vote_details']."\"><font color=\"green\">" .$arr[yeah]."</font> - <font color=\"red\">".$arr[against]."</font> = ".($arr[yeah] - $arr[against]). "</a></b>";
}
$addtime = gettime($arr['added'],false,true);
$dispname = $arr[name];
$count_dispname=mb_strlen($arr[name],"UTF-8");
$max_length_of_offer_name = 70;
if($count_dispname > $max_length_of_offer_name)
$dispname=mb_substr($dispname, 0, $max_length_of_offer_name-2,"UTF-8") . "..";
print("<tr><td class=\"rowfollow\" style=\"padding: 0px\"><a href=\"?category=".$arr['cat_id']."\">".return_category_image($arr['cat_id'], "")."</a></td><td style='text-align: left'><a href=\"?id=".$arr[id]."&off_details=1\" title=\"".htmlspecialchars($arr[name])."\"><b>".htmlspecialchars($dispname)."</b></a>".($CURUSER['appendnew'] != 'no' && strtotime($arr["added"]) >= $last_offer ? "<b> (<font class='new'>".$lang_offers['text_new']."</font>)</b>" : "").$allowed."</td><td class=\"rowfollow nowrap\" style='padding: 5px' align=\"center\">".$v_res."</td><td class=\"rowfollow nowrap\" ".(get_user_class() < $againstoffer_class ? " colspan=\"2\" " : "")." style='padding: 5px'><a href=\"?id=".$arr[id]."&vote=yeah\" title=\"".$lang_offers['title_i_want_this']."\"><font color=\"green\"><b>".$lang_offers['text_yep']."</b></font></a></td>".(get_user_class() >= $againstoffer_class ? "<td class=\"rowfollow nowrap\" align=\"center\"><a href=\"?id=".$arr[id]."&vote=against\" title=\"".$lang_offers['title_do_not_want_it']."\"><font color=\"red\"><b>".$lang_offers['text_nah']."</b></font></a></td>" : ""));
print("<td class=\"rowfollow\">".$comment."</td><td class=\"rowfollow nowrap\">" . $addtime. "</td>");
if ($offervotetimeout_main > 0 && $offeruptimeout_main > 0){
if ($arr["allowed"] == 'allowed'){
$futuretime = strtotime($arr['allowedtime']) + $offeruptimeout_main;
$timeout = gettime(date("Y-m-d H:i:s", $futuretime), false, true, true, false, true);
}
elseif ($arr["allowed"] == 'pending')
{
$futuretime = strtotime($arr['added']) + $offervotetimeout_main;
$timeout = gettime(date("Y-m-d H:i:s",$futuretime), false, true, true, false, true);
}
if (!$timeout)
$timeout = "N/A";
print("<td class=\"rowfollow nowrap\">".$timeout."</td>");
}
print("<td class=\"rowfollow\">".$addedby."</td>".(get_user_class() >= $offermanage_class ? "<td class=\"rowfollow\"><a href=\"?id=".$arr[id]."&del_offer=1\"><img class=\"staff_delete\" src=\"pic/trans.gif\" alt=\"D\" title=\"".$lang_offers['title_delete']."\" /></a><br /><a href=\"?id=".$arr[id]."&edit_offer=1\"><img class=\"staff_edit\" src=\"pic/trans.gif\" alt=\"E\" title=\"".$lang_offers['title_edit']."\" /></a></td>" : "")."</tr>");
}
print("</table>\n");
echo $pagerbottom;
if(!isset($CURUSER) || $CURUSER['showlastcom'] == 'yes')
create_tooltip_container($lastcom_tooltip, 400);
}
end_main_frame();
$USERUPDATESET[] = "last_offer = ".sqlesc(date("Y-m-d H:i:s"));
stdfoot();
?>