Attached Files |
random_string_configuration_1435.patch [^] (5,245 bytes) 2012-12-06 05:28
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 15648)
+++ install.php (working copy)
@@ -668,6 +668,8 @@
// for now we set "In-Portal" module version to "Core" module version (during clean install)
$this->toolkit->SetModuleVersion('In-Portal', 'core/');
+
+ $this->toolkit->generateRandomString();
}
break;
Index: install/english.lang
===================================================================
--- install/english.lang (revision 15648)
+++ install/english.lang (working copy)
@@ -193,6 +193,7 @@
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
<PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1" Hint="U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
+ <PHRASE Label="la_config_RandomString" Module="Core" Type="1">UmFuZG9tIFN0cmluZw==</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
<PHRASE Label="la_config_RegistrationUsernameRequired" Module="Core" Type="1">VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==</PHRASE>
<PHRASE Label="la_config_RememberLastAdminTemplate" Module="Core" Type="1">UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15648)
+++ install/install_data.sql (working copy)
@@ -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');
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 15648)
+++ install/install_toolkit.php (working copy)
@@ -1184,4 +1184,26 @@
return $compression_engines;
}
+
+ /**
+ * Generates Random String configuration value
+ *
+ * @return void
+ */
+ public function generateRandomString()
+ {
+ $table_name = $this->getSystemConfig('Database', 'TablePrefix') . 'SystemSettings';
+ $sql = 'SELECT VariableValue
+ FROM ' . $table_name . '
+ WHERE VariableName = "RandomString"';
+ $random_string = $this->Conn->GetOne($sql);
+ $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $random_string );
+ $rnd_value .= sha1($rnd_value);
+ $rnd_value .= sha1($rnd_value . $random_string);
+ $random_string = md5($random_string . $rnd_value);
+ $sql = 'UPDATE ' . $table_name . '
+ SET VariableValue = ' . $this->Conn->qstr($random_string) . '
+ WHERE VariableName = "RandomString"';
+ $this->Conn->Query($sql);
+ }
}
\ No newline at end of file
Index: install/upgrades.php
===================================================================
--- install/upgrades.php (revision 15648)
+++ install/upgrades.php (working copy)
@@ -2303,6 +2303,10 @@
*/
public function Upgrade_5_3_0_B1($mode)
{
+ if ($mode == 'after') {
+ $this->_toolkit->generateRandomString();
+ }
+
if ( $mode != 'before' ) {
return;
}
random_string_configuration_1435_v2.patch [^] (4,614 bytes) 2012-12-07 07:10
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 15648)
+++ install.php (working copy)
@@ -1052,6 +1052,8 @@
);
$this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SystemSettings');
}
+
+ $this->toolkit->generateRandomString();
break;
}
Index: install/english.lang
===================================================================
--- install/english.lang (revision 15648)
+++ install/english.lang (working copy)
@@ -193,6 +193,7 @@
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
<PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1" Hint="U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
+ <PHRASE Label="la_config_RandomString" Module="Core" Type="1">UmFuZG9tIFN0cmluZw==</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
<PHRASE Label="la_config_RegistrationUsernameRequired" Module="Core" Type="1">VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==</PHRASE>
<PHRASE Label="la_config_RememberLastAdminTemplate" Module="Core" Type="1">UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15648)
+++ install/install_data.sql (working copy)
@@ -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');
Index: install/install_toolkit.php
===================================================================
--- install/install_toolkit.php (revision 15648)
+++ install/install_toolkit.php (working copy)
@@ -1184,4 +1184,26 @@
return $compression_engines;
}
+
+ /**
+ * Generates Random String configuration value
+ *
+ * @return void
+ */
+ public function generateRandomString()
+ {
+ $random_string = $this->Application->ConfigValue('RandomString');
+
+ if ( $random_string ) {
+
+ return;
+ }
+
+ $random_string = $this->Application->ConfigValue('RootPass');
+ $rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $random_string );
+ $rnd_value .= sha1($rnd_value);
+ $rnd_value .= sha1($rnd_value . $random_string);
+ $random_string = md5($random_string . $rnd_value);
+ $this->Application->SetConfigValue('RandomString', $random_string);
+ }
}
\ No newline at end of file
random_string_configuration_1435_v3.patch [^] (7,042 bytes) 2012-12-11 05:53
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 15648)
+++ install.php (working copy)
@@ -1052,6 +1052,17 @@
);
$this->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: install/english.lang
===================================================================
--- install/english.lang (revision 15648)
+++ install/english.lang (working copy)
@@ -193,6 +193,7 @@
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
<PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1" Hint="U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
+ <PHRASE Label="la_config_RandomString" Module="Core" Type="1">UmFuZG9tIFN0cmluZw==</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
<PHRASE Label="la_config_RegistrationUsernameRequired" Module="Core" Type="1">VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==</PHRASE>
<PHRASE Label="la_config_RememberLastAdminTemplate" Module="Core" Type="1">UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 15648)
+++ install/install_data.sql (working copy)
@@ -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');
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 15648)
+++ install/upgrades.sql (working copy)
@@ -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);
Index: units/helpers/user_helper.php
===================================================================
--- units/helpers/user_helper.php (revision 15648)
+++ units/helpers/user_helper.php (working copy)
@@ -631,4 +631,74 @@
return $object->Update() ? '' : 'restore_impossible';
}
+
+ /**
+ * 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 public
+ */
+ public function generateRandomNumber($min = 0, $max = 0)
+ {
+ global $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));
+ }
+
+ /**
+ * Generates rendom 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;
+ }
}
random_string_configuration_1435_v4.patch [^] (8,170 bytes) 2012-12-12 03:38
[Show Content]
Index: core/install/upgrades.sql
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/upgrades.sql (revision 15640)
+++ core/install/upgrades.sql (revision )
@@ -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);
Index: core/install.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install.php (revision 15601)
+++ core/install.php (revision )
@@ -1052,6 +1052,17 @@
);
$this->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: core/install/install_data.sql
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/install_data.sql (revision 15640)
+++ core/install/install_data.sql (revision )
@@ -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: core/install/english.lang
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/install/english.lang (revision 15640)
+++ core/install/english.lang (revision )
@@ -193,6 +193,7 @@
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
<PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1" Hint="U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
+ <PHRASE Label="la_config_RandomString" Module="Core" Type="1">UmFuZG9tIFN0cmluZw==</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
<PHRASE Label="la_config_RegistrationUsernameRequired" Module="Core" Type="1">VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==</PHRASE>
<PHRASE Label="la_config_RememberLastAdminTemplate" Module="Core" Type="1">UmVzdG9yZSBsYXN0IHZpc2l0ZWQgQWRtaW4gU2VjdGlvbiBhZnRlciBMb2dpbg==</PHRASE>
@@ -2210,4 +2211,4 @@
<COUNTRY Iso="ZWE" Translation="WmltYmFid2U="/>
</COUNTRIES>
</LANGUAGE>
-</LANGUAGES>
\ No newline at end of file
+</LANGUAGES>
Index: core/units/helpers/user_helper.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- core/units/helpers/user_helper.php (revision 15601)
+++ core/units/helpers/user_helper.php (revision )
@@ -631,4 +631,74 @@
return $object->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
|