+/* Initialize an asynchronous upload. */\r
+elseif (isset ($_GET['init_async']))\r
+{\r
+ if (jirafeau_has_upload_password ($cfg) &&\r
+ (!isset ($_POST['upload_password']) ||\r
+ !jirafeau_challenge_upload_password ($cfg, $_POST['upload_password'])))\r
+ {\r
+ echo "Error";\r
+ exit;\r
+ }\r
+\r
+ if (!isset ($_POST['filename']))\r
+ {\r
+ echo "Error";\r
+ exit;\r
+ }\r
+\r
+ $type = '';\r
+ if (isset ($_POST['type']))\r
+ $type = $_POST['type'];\r
+ \r
+ $key = '';\r
+ if (isset ($_POST['key']))\r
+ $key = $_POST['key'];\r
+\r
+ $time = time ();\r
+ if (!isset ($_POST['time']))\r
+ $time = JIRAFEAU_INFINITY;\r
+ else\r
+ switch ($_POST['time'])\r
+ {\r
+ case 'minute':\r
+ $time += JIRAFEAU_MINUTE;\r
+ break;\r
+ case 'hour':\r
+ $time += JIRAFEAU_HOUR;\r
+ break;\r
+ case 'day':\r
+ $time += JIRAFEAU_DAY;\r
+ break;\r
+ case 'week':\r
+ $time += JIRAFEAU_WEEK;\r
+ break;\r
+ case 'month':\r
+ $time += JIRAFEAU_MONTH;\r
+ break;\r
+ default:\r
+ $time = JIRAFEAU_INFINITY;\r
+ break;\r
+ }\r
+ echo jirafeau_async_init ($_POST['filename'],\r
+ $type,\r
+ isset ($_POST['one_time_download']),\r
+ $key,\r
+ $time,\r
+ $_SERVER['REMOTE_ADDR']);\r
+}\r
+/* Continue an asynchronous upload. */\r
+elseif (isset ($_GET['push_async']))\r
+{\r
+ if ((!isset ($_POST['ref']))\r
+ || (!isset ($_FILES['data']))\r
+ || (!isset ($_POST['code'])))\r
+ echo "Error";\r
+ else\r
+ echo jirafeau_async_push ($_POST['ref'], $_FILES['data'], $_POST['code']); \r
+}\r
+/* Finalize an asynchronous upload. */\r
+elseif (isset ($_GET['end_async']))\r
+{\r
+ if (!isset ($_POST['ref'])\r
+ || !isset ($_POST['code']))\r
+ echo "Error";\r
+ else\r
+ echo jirafeau_async_end ($_POST['ref'], $_POST['code'], $cfg['enable_crypt'], $cfg['link_name_lenght']);\r
+}\r