public function beforeControllerAction($controller, $action)
 {
     if (!Yum::hasModule('role')) {
         throw new Exception('Using the membership submodule requires the role module activated');
     }
     return parent::beforeControllerAction($controller, $action);
 }
 public function beforeAction($action)
 {
     if (!Yum::hasModule('friendship')) {
         return false;
     }
     return parent::beforeAction($action);
 }
	public function beforeAction($action) {
		if(!Yum::hasModule('registration'))
			throw new CHttpException(401, 'Please activate the registration submodule in your config/main.php. See the installation instructions or registration/RegistrationModule.php for details');

		if(!Yii::app()->user->isGuest) 
			$this->redirect(Yii::app()->user->returnUrl);

		$this->layout = Yum::module('registration')->layout;
		return parent::beforeAction($action);
	}
 public function afterSave()
 {
     // If the user has activated email receiving, send a email
     if ($user = $this->profile->user) {
         if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_profilecomment) {
             Yii::import('application.modules.messages.models.YumMessage');
             YumMessage::write($user, $this->user_id, Yum::t('New profile comment from {username}', array('{username}' => $this->user->username)), YumTextSettings::getText('text_profilecomment_new', array('{username}' => $this->user->username, '{message}' => $this->comment, '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'))));
         }
     }
     return parent::afterSave();
 }
 public function afterSave()
 {
     // If the user has activated email receiving, send a email
     if ($user = $this->profile->user) {
         if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_profilecomment) {
             Yii::import('application.modules.messages.models.YumMessage');
             YumMessage::write($user, $this->user_id, Yum::t('New profile comment from {username}', array('{username}' => $this->user->username)), strtr('A new profile comment has been made from {username}: {message} <br /> <a href="{link_profile}">to my profile</a>', array('{username}' => $this->user->username, '{message}' => $this->comment, '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'))));
         }
     }
     return parent::afterSave();
 }
 public function loginByHybridAuth($provider)
 {
     if (!Yum::module()->loginType & UserModule::LOGIN_BY_HYBRIDAUTH) {
         throw new CException(400, 'Hybrid authentification is not allowed');
     }
     if (!Yum::hasModule('profile')) {
         throw new CException(400, 'Hybrid auth needs the profile submodule to be enabled');
     }
     Yii::import('user.vendors.hybridauth.Hybrid.Auth', true);
     Yii::import('user.profile.models.*');
     require_once Yum::module()->hybridAuthConfigFile;
     try {
         $hybridauth = new Hybrid_Auth(Yum::module()->hybridAuthConfigFile);
         $providers = Yum::module()->hybridAuthProviders;
         if (count($providers) == 0) {
             throw new CException('No Hybrid auth providers enabled in configuration file');
         }
         if (!in_array($provider, $providers)) {
             throw new CException('Requested provider is not enabled in configuration file');
         }
         $success = $hybridauth->authenticate($provider);
         if ($success && $success->isUserConnected()) {
             // User found and authenticated at foreign party. Is he already
             // registered at our application?
             $hybridAuthProfile = $success->getUserProfile();
             $user = $this->getUserByEmail($hybridAuthProfile->email);
             if (!$user && !YumProfile::model()->findByAttributes(array('email' => $hybridAuthProfile->email))) {
                 // No, he is not, so we register the user and sync the profile fields
                 $user = new YumUser();
                 if (!$user->registerByHybridAuth($hybridAuthProfile)) {
                     Yum::setFlash(Yum::t('Registration by external provider failed'));
                     $this->redirect(Yum::module()->returnUrl);
                 } else {
                     Yum::setFlash('Registration successful');
                 }
             }
             $identity = new YumUserIdentity($user->username, null);
             if ($identity->authenticate(true)) {
                 Yum::log(Yum::t('User {username} logged in by hybrid {provider}', array('{username}' => $hybridAuthProfile->displayName, '{email}' => $hybridAuthProfile->displayName, '{provider}' => $provider)));
                 Yii::app()->user->login($identity, Yum::module()->cookieDuration);
             } else {
                 Yum::setFlash(Yum::t('Login by external provider failed'));
             }
             $this->redirect(Yum::module()->returnUrl);
         }
     } catch (Exception $e) {
         if (Yum::module()->debug) {
             throw new CException($e->getMessage());
         } else {
             throw new CHttpException(403, Yum::t('Permission denied'));
         }
     }
 }
 public function actionView()
 {
     $this->layout = Yum::module()->adminLayout;
     $model = $this->loadModel();
     $assignedUsers = new CActiveDataProvider('YumUser', array('criteria' => array('condition' => "role_id = {$model->id}", 'join' => 'left join ' . Yum::module('role')->userRoleTable . ' on t.id = user_id')));
     $activeMemberships = false;
     if (Yum::hasModule('membership')) {
         Yii::import('application.modules.membership.models.*');
         $activeMemberships = new CActiveDataProvider('YumMembership', array('criteria' => array('condition' => "membership_id = {$model->id}")));
     }
     $this->render('view', array('assignedUsers' => $assignedUsers, 'activeMemberships' => $activeMemberships, 'model' => $model));
 }
 public function beforeAction($action)
 {
     if (!Yum::hasModule('registration')) {
         throw new CHttpException(401, 'Please activate the registration submodule in your config/main.php. See the installation instructions or registration/RegistrationModule.php for details');
     }
     if (!Yum::hasModule('profile')) {
         throw new CHttpException(401, 'The Registration submodule depends on the profile submodule. Please see the installation instructions or registration/RegistrationModule.php for details');
     }
     Yii::import('profile.models.*');
     Yii::import('registration.models.*');
     if (!Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->user->returnUrl);
     }
     $this->layout = Yum::module('registration')->layout;
     return parent::beforeAction($action);
 }
 public function rules()
 {
     $rules = parent::rules();
     if (!(Yum::hasModule('registration') && Yum::module('registration')->registration_by_email)) {
         $rules[] = array('username', 'required');
     }
     $rules[] = array('newsletter, terms,type_id', 'safe');
     // password requirement is already checked in YumUser model, its sufficient
     // to check for verifyPassword here
     $rules[] = array('verifyPassword', 'required');
     $rules[] = array('password', 'compare', 'compareAttribute' => 'verifyPassword', 'message' => Yum::t("Retype password is incorrect."));
     if (Yum::module('registration')->enableCaptcha && !Yum::module()->debug) {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => CCaptcha::checkRequirements());
     }
     return $rules;
 }
 public function authenticate($without_password = false)
 {
     $user = YumUser::model()->find('username = :username', array(':username' => $this->username));
     // try to authenticate via email
     if (Yum::hasModule('profile') && Yum::module()->loginType & UserModule::LOGIN_BY_EMAIL && !$user) {
         if ($profile = YumProfile::model()->find('email = :email', array(':email' => $this->username))) {
             if ($profile->user) {
                 $user = $profile->user;
             }
         }
     }
     if (!$user) {
         return self::ERROR_STATUS_USER_DOES_NOT_EXIST;
     }
     if ($user->status == YumUser::STATUS_INACTIVE) {
         $this->errorCode = self::ERROR_STATUS_INACTIVE;
     } else {
         if ($user->status == YumUser::STATUS_BANNED) {
             $this->errorCode = self::ERROR_STATUS_BANNED;
         } else {
             if ($user->status == YumUser::STATUS_REMOVED) {
                 $this->errorCode = self::ERROR_STATUS_REMOVED;
             } else {
                 if ($without_password) {
                     $this->credentialsConfirmed($user);
                 } else {
                     if (!CPasswordHelper::verifyPassword($this->password, $user->password)) {
                         $this->errorCode = self::ERROR_PASSWORD_INVALID;
                     } else {
                         $this->credentialsConfirmed($user);
                     }
                 }
             }
         }
     }
     return !$this->errorCode;
 }
