diff --git a/index.php b/index.php
index 776c268..3fcd10b 100644
--- a/index.php
+++ b/index.php
@@ -12,8 +12,8 @@
'import'=>array(
'application.models.*',
'application.components.*',
- 'application.modules.user.components.*',
- 'application.modules.user.models.*',
+ 'user.user.components.*',
+ 'user.user.models.*',
),
'modules'=>array(
'user' => array(
@@ -32,7 +32,7 @@
'components'=>array(
'cache' => array('class' => 'system.caching.CFileCache'),
'user'=>array(
- 'class' => 'application.modules.user.components.YumWebUser',
+ 'class' => 'user.user.components.YumWebUser',
'allowAutoLogin'=>true,
),
'urlManager'=>array(
diff --git a/modules/avatar/AvatarModule.php b/modules/avatar/AvatarModule.php
index 6c1f176..316d8a6 100644
--- a/modules/avatar/AvatarModule.php
+++ b/modules/avatar/AvatarModule.php
@@ -10,8 +10,8 @@ class AvatarModule extends CWebModule {
public $enableGravatarDefault = true;
// override this with your custom layout, if available
- public $adminLayout = 'application.modules.user.views.layouts.yum';
- public $layout = 'application.modules.user.views.layouts.yum';
+ public $adminLayout = 'user.user.views.layouts.yum';
+ public $layout = 'user.user.views.layouts.yum';
public $avatarPath = 'images';
@@ -28,10 +28,10 @@ class AvatarModule extends CWebModule {
public function init() {
$this->setImport(array(
- 'application.modules.user.controllers.*',
- 'application.modules.user.models.*',
- 'application.modules.avatar.controllers.*',
- 'application.modules.avatar.models.*',
+ 'user.user.controllers.*',
+ 'user.user.models.*',
+ 'user.avatar.controllers.*',
+ 'user.avatar.models.*',
));
}
}
diff --git a/modules/avatar/controllers/YumAvatarController.php b/modules/avatar/controllers/YumAvatarController.php
index 72e0ab4..347b55b 100644
--- a/modules/avatar/controllers/YumAvatarController.php
+++ b/modules/avatar/controllers/YumAvatarController.php
@@ -2,7 +2,7 @@
// This controller handles the administration, upload and the deletion
// of an Avatar image for the user profile.
-Yii::import('application.modules.user.controllers.YumController');
+Yii::import('user.user.controllers.YumController');
class YumAvatarController extends YumController {
public function beforeAction($action) {
diff --git a/modules/friendship/controllers/YumFriendshipController.php b/modules/friendship/controllers/YumFriendshipController.php
index b377629..05ee369 100644
--- a/modules/friendship/controllers/YumFriendshipController.php
+++ b/modules/friendship/controllers/YumFriendshipController.php
@@ -1,8 +1,8 @@
inviter->privacy)
&& $this->inviter->privacy->message_new_friendship) {
- Yii::import('application.modules.message.models.YumMessage');
+ Yii::import('user.message.models.YumMessage');
YumMessage::write($this->inviter, $this->invited,
Yum::t('Your friendship request has been accepted'),
strtr(
@@ -158,7 +158,7 @@ public function beforeSave() {
if(Yum::hasModule('message')
&& $user->privacy
&& $user->privacy->message_new_friendship) {
- Yii::import('application.modules.message.models.YumMessage');
+ Yii::import('user.message.models.YumMessage');
YumMessage::write($user, $this->inviter,
Yum::t('New friendship request from {username}', array(
'{username}' => $this->inviter->username)),
diff --git a/modules/friendship/views/friendship/friends.php b/modules/friendship/views/friendship/friends.php
index 377ef77..a602111 100644
--- a/modules/friendship/views/friendship/friends.php
+++ b/modules/friendship/views/friendship/friends.php
@@ -31,6 +31,6 @@
echo '';
Yii::import(
- 'application.modules.friendship.controllers.YumFriendshipController');
+ 'user.friendship.controllers.YumFriendshipController');
echo YumFriendshipController::invitationLink(Yii::app()->user->id, $model->id);
?>
diff --git a/modules/membership/MembershipModule.php b/modules/membership/MembershipModule.php
index 61cfd0e..5695bce 100644
--- a/modules/membership/MembershipModule.php
+++ b/modules/membership/MembershipModule.php
@@ -13,7 +13,7 @@ class MembershipModule extends CWebModule {
public $paymentTable = '{{payment}}';
// override this with your custom layout, if available
- public $layout = 'application.modules.user.views.layouts.yum';
+ public $layout = 'user.user.views.layouts.yum';
public $controllerMap=array(
diff --git a/modules/membership/controllers/YumMembershipController.php b/modules/membership/controllers/YumMembershipController.php
index b1d2e7a..aeae18d 100644
--- a/modules/membership/controllers/YumMembershipController.php
+++ b/modules/membership/controllers/YumMembershipController.php
@@ -1,8 +1,8 @@
user, 1,
Yum::t('Payment arrived'),
strtr(
diff --git a/modules/message/MessageModule.php b/modules/message/MessageModule.php
index f39326f..a01b54e 100644
--- a/modules/message/MessageModule.php
+++ b/modules/message/MessageModule.php
@@ -13,11 +13,11 @@ class MessageModule extends CWebModule
public $messageTable = '{{message}}';
- public $layout = 'application.modules.user.views.layouts.yum';
+ public $layout = 'user.user.views.layouts.yum';
public $dateFormat = 'Y-m-d G:i:s';
- public $inboxView = 'application.modules.message.views.message.index';
+ public $inboxView = 'user.message.views.message.index';
public $inboxRoute = array('index');
// Send a message to the user if the email changing has been succeeded
diff --git a/modules/message/components/MessageWidget.php b/modules/message/components/MessageWidget.php
index 7feb5bd..f83b626 100644
--- a/modules/message/components/MessageWidget.php
+++ b/modules/message/components/MessageWidget.php
@@ -1,5 +1,5 @@
0) {
if(Yum::module('message')->messageSystem == YumMessage::MSG_PLAIN)
$this->renderPartial(
- 'application.modules.message.views.message.new_messages_plain', array(
+ 'user.message.views.message.new_messages_plain', array(
'message' => $message));
else if(Yum::module('message')->messageSystem == YumMessage::MSG_DIALOG)
$this->renderPartial(
- 'application.modules.message.views.message.new_messages_dialog', array(
+ 'user.message.views.message.new_messages_dialog', array(
'message' => $message));
}
?>
diff --git a/modules/profile/components/ProfileCommentsWidget.php b/modules/profile/components/ProfileCommentsWidget.php
index a8c25fa..9d64d4d 100644
--- a/modules/profile/components/ProfileCommentsWidget.php
+++ b/modules/profile/components/ProfileCommentsWidget.php
@@ -1,5 +1,5 @@
privacy
&& $user->privacy->message_new_profilecomment) {
- Yii::import('application.modules.messages.models.YumMessage');
+ Yii::import('user.messages.models.YumMessage');
YumMessage::write($user, $this->user_id,
Yum::t('New profile comment from {username}', array(
'{username}' => $this->user->username)),
diff --git a/modules/profile/views/layouts/yumprofile.php b/modules/profile/views/layouts/yumprofile.php
index 5ec48c7..e48fdab 100644
--- a/modules/profile/views/layouts/yumprofile.php
+++ b/modules/profile/views/layouts/yumprofile.php
@@ -10,11 +10,11 @@
widget('MessageWidget');
}
if(Yum::hasModule('profile') && Yum::module('profile')->enableProfileVisitLogging) {
- Yii::import('application.modules.profile.components.*');
+ Yii::import('user.profile.components.*');
$this->widget('ProfileVisitWidget');
}
$this->renderMenu(); ?>
diff --git a/modules/profile/views/profile/view.php b/modules/profile/views/profile/view.php
index 38b71b1..aeffad6 100644
--- a/modules/profile/views/profile/view.php
+++ b/modules/profile/views/profile/view.php
@@ -17,7 +17,7 @@
renderPartial(
- 'application.modules.friendship.views.friendship.friends', array(
+ 'user.friendship.views.friendship.friends', array(
'model' => $model)); ?>
array(
- 'class'=>'registration.controllers.YumRegistrationController'),
- );
-
+ // why enableRegistration ? - in case you only want a recovery !
+ public $layout = 'user.views.layouts.yum';
+ public $enableRegistration = true;
+ public $enableRecovery = true;
+
+ public $recoveryUrl = array('//registration/registration/recovery');
+ public $activationUrl = array('//registration/registration/activation');
+ public $registrationUrl = array('//registration/registration/registration');
+
+ public $activationSuccessView = '/registration/activation_success';
+ public $activationFailureView = '/registration/activation_failure';
+
+ // Whether to confirm the activation of an user by email
+ public $enableActivationConfirmation = true;
+
+ public $registrationEmail='register@website.com';
+ public $recoveryEmail='restore@website.com';
+
+ // Which roles should be assigned automatically to a fresh registered user?
+ // Use role id, for example array(1,4,5)
+ public $defaultRoles = array();
+ public $defaultHybridAuthRoles = array();
+
+ public $registrationView = '/registration/registration';
+ public $changePasswordView = 'user.views.user.changepassword';
+ public $recoverPasswordView = 'registration.views.registration.recovery';
+
+ /**
+ * Whether to use captcha in registration process
+ * @var boolean
+ */
+ public $enableCaptcha = true;
+
+ public $loginAfterSuccessfulRecovery = false;
+ public $loginAfterSuccessfulActivation = false;
+
+ public $controllerMap=array(
+ 'registration'=>array(
+ 'class'=>'registration.controllers.YumRegistrationController'),
+ );
+
}
diff --git a/modules/registration/controllers/YumRegistrationController.php b/modules/registration/controllers/YumRegistrationController.php
index 19beb2f..59a7dc7 100644
--- a/modules/registration/controllers/YumRegistrationController.php
+++ b/modules/registration/controllers/YumRegistrationController.php
@@ -74,7 +74,7 @@ public function actionRegistration() {
'//registration/registration/registration'))
throw new CHttpException(403);
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$form = new YumRegistrationForm;
$profile = new YumProfile;
diff --git a/modules/role/RoleModule.php b/modules/role/RoleModule.php
index cec987e..2519eb2 100644
--- a/modules/role/RoleModule.php
+++ b/modules/role/RoleModule.php
@@ -7,7 +7,7 @@ class RoleModule extends CWebModule {
// SrBAC
public $useYiiCheckAccess = false;
- public $layout = 'application.modules.user.views.layouts.yum';
+ public $layout = 'user.user.views.layouts.yum';
public $roleTable = '{{role}}';
public $permissionTable = '{{permission}}';
diff --git a/modules/role/controllers/YumActionController.php b/modules/role/controllers/YumActionController.php
index 0d2597a..3c7f64b 100644
--- a/modules/role/controllers/YumActionController.php
+++ b/modules/role/controllers/YumActionController.php
@@ -1,8 +1,8 @@
array(
'condition' => "membership_id = {$model->id}")));
diff --git a/modules/user/components/EPhotoValidator.php b/modules/user/components/EPhotoValidator.php
index cdb1322..9bdf0f5 100644
--- a/modules/user/components/EPhotoValidator.php
+++ b/modules/user/components/EPhotoValidator.php
@@ -1,5 +1,5 @@
adminIsGod && Yii::app()->user->isAdmin())
return true;
@@ -112,7 +112,7 @@ public static function hasUser($username, $uid = 0)
*/
public function hasRole($role, $uid = 0) {
if(Yum::hasModule('role')) {
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
if($uid == 0)
$uid = Yii::app()->user->id;
diff --git a/modules/user/controllers/YumAuthController.php b/modules/user/controllers/YumAuthController.php
index 4fee93a..1427c85 100644
--- a/modules/user/controllers/YumAuthController.php
+++ b/modules/user/controllers/YumAuthController.php
@@ -75,7 +75,7 @@ public function loginByEmail() {
throw new CException(Yum::t(
'The profile submodule must be enabled to allow login by Email'));
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$profile = YumProfile::model()->find('email = :email', array(
':email' => $this->loginForm->username));
@@ -99,8 +99,8 @@ public function loginByHybridAuth($provider) {
if(!Yum::hasModule('profile'))
throw new CException(400, 'Hybrid auth needs the profile submodule to be enabled');
- Yii::import('application.modules.user.vendors.hybridauth.Hybrid.Auth', true);
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.user.vendors.hybridauth.Hybrid.Auth', true);
+ Yii::import('user.profile.models.*');
require_once(Yum::module()->hybridAuthConfigFile);
diff --git a/modules/user/controllers/YumCsvController.php b/modules/user/controllers/YumCsvController.php
index f39748e..47a4482 100644
--- a/modules/user/controllers/YumCsvController.php
+++ b/modules/user/controllers/YumCsvController.php
@@ -24,7 +24,7 @@ public function actionExport() {
$fields .= $field .',';
$fields = substr($fields, 0, -1);
- Yii::import('application.modules.user.components.CSVExport');
+ Yii::import('user.user.components.CSVExport');
$sql = sprintf('select %s from %s where %s',
$fields,
Yum::module('profile')->profileTable,
diff --git a/modules/user/controllers/YumUserController.php b/modules/user/controllers/YumUserController.php
index c46dc3c..68d769d 100644
--- a/modules/user/controllers/YumUserController.php
+++ b/modules/user/controllers/YumUserController.php
@@ -54,7 +54,7 @@ public function actionGenerateData() {
throw new CHttpException(500, Yum::t('Generation of Demo users only allowed in debug mode'));
if(Yum::hasModule('role'))
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
if(isset($_POST['user_amount'])) {
for($i = 0; $i < $_POST['user_amount']; $i++) {
@@ -193,7 +193,7 @@ public function actionCreate() {
if(isset($_POST['YumUserChangePassword'])) {
if($_POST['YumUserChangePassword']['password'] == '') {
- Yii::import('application.modules.user.components.EPasswordGenerator');
+ Yii::import('user.user.components.EPasswordGenerator');
$generatorOptions = Yum::module()->passwordGeneratorOptions;
$password = EPasswordGenerator::generate(
$generatorOptions['length'],
@@ -375,7 +375,7 @@ public function actionList() {
public function actionAdmin() {
if(Yum::hasModule('role'))
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$this->layout = Yum::module()->adminLayout;
@@ -385,7 +385,7 @@ public function actionAdmin() {
$model->attributes = $_GET['YumUser'];
if(Yum::hasModule('profile')) {
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$profile = new YumProfile;
if(isset($_GET['YumProfile'])) {
$profile->attributes = $_GET['YumProfile'];
diff --git a/modules/user/docs/logging.txt b/modules/user/docs/logging.txt
index c09c98c..fcfeb4c 100644
--- a/modules/user/docs/logging.txt
+++ b/modules/user/docs/logging.txt
@@ -25,7 +25,7 @@ specific user:
array(
'class'=>'CEmailLogRoute',
'levels'=>'error',
- 'categories' => 'application.modules.user.*',
+ 'categories' => 'user.user.*',
'emails' => 'emergency_admin@example.com'
),
@@ -36,7 +36,7 @@ If we want to log our Information to the database, we use the CDbLogRoute like t
'class'=>'CDbLogRoute',
'connectionID' => 'db',
'levels'=>'error, warning, info',
- 'categories' => 'application.modules.user.*',
+ 'categories' => 'user.user.*',
'logTableName' => 'user_activities'
),
diff --git a/modules/user/docs/registration.txt b/modules/user/docs/registration.txt
index c92a733..6c50fe9 100644
--- a/modules/user/docs/registration.txt
+++ b/modules/user/docs/registration.txt
@@ -38,7 +38,7 @@ Create a file RegistrationController.php in your project-specific
controllers/ directory containing some code like this:
Yii::import(
- 'application.modules.registration.controllers.YumRegistrationController');
+ 'user.registration.controllers.YumRegistrationController');
class RegistrationController extends YumRegistrationController {
}
@@ -98,7 +98,7 @@ echo $activeform->textArea($profile,'about');
override the actionRegistration() of your Controller like this:
public function actionRegistration() {
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$profile = new YumProfile;
if (isset($_POST['Profile'])) {
@@ -151,7 +151,7 @@ Now, we also need to override the sendRegistrationEmail method, because we want
create a file models/Profile.php that extends the YumProfile:
-Yii::import('application.modules.profile.models.YumProfile');
+Yii::import('user.profile.models.YumProfile');
class Profile extends YumProfile {
function rules() {
diff --git a/modules/user/models/Yum.php b/modules/user/models/Yum.php
index 474c005..cc12f53 100644
--- a/modules/user/models/Yum.php
+++ b/modules/user/models/Yum.php
@@ -106,7 +106,7 @@ public static function getFlash() {
* In addition to that, the message is being translated by Yum::t() */
public static function log($message,
$level = 'info',
- $category = 'application.modules.user.controllers.YumController') {
+ $category = 'user.user.controllers.YumController') {
if(Yum::module()->enableLogging)
return Yii::log(Yum::t($message), $level, $category);
}
diff --git a/modules/user/models/YumActiveRecord.php b/modules/user/models/YumActiveRecord.php
index d19b975..db7aee9 100644
--- a/modules/user/models/YumActiveRecord.php
+++ b/modules/user/models/YumActiveRecord.php
@@ -18,7 +18,7 @@ public function behaviors() {
$behaviors = array( 'CAdvancedArBehavior' );
if(Yum::module()->enableAuditTrail)
$behaviors = array_merge($behaviors, array(
- 'LoggableBehavior' => 'application.modules.auditTrail.behaviors.LoggableBehavior')
+ 'LoggableBehavior' => 'user.auditTrail.behaviors.LoggableBehavior')
);
return $behaviors;
diff --git a/modules/user/models/YumUser.php b/modules/user/models/YumUser.php
index d48b8af..bd71179 100644
--- a/modules/user/models/YumUser.php
+++ b/modules/user/models/YumUser.php
@@ -91,8 +91,8 @@ public function getActiveMemberships()
if (!Yum::hasModule('membership'))
return array();
- Yii::import('application.modules.role.models.*');
- Yii::import('application.modules.membership.models.*');
+ Yii::import('user.role.models.*');
+ Yii::import('user.membership.models.*');
$roles = array();
@@ -266,7 +266,7 @@ public function rules() {
}
public function assignRole($role_title) {
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
if($this->isNewRecord || !$this->id)
return false;
@@ -287,7 +287,7 @@ public function assignRole($role_title) {
}
public function hasRole($role_title) {
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
if (!Yum::hasModule('role'))
return false;
@@ -311,7 +311,7 @@ public function hasRole($role_title) {
public function getRoles()
{
if (Yum::hasModule('role')) {
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$roles = '';
foreach ($this->roles as $role)
$roles .= ' ' . $role->title;
@@ -330,7 +330,7 @@ public function getPermissions($subaction = null) {
if (!Yum::hasModule('role') || !$this->id)
return array();
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$roles = $this->roles;
if (Yum::hasModule('membership'))
@@ -382,7 +382,7 @@ public function relations() {
$relations = array();
if (Yum::hasModule('role')) {
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$relations['permissions'] = array(
self::HAS_MANY, 'YumPermission', 'principal_id');
@@ -395,7 +395,7 @@ public function relations() {
}
if (Yum::hasModule('message')) {
- Yii::import('application.modules.message.models.*');
+ Yii::import('user.message.models.*');
$relations['messages'] = array(
self::HAS_MANY, 'YumMessage', 'to_user_id',
'order' => 'timestamp DESC');
@@ -410,7 +410,7 @@ public function relations() {
}
if (Yum::hasModule('profile')) {
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$relations['visits'] = array(
self::HAS_MANY, 'YumProfileVisit', 'visited_id');
$relations['visited'] = array(
@@ -432,7 +432,7 @@ public function relations() {
}
if (Yum::hasModule('membership')) {
- Yii::import('application.modules.membership.models.*');
+ Yii::import('user.membership.models.*');
$relations['memberships'] = array(
self::HAS_MANY, 'YumMembership', 'user_id');
}
@@ -470,7 +470,7 @@ public function getFriends($everything = false)
$condition = 'inviter_id = :uid and status = 2';
$friends = array();
- Yii::import('application.modules.friendship.models.YumFriendship');
+ Yii::import('user.friendship.models.YumFriendship');
$friendships = YumFriendship::model()->findAll($condition, array(
':uid' => $this->id));
if ($friendships != NULL && !is_array($friendships))
@@ -500,7 +500,7 @@ public function getFriends($everything = false)
}
public function registerByHybridAuth($hybridAuthProfile) {
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
$profile = new YumProfile();
$profile->firstname = $hybridAuthProfile->firstName;
@@ -616,7 +616,7 @@ public function isPasswordExpired()
* -3 : Profile found, but no user - database inconsistency?
*/
public static function activate($email, $key) {
- Yii::import('application.modules.profile.models.*');
+ Yii::import('user.profile.models.*');
if ($profile = YumProfile::model()->find("email = :email", array(
':email' => $email))) {
@@ -631,7 +631,7 @@ public static function activate($email, $key) {
'{username}' => $user->username)));
if (Yum::hasModule('message')
&& Yum::module('registration')->enableActivationConfirmation) {
- Yii::import('application.modules.message.models.YumMessage');
+ Yii::import('user.message.models.YumMessage');
YumMessage::write($user, 1,
Yum::t('Your activation succeeded'),
strtr(
@@ -741,7 +741,7 @@ public static function itemAlias($type, $code = NULL)
*/
public static function getUsersByRole($roleTitle)
{
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$role = YumRole::model()->findByAttributes(array('title' => $roleTitle));
return $role ? $role->users : null;
}
@@ -765,7 +765,7 @@ public function getGravatarHash() {
public function syncRoles($roles = null) {
if(Yum::hasModule('role')){
- Yii::import('application.modules.role.models.*');
+ Yii::import('user.role.models.*');
$query = sprintf("delete from %s where user_id = %s",
Yum::module('role')->userRoleTable,
diff --git a/modules/user/tests/unit/RegistrationTest.php b/modules/user/tests/unit/RegistrationTest.php
index 248c350..8157a57 100644
--- a/modules/user/tests/unit/RegistrationTest.php
+++ b/modules/user/tests/unit/RegistrationTest.php
@@ -2,8 +2,8 @@
// This unit test tests, if the Registration and Activation process provided
// by Yum works
-Yii::import('application.modules.user.models.*');
-Yii::import('application.modules.user.controllers.*');
+Yii::import('user.user.models.*');
+Yii::import('user.user.controllers.*');
class RegistrationTest extends CDbTestCase
{
diff --git a/modules/user/views/user/_form.php b/modules/user/views/user/_form.php
index 13d63c9..9e3165d 100644
--- a/modules/user/views/user/_form.php
+++ b/modules/user/views/user/_form.php
@@ -48,7 +48,7 @@
'form'=>$passwordform)); ?>
diff --git a/modules/user/views/user/changepassword.php b/modules/user/views/user/changepassword.php
index b7f5860..bffa62e 100644
--- a/modules/user/views/user/changepassword.php
+++ b/modules/user/views/user/changepassword.php
@@ -20,7 +20,7 @@
} ?>
renderPartial(
- 'application.modules.user.views.user.passwordfields', array(
+ 'user.user.views.user.passwordfields', array(
'form'=>$form)); ?>