From 6a29f8e0abde94b13fb63cd7a8ad813e5e3de0c7 Mon Sep 17 00:00:00 2001 From: instantflorian Date: Thu, 11 Jun 2020 09:16:17 +0200 Subject: [PATCH] Add option to deactivate FE Session Cookie --- wbce/framework/wsession.php | 15 +- wbce/include/captcha/captcha.php | 300 ++++++++++++++++--------------- 2 files changed, 170 insertions(+), 145 deletions(-) diff --git a/wbce/framework/wsession.php b/wbce/framework/wsession.php index caff93256..2e2ac131a 100644 --- a/wbce/framework/wsession.php +++ b/wbce/framework/wsession.php @@ -61,7 +61,20 @@ public static function Start(){ } // Start a session if needed - if (!self::IsStarted()) { + $no_session_cookie=false; + if (defined('NO_SESSION_COOKIE')) { + $no_session_cookie = NO_SESSION_COOKIE; + } + + if ($no_session_cookie==true) { + $strCookiepagepattern = "@(modules\/|\/".ADMIN_DIRECTORY."\/)@"; + $nrCookiepage = preg_match( $strCookiepagepattern, $_SERVER['REQUEST_URI'] ); + } else { + $nrCookiepage = 1; + } + + if ($nrCookiepage == 1 && !self::IsStarted()) { + //if (!self::IsStarted()) { // Session parameter session_name(APP_NAME . '-sid'); session_set_cookie_params(0); diff --git a/wbce/include/captcha/captcha.php b/wbce/include/captcha/captcha.php index cc1d22528..9b049a020 100644 --- a/wbce/include/captcha/captcha.php +++ b/wbce/include/captcha/captcha.php @@ -107,151 +107,163 @@ function captcha_header() if (!function_exists('call_captcha')) { function call_captcha($action = 'all', $style = '', $sec_id = '') { - global $MOD_CAPTCHA; - $t = time(); - $_SESSION['captcha_time'] = $t; + + $no_session_cookie=false; + if (defined('NO_SESSION_COOKIE')) { + $no_session_cookie = NO_SESSION_COOKIE; + } + if ($no_session_cookie==false) { + + global $MOD_CAPTCHA; + $t = time(); + $_SESSION['captcha_time'] = $t; - // get width and height of captcha image for use in - -  =  - - - - - - - -
- " > - " alt="Captcha" style="margin: auto;padding: 0;" /> - -
" : ''); - include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; - echo ($style ? '' : ''); - break; - case 'calc_image': // calculation with image (old captcha) - case 'calc_ttf_image': // calculation with varying background and ttf-font - case 'ttf_image': // captcha with varying background and ttf-font - case 'old_image': // old captcha - echo ""; - break; - } - } elseif ($action == 'image_iframe') { - switch (CAPTCHA_TYPE) { - case 'text': // text-captcha - echo ($style ? "" : ''); - include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; - echo ($style ? '' : ''); - break; - case 'calc_text': // calculation as text - include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; - break; - case 'calc_image': // calculation with image (old captcha) - case 'calc_ttf_image': // calculation with varying background and ttf-font - case 'ttf_image': // captcha with varying background and ttf-font - case 'old_image': // old captcha - ?> - "> - "; - ?>'; - break; - case 'calc_text': // calculation as text - case 'calc_image': // calculation with image (old captcha) - case 'calc_ttf_image': // calculation with varying background and ttf-font - echo ''; - break; - case 'ttf_image': // captcha with varying background and ttf-font - case 'old_image': // old captcha - echo ''; - break; - } - } elseif ($action == 'text') { - echo ($style ? "" : ''); - switch (CAPTCHA_TYPE) { - case 'text': // text-captcha - echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; - break; - case 'calc_text': // calculation as text - case 'calc_image': // calculation with image (old captcha) - case 'calc_ttf_image': // calculation with varying background and ttf-font - echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; - break; - case 'ttf_image': // captcha with varying background and ttf-font - case 'old_image': // old captcha - echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; - break; - } - echo ($style ? '' : ''); - } + if ($action == 'all') { + switch (CAPTCHA_TYPE) { + case 'text': // text-captcha + ?> + + + + +
+ +
+ + + + +
+ +  = 
+ + + + +
+ "> + " alt="Captcha" style="margin: auto;padding: 0;" /> + +  = 
+ + + + +
+ " > + " alt="Captcha" style="margin: auto;padding: 0;" /> + +
" : ''); + include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; + echo ($style ? '' : ''); + break; + case 'calc_image': // calculation with image (old captcha) + case 'calc_ttf_image': // calculation with varying background and ttf-font + case 'ttf_image': // captcha with varying background and ttf-font + case 'old_image': // old captcha + echo ""; + break; + } + } elseif ($action == 'image_iframe') { + switch (CAPTCHA_TYPE) { + case 'text': // text-captcha + echo ($style ? "" : ''); + include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; + echo ($style ? '' : ''); + break; + case 'calc_text': // calculation as text + include WB_PATH . '/include/captcha/captchas/' . CAPTCHA_TYPE . '.php'; + break; + case 'calc_image': // calculation with image (old captcha) + case 'calc_ttf_image': // calculation with varying background and ttf-font + case 'ttf_image': // captcha with varying background and ttf-font + case 'old_image': // old captcha + ?> + "> + "; + ?>'; + break; + case 'calc_text': // calculation as text + case 'calc_image': // calculation with image (old captcha) + case 'calc_ttf_image': // calculation with varying background and ttf-font + echo ''; + break; + case 'ttf_image': // captcha with varying background and ttf-font + case 'old_image': // old captcha + echo ''; + break; + } + } elseif ($action == 'text') { + echo ($style ? "" : ''); + switch (CAPTCHA_TYPE) { + case 'text': // text-captcha + echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; + break; + case 'calc_text': // calculation as text + case 'calc_image': // calculation with image (old captcha) + case 'calc_ttf_image': // calculation with varying background and ttf-font + echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; + break; + case 'ttf_image': // captcha with varying background and ttf-font + case 'old_image': // old captcha + echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; + break; + } + echo ($style ? '' : ''); + } + /*hier*/ + } else { + echo '
ERROR: No session data available. Unable to verify form data!
'; + } + } }