mirror of
https://github.com/processwire/processwire.git
synced 2025-08-08 15:57:01 +02:00
Various minor updates
This commit is contained in:
37
install.php
37
install.php
@@ -786,11 +786,22 @@ class Installer {
|
||||
*/
|
||||
protected function dbSaveConfigFile(array $values) {
|
||||
|
||||
if(self::TEST_MODE) return true;
|
||||
if(self::TEST_MODE) return true;
|
||||
|
||||
$file = __FILE__;
|
||||
$time = time();
|
||||
$host = empty($values['httpHosts']) ? '' : implode(',', $values['httpHosts']);
|
||||
|
||||
$salt = md5(mt_rand() . microtime(true));
|
||||
|
||||
$cfg = "\n/**" .
|
||||
if(function_exists('random_bytes')) {
|
||||
$authSalt = sha1(random_bytes(random_int(40, 128)));
|
||||
$tableSalt = sha1(random_int(0, 65535) . "$host$file$time");
|
||||
} else {
|
||||
$authSalt = md5(mt_rand() . microtime(true));
|
||||
$tableSalt = md5(mt_rand() . "$host$file$time");
|
||||
}
|
||||
|
||||
$cfg =
|
||||
"\n/**" .
|
||||
"\n * Installer: Database Configuration" .
|
||||
"\n * " .
|
||||
"\n */" .
|
||||
@@ -807,11 +818,23 @@ class Installer {
|
||||
"\n" .
|
||||
"\n/**" .
|
||||
"\n * Installer: User Authentication Salt " .
|
||||
"\n * " .
|
||||
"\n * Must be retained if you migrate your site from one server to another" .
|
||||
"\n * " .
|
||||
"\n * This value was randomly generated for your system on " . date('Y/m/d') . "." .
|
||||
"\n * This should be kept as private as a password and never stored in the database." .
|
||||
"\n * Must be retained if you migrate your site from one server to another." .
|
||||
"\n * Do not change this value, or user passwords will no longer work." .
|
||||
"\n * " .
|
||||
"\n */" .
|
||||
"\n\$config->userAuthSalt = '$salt'; " .
|
||||
"\n\$config->userAuthSalt = '$authSalt'; " .
|
||||
"\n" .
|
||||
"\n * Installer: Table Salt (General Purpose) " .
|
||||
"\n * " .
|
||||
"\n * Use this rather than userAuthSalt when a hashing salt is needed for non user " .
|
||||
"\n * authentication purposes. Like with userAuthSalt, you should never change " .
|
||||
"\n * this value or it may break internal system comparisons that use it. " .
|
||||
"\n * " .
|
||||
"\n */" .
|
||||
"\n\$config->tableSalt = '$tableSalt'; " .
|
||||
"\n" .
|
||||
"\n/**" .
|
||||
"\n * Installer: File Permission Configuration" .
|
||||
|
@@ -1753,7 +1753,8 @@ class Page extends WireData implements \Countable, WireMatchable {
|
||||
/**
|
||||
* Same as getMarkup() except returned value is plain text
|
||||
*
|
||||
* Returned value is entity encoded, unless $entities argument is false.
|
||||
* If no `$entities` argument is provided, returned value is entity encoded when output formatting
|
||||
* is on, and not entity encoded when output formatting is off.
|
||||
*
|
||||
* #pw-advanced
|
||||
*
|
||||
@@ -1769,12 +1770,12 @@ class Page extends WireData implements \Countable, WireMatchable {
|
||||
$length = strlen($value);
|
||||
if(!$length) return '';
|
||||
$options = array(
|
||||
'entities' => (is_null($entities) ? $this->outputFormatting() : (bool) $entities)
|
||||
'entities' => ($entities === null ? $this->outputFormatting() : (bool) $entities)
|
||||
);
|
||||
if($oneLine) {
|
||||
$value = $this->wire('sanitizer')->markupToLine($value, $options);
|
||||
$value = $this->wire()->sanitizer->markupToLine($value, $options);
|
||||
} else {
|
||||
$value = $this->wire('sanitizer')->markupToText($value, $options);
|
||||
$value = $this->wire()->sanitizer->markupToText($value, $options);
|
||||
}
|
||||
// if stripping tags from non-empty value made it empty, just indicate that it was markup and length
|
||||
if(!strlen(trim($value))) $value = "markup($length)";
|
||||
|
@@ -1566,7 +1566,7 @@ class Sanitizer extends Wire {
|
||||
}
|
||||
|
||||
// remove entities
|
||||
$value = $this->wire('sanitizer')->unentities($value);
|
||||
$value = $this->unentities($value);
|
||||
|
||||
if(strpos($value, '<') !== false) {
|
||||
// tag replacements before strip_tags()
|
||||
|
@@ -389,8 +389,8 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
||||
|
||||
$wrap = $this->wire('modules')->get('InputfieldFieldset');
|
||||
$wrap->addClass('InputfieldRepeaterItem InputfieldNoFocus');
|
||||
$wrap->entityEncodeLabel = false;
|
||||
if(!$isPost) {
|
||||
$wrap->entityEncodeLabel = false;
|
||||
$wrap->label =
|
||||
"<span class='InputfieldRepeaterItemLabel'>" .
|
||||
$this->entityEncode($this->renderRepeaterLabel($label, ++$cnt, $page)) .
|
||||
|
@@ -314,7 +314,9 @@ class LanguageSupport extends WireData implements Module, ConfigurableModule {
|
||||
|
||||
/** @var Inputfield $inputfield */
|
||||
$inputfield = $event->object;
|
||||
$user = $this->wire('user');
|
||||
if(!$inputfield->useLanguages) return;
|
||||
|
||||
$user = $this->wire()->user;
|
||||
$userLanguage = $user->language;
|
||||
if(!$userLanguage) return;
|
||||
|
||||
@@ -619,6 +621,9 @@ class LanguageSupport extends WireData implements Module, ConfigurableModule {
|
||||
}
|
||||
$inputfield->set('value' . $language->id, $languageValue);
|
||||
}
|
||||
|
||||
// following this hookInputfieldBeforeRender() completes the process after
|
||||
// Fieldgroup::getPageInputfields() which sets the value attribute of Inputfields
|
||||
}
|
||||
|
||||
$event->return = $inputfield;
|
||||
|
Reference in New Issue
Block a user