]> git.p6c8.net - jirafeau.git/blob - script.php
prevent api exec in case of problem
[jirafeau.git] / script.php
1 <?php
2 /*
3 * Jirafeau, your web file repository
4 * Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 /*
21 * This file permits to easyly script file sending, receiving, deleting, ...
22 * If you don't want this feature, you can simply delete this file from your
23 * web directory.
24 */
25
26 define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
27
28 require (JIRAFEAU_ROOT . 'lib/config.php');
29 require (JIRAFEAU_ROOT . 'lib/settings.php');
30 require (JIRAFEAU_ROOT . 'lib/functions.php');
31 require (JIRAFEAU_ROOT . 'lib/lang.php');
32
33 global $script_langages;
34 $script_langages = array ('bash' => 'Bash');
35
36 /* Operations may take a long time.
37 * Be sure PHP's safe mode is off.
38 */
39 set_time_limit(0);
40
41 if ($_SERVER['REQUEST_METHOD'] == "GET" && count ($_GET) == 0)
42 {
43 require (JIRAFEAU_ROOT . 'lib/template/header.php');
44 check_errors ();
45 if (has_error ())
46 {
47 show_errors ();
48 require (JIRAFEAU_ROOT . 'lib/template/footer.php');
49 exit;
50 }
51 echo '<div class="info">';
52 echo '<h2>' . t('Welcome to Jirafeau\'s query interface') . '</h2>';
53 echo '<p>';
54 echo t('This interface permits to script your uploads and downloads.') .
55 ' ' . t('The instructions above show how to query this interface.');
56 echo '</p>';
57
58 echo '<h3>' . t('Get Jirafeau\'s version') . ':</h3>';
59 echo '<p>';
60 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
61 echo '<br />';
62 echo t('Parameters') . ':<br />';
63 echo "<b>get_version=</b>1<i> (" . t('Required') . ")</i> <br />";
64 echo '</p>';
65 echo '<p>' . t('This will return brut text content.') . ' ' .
66 t('First line is the version number.') . '<br /></p>';
67 echo '<p>';
68 echo t('Example') . ": <a href=\"" . $web_root . "script.php?get_version=1\">" . $web_root . "script.php?get_version=1</a> ";
69 echo '</p>';
70
71 echo '<h3>' . t('Get server capacity') . ':</h3>';
72 echo '<p>';
73 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
74 echo '<br />';
75 echo t('Parameters') . ':<br />';
76 echo "<b>get_capacity=</b>1<i> (" . t('Required') . ")</i> <br />";
77 echo '</p>';
78 echo '<p>' . t('This will return brut text content.') . ' ' .
79 t('First line is the server capacity (in Bytes).') . '<br /></p>';
80 echo '<p>';
81 echo t('Example') . ": <a href=\"" . $web_root . "script.php?get_capacity=1\">" . $web_root . "script.php?get_capacity=1</a> ";
82 echo '</p>';
83
84 echo '<h3>' . t('Upload a file') . ':</h3>';
85 echo '<p>';
86 echo t('Send a POST query to') . ': <i>' . $web_root . 'script.php</i><br />';
87 echo '<br />';
88 echo t('Parameters') . ':<br />';
89 echo "<b>file=</b>C:\\your\\file\\path<i> (" . t('Required') . ")</i> <br />";
90 echo "<b>time=</b>[minute|hour|day|week|month|none]<i> (" . t('Optional') . ', '. t('default: none') . ")</i> <br />";
91 echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
92 echo "<b>one_time_download=</b>1<i> (" . t('Optional') . ")</i> <br />";
93 echo '</p>';
94 echo '<p>' . t('This will return brut text content.') . ' ' .
95 t('First line is the download reference and the second line the delete code.') . '<br /></p>';
96
97 echo '<h3>' . t('Get a file') . ':</h3>';
98 echo '<p>';
99 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
100 echo '<br />';
101 echo t('Parameters') . ':<br />';
102 echo "<b>h=</b>your_download_reference<i> (" . t('Required') . ")</i> <br />";
103 echo '</p>';
104 echo '<p>';
105 echo t('If a password has been set, send a POST request with it.');
106 echo '<br />';
107 echo t('Parameters') . ':<br />';
108 echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
109 echo '</p>';
110 echo '<p>';
111 echo t('Example') . ": <a href=\"" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU\">" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU</a> ";
112 echo '</p>';
113
114 echo '<h3>' . t('Delete a file') . ':</h3>';
115 echo '<p>';
116 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
117 echo '<br />';
118 echo t('Parameters') . ':<br />';
119 echo "<b>h=</b>your_download_reference<i> (" . t('Required') . ")</i> <br />";
120 echo "<b>d=</b>yout_delete_code<i> (" . t('Required') . ")</i> <br />";
121 echo '</p>';
122 echo '<p>' . t('This will return "Ok" if succeded, "Error" otherwhise.') . '<br /></p>';
123 echo '<p>';
124 echo t('Example') . ": <a href=\"" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU&amp;d=0d210a952\">" . $web_root . "script.php?h=30ngy0hsDcpfrF8zR7x9iU&amp;d=0d210a952</a> ";
125 echo '</p>';
126
127 echo '<h3>' . t('Get a generated scripts') . ':</h3>';
128 echo '<p>';
129 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php</i><br />';
130 echo '<br />';
131 echo t('Parameters') . ':<br />';
132 echo "<b>lang=</b>[";
133 foreach ($script_langages as $lang => $name)
134 echo $lang;
135 echo "]<i> (" . t('Required') . ")</i> <br />";
136 echo '</p>';
137 echo '<p>' . t('This will return brut text content of the code.') . '<br /></p>';
138 echo '<p>';
139 echo t('Example') . ": <br />";
140 foreach ($script_langages as $lang => $name)
141 echo "$name: <a href=\"" . $web_root . "script.php?lang=$lang\">" . $web_root . "script.php?lang=$lang</a> ";
142 echo '</p>';
143
144 echo '<h3>' . t('Initalize a asynchronous transfert') . ':</h3>';
145 echo '<p>';
146 echo t('The goal is to permit to transfert big file, chunk by chunk.') . ' ';
147 echo t('Chunks of data must be sent in order.');
148 echo '</p>';
149 echo '<p>';
150 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?init_async</i><br />';
151 echo '<br />';
152 echo t('Parameters') . ':<br />';
153 echo "<b>filename=</b>file_name.ext<i> (" . t('Required') . ")</i> <br />";
154 echo "<b>type=</b>MIME_TYPE<i> (" . t('Optional') . ")</i> <br />";
155 echo "<b>time=</b>[minute|hour|day|week|month|none]<i> (" . t('Optional') . ', '. t('default: none') . ")</i> <br />";
156 echo "<b>password=</b>your_password<i> (" . t('Optional') . ")</i> <br />";
157 echo "<b>one_time_download=</b>1<i> (" . t('Optional') . ")</i> <br />";
158 echo '</p>';
159 echo '<p>' . t('This will return brut text content.') . ' ' .
160 t('First line is the asynchronous transfert reference and the second line the code to use in the next operation.') . '<br /></p>';
161
162 echo '<h3>' . t('Push data during asynchronous transfert') . ':</h3>';
163 echo '<p>';
164 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?push_async</i><br />';
165 echo '<br />';
166 echo t('Parameters') . ':<br />';
167 echo "<b>ref=</b>async_reference<i> (" . t('Required') . ")</i> <br />";
168 echo "<b>data=</b>data_chunk<i> (" . t('Required') . ")</i> <br />";
169 echo "<b>code=</b>last_provided_code<i> (" . t('Required') . ")</i> <br />";
170 echo '</p>';
171 echo '<p>' . t('This will return brut text content.') . ' ' .
172 t('Returns the next code to use.') . '<br /></p>';
173
174 echo '<h3>' . t('Finalize asynchronous transfert') . ':</h3>';
175 echo '<p>';
176 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?end_async</i><br />';
177 echo '<br />';
178 echo t('Parameters') . ':<br />';
179 echo "<b>ref=</b>async_reference<i> (" . t('Required') . ")</i> <br />";
180 echo "<b>code=</b>last_provided_code<i> (" . t('Required') . ")</i> <br />";
181 echo '</p>';
182 echo '<p>' . t('This will return brut text content.') . ' ' .
183 t('First line is the download reference and the second line the delete code.') . '<br /></p>';
184
185 if ($cfg['enable_blocks'])
186 {
187 echo '<h3>' . t('Create a data block') . ':</h3>';
188 echo '<p>';
189 echo t('This interface permits to create a block of data filled with zeros.') .
190 ' ' . t('You can read selected parts, write (using a code) and delete the block.') .
191 ' ' . t('Blocks may be removed after a month of non usage.');
192 echo '</p>';
193 echo '<p>';
194 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?init_block</i><br />';
195 echo '<br />';
196 echo t('Parameters') . ':<br />';
197 echo "<b>size=</b>size_in_bytes<i> (" . t('Required') . ")</i> <br />";
198 echo '</p>';
199 echo '<p>' . t('This will return brut text content.') . ' ' .
200 t('First line is a block id the second line the edit/delete code.') . '<br /></p>';
201
202 echo '<h3>' . t('Get block size') . ':</h3>';
203 echo '<p>';
204 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?get_block_size</i><br />';
205 echo '<br />';
206 echo t('Parameters') . ':<br />';
207 echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
208 echo '</p>';
209 echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';
210
211 echo '<h3>' . t('Read data in a block') . ':</h3>';
212 echo '<p>';
213 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?read_block</i><br />';
214 echo '<br />';
215 echo t('Parameters') . ':<br />';
216 echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
217 echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";
218 echo "<b>length=</b>length_to_read_in_bytes<i> (" . t('Required') . ")</i> <br />";
219 echo '</p>';
220 echo '<p>' . t('This will return asked data or "Error" string.') . '<br /></p>';
221
222 echo '<h3>' . t('Write data in a block') . ':</h3>';
223 echo '<p>';
224 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?write_block</i><br />';
225 echo '<br />';
226 echo t('Parameters') . ':<br />';
227 echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
228 echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";
229 echo "<b>start=</b>byte_position_starting_from_zero<i> (" . t('Required') . ")</i> <br />";
230 echo "<b>data=</b>data_to_write<i> (" . t('Required') . ")</i> <br />";
231 echo '</p>';
232 echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';
233
234 echo '<h3>' . t('Delete a block') . ':</h3>';
235 echo '<p>';
236 echo t('Send a GET query to') . ': <i>' . $web_root . 'script.php?delete_block</i><br />';
237 echo '<br />';
238 echo t('Parameters') . ':<br />';
239 echo "<b>id=</b>block_id<i> (" . t('Required') . ")</i> <br />";
240 echo "<b>code=</b>block_code<i> (" . t('Required') . ")</i> <br />";
241 echo '</p>';
242 echo '<p>' . t('This will return "Ok" or "Error" string.') . '<br /></p>';
243 }
244
245 echo '</div><br />';
246 require (JIRAFEAU_ROOT . 'lib/template/footer.php');
247 exit;
248 }
249
250 /* Lets use interface now. */
251 header('Content-Type: text; charset=utf-8');
252
253 check_errors ();
254 if (has_error ())
255 {
256 echo "Error";
257 exit;
258 }
259
260 /* Upload file */
261 if (isset ($_FILES['file']) && is_writable (VAR_FILES)
262 && is_writable (VAR_LINKS))
263 {
264 $key = '';
265 if (isset ($_POST['key']))
266 $key = $_POST['key'];
267
268 $time = time ();
269 if (!isset ($_POST['time']))
270 $time = JIRAFEAU_INFINITY;
271 else
272 switch ($_POST['time'])
273 {
274 case 'minute':
275 $time += JIRAFEAU_MINUTE;
276 break;
277 case 'hour':
278 $time += JIRAFEAU_HOUR;
279 break;
280 case 'day':
281 $time += JIRAFEAU_DAY;
282 break;
283 case 'week':
284 $time += JIRAFEAU_WEEK;
285 break;
286 case 'month':
287 $time += JIRAFEAU_MONTH;
288 break;
289 default:
290 $time = JIRAFEAU_INFINITY;
291 break;
292 }
293 $res = jirafeau_upload ($_FILES['file'],
294 isset ($_POST['one_time_download']),
295 $key, $time, $_SERVER['REMOTE_ADDR']);
296
297 if (empty($res) || $res['error']['has_error'])
298 {
299 echo "Error";
300 exit;
301 }
302 /* Print direct link. */
303 echo $res['link'];
304 echo NL;
305 /* Print delete link. */
306 echo $res['delete_link'];
307 }
308 elseif (isset ($_GET['h']))
309 {
310 $link_name = $_GET['h'];
311 $key = '';
312 if (isset ($_POST['key']))
313 $key = $_POST['key'];
314 $d = '';
315 if (isset ($_GET['d']))
316 $d = $_GET['d'];
317
318 if (!preg_match ('/[0-9a-zA-Z_-]{22}$/', $link_name))
319 {
320 echo "Error";
321 exit;
322 }
323
324 $link = jirafeau_get_link ($link_name);
325 if (count ($link) == 0)
326 {
327 echo "Error";
328 exit;
329 }
330 if (strlen ($d) > 0 && $d == $link['link_code'])
331 {
332 jirafeau_delete_link ($link_name);
333 echo "Ok";
334 exit;
335 }
336 if ($link['time'] != JIRAFEAU_INFINITY && time () > $link['time'])
337 {
338 jirafeau_delete_link ($link_name);
339 echo "Error";
340 exit;
341 }
342 if (strlen ($link['key']) > 0 && md5 ($key) != $link['key'])
343 {
344 echo "Error";
345 exit;
346 }
347 $p = s2p ($link['md5']);
348 if (!file_exists (VAR_FILES . $p . $link['md5']))
349 {
350 echo "Error";
351 exit;
352 }
353
354 /* Read file. */
355 header ('Content-Length: ' . $link['file_size']);
356 header ('Content-Type: ' . $link['mime_type']);
357 header ('Content-Disposition: attachment; filename="' .
358 $link['file_name'] . '"');
359
360 $r = fopen (VAR_FILES . $p . $link['md5'], 'r');
361 while (!feof ($r))
362 {
363 print fread ($r, 1024);
364 ob_flush();
365 }
366 fclose ($r);
367
368 if ($link['onetime'] == 'O')
369 jirafeau_delete_link ($link_name);
370 exit;
371 }
372 elseif (isset ($_GET['get_capacity']))
373 {
374 echo min (jirafeau_ini_to_bytes (ini_get ('post_max_size')),
375 jirafeau_ini_to_bytes (ini_get ('upload_max_filesize')));
376 }
377 elseif (isset ($_GET['get_version']))
378 {
379 echo JIRAFEAU_VERSION;
380 }
381 elseif (isset ($_GET['lang']))
382 {
383 $l=$_GET['lang'];
384 if ($l == "bash")
385 {
386 ?>
387 #!/bin/bash
388
389 # This script has been auto-generated by Jirafeau but you can still edit
390 # options below.
391
392 # Config
393 proxy='' # ex: proxy='proxysever.test.com:3128' or set JIRAFEAU_PROXY global variable
394 url='<?php echo $cfg['web_root'] . 'script.php'; ?>' # or set JIRAFEAU_URL ex: url='http://mysite/jirafeau/script.php'
395 time='none' # minute, hour, day, week, month or none. Or set JIRAFEAU_TIME.
396 one_time='' # ex: one_time="1" or set JIRAFEAU_ONE_TIME.
397 curl='' # curl path to download or set JIRAFEAU_CURL_PATH.
398 # End of config
399
400 if [ -n "$JIRAFEAU_PROXY" ]; then
401 proxy="$JIRAFEAU_PROXY"
402 fi
403
404 if [ -n "$JIRAFEAU_URL" ]; then
405 url="$JIRAFEAU_URL"
406 fi
407
408 if [ -z "$url" ]; then
409 echo "Please set url in script parameters or export JIRAFEAU_URL"
410 fi
411
412 if [ -n "$JIRAFEAU_TIME" ]; then
413 time="$JIRAFEAU_TIME"
414 fi
415
416 if [ -n "$JIRAFEAU_ONE_TIME" ]; then
417 one_time='1'
418 fi
419
420 if [ -z "$curl" ]; then
421 curl="$JIRAFEAU_CURL_PATH"
422 fi
423
424 if [ -z "$curl" ] && [ -e "/usr/bin/curl" ]; then
425 curl="/usr/bin/curl"
426 fi
427
428 if [ -z "$curl" ] && [ -e "/bin/curl.exe" ]; then
429 curl="/bin/curl.exe"
430 fi
431
432 if [ -z "$curl" ]; then
433 echo "Please set your curl binary path (by editing this script or export JIRAFEAU_CURL_PATH global variable)."
434 exit
435 fi
436
437 if [ -z "$2" ]; then
438 echo "man:"
439 echo " $0 send PATH [PASSWORD]"
440 echo " $0 get URL [PASSWORD]"
441 echo " $0 delete URL"
442 echo ""
443 echo "Global variables to export:"
444 echo " JIRAFEAU_PROXY : example: proxysever.test.com:3128"
445 echo " JIRAFEAU_URL : example: http://mysite/jirafeau/script.php"
446 echo " JIRAFEAU_TIME : minute, hour, day, week, month or none"
447 echo " JIRAFEAU_ONE_TIME : set anything or set empty"
448 echo " JIRAFEAU_CURL : path to your curl binary"
449
450 exit 0
451 fi
452
453 if [ -n "$proxy" ]; then
454 proxy="-x $proxy"
455 fi
456
457 options=''
458 if [ -n "$one_time" ]; then
459 options="$options -F one_time_download=1"
460 fi
461
462 password=''
463 if [ -n "$3" ]; then
464 password="$3"
465 options="$options -F key=$password"
466 fi
467
468 if [ "$1" == "send" ]; then
469 if [ ! -f "$2" ]; then
470 echo "File \"$2\" does not exists."
471 exit
472 fi
473
474 # Ret result
475 res=$($curl -X POST --http1.0 $proxy $options \
476 -F "time=$time" \
477 -F "file=@$2" \
478 $url)
479
480 if [[ "$res" == "Error" ]]; then
481 echo "Error while uploading."
482 exit
483 fi
484
485 # Not using head or tail to minimise command dependencies
486 code=$(cnt=0; echo "$res" | while read l; do
487 if [[ "$cnt" == "0" ]]; then
488 echo "$l"
489 fi
490 cnt=$(( cnt + 1 ))
491 done)
492 del_code=$(cnt=0; echo "$res" | while read l; do
493 if [[ "$cnt" == "1" ]]; then
494 echo "$l"
495 fi
496 cnt=$(( cnt + 1 ))
497 done)
498 echo "${url}?h=$code"
499 echo "${url}?h=$code&d=$del_code"
500 elif [ "$1" == "get" ]; then
501 if [ -z "$password" ]; then
502 $curl $proxy -OJ "$2"
503 else
504 $curl $proxy -OJ -X POST -F key=$password "$2"
505 fi
506 elif [ "$1" == "delete" ]; then
507 $curl $proxy "$2"
508 fi
509 <?php
510 }
511 else
512 {
513 echo "Error";
514 exit;
515 }
516 }
517 /* Initialize an asynchronous upload. */
518 elseif (isset ($_GET['init_async']))
519 {
520 if (!isset ($_POST['filename']))
521 {
522 echo "Error";
523 exit;
524 }
525
526 $type = '';
527 if (isset ($_POST['type']))
528 $type = $_POST['type'];
529
530 $key = '';
531 if (isset ($_POST['password']))
532 $key = $_POST['password'];
533
534 $time = time ();
535 if (!isset ($_POST['time']))
536 $time = JIRAFEAU_INFINITY;
537 else
538 switch ($_POST['time'])
539 {
540 case 'minute':
541 $time += JIRAFEAU_MINUTE;
542 break;
543 case 'hour':
544 $time += JIRAFEAU_HOUR;
545 break;
546 case 'day':
547 $time += JIRAFEAU_DAY;
548 break;
549 case 'week':
550 $time += JIRAFEAU_WEEK;
551 break;
552 case 'month':
553 $time += JIRAFEAU_MONTH;
554 break;
555 default:
556 $time = JIRAFEAU_INFINITY;
557 break;
558 }
559 echo jirafeau_async_init ($_POST['filename'],
560 $type,
561 isset ($_POST['one_time_download']),
562 $key,
563 $time,
564 $_SERVER['REMOTE_ADDR']);
565 }
566 /* Continue an asynchronous upload. */
567 elseif (isset ($_GET['push_async']))
568 {
569 if ((!isset ($_POST['ref']))
570 || (!isset ($_FILES['data']))
571 || (!isset ($_POST['code'])))
572 echo "Error";
573 else
574 echo jirafeau_async_push ($_POST['ref'], $_FILES['data'], $_POST['code']);
575 }
576 /* Finalize an asynchronous upload. */
577 elseif (isset ($_GET['end_async']))
578 {
579 if (!isset ($_POST['ref'])
580 || !isset ($_POST['code']))
581 echo "Error";
582 else
583 echo jirafeau_async_end ($_POST['ref'], $_POST['code']);
584 }
585 /* Initialize block. */
586 elseif (isset ($_GET['init_block']) && $cfg['enable_blocks'])
587 {
588 if (!isset ($_POST['size']))
589 echo "Error";
590 else
591 echo jirafeau_block_init ($_POST['size']);
592 }
593 /* Get block size. */
594 elseif (isset ($_GET['get_block_size']) && $cfg['enable_blocks'])
595 {
596 if (!isset ($_POST['id']))
597 echo "Error";
598 else
599 echo jirafeau_block_get_size ($_POST['id']);
600 }
601 /* Read data in block. */
602 elseif (isset ($_GET['read_block']) && $cfg['enable_blocks'])
603 {
604 if (!isset ($_POST['id'])
605 || !isset ($_POST['start'])
606 || !isset ($_POST['length']))
607 echo "Error";
608 else
609 jirafeau_block_read ($_POST['id'], $_POST['start'], $_POST['length']);
610 }
611 /* Write data in block. */
612 elseif (isset ($_GET['write_block']) && $cfg['enable_blocks'])
613 {
614 if (!isset ($_POST['id'])
615 || !isset ($_POST['start'])
616 || !isset ($_FILES['data'])
617 || !isset ($_POST['code']))
618 echo "Error";
619 else
620 echo jirafeau_block_write ($_POST['id'], $_POST['start'], $_FILES['data'], $_POST['code']);
621 }
622 /* Delete block. */
623 elseif (isset ($_GET['delete_block']) && $cfg['enable_blocks'])
624 {
625 if (!isset ($_POST['id'])
626 || !isset ($_POST['code']))
627 echo "Error";
628 else
629 echo jirafeau_block_delete ($_POST['id'], $_POST['code']);
630 }
631 else
632 echo "Error";
633 exit;
634 ?>

patrick-canterino.de