mirror of
https://github.com/processwire/processwire.git
synced 2025-08-06 06:48:10 +02:00
Some minor adjustments and bump version to 3.0.61
This commit is contained in:
@@ -268,6 +268,15 @@ $config->sessionChallenge = true;
|
||||
* 12: Fingerprint the forwarded/client IP and useragent
|
||||
* 14: Fingerprint the remote IP, forwarded/client IP and useragent (all).
|
||||
*
|
||||
* If using fingerprint in an environment where the user’s
|
||||
* IP address may change during the session, you should
|
||||
* fingerprint only the useragent, or disable fingerprinting.
|
||||
*
|
||||
* If using fingerprint with an AWS load balancer, you should
|
||||
* use one of the options that uses the “client IP” rather than
|
||||
* the “remote IP”, fingerprint only the useragent, or disable
|
||||
* fingerprinting.
|
||||
*
|
||||
* @var int
|
||||
*
|
||||
*/
|
||||
|
@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
|
||||
* Reversion revision number
|
||||
*
|
||||
*/
|
||||
const versionRevision = 60;
|
||||
const versionRevision = 61;
|
||||
|
||||
/**
|
||||
* Version suffix string (when applicable)
|
||||
|
@@ -343,27 +343,67 @@ class Session extends Wire implements \IteratorAggregate {
|
||||
|
||||
/**
|
||||
* Generate a session fingerprint
|
||||
*
|
||||
* If the `$mode` argument is omitted, the mode is pulled from `$config->sessionFingerprint`. If using the
|
||||
* mode argument, specify one of the following:
|
||||
*
|
||||
* - 0 or false: Fingerprint nothing.
|
||||
* - 1 or true: Fingerprint on with default/recommended setting (currently 10).
|
||||
* - 2: Fingerprint only the remote IP.
|
||||
* - 4: Fingerprint only the forwarded/client IP (can be spoofed).
|
||||
* - 8: Fingerprint only the useragent.
|
||||
* - 10: Fingerprint the remote IP and useragent (default).
|
||||
* - 12: Fingerprint the forwarded/client IP and useragent.
|
||||
* - 14: Fingerprint the remote IP, forwarded/client IP and useragent (all).
|
||||
*
|
||||
* If using fingerprint in an environment where the user’s IP address may change during the session, you should
|
||||
* fingerprint only the useragent, or disable fingerprinting.
|
||||
*
|
||||
* If using fingerprint with an AWS load balancer, you should use one of the options that uses the “client IP”
|
||||
* rather than the “remote IP”, fingerprint only the useragent, or disable fingerprinting.
|
||||
*
|
||||
* #pw-internal
|
||||
*
|
||||
* @param int|bool|null $mode Optionally specify fingerprint mode (default=$config->sessionFingerprint)
|
||||
* @param bool $debug Return non-hashed fingerprint for debugging purposes? (default=false)
|
||||
* @return bool|string Returns false if fingerprints not enabled. Returns string if enabled.
|
||||
*
|
||||
*/
|
||||
protected function getFingerprint() {
|
||||
public function getFingerprint($mode = null, $debug = false) {
|
||||
|
||||
$debugInfo = array();
|
||||
$useFingerprint = $mode === null ? $this->config->sessionFingerprint : $mode;
|
||||
|
||||
$useFingerprint = $this->config->sessionFingerprint;
|
||||
if(!$useFingerprint) return false;
|
||||
|
||||
if(is_bool($useFingerprint) || $useFingerprint == 1) {
|
||||
// default (boolean true)
|
||||
$useFingerprint = self::fingerprintRemoteAddr | self::fingerprintUseragent;
|
||||
if($debug) $debugInfo[] = 'default';
|
||||
}
|
||||
|
||||
$fingerprint = '';
|
||||
if($useFingerprint & self::fingerprintRemoteAddr) $fingerprint .= $this->getIP(true);
|
||||
if($useFingerprint & self::fingerprintClientAddr) $fingerprint .= $this->getIP(false, 2);
|
||||
|
||||
if($useFingerprint & self::fingerprintRemoteAddr) {
|
||||
$fingerprint .= $this->getIP(true);
|
||||
if($debug) $debugInfo[] = 'remote-addr';
|
||||
}
|
||||
|
||||
if($useFingerprint & self::fingerprintClientAddr) {
|
||||
$fingerprint .= $this->getIP(false, 2);
|
||||
if($debug) $debugInfo[] = 'client-addr';
|
||||
}
|
||||
|
||||
if($useFingerprint & self::fingerprintUseragent) {
|
||||
$fingerprint .= isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
|
||||
if($debug) $debugInfo[] = 'useragent';
|
||||
}
|
||||
|
||||
if($debug) {
|
||||
$fingerprint = implode(',', $debugInfo) . ': ' . $fingerprint;
|
||||
} else {
|
||||
$fingerprint = md5($fingerprint);
|
||||
}
|
||||
$fingerprint = md5($fingerprint);
|
||||
|
||||
return $fingerprint;
|
||||
}
|
||||
|
@@ -1447,15 +1447,17 @@ class ProcessPageEdit extends Process implements WirePageEditor, ConfigurableMod
|
||||
*
|
||||
*/
|
||||
protected function ___processSaveRedirect($redirectUrl) {
|
||||
$admin = true;
|
||||
if($redirectUrl) {
|
||||
$redirectUrl .= (strpos($redirectUrl, '?') === false ? '?' : '&') . 's=1';
|
||||
$admin = strpos($redirectUrl, $this->wire('config')->urls->admin) === 0;
|
||||
if($admin) $redirectUrl .= (strpos($redirectUrl, '?') === false ? '?' : '&') . 's=1';
|
||||
} else {
|
||||
$redirectUrl = "./?id={$this->page->id}&s=1";
|
||||
}
|
||||
$redirectUrl .= "&c=" . count($this->changes);
|
||||
$modal = $this->wire('config')->modal;
|
||||
if($admin) $redirectUrl .= "&c=" . count($this->changes);
|
||||
$modal = $admin && $this->wire('config')->modal;
|
||||
if($modal) $redirectUrl .= "&modal=$modal";
|
||||
if(count($this->fields)) {
|
||||
if(count($this->fields) && $admin) {
|
||||
if(count($this->fields) == 1) {
|
||||
$redirectUrl .= "&field={$this->field->name}";
|
||||
} else {
|
||||
|
2326
wire/templates-admin/styles/font-awesome/scss/font-awesome.css
vendored
Normal file
2326
wire/templates-admin/styles/font-awesome/scss/font-awesome.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user