Форум программистов, компьютерный форум, киберфорум
PHP для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.60/25: Рейтинг темы: голосов - 25, средняя оценка - 4.60
0 / 0 / 1
Регистрация: 19.08.2013
Сообщений: 8

Parse error: syntax error, unexpected $end in /var/www/timo/data/www/mysite.ru/engine/ajax/upload.php on line 1340

19.08.2013, 22:17. Показов 4616. Ответов 2
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Здравствуйте, помогите пожалуйста разобраться
Parse error: syntax error, unexpected $end in /var/www/timo/data/www/mysite.ru/engine/ajax/upload.php on line 1340

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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
<?php
/*
=====================================================
 DataLife Engine - by SoftNews Media Group 
-----------------------------------------------------
 http://dle-news.ru/
-----------------------------------------------------
 Copyright (c) 2004,2013 SoftNews Media Group
=====================================================
 Данный код защищен авторскими правами
=====================================================
 Файл: upload.php
-----------------------------------------------------
 Назначение: загрузка файлов
=====================================================
*/
 
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );
 
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname(  __FILE__ ), 0, -12 ) );
define( 'ENGINE_DIR', ROOT_DIR . '/engine' );
 
require_once ENGINE_DIR . '/data/config.php';
 
if( $config['http_home_url'] == "" ) {
    
    $config['http_home_url'] = explode( "engine/ajax/upload.php", $_SERVER['PHP_SELF'] );
    $config['http_home_url'] = reset( $config['http_home_url'] );
    $config['http_home_url'] = "http://" . $_SERVER['HTTP_HOST'] . $config['http_home_url'];
 
}
 
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/inc/include/functions.inc.php';
 
if( isset( $_POST['PHPSESSID'] ) AND $_REQUEST['subaction'] == "upload" ) dle_session( $_POST['PHPSESSID'] ); else dle_session();
 
if ($_COOKIE['dle_skin']) {
 
    $_COOKIE['dle_skin'] = trim( totranslit($_COOKIE['dle_skin'], false, false) );
 
    if ($_COOKIE['dle_skin'] != '' AND @is_dir ( ROOT_DIR . '/templates/' . $_COOKIE['dle_skin'] )) {
        $config['skin'] = $_COOKIE['dle_skin'];
    }
}
 
$selected_language = false;
 
if (isset( $_COOKIE['selected_language'] )) { 
 
    $_COOKIE['selected_language'] = trim(totranslit( $_COOKIE['selected_language'], false, false ));
 
    if ($_COOKIE['selected_language'] != "" AND @is_dir ( ROOT_DIR . '/language/' . $_COOKIE['selected_language'] )) {
        $selected_language = $_COOKIE['selected_language'];
    }
 
}
 
if( $selected_language ) {
 
    if ( file_exists( ROOT_DIR.'/language/'.$selected_language.'/adminpanel.lng' ) ) {
        require_once ROOT_DIR.'/language/'.$selected_language.'/adminpanel.lng';
    } else die("Language file not found");
 
} elseif ($config["lang_" . $config['skin']]) {
 
    if ( file_exists( ROOT_DIR . '/language/' . $config["lang_" . $config['skin']] . '/adminpanel.lng' ) ) {    
        include_once ROOT_DIR . '/language/' . $config["lang_" . $config['skin']] . '/adminpanel.lng';
    } else die("Language file not found");
 
} else {
    
    include_once ROOT_DIR . '/language/' . $config['langs'] . '/adminpanel.lng';
 
}
 
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
 
//################# Определение групп пользователей
$user_group = get_vars( "usergroup" );
 
if( ! $user_group ) {
    $user_group = array ();
    
    $db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
    
    while ( $row = $db->get_row() ) {
        
        $user_group[$row['id']] = array ();
        
        foreach ( $row as $key => $value ) {
            $user_group[$row['id']][$key] = stripslashes($value);
        }
    
    }
    set_vars( "usergroup", $user_group );
    $db->free();
}
 
require_once ENGINE_DIR . '/modules/sitelogin.php';
 
if ($_POST['flashmode']) @header( "Content-type: text/html; charset=utf-8" ); else @header( "Content-type: text/html; charset=" . $config['charset'] );
 
if( ! $is_logged ) {
    die ( "{\"error\":\"{$lang['err_notlogged']}\"}" );
}
 
if( !$user_group[$member_id['user_group']]['allow_image_upload'] AND !$user_group[$member_id['user_group']]['allow_file_upload'] ) {
    die ( "{\"error\":\"{$lang['err_noupload']}\"}" );
}
 
$_TIME = time () + ($config['date_adjust'] * 60);
 
$allowed_extensions = array ("gif", "jpg", "png", "jpe", "jpeg" );
$allowed_video = array ("avi", "mp4", "wmv", "mpg", "flv", "mp3", "swf", "m4v", "m4a", "mov", "3gp", "f4v", "mkv" );
$allowed_files = explode( ',', strtolower( $user_group[$member_id['user_group']]['files_type'] ) );
 
if( intval( $_REQUEST['news_id'] ) ) $news_id = intval( $_REQUEST['news_id'] ); else $news_id = 0;
if( isset( $_REQUEST['area'] ) ) $area = totranslit( $_REQUEST['area'] ); else $area = "";
if( isset( $_REQUEST['wysiwyg'] ) ) $wysiwyg = totranslit( $_REQUEST['wysiwyg'], true, false ); else $wysiwyg = 0;
if( isset( $_REQUEST['author'] ) ) $author = @$db->safesql( strip_tags( urldecode( $_REQUEST['author'] ) ) ); else $author = "";
 
 
if ( !$author ) $author = $member_id['name'];
if ( !$user_group[$member_id['user_group']]['allow_all_edit'] ) $author = $member_id['name'];
 
if ( $area == "template" ) {
 
    if ( !$user_group[$member_id['user_group']]['admin_static'] ) die( "Hacking attempt!" );
 
}
 
if ( $area == "adminupload" ) {
 
    if ( $member_id['user_group'] != 1 ) die( "Hacking attempt!" );
 
}
 
if ( $news_id AND $area != "template") {
 
    $row = $db->super_query( "SELECT id, autor, approve FROM " . PREFIX . "_post WHERE id = '{$news_id}'" );
 
    if ( !$row['id'] OR ($row['approve'] AND !$user_group[$member_id['user_group']]['moderation']) ) die( "Hacking attempt!" );
 
    if ( !$user_group[$member_id['user_group']]['allow_all_edit'] AND $row['autor'] != $member_id['name'] ) die( "Hacking attempt!" );
}
 
