diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ed999553cb..4facfad081 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6269,3 +6269,33 @@ function arrayOutputSorting($sort, $sortField) } }; } + + +function setCookieToken($cookieName, $cookieValue, $httpOnly=true, $secure=false) +{ + // See: http://stackoverflow.com/a/1459794/59087 + // See: http://shiflett.org/blog/2006/mar/server-name-versus-http-host + // See: http://stackoverflow.com/a/3290474/59087 + setcookie( + $cookieName, + $cookieValue, + 2147483647, + // expires January 1, 2038 + '/', + // your path + $_SERVER['HTTP_HOST'], + // your domain + $secure, + // Use true over HTTPS + $httpOnly + // Set true for $AUTH_COOKIE_NAME + ); +} + + +function setDownloadCookieToken() +{ + $token = 'downloadToken'; + + setCookieToken($token, $_GET[$token], false, false); +} diff --git a/pandora_console/include/javascript/pandora_ui.js b/pandora_console/include/javascript/pandora_ui.js index ecb23827d9..30e7ee32ee 100644 --- a/pandora_console/include/javascript/pandora_ui.js +++ b/pandora_console/include/javascript/pandora_ui.js @@ -763,3 +763,68 @@ function getGroupIcon(id_group, img_container) { } }); } + +/* Prepare download control */ +function getCookie(name) { + var parts = document.cookie.split(name + "="); + if (parts.length == 2) + return parts + .pop() + .split(";") + .shift(); +} + +function expireCookie(cName) { + document.cookie = + encodeURIComponent(cName) + + "=deleted; expires=" + + new Date(0).toUTCString(); +} + +function setCursor(buttonStyle, button) { + button.css("cursor", buttonStyle); +} + +function setFormToken(button) { + var downloadToken = new Date().getTime(); + button.append(" 'forced_title_layer', 'class' => 'forced_title_layer', ' set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false)); set_js_value('homeurl', $config['homeurl']); set_js_value('homedir', $config['homedir'].'/'); +// Prevent double request message. +set_js_value('prepareDownloadTitle', __('Generating content')); +set_js_value('prepareDownloadMsg', __('Generating content, please wait')); + // ======================================================================