Index: core/admin_templates/login.tpl
===================================================================
--- core/admin_templates/login.tpl (revision 14596)
+++ core/admin_templates/login.tpl (working copy)
@@ -153,6 +153,21 @@
+
+
+
+
+
+
+
+
+
401 Authentication Required
Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 14630)
+++ core/install/english.lang (working copy)
@@ -1506,6 +1506,8 @@
QXV0by1EZXRlY3Q=
Q29va2llcw==
UXVlcnkgU3RyaW5nIChTSUQp
+ UmVzZXQgInJvb3QiIHBhc3N3b3Jk
+ WW91ciAicm9vdCIgcGFzc3dvcmQgaGFzIGJlZW4gcmVzZXQuIFBsZWFzZSByZW1vdmUgREJHX1JFU0VUX1JPT1QgY29uc3RhbnQgYW5kIGNoZWNrIHlvdXIgZS1tYWlsIGFkZHJlc3Mu
U3ViamVjdDogTmV3IENhdGVnb3J5ICI8aW5wMjpjX0ZpZWxkIG5hbWU9Ik5hbWUiLz4iIC0gQWRkZWQKCllvdXIgc3VnZ2VzdGVkIGNhdGVnb3J5ICI8aW5wMjpjX0ZpZWxkIG5hbWU9Ik5hbWUiLz4iIGhhcyBiZWVuIGFkZGVkLg==
@@ -1543,6 +1545,7 @@
U3ViamVjdDogVXNlciBVbnN1YnNyaWJlZCBmcm9tIE1haWxpbmcgTGlzdAoKQSB1c2VyICI8aW5wMjp1X0ZpZWxkIG5hbWU9IkVtYWlsIi8+IiBoYXMgdW5zdWJzY3JpYmVkIGZyb20gdGhlIG1haWxpbmcgbGlzdCBvbiA8YSBocmVmPSI8aW5wMjptX0Jhc2VVcmwvPiI+PGlucDI6bV9CYXNlVXJsLz48L2E+Lg==
U3ViamVjdDogVXNlciBSZWdpc3RyYXRpb24gaXMgVmFsaWRhdGVkCgpXZWxjb21lIHRvIEluLXBvcnRhbCE8YnIvPjxici8+DQoNCllvdXIgdXNlciByZWdpc3RyYXRpb24gaGFzIGJlZW4gYXBwcm92ZWQuIFlvdSBjYW4gbG9naW4gbm93IDxhIGhyZWY9IjxpbnAyOm1fQmFzZVVybC8+Ij48aW5wMjptX0Jhc2VVcmwvPjwvYT4gdXNpbmcgdGhlIGZvbGxvd2luZyBpbmZvcm1hdGlvbjo8YnIvPjxici8+DQoNCj09PT09PT09PT09PT09PT09PTxici8+DQpVc2VybmFtZTogIjxpbnAyOnVfRmllbGQgbmFtZT0iTG9naW4iLz4iPGJyLz4NClBhc3N3b3JkOiAiPGlucDI6dV9GaWVsZCBuYW1lPSJQYXNzd29yZF9wbGFpbiIvPiI8YnIvPg0KPT09PT09PT09PT09PT09PT09PGJyLz48YnIvPg0K
U3ViamVjdDogTmV3IFVzZXIgUmVnaXN0cmF0aW9uIGlzIFZhbGlkYXRlZAoKVXNlciAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIgaGFzIGJlZW4gdmFsaWRhdGVkLg==
+ U3ViamVjdDogUm9vdCBSZXNldCBQYXNzd29yZAoKWW91ciBuZXcgcGFzc3dvcmQgaXM6IDxpbnAyOm1fUGFyYW0gbmFtZT0icGFzc3dvcmQiLz4=
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql (revision 14606)
+++ core/install/install_data.sql (working copy)
@@ -171,6 +171,7 @@
INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER.BOUNCED', NULL, 1, 0, 'Core', 'Form Submission Admin Reply Delivery Failure', 1, 1, 1);
INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.NEW.PASSWORD', NULL, 1, 0, 'Core', 'Sends new password to an existing user', 0, 1, 0);
INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.BYADMIN', NULL, 1, 0, 'Core', 'Sends password to a new user', 0, 1, 0);
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0);
INSERT INTO IdGenerator VALUES ('100');
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 14630)
+++ core/install/upgrades.sql (working copy)
@@ -2136,4 +2136,5 @@
CHANGE ip IPAddress VARCHAR(15) NOT NULL,
ADD IPRestrictions TEXT NULL;
-ALTER TABLE PortalGroup ADD IPRestrictions TEXT NULL;
\ No newline at end of file
+ALTER TABLE PortalGroup ADD IPRestrictions TEXT NULL;
+INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0);
\ No newline at end of file
Index: core/units/users/users_event_handler.php
===================================================================
--- core/units/users/users_event_handler.php (revision 14630)
+++ core/units/users/users_event_handler.php (working copy)
@@ -129,6 +129,10 @@
return true;
}
+ if ( $event->Name == 'OnResetRootPassword' ) {
+ return defined('DBG_RESET_ROOT') && DBG_RESET_ROOT;
+ }
+
if ( !$this->Application->isAdminUser ) {
$user_id = $this->Application->RecallVar('user_id');
$items_info = $this->Application->GetVar($event->getPrefixSpecial(true));
@@ -238,8 +242,10 @@
* Checks user data and logs it in if allowed
*
* @param kEvent $event
+ * @return void
+ * @access protected
*/
- function OnLogin(&$event)
+ protected function OnLogin(&$event)
{
$object =& $event->getObject( Array ('form_name' => 'login') );
/* @var $object kDBItem */
@@ -311,7 +317,14 @@
$sync_manager->performAction('LogoutUser');
}
- function OnLogout(&$event)
+ /**
+ * Performs user logout
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnLogout(&$event)
{
$user_helper =& $this->Application->recallObject('UserHelper');
/* @var $user_helper UserHelper */
@@ -387,8 +400,10 @@
* Returns subscribed user ID by given e-mail address
*
* @param string $email
+ * @return int|bool
+ * @access protected
*/
- function getSubscriberByEmail($email)
+ protected function getSubscriberByEmail($email)
{
$verify_user =& $this->Application->recallObject('u.verify', null, Array ('skip_autoload' => true));
/* @var $verify_user UsersItem */
@@ -406,6 +421,8 @@
function autoLoginUser(&$event)
{
$object =& $event->getObject();
+ /* @var $object UsersItem */
+
$this->Application->SetVar('u.current_id', $object->GetID());
if ( $object->GetDBField('Status') == STATUS_ACTIVE ) {
@@ -810,7 +827,13 @@
}
}
- function OnUpdate(&$event)
+ /**
+ * Updates kDBItem
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ protected function OnUpdate(&$event)
{
parent::OnUpdate($event);
@@ -946,8 +969,8 @@
if ($records) {
$conditions = Array();
foreach ($records as $record) {
- $email_event_user =& $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRATION.NOTICE', $record['PortalUserId']);
- $email_event_admin =& $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRATION.NOTICE');
+ $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRATION.NOTICE', $record['PortalUserId']);
+ $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRATION.NOTICE');
$conditions[] = '(PortalUserId = '.$record['PortalUserId'].' AND GroupId = '.$record['GroupId'].')';
}
$sql = 'UPDATE '.TABLE_PREFIX.'UserGroup
@@ -964,8 +987,8 @@
$user_ids = $this->Conn->GetCol($sql);
if ($user_ids) {
foreach ($user_ids as $id) {
- $email_event_user =& $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRED', $id);
- $email_event_admin =& $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRED');
+ $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRED', $id);
+ $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRED');
}
}
$sql = 'DELETE FROM '.TABLE_PREFIX.'UserGroup
@@ -1013,9 +1036,10 @@
}
/**
- * Overwritten to return user from order by special .ord
+ * Return user from order by special .ord
*
* @param kEvent $event
+ * @return int
*/
function getPassedID(&$event)
{
@@ -1148,9 +1172,16 @@
$event->SetRedirectParam('opener', 'u');
}
- function OnMassResetSettings(&$event)
+ /**
+ * Resets grid settings, remembered in each user record
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnMassResetSettings(&$event)
{
- if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+ if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) {
$event->status = kEvent::erFAIL;
return;
}
@@ -1158,11 +1189,12 @@
$ids = $this->StoreSelectedIDs($event);
$default_user_id = $this->Application->ConfigValue('DefaultSettingsUserId');
- if (in_array($default_user_id, $ids)) {
+ if ( in_array($default_user_id, $ids) ) {
array_splice($ids, array_search($default_user_id, $ids), 1);
}
- if ($ids) {
- $q = 'DELETE FROM '.TABLE_PREFIX.'PersistantSessionData WHERE PortalUserId IN ('.join(',', $ids).') AND
+
+ if ( $ids ) {
+ $q = 'DELETE FROM ' . TABLE_PREFIX . 'PersistantSessionData WHERE PortalUserId IN (' . join(',', $ids) . ') AND
(VariableName LIKE "%_columns_%"
OR
VariableName LIKE "%_filter%"
@@ -1170,6 +1202,7 @@
VariableName LIKE "%_PerPage%")';
$this->Conn->Query($q);
}
+
$this->clearSelectedIDs($event);
}
@@ -1706,4 +1739,26 @@
}
}
}
+
+ /**
+ * Generates new Root password and email it
+ *
+ * @param kEvent $event
+ * @return void
+ * @access protected
+ */
+ protected function OnResetRootPassword(&$event)
+ {
+ $password_formatter =& $this->Application->recallObject('kPasswordFormatter');
+ /* @var $password_formatter kPasswordFormatter */
+
+ $new_root_password = kUtil::generatePassword();
+ $new_root_password_encrypted = $password_formatter->EncryptPassword($new_root_password, 'b38');
+
+ $this->Application->SetConfigValue('RootPass', $new_root_password_encrypted);
+ $this->Application->EmailEventAdmin('ROOT.RESET.PASSWORD', null, Array ('password' => $new_root_password));
+
+ $event->SetRedirectParam('reset', 1);
+ $event->SetRedirectParam('pass', 'm');
+ }
}
Index: tools/debug_sample.php
===================================================================
--- tools/debug_sample.php (revision 14590)
+++ tools/debug_sample.php (working copy)
@@ -15,9 +15,10 @@
// define('SILENT_LOG', 1); // Log all php errors on site to separate file (/silent_log.txt)
// define('DBG_REQUREST_LOG', '/path/to/file');// Log all user requests to site into filename specified
// define('DBG_ZEND_PRESENT', 0); // Set to 0 to debug debugger (because debugger automatically got disabled during zend debug sessions)
-// define('SA_IP', '193.68.72.64/26;99.14.230.174'); // Define IP addreses, from which super admin are allowed to login
-// define('DBG_CAPTURE_STATISTICS', 1); // Capture performance satistics
+// define('SA_IP', '193.68.72.64/26;99.14.230.174'); // Define IP addresses, from which super admin are allowed to login
+// define('DBG_CAPTURE_STATISTICS', 1); // Capture performance statistics
// define('DBG_MAX_SQL_TIME', 2); // Maximal allowed sql execution time in seconds, all sqls above this become slow sqls
+// define('DBG_RESET_ROOT', 1); // Shows "root" user password reset link on Admin Console login screen
$dbg_options = Array (
// !!! DEBUG MODE will be off if IP does not match !!!