//////////////////////
// go go upload
//////////////////////
if( $_REQUEST['subaction'] == "upload" ) {
 
    include_once ENGINE_DIR . '/classes/uploads/upload.class.php';
 
    if( $user_group[$member_id['user_group']]['allow_image_size'] ) {
 
        if ( isset($_REQUEST['t_seite']) ) $t_seite = intval( $_REQUEST['t_seite'] ); else $t_seite = intval($config['t_seite']);
        if ( isset($_REQUEST['make_thumb']) ) $make_thumb = intval( $_REQUEST['make_thumb'] ); else $make_thumb = true;
 
        $t_size = $_REQUEST['t_size'] ? $_REQUEST['t_size'] : $config['max_image'];
        $make_watermark = $_REQUEST['make_watermark'] ? intval($_REQUEST['make_watermark']) : false;
 
        if ( $area == "adminupload" ) {
        
            if ($config['allow_watermark'] == "yes" ) $make_watermark = true; else $make_watermark = false;
            $t_seite = intval($config['t_seite']);
            $t_size = $config['max_image'];
            $make_thumb = false;
        
        }
 
    } else {
        
        $t_seite = intval($config['t_seite']);
        $t_size = $config['max_image'];
        $make_thumb = true;
        if ($config['allow_watermark'] == "yes" ) $make_watermark = true; else $make_watermark = false;
    
    }
 
    $t_size = explode ("x", $t_size);
    
    if ( count($t_size) == 2) {
    
        $t_size = intval($t_size[0]) . "x" . intval($t_size[1]);
    
    } else {
    
        $t_size = intval( $t_size[0] );
    
    }
 
    if ($_POST['flashmode']) $flashmode = true; else $flashmode = false;
 
    $uploader = new FileUploader($area, $news_id, $author, $t_size, $t_seite, $make_thumb, $make_watermark, $flashmode);
    $result = $uploader->FileUpload();
    echo $result;
    die();
 
}
//////////////////////
// go go delete uploaded files
//////////////////////
check_xss ();
 
if( $_POST['subaction'] == "deluploads" ) {
 
    if( $_REQUEST['user_hash'] == "" or $_REQUEST['user_hash'] != $dle_login_hash ) {
        
        die( "Hacking attempt! User not found" );
    
    }
 
    if( isset( $_POST['images'] ) ) {
 
        $row = $db->super_query( "SELECT images  FROM " . PREFIX . "_images WHERE author = '$author' AND news_id = '$news_id'" );
        
        $listimages = explode( "|||", $row['images'] );
 
        foreach ( $_POST['images'] as $image ) {
            
            $i = 0;
            
            sort( $listimages );
            reset( $listimages );
            
            foreach ( $listimages as $dataimages ) {
                
                if( $dataimages == $image ) {
                    
                    $url_image = explode( "/", $image );
                    
                    if( count( $url_image ) == 2 ) {
                        
                        $folder_prefix = $url_image[0] . "/";
                        $image = $url_image[1];
                    
                    } else {
                        
                        $folder_prefix = "";
                        $image = $url_image[0];
                    
                    }
                    
                    unset( $listimages[$i] );
                    $image = totranslit($image);
    
                    @unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $image );
                    @unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . "thumbs/" . $image );
                
                }
                
                $i ++;
            }
    
        }
 
        if( count( $listimages ) ) $row['images'] = implode( "|||", $listimages );
        else $row['images'] = "";
 
        $db->query( "UPDATE " . PREFIX . "_images set images='{$row['images']}' WHERE author = '$author' AND news_id = '$news_id'" );
 
        if ($user_group[$member_id['user_group']]['allow_admin']) $db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '32', '{$news_id}')" );
    
    }
 
    if( $user_group[$member_id['user_group']]['allow_file_upload'] AND count( $_POST['files'] ) ) {
 
        foreach ( $_POST['files'] as $file ) {
            
            $file = intval( $file );
            
            $row = $db->super_query( "SELECT id, onserver FROM " . PREFIX . "_files WHERE author = '$author' AND news_id = '$news_id' AND id='$file'" );        
 
            if ( $row['id'] ) {
                $url = explode( "/", $row['onserver'] );
 
                if( count( $url ) == 2 ) {
                        
                    $folder_prefix = $url[0] . "/";
                    $file = $url[1];
                    
                } else {
                        
                    $folder_prefix = "";
                    $file = $url[0];
                    
                }
 
                $file = totranslit( $file, false );
    
                if( trim($file) == ".htaccess") die("Hacking attempt!");    
    
                #********* Tracker by MSW *** start *********#
                if(pathinfo($row['onserver'], PATHINFO_EXTENSION) == "torrent") {
                    @unlink( ROOT_DIR . "/uploads/torrents/" . $row['onserver'] );
                    $db->query("UPDATE " . PREFIX . "_files SET news_id=0, name='torrent.deleted', onserver=0, flags=1 WHERE id='{$row['id']}'");
                } else {
                    @unlink( ROOT_DIR . "/uploads/files/" . $folder_prefix . $file );
                    $db->query( "DELETE FROM " . PREFIX . "_files WHERE id='{$row['id']}'" );
                }
#********* Tracker by MSW *** stop  *********#
            }
        
        }
 
        if ($user_group[$member_id['user_group']]['allow_admin']) $db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '34', '{$news_id}')" );
    
    }
 
 
    if( $user_group[$member_id['user_group']]['admin_static'] AND count( $_POST['static_files'] ) ) {
 
        $db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '33', '{$news_id}')" );
        
        foreach ( $_POST['static_files'] as $file ) {
            
            $file = intval( $file );
            
            $row = $db->super_query( "SELECT id, name, onserver FROM " . PREFIX . "_static_files WHERE static_id = '$news_id' AND id='$file'" );
            
            if( $row['id'] and $row['onserver'] ) {
 
                $url = explode( "/", $row['onserver'] );
 
                if( count( $url ) == 2 ) {
                        
                    $folder_prefix = $url[0] . "/";
                    $file = $url[1];
                    
                } else {
                        
                    $folder_prefix = "";
                    $file = $url[0];
                    
                }
 
                $file = totranslit( $file, false );
    
                if( trim($file) == ".htaccess") die("Hacking attempt!");    
    
                @unlink( ROOT_DIR . "/uploads/files/" . $folder_prefix . $file );
 
                $db->query( "DELETE FROM " . PREFIX . "_static_files WHERE id='{$row['id']}'" );
            
            } else {
                
                if( $row['id'] ) {
                    $url_image = explode( "/", $row['name'] );
                    
                    if( count( $url_image ) == 2 ) {
                        
                        $folder_prefix = $url_image[0] . "/";
                        $image = $url_image[1];
                    
                    } else {
                        
                        $folder_prefix = "";
                        $image = $url_image[0];
                    
                    }
 
                    $image = totranslit($image);                    
 
                    @unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $image );
                    @unlink( ROOT_DIR . "/uploads/posts/" . $folder_prefix . "thumbs/" . $image );
                    $db->query( "DELETE FROM " . PREFIX . "_static_files WHERE id='{$row['id']}'" );
                
                }
            
            }
        }
    }
 
 
}
 
