├── .gitignore
├── README.md
├── avatar
├── AvatarModule.php
├── controllers
│ └── YumAvatarController.php
└── views
│ └── avatar
│ ├── _view.php
│ ├── admin.php
│ └── edit_avatar.php
├── composer.json
├── friendship
├── FriendshipModule.php
├── controllers
│ └── YumFriendshipController.php
├── models
│ └── YumFriendship.php
└── views
│ └── friendship
│ ├── _form.php
│ ├── _view.php
│ ├── admin.php
│ ├── friendedit.php
│ ├── friends.php
│ ├── invitation.php
│ ├── myfriends.php
│ ├── new_friends.php
│ ├── update.php
│ └── view.php
├── membership
├── MembershipModule.php
├── controllers
│ ├── YumMembershipController.php
│ └── YumPaymentController.php
├── models
│ ├── YumMembership.php
│ └── YumPayment.php
└── views
│ ├── membership
│ ├── _form.php
│ ├── _miniform.php
│ ├── _view.php
│ ├── admin.php
│ ├── buttons.php
│ ├── index.php
│ ├── membership_expired.php
│ ├── order.php
│ ├── orders.php
│ ├── success.php
│ ├── update.php
│ └── view.php
│ └── payment
│ ├── _form.php
│ ├── _miniform.php
│ ├── _view.php
│ ├── admin.php
│ ├── buttons.php
│ ├── create.php
│ ├── index.php
│ ├── success.php
│ ├── update.php
│ └── view.php
├── message
├── MessageModule.php
├── components
│ ├── MessageWidget.php
│ └── views
│ │ └── messages.php
├── controllers
│ └── YumMessageController.php
├── models
│ └── YumMessage.php
└── views
│ └── message
│ ├── compose.php
│ ├── index.php
│ ├── message.php
│ ├── message_view_forbidden.php
│ ├── messages.php
│ ├── new_messages.php
│ ├── new_messages_dialog.php
│ ├── new_messages_plain.php
│ ├── reply.php
│ ├── sent.php
│ ├── success.php
│ ├── view.php
│ └── write_a_message.php
├── profile
├── ProfileModule.php
├── components
│ ├── ProfileCommentsWidget.php
│ ├── ProfileVisitWidget.php
│ └── views
│ │ ├── profile_comments.php
│ │ └── profile_visits.php
├── controllers
│ ├── YumPrivacysettingController.php
│ ├── YumProfileCommentController.php
│ └── YumProfileController.php
├── models
│ ├── YumPrivacySetting.php
│ ├── YumProfile.php
│ ├── YumProfileComment.php
│ └── YumProfileVisit.php
└── views
│ ├── layouts
│ └── yumprofile.php
│ ├── privacy
│ └── update.php
│ ├── profile
│ ├── _form.php
│ ├── _search.php
│ ├── admin.php
│ ├── myprofile.php
│ ├── profilenotallowed.php
│ ├── public_fields.php
│ ├── update.php
│ ├── view.php
│ └── visits.php
│ └── profileComment
│ ├── _miniform.php
│ ├── _search.php
│ ├── _view.php
│ ├── admin.php
│ ├── buttons.php
│ ├── create.php
│ ├── index.php
│ ├── success.php
│ └── update.php
├── registration
├── RegistrationModule.php
├── controllers
│ └── YumRegistrationController.php
├── models
│ ├── YumPasswordRecoveryForm.php
│ ├── YumRegistration.php
│ └── YumRegistrationForm.php
└── views
│ └── registration
│ ├── activation_failure.php
│ ├── activation_success.php
│ ├── recovery.php
│ └── registration.php
├── role
├── RoleModule.php
├── controllers
│ ├── YumActionController.php
│ ├── YumPermissionController.php
│ └── YumRoleController.php
├── models
│ ├── YumAction.php
│ ├── YumPermission.php
│ └── YumRole.php
└── views
│ ├── action
│ ├── _form.php
│ ├── _view.php
│ ├── admin.php
│ ├── create.php
│ ├── index.php
│ ├── update.php
│ └── view.php
│ ├── permission
│ ├── admin.php
│ ├── create.php
│ └── view.php
│ └── role
│ ├── _form.php
│ ├── admin.php
│ ├── create.php
│ ├── update.php
│ └── view.php
├── user
├── UserModule.php
├── assets
│ ├── css
│ │ ├── bootstrap.min.css
│ │ ├── statistics.css
│ │ └── yum.css
│ ├── images
│ │ ├── facebook.png
│ │ ├── google.png
│ │ ├── green_button.png
│ │ ├── linkedin.png
│ │ ├── live.png
│ │ ├── livejournal.png
│ │ ├── myspace.png
│ │ ├── no_avatar_available.jpg
│ │ ├── no_avatar_available_thumb.jpg
│ │ ├── openid.png
│ │ ├── tumblr.png
│ │ ├── twitter.png
│ │ ├── wordpress.png
│ │ └── yahoo.png
│ └── js
│ │ ├── bootstrap.min.js
│ │ ├── pStrength.jquery.js
│ │ ├── tooltip.min.js
│ │ └── tooltip_users.js
├── commands
│ └── ImportCommand.php
├── components
│ ├── CAdvYum.php
│ ├── CAdvancedArBehavior.php
│ ├── CSVExport.php
│ ├── CSerializeBehavior.php
│ ├── CsvGridView.php
│ ├── EPasswordGenerator.php
│ ├── EPhotoValidator.php
│ ├── LoginWidget.php
│ ├── Relation.php
│ ├── YumAdminMenu.php
│ ├── YumMailer.php
│ ├── YumMenu.php
│ ├── YumPasswordValidator.php
│ ├── YumUserIdentity.php
│ ├── YumUserMenu.php
│ ├── YumWebUser.php
│ ├── select2
│ │ ├── .gitignore
│ │ ├── ESelect2.php
│ │ ├── README.md
│ │ ├── assets
│ │ │ ├── LICENSE
│ │ │ ├── README.md
│ │ │ ├── component.json
│ │ │ ├── release.sh
│ │ │ ├── select2-spinner.gif
│ │ │ ├── select2.css
│ │ │ ├── select2.jquery.json
│ │ │ ├── select2.js
│ │ │ ├── select2.min.js
│ │ │ ├── select2.png
│ │ │ ├── select2_locale_it.js
│ │ │ ├── select2x2.png
│ │ │ └── spinner.gif
│ │ └── messages
│ │ │ ├── id
│ │ │ └── select2.php
│ │ │ └── pl
│ │ │ └── select2.php
│ └── views
│ │ └── quicklogin.php
├── controllers
│ ├── YumAuthController.php
│ ├── YumController.php
│ ├── YumCsvController.php
│ ├── YumDefaultController.php
│ ├── YumInstallController.php
│ ├── YumRestController.php
│ ├── YumStatisticsController.php
│ ├── YumTranslationController.php
│ └── YumUserController.php
├── docs
│ ├── RESTful_api.txt
│ ├── avatar.txt
│ ├── changelog.txt
│ ├── hybridauth.txt
│ ├── logging.txt
│ ├── membership.txt
│ ├── messages.txt
│ ├── messages_daily_digest.txt
│ ├── permission_system.txt
│ ├── registration.txt
│ ├── testing.txt
│ ├── upgrade.txt
│ └── yum_translation.sql
├── messages
│ └── de
│ │ ├── yum_action.php
│ │ ├── yum_registration.php
│ │ └── yum_yumTextSettings.php
├── models
│ ├── Yum.php
│ ├── YumActiveRecord.php
│ ├── YumEncrypt.php
│ ├── YumFormModel.php
│ ├── YumTranslation.php
│ ├── YumUser.php
│ ├── YumUserChangePassword.php
│ └── YumUserLogin.php
├── tests
│ └── unit
│ │ └── RegistrationTest.php
├── vendors
│ └── hybridauth
│ │ ├── Hybrid
│ │ ├── Auth.php
│ │ ├── Endpoint.php
│ │ ├── Error.php
│ │ ├── Logger.php
│ │ ├── Provider_Adapter.php
│ │ ├── Provider_Model.php
│ │ ├── Provider_Model_OAuth1.php
│ │ ├── Provider_Model_OAuth2.php
│ │ ├── Provider_Model_OpenID.php
│ │ ├── Providers
│ │ │ ├── AOL.php
│ │ │ ├── Disqus.php
│ │ │ ├── Facebook.php
│ │ │ ├── Foursquare.php
│ │ │ ├── GitHub.php
│ │ │ ├── Goodreads.php
│ │ │ ├── Google.php
│ │ │ ├── Identica.php
│ │ │ ├── Instagram.php
│ │ │ ├── LastFM.php
│ │ │ ├── LinkedIn.php
│ │ │ ├── Live.php
│ │ │ ├── Mailru.php
│ │ │ ├── Murmur.php
│ │ │ ├── MySpace.php
│ │ │ ├── Odnoklassniki.php
│ │ │ ├── OpenID.php
│ │ │ ├── Pixnet.php
│ │ │ ├── Plurk.php
│ │ │ ├── QQ.php
│ │ │ ├── Sina.php
│ │ │ ├── Skyrock.php
│ │ │ ├── Steam.php
│ │ │ ├── Tumblr.php
│ │ │ ├── TwitchTV.php
│ │ │ ├── Twitter.php
│ │ │ ├── Viadeo.php
│ │ │ ├── Vimeo.php
│ │ │ ├── Vkontakte.php
│ │ │ ├── Yahoo.php
│ │ │ ├── Yandex.php
│ │ │ └── px500.php
│ │ ├── Storage.php
│ │ ├── User.php
│ │ ├── User_Activity.php
│ │ ├── User_Contact.php
│ │ ├── User_Profile.php
│ │ ├── index.html
│ │ ├── resources
│ │ │ ├── config.php.tpl
│ │ │ ├── index.html
│ │ │ ├── openid_policy.html
│ │ │ ├── openid_realm.html
│ │ │ └── openid_xrds.xml
│ │ └── thirdparty
│ │ │ ├── Facebook
│ │ │ ├── base_facebook.php
│ │ │ ├── facebook.php
│ │ │ └── fb_ca_chain_bundle.crt
│ │ │ ├── LastFM
│ │ │ └── LastFM.php
│ │ │ ├── LinkedIn
│ │ │ └── LinkedIn.php
│ │ │ ├── OAuth
│ │ │ ├── OAuth.php
│ │ │ ├── OAuth1Client.php
│ │ │ └── OAuth2Client.php
│ │ │ ├── OpenID
│ │ │ └── LightOpenID.php
│ │ │ ├── Sina
│ │ │ ├── Sina.php
│ │ │ └── saetv2.ex.class.php
│ │ │ ├── Viadeo
│ │ │ └── ViadeoAPI.php
│ │ │ ├── Vimeo
│ │ │ └── Vimeo.php
│ │ │ └── index.html
│ │ ├── config.php
│ │ ├── index.php
│ │ └── install.php
└── views
│ ├── csv
│ ├── import.php
│ └── select.php
│ ├── install
│ ├── start.php
│ └── success.php
│ ├── layouts
│ ├── login.php
│ └── yum.php
│ ├── statistics
│ └── statistics.php
│ ├── translation
│ ├── _form.php
│ ├── admin.php
│ ├── create.php
│ └── update.php
│ └── user
│ ├── _activation_passwordform.php
│ ├── _form.php
│ ├── _miniform.php
│ ├── _resend_activation_partial.php
│ ├── _tooltip.php
│ ├── _view.php
│ ├── admin.php
│ ├── browse.php
│ ├── changepassword.php
│ ├── confirmDeletion.php
│ ├── create.php
│ ├── foreignprofile.php
│ ├── generate_data.php
│ ├── index.php
│ ├── list.php
│ ├── login.php
│ ├── login_debug.php
│ ├── message.php
│ ├── password_expired.php
│ ├── passwordfields.php
│ ├── resend_activation.php
│ ├── restricted_admin.php
│ ├── update.php
│ └── view.php
└── usergroup
├── UsergroupModule.php
├── controllers
└── YumUsergroupController.php
├── models
├── YumGroupParticipation.php
├── YumUsergroup.php
└── YumUsergroupMessage.php
└── views
└── groups
├── _form.php
├── _message.php
├── _message_form.php
├── _miniform.php
├── _participant.php
├── _search.php
├── _tooltip.php
├── _view.php
├── admin.php
├── browse.php
├── create.php
├── index.php
├── success.php
├── update.php
└── view.php
/.gitignore:
--------------------------------------------------------------------------------
1 | ./assets/
2 | ./runtime/
3 | *.swp
4 | *~
5 | ./nbproject
6 | .DS_Store
7 | .idea
8 |
--------------------------------------------------------------------------------
/avatar/AvatarModule.php:
--------------------------------------------------------------------------------
1 | array('class'=>'AvatarModule.controllers.YumAvatarController'),
27 | );
28 |
29 | public function init() {
30 | $this->setImport(array(
31 | 'user.controllers.*',
32 | 'user.models.*',
33 | 'user.avatar.controllers.*',
34 | 'user.avatar.models.*',
35 | ));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/avatar/views/avatar/_view.php:
--------------------------------------------------------------------------------
1 |
2 | getAvatar(true), array(
3 | '//avatar/avatar/editAvatar', 'id' => $data->id)); ?>
4 |
username, array(
5 | '//avatar/avatar/editAvatar', 'id' => $data->id)); ?>
6 |
7 |
--------------------------------------------------------------------------------
/avatar/views/avatar/admin.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Avatar administration');
2 |
3 | $this->breadcrumbs = array(
4 | Yum::t('Users') => array('admin'),
5 | Yum::t('Avatars'));
6 |
7 | $this->widget('zii.widgets.CListView', array(
8 | 'dataProvider'=>$model->search(),
9 | 'sortableAttributes' => array('username', 'createtime', 'status', 'lastvisit', 'avatar'),
10 | 'itemView' => '_view',
11 | )); ?>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/avatar/views/avatar/edit_avatar.php:
--------------------------------------------------------------------------------
1 |
47 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "thyseus/yii-user-management",
3 | "description": "A user management module collection for the yii framework",
4 | "type": "library",
5 | "keywords": ["user","role", "profile", "friendship"],
6 | "homepage": "http://github.com/thyseus/yii-user-management",
7 | "license": "GPL",
8 | "authors": [
9 | {
10 | "name": "Herbert Maschke",
11 | "email": "thyseus@gmail.com",
12 | "homepage": "http://www.litecode.de",
13 | "role": "Developer"
14 | }
15 | ],
16 | "require": {
17 | "php": ">=5.3.0",
18 | "yiisoft/yii": ">=1.1.14"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/friendship/FriendshipModule.php:
--------------------------------------------------------------------------------
1 | array(
9 | 'class'=>'FriendshipModule.controllers.YumFriendshipController'),
10 | );
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/friendship/views/friendship/_form.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | beginWidget('CActiveForm', array(
4 | 'id'=>'groups-form',
5 | 'enableAjaxValidation'=>false,
6 | )); ?>
7 |
8 |
9 |
10 | errorSummary($model); ?>
11 |
12 |
13 | label($model,'inviter_id'); ?>
14 | textField($model->inviter,'username',array(
15 | 'size'=>20,'maxlength'=>25,'readonly'=>'readonly')); ?>
16 | error($model,'inviter_id'); ?>
17 |
18 |
19 |
20 | label($model,'status'); ?>
21 | 'No friendship requested','1'=>'Confirmation pending','2'=>'Friendship confirmed','3'=>'Friendship rejected'));
24 | ?>
25 | error($model,'status'); ?>
26 |
27 |
28 |
29 |
30 |
31 | label($model,'friend_id'); ?>
32 | textField($model->invited,'username',array(
33 | 'size'=>20,'maxlength'=>25,'readonly'=>'readonly')); ?>
34 | error($model,'friend_id'); ?>
35 |
36 |
37 |
38 | label($model,'message'); ?>
39 | textArea($model,'message'); ?>
40 | error($model,'message'); ?>
41 |
42 |
43 |
44 |
45 |
46 | isNewRecord ? Yii::t('App', 'Create') : Yii::t('App', 'Save')); ?>
47 |
48 |
49 | endWidget(); ?>
50 |
51 |
52 |
--------------------------------------------------------------------------------
/friendship/views/friendship/_view.php:
--------------------------------------------------------------------------------
1 | %s', $data->invited->username);
3 | ?>
4 |
--------------------------------------------------------------------------------
/friendship/views/friendship/admin.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Friendship administration');
3 | $this->breadcrumbs = array('Friends', 'Admin');
4 |
5 | printf('%s
', Yum::t('All friendships in the system'));
6 |
7 | $this->widget('zii.widgets.grid.CGridView', array(
8 | 'dataProvider'=>$friendships,
9 | 'enableSorting' => true,
10 | 'enablePagination' => true,
11 | 'filter' => new YumFriendship(),
12 | 'columns' => array(
13 | array(
14 | 'header' => Yum::t('User'),
15 | 'name' => 'inviter_id',
16 | 'value' => '$data->inviter->username'),
17 | array(
18 | 'header' => Yum::t('is friend of'),
19 | 'name' => 'friend_id',
20 | 'value' => '$data->invited->username'),
21 | array(
22 | 'header' => Yum::t('Requesttime'),
23 | 'name' => 'requesttime',
24 | 'value' => 'date(Yum::module()->dateTimeFormat, $data->requesttime)'),
25 | array(
26 | 'header' => Yum::t('Acknowledgetime'),
27 | 'name' => 'acknowledgetime',
28 | 'value' => 'date(Yum::module()->dateTimeFormat, $data->acknowledgetime)'),
29 | array(
30 | 'header' => Yum::t('Last update'),
31 | 'name' => 'updatetime',
32 | 'value' => 'date(Yum::module()->dateTimeFormat, $data->updatetime)'),
33 | array(
34 | 'header' => Yum::t('Status'),
35 | 'name' => 'status',
36 | 'value' => '$data->getStatus()'),
37 |
38 |
39 | )));
40 |
41 | ?>
42 |
43 |
--------------------------------------------------------------------------------
/friendship/views/friendship/friends.php:
--------------------------------------------------------------------------------
1 | profile)
3 | return false;
4 |
5 | echo '';
6 | if(isset($model->friends)) {
7 | echo '
' . Yum::t('Friends of {username}', array(
8 | '{username}' => $model->username)) . '
';
9 | foreach($model->friends as $friend) {
10 | ?>
11 |
12 |
13 | getAvatar(true);
15 | ?>
16 |
17 | username),
19 | Yii::app()->createUrl('//profile/profile/view',array(
20 | 'id'=>$friend->id)));
21 | ?>
22 |
23 |
24 |
25 | $model->username));
30 | }
31 | echo '
';
32 |
33 | Yii::import(
34 | 'user.friendship.controllers.YumFriendshipController');
35 | echo YumFriendshipController::invitationLink(Yii::app()->user->id, $model->id);
36 | ?>
37 |
--------------------------------------------------------------------------------
/friendship/views/friendship/invitation.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Request friendship for user {username}', array(
3 | '{username}' => $invited->username));
4 | $this->breadcrumbs = array(
5 | Yum::t('Friendship'),
6 | Yum::t('Invitation'), $invited->username);
7 |
8 | $friendship_status = $invited->isFriendOf(Yii::app()->user->id);
9 | if($friendship_status !== false) {
10 | if($friendship_status == 1)
11 | echo Yum::t('Friendship request already sent');
12 | if($friendship_status == 2)
13 | echo Yum::t('You already are friends');
14 | if($friendship_status == 3)
15 | echo Yum::t('Friendship request has been rejected');
16 |
17 | return false;
18 | } else {
19 | if(isset($friendship))
20 | echo CHtml::errorSummary($friendship);
21 |
22 | echo CHtml::beginForm(array('friendship/invite'));
23 | echo CHtml::hiddenField('user_id', $invited->id);
24 | echo CHtml::label(Yum::t('Please enter a request Message up to 255 characters'), 'message');
25 | echo '
';
26 | echo CHtml::textArea('message', '', array('cols' =>60, 'rows' => 10));
27 | echo '
';
28 | echo CHtml::submitButton(Yum::t('Send invitation'));
29 | echo CHtml::endForm();
30 | }
31 | ?>
32 |
33 |
--------------------------------------------------------------------------------
/friendship/views/friendship/myfriends.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('My friends');
3 | $this->breadcrumbs = array(Yum::t('Friends'));
4 |
5 |
6 |
7 | if($friends) {
8 | echo '';
9 |
10 | echo '
';
11 |
12 | foreach($friends as $friend) {
13 | $options = array();
14 | $form=$this->beginWidget('CActiveForm', array(
15 | 'id'=>'groups-form',
16 | 'enableAjaxValidation'=>false,
17 | ));
18 |
19 | echo CHtml::activeHiddenField($friend, 'inviter_id');
20 | echo CHtml::activeHiddenField($friend, 'friend_id');
21 |
22 | if($friend->status == 1) { // Confirmation Pending
23 | if($friend->inviter_id == Yii::app()->user->id) {
24 | $options = CHtml::submitButton(Yum::t('Cancel request'),array(
25 | 'id'=>'cancel_request', 'name'=>'YumFriendship[cancel_request]'));
26 | } else {
27 | $options = CHtml::submitButton(Yum::t('Confirm'), array(
28 | 'id'=>'add_request','name'=>'YumFriendship[add_request]'));
29 | // $options .= CHtml::submitButton(Yum::t('Ignore'), array(
30 | // 'id'=>'ignore_request','name'=>'YumFriendship[ignore_request]'));
31 | $options .= CHtml::submitButton(Yum::t('Deny'), array(
32 | 'id'=>'deny_request','name'=>'YumFriendship[deny_request]'));
33 | }
34 | } else if($friend->status == 2) { // Users are friends
35 | $options = CHtml::submitButton(Yum::t('Remove friend'),array(
36 | 'id'=>'remove_friend','name'=>'YumFriendship[remove_friend]','confirm' => Yum::t('Are you sure you want to remove this friend?')));
37 | }
38 | if($friend->inviter_id == Yii::app()->user->id)
39 | $label = $friend->invited;
40 | else
41 | $label = $friend->inviter;
42 |
43 | printf('%s | %s | %s | %s | %s |
',
44 | $label->getAvatar(true),
45 | CHtml::link($label->username, array(
46 | '//profile/profile/view', 'id'=>$label->id)),
47 | $friend->getStatus(),
48 | CHtml::link(Yum::t('Write a message'), array(
49 | '//message/message/compose', 'to_user_id'=>$label->id)),
50 | $friend->status != 3 ? $options : ''
51 |
52 | );
53 |
54 | $this->endWidget();
55 | }
56 | echo '
';
57 | echo '
';
58 | } else {
59 | echo Yum::t('You do not have any friends yet');
60 | }
61 |
62 | ?>
63 |
64 |
--------------------------------------------------------------------------------
/friendship/views/friendship/new_friends.php:
--------------------------------------------------------------------------------
1 | findByPk(Yii::app()->user->id);
3 |
4 | if($user->friendship_requests) {
5 | $this->beginWidget('zii.widgets.CPortlet', array(
6 | 'title'=> Yum::t('New friendship requests')));
7 | foreach($user->friendship_requests as $friendship) {
8 | printf(' %s: %s ',
9 | date(Yum::module()->dateTimeFormat, $friendship->requesttime),
10 | CHtml::link($friendship->inviter->username, array(
11 | '//profile/profile/view', 'id' => $friendship->inviter->id)));
12 | }
13 | echo CHtml::link(Yum::t('Manage friends'), array(
14 | '//friendship/friendship/admin'));
15 | $this->endWidget();
16 | }
17 | ?>
18 |
19 |
--------------------------------------------------------------------------------
/friendship/views/friendship/update.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Friendships')=>array('index'),
4 | $model->id=>array('view','id'=>$model->id),
5 | 'Update',
6 | );
7 | ?>
8 |
9 | Update Friendship #id; ?>
10 |
11 | renderPartial('_form', array('model'=>$model)); ?>
12 |
--------------------------------------------------------------------------------
/friendship/views/friendship/view.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Groups'=>array('index'),
4 | );
5 | ?>
6 |
7 | View Friendship #id; ?>
8 |
9 | widget('zii.widgets.CDetailView', array(
10 | 'data'=>$model,
11 | 'attributes'=>array(
12 | 'id',
13 | 'inviter.username',
14 | 'status',
15 | 'invited.username',
16 | 'acknowledgetime',
17 | 'requesttime',
18 | 'updatetime',
19 | 'message',
20 |
21 | ),
22 | )); ?>
23 |
--------------------------------------------------------------------------------
/membership/MembershipModule.php:
--------------------------------------------------------------------------------
1 | array(
21 | 'class'=>'MembershipModule.controllers.YumPaymentController'),
22 | 'membership'=>array(
23 | 'class'=>'MembershipModule.controllers.YumMembershipController'),
24 | );
25 |
26 | public function beforeControllerAction($controller, $action) {
27 | if(!Yum::hasModule('role'))
28 | throw new Exception(
29 | 'Using the membership submodule requires the role module activated');
30 |
31 | return parent::beforeControllerAction($controller, $action);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/membership/models/YumPayment.php:
--------------------------------------------------------------------------------
1 | _tableName = Yum::module('membership')->paymentTable;
16 | return $this->_tableName;
17 | }
18 |
19 | public function rules()
20 | {
21 | return array(
22 | array('title, text', 'required'),
23 | array('id', 'numerical', 'integerOnly'=>true),
24 | array('title', 'length', 'max'=>255),
25 | array('id, title, text', 'safe', 'on'=>'search'),
26 | );
27 | }
28 |
29 | public function activate() {
30 | $membership->payment_date = time();
31 | $membership->end_date = time() + $this->role->duration * 86400 ;
32 | return true;
33 | }
34 |
35 | public function relations()
36 | {
37 | return array(
38 | 'memberships' => array(self::HAS_MANY, 'YumMembership', 'payment_id'),
39 | );
40 | }
41 |
42 | public function attributeLabels()
43 | {
44 | return array(
45 | 'id' => Yum::t('ID'),
46 | 'title' => Yum::t('Title'),
47 | 'text' => Yum::t('Text'),
48 | );
49 | }
50 |
51 | public function search()
52 | {
53 | $criteria=new CDbCriteria;
54 |
55 | $criteria->compare('id', $this->id);
56 | $criteria->compare('title', $this->title, true);
57 | $criteria->compare('text', $this->text, true);
58 |
59 | return new CActiveDataProvider(get_class($this), array(
60 | 'criteria'=>$criteria,
61 | ));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/membership/views/membership/_form.php:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/membership/views/membership/_miniform.php:
--------------------------------------------------------------------------------
1 |
44 |
--------------------------------------------------------------------------------
/membership/views/membership/_view.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
role->description; ?>
4 |
5 | id . '
';
7 | if($data->role->price != 0)
8 | if($data->payment_date == 0)
9 | echo Yum::t('Membership has not been payed yet');
10 | else {
11 | echo Yum::t('Membership payed at: {date}', array(
12 | '{date}' => date('d. m. Y', $data->payment_date)));
13 | echo '
';
14 | echo Yum::t('Membership ends at: {date} ', array(
15 | '{date}' => date('d. m. Y', $data->end_date)));
16 | echo '
';
17 | }
18 | ?>
19 |
20 | role->price != 0) { ?>
21 |
22 |
23 | order_date); ?>
24 |
25 |
26 | payment)) echo $data->payment->title . '
'; ?>
27 |
28 |
29 | end_date != 0)
31 | echo Yum::t('This membership is still active {days} days', array(
32 | '{days}' => $data->daysLeft()));
33 | ?>
34 |
35 |
36 | isActive()) { ?>
37 |
38 |
:
39 | Yum::t('Automatically extend subscription'),
42 | 'cancel' => Yum::t('Cancel Subscription'));
43 | foreach( $data->getPossibleExtendOptions('downgrade') as $key => $option)
44 | $options[$key] = $option;
45 | foreach( $data->getPossibleExtendOptions('upgrade') as $key => $option)
46 | $options[$key] = $option;
47 |
48 | echo CHtml::hiddenField('membership_id', $data->id);
49 | echo CHtml::dropDownList('subscription',
50 | $data->subscribed == -1 ? 'cancel' : $data->subscribed, $options);
51 | echo CHtml::submitButton(Yum::t('Save'));
52 | ?>
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/membership/views/membership/admin.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Memberships')=>array('index'),
4 | Yum::t('Manage'),
5 | );
6 | ?>
7 |
8 |
9 |
10 | language);
12 |
13 | $this->widget('zii.widgets.grid.CGridView', array(
14 | 'id'=>'membership-grid',
15 | 'dataProvider'=>$model->search(),
16 | 'filter'=>$model,
17 | 'columns'=>array(
18 | array('name' => 'id',
19 | 'htmlOptions' => array('style' => 'width: 20px;')),
20 | 'username',
21 | 'role.title',
22 | array(
23 | 'name'=>'order_date',
24 | 'value' =>'date("Y. m. d G:i:s", $data->order_date)',
25 | 'filter' => false,
26 | ),
27 | array(
28 | 'name'=>'end_date',
29 | 'value' =>'date("Y. m. d G:i:s", $data->end_date)',
30 | 'filter' => false,
31 | ),
32 | array(
33 | 'name'=>'payment_date',
34 | 'value' =>'($data->payment_date === null || $data->payment_date == 0) ? Yum::t("Not yet payed") : date("Y. m. d G:i:s", $data->payment_date)',
35 | 'filter' => array('not_payed' => Yum::t('Not yet payed')),
36 | ),
37 | 'role.price',
38 | 'payment.title',
39 | array(
40 | 'header' => Yum::t('Time left'),
41 | 'value' => '$data->timeLeft()',
42 | 'type' => 'raw'),
43 | array(
44 | 'class'=>'CButtonColumn',
45 | 'template' => '{update}{delete}',
46 | ),
47 | ),
48 | )); ?>
49 |
--------------------------------------------------------------------------------
/membership/views/membership/buttons.php:
--------------------------------------------------------------------------------
1 |
2 | $url)); ?>
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/membership/views/membership/index.php:
--------------------------------------------------------------------------------
1 | breadcrumbs = array(
3 | Yum::t('Membership'),
4 | Yum::t('My memberships'),
5 | );
6 |
7 | $this->title = Yum::t('My memberships');
8 | echo Yum::renderFlash();
9 | ?>
10 |
11 |
12 | widget('zii.widgets.CListView', array(
13 | 'dataProvider'=>$dataProvider,
14 | 'itemView'=>'_view',
15 | )); ?>
16 |
17 |
18 |
--------------------------------------------------------------------------------
/membership/views/membership/membership_expired.php:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/membership/views/membership/order.php:
--------------------------------------------------------------------------------
1 | breadcrumbs = array(Yum::t('Membership'));?>
2 |
3 | title = Yum::t('Membership'); ?>
4 |
5 |
37 |
38 |
39 |
mehr Informationen
40 |
46 |
47 | clientScript->registerScript('toggle', "
49 | $('#detail-information').hide();
50 | $('#more-information').click(function() {
51 | $('#detail-information').fadeToggle('slow');
52 | });
53 | ");
54 | ?>
55 | endWidget(); ?>
56 |
--------------------------------------------------------------------------------
/membership/views/membership/orders.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Pakete',
4 | 'Bestellungen'
5 | );
6 |
7 | ?>
8 |
9 | Bestellungen
10 |
11 | language);
13 |
14 | $this->widget('zii.widgets.grid.CGridView', array(
15 | 'id'=>'membership-has-company-grid',
16 | 'dataProvider'=>$model->search(),
17 | 'filter'=>$model,
18 | 'columns'=>array(
19 | 'company.name',
20 | array(
21 | 'name'=>'order_date',
22 | 'value' =>'date("Y. m. d G:i:s", $data->order_date)'),
23 | array(
24 | 'name'=>'end_date',
25 | 'value' =>'date("Y. m. d G:i:s", $data->end_date)'),
26 | array(
27 | 'name'=>'payment_date',
28 | 'value' =>'date("Y. m. d G:i:s", $data->payment_date)'),
29 | 'membership.type',
30 | 'membership.fee',
31 | 'payment.title',
32 | ),
33 | )); ?>
34 |
--------------------------------------------------------------------------------
/membership/views/membership/success.php:
--------------------------------------------------------------------------------
1 | The Membership has been successfully created
2 |
3 | $relation.'_done')); ?> $relation.'_create'));
4 |
--------------------------------------------------------------------------------
/membership/views/membership/update.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Memberships')=>array('index'),
4 | Yum::t('Update'),
5 | );
6 |
7 | ?>
8 |
9 |
10 | widget('zii.widgets.CDetailView', array(
12 | 'data'=>$model,
13 | 'attributes'=>array(
14 | 'username',
15 | 'role.price',
16 | 'payment.title',
17 |
18 | ),
19 | ));
20 |
21 | echo Yum::t('Ordered at').': '.date("Y. m. d G:i:s", $model->order_date) . '
';
22 | echo Yum::t('Ends at').': ' . date("Y. m. d G:i:s", $model->end_date) . '
';
23 | echo Yum::t('Payment date').': '. date("Y. m. d G:i:s", $model->payment_date) . '
';
24 |
25 | echo CHtml::beginForm(array('//membership/membership/update'));
26 | echo CHtml::hiddenField('YumMembership[id]', $model->id);
27 | echo CHtml::submitButton(Yum::t('Set payment date to today'));
28 | echo CHtml::endForm();
29 | ?>
30 |
--------------------------------------------------------------------------------
/membership/views/membership/view.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Memberships'=>array('index'),
4 | $model->id,
5 | );
6 |
7 | ?>
8 |
9 | Membership #id; ?>
10 |
11 | language);
13 |
14 | $this->widget('zii.widgets.CDetailView', array(
15 | 'data'=>$model,
16 | 'attributes'=>array(
17 | 'id',
18 | 'type',
19 | 'fee',
20 | 'period',
21 | ),
22 | )); ?>
23 |
24 |
25 | 'MembershipHasCompanys')), array('MembershipHasCompany/admin'));?>
26 | membershipHasCompanys as $foreignobj) {
27 |
28 | printf('- %s
', CHtml::link($foreignobj->order_date, array('membershiphascompany/view', 'id' => $foreignobj->id)));
29 |
30 | } ?>
31 |
--------------------------------------------------------------------------------
/membership/views/payment/_form.php:
--------------------------------------------------------------------------------
1 |
34 |
--------------------------------------------------------------------------------
/membership/views/payment/_miniform.php:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/membership/views/payment/_view.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | getAttributeLabel('id')); ?>:
4 | id), array('view', 'id'=>$data->id)); ?>
5 |
6 |
7 | getAttributeLabel('title')); ?>:
8 | title); ?>
9 |
10 |
11 | getAttributeLabel('text')); ?>:
12 | text); ?>
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/membership/views/payment/admin.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Payments')=>array(Yii::t('app', 'index')),
4 | Yum::t('Manage'),
5 | );
6 | ?>
7 |
8 |
9 |
10 | language);
12 |
13 | $this->widget('zii.widgets.grid.CGridView', array(
14 | 'id'=>'payment-grid',
15 | 'dataProvider'=>$model->search(),
16 | 'filter'=>$model,
17 | 'columns'=>array(
18 | 'title',
19 | 'text',
20 | array(
21 | 'class'=>'CButtonColumn',
22 | ),
23 | ),
24 | )); ?>
25 |
--------------------------------------------------------------------------------
/membership/views/payment/buttons.php:
--------------------------------------------------------------------------------
1 |
2 | $url)); ?>
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/membership/views/payment/create.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Payments')=>array(Yii::t('app', 'index')),
4 | Yum::t('Create'),
5 | );
6 |
7 | ?>
8 |
9 |
10 | renderPartial('_form', array(
12 | 'model' => $model,
13 | 'buttons' => 'create'));
14 |
15 | ?>
16 |
17 |
--------------------------------------------------------------------------------
/membership/views/payment/index.php:
--------------------------------------------------------------------------------
1 | breadcrumbs = array(
3 | 'Payments',
4 | Yii::t('app', 'Index'),
5 | );
6 |
7 | $this->menu=array(
8 | array('label'=>Yii::t('app', 'Create') . ' Payment', 'url'=>array('create')),
9 | array('label'=>Yii::t('app', 'Manage') . ' Payment', 'url'=>array('admin')),
10 | );
11 | ?>
12 |
13 | Payments
14 |
15 | widget('zii.widgets.CListView', array(
16 | 'dataProvider'=>$dataProvider,
17 | 'itemView'=>'_view',
18 | )); ?>
19 |
--------------------------------------------------------------------------------
/membership/views/payment/success.php:
--------------------------------------------------------------------------------
1 | The Payment has been successfully created
2 |
3 | $relation.'_done')); ?> $relation.'_create'));
4 |
--------------------------------------------------------------------------------
/membership/views/payment/update.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | Yum::t('Payments')=>array('index'),
4 | $model->id=>array('view','id'=>$model->id),
5 | Yii::t('app', 'Update'),
6 | );
7 |
8 | ?>
9 |
10 | : title; ?>
11 | renderPartial('_form', array(
13 | 'model'=>$model));
14 | ?>
15 |
--------------------------------------------------------------------------------
/membership/views/payment/view.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Payments'=>array('index'),
4 | $model->id,
5 | );
6 | ?>
7 |
8 | Payment #id; ?>
9 |
10 | language);
12 |
13 | $this->widget('zii.widgets.CDetailView', array(
14 | 'data'=>$model,
15 | 'attributes'=>array(
16 | 'title',
17 | 'text',
18 | ),
19 | )); ?>
20 |
21 |
22 |
23 | memberships as $foreignobj) {
24 |
25 | printf('- %s
', CHtml::link($foreignobj->start, array('membership/view', 'id' => $foreignobj->id)));
26 |
27 | } ?>
28 |
--------------------------------------------------------------------------------
/message/MessageModule.php:
--------------------------------------------------------------------------------
1 | array(
34 | 'class' => 'MessageModule.controllers.YumMessageController'),
35 | );
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/message/components/MessageWidget.php:
--------------------------------------------------------------------------------
1 | messageSystem === false)
12 | return false;
13 |
14 | $this->title=Yum::t('New messages');
15 | parent::init();
16 | }
17 |
18 | protected function renderContent()
19 | {
20 | if(Yum::module('message')->messageSystem === false)
21 | return false;
22 |
23 | if(!Yii::app()->user->isGuest) {
24 | $messages = YumMessage::model()->unread()->limit(10)->findAll();
25 |
26 | $this->render('messages', array(
27 | 'messages' => $messages
28 | ));
29 | }
30 | }
31 | }
32 | ?>
33 |
--------------------------------------------------------------------------------
/message/components/views/messages.php:
--------------------------------------------------------------------------------
1 | ';
4 | printf('%s | %s | ',
5 | Yum::t('From'),
6 | Yum::t('Subject'));
7 | foreach($messages as $message) {
8 | printf('%s | %s |
',
9 | substr($message->from_user->username, 0, 10),
10 | CHtml::link(substr($message->title, 0, 40), array
11 | ('//message/message/view', 'id' => $message->id)));
12 | }
13 | echo '';
14 | } else
15 | echo Yum::t('No new messages');
16 | ?>
17 |
--------------------------------------------------------------------------------
/message/views/message/compose.php:
--------------------------------------------------------------------------------
1 | title)
3 | $this->title = Yum::t('Compose new message');
4 | if($this->breadcrumbs == array())
5 | $this->breadcrumbs = array(Yum::t('Messages'), Yum::t('Compose'));
6 | ?>
7 |
8 |
59 |
--------------------------------------------------------------------------------
/message/views/message/index.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('My inbox');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Messages')=>array('index'),
6 | Yum::t('My inbox'));
7 |
8 | echo Yum::renderFlash();
9 |
10 | echo '' . Yum::t('Messages') . '
';
11 |
12 | $this->widget('zii.widgets.grid.CGridView', array(
13 | 'id'=>'yum-message-grid',
14 | 'dataProvider' => $model->search(),
15 | 'columns'=>array(
16 | array(
17 | 'type' => 'raw',
18 | 'name' => Yum::t('From'),
19 | 'value' => 'CHtml::link($data->from_user->username, array(
20 | "//profile/profile/view",
21 | "id" => $data->from_user_id)
22 | )'
23 | ),
24 | array(
25 | 'type' => 'raw',
26 | 'name' => Yum::t('title'),
27 | 'value' => 'CHtml::link($data->getTitle(), array("view", "id" => $data->id))',
28 | ),
29 | array(
30 | 'name' => 'timestamp',
31 | 'value' => '$data->getDate()',
32 | ),
33 | array(
34 | 'class'=>'CButtonColumn',
35 | 'template' => '{view}{delete}',
36 | ),
37 | ),
38 | )); ?>
39 |
--------------------------------------------------------------------------------
/message/views/message/message.php:
--------------------------------------------------------------------------------
1 | pageTitle=Yum::t('Messages'); ?>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/message/views/message/message_view_forbidden.php:
--------------------------------------------------------------------------------
1 | ';
5 | echo CHtml::link(Yum::t('Return to your inbox'), array('index'));
6 |
7 | ?>
8 |
--------------------------------------------------------------------------------
/message/views/message/messages.php:
--------------------------------------------------------------------------------
1 | ';
4 | printf('%s | %s | ',
5 | Yum::t('From'),
6 | Yum::t('Subject'));
7 | foreach($messages as $message) {
8 | printf('%s | %s |
',
9 | substr($message->from_user->username, 0, 10),
10 | CHtml::link(substr($message->title, 0, 40), array
11 | ('//message/message/view', 'id' => $message->id)));
12 | }
13 | echo '';
14 | } else
15 | echo Yum::t('No new messages');
16 | ?>
17 |
--------------------------------------------------------------------------------
/message/views/message/new_messages.php:
--------------------------------------------------------------------------------
1 | findAll(
3 | 'to_user_id = :to and message_read = 0',
4 | array( ':to' => Yii::app()->user->id)
5 | );
6 |
7 | if(count($messages) > 0) {
8 | if(Yum::module('message')->messageSystem == YumMessage::MSG_PLAIN)
9 | $this->renderPartial(
10 | 'user.message.views.message.new_messages_plain', array(
11 | 'message' => $message));
12 | else if(Yum::module('message')->messageSystem == YumMessage::MSG_DIALOG)
13 | $this->renderPartial(
14 | 'user.message.views.message.new_messages_dialog', array(
15 | 'message' => $message));
16 | }
17 | ?>
18 |
--------------------------------------------------------------------------------
/message/views/message/new_messages_dialog.php:
--------------------------------------------------------------------------------
1 | beginWidget('zii.widgets.jui.CJuiDialog', array(
3 | 'id'=>rand(1, 999999),
4 | 'options'=>array(
5 | 'show' => 'blind',
6 | 'hide' => 'explode',
7 | 'modal' => 'false',
8 | 'width' => '800px',
9 | 'title' => Yum::t('You have {count} new Messages !', array(
10 | '{count}' => count($messages))),
11 | 'autoOpen'=>true,
12 | ),
13 | ));
14 |
15 | echo '';
16 | printf('%s | %s | %s | %s |
',
17 | Yum::t('From'),
18 | Yum::t('Date'),
19 | Yum::t('Title'),
20 | Yum::t('Actions'));
21 |
22 | foreach($messages as $message) {
23 | if(is_object($message) && $message->from_user instanceof YumUser )
24 | printf('%s | %s | %s | %s | %s |
',
25 | CHtml::link($message->from_user->username, array(
26 | '//profile/profile/view', 'id' => $message->from_user_id)),
27 | date(Yum::module()->dateTimeFormat, $message->timestamp),
28 | CHtml::link($message->title, array('//message/message/view', 'id' => $message->id)),
29 | CHtml::link(Yum::t('View'), array('//message/message/view', 'id' => $message->id)),
30 | CHtml::link(Yum::t('Reply'), array('//message/message/compose', 'to_user_id' => $message->from_user_id)));
31 |
32 |
33 | }
34 | echo '
';
35 | $this->endWidget('zii.widgets.jui.CJuiDialog');
36 | ?>
37 |
--------------------------------------------------------------------------------
/message/views/message/new_messages_plain.php:
--------------------------------------------------------------------------------
1 | ';
4 |
5 | echo Yum::t('You have new messages!');
6 |
7 | echo '';
8 | foreach($messages as $message) {
9 | printf("- %s %s
",
10 | CHtml::link($message->title, array(
11 | '//message/message/view', 'id' => $message->id)),
12 | CHtml::link(Yum::t('Reply'), array(
13 | '//message/message/compose',
14 | 'to_user_id' => $message->from_user_id)));
15 | }
16 | echo '
';
17 | echo '';
18 | }
19 |
20 | ?>
21 |
--------------------------------------------------------------------------------
/message/views/message/reply.php:
--------------------------------------------------------------------------------
1 |
38 |
--------------------------------------------------------------------------------
/message/views/message/sent.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Sent messages');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Messages')=>array('index'),
6 | Yum::t('Sent messages'));
7 |
8 | $this->widget('zii.widgets.grid.CGridView', array(
9 | 'id'=>'yum-sent-message-grid',
10 | 'dataProvider' => $model->search(true),
11 | 'columns'=>array(
12 | array(
13 | 'name' => 'to_user_id',
14 | 'type' => 'raw',
15 | 'value' => 'isset($data->to_user) ? CHtml::link($data->to_user->username, array("//profile/profile/view", "id" => $data->to_user->username)) : ""',
16 | ),
17 | array(
18 | 'type' => 'raw',
19 | 'name' => 'title',
20 | 'value' => 'CHtml::link($data->title, array("view", "id" => $data->id))',
21 | ),
22 | array(
23 | 'name' => 'timestamp',
24 | 'value' => '$data->getDate()',
25 | ),
26 | array(
27 | 'class'=>'CButtonColumn',
28 | 'template' => '{view}',
29 | ),
30 | ),
31 | )); ?>
32 |
--------------------------------------------------------------------------------
/message/views/message/success.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Your message has been sent');
3 | $this->breadcrumbs=array(
4 | Yum::t('Messages')=>array('index'),
5 | Yum::t('Success'));
6 | ?>
7 |
8 |
9 |
--------------------------------------------------------------------------------
/message/views/message/view.php:
--------------------------------------------------------------------------------
1 | title = $model->title;
3 | $this->breadcrumbs=array(Yum::t('Messages')=>array('index'),$model->title);
4 | ?>
5 |
6 | ' . $model->from_user->username . '';
7 |
8 | echo ': ' . $model->title; ?>
9 |
10 |
11 |
12 |
13 |
14 | message; ?>
15 |
16 |
17 |
18 | ';
21 |
22 | if(Yii::app()->user->id != $model->from_user_id) {
23 | echo CHtml::link(Yum::t('Reply to message'), '', array(
24 | 'onclick' => "$('.reply').toggle(500)"));
25 |
26 | echo '';
27 | $reply = new YumMessage;
28 |
29 | if(substr($model->title, 0, 3) != 'Re:')
30 | $reply->title = 'Re: ' . $model->title;
31 | else
32 | $reply->title = $model->title;
33 |
34 | $this->renderPartial('reply', array(
35 | 'to_user_id' => $model->from_user_id,
36 | 'answer_to' => $model->id,
37 | 'model' => $reply));
38 | echo '
';
39 | }
40 | ?>
41 |
--------------------------------------------------------------------------------
/message/views/message/write_a_message.php:
--------------------------------------------------------------------------------
1 | messageSystem != YumMessage::MSG_NONE
3 | && $model->id != Yii::app()->user->id) {
4 |
5 | echo '';
6 |
7 | $this->renderPartial(Yum::module()->messageComposeView, array(
8 | 'model' => new YumMessage,
9 | 'to_user_id' => $model->id), false, true);
10 |
11 | echo '
';
12 |
13 | echo CHtml::link(Yum::t('Write a message to this User'), '',
14 | array('onclick'=>"$('#write_a_message').toggle(500);"));
15 | }
16 | ?>
17 |
--------------------------------------------------------------------------------
/profile/ProfileModule.php:
--------------------------------------------------------------------------------
1 | array(
48 | 'class'=>'profile.controllers.YumProfileCommentController'),
49 | 'privacy'=>array(
50 | 'class'=>'profile.controllers.YumPrivacysettingController'),
51 | 'profile'=>array(
52 | 'class'=>'profile.controllers.YumProfileController'),
53 | );
54 |
55 | public function init() {
56 | $this->setImport(array(
57 | 'user.controllers.*',
58 | 'user.models.*',
59 | 'profile.components.*',
60 | 'profile.models.*',
61 | ));
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/profile/components/ProfileCommentsWidget.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Profile Comments');
11 | if(Yii::app()->user->isGuest)
12 | return false;
13 |
14 | parent::init();
15 | }
16 |
17 | protected function renderContent()
18 | {
19 | parent::renderContent();
20 | if(Yii::app()->user->isGuest)
21 | return false;
22 |
23 | $user = YumUser::model()->findByPk(Yii::app()->user->id);
24 | $this->render('profile_comments', array(
25 | 'comments' => Yii::app()->user->data()->profile->recentComments()));
26 | }
27 | }
28 | ?>
29 |
--------------------------------------------------------------------------------
/profile/components/ProfileVisitWidget.php:
--------------------------------------------------------------------------------
1 | enableProfileVisitLogging)
11 | return false;
12 |
13 | $this->title=Yum::t('Profile visits');
14 | if(Yii::app()->user->isGuest)
15 | return false;
16 |
17 | parent::init();
18 | }
19 |
20 | protected function renderContent()
21 | {
22 | if(!Yum::module('profile')->enableProfileVisitLogging)
23 | return false;
24 |
25 | parent::renderContent();
26 | if(Yii::app()->user->isGuest)
27 | return false;
28 |
29 | $this->render('profile_visits', array(
30 | 'visits' => Yii::app()->user->data()->visits));
31 | }
32 | }
33 | ?>
34 |
--------------------------------------------------------------------------------
/profile/components/views/profile_comments.php:
--------------------------------------------------------------------------------
1 | '.Yum::t('These users have commented your profile recently') . ': ';
4 | foreach($comments as $comment) {
5 | printf('%s %s
',
6 | CHtml::link($comment->user->getAvatar(true), array(
7 | '//profile/profile/view', 'id' => $comment->user_id)),
8 | CHtml::link($comment->user->username, array(
9 | '//profile/profile/view', 'id' => $comment->user_id)));
10 | printf('%s
',
11 | substr($comment->comment, 0, 100));
12 | echo '';
13 |
14 | }
15 | } else
16 | echo Yum::t('Nobody has commented your profile yet');
17 | ?>
18 |
19 |
20 |
--------------------------------------------------------------------------------
/profile/components/views/profile_visits.php:
--------------------------------------------------------------------------------
1 | '. Yum::t('These users have visited your profile recently') . ': ';
3 |
4 | if($visits) {
5 | foreach($visits as $visit)
6 | printf('%s
%s
',
7 | CHtml::link($visit->visitor->getAvatar(true), array(
8 | Yum::module('profile')->profileView, 'id' => $visit->visitor_id)),
9 | substr($visit->visitor->username,0,12)
10 | );
11 | } else
12 | echo Yum::t('Nobody has visited your profile yet');
13 | ?>
14 |
15 |
16 |
--------------------------------------------------------------------------------
/profile/controllers/YumPrivacysettingController.php:
--------------------------------------------------------------------------------
1 | array('update'),
14 | 'users'=>array('@'),
15 | ),
16 | array('deny',
17 | 'users'=>array('*'),
18 | ),
19 | );
20 | }
21 |
22 | public function beforeAction($action) {
23 | if(!Yum::module('profile')->enablePrivacySetting)
24 | throw new CHttpException(404);
25 |
26 | return parent::beforeAction($action);
27 | }
28 |
29 | public function actionUpdate() {
30 | $model = YumPrivacySetting::model()->findByPk(Yii::app()->user->id);
31 |
32 | if(isset($_POST['YumPrivacysetting'])) {
33 | $model->attributes = $_POST['YumPrivacysetting'];
34 |
35 | $profile_privacy = 0;
36 | foreach($_POST as $key => $value) {
37 | if($value == 1 && substr($key, 0, 18) == 'privacy_for_field_') {
38 | $data = explode('_', $key);
39 | $data = (int) $data[3];
40 | $profile_privacy += $data;
41 | }
42 | }
43 |
44 | $model->public_profile_fields = $profile_privacy;
45 | $model->validate();
46 |
47 | if(isset($_POST['YumProfile'])) {
48 | $profile = $model->user->profile;
49 | $profile->attributes = $_POST['YumProfile'];
50 | $profile->validate();
51 | }
52 |
53 | if(!$model->hasErrors()) {
54 | $profile->save();
55 | $model->save();
56 | Yum::setFlash('Your privacy settings have been saved');
57 | $this->redirect(array('//profile/profile/view', 'id' => $model->user_id));
58 | }
59 | }
60 |
61 | // If the user does not have a privacy setting entry yet, create an
62 | // empty one
63 | if(!$model) {
64 | $model = new YumPrivacySetting();
65 | $model->user_id = Yii::app()->user->id;
66 | $model->save();
67 | $this->refresh();
68 | }
69 |
70 | $this->render(Yum::module('profile')->privacySettingView,array(
71 | 'model'=>$model,
72 | 'profile'=> isset($model->user) && isset($model->user->profile)
73 | ? $model->user->profile
74 | : null
75 | ));
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/profile/controllers/YumProfileCommentController.php:
--------------------------------------------------------------------------------
1 | array('index'),
9 | 'users'=>array('*'),
10 | ),
11 | array('allow',
12 | 'actions'=>array('create', 'delete'),
13 | 'users'=>array('@'),
14 | ),
15 | array('allow',
16 | 'actions'=>array('admin'),
17 | 'users'=>array('admin'),
18 | ),
19 | array('deny',
20 | 'users'=>array('*'),
21 | ),
22 | );
23 | }
24 |
25 | public function actionCreate() {
26 | $model = new YumProfileComment;
27 |
28 | $this->performAjaxValidation($model, 'profile-comment-form');
29 |
30 | if(isset($_POST['YumProfileComment'])) {
31 | $model->attributes = $_POST['YumProfileComment'];
32 | $model->save();
33 | }
34 |
35 | if(isset($model->profile->user) && $user = $model->profile->user)
36 | $this->renderPartial(Yum::module('profile')->profileView, array(
37 | 'model'=>$user
38 | ), false, true);
39 | }
40 |
41 |
42 | public function actionDelete($id) {
43 | $comment = YumProfileComment::model()->findByPk($id);
44 |
45 | if($comment->user_id == Yii::app()->user->id
46 | || $comment->profile_id == Yii::app()->user->id) {
47 | $comment->delete();
48 | $this->redirect(array(
49 | Yum::module('profile')->profileView, 'id' => $comment->profile->user_id));
50 | } else
51 | throw new CHttpException(403,
52 | Yum::t('You are not the owner of this Comment or this Profile!'));
53 | }
54 |
55 | public function actionIndex() {
56 | $dataProvider=new CActiveDataProvider('ProfileComment');
57 | $this->render('index',array(
58 | 'dataProvider'=>$dataProvider,
59 | ));
60 | }
61 |
62 | public function actionAdmin() {
63 | $model=new ProfileComment('search');
64 | $model->unsetAttributes();
65 |
66 | if(isset($_GET['ProfileComment']))
67 | $model->attributes = $_GET['ProfileComment'];
68 |
69 | $this->render('admin',array(
70 | 'model'=>$model,
71 | ));
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/profile/views/layouts/yumprofile.php:
--------------------------------------------------------------------------------
1 | clientScript->registerCssFile(
3 | Yii::app()->getAssetManager()->publish(
4 | Yii::getPathOfAlias('YumAssets').'/css/yum.css'));
5 |
6 | $module = Yii::app()->getModule('user');
7 | $this->beginContent($module->baseLayout); ?>
8 |
9 |
23 |
24 |
25 |
26 |
27 |
28 | endContent(); ?>
29 |
--------------------------------------------------------------------------------
/profile/views/profile/_form.php:
--------------------------------------------------------------------------------
1 | rtepath != false)
3 | Yii::app()->clientScript-> registerScriptFile(Yum::module()->rtepath);
4 | if(Yum::module()->rteadapter != false)
5 | Yii::app()->clientScript-> registerScriptFile(Yum::module()->rteadapter);
6 |
7 | if($profile)
8 | foreach(YumProfile::getProfileFields() as $field) {
9 | echo CHtml::openTag('div',array());
10 |
11 | echo $form->labelEx($profile, $field);
12 | echo $form->textField($profile, $field);
13 | echo $form->error($profile,$field);
14 |
15 | echo CHtml::closeTag('div');
16 | }
17 | ?>
18 |
--------------------------------------------------------------------------------
/profile/views/profile/_search.php:
--------------------------------------------------------------------------------
1 |
40 |
--------------------------------------------------------------------------------
/profile/views/profile/admin.php:
--------------------------------------------------------------------------------
1 | widget('zii.widgets.grid.CGridView', array(
6 | 'id'=>'profiles-grid',
7 | 'dataProvider'=>$dataProvider,
8 | 'filter'=>null,
9 | 'columns'=>$columns,
10 | )
11 | ); ?>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/profile/views/profile/profilenotallowed.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Permission Denied'); ?>
2 |
8 |
--------------------------------------------------------------------------------
/profile/views/profile/public_fields.php:
--------------------------------------------------------------------------------
1 | isNewRecord && $profile->getProfileFields()) { ?>
2 |
3 | getProfileFields() as $field) { ?>
4 |
5 | |
6 | $field; ?> |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/profile/views/profile/update.php:
--------------------------------------------------------------------------------
1 | pageTitle = Yum::t( "Profile");
3 | $this->breadcrumbs=array(
4 | Yum::t('Edit profile'));
5 | $this->title = Yum::t('Edit profile');
6 | ?>
7 |
8 |
9 |
10 | beginWidget('CActiveForm', array(
11 | 'id'=>'profile-form',
12 | )); ?>
13 |
14 |
15 |
16 | errorSummary(array($user, $profile)); ?>
17 |
18 | loginType & UserModule::LOGIN_BY_USERNAME) { ?>
19 |
20 | LabelEx($user,'username'); ?>
21 | textField($user,'username',array(
22 | 'size'=>20,'maxlength'=>20)); ?>
23 | error($user,'username'); ?>
24 |
25 |
26 |
27 | renderPartial('/profile/_form', array('profile' => $profile, 'form'=>$form)); ?>
29 |
30 | enablePrivacySetting)
33 | echo CHtml::button(Yum::t('Privacy settings'), array(
34 | 'submit' => array('/profile/privacy/update'),
35 | 'class' => 'btn')); ?>
36 |
37 | array('/avatar/avatar/editAvatar'), 'class'=>'btn')); ?>
41 |
42 | isNewRecord
43 | ? Yum::t('Create my profile')
44 | : Yum::t('Save profile changes'), array('class'=>'btn')); ?>
45 |
46 |
47 | endWidget(); ?>
48 |
49 |
50 |
--------------------------------------------------------------------------------
/profile/views/profile/view.php:
--------------------------------------------------------------------------------
1 | profile)
3 | $profile = new YumProfile;
4 |
5 | $this->pageTitle = Yum::t('Profile');
6 | $this->title = CHtml::activeLabel($model,'username');
7 | $this->breadcrumbs = array(Yum::t('Profile'), $model->username);
8 | Yum::renderFlash();
9 | ?>
10 |
11 |
12 |
13 | getAvatar(); ?>
14 | renderPartial(Yum::module('profile')->publicFieldsView, array(
15 | 'profile' => $model->profile)); ?>
16 |
17 | renderPartial(
20 | 'user.friendship.views.friendship.friends', array(
21 | 'model' => $model)); ?>
22 |
23 | messageSystem != 0)
25 | $this->renderPartial('/message/write_a_message', array(
26 | 'model' => $model)); ?>
27 |
28 | enableProfileComments
30 | && Yii::app()->controller->action->id != 'update'
31 | && isset($model->profile))
32 | $this->renderPartial(Yum::module('profile')->profileCommentIndexView, array(
33 | 'model' => $model->profile)); ?>
34 |
35 |
36 | user->isGuest && Yii::app()->user->id == $model->id) {
38 | echo CHtml::link(Yum::t('Edit profile'), array('//profile/profile/update'), array('class' => 'btn'));
39 | if(Yum::hasModule('avatar')) {
40 | echo ' ';
41 | echo CHtml::link(Yum::t('Upload avatar image'), array('//avatar/avatar/editAvatar'), array('class' => 'btn'));
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/profile/views/profile/visits.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('All Profile visits in the system');
3 |
4 | $this->breadcrumbs = array(
5 | Yum::t('Profiles') => array('index'),
6 | Yum::t('Profile visits'));
7 |
8 | $this->widget('zii.widgets.grid.CGridView', array(
9 | 'dataProvider'=>$model->search(),
10 | 'columns'=>array(
11 | array(
12 | 'header' => Yum::t('Visitor'),
13 | 'type' => 'raw',
14 | 'value' => 'CHtml::link($data->visitor->username, array(
15 | "/profile/profile/view",
16 | "id" => $data->visitor->profile->id))'),
17 | array(
18 | 'header' => Yum::t('Visited'),
19 | 'type' => 'raw',
20 | 'value' => 'CHtml::link($data->visited->username, array(
21 | "/profile/profile/view",
22 | "id" => $data->visited->id))'),
23 | array(
24 | 'name' => 'timestamp_first_visit',
25 | 'filter' => false,
26 | 'value'=>'date(Yii::app()->getModule("user")->dateTimeFormat,
27 | $data->timestamp_first_visit)',
28 | ),
29 | array(
30 | 'name'=>'timestamp_last_visit',
31 | 'filter' => false,
32 | 'value'=>'date(Yii::app()->getModule("user")->dateTimeFormat,
33 | $data->timestamp_last_visit)',
34 | ),
35 | 'num_of_visits',
36 | ))); ?>
37 |
--------------------------------------------------------------------------------
/profile/views/profileComment/_miniform.php:
--------------------------------------------------------------------------------
1 |
47 |
--------------------------------------------------------------------------------
/profile/views/profileComment/_search.php:
--------------------------------------------------------------------------------
1 |
40 |
--------------------------------------------------------------------------------
/profile/views/profileComment/_view.php:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | user->getAvatar(true); ?>
14 |
15 |
16 |
19 |
20 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/profile/views/profileComment/admin.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Profile Comments'=>array(Yii::t('app', 'index')),
4 | Yii::t('app', 'Manage'),
5 | );
6 |
7 | $this->menu=array(
8 | array('label'=>Yii::t('app', 'List') . ' ProfileComment',
9 | 'url'=>array('index')),
10 | array('label'=>Yii::t('app', 'Create') . ' ProfileComment',
11 | 'url'=>array('create')),
12 | );
13 |
14 | Yii::app()->clientScript->registerScript('search', "
15 | $('.search-button').click(function(){
16 | $('.search-form').toggle();
17 | return false;
18 | });
19 | $('.search-form form').submit(function(){
20 | $.fn.yiiGridView.update('profile-comment-grid', {
21 | data: $(this).serialize()
22 | });
23 | return false;
24 | });
25 | ");
26 | ?>
27 |
28 | Profile Comments
29 |
30 | 'search-button')); ?>
31 |
32 | renderPartial('_search',array(
33 | 'model'=>$model,
34 | )); ?>
35 |
36 |
37 | language);
39 |
40 | $this->widget('zii.widgets.grid.CGridView', array(
41 | 'id'=>'profile-comment-grid',
42 | 'dataProvider'=>$model->search(),
43 | 'filter'=>$model,
44 | 'columns'=>array(
45 | 'id',
46 | 'user_id',
47 | 'profile_id',
48 | 'comment',
49 | array(
50 | 'name'=>'createtime',
51 | 'value' =>'date("Y. m. d G:i:s", $data->createtime)'),
52 | array(
53 | 'class'=>'CButtonColumn',
54 | ),
55 | ),
56 | )); ?>
57 |
--------------------------------------------------------------------------------
/profile/views/profileComment/buttons.php:
--------------------------------------------------------------------------------
1 |
2 | $url)); ?>
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/profile/views/profileComment/create.php:
--------------------------------------------------------------------------------
1 |
40 |
--------------------------------------------------------------------------------
/profile/views/profileComment/index.php:
--------------------------------------------------------------------------------
1 | enableProfileComments ) { ?>
2 |
3 |
4 | array(
7 | 'condition'=>'profile_id = :profile_id',
8 | 'params' => array(':profile_id' => $model->id),
9 | 'order'=>'createtime DESC')
10 | )
11 | );
12 |
13 | $this->renderPartial(Yum::module('profile')->profileCommentCreateView, array(
14 | 'comment' => new YumProfileComment,
15 | 'profile' => $model));
16 |
17 | $this->widget('zii.widgets.CListView', array(
18 | 'dataProvider'=>$dataProvider,
19 | 'itemView'=>Yum::module('profile')->profileCommentView,
20 | ));
21 | }
22 | ?>
23 |
--------------------------------------------------------------------------------
/profile/views/profileComment/success.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | 'window.location.reload()')); ?>
4 |
--------------------------------------------------------------------------------
/profile/views/profileComment/update.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Profile Comments'=>array('index'),
4 | $model->id=>array('view','id'=>$model->id),
5 | Yii::t('app', 'Update'),
6 | );
7 |
8 | $this->menu=array(
9 | array('label'=>Yii::t('app', 'List') . ' ProfileComment', 'url'=>array('index')),
10 | array('label'=>Yii::t('app', 'Create') . ' ProfileComment', 'url'=>array('create')),
11 | array('label'=>Yii::t('app', 'View') . ' ProfileComment', 'url'=>array('view', 'id'=>$model->id)),
12 | array('label'=>Yii::t('app', 'Manage') . ' ProfileComment', 'url'=>array('admin')),
13 | );
14 | ?>
15 |
16 | ProfileComment #id; ?>
17 | renderPartial('_form', array(
19 | 'model'=>$model));
20 | ?>
21 |
--------------------------------------------------------------------------------
/registration/RegistrationModule.php:
--------------------------------------------------------------------------------
1 | array(
48 | 'class'=>'registration.controllers.YumRegistrationController'),
49 | );
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/registration/models/YumPasswordRecoveryForm.php:
--------------------------------------------------------------------------------
1 | Yum::t('Email'),
31 | );
32 | }
33 |
34 | public function checkexists($attribute, $params) {
35 | $user = null;
36 |
37 | // we only want to authenticate when there are no input errors so far
38 | if(!$this->hasErrors()) {
39 | if (strpos($this->login_or_email,"@")) {
40 | $profile = YumProfile::model()->findByAttributes(array(
41 | 'email'=>$this->login_or_email));
42 | $this->user = $profile
43 | && $profile->user
44 | && $profile->user instanceof YumUser ? $profile->user : null;
45 | } else
46 | $this->user = YumUser::model()->findByAttributes(array(
47 | 'username'=>$this->login_or_email));
48 |
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/registration/models/YumRegistration.php:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/registration/models/YumRegistrationForm.php:
--------------------------------------------------------------------------------
1 | registration_by_email))
26 | $rules[] = array('username', 'required');
27 |
28 | $rules[] = array('newsletter, terms', 'safe');
29 | // password requirement is already checked in YumUser model, its sufficient
30 | // to check for verifyPassword here
31 | $rules[] = array('verifyPassword', 'required');
32 | $rules[] = array('password', 'compare',
33 | 'compareAttribute'=>'verifyPassword',
34 | 'message' => Yum::t("Retype password is incorrect."));
35 |
36 | if(Yum::module('registration')->enableCaptcha && !Yum::module()->debug)
37 | $rules[] = array('verifyCode', 'captcha',
38 | 'allowEmpty'=>CCaptcha::checkRequirements());
39 |
40 | return $rules;
41 | }
42 |
43 | public static function genRandomString($length = 10)
44 | {
45 | $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
46 | $string ='';
47 | for ($p = 0; $p < $length; $p++)
48 | {
49 | $string .= $characters[mt_rand(0, strlen($characters)-1)];
50 | }
51 | return $string;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/registration/views/registration/activation_failure.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/registration/views/registration/activation_success.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | CHtml::link(Yum::t('here'), Yum::module()->loginUrl
5 | ))); ?>
6 |
--------------------------------------------------------------------------------
/registration/views/registration/recovery.php:
--------------------------------------------------------------------------------
1 | pageTitle = Yum::t('Password recovery');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Login') => Yum::module()->loginUrl,
6 | Yum::t('Restore'));
7 |
8 | ?>
9 | ';
11 | echo Yum::getFlash();
12 | echo '';
13 | } else {
14 | echo ''.Yum::t('Password recovery').'
';
15 | ?>
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | 'btn')); ?>
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/role/RoleModule.php:
--------------------------------------------------------------------------------
1 | user->can() will always return true when
19 | // this option is set to true and the current user is admin
20 | public $adminIsGod = false;
21 |
22 | public $controllerMap=array(
23 | 'action'=>array(
24 | 'class'=>'RoleModule.controllers.YumActionController'),
25 | 'permission'=>array(
26 | 'class'=>'RoleModule.controllers.YumPermissionController'),
27 | 'role'=>array(
28 | 'class'=>'RoleModule.controllers.YumRoleController'),
29 | );
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/role/models/YumAction.php:
--------------------------------------------------------------------------------
1 | _tableName = Yum::module('role')->actionTable;
10 |
11 | return $this->_tableName;
12 | }
13 |
14 | public function rules() {
15 | return array(
16 | array('title', 'required'),
17 | array('comment, subject', 'default', 'setOnEmpty' => true, 'value' => null),
18 | array('title, subject', 'length', 'max'=>255),
19 | array('comment', 'safe'),
20 | array('id, title, comment, subject', 'safe', 'on'=>'search'),
21 | );
22 | }
23 |
24 | // return all users that have the possibility to run this action
25 | public function getUsers() {
26 | $users = array();
27 |
28 | foreach($this->permissions as $permission) {
29 | if($permission->type == 'role')
30 | foreach(YumRole::model()->findByPk($permission->principal_id)->users as $user)
31 | $users[$user->id] = $user;
32 | else if($permission->type == 'user')
33 | $users[$permission->principal_id] = $permission->principal;
34 |
35 | return $users;
36 | }
37 | }
38 |
39 | public function relations()
40 | {
41 | return array(
42 | 'permissions' => array(self::HAS_MANY, 'YumPermission', 'principal_id')
43 | );
44 | }
45 |
46 | public function attributeLabels()
47 | {
48 | return array(
49 | 'id' => Yum::t('ID'),
50 | 'title' => Yum::t('Title'),
51 | 'comment' => Yum::t('Comment'),
52 | 'subject' => Yum::t('Subject'),
53 | );
54 | }
55 |
56 | public function __toString() {
57 | return $this->title;
58 |
59 | }
60 |
61 | public function search()
62 | {
63 | $criteria=new CDbCriteria;
64 |
65 | $criteria->compare('id', $this->id);
66 | $criteria->compare('title', $this->title, true);
67 | $criteria->compare('comment', $this->comment, true);
68 | $criteria->compare('subject', $this->subject, true);
69 |
70 | return new CActiveDataProvider(get_class($this), array(
71 | 'criteria'=>$criteria,
72 | ));
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/role/models/YumRole.php:
--------------------------------------------------------------------------------
1 | _tableName = Yum::module('role')->roleTable;
14 | return $this->_tableName;
15 | }
16 |
17 | public function rules()
18 | {
19 | return array(
20 | array('title', 'required'),
21 | array('membership_priority', 'numerical'),
22 | array('price', 'numerical'),
23 | array('duration', 'numerical'),
24 | array('title, description', 'length', 'max' => '255'),
25 | );
26 | }
27 |
28 | public function scopes() {
29 | return array(
30 | 'possible_memberships' => array(
31 | 'condition' => 'membership_priority > 0'),
32 | );
33 | }
34 |
35 | public function relations()
36 | {
37 | return array(
38 | 'activeusers'=>array(self::MANY_MANY, 'YumUser', Yum::module('role')->userRoleTable . '(role_id, user_id)', 'condition' => 'status = 3'),
39 | 'users'=>array(self::MANY_MANY, 'YumUser', Yum::module('role')->userRoleTable. '(role_id, user_id)'),
40 | 'permissions' => array(self::HAS_MANY, 'YumPermission', 'principal_id'),
41 | 'memberships' => array(self::HAS_MANY, 'YumMembership', 'membership_id'),
42 | 'managed_by' => array(self::HAS_MANY, 'YumPermission', 'subordinate_id'),
43 |
44 | );
45 | }
46 |
47 | public function activeMembership() {
48 | return YumMembership::model()->lastFirst()->find(
49 | 'user_id = :user_id and membership_id = :role_id', array(
50 | ':user_id' => Yii::app()->user->id,
51 | ':role_id' => $this->id));
52 | }
53 |
54 | public function activeUsers() {
55 | $users = $this->users;
56 | foreach($users as $key => $user)
57 | if(!$user->active())
58 | unset($users[$key]);
59 |
60 | return $users;
61 | }
62 |
63 | public function attributeLabels()
64 | {
65 | return array(
66 | 'id'=>Yum::t("#"),
67 | 'title'=>Yum::t("Title"),
68 | 'description'=>Yum::t("Description"),
69 | 'selectable'=>Yum::t("Selectable on registration"),
70 | 'searchable'=>Yum::t("Searchable"),
71 | 'price'=>Yum::t("Price"),
72 | 'duration'=>Yum::t("Duration in days"),
73 | );
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/role/views/action/_form.php:
--------------------------------------------------------------------------------
1 |
40 |
--------------------------------------------------------------------------------
/role/views/action/_view.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | getAttributeLabel('id')); ?>:
4 | id), array('view', 'id'=>$data->id)); ?>
5 |
6 |
7 | getAttributeLabel('title')); ?>:
8 | title); ?>
9 |
10 |
11 | getAttributeLabel('comment')); ?>:
12 | comment); ?>
13 |
14 |
15 | getAttributeLabel('subject')); ?>:
16 | subject); ?>
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/role/views/action/admin.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | breadcrumbs=array(
7 | Yum::t('Actions')=>array('index'),
8 | Yum::t('Manage'),
9 | );
10 |
11 | ?>
12 |
13 |
14 | 'btn'));
19 |
20 | $this->widget('zii.widgets.grid.CGridView', array(
21 | 'id'=>'action-grid',
22 | 'dataProvider'=>$model->search(),
23 | 'filter'=>$model,
24 | 'columns'=>array(
25 | 'title',
26 | 'comment',
27 | 'subject',
28 | array(
29 | 'class'=>'CButtonColumn',
30 | ),
31 | ),
32 | 'htmlOptions' => array('class' => 'table table-striped table-condensed admin-user'),
33 | )); ?>
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/role/views/action/create.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | breadcrumbs=array(
7 | Yum::t('Actions')=>array('index'),
8 | Yum::t('Create'),
9 | );
10 |
11 | ?>
12 |
13 |
14 |
15 | renderPartial('_form', array('model'=>$model)); ?>
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/role/views/action/index.php:
--------------------------------------------------------------------------------
1 | breadcrumbs=array(
3 | 'Actions',
4 | );
5 |
6 | $this->menu=array(
7 | array('label'=>'Create Action', 'url'=>array('create')),
8 | array('label'=>'Manage Action', 'url'=>array('admin')),
9 | );
10 | ?>
11 |
12 | Actions
13 |
14 | widget('zii.widgets.CListView', array(
15 | 'dataProvider'=>$dataProvider,
16 | 'itemView'=>'_view',
17 | )); ?>
18 |
--------------------------------------------------------------------------------
/role/views/action/update.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | breadcrumbs=array(
7 | 'Actions'=>array('index'),
8 | $model->title=>array('view','id'=>$model->id),
9 | 'Update',
10 | );
11 |
12 | $this->menu=array(
13 | array('label'=>'List Action', 'url'=>array('index')),
14 | array('label'=>'Create Action', 'url'=>array('create')),
15 | array('label'=>'View Action', 'url'=>array('view', 'id'=>$model->id)),
16 | array('label'=>'Manage Action', 'url'=>array('admin')),
17 | );
18 | ?>
19 |
20 |
Update Action id; ?>
21 |
22 | renderPartial('_form', array('model'=>$model)); ?>
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/role/views/action/view.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | breadcrumbs=array(
7 | Yum::t('Actions')=>array('index'),
8 | $model->title,
9 | );
10 |
11 | ?>
12 |
13 |
title; ?>
14 |
15 | widget('zii.widgets.CDetailView', array(
16 | 'data'=>$model,
17 | 'attributes'=>array(
18 | 'id',
19 | 'title',
20 | 'comment',
21 | 'subject',
22 | ),
23 | )); ?>
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/role/views/permission/admin.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | breadcrumbs=array(
7 | Yum::t('Permissions')=>array('index'),
8 | Yum::t('Manage'),
9 | );
10 |
11 | ?>
12 |
13 |
14 |
15 | 'btn'));
18 |
19 | $this->widget('zii.widgets.grid.CGridView', array(
20 | 'id'=>'action-grid',
21 | 'dataProvider'=>$model->search(),
22 | 'filter'=>$model,
23 | 'columns' => array(
24 | array(
25 | 'name' => 'type',
26 | 'value' => '$data->type',
27 | 'filter' => array(
28 | 'type' => Yum::t('User'),
29 | 'role' => Yum::t('Role'),
30 | )
31 | ),
32 | array(
33 | 'filter' => $rolefilter,
34 | 'name' => 'principal_id',
35 | 'value' => '$data->type == "user" ? $data->principal->username : @$data->principal_role->title'
36 | ),
37 | array(
38 | 'name' => 'action',
39 | 'filter' => $actionfilter,
40 | 'header' => Yum::t('Action'),
41 | 'value' => '$data->Action->title',
42 | ),
43 | array(
44 | 'name' => 'subaction',
45 | 'filter' => $actionfilter,
46 | 'header' => Yum::t('Subaction'),
47 | 'value' => '$data->Subaction->title',
48 | ),
49 | 'comment',
50 | 'Action.comment',
51 | array(
52 | 'class'=>'CButtonColumn',
53 | 'template' => '{delete}',
54 | ),
55 | ),
56 | 'htmlOptions' => array('class' => 'table table-striped table-condensed admin-user'),
57 | )
58 | ); ?>
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/role/views/permission/view.php:
--------------------------------------------------------------------------------
1 | %s', $action->title);
5 | echo Yum::t(
6 | 'The following users have permission to perform the action {action}:',
7 | array(
8 | '{action}' => $action->title));
9 | if($action->permissions) {
10 | foreach($action->permissions as $permission) {
11 | echo '';
12 | if($permission->type == 'user') {
13 | $user = YumUser::model()->findByPk($permission->principal_id);
14 | printf('- %s
', CHtml::link(
15 | $user->username, array('/user/view', 'id' => $user->id)));
16 | }
17 | if($permission->type == 'role') {
18 | $role = YumRole::model()->findByPk($permission->principal_id);
19 | printf('- role %s
', CHtml::link(
20 | $role->title, array('/role/view', 'id' => $role->id)));
21 | }
22 | echo '
';
23 | }
24 | }
25 | } else
26 | echo Yum::t('No user has permission');
27 | ?>
28 |
29 |
--------------------------------------------------------------------------------
/role/views/role/_form.php:
--------------------------------------------------------------------------------
1 |
61 |
62 |
--------------------------------------------------------------------------------
/role/views/role/admin.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Manage roles');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Roles')=>array('index'),
6 | Yum::t('Manage'),
7 | );
8 |
9 | ?>
10 | widget('zii.widgets.grid.CGridView', array(
12 | 'dataProvider'=>$dataProvider,
13 | 'columns'=>array(
14 | array(
15 | 'name' => 'title',
16 | 'type' => 'raw',
17 | 'value'=> 'CHtml::link(CHtml::encode($data->title),
18 | array("//role/role/view","id"=>$data->id))',
19 | ),
20 | 'price',
21 | 'membership_priority',
22 | array(
23 | 'class'=>'CButtonColumn',
24 | ),
25 | ),
26 | )); ?>
27 |
--------------------------------------------------------------------------------
/role/views/role/create.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Create role');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Roles')=>array('index'),
6 | Yum::t('Create'));
7 |
8 | ?>
9 |
10 | renderPartial('_form', array('model'=>$model)); ?>
11 |
--------------------------------------------------------------------------------
/role/views/role/update.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('Update role');
3 |
4 | $this->breadcrumbs=array(
5 | Yum::t('Roles')=>array('index'),
6 | Yum::t('Update'));
7 |
8 | ?>
9 |
10 | renderPartial('_form', array('model'=>$model)); ?>
11 |
--------------------------------------------------------------------------------
/role/views/role/view.php:
--------------------------------------------------------------------------------
1 | title = Yum::t('{role}', array(
3 | '{role}' => $model->title));
4 |
5 | $this->breadcrumbs=array(
6 | Yum::t('Roles')=>array('index'),
7 | Yum::t('View'),
8 | $model->title
9 | );
10 |
11 | echo $model->description;
12 |
13 |
14 | ?>
15 |
16 |
17 |
18 |
19 | widget('zii.widgets.grid.CGridView', array(
22 | 'dataProvider'=>$assignedUsers,
23 | 'columns'=>array(
24 | 'username',
25 | 'status',
26 | ),
27 | ));
28 | ?>
29 |
30 |
31 | membership_priority) {
33 | echo Yum::t('Membership priority') . ': '. $model->membership_priority . '
';
34 | echo Yum::t('Membership price') . ': '. $model->price . '
';
35 | echo Yum::t('Membership duration') . ': '. $model->duration . '
';
36 |
37 | echo Yum::p('These users have a ordered memberships of this role');
38 |
39 | if($activeMemberships)
40 | $this->widget('zii.widgets.grid.CGridView', array(
41 | 'dataProvider'=>$activeMemberships,
42 | 'columns'=>array(
43 | 'id',
44 | 'username',
45 | array(
46 | 'name'=>'order_date',
47 | 'value' =>'date("Y. m. d G:i:s", $data->order_date)'),
48 | array(
49 | 'name'=>'end_date',
50 | 'value' =>'date("Y. m. d G:i:s", $data->end_date)'),
51 | array(
52 | 'name'=>'payment_date',
53 | 'value' =>'date("Y. m. d G:i:s", $data->payment_date)'),
54 | 'role.price',
55 | 'payment.title',
56 | ),
57 | ));
58 |
59 | }
60 |
61 | if(Yii::app()->user->isAdmin())
62 | echo CHtml::Button(Yum::t('Update role'), array(
63 | 'submit' => array(
64 | 'role/update', 'id' => $model->id)));
65 |
66 | ?>
67 |
--------------------------------------------------------------------------------
/user/assets/css/statistics.css:
--------------------------------------------------------------------------------
1 | #users {float: left; width: 300px;margin: 5px 20px;}
2 | #roles {float: left; width: 300px;margin: 5px;}
3 | #profiles {float: left; width: 300px;margin: 5px 20px;}
4 | #messages {float: left; width: 300px;margin: 5px 20px;}
5 |
--------------------------------------------------------------------------------
/user/assets/css/yum.css:
--------------------------------------------------------------------------------
1 | div.form .tooltip { display: none; background-color:#EFFDFF; border:1px solid #79B4DC; padding: 10px; width: 300px; }
2 | .avatar {float:left; margin-right: 5px;}
3 | .yumwarning{background-color: red;color:white;padding:5px;}
4 | label { display: inline }
5 | .checkbox { float: left; margin-right: 5px; }
6 | .listbox { display: inline; }
7 | .membership { float: left;margin: 5px; }
8 | .info {background-color: lightgray; padding: 10px; margin:10px; border: 1px dotted black;}
9 | .new_messages td { border-bottom: 1px solid;}
10 | .tooltip { display: none; padding: 5px; margin: 5px; background-color: #ffa;border: 1px solid #cc9; border-radius: 5px;}
11 | .view_user {float:left; margin:5px;}
12 | .profile_field_selection { float: right; margin: 5px;}
13 | .table_profile_fields { width: 50%; }
14 | .profilefieldlabel { float: left; margin-right: 5px; width: 100px;}
15 | .friend { margin: 5px; }
16 | a.social { text-decoration: none; }
17 | .admin-user select, .admin-user input, .admin-user textarea, .admin-user .uneditable-input { width: 75px !important; }
18 |
--------------------------------------------------------------------------------
/user/assets/images/facebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/facebook.png
--------------------------------------------------------------------------------
/user/assets/images/google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/google.png
--------------------------------------------------------------------------------
/user/assets/images/green_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/green_button.png
--------------------------------------------------------------------------------
/user/assets/images/linkedin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/linkedin.png
--------------------------------------------------------------------------------
/user/assets/images/live.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/live.png
--------------------------------------------------------------------------------
/user/assets/images/livejournal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/livejournal.png
--------------------------------------------------------------------------------
/user/assets/images/myspace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/myspace.png
--------------------------------------------------------------------------------
/user/assets/images/no_avatar_available.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/no_avatar_available.jpg
--------------------------------------------------------------------------------
/user/assets/images/no_avatar_available_thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/no_avatar_available_thumb.jpg
--------------------------------------------------------------------------------
/user/assets/images/openid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/openid.png
--------------------------------------------------------------------------------
/user/assets/images/tumblr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/tumblr.png
--------------------------------------------------------------------------------
/user/assets/images/twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/twitter.png
--------------------------------------------------------------------------------
/user/assets/images/wordpress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/wordpress.png
--------------------------------------------------------------------------------
/user/assets/images/yahoo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/images/yahoo.png
--------------------------------------------------------------------------------
/user/assets/js/tooltip_users.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/assets/js/tooltip_users.js
--------------------------------------------------------------------------------
/user/commands/ImportCommand.php:
--------------------------------------------------------------------------------
1 | db)
16 | throw new CException('No database configured');
17 |
18 | if(!in_array('user', Yii::app()->db->schema->tableNames))
19 | throw new CException('No table "user" found; is yum installed?');
20 |
21 | if(!$file)
22 | throw new CException('No file given');
23 |
24 | $data = file_get_contents($file);
25 |
26 | Yum::import($data, $delimiter, $enclosure, $escape, $roles);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/user/components/CsvGridView.php:
--------------------------------------------------------------------------------
1 | filter!==null)
12 | {
13 | echo "filterCssClass}\">\n";
14 | $i = 0;
15 | $count = count($this->columns);
16 | foreach($this->columns as $column) {
17 | $i++;
18 | if($i == $count)
19 | $this->renderCsvButton();
20 | else
21 | $column->renderFilterCell();
22 | }
23 | echo "
\n";
24 | }
25 | }
26 |
27 | public function renderCsvButton() {
28 | echo CHtml::beginForm(array('//user/csv/select'));
29 | foreach($this->columns as $column)
30 | if(isset($column->name))
31 | echo CHtml::hiddenField($column->name, $column->value);
32 | printf('%s | ', CHtml::submitButton('CSV'));
33 | echo CHtml::endForm();
34 | }
35 |
36 | }
37 | ?>
38 |
--------------------------------------------------------------------------------
/user/components/EPasswordGenerator.php:
--------------------------------------------------------------------------------
1 |
71 |
--------------------------------------------------------------------------------
/user/components/LoginWidget.php:
--------------------------------------------------------------------------------
1 | title === NULL)
12 | $this->title=Yum::t('Login');
13 | parent::init();
14 | }
15 |
16 | protected function renderContent()
17 | {
18 | $this->render($this->view, array('model' => new YumUserLogin()));
19 | }
20 | }
21 | ?>
22 |
--------------------------------------------------------------------------------
/user/components/YumUserIdentity.php:
--------------------------------------------------------------------------------
1 | find('username = :username', array(
17 | ':username' => $this->username));
18 |
19 | // try to authenticate via email
20 | if(Yum::hasModule('profile')
21 | && Yum::module()->loginType & UserModule::LOGIN_BY_EMAIL
22 | && !$user) {
23 | if($profile = YumProfile::model()->find('email = :email', array(
24 | ':email' => $this->username)))
25 | if($profile->user)
26 | $user = $profile->user;
27 | }
28 |
29 | if(!$user)
30 | return self::ERROR_STATUS_USER_DOES_NOT_EXIST;
31 |
32 | if($user->status == YumUser::STATUS_INACTIVE)
33 | $this->errorCode=self::ERROR_STATUS_INACTIVE;
34 | else if($user->status == YumUser::STATUS_BANNED)
35 | $this->errorCode=self::ERROR_STATUS_BANNED;
36 | else if($user->status == YumUser::STATUS_REMOVED)
37 | $this->errorCode=self::ERROR_STATUS_REMOVED;
38 | else if($without_password)
39 | $this->credentialsConfirmed($user);
40 | else if(!CPasswordHelper::verifyPassword($this->password, $user->password))
41 | $this->errorCode=self::ERROR_PASSWORD_INVALID;
42 | else
43 | $this->credentialsConfirmed($user);
44 | return !$this->errorCode;
45 | }
46 |
47 | function credentialsConfirmed($user) {
48 | $this->id = $user->id;
49 | $this->setState('id', $user->id);
50 | $this->username = $user->username;
51 | $this->errorCode=self::ERROR_NONE;
52 | }
53 |
54 | /**
55 | * @return integer the ID of the user record
56 | */
57 | public function getId()
58 | {
59 | return $this->id;
60 | }
61 |
62 | public function getRoles()
63 | {
64 | return $this->Role;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/user/components/select2/.gitignore:
--------------------------------------------------------------------------------
1 | /nbproject/
--------------------------------------------------------------------------------
/user/components/select2/assets/component.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "select2",
3 | "version": "3.3.0",
4 | "main": ["select2.js", "select2.css", "select2.png", "select2x2.png", "spinner.gif"],
5 | "dependencies": {
6 | "jquery": "~1.4.4"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/user/components/select2/assets/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | echo -n "Enter the version for this release: "
5 |
6 | read ver
7 |
8 | if [ ! $ver ]; then
9 | echo "Invalid version."
10 | exit
11 | fi
12 |
13 | name="select2"
14 | js="$name.js"
15 | mini="$name.min.js"
16 | css="$name.css"
17 | release="$name-$ver"
18 | tag="$ver"
19 | branch="build-$ver"
20 | curbranch=`git branch | grep "*" | sed "s/* //"`
21 | timestamp=$(date)
22 | tokens="s/@@ver@@/$ver/g;s/\@@timestamp@@/$timestamp/g"
23 | remote="github"
24 |
25 | echo "Updating Version Identifiers"
26 |
27 | sed -E -e "s/\"version\": \"([0-9\.]+)\",/\"version\": \"$ver\",/g" -i "" component.json select2.jquery.json
28 | git add component.json
29 | git add select2.jquery.json
30 | git commit -m "modified version identifiers in descriptors for release $ver"
31 | git push
32 |
33 | git branch "$branch"
34 | git checkout "$branch"
35 |
36 | echo "Tokenizing..."
37 |
38 | find . -name "$js" | xargs -I{} sed -e "$tokens" -i "" {}
39 | find . -name "$css" | xargs -I{} sed -e "$tokens" -i "" {}
40 | sed -e "s/latest/$ver/g" -i "" component.json
41 |
42 | git add "$js"
43 | git add "$css"
44 |
45 | echo "Minifying..."
46 |
47 | echo "/*" > "$mini"
48 | cat LICENSE | sed "$tokens" >> "$mini"
49 | echo "*/" >> "$mini"
50 |
51 | curl -s \
52 | -d compilation_level=SIMPLE_OPTIMIZATIONS \
53 | -d output_format=text \
54 | -d output_info=compiled_code \
55 | --data-urlencode "js_code@$js" \
56 | http://closure-compiler.appspot.com/compile \
57 | >> "$mini"
58 |
59 | git add "$mini"
60 |
61 | git commit -m "release $ver"
62 |
63 | echo "Tagging..."
64 | git tag -a "$tag" -m "tagged version $ver"
65 | git push "$remote" --tags
66 |
67 | echo "Cleaning Up..."
68 |
69 | git checkout "$curbranch"
70 | git branch -D "$branch"
71 |
72 | echo "Done"
73 |
--------------------------------------------------------------------------------
/user/components/select2/assets/select2-spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/components/select2/assets/select2-spinner.gif
--------------------------------------------------------------------------------
/user/components/select2/assets/select2.jquery.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "select2",
3 | "title": "Select2",
4 | "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.",
5 | "keywords": [
6 | "select",
7 | "autocomplete",
8 | "typeahead",
9 | "dropdown",
10 | "multiselect",
11 | "tag",
12 | "tagging"
13 | ],
14 | "version": "3.3.0",
15 | "author": {
16 | "name": "Igor Vaynberg",
17 | "url": "https://github.com/ivaynberg"
18 | },
19 | "licenses": [
20 | {
21 | "type": "Apache",
22 | "url": "http://www.apache.org/licenses/LICENSE-2.0"
23 | },
24 | {
25 | "type": "GPL v2",
26 | "url": "http://www.gnu.org/licenses/gpl-2.0.html"
27 | }
28 | ],
29 | "bugs": "https://github.com/ivaynberg/select2/issues",
30 | "homepage": "http://ivaynberg.github.com/select2",
31 | "docs": "http://ivaynberg.github.com/select2/",
32 | "download": "https://github.com/ivaynberg/select2/tags",
33 | "dependencies": {
34 | "jquery": ">=1.4.6"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/user/components/select2/assets/select2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/components/select2/assets/select2.png
--------------------------------------------------------------------------------
/user/components/select2/assets/select2_locale_it.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Select2 Italian translation
3 | */
4 | (function ($) {
5 | "use strict";
6 |
7 | $.extend($.fn.select2.defaults, {
8 | formatNoMatches: function () { return "Nessuna corrispondenza trovata"; },
9 | formatInputTooShort: function (input, min) { var n = min - input.length; return "Inserisci ancora " + n + " caratter" + (n == 1? "e" : "i"); },
10 | formatInputTooLong: function (input, max) { var n = input.length - max; return "Inserisci " + n + " caratter" + (n == 1? "e" : "i") + " in meno"; },
11 | formatSelectionTooBig: function (limit) { return "Puoi selezionare solo " + limit + " element" + (limit == 1 ? "o" : "i"); },
12 | formatLoadMore: function (pageNumber) { return "Caricamento in corso..."; },
13 | formatSearching: function () { return "Ricerca..."; }
14 | });
15 | })(jQuery);
--------------------------------------------------------------------------------
/user/components/select2/assets/select2x2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/components/select2/assets/select2x2.png
--------------------------------------------------------------------------------
/user/components/select2/assets/spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thyseus/yii-user-management/fc27335c89f04a443fd057c16e6b0c6ecff241aa/user/components/select2/assets/spinner.gif
--------------------------------------------------------------------------------
/user/components/select2/messages/id/select2.php:
--------------------------------------------------------------------------------
1 | 'Tidak diketemukan hasil',
4 | 'Please enter {chars} more characters' => 'Mohon memasukkan karakter lebih dari {chars}',
5 | 'Please enter {chars} less characters' => 'Mohon memasukkan karakter kurang dari {chars}',
6 | 'You can only select {count} items' => 'Anda hanya dapat memilih {count} item',
7 | 'Loading more results...' => 'Memuat lebih banyak hasil...',
8 | 'Searching...' => 'Mencari...',
9 | );
10 |
--------------------------------------------------------------------------------
/user/components/select2/messages/pl/select2.php:
--------------------------------------------------------------------------------
1 | 'Brak wyników szukania',
4 | 'Please enter {chars} more characters' => 'Proszę wprowadzić jeszcze {chars} znaków',
5 | 'You can only select {count} items' => 'Można wybrac tylko {count} pozycji',
6 | 'Loading more results...' => 'Ładowanie pozostałych wyników',
7 | 'Searching...' => 'Szukanie...',
8 | );
9 |
--------------------------------------------------------------------------------
/user/components/views/quicklogin.php:
--------------------------------------------------------------------------------
1 | controller->uniqueid .
5 | '/' . Yii::app()->controller->action->id;
6 | echo CHtml::hiddenField('quicklogin', $link);
7 | ?>
8 |
9 |
10 |
11 |
12 |
13 |
14 | 10)) ?>
15 |
16 |
17 |
18 |
19 |
20 |
21 | 10)); ?>
22 |
23 |
24 |
25 |
26 |
27 | enableRecovery)
30 | echo CHtml::link(Yum::t('Lost password?'),
31 | Yum::module('registration')->recoveryUrl); ?>
32 |
33 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/user/controllers/YumController.php:
--------------------------------------------------------------------------------
1 | end();
23 | }
24 | }
25 |
26 | public function beforeAction($action) {
27 | if(Yum::module()->enableOnlineStatus && !Yii::app()->user->isGuest)
28 | Yii::app()->user->data()->setLastAction();
29 |
30 | if(Yum::module()->enableBootstrap)
31 | Yum::register('css/bootstrap.min.css');
32 |
33 |
34 | return parent::beforeAction($action);
35 | }
36 |
37 | public function loadModel($model = false) {
38 | if(!$model)
39 | $model = str_replace('Controller', '', get_class($this));
40 |
41 | if($this->_model === null) {
42 | if(isset($_GET['id']))
43 | $this->_model = CActiveRecord::model($model)->findByPk($_GET['id']);
44 |
45 | if($this->_model===null && !is_numeric($_GET['id']))
46 | @$this->_model = CActiveRecord::model($model)->find(
47 | 'name = :name', array(':name' => $_GET['id']));
48 |
49 | if($this->_model===null)
50 | throw new CHttpException(404,
51 | Yii::t('app', 'The requested page does not exist.'));
52 | }
53 | return $this->_model;
54 | }
55 |
56 | public function renderMenu() {
57 | if(Yii::app()->user->isAdmin())
58 | $this->widget('YumAdminMenu');
59 | else if(!Yii::app()->user->isGuest)
60 | $this->widget('YumUserMenu');
61 | }
62 |
63 | public function filters()
64 | {
65 | return array(
66 | 'accessControl',
67 | );
68 | }
69 | }
70 | ?>
71 |
--------------------------------------------------------------------------------
/user/controllers/YumCsvController.php:
--------------------------------------------------------------------------------
1 | array('select', 'export', 'import'),
11 | 'expression' => 'Yii::app()->user->isAdmin()'
12 | ),
13 | array('deny', // deny all other users
14 | 'users'=>array('*'),
15 | ),
16 | );
17 | }
18 |
19 | public function actionImport() {
20 | if(isset($_FILES['filename']) && isset($_FILES['filename']['name'])) {
21 | if (is_uploaded_file($_FILES['filename']['tmp_name']))
22 | $fileData = file_get_contents($_FILES['filename']['tmp_name']);
23 | var_dump($fileData);
24 | }
25 |
26 | $this->render('import');
27 | }
28 |
29 | public function actionExport() {
30 | if(isset($_POST['profile_fields'])) {
31 |
32 | $fields = '';
33 | foreach($_POST['profile_fields'] as $field)
34 | $fields .= $field .',';
35 | $fields = substr($fields, 0, -1);
36 |
37 | Yii::import('user.components.CSVExport');
38 | $sql = sprintf('select %s from %s where %s',
39 | $fields,
40 | Yum::module('profile')->profileTable,
41 | Yum::module()->customCsvExportCriteria);
42 | $result = Yii::app()->db->createCommand($sql)->queryAll();
43 | $csv = new CSVExport($result);
44 | $content = $csv->toCSV();
45 | $filename = Yii::app()->basePath.'/runtime/yum_user_export.csv';
46 | $content = $csv->toCSV($filename, ",", "\"");
47 | Yii::app()->getRequest()->sendFile(basename($filename),
48 | @file_get_contents($filename),
49 | "text/csv", false);
50 | exit();
51 | }
52 | }
53 |
54 | public function actionSelect() {
55 | $profile = new YumProfile;
56 | $this->render('select', array(
57 | 'user' => new YumUser,
58 | 'profile_fields' => $profile->getProfileFields(),
59 | ));
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/user/controllers/YumDefaultController.php:
--------------------------------------------------------------------------------
1 | array('index'),
13 | 'users'=>array('*'),
14 | ),
15 | #deny all other users
16 | array('deny',
17 | 'users'=>array('*'),
18 | ),
19 | );
20 | }
21 |
22 | public function actionIndex() {
23 | $this->redirect($this->module->returnLogoutUrl);
24 | }
25 | }
26 |
27 | ?>
28 |
--------------------------------------------------------------------------------
/user/controllers/YumStatisticsController.php:
--------------------------------------------------------------------------------
1 | array('index'),
11 | 'users'=>array(Yii::app()->user->name ),
12 | 'expression' => 'Yii::app()->user->isAdmin()'
13 | ),
14 | array('deny', 'users'=>array('*')));
15 | }
16 |
17 | public function actions()
18 | {
19 | return array('index');
20 | }
21 |
22 | public function actionIndex()
23 | {
24 | $this->layout = Yum::module()->adminLayout;
25 | //$this->layout = Yum::module()->baseLayout;
26 | $this->render('statistics', array(
27 | 'total_users' => YumUser::model()->count(),
28 | 'active_users' => YumUser::model()->count('status = '.YumUser::STATUS_ACTIVE),
29 | 'todays_registered_users' => YumUser::model()->count('createtime >= '.strtotime(date('Y-m-d'))),
30 | 'inactive_users' => YumUser::model()->count('status = '.YumUser::STATUS_INACTIVE),
31 | 'banned_users' => YumUser::model()->count('status = '.YumUser::STATUS_BANNED),
32 | 'admin_users' => YumUser::model()->count('superuser = 1'),
33 | // 'roles' => YumRole::model()->count(),
34 | // 'profiles' => YumProfile::model()->count(),
35 | // 'profile_fields' => YumProfileField::model()->count(),
36 | // 'profile_field_groups' => YumProfileFieldsGroup::model()->count(),
37 | // 'profile_views' => YumProfileVisit::model() !== false ? YumProfileVisit::model()->count() : null,
38 | // 'messages' => YumMessage::model()->count(),
39 | 'logins_today' => $this->loginsToday(),
40 | ));
41 | }
42 |
43 | public function getStartOfDay($time = 0)
44 | {
45 | if($time == 0)
46 | $time = time();
47 | $hours = date("G", $time);
48 | $minutes = date("i", $time);
49 | $seconds = date("s", $time);
50 |
51 | $temp = $time;
52 | $temp -= ($hours * 3600);
53 | $temp -= ($minutes * 60);
54 | $temp -= $seconds;
55 |
56 | $today = $temp;
57 | $first = $today;
58 |
59 | return $first;
60 | }
61 |
62 |
63 | public function loginsToday()
64 | {
65 | $day = $this->getStartOfDay(time());
66 | return YumUser::model()->count(
67 | 'lastvisit > :begin and lastvisit < :end', array(
68 | ':begin' => $day,
69 | ':end' => $day + 86400));
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/user/docs/RESTful_api.txt:
--------------------------------------------------------------------------------
1 | since yii-user-management 0.8rc2 there is a RESTful Api implemented.
2 |
3 | To use it, first read this:
4 |
5 | http://www.yiiframework.com/wiki/175/how-to-create-a-rest-api/
6 | http://www.gen-x-design.com/archives/create-a-rest-api-with-php/
7 |
8 | Thanks to the first wiki article, from which i borrowed most of the code.
9 |
10 | Then, add this lines (for example) to your UrlManager rules:
11 |
12 | 'urlManager'=>array(
13 | 'rules'=>array(
14 | array('//user/rest/list', 'pattern' => 'rest/', 'verb' => 'GET'),
15 | array('//user/rest/view', 'pattern' => 'rest//', 'verb' => 'GET'),
16 | array('//user/rest/create', 'pattern'=>'rest/create/', 'verb'=>'POST'),
17 | array('//user/rest/update', 'pattern'=>'rest/update//', 'verb'=>'PUT'),
18 |
19 |
20 |
21 | [ ... other rules ]
22 |
23 |
24 | Please note that admin:admin needs to be a correct user/password combination
25 | and that the user needs to be a superuser (superuser = true) in the user table
26 |
27 | Now, you can access the data this way:
28 |
29 | List all Users:
30 |
31 | curl --user admin:admin http://path/to/webapp/index.php/rest/users
32 |
33 | List user with id 2:
34 |
35 | curl --user admin:admin http://path/to/webapp/index.php/rest/user/2
36 |
37 | Create a new User. Note that, if the profile module is enabled, the profile
38 | must be validated, otherwise the user will not be inserted.
39 | Also note, that the user will be created using YumUser::register(). This
40 | means, that the user is _deactivated_ by default. If you want to activate
41 | him, call a PUT request after the user is created:
42 |
43 | curl --user admin:admin --data "username=johndoe&password=secret&email=e@mail.de&firstname=Jon&lastname=Doe" http://path/to/webapp/index.php/rest/create/user
44 |
45 | Update the user with the id 8. Change the username to "another_one"
46 |
47 | curl --user admin:admin -X PUT -d "username=another_one" http://path/to/webapp/index.php/rest/update/user/
48 |
49 |
50 | To disable the RESTful api, set 'enableRestfulApi' => false in the application configuration.
51 |
--------------------------------------------------------------------------------
/user/docs/avatar.txt:
--------------------------------------------------------------------------------
1 | To enable the Avatar upload, simply enable the 'avatar' module in your
2 | application configuration like this:
3 |
4 |
5 | 'modules' => array(
6 | 'avatar' => array(
7 | [...]
8 | ),
9 | 'user' => array(
10 | [...]
11 | )
12 | );
13 |
14 | Location of avatar images:
15 | By default, the avatar images are loaded into the 'images' directory in the root of your Yii application.
16 | You can change this location using the 'avatarPath' configuration option. Be sure to set the permissions
17 | of this directory so that the web server can write to it.
18 |
19 | See the file avatar/AvatarModule.php for possible configuration options.
20 |
21 |
--------------------------------------------------------------------------------
/user/docs/hybridauth.txt:
--------------------------------------------------------------------------------
1 | Using hybridauth with yii-user-management:
2 |
3 | 0.) Read the Hybrid Auth User Guide to get an idea of what we are doing here:
4 | http://hybridauth.sourceforge.net/userguide.html
5 |
6 | 1.) Configure 'loginType' in UserModule configuration to include 'hybridauth' in your
7 | application config/main.php. For example, set 'loginType' to 7, to allow login by
8 | username, email and hybridauth. Make sure to enable the profile submodule.
9 |
10 | 2.) Select the providers you want to use in the 'hybridAuthProviders' array. For example,
11 | to use Facebook and Twitter, set this variable to array('Facebook', 'Twitter')
12 |
13 | 3.) Take the modules/user/vendors/index.php, rename it to 'hybridauth.php' and place it
14 | beside your application index.php bootstrap script. This will be your hybrid auth
15 | entry script.
16 |
17 | 4.) Configure and place your hybridauth configuration file. Set the base_url
18 | to the hybridauth.php script configured above.
19 |
20 | 5.) Place the hybrid auth configuration file into your application
21 | protected/config/hybridauth.php. If necessary, this path can be configured with
22 | the hybridAuthConfigFile option. You can use the example provided by
23 | hybridauth in user/vendors/hybridauth/config.php to get started.
24 |
25 | 6.) Navigate to your login page. The configured providers should appear beneath
26 | the login fields.
27 |
--------------------------------------------------------------------------------
/user/docs/logging.txt:
--------------------------------------------------------------------------------
1 | Logging is availabe since yii-user-management 0.8. All information is logged
2 | to the loglevel 'info'. In a default Yii Application, only the loglevels
3 | error and warning are being logged, so we need to add the info level
4 | to the CLogRoute whereever we want user information to be written to, like
5 | this:
6 |
7 | 'log'=>array(
8 | 'class'=>'CLogRouter',
9 | 'routes'=>array(
10 | array(
11 | 'class'=>'CFileLogRoute',
12 | 'levels'=>'error, warning, info',
13 | ),
14 | array(
15 | 'class'=>'CWebLogRoute',
16 | ),
17 | ),
18 |
19 |
20 |
21 | Wrong login attempts will always be logged to the log info 'error' so
22 | a admin can get informed when too many wrong attempts are made for a
23 | specific user:
24 |
25 | array(
26 | 'class'=>'CEmailLogRoute',
27 | 'levels'=>'error',
28 | 'categories' => 'user.*',
29 | 'emails' => 'emergency_admin@example.com'
30 | ),
31 |
32 |
33 | If we want to log our Information to the database, we use the CDbLogRoute like this:
34 |
35 | array(
36 | 'class'=>'CDbLogRoute',
37 | 'connectionID' => 'db',
38 | 'levels'=>'error, warning, info',
39 | 'categories' => 'user.*',
40 | 'logTableName' => 'user_activities'
41 | ),
42 |
43 | and possibly:
44 | array(
45 | 'class'=>'CDbLogRoute',
46 | 'connectionID' => 'db',
47 | 'logTableName' => 'all_other_activities_including_user_activities'
48 | ),
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/user/docs/membership.txt:
--------------------------------------------------------------------------------
1 | How the membership system in yii-user-management works:
2 |
3 | 1.) Define your membership as roles (see the example 'business'
4 | and 'premium' account)
5 |
6 | 2.) Set priorities. higher is more-valued. This is used to determine to which
7 | account types a user can up/downgrade. If you only have one premium account,
8 | set it to 1
9 |
10 | 3.) define the price and the duration in days of your membership
11 |
12 | 4.) place a function call YumMembership::syncMemberships(); somewhere.
13 |
14 | For example:
15 |
16 | 4.1) bad: at every request (just place the line in your layouts/main.php)
17 |
18 | 4.2) good: if your server configuration allows it, place a cron job that
19 | runs every 5 minutes and checks, if user accounts have been expired
20 |
21 | both are fine, but you are adding ~1 millisecond to your request response time
22 | when choosing the first variant
23 |
--------------------------------------------------------------------------------
/user/docs/messages.txt:
--------------------------------------------------------------------------------
1 | To enable the Message subsystem, simply enable the 'messages' module in your
2 | application configuration like this:
3 |
4 |
5 | 'modules' => array(
6 | 'message' => array(
7 | [...]
8 | ),
9 | 'user' => array(
10 | [...]
11 | )
12 | );
13 |
14 |
15 | See the file message/MessageModule.php for possible configuration options.
16 |
17 |
18 |
--------------------------------------------------------------------------------
/user/docs/messages_daily_digest.txt:
--------------------------------------------------------------------------------
1 | how to use the 'daily digest' (or other time-range) feature in Yum:
2 |
3 |
4 |
--------------------------------------------------------------------------------
/user/docs/permission_system.txt:
--------------------------------------------------------------------------------
1 | The Yii User Management Module version 0.8 introduces a new Permission System.
2 |
3 | This document will describe the basics of the configuration and usage, since
4 | it is neither a pure RBAC nor a ACL based system. It is relatively simple,
5 | tough.
6 |
7 | At first, we have the classical roles. A User can be in none, one or many
8 | roles.
9 |
10 | Then, we have the permission. A Permission can be either granted to a specific
11 | user or to a Role, in which case the permission is granted for every User
12 | in the role. A Permission furthermore has a assigned action, that specifies,
13 | to which action a user is allowed.
14 |
15 | For example, if we assign the user 'Bob' the permission to run a action
16 | 'removeUsers', we can check if Bob has the permission by:
17 |
18 | if(YumUser::model()->find('username = bob')->can('removeUsers')) { ...
19 |
20 | A Permission can have a Subordinate. With this feature, you can
21 | further restrict, what a action can affect.
22 |
23 | A Permission can also have a Subaction. For example, to check if the current
24 | user can remove users:
25 |
26 | if(Yii::app()->user->can('User', 'remove')) { ...
27 |
28 | A Membership system is also available. A membership acts as a temporary
29 | role assignment to a user that expires after some time.
30 |
--------------------------------------------------------------------------------
/user/docs/testing.txt:
--------------------------------------------------------------------------------
1 | Since Yum 0.8 a set of unit tests is being shipped to test portions of your
2 | Application. The Unit-Tests are included in the tests/unit folder.
3 |
4 | In order to use them, simply copy them over to you application-specific
5 | unit test folder (webroot/protected/tests/unit) and run them with phpunit. See
6 |
7 | http://www.yiiframework.com/doc/guide/1.1/en/test.overview
8 | http://www.yiiframework.com/doc/guide/1.1/en/test.unit
9 |
10 | on how unit test works.
11 |
--------------------------------------------------------------------------------
/user/docs/upgrade.txt:
--------------------------------------------------------------------------------
1 | Upgrading Yii User Management Module (Yum) since Version 0.6
2 |
3 | From ver. 0.5 to 0.6
4 | - UserModule::disableEmailActivation has been renamed to
5 | UserModule::enableEmailActivation (default to true)
6 | - Following models were renamed to avoid conflicts when using Yum as submodule:
7 | * Messages => YumMessages,
8 | * Profile => YumProfile,
9 | * ProfileField => YumProfileField,
10 | * RegistrationForm => YumRegistrationForm,
11 | * Role => YumRole
12 | * User => YumUser,
13 | * UserChangePassword => YumUserChangePassword,
14 | * UserLogin => YumUserLogin,
15 | * UserRecoveryForm => YumUserRecoveryForm
16 | Note that this change in some cases may break the code.
17 | - Following components were renamed to avoid conflicts when using Yum as submodule:
18 | * UserIdentity => YumUserIdentity,
19 | * WebUser => YumWebUser,
20 | Note that this change in some cases may break the code.
21 | - Following controllers were renamed to avoid conflicts when using Yum as submodule
22 | * DefaultController => YumDefaultController,
23 | * InstallController => YumInstallcontroller,
24 | * MessageController => YumMessageController,
25 | * RoleController => YumRoleController,
26 | * UserController => YumUserController,
27 |
--------------------------------------------------------------------------------
/user/messages/de/yum_action.php:
--------------------------------------------------------------------------------
1 | 'Aktionen verwalten',
3 | 'Create Action' => 'Aktion hinzufügen',
4 | );
5 | ?>
6 |
--------------------------------------------------------------------------------
/user/messages/de/yum_registration.php:
--------------------------------------------------------------------------------
1 | 'Ihr Zugang wurde aktiviert',
4 | 'Activation did not work' => 'Die Aktivierung ist fehlgeschlagen',
5 | 'The user is already activated' => 'Der Benutzer ist bereits aktiviert',
6 | 'Wrong activation Key' => 'Falscher Aktivierungsschlüssel',
7 | 'Instructions have been sent to you. Please check your email.' => 'Ihnen wurde eine E-Mail mit einem Aktivierungslink zugesendet. Bitte überprüfen Sie Ihr E-Mail Postfach. '
8 | );
9 | ?>
10 |
--------------------------------------------------------------------------------
/user/messages/de/yum_yumTextSettings.php:
--------------------------------------------------------------------------------
1 | 'Texte bearbeiten',
4 | );
5 | ?>
6 |
--------------------------------------------------------------------------------
/user/models/YumActiveRecord.php:
--------------------------------------------------------------------------------
1 | enableAuditTrail)
20 | $behaviors = array_merge($behaviors, array(
21 | 'LoggableBehavior' => 'user.auditTrail.behaviors.LoggableBehavior')
22 | );
23 |
24 | return $behaviors;
25 | }
26 |
27 | public function limit($limit = 10)
28 | {
29 | $this->getDbCriteria()->mergeWith(array(
30 | 'limit' => $limit,
31 | ));
32 | return $this;
33 | }
34 |
35 | public function order($order = 'id')
36 | {
37 | $this->getDbCriteria()->mergeWith(array(
38 | 'order' => $order,
39 | ));
40 | return $this;
41 | }
42 |
43 |
44 | /**
45 | * @return CActiveRecordMetaData the meta for this AR class.
46 | */
47 | public function getMetaData( )
48 | {
49 | $md = parent::getMetaData( );
50 | if($this->getScenario()==='search')
51 | {
52 | $md->attributeDefaults = array ();
53 | }
54 |
55 | return $md;
56 | }
57 |
58 | }
59 | ?>
60 |
--------------------------------------------------------------------------------
/user/models/YumFormModel.php:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/user/models/YumTranslation.php:
--------------------------------------------------------------------------------
1 | _tableName = Yum::module()->translationTable;
15 | return $this->_tableName;
16 | }
17 |
18 | public function rules()
19 | {
20 | return array(
21 | array('message, translation, language', 'required'),
22 | array('category', 'default', 'setOnEmpty' => true, 'value' => null),
23 | array('message, translation, category', 'length', 'max'=>255),
24 | array('language', 'length', 'max'=>5),
25 | array('message, translation, language, category', 'safe', 'on'=>'search'),
26 | );
27 | }
28 |
29 | public function relations()
30 | {
31 | return array(
32 | );
33 | }
34 |
35 | public function attributeLabels()
36 | {
37 | return array(
38 | 'message' => Yum::t('Message'),
39 | 'translation' => Yum::t('Translation'),
40 | 'language' => Yum::t('Language'),
41 | 'category' => Yum::t('Category'),
42 | );
43 | }
44 |
45 | public function search()
46 | {
47 | $criteria=new CDbCriteria;
48 |
49 | $criteria->compare('message', $this->message, true);
50 | $criteria->compare('translation', $this->translation, true);
51 | $criteria->compare('language', $this->language, true);
52 | $criteria->compare('category', $this->category, true);
53 |
54 | return new CActiveDataProvider(get_class($this), array(
55 | 'criteria'=>$criteria,
56 | ));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/user/models/YumUserChangePassword.php:
--------------------------------------------------------------------------------
1 | passwordRequirements;
22 | $passwordrule = array_merge(array(
23 | 'password', 'YumPasswordValidator'), $passwordRequirements);
24 | $rules[] = $passwordrule;
25 | $rules[] = array('currentPassword', 'safe');
26 | $rules[] = array('currentPassword', 'required', 'on' => 'user_request');
27 | $rules[] = array('password, verifyPassword', 'required');
28 | $rules[] = array('password', 'compare', 'compareAttribute' =>'verifyPassword', 'message' => Yum::t('Retyped password is incorrect'));
29 |
30 | return $rules;
31 | }
32 |
33 | public function attributeLabels() {
34 | return array(
35 | 'password'=>Yum::t('New password'),
36 | 'verifyPassword'=>Yum::t('Retype your new password'),
37 | 'currentPassword'=>Yum::t('Your current password'),
38 | );
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/user/models/YumUserLogin.php:
--------------------------------------------------------------------------------
1 | scenario))
21 | $this->scenario = 'login';
22 |
23 | $rules = array(
24 | array('username, password', 'required', 'on' => 'login'),
25 | array('rememberMe', 'boolean'),
26 | );
27 |
28 | if(Yum::module()->captchaAfterUnsuccessfulLogins !== false) {
29 | $rules[] = array( 'verifyCode', 'captcha', 'on' => 'captcha',
30 | 'allowEmpty' => !CCaptcha::checkRequirements(),
31 | );
32 | $rules[] = array('username, password', 'required', 'on' => 'captcha');
33 | }
34 |
35 | return $rules;
36 | }
37 |
38 | public function attributeLabels() {
39 | return array(
40 | 'username'=>Yum::t("Username"),
41 | 'password'=>Yum::t("Password"),
42 | 'rememberMe'=>Yum::t("Remember me next time"),
43 | 'verifyCode'=>Yum::t("Verification code"),
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/user/tests/unit/RegistrationTest.php:
--------------------------------------------------------------------------------
1 | controller = new YumRegistrationController('registration');
14 |
15 | $user = new YumRegistrationForm;
16 |
17 | $user->username = 'no whitespaces allowed';
18 | $this->assertFalse($user->validate());
19 |
20 | $user->username = 'allowed';
21 | $user->password = 'notthesame';
22 | $user->password = 'emasehtton';
23 | $this->assertFalse($user->validate());
24 |
25 | $user->setAttributes(array(
26 | 'username' => 'A_Testuser',
27 | 'password' => 'hiddenpassword1',
28 | 'verifyPassword' => 'hiddenpassword1',
29 | ));
30 | $this->assertTrue($user->validate());
31 |
32 | $profile = new YumRegistrationForm;
33 | $profile->setAttributes(array(
34 | 'firstname' => 'My first Name !"§$%&/()=',
35 | 'lastname' => 'My last Name !"§$%&/()=',
36 | 'password' => 'hiddenpassword1',
37 | 'verifyPassword' => 'hiddenpassword1',
38 |
39 | ));
40 | $profile->setAttributes($user->getAttributes());
41 | $this->assertTrue($profile->validate());
42 |
43 | // it is good that $_POST is bloated here because we want to test if
44 | // only safe Attributes are being assigned:
45 | $_POST['YumRegistrationForm'] = $user->getAttributes();
46 | $_POST['YumProfile'] = $profile->getAttributes();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/Providers/AOL.php:
--------------------------------------------------------------------------------
1 | api->api_base_url = "https://disqus.com/api/3.0/";
25 | $this->api->authorize_url = "https://disqus.com/api/3.0/oauth/2.0/authorize";
26 | $this->api->token_url = "https://disqus.com/api/3.0/oauth/2.0/access_token";
27 |
28 | $this->api->curl_header = array( 'client_id: ' . $this->config["keys"]["id"], 'Accept: application/json' );
29 | }
30 |
31 | /**
32 | * load the user profile from the IDp api client
33 | */
34 | function getUserProfile()
35 | {
36 | $data = $this->api->get( "users/details" );
37 | print_r($data);
38 | if ( ! isset( $data->code ) ){
39 | throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
40 | } else if ( $data->code != 0 ){
41 | throw new Exception( "User profile request failed! {$this->providerId} returned error code".$data->code.".", 6 );
42 | }
43 |
44 | $this->user->profile->identifier = @ $data->id;
45 | $this->user->profile->displayName = @ $data->name;
46 | $this->user->profile->description = @ $data->bio;
47 | $this->user->profile->photoURL = @ $data->avatar_url;
48 | $this->user->profile->profileURL = @ $data->html_url;
49 | $this->user->profile->email = @ $data->email;
50 | $this->user->profile->webSiteURL = @ $data->blog;
51 | $this->user->profile->region = @ $data->location;
52 |
53 | if( ! $this->user->profile->displayName ){
54 | $this->user->profile->displayName = @ $data->login;
55 | }
56 |
57 | return $this->user->profile;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/Providers/Foursquare.php:
--------------------------------------------------------------------------------
1 | api->api_base_url = "https://api.foursquare.com/v2/";
24 | $this->api->authorize_url = "https://foursquare.com/oauth2/authenticate";
25 | $this->api->token_url = "https://foursquare.com/oauth2/access_token";
26 |
27 | $this->api->sign_token_name = "oauth_token";
28 | }
29 |
30 | /**
31 | * load the user profile from the IDp api client
32 | */
33 | function getUserProfile()
34 | {
35 | $data = $this->api->api( "users/self" );
36 |
37 | if ( ! isset( $data->response->user->id ) ){
38 | throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
39 | }
40 |
41 | $data = $data->response->user;
42 |
43 | $this->user->profile->identifier = $data->id;
44 | $this->user->profile->firstName = $data->firstName;
45 | $this->user->profile->lastName = $data->lastName;
46 | $this->user->profile->displayName = trim( $this->user->profile->firstName . " " . $this->user->profile->lastName );
47 | $this->user->profile->photoURL = $data->photo;
48 | $this->user->profile->profileURL = "https://www.foursquare.com/user/" . $data->id;
49 | $this->user->profile->gender = $data->gender;
50 | $this->user->profile->city = $data->homeCity;
51 | $this->user->profile->email = $data->contact->email;
52 | $this->user->profile->emailVerified = $data->contact->email;
53 |
54 | return $this->user->profile;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/Providers/GitHub.php:
--------------------------------------------------------------------------------
1 | public read-only access (includes public user profile info, public repo info, and gists).
15 | public $scope = "";
16 |
17 | /**
18 | * IDp wrappers initializer
19 | */
20 | function initialize()
21 | {
22 | parent::initialize();
23 |
24 | // Provider api end-points
25 | $this->api->api_base_url = "https://api.github.com/";
26 | $this->api->authorize_url = "https://github.com/login/oauth/authorize";
27 | $this->api->token_url = "https://github.com/login/oauth/access_token";
28 | }
29 |
30 | /**
31 | * load the user profile from the IDp api client
32 | */
33 | function getUserProfile()
34 | {
35 | $data = $this->api->api( "user" );
36 |
37 | if ( ! isset( $data->id ) ){
38 | throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
39 | }
40 |
41 | $this->user->profile->identifier = @ $data->id;
42 | $this->user->profile->displayName = @ $data->name;
43 | $this->user->profile->description = @ $data->bio;
44 | $this->user->profile->photoURL = @ $data->avatar_url;
45 | $this->user->profile->profileURL = @ $data->html_url;
46 | $this->user->profile->email = @ $data->email;
47 | $this->user->profile->webSiteURL = @ $data->blog;
48 | $this->user->profile->region = @ $data->location;
49 |
50 | if( ! $this->user->profile->displayName ){
51 | $this->user->profile->displayName = @ $data->login;
52 | }
53 |
54 | return $this->user->profile;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/Providers/Instagram.php:
--------------------------------------------------------------------------------
1 | api->api_base_url = "https://api.instagram.com/v1/";
25 | $this->api->authorize_url = "https://api.instagram.com/oauth/authorize/";
26 | $this->api->token_url = "https://api.instagram.com/oauth/access_token";
27 | }
28 |
29 | /**
30 | * load the user profile from the IDp api client
31 | */
32 | function getUserProfile(){
33 | $data = $this->api->api("users/self/" );
34 |
35 | if ( $data->meta->code != 200 ){
36 | throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
37 | }
38 |
39 | $this->user->profile->identifier = $data->data->id;
40 | $this->user->profile->displayName = $data->data->full_name ? $data->data->full_name : $data->data->username;
41 | $this->user->profile->description = $data->data->bio;
42 | $this->user->profile->photoURL = $data->data->profile_picture;
43 |
44 | $this->user->profile->webSiteURL = $data->data->website;
45 |
46 | return $this->user->profile;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/Providers/OpenID.php:
--------------------------------------------------------------------------------
1 | user->profile->identifier );
25 |
26 | if( $uid ){
27 | $data = @ file_get_contents( "http://steamcommunity.com/profiles/$uid/?xml=1" );
28 |
29 | $data = @ new SimpleXMLElement( $data );
30 |
31 | if ( ! is_object( $data ) ){
32 | return false;
33 | }
34 |
35 | $this->user->profile->displayName = (string) $data->{'steamID'};
36 | $this->user->profile->photoURL = (string) $data->{'avatarMedium'};
37 | $this->user->profile->description = (string) $data->{'summary'};
38 |
39 | $realname = (string) $data->{'realname'};
40 |
41 | if( $realname ){
42 | $this->user->profile->displayName = $realname;
43 | }
44 |
45 | $customURL = (string) $data->{'customURL'};
46 |
47 | if( $customURL ){
48 | $this->user->profile->profileURL = "http://steamcommunity.com/id/$customURL/";
49 | }
50 |
51 | // restore the user profile
52 | Hybrid_Auth::storage()->set( "hauth_session.{$this->providerId}.user", $this->user );
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/User.php:
--------------------------------------------------------------------------------
1 | timestamp = time();
28 |
29 | $this->profile = new Hybrid_User_Profile();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/User_Activity.php:
--------------------------------------------------------------------------------
1 | user = new stdClass();
32 |
33 | // typically, we should have a few information about the user who created the event from social apis
34 | $this->user->identifier = NULL;
35 | $this->user->displayName = NULL;
36 | $this->user->profileURL = NULL;
37 | $this->user->photoURL = NULL;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/user/vendors/hybridauth/Hybrid/User_Contact.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | 403 Forbidden
4 |
5 |
6 |
7 | Directory access is forbidden.
8 |
9 |
10 |