Пример #11
0
}
?>


<div class="row-fluid">
<div class="span12">

  <p class="hint">
<?php 
if (Yum::hasModule('registration') && Yum::module('registration')->enableRegistration) {
    echo CHtml::link(Yum::t("Registration"), Yum::module('registration')->registrationUrl);
}
if (Yum::hasModule('registration') && Yum::module('registration')->enableRegistration && Yum::module('registration')->enableRecovery) {
    echo ' | ';
}
if (Yum::hasModule('registration') && Yum::module('registration')->enableRecovery) {
    echo CHtml::link(Yum::t("Lost password?"), Yum::module('registration')->recoveryUrl);
}
?>
</p>
</div>
</div>


<div class="row-fluid">
<div class="span3">
<div class="buttons">
<p><?php 
echo CHtml::submitButton(Yum::t('Login'), array('class' => 'btn'));
?>
</p>
 public function loginByEmail()
 {
     if (Yum::hasModule('profile')) {
         Yii::import('application.modules.profile.models.*');
         $profile = YumProfile::model()->find('email = :email', array(':email' => $this->loginForm->username));
         if ($profile && $profile->user) {
             return $this->authenticate($profile->user);
         }
     } else {
         throw new CException(Yum::t('The profile submodule must be enabled to allow login by Email'));
     }
 }
