-
Notifications
You must be signed in to change notification settings - Fork 50
/
functions.php
4936 lines (4537 loc) · 189 KB
/
functions.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
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
# IMPORTANT: Do not edit below unless you know what you are doing!
if(!defined('IN_TRACKER'))
die('Hacking attempt!');
include_once($rootpath . 'include/globalfunctions.php');
include_once($rootpath . 'include/config.php');
include_once($rootpath . 'classes/class_advertisement.php');
require_once($rootpath . get_langfile_path("functions.php"));
function get_langfolder_cookie()
{
global $deflang;
if (!isset($_COOKIE["c_lang_folder"])) {
return $deflang;
} else {
$langfolder_array = get_langfolder_list();
foreach($langfolder_array as $lf)
{
if($lf == $_COOKIE["c_lang_folder"])
return $_COOKIE["c_lang_folder"];
}
return $deflang;
}
}
function get_user_lang($user_id)
{
$lang = mysql_fetch_assoc(sql_query("SELECT site_lang_folder FROM language LEFT JOIN users ON language.id = users.lang WHERE language.site_lang=1 AND users.id= ". sqlesc($user_id) ." LIMIT 1")) or $user_id;
return $lang['site_lang_folder'];
}
function get_langfile_path($script_name ="", $target = false, $lang_folder = "")
{
global $CURLANGDIR;
$CURLANGDIR = get_langfolder_cookie();
if($lang_folder == "")
{
$lang_folder = $CURLANGDIR;
}
return "lang/" . ($target == false ? $lang_folder : "_target") ."/lang_". ( $script_name == "" ? substr(strrchr($_SERVER['SCRIPT_NAME'],'/'),1) : $script_name);
}
function get_row_count($table, $suffix = "")
{
$r = sql_query("SELECT COUNT(*) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r) or die(mysql_error());
return $a[0];
}
function get_row_sum($table, $field, $suffix = "")
{
$r = sql_query("SELECT SUM($field) FROM $table $suffix") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r) or die(mysql_error());
return $a[0];
}
function get_single_value($table, $field, $suffix = ""){
$r = sql_query("SELECT $field FROM $table $suffix LIMIT 1") or sqlerr(__FILE__, __LINE__);
$a = mysql_fetch_row($r) or die(mysql_error());
if ($a) {
return $a[0];
} else {
return false;
}
}
function stdmsg($heading, $text, $htmlstrip = false)
{
if ($htmlstrip) {
$heading = htmlspecialchars(trim($heading));
$text = htmlspecialchars(trim($text));
}
print("<table align=\"center\" class=\"main\" width=\"500\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"embedded\">\n");
if ($heading)
print("<h2>".$heading."</h2>\n");
print("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\"><tr><td class=\"text\">");
print($text . "</td></tr></table></td></tr></table>\n");
}
function stderr($heading, $text, $htmlstrip = true, $head = true, $foot = true, $die = true)
{
if ($head) stdhead();
stdmsg($heading, $text, $htmlstrip);
if ($foot) stdfoot();
if ($die) die;
}
function sqlerr($file = '', $line = '')
{
print("<table border=\"0\" bgcolor=\"blue\" align=\"left\" cellspacing=\"0\" cellpadding=\"10\" style=\"background: blue;\">" .
"<tr><td class=\"embedded\"><font color=\"white\"><h1>SQL Error</h1>\n" .
"<b>" . mysql_error() . ($file != '' && $line != '' ? "<p>in $file, line $line</p>" : "") . "</b></font></td></tr></table>");
die;
}
function format_quotes($s)
{
global $lang_functions;
preg_match_all('/\\[quote.*?\\]/i', $s, $result, PREG_PATTERN_ORDER);
$openquotecount = count($openquote = $result[0]);
preg_match_all('/\\[\/quote\\]/i', $s, $result, PREG_PATTERN_ORDER);
$closequotecount = count($closequote = $result[0]);
if ($openquotecount != $closequotecount) return $s; // quote mismatch. Return raw string...
// Get position of opening quotes
$openval = array();
$pos = -1;
foreach($openquote as $val)
$openval[] = $pos = strpos($s,$val,$pos+1);
// Get position of closing quotes
$closeval = array();
$pos = -1;
foreach($closequote as $val)
$closeval[] = $pos = strpos($s,$val,$pos+1);
for ($i=0; $i < count($openval); $i++)
if ($openval[$i] > $closeval[$i]) return $s; // Cannot close before opening. Return raw string...
$s = preg_replace("/\\[quote\\]/i","<fieldset><legend> ".$lang_functions['text_quote']." </legend><br />",$s);
$s = preg_replace("/\\[quote=(.+?)\\]/i", "<fieldset><legend> ".$lang_functions['text_quote'].": \\1 </legend><br />", $s);
$s = preg_replace("/\\[\\/quote\\]/i","</fieldset><br />",$s);
return $s;
}
function print_attachment($dlkey, $enableimage = true, $imageresizer = true)
{
global $Cache, $httpdirectory_attachment;
global $lang_functions;
if (strlen($dlkey) == 32){
if (!$row = $Cache->get_value('attachment_'.$dlkey.'_content')){
$res = sql_query("SELECT * FROM attachments WHERE dlkey=".sqlesc($dlkey)." LIMIT 1") or sqlerr(__FILE__,__LINE__);
$row = mysql_fetch_array($res);
$Cache->cache_value('attachment_'.$dlkey.'_content', $row, 86400);
}
}
if (!$row)
{
return "<div style=\"text-decoration: line-through; font-size: 7pt\">".$lang_functions['text_attachment_key'].$dlkey.$lang_functions['text_not_found']."</div>";
}
else{
$id = $row['id'];
if ($row['isimage'] == 1)
{
if ($enableimage){
if ($row['thumb'] == 1){
$url = $httpdirectory_attachment."/".$row['location'].".thumb.jpg";
}
else{
$url = $httpdirectory_attachment."/".$row['location'];
}
if($imageresizer == true)
$onclick = " onclick=\"Previewurl('".$httpdirectory_attachment."/".$row['location']."')\"";
else $onclick = "";
$return = "<img id=\"attach".$id."\" alt=\"".htmlspecialchars($row['filename'])."\" src=\"".$url."\"". $onclick . " onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".$lang_functions['text_size']."</strong>: ".mksize($row['filesize'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\" />";
}
else $return = "";
}
else
{
switch($row['filetype'])
{
case 'application/x-bittorrent': {
$icon = "<img alt=\"torrent\" src=\"pic/attachicons/torrent.gif\" />";
break;
}
case 'application/zip':{
$icon = "<img alt=\"zip\" src=\"pic/attachicons/archive.gif\" />";
break;
}
case 'application/rar':{
$icon = "<img alt=\"rar\" src=\"pic/attachicons/archive.gif\" />";
break;
}
case 'application/x-7z-compressed':{
$icon = "<img alt=\"7z\" src=\"pic/attachicons/archive.gif\" />";
break;
}
case 'application/x-gzip':{
$icon = "<img alt=\"gzip\" src=\"pic/attachicons/archive.gif\" />";
break;
}
case 'audio/mpeg':{
}
case 'audio/ogg':{
$icon = "<img alt=\"audio\" src=\"pic/attachicons/audio.gif\" />";
break;
}
case 'video/x-flv':{
$icon = "<img alt=\"flv\" src=\"pic/attachicons/flv.gif\" />";
break;
}
default: {
$icon = "<img alt=\"other\" src=\"pic/attachicons/common.gif\" />";
}
}
$return = "<div class=\"attach\">".$icon." <a href=\"".htmlspecialchars("getattachment.php?id=".$id."&dlkey=".$dlkey)."\" target=\"_blank\" id=\"attach".$id."\" onmouseover=\"domTT_activate(this, event, 'content', '".htmlspecialchars("<strong>".$lang_functions['text_downloads']."</strong>: ".number_format($row['downloads'])."<br />".gettime($row['added']))."', 'styleClass', 'attach', 'x', findPosition(this)[0], 'y', findPosition(this)[1]-58);\">".htmlspecialchars($row['filename'])."</a> <font class=\"size\">(".mksize($row['filesize']).")</font></div>";
}
return $return;
}
}
function addTempCode($value) {
global $tempCode, $tempCodeCount;
$tempCode[$tempCodeCount] = $value;
$return = "<tempCode_$tempCodeCount>";
$tempCodeCount++;
return $return;
}
function formatAdUrl($adid, $url, $content, $newWindow=true)
{
return formatUrl("adredir.php?id=".$adid."&url=".rawurlencode($url), $newWindow, $content);
}
function formatUrl($url, $newWindow = false, $text = '', $linkClass = '') {
if (!$text) {
$text = $url;
}
return addTempCode("<a".($linkClass ? " class=\"$linkClass\"" : '')." href=\"$url\"" . ($newWindow==true? " target=\"_blank\"" : "").">$text</a>");
}
function formatCode($text) {
global $lang_functions;
return addTempCode("<br /><div class=\"codetop\">".$lang_functions['text_code']."</div><div class=\"codemain\">$text</div><br />");
}
function formatImg($src, $enableImageResizer, $image_max_width, $image_max_height) {
// if(preg_match('/highbd/i',$src))
// return addTempCode("<img alt=\"image\" src=\"img.php?mm=$src\"" .($enableImageResizer ? " onload=\"Scale(this,$image_max_width,$image_max_height);\" onclick=\"Preview(this);\"" : "") . " />");
// else
return addTempCode("<img alt=\"image\" src=\"$src\"" .($enableImageResizer ? " onload=\"Scale(this,$image_max_width,$image_max_height);\" onclick=\"Preview(this);\"" : "") . " />");
}
function formatFlash($src, $width, $height) {
if (!$width) {
$width = 500;
}
if (!$height) {
$height = 300;
}
return addTempCode("<object width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"$src\" /><embed src=\"$src\" width=\"$width\" height=\"$height\" type=\"application/x-shockwave-flash\"></embed></object>");
}
function formatFlv($src, $width, $height) {
if (!$width) {
$width = 320;
}
if (!$height) {
$height = 240;
}
return addTempCode("<object width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"flvplayer.swf?file=$src\" /><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"flvplayer.swf?file=$src\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed></object>");
}
function format_urls($text, $newWindow = false) {
return preg_replace("/((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/[^()\[\]<>\s]+)/ei",
"formatUrl('\\1', ".($newWindow==true ? 1 : 0).", '', 'faqlink')", $text);
}
function format_comment($text, $strip_html = true, $xssclean = false, $newtab = false, $imageresizer = true, $image_max_width = 700, $enableimage = true, $enableflash = true , $imagenum = -1, $image_max_height = 0, $adid = 0)
{
global $lang_functions;
global $CURUSER, $SITENAME, $BASEURL, $enableattach_attachment;
global $tempCode, $tempCodeCount;
$tempCode = array();
$tempCodeCount = 0;
$imageresizer = $imageresizer ? 1 : 0;
$s = $text;
if ($strip_html) {
$s = htmlspecialchars($s);
}
// Linebreaks
$s = nl2br($s);
if (strpos($s,"[code]") !== false && strpos($s,"[/code]") !== false) {
$s = preg_replace("/\[code\](.+?)\[\/code\]/eis","formatCode('\\1')", $s);
}
$originalBbTagArray = array('[siteurl]', '[site]','[*]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[pre]', '[/pre]', '[/color]', '[/font]', '[/size]', " ");
$replaceXhtmlTagArray = array(get_protocol_prefix().$BASEURL, $SITENAME, '<img class="listicon listitem" src="pic/trans.gif" alt="list" />', '<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<pre>', '</pre>', '</span>', '</font>', '</font>', ' ');
$s = str_replace($originalBbTagArray, $replaceXhtmlTagArray, $s);
$originalBbTagArray = array("/\[font=([^\[\(&\\;]+?)\]/is", "/\[color=([#0-9a-z]{1,15})\]/is", "/\[color=([a-z]+)\]/is", "/\[size=([1-7])\]/is");
$replaceXhtmlTagArray = array("<font face=\"\\1\">", "<span style=\"color: \\1;\">", "<span style=\"color: \\1;\">", "<font size=\"\\1\">");
$s = preg_replace($originalBbTagArray, $replaceXhtmlTagArray, $s);
if ($enableattach_attachment == 'yes' && $imagenum != 1){
$limit = 20;
$s = preg_replace("/\[attach\]([0-9a-zA-z][0-9a-zA-z]*)\[\/attach\]/ies", "print_attachment('\\1', ".($enableimage ? 1 : 0).", ".($imageresizer ? 1 : 0).")", $s, $limit);
}
if ($enableimage) {
$s = preg_replace("/\[img\]([^\<\r\n\"']+?)\[\/img\]/ei", "formatImg('\\1',".$imageresizer.",".$image_max_width.",".$image_max_height.")", $s, $imagenum, $imgReplaceCount);
$s = preg_replace("/\[img=([^\<\r\n\"']+?)\]/ei", "formatImg('\\1',".$imageresizer.",".$image_max_width.",".$image_max_height.")", $s, ($imagenum != -1 ? max($imagenum-$imgReplaceCount, 0) : -1));
} else {
$s = preg_replace("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", '', $s, -1);
$s = preg_replace("/\[img=([^\<\r\n\"']+?)\]/i", '', $s, -1);
}
// [flash,500,400]http://www/image.swf[/flash]
if (strpos($s,"[flash") !== false) { //flash is not often used. Better check if it exist before hand
if ($enableflash) {
$s = preg_replace("/\[flash(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|ftp):\/\/[^\s'\"<>]+(\.(swf)))\[\/flash\]/ei", "formatFlash('\\4', '\\2', '\\3')", $s);
} else {
$s = preg_replace("/\[flash(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|ftp):\/\/[^\s'\"<>]+(\.(swf)))\[\/flash\]/i", '', $s);
}
}
//[flv,320,240]http://www/a.flv[/flv]
if (strpos($s,"[flv") !== false) { //flv is not often used. Better check if it exist before hand
if ($enableflash) {
$s = preg_replace("/\[flv(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|ftp):\/\/[^\s'\"<>]+(\.(flv)))\[\/flv\]/ei", "formatFlv('\\4', '\\2', '\\3')", $s);
} else {
$s = preg_replace("/\[flv(\,([1-9][0-9]*)\,([1-9][0-9]*))?\]((http|ftp):\/\/[^\s'\"<>]+(\.(flv)))\[\/flv\]/i", '', $s);
}
}
// [url=http://www.example.com]Text[/url]
if ($adid) {
$s = preg_replace("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/ei", "formatAdUrl(".$adid." ,'\\1', '\\2', ".($newtab==true ? 1 : 0).", 'faqlink')", $s);
} else {
$s = preg_replace("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/ei", "formatUrl('\\1', ".($newtab==true ? 1 : 0).", '\\2', 'faqlink')", $s);
}
// [url]http://www.example.com[/url]
$s = preg_replace("/\[url\]([^\[\s]+?)\[\/url\]/ei",
"formatUrl('\\1', ".($newtab==true ? 1 : 0).", '', 'faqlink')", $s);
$s = format_urls($s, $newtab);
// Quotes
if (strpos($s,"[quote") !== false && strpos($s,"[/quote]") !== false) { //format_quote is kind of slow. Better check if [quote] exists beforehand
$s = format_quotes($s);
}
$s = preg_replace("/\[em([1-9][0-9]*)\]/ie", "(\\1 < 192 ? '<img src=\"pic/smilies/\\1.gif\" alt=\"[em\\1]\" />' : '[em\\1]')", $s);
reset($tempCode);
$j = 0;
while(count($tempCode) || $j > 5) {
foreach($tempCode as $key=>$code) {
$s = str_replace("<tempCode_$key>", $code, $s, $count);
if ($count) {
unset($tempCode[$key]);
$i = $i+$count;
}
}
$j++;
}
return $s;
}
function highlight($search,$subject,$hlstart='<b><font class="striking">',$hlend="</font></b>")
{
$srchlen=strlen($search); // lenght of searched string
if ($srchlen==0) return $subject;
$find = $subject;
while ($find = stristr($find,$search)) { // find $search text in $subject -case insensitiv
$srchtxt = substr($find,0,$srchlen); // get new search text
$find=substr($find,$srchlen);
$subject = str_replace($srchtxt,"$hlstart$srchtxt$hlend",$subject); // highlight founded case insensitive search text
}
return $subject;
}
function get_user_class()
{
global $CURUSER;
return $CURUSER["class"];
}
function get_user_class_name($class, $compact = false, $b_colored = false, $I18N = false)
{
static $en_lang_functions;
static $current_user_lang_functions;
if (!$en_lang_functions) {
require(get_langfile_path("functions.php",false,"en"));
$en_lang_functions = $lang_functions;
}
if(!$I18N) {
$this_lang_functions = $en_lang_functions;
} else {
if (!$current_user_lang_functions) {
require(get_langfile_path("functions.php"));
$current_user_lang_functions = $lang_functions;
}
$this_lang_functions = $current_user_lang_functions;
}
$class_name = "";
switch ($class)
{
case UC_PEASANT: {$class_name = $this_lang_functions['text_peasant']; break;}
case UC_USER: {$class_name = $this_lang_functions['text_user']; break;}
case UC_POWER_USER: {$class_name = $this_lang_functions['text_power_user']; break;}
case UC_ELITE_USER: {$class_name = $this_lang_functions['text_elite_user']; break;}
case UC_CRAZY_USER: {$class_name = $this_lang_functions['text_crazy_user']; break;}
case UC_INSANE_USER: {$class_name = $this_lang_functions['text_insane_user']; break;}
case UC_VETERAN_USER: {$class_name = $this_lang_functions['text_veteran_user']; break;}
case UC_EXTREME_USER: {$class_name = $this_lang_functions['text_extreme_user']; break;}
case UC_ULTIMATE_USER: {$class_name = $this_lang_functions['text_ultimate_user']; break;}
case UC_NEXUS_MASTER: {$class_name = $this_lang_functions['text_nexus_master']; break;}
case UC_VIP: {$class_name = $this_lang_functions['text_vip']; break;}
case UC_DOWNLOADER: {$class_name = $this_lang_functions['text_downloader']; break;}
case UC_UPLOADER: {$class_name = $this_lang_functions['text_uploader']; break;}
case UC_RETIREE: {$class_name = $this_lang_functions['text_retiree']; break;}
case UC_FORUM_MODERATOR: {$class_name = $this_lang_functions['text_forum_moderator']; break;}
case UC_MODERATOR: {$class_name = $this_lang_functions['text_moderators']; break;}
case UC_ADMINISTRATOR: {$class_name = $this_lang_functions['text_administrators']; break;}
case UC_SYSOP: {$class_name = $this_lang_functions['text_sysops']; break;}
case UC_STAFFLEADER: {$class_name = $this_lang_functions['text_staff_leader']; break;}
}
switch ($class)
{
case UC_PEASANT: {$class_name_color = $en_lang_functions['text_peasant']; break;}
case UC_USER: {$class_name_color = $en_lang_functions['text_user']; break;}
case UC_POWER_USER: {$class_name_color = $en_lang_functions['text_power_user']; break;}
case UC_ELITE_USER: {$class_name_color = $en_lang_functions['text_elite_user']; break;}
case UC_CRAZY_USER: {$class_name_color = $en_lang_functions['text_crazy_user']; break;}
case UC_INSANE_USER: {$class_name_color = $en_lang_functions['text_insane_user']; break;}
case UC_VETERAN_USER: {$class_name_color = $en_lang_functions['text_veteran_user']; break;}
case UC_EXTREME_USER: {$class_name_color = $en_lang_functions['text_extreme_user']; break;}
case UC_ULTIMATE_USER: {$class_name_color = $en_lang_functions['text_ultimate_user']; break;}
case UC_NEXUS_MASTER: {$class_name_color = $en_lang_functions['text_nexus_master']; break;}
case UC_VIP: {$class_name_color = $en_lang_functions['text_vip']; break;}
case UC_DOWNLOADER: {$class_name_color = $en_lang_functions['text_downloader']; break;}
case UC_UPLOADER: {$class_name_color = $en_lang_functions['text_uploader']; break;}
case UC_RETIREE: {$class_name_color = $en_lang_functions['text_retiree']; break;}
case UC_FORUM_MODERATOR: {$class_name_color = $en_lang_functions['text_forum_moderator']; break;}
case UC_MODERATOR: {$class_name_color = $en_lang_functions['text_moderators']; break;}
case UC_ADMINISTRATOR: {$class_name_color = $en_lang_functions['text_administrators']; break;}
case UC_SYSOP: {$class_name_color = $en_lang_functions['text_sysops']; break;}
case UC_STAFFLEADER: {$class_name_color = $en_lang_functions['text_staff_leader']; break;}
}
$class_name = ( $compact == true ? str_replace(" ", "",$class_name) : $class_name);
if ($class_name) return ($b_colored == true ? "<b class='" . str_replace(" ", "",$class_name_color) . "_Name'>" . $class_name . "</b>" : $class_name);
}
function is_valid_user_class($class)
{
return is_numeric($class) && floor($class) == $class && $class >= UC_PEASANT && $class <= UC_STAFFLEADER;
}
function int_check($value,$stdhead = false, $stdfood = true, $die = true, $log = true) {
global $lang_functions;
global $CURUSER;
if (is_array($value))
{
foreach ($value as $val) int_check ($val);
}
else
{
if (!is_valid_id($value)) {
$msg = "Invalid ID Attempt: Username: ".$CURUSER["username"]." - UserID: ".$CURUSER["id"]." - UserIP : ".getip();
if ($log)
write_log($msg,'mod');
if ($stdhead)
stderr($lang_functions['std_error'],$lang_functions['std_invalid_id']);
else
{
print ("<h2>".$lang_functions['std_error']."</h2><table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\"><tr><td class=\"text\">");
print ($lang_functions['std_invalid_id']."</td></tr></table>");
}
if ($stdfood)
stdfoot();
if ($die)
die;
}
else
return true;
}
}
function is_valid_id($id)
{
return is_numeric($id) && ($id > 0) && (floor($id) == $id);
}
//-------- Begins a main frame
function begin_main_frame($caption = "", $center = false, $width = 100)
{
$tdextra = "";
if ($caption)
print("<h2>".$caption."</h2>");
if ($center)
$tdextra .= " align=\"center\"";
$width = 940 * $width /100;
print("<table class=\"main\" width=\"".$width."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" .
"<tr><td class=\"embedded\" $tdextra>");
}
function end_main_frame()
{
print("</td></tr></table>\n");
}
function begin_frame($caption = "", $center = false, $padding = 10, $width="100%", $caption_center="left")
{
$tdextra = "";
if ($center)
$tdextra .= " align=\"center\"";
print(($caption ? "<h2 align=\"".$caption_center."\">".$caption."</h2>" : "") . "<table width=\"".$width."\" cellspacing=\"0\" cellpadding=\"".$padding."\">" . "<tr><td class=\"text\" $tdextra>\n");
}
function end_frame()
{
print("</td></tr></table>\n");
}
function begin_table($fullwidth = false, $padding = 5)
{
$width = "";
if ($fullwidth)
$width .= " width=50%";
print("<table class=\"main".$width."\" cellspacing=\"0\" cellpadding=\"".$padding."\">");
}
function end_table()
{
print("</table>\n");
}
//-------- Inserts a smilies frame
// (move to globals)
function insert_smilies_frame()
{
global $lang_functions;
begin_frame($lang_functions['text_smilies'], true);
begin_table(false, 5);
print("<tr><td class=\"colhead\">".$lang_functions['col_type_something']."</td><td class=\"colhead\">".$lang_functions['col_to_make_a']."</td></tr>\n");
for ($i=1; $i<192; $i++) {
print("<tr><td>[em$i]</td><td><img src=\"pic/smilies/".$i.".gif\" alt=\"[em$i]\" /></td></tr>\n");
}
end_table();
end_frame();
}
function get_ratio_color($ratio)
{
if ($ratio < 0.1) return "#ff0000";
if ($ratio < 0.2) return "#ee0000";
if ($ratio < 0.3) return "#dd0000";
if ($ratio < 0.4) return "#cc0000";
if ($ratio < 0.5) return "#bb0000";
if ($ratio < 0.6) return "#aa0000";
if ($ratio < 0.7) return "#990000";
if ($ratio < 0.8) return "#880000";
if ($ratio < 0.9) return "#770000";
if ($ratio < 1) return "#660000";
return "";
}
function get_slr_color($ratio)
{
if ($ratio < 0.025) return "#ff0000";
if ($ratio < 0.05) return "#ee0000";
if ($ratio < 0.075) return "#dd0000";
if ($ratio < 0.1) return "#cc0000";
if ($ratio < 0.125) return "#bb0000";
if ($ratio < 0.15) return "#aa0000";
if ($ratio < 0.175) return "#990000";
if ($ratio < 0.2) return "#880000";
if ($ratio < 0.225) return "#770000";
if ($ratio < 0.25) return "#660000";
if ($ratio < 0.275) return "#550000";
if ($ratio < 0.3) return "#440000";
if ($ratio < 0.325) return "#330000";
if ($ratio < 0.35) return "#220000";
if ($ratio < 0.375) return "#110000";
return "";
}
function write_log($text, $security = "normal")
{
$text = sqlesc($text);
$added = sqlesc(date("Y-m-d H:i:s"));
$security = sqlesc($security);
sql_query("INSERT INTO sitelog (added, txt, security_level) VALUES($added, $text, $security)") or sqlerr(__FILE__, __LINE__);
}
function get_elapsed_time($ts,$shortunit = false)
{
global $lang_functions;
$mins = floor(abs(TIMENOW - $ts) / 60);
$hours = floor($mins / 60);
$mins -= $hours * 60;
$days = floor($hours / 24);
$hours -= $days * 24;
$months = floor($days / 30);
$days2 = $days - $months * 30;
$years = floor($days / 365);
$months -= $years * 12;
$t = "";
if ($years > 0)
return $years.($shortunit ? $lang_functions['text_short_year'] : $lang_functions['text_year'] . add_s($year)) ." ".$months.($shortunit ? $lang_functions['text_short_month'] : $lang_functions['text_month'] . add_s($months));
if ($months > 0)
return $months.($shortunit ? $lang_functions['text_short_month'] : $lang_functions['text_month'] . add_s($months)) ." ".$days2.($shortunit ? $lang_functions['text_short_day'] : $lang_functions['text_day'] . add_s($days2));
if ($days > 0)
return $days.($shortunit ? $lang_functions['text_short_day'] : $lang_functions['text_day'] . add_s($days))." ".$hours.($shortunit ? $lang_functions['text_short_hour'] : $lang_functions['text_hour'] . add_s($hours));
if ($hours > 0)
return $hours.($shortunit ? $lang_functions['text_short_hour'] : $lang_functions['text_hour'] . add_s($hours))." ".$mins.($shortunit ? $lang_functions['text_short_min'] : $lang_functions['text_min'] . add_s($mins));
if ($mins > 0)
return $mins.($shortunit ? $lang_functions['text_short_min'] : $lang_functions['text_min'] . add_s($mins));
return "< 1".($shortunit ? $lang_functions['text_short_min'] : $lang_functions['text_min']);
}
function textbbcode($form,$text,$content="",$hastitle=false, $col_num = 130)
{
global $lang_functions;
global $subject, $BASEURL, $CURUSER, $enableattach_attachment;
?>
<script type="text/javascript">
//<![CDATA[
var b_open = 0;
var i_open = 0;
var u_open = 0;
var color_open = 0;
var list_open = 0;
var quote_open = 0;
var html_open = 0;
var myAgent = navigator.userAgent.toLowerCase();
var myVersion = parseInt(navigator.appVersion);
var is_ie = ((myAgent.indexOf("msie") != -1) && (myAgent.indexOf("opera") == -1));
var is_nav = ((myAgent.indexOf('mozilla')!=-1) && (myAgent.indexOf('spoofer')==-1)
&& (myAgent.indexOf('compatible') == -1) && (myAgent.indexOf('opera')==-1)
&& (myAgent.indexOf('webtv') ==-1) && (myAgent.indexOf('hotjava')==-1));
var is_win = ((myAgent.indexOf("win")!=-1) || (myAgent.indexOf("16bit")!=-1));
var is_mac = (myAgent.indexOf("mac")!=-1);
var bbtags = new Array();
function cstat() {
var c = stacksize(bbtags);
if ( (c < 1) || (c == null) ) {c = 0;}
if ( ! bbtags[0] ) {c = 0;}
document.<?php echo $form?>.tagcount.value = "Close last, Open "+c;
}
function stacksize(thearray) {
for (i = 0; i < thearray.length; i++ ) {
if ( (thearray[i] == "") || (thearray[i] == null) || (thearray == 'undefined') ) {return i;}
}
return thearray.length;
}
function pushstack(thearray, newval) {
arraysize = stacksize(thearray);
thearray[arraysize] = newval;
}
function popstackd(thearray) {
arraysize = stacksize(thearray);
theval = thearray[arraysize - 1];
return theval;
}
function popstack(thearray) {
arraysize = stacksize(thearray);
theval = thearray[arraysize - 1];
delete thearray[arraysize - 1];
return theval;
}
function closeall() {
if (bbtags[0]) {
while (bbtags[0]) {
tagRemove = popstack(bbtags)
if ( (tagRemove != 'color') ) {
doInsert("[/"+tagRemove+"]", "", false);
eval("document.<?php echo $form?>." + tagRemove + ".value = ' " + tagRemove + " '");
eval(tagRemove + "_open = 0");
} else {
doInsert("[/"+tagRemove+"]", "", false);
}
cstat();
return;
}
}
document.<?php echo $form?>.tagcount.value = "Close last, Open 0";
bbtags = new Array();
document.<?php echo $form?>.<?php echo $text?>.focus();
}
function add_code(NewCode) {
document.<?php echo $form?>.<?php echo $text?>.value += NewCode;
document.<?php echo $form?>.<?php echo $text?>.focus();
}
function alterfont(theval, thetag) {
if (theval == 0) return;
if(doInsert("[" + thetag + "=" + theval + "]", "[/" + thetag + "]", true)) pushstack(bbtags, thetag);
document.<?php echo $form?>.color.selectedIndex = 0;
cstat();
}
function tag_url(PromptURL, PromptTitle, PromptError) {
var FoundErrors = '';
var enterURL = prompt(PromptURL, "http://");
var enterTITLE = prompt(PromptTitle, "");
if (!enterURL || enterURL=="") {FoundErrors += " " + PromptURL + ",";}
if (!enterTITLE) {FoundErrors += " " + PromptTitle;}
if (FoundErrors) {alert(PromptError+FoundErrors);return;}
doInsert("[url="+enterURL+"]"+enterTITLE+"[/url]", "", false);
}
function tag_list(PromptEnterItem, PromptError) {
var FoundErrors = '';
var enterTITLE = prompt(PromptEnterItem, "");
if (!enterTITLE) {FoundErrors += " " + PromptEnterItem;}
if (FoundErrors) {alert(PromptError+FoundErrors);return;}
doInsert("[*]"+enterTITLE+"", "", false);
}
function tag_image(PromptImageURL, PromptError) {
var FoundErrors = '';
var enterURL = prompt(PromptImageURL, "http://");
if (!enterURL || enterURL=="http://") {
alert(PromptError+PromptImageURL);
return;
}
doInsert("[img]"+enterURL+"[/img]", "", false);
}
function tag_extimage(content) {
doInsert(content, "", false);
}
function tag_email(PromptEmail, PromptError) {
var emailAddress = prompt(PromptEmail, "");
if (!emailAddress) {
alert(PromptError+PromptEmail);
return;
}
doInsert("[email]"+emailAddress+"[/email]", "", false);
}
/* function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = document.compose.body;
if ( (myVersion >= 4) && is_ie &&navigator.appName=="Microsoft Internet Explorer" && is_win){
if(obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle) isClose = true;
rng.text = ibTag;
}
}
else
{
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
}
else if (obj_ta.selectionStart || obj_ta.selectionStart == '0')
{
var startPos = obj_ta.selectionStart;
var endPos = obj_ta.selectionEnd;
if(startPos!=endPos&&isSingle){
obj_ta.value = obj_ta.value.substring(0, startPos) + ibTag + obj_ta.value.substring(startPos,endPos) + ibClsTag + obj_ta.value.substring(endPos, obj_ta.value.length);
obj_ta.selectionEnd = endPos + ibTag.length;
obj_ta.selectionStart= startPos + ibTag.length;
}else{
obj_ta.value = obj_ta.value.substring(0, startPos) +obj_ta.value.substring(startPos,endPos)+ ibTag + obj_ta.value.substring(endPos, obj_ta.value.length);
obj_ta.selectionEnd = endPos + ibTag.length+obj_ta.value.substring(startPos,endPos).length;
obj_ta.selectionStart= obj_ta.selectionEnd;
if(isSingle)isClose = true;
}
//obj_ta.selectionStart=obj_ta.selectionEnd;
}
else
{
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
obj_ta.focus();
//obj_ta.value = obj_ta.value.replace(/ /, " ");
return isClose;
}*///有问题代码
function doInsert(ibTag, ibClsTag, isSingle)
{
var isClose = false;
var obj_ta = document.<?php echo $form?>.<?php echo $text?>;
if ( (myVersion >= 4) && is_ie && is_win)
{
if(obj_ta.isTextEdit)
{
obj_ta.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null)
{
if(ibClsTag != "" && rng.text.length > 0)
ibTag += rng.text + ibClsTag;
else if(isSingle) isClose = true;
rng.text = ibTag;
}
}
else
{
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
}
else if (obj_ta.selectionStart || obj_ta.selectionStart == '0')
{
var startPos = obj_ta.selectionStart;
var endPos = obj_ta.selectionEnd;
obj_ta.value = obj_ta.value.substring(0, startPos) + ibTag + obj_ta.value.substring(endPos, obj_ta.value.length);
obj_ta.selectionEnd = startPos + ibTag.length;
if(isSingle) isClose = true;
}
else
{
if(isSingle) isClose = true;
obj_ta.value += ibTag;
}
obj_ta.focus();
// obj_ta.value = obj_ta.value.replace(/ /, " ");
return isClose;
} // 原来的代码
function winop()
{
windop = window.open("moresmilies.php?form=<?php echo $form?>&text=<?php echo $text?>","mywin","height=500,width=500,resizable=no,scrollbars=yes");
}
function simpletag(thetag)
{
var tagOpen = eval(thetag + "_open");
if (tagOpen == 0) {
if(doInsert("[" + thetag + "]", "[/" + thetag + "]", true))
{
eval(thetag + "_open = 1");
eval("document.<?php echo $form?>." + thetag + ".value += '*'");
pushstack(bbtags, thetag);
cstat();
}
}
else {
lastindex = 0;
for (i = 0; i < bbtags.length; i++ ) {
if ( bbtags[i] == thetag ) {
lastindex = i;
}
}
while (bbtags[lastindex]) {
tagRemove = popstack(bbtags);
doInsert("[/" + tagRemove + "]", "", false)
if ((tagRemove != 'COLOR') ){
eval("document.<?php echo $form?>." + tagRemove + ".value = '" + tagRemove.toUpperCase() + "'");
eval(tagRemove + "_open = 0");
}
}
cstat();
}
}
//]]>
</script>
<table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr><td align="left" colspan="2">
<table cellspacing="1" cellpadding="2" border="0">
<tr>
<td class="embedded"><input style="font-weight: bold;font-size:11px; margin-right:3px" type="button" name="b" value="加粗" onclick="javascript: simpletag('b')" /></td>
<td class="embedded"><input class="codebuttons" style="font-style: italic;font-size:11px;margin-right:3px" type="button" name="i" value="斜体" onclick="javascript: simpletag('i')" /></td>
<td class="embedded"><input class="codebuttons" style="text-decoration: underline;font-size:11px;margin-right:3px" type="button" name="u" value="下划线" onclick="javascript: simpletag('u')" /></td>
<?php
print("<td class=\"embedded\"><input class=\"codebuttons\" style=\"font-size:11px;margin-right:3px\" type=\"button\" name='url' value='URL' onclick=\"javascript:tag_url('" . $lang_functions['js_prompt_enter_url'] . "','" . $lang_functions['js_prompt_enter_title'] . "','" . $lang_functions['js_prompt_error'] . "')\" /></td>");
print("<td class=\"embedded\"><input class=\"codebuttons\" style=\"font-size:11px;margin-right:3px\" type=\"button\" name=\"IMG\" value=\"IMG\" onclick=\"javascript: tag_image('" . $lang_functions['js_prompt_enter_image_url'] . "','" . $lang_functions['js_prompt_error'] . "')\" /></td>");
print("<td class=\"embedded\"><input type=\"button\" style=\"font-size:11px;margin-right:3px\" name=\"list\" value=\"List\" onclick=\"tag_list('" . addslashes($lang_functions['js_prompt_enter_item']) . "','" . $lang_functions['js_prompt_error'] . "')\" /></td>");
?>
<td class="embedded"><input class="codebuttons" style="font-size:11px;margin-right:3px" type="button" name="quote" value="QUOTE" onclick="javascript: simpletag('quote')" /></td>
<td class="embedded"><input style="font-size:11px;margin-right:3px" type="button" onclick='javascript:closeall();' name='tagcount' value="Close all tags" /></td>
<td class="embedded"><select class="med codebuttons" style="margin-right:3px" name='color' onchange="alterfont(this.options[this.selectedIndex].value, 'color')">
<option value='0'>--- <?php echo $lang_functions['select_color'] ?> ---</option>
<option style="background-color: black" value="Black">Black</option>
<option style="background-color: sienna" value="Sienna">Sienna</option>
<option style="background-color: darkolivegreen" value="DarkOliveGreen">Dark Olive Green</option>
<option style="background-color: darkgreen" value="DarkGreen">Dark Green</option>
<option style="background-color: darkslateblue" value="DarkSlateBlue">Dark Slate Blue</option>
<option style="background-color: navy" value="Navy">Navy</option>
<option style="background-color: indigo" value="Indigo">Indigo</option>
<option style="background-color: darkslategray" value="DarkSlateGray">Dark Slate Gray</option>
<option style="background-color: darkred" value="DarkRed">Dark Red</option>
<option style="background-color: darkorange" value="DarkOrange">Dark Orange</option>
<option style="background-color: olive" value="Olive">Olive</option>
<option style="background-color: green" value="Green">Green</option>
<option style="background-color: teal" value="Teal">Teal</option>
<option style="background-color: blue" value="Blue">Blue</option>
<option style="background-color: slategray" value="SlateGray">Slate Gray</option>
<option style="background-color: dimgray" value="DimGray">Dim Gray</option>
<option style="background-color: red" value="Red">Red</option>
<option style="background-color: sandybrown" value="SandyBrown">Sandy Brown</option>
<option style="background-color: yellowgreen" value="YellowGreen">Yellow Green</option>
<option style="background-color: seagreen" value="SeaGreen">Sea Green</option>
<option style="background-color: mediumturquoise" value="MediumTurquoise">Medium Turquoise</option>
<option style="background-color: royalblue" value="RoyalBlue">Royal Blue</option>
<option style="background-color: purple" value="Purple">Purple</option>
<option style="background-color: gray" value="Gray">Gray</option>
<option style="background-color: magenta" value="Magenta">Magenta</option>
<option style="background-color: orange" value="Orange">Orange</option>
<option style="background-color: yellow" value="Yellow">Yellow</option>
<option style="background-color: lime" value="Lime">Lime</option>
<option style="background-color: cyan" value="Cyan">Cyan</option>
<option style="background-color: deepskyblue" value="DeepSkyBlue">Deep Sky Blue</option>
<option style="background-color: darkorchid" value="DarkOrchid">Dark Orchid</option>
<option style="background-color: silver" value="Silver">Silver</option>
<option style="background-color: pink" value="Pink">Pink</option>
<option style="background-color: wheat" value="Wheat">Wheat</option>
<option style="background-color: lemonchiffon" value="LemonChiffon">Lemon Chiffon</option>
<option style="background-color: palegreen" value="PaleGreen">Pale Green</option>
<option style="background-color: paleturquoise" value="PaleTurquoise">Pale Turquoise</option>
<option style="background-color: lightblue" value="LightBlue">Light Blue</option>
<option style="background-color: plum" value="Plum">Plum</option>
<option style="background-color: white" value="White">White</option>
</select></td>
<td class="embedded">
<select class="med codebuttons" name='font' onchange="alterfont(this.options[this.selectedIndex].value, 'font')">
<option value="0">--- <?php echo $lang_functions['select_font'] ?> ---</option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Book Antiqua">Book Antiqua</option>
<option value="Century Gothic">Century Gothic</option>
<option value="Comic Sans MS">Comic Sans MS</option>
<option value="Courier New">Courier New</option>
<option value="Fixedsys">Fixedsys</option>
<option value="Garamond">Garamond</option>
<option value="Georgia">Georgia</option>
<option value="Impact">Impact</option>
<option value="Lucida Console">Lucida Console</option>
<option value="Lucida Sans Unicode">Lucida Sans Unicode</option>
<option value="Microsoft Sans Serif">Microsoft Sans Serif</option>
<option value="Palatino Linotype">Palatino Linotype</option>
<option value="System">System</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Trebuchet MS">Trebuchet MS</option>
<option value="Verdana">Verdana</option>
</select>
</td>
<td class="embedded">
<select class="med codebuttons" name='size' onchange="alterfont(this.options[this.selectedIndex].value, 'size')">
<option value="0">--- <?php echo $lang_functions['select_size'] ?> ---</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select></td></tr>
</table>
</td>
</tr>
<?php
if ($enableattach_attachment == 'yes'){
?>
<tr>
<td colspan="2" valign="middle">
<iframe src="<?php echo get_protocol_prefix() . $BASEURL?>/attachment.php" width="100%" height="24" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
</td>
</tr>
<?php
}
print("<tr>");
print("<td align=\"left\"><textarea class=\"bbcode\" cols=\"100\" style=\"width: 650px;\" name=\"".$text."\" id=\"".$text."\" rows=\"20\" onkeydown=\"ctrlenter(event,'compose','qr')\">".$content."</textarea>");
?>
</td>
<td align="center" width="99%">
<table cellspacing="1" cellpadding="3">
<tr>
<?php
$i = 0;
$quickSmilies = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 16, 17, 19, 20, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 39, 40, 41);
foreach ($quickSmilies as $smily) {