Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define overridable constants for session properties FS#1913 #578

Merged
merged 2 commits into from Mar 5, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions inc/init.php
Expand Up @@ -140,18 +140,23 @@ function_exists('ob_gzhandler') &&
}

// init session
if (!headers_sent() && !defined('NOSESSION')){
session_name("DokuWiki");
if(!headers_sent() && !defined('NOSESSION')) {
if(!defined('DOKU_SESSION_NAME')) define ('DOKU_SESSION_NAME', "DokuWiki");
if(!defined('DOKU_SESSION_LIFETIME')) define ('DOKU_SESSION_LIFETIME', 0);
$cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'];
if (version_compare(PHP_VERSION, '5.2.0', '>')) {
session_set_cookie_params(0,$cookieDir,'',($conf['securecookie'] && is_ssl()),true);
}else{
session_set_cookie_params(0,$cookieDir,'',($conf['securecookie'] && is_ssl()));
if(!defined('DOKU_SESSION_PATH')) define ('DOKU_SESSION_PATH', $cookieDir);
if(!defined('DOKU_SESSION_DOMAIN')) define ('DOKU_SESSION_DOMAIN', '');

session_name(DOKU_SESSION_NAME);
if(version_compare(PHP_VERSION, '5.2.0', '>')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this version check? min. dokuwiki requirement is 5.2

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP api writes:
5.2.0 The httponly parameter was added.

(i guess the check had must be >= instead of >, hasn't?)

So I think that removing this check is ok.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this can be removed

session_set_cookie_params(DOKU_SESSION_LIFETIME, DOKU_SESSION_PATH, DOKU_SESSION_DOMAIN, ($conf['securecookie'] && is_ssl()), true);
} else {
session_set_cookie_params(DOKU_SESSION_LIFETIME, DOKU_SESSION_PATH, DOKU_SESSION_DOMAIN, ($conf['securecookie'] && is_ssl()));
}
session_start();

// load left over messages
if(isset($_SESSION[DOKU_COOKIE]['msg'])){
if(isset($_SESSION[DOKU_COOKIE]['msg'])) {
$MSG = $_SESSION[DOKU_COOKIE]['msg'];
unset($_SESSION[DOKU_COOKIE]['msg']);
}
Expand Down