<?php

$this->breadcrumbs = array(Yum::t('Data Generation'));
if (isset($_POST['user_amount'])) {
    echo '<h2> Success </h2>';
    printf('<p> <strong> %d </strong> %s been generated. The associated password is <em>%s</em> </p>', $_POST['user_amount'], $_POST['user_amount'] == 1 ? 'User has' : 'Users have', $_POST['password']);
    echo '<br />';
}
echo CHtml::beginForm();
echo '<h2> Random user Generator </h2>';
printf('Generate %s %s users <br />
		belonging to role %s <br />
		with associated password %s', CHtml::textField('user_amount', '1', array('size' => 2)), CHtml::dropDownList('status', 1, array('-1' => Yum::t('banned'), '0' => Yum::t('inactive'), '1' => Yum::t('active'))), Yum::hasModule('role') ? CHtml::dropDownList('role', '', CHtml::listData(YumRole::model()->findAll(), 'id', 'title')) : ' - ', CHtml::textField('password', 'Demopassword123'));
echo '<br />';
echo CHtml::submitButton(Yum::t('Generate'));
echo CHtml::endForm();
	public function authenticate($without_password = false)
	{
		$user = YumUser::model()->find('username = :username', array(
					':username' => $this->username));

		// try to authenticate via email
		if(!$user && (Yum::module()->loginType & 2) && Yum::hasModule('profile')) {
			if($profile = YumProfile::model()->find('email = :email', array(
							':email' => $this->username)))
				if($profile->user)
					$user = $profile->user;
		}

		if(!$user)
			return self::ERROR_STATUS_USER_DOES_NOT_EXIST;

		if($without_password)
			$this->credentialsConfirmed($user);
		else if(YumUser::encrypt($this->password)!==$user->password)
			$this->errorCode=self::ERROR_PASSWORD_INVALID;
		else if($user->status == YumUser::STATUS_INACTIVE)
			$this->errorCode=self::ERROR_STATUS_INACTIVE;
		else if($user->status == YumUser::STATUS_BANNED)
			$this->errorCode=self::ERROR_STATUS_BANNED;
		else if($user->status == YumUser::STATUS_REMOVED)
			$this->errorCode=self::ERROR_STATUS_REMOVED;
		else
			$this->credentialsConfirmed($user);
		return !$this->errorCode;

	}
Пример #15
0
exit('YUMPROFILEHEREE');
//Yii::app()->clientScript->registerCssFile(
//		Yii::app()->getAssetManager()->publish(
//			Yii::getPathOfAlias('YumAssets').'/css/yum.css'));
//$module = Yii::app()->getModule('user');
//$this->beginContent($module->baseLayout);
?>

<div id="usermenu">
<?php 
Yum::renderFlash();
if (Yum::hasModule('message')) {
    Yii::import('user.message.components.*');
    $this->widget('MessageWidget');
}
if (Yum::hasModule('profile') && Yum::module('profile')->enableProfileVisitLogging) {
    Yii::import('user.profile.components.*');
    $this->widget('ProfileVisitWidget');
}
$this->renderMenu();
?>

</div>

<div id="usercontent">
<?php 
echo $content;
?>
</div>

<?php 
    echo CHtml::activeDropDownList($model, 'show_online_status', array('0' => Yum::t('Do not show my online status'), '1' => Yum::t('Show my online status to everyone')));
    ?>
	</div>
<?php 
}
?>

	<div class="row">
	<?php 
