Index: branches/unlabeled/unlabeled-1.66.2/core/kernel/processors/main_processor.php =================================================================== diff -u -r7400 -r7696 --- branches/unlabeled/unlabeled-1.66.2/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 7400) +++ branches/unlabeled/unlabeled-1.66.2/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 7696) @@ -951,6 +951,7 @@ function CaptchaImage($params){ $captcha_helper =& $this->Application->recallObject('CaptchaHelper'); + /* @var $captcha_helper kCaptchaHelper */ $captcha_helper->GenerateCaptchaImage( $this->Application->RecallVar($this->Application->GetVar('var')), $this->Application->GetVar('w'), Index: branches/unlabeled/unlabeled-1.5.2/core/install/install_data.sql =================================================================== diff -u -r7656 -r7696 --- branches/unlabeled/unlabeled-1.5.2/core/install/install_data.sql (.../install_data.sql) (revision 7656) +++ branches/unlabeled/unlabeled-1.5.2/core/install/install_data.sql (.../install_data.sql) (revision 7696) @@ -46,6 +46,7 @@ INSERT INTO ConfigurationAdmin VALUES ('Min_UserName', 'la_Text_General', 'la_text_min_username', 'text', '', '', 10.03, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Min_Password', 'la_Text_General', 'la_text_min_password', 'text', '', '', 10.04, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('Email_As_Login', 'la_Text_General', 'la_use_emails_as_login', 'checkbox', NULL, NULL, 10.02, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('RegistrationCaptcha', 'la_Text_General', 'la_registration_captcha', 'checkbox', NULL, NULL, 10.025, 0, 0); INSERT INTO ConfigurationAdmin VALUES ('User_LoggedInGroup', 'la_Text_General', 'la_users_assign_all_to', 'select', NULL, '0=lu_none,SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.09, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('FirstDayOfWeek', 'la_Text_Date_Time_Settings', 'la_config_first_day_of_week', 'select', '', '0=la_sunday,1=la_monday', 20.03, 0, 1); INSERT INTO ConfigurationAdmin VALUES ('SSL_URL', 'la_Text_Website', 'la_config_ssl_url', 'text', '', '', 10.09, 0, 1); @@ -179,6 +180,7 @@ INSERT INTO ConfigurationValues VALUES (NULL, 'Search_MinKeyword_Length', '3', 'In-Portal', ''); INSERT INTO ConfigurationValues VALUES (NULL, 'Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO ConfigurationValues VALUES (NULL, 'Email_As_Login', '0', 'In-Portal:Users', 'in-portal:configure_users'); +INSERT INTO ConfigurationValues VALUES (NULL, 'RegistrationCaptcha', '0', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO ConfigurationValues VALUES (NULL, 'User_LoggedInGroup', '15', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO ConfigurationValues VALUES (NULL, 'User_MembershipExpirationReminder', '10', 'In-Portal:Users', 'in-portal:configure_users'); INSERT INTO ConfigurationValues VALUES (NULL, 'FirstDayOfWeek', '1', 'In-Portal', 'in-portal:configure_general'); Index: branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.0.1.sql =================================================================== diff -u --- branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.0.1.sql (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/admin/install/upgrades/inportal_upgrade_v4.0.1.sql (revision 7696) @@ -0,0 +1,4 @@ +INSERT INTO ConfigurationValues VALUES (NULL, 'RegistrationCaptcha', '0', 'In-Portal:Users', 'in-portal:configure_users'); +INSERT INTO ConfigurationAdmin VALUES ('RegistrationCaptcha', 'la_Text_General', 'la_registration_captcha', 'checkbox', NULL, NULL, 10.025, 0, 0); + +ALTER TABLE EmailMessage ADD `Subject` TINYTEXT NULL ; \ No newline at end of file Index: branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php =================================================================== diff -u -r7663 -r7696 --- branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php (.../frontaction.php) (revision 7663) +++ branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php (.../frontaction.php) (revision 7696) @@ -463,6 +463,9 @@ $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); $ip = $_SERVER['REMOTE_ADDR']; + $application =& kApplication::Instance(); + $application->SetVar('user_password', $password); + SetVar('user_password', $password); $fields_hash = Array('Login' => $_POST['username'], 'Password' => md5($password), 'FirstName' => $_POST['firstname'], @@ -522,9 +525,9 @@ } else { - $doLoginNow = true; - $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.ADD"); + $doLoginNow = true; + $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.ADD"); } } else Index: branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php =================================================================== diff -u -r7662 -r7696 --- branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7662) +++ branches/unlabeled/unlabeled-1.71.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7696) @@ -497,6 +497,7 @@ $cs_helper->CheckStateField($event, 'State', 'Country'); $object =& $event->getObject( Array('skip_autoload' => true) ); + /* @var $object kDBItem */ if ($this->Application->ConfigValue('User_Password_Auto')) { $pass = makepassword4(rand(5,8)); $object->SetField('Password', $pass); @@ -505,7 +506,6 @@ } parent::OnCreate($event); - $this->Application->SetVar('u.current_id', $object->getID() ); // for affil:OnRegisterAffiliate after hook $this->setNextTemplate($event); @@ -1121,6 +1121,55 @@ } } } + + /** + * Apply some special processing to + * object beeing recalled before using + * it in other events that call prepareObject + * + * @param Object $object + * @param kEvent $event + * @access protected + */ + function prepareObject(&$object, &$event) + { + parent::prepareObject($object, $event); + + if (!$this->Application->IsAdmin()) { + if ($this->Application->RecallVar('register_captcha_code')) return ; + $captcha_helper =& $this->Application->recallObject('CaptchaHelper'); + /* @var $captcha_helper kCaptchaHelper */ + $this->Application->StoreVar('register_captcha_code', $captcha_helper->GenerateCaptchaCode()); + } + } + + /** + * Apply custom processing to item + * + * @param kEvent $event + */ + function customProcessing(&$event, $type) + { + if ($event->Name == 'OnCreate' && $type == 'before') { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + // if auto password has not been set already - store real one - to be used in email events + if (!$this->Application->GetVar('user_password')) { + $this->Application->SetVar('user_password', $object->GetDirtyField('Password')); + $object->SetDBField('Password_plain', $object->GetDirtyField('Password')); + } + + // Validate captcha image if it's requried + if ($this->Application->ConfigValue('RegistrationCaptcha') && $object->GetDBField('Captcha') != $this->Application->RecallVar('register_captcha_code')) { + $object->SetError('Captcha', 'captcha_error', 'lu_captcha_error'); + $captcha_helper =& $this->Application->recallObject('CaptchaHelper'); + /* @var $captcha_helper kCaptchaHelper */ + $this->Application->StoreVar('register_captcha_code', $captcha_helper->GenerateCaptchaCode()); + } + + } + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.29.2/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -r7647 -r7696 --- branches/unlabeled/unlabeled-1.29.2/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 7647) +++ branches/unlabeled/unlabeled-1.29.2/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 7696) @@ -82,9 +82,9 @@ $items_info = $this->Application->GetVar('u'); if ($items_info) { $user_id = array_shift( array_keys($items_info) ); - + $selected_ids = $this->getSelectedIDs($event, true); - + $ids = $this->Application->RecallVar($event->getPrefixSpecial().'_selected_ids'); $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($event->Prefix, 'TableName'); @@ -199,6 +199,7 @@ $direct_send_params['message_text'] = $message_body_additional; $this->Application->Parser->Params = array_merge_recursive2($this->Application->Parser->Params, $direct_send_params); $message_template = str_replace('Application->Parser->Parse($message_template, 'email_template', 0); Index: branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php =================================================================== diff -u -r7651 -r7696 --- branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php (.../users_config.php) (revision 7651) +++ branches/unlabeled/unlabeled-1.34.2/core/units/users/users_config.php (.../users_config.php) (revision 7696) @@ -76,7 +76,7 @@ 'users_edit' => Array('prefixes' => Array('u'), 'format' => "#u_status# '#u_titlefield#' - !la_title_General!"), 'users_custom' => Array('prefixes' => Array('u'), 'format' => "#u_status# '#u_titlefield#' - !la_title_Custom!"), - + 'users_select' => Array('prefixes' => Array('u_List'), 'format' => "!la_title_Users! (#u_recordcount#) - !la_title_SelectUser!"), 'user_groups_list' => Array('prefixes' => Array('u', 'u-ug_List'), 'format' => "#u_status# '#u_titlefield#' - !la_title_Groups! (#u-ug_recordcount#)"), @@ -176,6 +176,7 @@ 'ValidateLogin' => Array('type'=>'string','default'=>''), 'SubscribeEmail' => Array('type'=>'string','default'=>''), 'PrimaryGroup' => Array('type' => 'string', 'default' => ''), + 'Captcha' => Array('type' => 'string', 'default' => ''), 'RootPassword' => Array('type' => 'string', 'formatter' => 'kPasswordFormatter', 'encryption_method' => 'md5', 'verify_field' => 'VerifyRootPassword', 'skip_empty' => 1, 'default' => md5('') ), ),