X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/26d3657f83ba96b080c9cb0a242ee8b2d8fc1fe1..169cbfa6f1d566deba92eb3ac559cba01588be27:/lib/functions.js.php diff --git a/lib/functions.js.php b/lib/functions.js.php index e8a6bb1..989b788 100644 --- a/lib/functions.js.php +++ b/lib/functions.js.php @@ -20,16 +20,16 @@ header('Content-Type: text/javascript'); -define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/../'); -require (JIRAFEAU_ROOT . 'lib/config.original.php'); -require (JIRAFEAU_ROOT . 'lib/settings.php'); -require (JIRAFEAU_ROOT . 'lib/functions.php'); -require (JIRAFEAU_ROOT . 'lib/lang.php'); +define('JIRAFEAU_ROOT', dirname(__FILE__) . '/../'); + +require(JIRAFEAU_ROOT . 'lib/settings.php'); +require(JIRAFEAU_ROOT . 'lib/functions.php'); +require(JIRAFEAU_ROOT . 'lib/lang.php'); ?> function translate (expr) { - var lang_array = ; + var lang_array = ; if (lang_array.hasOwnProperty(expr)) return lang_array[expr]; return expr; @@ -206,7 +206,7 @@ function add_time_string_to_date(d, time) { return false; } - + if (time == 'minute') { d.setSeconds (d.getSeconds() + 60); @@ -232,6 +232,11 @@ function add_time_string_to_date(d, time) d.setSeconds (d.getSeconds() + 2419200); return true; } + if (time == 'quarter') + { + d.setSeconds (d.getSeconds() + 7257600); + return true; + } if (time == 'year') { d.setSeconds (d.getSeconds() + 29030400); @@ -254,11 +259,14 @@ function classic_upload (url, file, time, password, one_time, upload_password) if (req.readyState == 4 && req.status == 200) { var res = req.responseText; - if (res == "Error") + + // if response starts with "Error" then show a failure + if (/^Error/.test(res)) { - pop_failure (); + pop_failure (res); return; } + res = res.split ("\n"); if (time != 'none') { @@ -316,11 +324,13 @@ function async_upload_start (url, max_size, file, time, password, one_time, uplo if (req.readyState == 4 && req.status == 200) { var res = req.responseText; - if (res == "Error") + + if (/^Error/.test(res)) { - pop_failure (); + pop_failure (res); return; } + res = res.split ("\n"); async_global_ref = res[0]; var code = res[1]; @@ -385,11 +395,13 @@ function async_upload_push (code) if (req.readyState == 4 && req.status == 200) { var res = req.responseText; - if (res == "Error") + + if (/^Error/.test(res)) { - pop_failure (); + pop_failure (res); return; } + res = res.split ("\n"); var code = res[0] async_global_transfered = async_global_transfering; @@ -423,11 +435,13 @@ function async_upload_end (code) if (req.readyState == 4 && req.status == 200) { var res = req.responseText; - if (res == "Error") + + if (/^Error/.test(res)) { - pop_failure (); + pop_failure (res); return; } + res = res.split ("\n"); if (async_global_time != 'none') {