echo CHtml::activeLabelEx($model, 'log_profile_visits');
echo CHtml::activeDropDownList($model, 'log_profile_visits', array('0' => Yum::t('Do not show the owner of a profile when i visit him'), '1' => Yum::t('Show the owner when i visit his profile')));
?>
	</div>

<?php 
if (Yum::hasModule('role')) {
    ?>
	<div class="row">
	<?php 
    echo CHtml::activeLabelEx($model, 'appear_in_search');
    echo CHtml::activeDropDownList($model, 'appear_in_search', array('0' => Yum::t('Do not appear in search'), '1' => Yum::t('Appear in search')));
    ?>
	</div>
<?php 
}
?>

<div class="row">
<?php 
echo $form->labelEx($model, 'ignore_users');
echo $form->textField($model, 'ignore_users', array('size' => 100));
?>
</th>
    <td><?php 
echo CHtml::encode(YumUser::itemAlias("UserStatus", $model->status));
?>
</td>
</tr>
</table>

<div id="friends">
<h2> <?php 
echo Yum::t('My friends');
?>
 </h2>
<?php 
if (Yum::hasModule('friendship') && $model->friends) {
    foreach ($friends as $friend) {
        ?>
<div id="friend">
<div id="avatar">
<?php 
        $model->renderAvatar($friend);
        ?>
<div id='user'>
<?php 
        echo CHtml::link(ucwords($friend->username), Yii::app()->createUrl('profile/profile/view', array('id' => $friend->id)));
        ?>
</div>
</div>
</div>
</div>
Пример #18
0
$this->title = Yum::t('{role}', array('{role}' => $model->title));
$this->breadcrumbs = array(Yum::t('Roles') => array('index'), Yum::t('View'), $model->title);
echo $model->description;
?>

<br />
<?php 
echo Yum::p('These users have been assigned to this role');
?>
 

<?php 
if ($assignedUsers) {
}
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $assignedUsers, 'columns' => array('username', 'status')));
?>
<br />

<?php 
if (Yum::hasModule('membership') && $model->membership_priority) {
    echo Yum::t('Membership priority') . ': ' . $model->membership_priority . '<br />';
    echo Yum::t('Membership price') . ': ' . $model->price . '<br />';
    echo Yum::t('Membership duration') . ': ' . $model->duration . '<br />';
    echo Yum::p('These users have a ordered memberships of this role');
    if ($activeMemberships) {
        $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $activeMemberships, 'columns' => array('id', 'username', array('name' => 'order_date', 'value' => 'date("Y. m. d G:i:s", $data->order_date)'), array('name' => 'end_date', 'value' => 'date("Y. m. d G:i:s", $data->end_date)'), array('name' => 'payment_date', 'value' => 'date("Y. m. d G:i:s", $data->payment_date)'), 'role.price', 'payment.title')));
    }
}
if (Yii::app()->user->isAdmin()) {
    echo CHtml::Button(Yum::t('Update role'), array('submit' => array('role/update', 'id' => $model->id)));
}
Пример #19
0
?>
</div>	

<div class="row" style="float:right;">
<?php 
echo CHtml::label(Yum::t('This users have been assigned to this role'), '');
?>
 

<?php 
$this->widget('YumModule.components.Relation', array('model' => $model, 'relation' => 'users', 'style' => 'dropdownlist', 'fields' => 'username', 'htmlOptions' => array('checkAll' => Yum::t('Choose All'), 'template' => '<div style="float:left;margin-right:5px;">{input}</div>{label}'), 'showAddButton' => false));
?>
</div>