//////////////////////
// go go show
//////////////////////
 
$skin = trim( totranslit($_REQUEST['skin'], false, false) );
 
if ( $skin ) {
 
    $css_path = $config['http_home_url']."templates/".$skin."/frame.css";
 
} else {
 
    $css_path = $config['http_home_url']."engine/skins/frame.css";
 
}
 
include (ENGINE_DIR . '/data/videoconfig.php');
 
echo <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<meta content="text/html; charset={$config['charset']}" http-equiv="content-type" />
<title>{$lang['media_upload']}</title>
<link rel="stylesheet" type="text/css" href="{$css_path}">
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/js/jquery.js"></script>
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/uploads/html5/fileuploader.js"></script>
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/uploads/swfupload/swfupload.js"></script>
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/uploads/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/uploads/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="{$config['http_home_url']}engine/classes/uploads/swfupload/handlers.js"></script>
</head>
<body>
HTML;
 
 
$uploaded_list = array();
$folder_list = array();
 
if( $area != "template" ) {
        
    $row = $db->super_query( "SELECT images  FROM " . PREFIX . "_images WHERE news_id = '{$news_id}' AND author = '{$author}'" );
 
    if( $row['images'] ) {
 
        $listimages = explode( "|||", $row['images'] ); 
 
        foreach ( $listimages as $dataimages ) {
 
            $url_image = explode( "/", $dataimages );
            
            if( count( $url_image ) == 2 ) {
                
                $folder_prefix = $url_image[0] . "/";
                $dataimages = $url_image[1];
            
            } else {
                
                $folder_prefix = "";
                $dataimages = $url_image[0];
            
            }
 
            if( file_exists( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages ) ) {
 
                $this_size = @filesize( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages );
                $img_info = @getimagesize( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages );
 
                if( file_exists( ROOT_DIR . "/uploads/posts/" . $folder_prefix . "thumbs/" . $dataimages ) ) {
                    $img_url =  $config['http_home_url'] . "uploads/posts/" . $folder_prefix . "thumbs/" . $dataimages;
                    $thumb_data = "yes";
                } else {
                    $img_url =  $config['http_home_url'] . "uploads/posts/" . $folder_prefix . $dataimages;
                    $thumb_data = "no";
 
                }
 
                $file_name = explode("_", $dataimages);
                unset($file_name[0]);
                $file_name = implode("_", $file_name);
 
                $data_url = $config['http_home_url'] . "uploads/posts/" . $folder_prefix . $dataimages;
                $uploaded_list[] = "<div class=\"uploadedfile\"><div class=\"info\">{$file_name}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$data_url}\" data-thumb=\"{$thumb_data}\" data-type=\"image\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $img_url . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" name=\"images[" . $folder_prefix . $dataimages . "]\" value=\"" . $folder_prefix . $dataimages . "\" data-thumb=\"{$thumb_data}\" data-type=\"image\" data-src=\"{$data_url}\">&nbsp;{$img_info[0]}x{$img_info[1]}</div></div>";
 
            }
 
        }
    }
 
    $db->query( "SELECT id, name, onserver  FROM " . PREFIX . "_files where author = '$author' AND news_id = '$news_id'" );
 
    while ( $row = $db->get_row() ) {
 
        #********* Tracker by MSW *** start *********#
        if(pathinfo($row['onserver'], PATHINFO_EXTENSION) == "torrent") {
            $this_size = formatsize( @filesize( ROOT_DIR . "/uploads/torrents/" . $row['onserver'] ) );
        } else {
            $this_size = formatsize( @filesize( ROOT_DIR . "/uploads/files/" . $row['onserver'] ) );
        }
#********* Tracker by MSW *** stop  *********#
        $file_type = explode( ".", $row['name'] );
        $file_type = totranslit( end( $file_type ) );
 
 
        if( in_array( $file_type, $allowed_video ) ) {
                
            if( $file_type == "mp3" ) {
                    
                $file_link = $config['http_home_url'] . "engine/skins/images/mp3_file.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "audio";
                
            } elseif ($file_type == "swf") {
 
                $file_link = $config['http_home_url'] . "engine/skins/images/file_flash.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "flash";
            } else {
                    
                $file_link = $config['http_home_url'] . "engine/skins/images/video_file.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "video";
            }
            
        #********* Tracker by MSW *** start *********#
        } elseif ($file_type == "torrent") {
            $file_link = $config['http_home_url'] . "engine/skins/images/torrent_file.png";
            $data_url = "/engine/download.php?id={$row['id']}";
            $file_play = "torrent";
        } elseif ($file_type == "deleted") {
            $file_link = $config['http_home_url'] . "engine/skins/images/deleted_file.png";
            $data_url = "#";
            $file_play = "";
#********* Tracker by MSW *** stop  *********#
 
        $uploaded_list[] = "<div class=\"uploadedfile\"><div class=\"info\">{$row['name']}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$row['id']}:{$row['name']}\" data-type=\"file\" data-play=\"{$file_play}\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $file_link . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" id=\"file\" name=\"files[]\" value=\"{$row['id']}\" data-type=\"file\">&nbsp;{$this_size}</div></div>";
 
 
    }
 
}
 
 
if( $area == "template" ) {
 
    $db->query( "SELECT id, name FROM " . PREFIX . "_static_files WHERE static_id = '$news_id' AND onserver = ''" );
 
    while ( $row = $db->get_row() ) {
 
        $url_image = explode( "/", $row['name'] );
            
        if( count( $url_image ) == 2 ) {
                
            $folder_prefix = $url_image[0] . "/";
            $dataimages = $url_image[1];
            
        } else {
                
            $folder_prefix = "";
            $dataimages = $url_image[0];
            
        }
 
        if( file_exists( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages ) ) {
 
            $this_size = @filesize( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages );
            $img_info = @getimagesize( ROOT_DIR . "/uploads/posts/" . $folder_prefix . $dataimages );
 
            if( file_exists( ROOT_DIR . "/uploads/posts/" . $folder_prefix . "thumbs/" . $dataimages ) ) {
                $img_url =  $config['http_home_url'] . "uploads/posts/" . $folder_prefix . "thumbs/" . $dataimages;
                $thumb_data = "yes";
            } else {
                $img_url =  $config['http_home_url'] . "uploads/posts/" . $folder_prefix . $dataimages;
                $thumb_data = "no";
 
            }       
 
            $file_name = explode("_", $dataimages);
            unset($file_name[0]);
            $file_name = implode("_", $file_name);
 
            $data_url = $config['http_home_url'] . "uploads/posts/" . $folder_prefix . $dataimages;
            $uploaded_list[] = "<div class=\"uploadedfile\"><div class=\"info\">{$file_name}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$data_url}\" data-thumb=\"{$thumb_data}\" data-type=\"image\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $img_url . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" name=\"static_files[]\" value=\"" . $row['id'] . "\" data-thumb=\"{$thumb_data}\" data-src=\"{$data_url}\" data-type=\"image\">&nbsp;{$img_info[0]}x{$img_info[1]}</div></div>";
 
        }
    
    }
 
    $db->query( "SELECT id, name, onserver  FROM " . PREFIX . "_static_files WHERE static_id = '$news_id' AND onserver != ''" );
        
    while ( $row = $db->get_row() ) {
 
        $this_size = formatsize( @filesize( ROOT_DIR . "/uploads/files/" . $row['onserver'] ) );
        $file_type = explode( ".", $row['name'] );
        $file_type = totranslit( end( $file_type ) );
 
 
        if( in_array( $file_type, $allowed_video ) ) {
                
            if( $file_type == "mp3" ) {
                    
                $file_link = $config['http_home_url'] . "engine/skins/images/mp3_file.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "audio";
                
            } elseif ($file_type == "swf") {
 
                $file_link = $config['http_home_url'] . "engine/skins/images/file_flash.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "flash";
            } else {
                    
                $file_link = $config['http_home_url'] . "engine/skins/images/video_file.png";
                $data_url = $config['http_home_url'] . "uploads/files/" . $row['onserver'];
                $file_play = "video";
            }
            
        } else { $file_link = $config['http_home_url'] . "engine/skins/images/all_file.png";  $data_url = "#"; $file_play = ""; };
 
        $uploaded_list[] = "<div class=\"uploadedfile\"><div class=\"info\">{$row['name']}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$row['id']}:{$row['name']}\" data-type=\"file\" data-play=\"{$file_play}\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $file_link . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" id=\"file\" name=\"static_files[]\" value=\"{$row['id']}\" data-type=\"file\">&nbsp;{$this_size}</div></div>";
 
 
    }
 
}
 
 
$img_dir = opendir(  ROOT_DIR . "/uploads/" );
 
while ( $file = readdir( $img_dir ) ) {
    $images_in_dir[] = $file;
}
 
natcasesort( $images_in_dir );
reset( $images_in_dir );
 
if ( count( $images_in_dir ) ) {
    foreach ( $images_in_dir as $url_image ) {
 
        $img_type = explode( ".", $url_image );
        $img_type = totranslit( end( $img_type ) );
 
        if( in_array( $img_type, $allowed_extensions ) AND is_file( ROOT_DIR . "/uploads/" . $url_image ) ) {
 
            $img_info = @getimagesize( ROOT_DIR . "/uploads/" . $url_image );
 
            if( file_exists( ROOT_DIR . "/uploads/thumbs/" . $url_image ) ) {
                $img_url =  $config['http_home_url'] . "uploads/thumbs/" . $url_image;
                $thumb_data = "yes";
            } else {
                $img_url =  $config['http_home_url'] . "uploads/" . $url_image;
                $thumb_data = "no";
 
            }       
 
            $data_url = $config['http_home_url'] . "uploads/" . $url_image;
            $folder_list[] = "<div class=\"uploadedfile\"><div class=\"info\">{$url_image}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$data_url}\" data-thumb=\"{$thumb_data}\" data-type=\"image\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $img_url . "\" /></a></div><div class=\"info\">{$img_info[0]}x{$img_info[1]}</div></div>";
 
 
        }
    
    }
}
 
if ( count ($uploaded_list) ) $uploaded_list = implode("", $uploaded_list); else $uploaded_list = "";
if ( count ($folder_list) ) $folder_list = implode("", $folder_list); else $folder_list = "";
 
$image_align = array ();
$image_align[$config['image_align']] = "selected";
 
 
if( $user_group[$member_id['user_group']]['allow_file_upload'] ) {
        
    if( $user_group[$member_id['user_group']]['max_file_size'] ) {
            
        $lang['files_max_info'] = $lang['files_max_info'] . " " . formatsize( $user_group[$member_id['user_group']]['max_file_size'] * 1024 );
        
    } else {
            
        $lang['files_max_info'] = $lang['files_max_info_2'];
        
    }
        
    $lang['files_max_info_1'] = $lang['files_max_info'] . "<br />" . $lang['files_max_info_1'] . " " . formatsize( $config['max_up_size'] * 1024 );
    
} else {
        
    $lang['files_max_info_1'] = $lang['files_max_info_1'] . " " . formatsize( $config['max_up_size'] * 1024 );
    
}
 
if( $user_group[$member_id['user_group']]['allow_image_size'] ) {
    
    $t_seite_selected[$config['t_seite']] = "selected";
    
    $upload_param = <<<HTML
<hr />
<div>{$lang['upload_t_size']}&nbsp;<input class="edit bk" type="text" name="t_size" id="t_size" size="9" value="{$config['max_image']}">&nbsp;px&nbsp;<select name="t_seite" id="t_seite"><option value="0" {$t_seite_selected[0]}>{$lang['upload_t_seite_1']}</option><option value="1" {$t_seite_selected[1]}>{$lang['upload_t_seite_2']}</option><option value="2" {$t_seite_selected[2]}>{$lang['upload_t_seite_3']}</option></select></div>
<hr />
HTML;
 
    $upload_param .= "<input type=\"checkbox\" name=\"make_thumb\" value=\"make_thumb\" id=\"make_thumb\" checked=\"checked\">&nbsp;<label for=\"make_thumb\">{$lang['images_ath']}</label>";
 
    if( $config['allow_watermark'] == "yes" ) $upload_param .= "&nbsp;&nbsp;<input type=\"checkbox\" name=\"make_watermark\" value=\"yes\" id=\"make_watermark\" checked=\"checked\">&nbsp;<label for=\"make_watermark\">{$lang['images_water']}</label>";
 
    if( !extension_loaded( "gd" ) ) $upload_param = "<font color=\"red\"><b>{$lang['images_nogd']}</b></font>";
 
} else $upload_param = "";
 
 
if( $member_id['user_group'] == 1 ) {
 
    $ftp_input = "<div><hr /><b>/uploads/files/</b>&nbsp;<input class=\"edit bk\" type=\"text\" id=\"ftpurl\" name=\"ftpurl\" style=\"width:350px;\">&nbsp;<button class=\"edit\" onclick=\"upload_from_url('ftp'); return false;\" style=\"width:115px;\">{$lang['db_load_a']}</button><div id=\"upload-viaftp-status\"></div></div>";
 
} else $ftp_input = "";
 
    $sess_id = session_id();
    
    if( $user_group[$member_id['user_group']]['allow_file_upload'] ) {
        
        if( ! $user_group[$member_id['user_group']]['max_file_size'] ) $max_file_size = 0;
        elseif( $user_group[$member_id['user_group']]['max_file_size'] > $config['max_up_size'] ) $max_file_size = ( int ) $user_group[$member_id['user_group']]['max_file_size'];
        else $max_file_size = ( int )$config['max_up_size'];
    
    } else {
        
        $max_file_size = ( int )$config['max_up_size'];
    
    }
    $max_flash_size = $max_file_size . " KB";
    $max_file_size = $max_file_size * 1024;
    
    $config['max_file_count'] = intval( $config['max_file_count'] );
 
    $all_ext = "*." . implode( ";*.", $allowed_extensions );
    $simple_ext = implode( "', '", $allowed_extensions );
 
    if( $config['files_allow'] == "yes" and $user_group[$member_id['user_group']]['allow_file_upload'] ) {
 
        $all_ext .= ";*." . implode( ";*.", $allowed_files );
        $simple_ext .= "', '" . implode( "', '", $allowed_files );
    }
 
    $author = urlencode($author);
 
    $root = explode ( "engine/ajax/upload.php", $_SERVER['PHP_SELF'] );
    $root = reset ( $root );
 
echo <<<HTML
<div class="tabs">
  <ul>
    <li><a href='#' id="link1" onclick="tabClick(2); return false;" title='{$lang['media_upload_st']}' class="current" ><span>{$lang['media_upload_st']}</span></a></li>
    <li><a href='#' id="link2" onclick="tabClick(0); return false;" title='{$lang['images_iln']}'><span>{$lang['images_iln']}</span></a></li>
    <li><a href='#' id="link3" onclick="tabClick(1); return false;" title='{$lang['images_lgem']}'><span>{$lang['images_lgem']}</span></a></li>
  </ul>
</div>
<div style="clear: both;"></div>
<div class="box">
<form action="" method="post" name="form" id="form">
<input type="hidden" name="subaction" value="upload">
<input type="hidden" name="user_hash" value="{$dle_login_hash}" />
    <div id="stmode">
        <div id="simpleupload">
            <div id="file-uploader"></div>
            <div><a href='#' onclick="tabClick(4); return false;"><span>{$lang['media_upload_st2']}</span></a></div>
        </div>
        <div id="flashupload" style="display:none;">
 
            <div id="flash-uploader" style="position: relative">
                <input id="btnBrowse" type="button" value="{$lang['media_upload_st4']}" style="width:320px;" class="button" />&nbsp;&nbsp;<input id="btnCancel" type="button" value="  {$lang['upload_cancel']}  " onclick="swfu.cancelQueue();" disabled="disabled" class="button" />
                <div id="flash_container" style="width:320px; height: 35px;position:absolute;top:0;left:0px;"></div>
            </div>
            <div id="fsUploadProgress" ></div>
 
            <div><a href='#' onclick="tabClick(5); return false;"><span>{$lang['media_upload_st3']}</span></a></div>
        </div>
        <div><hr />{$lang['images_upurl']}&nbsp;<input class="edit bk" type="text" id="copyurl" name="copyurl" style="width:350px;">&nbsp;<button class="edit" onclick="upload_from_url('url'); return false;" style="width:115px;">{$lang['db_load_a']}</button><div id="upload-viaurl-status"></div></div>
        {$ftp_input}
        <div>{$upload_param}</div>
        <div><hr />{$lang['files_max_info_1']}</div>
    </div>
</form>
<form action="" method="post" name="delimages" id="delimages">
<input type="hidden" name="subaction" value="deluploads">
<input type="hidden" name="user_hash" value="{$dle_login_hash}" />
<input type="hidden" name="area" value='{$area}'>
    <div id="cont1" style="display:none;">{$uploaded_list}</div>
    <div id="cont2" style="display:none;">{$folder_list}</div>
</form>
</div>
<div style="clear: both;"></div>
<div>
<div class="properties">{$lang['images_align']}&nbsp;<select id="imagealign" name="imagealign">
          <option value="none" {$image_align[0]}>{$lang['opt_sys_no']}</option>
          <option value="left" {$image_align['left']}>{$lang['images_left']}</option>
          <option value="right" {$image_align['right']}>{$lang['images_right']}</option>
          <option value="center" {$image_align['center']}>{$lang['images_center']}</option>
        </select></div>
<div style="float: right;"><button class="button" onclick="check_uncheck_all(); return false;" style="width:115px;">{$lang['edit_selall']}</button><button class="button" onclick="insert_all(); return false;" style="width:165px;">{$lang['images_all_insert']}</button><button class="button" onclick="delete_file(); return false;" style="width:135px;">{$lang['images_del']}</button></div>
</div>
<div style="clear: both;"></div>
<div id="linkbox" class="linkbox" style="display:none;">
<div id="linkboximage" style="display:none;">
<table>
    <tr>
        <td width="150">{$lang['media_upload_url']}</td>
        <td><input id="imageurl" name="imageurl" value="" style="width:460px;" class="edit bk" /></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td>{$lang['media_upload_title']}</td>
        <td><input id="imagetitle" name="imagetitle" value="" style="width:460px;" class="edit bk" /></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td><div id="imgparam"></div></td>
        <td><div id="imgparam1"></div></td>
    </tr>
</table>
</div>
<div id="linkboxfile" style="display:none;">
<table>
    <tr>
        <td width="190"><div id="imgparam2"></div></td>
        <td><div id="imgparam3"></div></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td>{$lang['media_upload_link']}</td>
        <td><input id="fileurl" name="fileurl" value="" style="width:420px;" class="edit bk" /></td>
    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td><div id="imgparam4"></div></td>
        <td><div id="imgparam5"></div></td>
    </tr>
</table>
</div>
<div style="clear: both;"></div>
<div style="float: right;"><button id="ins_image" class="button" onclick="insert_image(); return false;" style="display:none;">{$lang['media_upload_b1']}</button><button id="ins_file" class="button" onclick="insert_file(); return false;" style="display:none;">{$lang['media_upload_b2']}</button></div>
<div style="clear: both;"></div>
</div>
HTML;
 
if ( $uploaded_list ) $im_show = "tabClick(0);"; else $im_show = "";
 
echo <<<HTML
<script type="text/javascript">
jQuery(document).ready(function ($) {
 
    var totaladded = 0;
    var totaluploaded = 0;
    {$im_show}
 
    var uploader = new qq.FileUploader({
        element: document.getElementById('file-uploader'),
        action: '{$root}engine/ajax/upload.php',
        maxConnections: 1,
        encoding: 'multipart',
        sizeLimit: {$max_file_size},
        allowedExtensions: ['{$simple_ext}'],
        params: {"PHPSESSID" : "{$sess_id}", "subaction" : "upload", "news_id" : "{$news_id}", "area" : "{$area}", "author" : "{$author}"},
        template: '<div class="qq-uploader">' + 
                '<div class="qq-upload-drop-area"><span>{$lang['media_upload_st5']}</span></div>' +
                '<div class="qq-upload-button">{$lang['media_upload_st4']}</div>' +
                '<ul class="qq-upload-list" style="display:none;"></ul>' + 
             '</div>',
        onSubmit: function(id, fileName) {
 
                    uploader._options.params['t_size'] = $('#t_size').val();
                    uploader._options.params['t_seite'] = $('#t_seite').val();
                    uploader._options.params['make_thumb'] = $("#make_thumb").is(":checked") ? 1 : 0;
                    uploader._options.params['make_watermark'] = $("#make_watermark").is(":checked") ? 1 : 0;
                    totaladded ++;
 
                    $('<div id="uploadfile-'+id+'" class="file-box"><span class="qq-upload-file">{$lang['media_upload_st6']}&nbsp;'+fileName+'</span><span class="qq-status"><span class="qq-upload-spinner"></span><span class="qq-upload-size"></span></span></div>').appendTo('#file-uploader');
 
        },
        onProgress: function(id, fileName, loaded, total){
                    $('#uploadfile-'+id+' .qq-upload-size').text(uploader._formatSize(loaded)+' {$lang['media_upload_st8']} '+uploader._formatSize(total));
        },
        onComplete: function(id, fileName, response){
                        totaluploaded ++;
 
                        if ( response.success ) {
                            var returnbox = response.returnbox;
 
                            returnbox = returnbox.replace(/&lt;/g, "<");
                            returnbox = returnbox.replace(/&gt;/g, ">");
                            returnbox = returnbox.replace(/&amp;/g, "&");
 
                            $('#uploadfile-'+id+' .qq-status').html('{$lang['media_upload_st9']}');
                            $('#cont1').append( returnbox );
 
                            if (totaluploaded == totaladded ) tabClick(0);
 
                            setTimeout(function() {
                                $('#uploadfile-'+id).fadeOut('slow', function() { $(this).remove(); });
                            }, 1000);
 
                        } else {
                            $('#uploadfile-'+id+' .qq-status').html('{$lang['media_upload_st10']}');
 
                            if( response.error ) $('#uploadfile-'+id+' .qq-status').append( '<br /><font color="red">' + response.error + '</font>' );
 
                            setTimeout(function() {
                                $('#uploadfile-'+id).fadeOut('slow');
                            }, 4000);
                        }
        },
        messages: {
            typeError: "{$lang['media_upload_st11']}",
            sizeError: "{$lang['media_upload_st12']}",
            emptyError: "{$lang['media_upload_st13']}"
        },
        debug: false
    });
 
 
    var settings = {
        flash_url : "{$root}engine/classes/uploads/swfupload/swfupload.swf",
        upload_url: "{$root}engine/ajax/upload.php",    // Relative to the SWF file
        post_params: {"PHPSESSID" : "{$sess_id}", "news_id" : "{$news_id}", "area" : "{$area}", "author" : "{$author}", "flashmode" : "1"},
        file_size_limit : "{$max_flash_size}",
        file_types : "{$all_ext}",
        file_types_description : "All Files",
        file_upload_limit : {$config['max_file_count']},
        file_queue_limit : {$config['max_file_count']},
        custom_settings : {
            progressTarget : "fsUploadProgress",
            cancelButtonId : "btnCancel"
        },
        debug: false,
        flash_container_id : "flash_container",
        // The event handler functions are defined in handlers.js
        file_queued_handler : fileQueued,
        file_queue_error_handler : fileQueueError,
        file_dialog_complete_handler : fileDialogComplete,
        upload_start_handler : uploadStart,
        upload_progress_handler : uploadProgress,
        upload_error_handler : uploadError,
        upload_success_handler : uploadSuccess,
        upload_complete_handler : uploadComplete,
        queue_complete_handler : queueComplete  // Queue plugin event
    };
 
    var swfu = new SWFUpload(settings);
 
    $(document).on("click", ".uploadfile", function() {
 
        $('#linkbox').show();
 
        if ( $(this).data('type') == "image" ) {
            $("#linkboxfile").hide();
            $('#linkboximage').show();
            $('#ins_image').show();
            $('#ins_file').hide();
            $('#imageurl').val( $(this).data('src') );
 
            if ( $(this).data('thumb') == "yes" ) {
                $('#imgparam').html('{$lang['media_upload_ip1']}');
                $('#imgparam1').html('<input type="radio" name="thumbimg" value="1" checked="checked" />&nbsp;{$lang['media_upload_ip2']}&nbsp;&nbsp;<input type="radio" name="thumbimg" value="0" />&nbsp;{$lang['media_upload_ip3']}');
 
            } else {
                $('#imgparam').html('');
                $('#imgparam1').html('');
            }
 
        } else {
 
            $('#linkboximage').hide();
            $("#linkboxfile").show();
            $('#ins_image').hide();
            $('#ins_file').show();
 
            $('#fileurl').val( '[attachment='+$(this).data('src') +']' );
 
            var mode = $(this).data('play');
 
            if ( mode == "video" || mode == "audio" || mode == "flash") {
                $('#imgparam2').html('{$lang['media_upload_play']}');
                $('#imgparam4').html('{$lang['media_upload_ip1']}');
                $('#imgparam5').html('<input type="radio" name="filemode" value="1" checked="checked" />&nbsp;{$lang['media_upload_ip4']}&nbsp;&nbsp;<input type="radio" name="filemode" value="0" />&nbsp;{$lang['media_upload_ip5']}');
 
                if ( mode == "video" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[video={$video_config['width']}x{$video_config['height']},'+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');
                if ( mode == "audio" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[audio={$video_config['audio_width']},'+$(this).attr('href')+']" style="width:420px;" class="edit bk" />');
                if ( mode == "flash" ) $('#imgparam3').html('<input id="playurl" name="playurl" value="[flash={$video_config['width']},{$video_config['height']}]'+$(this).attr('href')+'[/flash]" style="width:420px;" class="edit bk" />');
    
} else if ( mode == "torrent" ) {
                $('#imgparam2').html('Скачать торрент-файл:');
                $('#imgparam3').html('[ <a href="'+$(this).attr('href')+'">скачать</a> ]');
                $('#imgparam4').html('');
                $('#imgparam5').html('');
        
 
} else {
 
                $('#imgparam2').html('');
                $('#imgparam3').html('');
                $('#imgparam4').html('');
                $('#imgparam5').html('');
            }
 
        }
 
        return false;
 
    });
 
});
function tabClick(n) {
 
    if (n == 0) {
        $("#cont2").hide();
        $("#stmode").hide();
        $("#linkbox").hide();
        $("#cont1").fadeTo('slow', 1);
        $("#link2").addClass("current");
        $("#link1").removeClass("current");
        $("#link3").removeClass("current");
 
    }
 
    if (n == 1) {
        $("#stmode").hide();
        $("#cont1").hide();
        $("#linkbox").hide();
        $("#cont2").fadeTo('slow', 1);
        $("#link3").addClass("current");
        $("#link1").removeClass("current");
        $("#link2").removeClass("current");
    }
 
    if (n == 2) {
        $("#cont2").hide();
        $("#cont1").hide();
        $("#linkbox").hide();
        $("#stmode").fadeTo('slow', 1);
        $("#link1").addClass("current");
        $("#link2").removeClass("current");
        $("#link3").removeClass("current");
    }
 
    if (n == 4) {
        $("#flashupload").fadeTo('slow', 1);
        $("#simpleupload").hide();
    }
 
    if (n == 5) {
        $("#flashupload").hide();
        $("#simpleupload").fadeTo('slow', 1);
    }
 
};
function check_uncheck_all() {
    var frm = document.delimages;
    for (var i=0;i<frm.elements.length;i++) {
        var elmnt = frm.elements[i];
        if (elmnt.type=='checkbox') {
            if(elmnt.checked == true){ elmnt.checked=false; }
            else{ elmnt.checked=true; }
        }
    }
};
 
function insert_all() {
 
    var frm = document.delimages;
    var wysiwyg = '{$wysiwyg}';
    var links = new Array();
    var align = $('#imagealign').val();
    var content = '';
    var t = 0;
    var url = '';
 
    for (var i=0;i<frm.elements.length;i++) {
   
     var elmnt = frm.elements[i];
 
       if (elmnt.type=='checkbox') {
            if(elmnt.checked == true){ 
                if ($(elmnt).data('type') == "image" ) {
                    if ( $(elmnt).data('thumb') == "yes" ) {
                        links[t] = buildthumb ($(elmnt).data('src'), true);
                    } else {
                        links[t] = buildimage ($(elmnt).data('src'), true);
                    }
                }
                if ($(elmnt).data('type') == "file" ) {
                    links[t] = '[attachment='+elmnt.value+']';
                }
                t++;
            }
        }
    }
 
    if (wysiwyg != 'no') {
        if (align == 'center') { content = links.join('</p><p>&nbsp;</p><p style="text-align:center;">'); } else { content = links.join('<br />'); }
        if (align == 'center' && content != "" ) { content = '<p style="text-align:center;">'+ content +'</p><p>&nbsp;</p>'; }
    } else {
        content = links.join('\\n');
        if (align == 'center' && content != "" ) { content = '[center]'+ content +'[/center]'; }
    }
 
    insertcontent( content );
 
};
 
function insertcontent( content ) {
    var wysiwyg = '{$wysiwyg}';
 
    if ( wysiwyg == '1' ) {
 
        var obj = parent.oUtil.obj;
        obj.insertHTML( content );
 
    } else if (wysiwyg == '2') {
 
        parent.tinyMCE.execCommand('mceInsertContent',false,content);
 
    } else {
        parent.doInsert( content, '', false );
    }
};
 
function buildthumb( image, mass ) {
 
    var align = $('#imagealign').val();
    var content = '';
    var wysiwyg = '{$wysiwyg}';
 
    if ( mass ) {
        if (align == 'center' || align == 'none') {
            content = '[thumb]'+ image +'[/thumb]';
        } else {
            content = '[thumb='+align+']'+ image +'[/thumb]';
        }
    } else {
 
        var imgoption = "";
        var imagealt = $('#imagetitle').val();
 
        if (imagealt != "") { 
 
            imgoption = "|"+imagealt;
 
        }
 
        if (align != "none" && align != "center") { 
 
            imgoption = align+imgoption;
 
        }
 
        if (imgoption != "" ) {
 
            imgoption = "="+imgoption;
 
        }
 
        content = '[thumb'+imgoption+']'+ image +'[/thumb]';
 
        if (align == "center" && wysiwyg != 'no' ) {
            content = '<p style="text-align:center;">'+ content +'</p>';
        }
        else if (align == "center") {
            content = '[center]'+ content +'[/center]';
        }
 
    }
 
    return content;
};
 
function buildimage( image, mass ) {
 
    var wysiwyg = '{$wysiwyg}';
    var content = '';
    var align = $('#imagealign').val();
 
    if ( mass ) {
        if (wysiwyg != 'no') {
            if (align == 'center' || align == 'none') {
                content = '<img src="'+ image +'" />';              
            } else {
                content = '<img src="'+ image +'" style="float:' + align+ ';" />';      
            }
        } else {
    
            if (align == 'center' || align == 'none') {
                content = '[img]'+ image +'[/img]'; 
            } else {
                content = '[img='+align+']'+ image +'[/img]';
            }
    
        }
    } else {
 
        if (wysiwyg != 'no') {
 
            var imagealt = $('#imagetitle').val();
 
            if (align == 'center' || align == 'none') {
                content = '<img src="'+ image +'" alt="'+ imagealt +'" title="'+ imagealt +'" />';              
            } else {
                content = '<img src="'+ image +'" alt="'+ imagealt +'" title="'+ imagealt +'" style="float:' + align+ ';" />';      
            }
 
            if (align == "center") {
                content = '<p style="text-align:center;">'+ content +'</p>';
            }
 
        } else {
 
            var imgoption = "";
            var imagealt = $('#imagetitle').val();
    
            if (imagealt != "") { 
    
                imgoption = "|"+imagealt;
    
            }
    
            if (align != "none" && align != "center") { 
    
                imgoption = align+imgoption;
    
            }
    
            if (imgoption != "" ) {
    
                imgoption = "="+imgoption;
    
            }
 
            content = '[img'+imgoption+']'+ image +'[/img]';
 
            if (align == "center") {
                content = '[center]'+ content +'[/center]';
            }
 
        }
 
    }
 
    return content;
};
 
function insert_image() {
 
    var type = $('#imgparam1 input:radio[name=thumbimg]:checked').val()
    var content = '';
 
    if( type && type == 1) {
 
        content = buildthumb ($('#imageurl').val(), false);
 
    } else {
 
        content = buildimage ($('#imageurl').val(), false);
    }
 
    insertcontent( content );
};
 
function insert_file() {
 
    var type = $('#imgparam5 input:radio[name=filemode]:checked').val()
 
    if( type ) {
 
        if( type == 1 ) {
    
            insertcontent( $('#fileurl').val() );
    
        } else {
    
            insertcontent( $('#playurl').val() );
    
        }
 
    } else {
 
        insertcontent( $('#fileurl').val() );
 
    }
 
};
function upload_from_url( url ) {
 
    var t_size = $('#t_size').val();
    var t_seite = $('#t_seite').val();
    var make_thumb = $("#make_thumb").is(":checked") ? 1 : 0;
    var make_watermark = $("#make_watermark").is(":checked") ? 1 : 0;
 
    if (url == 'url' ) {
 
        var copyurl = $('#copyurl').val();
        var ftpurl = '';
        var error_id = 'upload-viaurl-status';      
    } else {
 
        var ftpurl = $('#ftpurl').val();
        var copyurl = '';
        var error_id = 'upload-viaftp-status';
    }
 
    $('#'+error_id).html( '<font color="green">{$lang['ajax_info']}</font>' );
 
    $.post( "{$root}engine/ajax/upload.php", { news_id: "{$news_id}", imageurl: copyurl, ftpurl: ftpurl, t_size: t_size, t_seite: t_seite, make_thumb: make_thumb, make_watermark: make_watermark, area: "{$area}", author: "{$author}", subaction: "upload" }, function(data){
 
        if ( data.success ) {
 
            var returnbox = data.returnbox;
 
            returnbox = returnbox.replace(/&lt;/g, "<");
            returnbox = returnbox.replace(/&gt;/g, ">");
            returnbox = returnbox.replace(/&amp;/g, "&");
 
            $('#cont1').append( returnbox );
 
            $('#'+error_id).html('');
 
            if (url == 'url' ) {
                $('#copyurl').val('');
            } else {
                $('#ftpurl').val('');
            }
 
            tabClick(0);
 
        } else {
 
            if( data.error ) $('#'+error_id).html( '<font color="red">' + data.error + '</font>' );
 
        }
 
    }, "json");
    return false;
 
};
 
function delete_file() {
    document.delimages.submit();
};
</script>
</body>
</html>
HTML;
?>
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
19.08.2013, 22:17
Ответы с готовыми решениями:

Parse error: syntax error, unexpected T_INC, expecting ')' in Z:\home\mysite.ru\www\index.php on line 19
Изучаю php. Не могу найти ошибку в коде. Помогите плиз. Выводит ошибку: &quot;Parse error: syntax error, unexpected T_INC, expecting ')' in...

Parse error: syntax error, unexpected T_IF in X:\home\mysite.local\www\blocks\questbook.php on line 27
В чем здесь ошибка? Браузер выводит: Parse error: syntax error, unexpected T_IF in X:\home\mysite.local\www\blocks\questbook.php on line...

Parse error: syntax error, unexpected T_STRING in /var/www/std-vat-3003/data/www/ds27kolokolchik.ru/wp-config
Помогите пожалуйста пишет Parse error: syntax error, unexpected T_STRING in /var/www/std-vat-3003/data/www/ds27kolokolchik.ru/wp-config.php...

2
 Аватар для Dealiss
296 / 284 / 84
Регистрация: 10.05.2013
Сообщений: 920
19.08.2013, 22:30
Закрой все " ) }

Добавлено через 9 минут
PHP
1
if( $area != "template" ) { // 422 строка - не закрытый if
1
0 / 0 / 1
Регистрация: 19.08.2013
Сообщений: 8
19.08.2013, 22:34  [ТС]
Цитата Сообщение от Dealiss Посмотреть сообщение
Закрой все " ) }

Добавлено через 9 минут
PHP
1
if( $area != "template" ) { // 422 строка - не закрытый if
спасибо, заработало
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
19.08.2013, 22:34
Помогаю со студенческими работами здесь

Parse error: syntax error, unexpected '<' in Z:\home\dle\www\engine\inc\test_adm.php on line 3
Всем привет! Стараюсь разобраться, но иногда торможу. наводку дайте пожалуйста. Не проникся ещё php, но что-то начинаю понимать....

Выдает ошибку Parse error: syntax error, unexpected $end in Z:\home\localhost\www\LR\LR_6\6.php on line 42
Выдает ошибку Parse error: syntax error, unexpected $end in Z:\home\localhost\www\LR\LR_6\6.php on line 42 Что не так? ...

Parse error: syntax error, unexpected $end in Z:\home\localhost\www\...\admin\edit_article.php on line 113
Есть файл редактирования статьи в базе. При проверке в браузере выдает ошибку: &quot;Parse error: syntax error, unexpected $end in...

Parse error: syntax error, unexpected $end in Z:\home\nonametravel.ru\www\admin\index.php on line 101
Помогите разобраться с проблемой...выводит сообщение об ошибке, вроде по коду все закрыто и переменные совпадают по названиям...в чем может...

Parse error: syntax error, unexpected $end in /home/bitrix/www/contacts/index.php on line 142 - как исправить?
Здравствуйте! Помогите пожалуйста разобраться, в чём может быть проблема. Выскакивает такая ошибка при переходе в подраздел...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Новые блоги и статьи
Использование SDL3-callbacks вместо функции main() на Android, Desktop и WebAssembly
8Observer8 24.01.2026
Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а привычная функция main(). . .
моя боль
iceja 24.01.2026
Выложила интерполяцию кубическими сплайнами www. iceja. net REST сервисы временно не работают, только через Web. Написала за 56 рабочих часов этот сайт с нуля. При помощи perplexity. ai PRO , при. . .
Модель сукцессии микоризы
anaschu 24.01.2026
Решили писать научную статью с неким РОманом
http://iceja.net/ математические сервисы
iceja 20.01.2026
Обновила свой сайт http:/ / iceja. net/ , приделала Fast Fourier Transform экстраполяцию сигналов. Однако предсказывает далеко не каждый сигнал (см ограничения http:/ / iceja. net/ fourier/ docs ). Также. . .
http://iceja.net/ сервер решения полиномов
iceja 18.01.2026
Выкатила http:/ / iceja. net/ сервер решения полиномов (находит действительные корни полиномов методом Штурма). На сайте документация по API, но скажу прямо VPS слабенький и 200 000 полиномов. . .
Расчёт переходных процессов в цепи постоянного тока
igorrr37 16.01.2026
/ * Дана цепь(не выше 3-го порядка) постоянного тока с элементами R, L, C, k(ключ), U, E, J. Программа находит переходные токи и напряжения на элементах схемы классическим методом(1 и 2 з-ны. . .
Восстановить юзерскрипты Greasemonkey из бэкапа браузера
damix 15.01.2026
Если восстановить из бэкапа профиль Firefox после переустановки винды, то список юзерскриптов в Greasemonkey будет пустым. Но восстановить их можно так. Для этого понадобится консольная утилита. . .
Сукцессия микоризы: основная теория в виде двух уравнений.
anaschu 11.01.2026
https:/ / rutube. ru/ video/ 7a537f578d808e67a3c6fd818a44a5c4/
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru