Index: branches/5.3.x/core/install/english.lang
===================================================================
diff -u -r15640 -r15649
--- branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15640)
+++ branches/5.3.x/core/install/english.lang (.../english.lang) (revision 15649)
@@ -193,6 +193,7 @@
UGF0aCB0byBXZWJzaXRl
UGVyZm9ybSBFeGFjdCBTZWFyY2g=
Q29tbWVudHMgcGVyIHBhZ2U=
+ UmFuZG9tIFN0cmluZw==
IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=
VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==
UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==
@@ -2210,4 +2211,4 @@
-
\ No newline at end of file
+
Index: branches/5.3.x/core/install/install_data.sql
===================================================================
diff -u -r15640 -r15649
--- branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15640)
+++ branches/5.3.x/core/install/install_data.sql (.../install_data.sql) (revision 15649)
@@ -97,6 +97,7 @@
INSERT INTO SystemSettings VALUES(DEFAULT, 'Backup_Path', '/home/alex/web/in-portal.rc/system/backupdata', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_backup_path', 'text', '', '', 60.06, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemTagCache', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_syscache_enable', 'checkbox', NULL, NULL, 60.07, 0, 0, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SocketBlockingMode', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_prompt_socket_blocking_mode', 'checkbox', NULL, NULL, 60.08, 0, 0, NULL);
+INSERT INTO SystemSettings VALUES(DEFAULT, 'RandomString', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_RandomString', 'text', '', '', 60.09, 0, 1, NULL);
INSERT INTO SystemSettings VALUES(DEFAULT, 'EnableEmailLog', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EnableEmailLog', 'radio', NULL, '1=la_Yes||0=la_No', 65.01, 0, 1, 'hint:la_config_EnableEmailLog');
INSERT INTO SystemSettings VALUES(DEFAULT, 'EmailLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_EmailLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_EmailLogKeepForever', 65.02, 0, 0, 'hint:la_config_EmailLogRotationInterval');
INSERT INTO SystemSettings VALUES(DEFAULT, 'SystemLogRotationInterval', '2419200', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SystemLogRotationInterval', 'select', NULL, '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2419200=la_opt_OneMonth||7257600=la_opt_ThreeMonths||29030400=la_opt_OneYear||-1=la_opt_SystemLogKeepForever', 65.03, 0, 1, 'hint:la_config_SystemLogRotationInterval');
@@ -1028,4 +1029,4 @@
INSERT INTO PromoBlockGroups VALUES (DEFAULT, 'Default Group', UNIX_TIMESTAMP(), '1', '7.00', '0.60', '1', 'fade', '');
INSERT INTO Modules VALUES ('Core', 'core/', 'adm', DEFAULT, 1, 1, '', 0, NULL, NULL);
-INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', DEFAULT, 1, 0, '', 0, NULL, NULL);
\ No newline at end of file
+INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', DEFAULT, 1, 0, '', 0, NULL, NULL);
Index: branches/5.3.x/core/units/helpers/user_helper.php
===================================================================
diff -u -r15483 -r15649
--- branches/5.3.x/core/units/helpers/user_helper.php (.../user_helper.php) (revision 15483)
+++ branches/5.3.x/core/units/helpers/user_helper.php (.../user_helper.php) (revision 15649)
@@ -1,6 +1,6 @@
Update() ? '' : 'restore_impossible';
}
- }
+
+ /**
+ * Generates random string
+ *
+ * @param int $length
+ * @param bool $special_chars
+ * @param bool $extra_special_chars
+ * @return string
+ * @access public
+ */
+ public function generateRandomString($length = 12, $special_chars = true, $extra_special_chars = false)
+ {
+ $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+
+ if ( $special_chars ) {
+ $chars .= '!@#$%^&*()';
+ }
+
+ if ( $extra_special_chars ) {
+ $chars .= '-_ []{}<>~`+=,.;:/?|';
+ }
+
+ $password = '';
+
+ for ($i = 0; $i < $length; $i++) {
+ $password .= substr($chars, $this->_generateRandomNumber(0, strlen($chars) - 1), 1);
+ }
+
+ return $password;
+ }
+
+ /**
+ * Generates a random number
+ *
+ * @param int $min Lower limit for the generated number (optional, default is 0)
+ * @param int $max Upper limit for the generated number (optional, default is 4294967295)
+ * @return int A random number between min and max
+ * @access protected
+ */
+ protected function _generateRandomNumber($min = 0, $max = 0)
+ {
+ static $rnd_value = '';
+
+ // Reset $rnd_value after 14 uses
+ // 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
+ if ( strlen($rnd_value) < 8 ) {
+ $random_seed = $this->Application->getDBCache('random_seed');
+ $rnd_value = md5(uniqid(microtime() . mt_rand(), true) . $random_seed);
+ $rnd_value .= sha1($rnd_value);
+ $rnd_value .= sha1($rnd_value . $random_seed);
+ $random_seed = md5($random_seed . $rnd_value);
+ $this->Application->setDBCache('random_seed', $random_seed);
+ }
+
+ // Take the first 8 digits for our value
+ $value = substr($rnd_value, 0, 8);
+
+ // Strip the first eight, leaving the remainder for the next call to wp_rand().
+ $rnd_value = substr($rnd_value, 8);
+
+ $value = abs(hexdec($value));
+
+ // Reduce the value to be within the min - max range
+ // 4294967295 = 0xffffffff = max random number
+ if ( $max != 0 ) {
+ $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
+ }
+
+ return abs(intval($value));
+ }
+ }
\ No newline at end of file
Index: branches/5.3.x/core/install.php
===================================================================
diff -u -r15578 -r15649
--- branches/5.3.x/core/install.php (.../install.php) (revision 15578)
+++ branches/5.3.x/core/install.php (.../install.php) (revision 15649)
@@ -1,6 +1,6 @@
Conn->doInsert($fields_hash, TABLE_PREFIX.'SystemSettings');
}
+
+ $random_string = $this->Application->ConfigValue('RandomString');
+
+ if ( !$random_string ) {
+ $user_helper = $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
+
+ $random_string = $user_helper->generateRandomString(64, true, true);
+ $this->Application->SetConfigValue('RandomString', $random_string);
+ }
+
break;
}
Index: branches/5.3.x/core/install/upgrades.sql
===================================================================
diff -u -r15640 -r15649
--- branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15640)
+++ branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15649)
@@ -2883,3 +2883,5 @@
UPDATE SystemSettings
SET DisplayOrder = ROUND(DisplayOrder - 0.01, 2)
WHERE (DisplayOrder BETWEEN 60.04 AND 60.10) AND (ModuleOwner = 'In-Portal') AND (Section = 'in-portal:configure_advanced');
+
+INSERT INTO SystemSettings VALUES(DEFAULT, 'RandomString', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSystem', 'la_config_RandomString', 'text', '', '', 60.09, 0, 1, NULL);