<?php 
if (Yum::hasModule('membership')) {
    ?>
<div class="row">
<?php 
    echo CHtml::activeLabelEx($model, 'is_membership_possible');
    echo CHtml::activeCheckBox($model, 'is_membership_possible');
    ?>

</div>
<div class="membership">
<div class="row">
<?php 
    echo CHtml::activeLabelEx($model, 'price');
    echo CHtml::activeTextField($model, 'price');
    echo CHtml::Error($model, 'price');
    ?>
 public function beforeSave()
 {
     $this->updatetime = time();
     // If the user has activated email receiving, send a email
     if ($this->isNewRecord) {
         if ($user = YumUser::model()->findByPk($this->friend_id)) {
             if (Yum::hasModule('messages') && $user->privacy && $user->privacy->message_new_friendship) {
                 Yii::import('application.modules.messages.models.YumMessage');
                 YumMessage::write($user, $this->inviter, Yum::t('New friendship request from {username}', array('{username}' => $this->inviter->username)), YumTextSettings::getText('text_friendship_new', array('{username}' => $this->inviter->username, '{link_friends}' => Yii::app()->controller->createUrl('//friendship/friendship/index'), '{link_profile}' => Yii::app()->controller->createUrl('//profile/profile/view'), '{message}' => $this->message)));
             }
         }
     }
     return parent::beforeSave();
 }
 public function actionAdmin()
 {
     if (Yum::hasModule('role')) {
         Yii::import('user.role.models.*');
     }
     $this->layout = Yum::module()->adminLayout;
     $model = new YumUser('search');
     if (isset($_GET['YumUser'])) {
         $model->attributes = $_GET['YumUser'];
     }
     if (Yum::hasModule('profile')) {
         Yii::import('user.profile.models.*');
         $profile = new YumProfile();
         if (isset($_GET['YumProfile'])) {
             $profile->attributes = $_GET['YumProfile'];
             $model->profile = $profile;
         }
     }
     $this->render('admin', array('model' => $model, 'profile' => isset($profile) ? $profile : false));
 }
 public function getAvatar($thumb = false)
 {
     if (Yum::hasModule('avatar') && $this->profile) {
         $options = array();
         if ($thumb) {
             $options = array('class' => 'avatar', 'style' => 'width: 40px; height:40px;');
         } else {
             $options = array('class' => 'avatar', 'style' => 'width: ' . Yum::module('avatar')->avatarDisplayWidth . ' px;');
         }
         $return = '<div class="avatar">';
         if (Yum::module('avatar')->enableGravatar && $this->avatar == 'gravatar') {
             return CHtml::image('http://www.gravatar.com/avatar/' . $this->getGravatarHash(), Yum::t('Avatar image'), $options);
         }
         if (isset($this->avatar) && $this->avatar) {
             $return .= CHtml::image(Yii::app()->baseUrl . '/' . $this->avatar, 'Avatar', $options);
         } else {
             $return .= CHtml::image(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('YumAssets.images') . ($thumb ? '/no_avatar_available_thumb.jpg' : '/no_avatar_available.jpg'), Yum::t('No image available'), $options));
         }
         $return .= '</div><!-- avatar -->';
         return $return;
     }
 }
Пример #23
0
    Yii::app()->controller->uniqueid .
    '/' . Yii::app()->controller->action->id;
    echo CHtml::hiddenField('quicklogin', $link);
    ?>
    
        <? echo CHtml::errorSummary($model); ?>
        
        <div class="row">
            <? echo CHtml::activeLabelEx($model,'username'); ?>
            <? echo CHtml::activeTextField($model,'username', array('size' => 10)) ?>
        </div>
        
        <div class="row" style="padding-top:12px;">
            <? echo CHtml::activeLabelEx($model,'password'); ?>
            <? echo CHtml::activePasswordField($model,'password', array('size' => 10)); ?>
        </div>
        
        <div class="row" style="font-size:10px;">
			<?
			if(Yum::hasModule('registration') 
					&& Yum::module('registration')->enableRecovery)
			echo CHtml::link(Yum::t('Lost password?'), 
				Yum::module('registration')->recoveryUrl); ?>
			</div>
        
        <div class="row submit">
            <? echo CHtml::submitButton(Yum::t('Login')); ?>
        </div>
        
    <? echo CHtml::endForm(); ?>
Пример #24
0

$this->pageTitle = Yii::app()->name . ' - ' . Yum::t('Profile');
$this->title = CHtml::activeLabel($model,'username');
$this->breadcrumbs = array(Yum::t('Profile'), $model->username);
Yum::renderFlash();
?>

<div id="profile">

<? echo $model->getAvatar(); ?>
<? $this->renderPartial(Yum::module('profile')->publicFieldsView, array(
			'profile' => $model->profile)); ?>
<br />
<?
if(Yum::hasModule('friendship'))
$this->renderPartial(
		'application.modules.friendship.views.friendship.friends', array(
			'model' => $model)); ?>
<br />
<?
if(@Yum::module('message')->messageSystem != 0)
$this->renderPartial('/message/write_a_message', array(
			'model' => $model)); ?>
<br />
<?
if(Yum::module('profile')->enableProfileComments
		&& Yii::app()->controller->action->id != 'update'
		&& isset($model->profile))
	$this->renderPartial(Yum::module('profile')->profileCommentIndexView, array(
			 'model' => $model->profile)); ?>
Пример #25
0
?>
    </div>


    <div class="row">
        <p> Leave password <em> empty </em> to 
    <?php 
echo $model->isNewRecord ? 'generate a random Password' : 'keep it <em> unchanged </em>';
?>
 </p>
<?php 
$this->renderPartial('/user/passwordfields', array('form' => $passwordform));
?>
    </div>
        <?php 
if (Yum::hasModule('profile')) {
    $this->renderPartial('application.modules.profile.views.profile._form', array('profile' => $profile));
}
?>

    <div class="row buttons">
<?php 
echo CHtml::submitButton($model->isNewRecord ? Yum::t('Create') : Yum::t('Save'));
?>
    </div>

<?php 
$this->endWidget();
?>
</div>
<div style="clear:both;"></div>
Пример #26
0
	public function actionAdmin()
	{
		if(Yum::hasModule('role'))
			Yii::import('application.modules.role.models.*');

		$this->layout = Yum::module()->adminLayout;

		$model = new YumUser('search');

		if(isset($_GET['YumUser']))
			$model->attributes = $_GET['YumUser'];

		$this->render('admin', array('model'=>$model));
	}
Пример #27
0
<?php

$this->title = Yum::t('Manage users');
$this->breadcrumbs = array(Yum::t('Users') => array('index'), Yum::t('Manage'));
echo Yum::renderFlash();
$this->widget('application.modules.user.components.CsvGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'filter' => false, 'type' => 'raw', 'value' => 'CHtml::link($data->id,
				array("//user/user/update","id"=>$data->id))'), array('name' => 'username', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->username),
				array("//user/user/view","id"=>$data->id))'), array('name' => 'createtime', 'filter' => false, 'value' => 'date(UserModule::$dateFormat,$data->createtime)'), array('name' => 'lastvisit', 'filter' => false, 'value' => 'date(UserModule::$dateFormat,$data->lastvisit)'), array('name' => 'status', 'filter' => false, 'value' => 'YumUser::itemAlias("UserStatus",$data->status)'), array('name' => Yum::t('Roles'), 'type' => 'raw', 'visible' => Yum::hasModule('role'), 'filter' => false, 'value' => '$data->getRoles()'), array('class' => 'CButtonColumn'))));
?>

<?php 
echo CHtml::link(Yum::t('Create new User'), array('//user/user/create'));
?>

