1
1
<?php
2
+
2
3
session_start ();
3
4
error_reporting (0 );
4
5
5
- require '../../lib/Medoo.php ' ;
6
- use Medoo \Medoo ;
7
-
8
- require '../../config.php ' ;
9
-
10
-
11
- if (is_file ('../../config_database.php ' )) {
12
- include '../../config_database.php ' ;
13
- $ db_type = 'mysql ' ;
14
-
15
- $ database = new Medoo ([
16
-
17
- 'database_type ' => 'mysql ' ,
18
- 'database_name ' => "$ database_name " ,
19
- 'server ' => "$ database_host " ,
20
- 'username ' => "$ database_user " ,
21
- 'password ' => "$ database_psw " ,
22
-
23
- 'charset ' => 'utf8 ' ,
24
- 'port ' => $ database_port ,
25
-
26
- 'prefix ' => DB_PREFIX
27
- ]);
28
-
29
- $ db_content = $ database ;
30
- $ db_user = $ database ;
31
- $ db_statistics = $ database ;
32
-
33
-
34
-
35
- } else {
36
- $ db_type = 'sqlite ' ;
37
-
38
- if (isset ($ fc_content_files ) && is_array ($ fc_content_files )) {
39
- /* switch database file $fc_db_content */
40
- include 'core/contentSwitch.php ' ;
41
- }
42
-
43
-
44
- define ("CONTENT_DB " , "$ fc_db_content " );
45
-
46
- $ db_content = new Medoo ([
47
- 'database_type ' => 'sqlite ' ,
48
- 'database_file ' => CONTENT_DB
49
- ]);
50
-
51
-
52
- }
53
-
54
-
55
-
56
-
57
-
58
- define ("FC_ROOT " , str_replace ("/acp " ,"" ,FC_INC_DIR ));
59
- define ("IMAGES_FOLDER " , "../ $ img_path " );
60
- define ("FILES_FOLDER " , "../ $ files_path " );
61
- define ("FC_SOURCE " , "backend " );
62
-
63
-
64
-
65
6
require_once 'access.php ' ;
66
- require_once 'functions.php ' ;
67
- require '../../lib/lang/ ' .$ _SESSION ['lang ' ].'/dict-backend.php ' ;
68
7
69
- $ set_lang = $ _SESSION [ ' lang ' ] ;
8
+ $ set_lang = $ languagePack ;
70
9
if (isset ($ _REQUEST ['set_lang ' ])) {
71
10
$ set_lang = $ _REQUEST ['set_lang ' ];
72
11
}
73
12
74
- $ fc_labels = fc_get_labels ( );
13
+ $ form_tpl = file_get_contents ( ' templates/media-edit-form.tpl ' );
75
14
76
- $ form_tpl = file_get_contents ('../templates/media-edit-form.tpl ' );
77
15
78
16
if (isset ($ _REQUEST ['file ' ])) {
79
17
$ media_filename = strip_tags ($ _REQUEST ['file ' ]);
85
23
} else {
86
24
$ preview_src = '<img src=" ' . $ media_filename .'" class="img-fluid"> ' ;
87
25
$ realpath = $ media_filename ;
88
- list ($ img_width , $ img_height ) = getimagesize (".. / $ media_filename " );
26
+ list ($ img_width , $ img_height ) = getimagesize ("./ $ media_filename " );
89
27
$ img_dimensions = ' | ' .$ img_width .' x ' .$ img_height .' px ' ;
90
28
$ shortcode = 'image ' ;
91
29
}
92
30
}
93
31
94
32
$ abs_path = str_replace ('../ ' ,'/ ' ,$ realpath );
95
33
$ filesize = filesize ("../ $ realpath " );
96
- $ rfilesize = readable_filesize (filesize ("../ $ realpath " ));
97
- $ lastedit = date ('d.m.Y H:i ' ,filemtime ("../ $ realpath " ));
34
+ $ rfilesize = readable_filesize (filesize ("$ realpath " ));
35
+ $ lastedit = date ('d.m.Y H:i ' ,filemtime ("$ realpath " ));
36
+
98
37
99
- if (isset ($ _POST ['saveMedia ' ])) {
38
+ if (isset ($ _POST ['save ' ])) {
100
39
$ savedMedia = fc_write_media_data ($ _POST ['realpath ' ],$ _POST ['title ' ],$ _POST ['notes ' ],$ _POST ['keywords ' ],$ _POST ['text ' ],$ _POST ['url ' ],$ _POST ['alt ' ],$ set_lang ,$ _POST ['credit ' ],$ _POST ['priority ' ],$ _POST ['license ' ],time (),$ filesize ,$ _POST ['version ' ],$ _POST ['media_labels ' ]);
101
40
if ($ savedMedia == 'success ' ) {
102
41
$ message = '<div class="alert alert-success alert-auto-close"> ' .$ lang ['db_changed ' ].'</div> ' ;
109
48
}
110
49
111
50
112
- /* language switch */
51
+ echo '<div class="subHeader"> ' ;
52
+ echo '<a class="btn btn-fc" href="?tn=filebrowser&sub=browse"> ' .$ icon ['angle_left ' ].'</a> ' ;
53
+ echo '<span class="ms-3"> ' . $ media_filename .'</span> ' ;
54
+ echo '</div> ' ;
113
55
114
- $ arr_lang = get_all_languages ($ d ='../../lib/lang ' );
115
- $ langSwitch = '<div class="btn-group" role="group"> ' ;
56
+ $ arr_lang = get_all_languages ();
57
+ $ langSwitch = '<form action="?tn=filebrowser&sub=edit"> ' ;
58
+ $ langSwitch .= '<div class="btn-group" role="group"> ' ;
116
59
foreach ($ arr_lang as $ langs ) {
117
60
$ btn_status = '' ;
118
61
if ($ langs ['lang_sign ' ] == "$ set_lang " ) { $ btn_status = 'active ' ; }
119
- $ langSwitch .= '<a data-fancybox data- type="ajax " class="change-fb btn btn-fc btn-sm ' .$ btn_status .'" data-src="../acp/core/ajax.media.php?file= ' . $ media_filename . ' &folder= ' . $ _REQUEST [ ' folder ' ]. ' & set_lang= ' .$ langs ['lang_sign ' ].'" href="javascript:;" > ' .$ langs ['lang_sign ' ].'</a > ' ;
62
+ $ langSwitch .= '<button type="submit " class="btn btn-fc btn-sm ' .$ btn_status .'" name=" set_lang" value=" ' .$ langs ['lang_sign ' ].'"> ' .$ langs ['lang_sign ' ].'</button > ' ;
120
63
}
121
64
$ langSwitch .= '</div> ' ;
122
-
65
+ $ langSwitch .= '<input type="hidden" name="file" value=" ' .$ media_filename .'"> ' ;
66
+ $ langSwitch .= '<input type="hidden" name="folder" value=" ' .$ _REQUEST ['folder ' ].'"> ' ;
67
+ $ langSwitch .= '</form> ' ;
123
68
124
69
$ media_data = fc_get_media_data ($ realpath ,$ set_lang );
125
70
126
71
127
-
128
72
/* labels */
129
73
130
74
$ cnt_labels = count ($ fc_labels );
149
93
150
94
$ form_tpl = str_replace ('{media_labels} ' , $ checkbox_set_labels , $ form_tpl );
151
95
152
-
153
-
154
- $ form_tpl = str_replace ('{form_action} ' , "# " , $ form_tpl );
96
+ $ form_tpl = str_replace ('{form_action} ' , "?tn=filebrowser&sub=edit " , $ form_tpl );
155
97
$ form_tpl = str_replace ('{filename} ' , $ media_filename , $ form_tpl );
156
98
$ form_tpl = str_replace ('{file} ' , $ media_filename , $ form_tpl );
157
99
$ form_tpl = str_replace ('{basename} ' , basename ($ media_filename ), $ form_tpl );
190
132
$ form_tpl = str_replace ('{lang_switch} ' , $ langSwitch , $ form_tpl );
191
133
$ form_tpl = str_replace ('{shortcode} ' , $ shortcode , $ form_tpl );
192
134
$ form_tpl = str_replace ('{token} ' ,$ _SESSION ['token ' ],$ form_tpl );
193
- echo $ form_tpl ;
194
-
195
135
196
- ?>
197
-
198
- <script>
136
+ echo $ form_tpl ;
199
137
200
- $(document).ready(function(){
201
-
202
- $('a.change-fb').click(function(e) {
203
- e.preventDefault();
204
- var target = $(this).data('src');
205
- $.get(target, function (data) {
206
- $.fancybox.getInstance().setContent( $.fancybox.getInstance().current, data );
207
- });
208
-
209
- });
210
-
211
-
212
- $("#media_form").bind("submit", function() {
213
- $.ajax({
214
- type : "POST",
215
- cache : false,
216
- url: "../acp/core/ajax.media.php",
217
- data: $(this).serializeArray(),
218
- success:function(data){
219
- $.fancybox.getInstance().setContent( $.fancybox.getInstance().current, data );
220
- }
221
- });
222
- return false;
223
- });
224
-
225
-
226
- $("[data-fancybox]").fancybox({
227
- type: 'ajax',
228
- minWidth: '450px',
229
- height: '90%'
230
- });
231
-
232
-
233
- setTimeout(function() {
234
- $(".alert-auto-close").slideUp('slow');
235
- }, 2000);
236
-
237
-
238
- });
239
138
240
- </script >
139
+ ? >
0 commit comments