Пример #28
0
	/**
	 * Checks if the user has the given Role
	 * @mixed Role string or array of strings that should be checked
	 * @int (optional) id of the user that should be checked 
	 * @return bool Return value tells if the User has access or hasn't access.
	 */
	public function hasRole($role, $uid = 0) {
		if(Yum::hasModule('role')) {
			Yii::import('application.modules.role.models.*');

			if($uid == 0)
				$uid = Yii::app()->user->id;

			if(!is_array($role))
				$role = array ($role);

			if($uid && $user = YumUser::model()->cache(500)->with('roles')->find(
						't.id = '.$uid)) {
				// Check if a user has a active membership and, if so, add this
				// to the roles
				$roles = $user->roles;
				if(Yum::hasModule('membership'))
					$roles = array_merge($roles, $user->getActiveMemberships());

				if(isset($roles)) 
					foreach($roles as $roleobj) {
						if(in_array($roleobj->title, $role) ||
								in_array($roleobj->id, $role))
							return true;
					}
			}
		}

		return false;
	}
Пример #29
0
?>
                        
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'profile-form'));
?>

<?php 
echo '<ul class="list-group">';
?>
    <div class="profile_img">
<?php 
echo $user->getAvatar();
?>
</div>
<?php 
if (Yum::hasModule('avatar')) {
    echo '&nbsp;';
    echo CHtml::link(Yum::t('Edit avatar image'), array('//avatar/avatar/editAvatar'), array('class' => 'btn btn-primary left_button'));
}
?>
                                
                                
                                
<?php 
echo $form->errorSummary(array($user, $profile));
?>

<?php 
if (Yum::module()->loginType & UserModule::LOGIN_BY_USERNAME) {
    ?>
 public static function send($to, $subject = null, $body = null, $header = null)
 {
     if ($to instanceof YumUser) {
         $to = $to->profile->email;
     }
     if (!is_array($to)) {
         $to = array('to' => $to, 'from' => Yum::module('message')->adminEmail, 'subject' => $subject, 'body' => $body);
     }
     if (Yum::module()->mailer == 'swift') {
         $sm = Yii::app()->swiftMailer;
         $mailer = $sm->mailer($sm->mailTransport());
         $message = $sm->newMessage($to['subject'])->setFrom($to['from'])->setTo($to['to'])->setBody($to['body']);
         return $mailer->send($message);
     } else {
         if (Yum::module()->mailer == 'PHPMailer') {
             Yii::import('application.extensions.phpmailer.JPhpMailer');
             $mailer = new JPhpMailer(true);
             if (Yum::module()->phpmailer['transport']) {
                 switch (Yum::module()->phpmailer['transport']) {
                     case 'smtp':
                         $mailer->IsSMTP();
                         break;
                     case 'sendmail':
                         $mailer->IsSendmail();
                         break;
                     case 'qmail':
                         $mailer->IsQmail();
                         break;
                     case 'mail':
                     default:
                         $mailer->IsMail();
                 }
             } else {
                 $mailer->IsMail();
             }
             if (Yum::module()->phpmailer['html']) {
                 $mailer->IsHTML(Yum::module()->phpmailer['html']);
             } else {
                 $mailer->IsHTML(false);
             }
             $mailerconf = Yum::module()->phpmailer['properties'];
             if (is_array($mailerconf)) {
                 foreach ($mailerconf as $key => $value) {
                     if (isset(JPhpMailer::${$key})) {
                         JPhpMailer::${$key} = $value;
                     } else {
                         $mailer->{$key} = $value;
                     }
                 }
             }
             $mailer->SetFrom($to['from'], Yum::module()->phpmailer['msgOptions']['fromName']);
             //FIXME
             $mailer->AddAddress($to['to'], Yum::module()->phpmailer['msgOptions']['toName']);
             //FIXME
             $mailer->Subject = $to['subject'];
             $mailer->Body = $to['body'];
             return $mailer->Send();
         } else {
             if ($header == null) {
                 $header = 'MIME-Version: 1.0' . "\n";
                 $header .= 'Content-type: text/html; charset=utf-8' . "\n";
                 if (Yum::hasModule('message')) {
                     $header .= 'From: ' . Yum::module('message')->adminEmail . "\r\n";
                 } else {
                     $header .= 'From: ' . Yum::module()->adminEmail . "\r\n";
                 }
             }
             return mail($to['to'], $to['subject'], $to['body'], $header);
         }
     }
 }