当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile类代码示例

本文整理汇总了PHP中Profile的典型用法代码示例。如果您正苦于以下问题:PHP Profile类的具体用法?PHP Profile怎么用?PHP Profile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Profile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUser

 public function createUser(RegistrationForm $form, Profile $profile)
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $user = new User('registration');
         $data = $form->getAttributes();
         unset($data['cPassword'], $data['verifyCode']);
         $user->setAttributes($data);
         $user->hash = $this->hasher->hashPassword($form->password);
         $user->role = User::USER_ROLE;
         if ($user->save() && ($token = $this->tokenStorage->createAccountActivationToken($user)) !== false) {
             $profile->user_id = $user->id;
             if (!$profile->save()) {
                 throw new CException(Yii::t('UserModule.user', 'Error creating profile!'));
             }
             Yii::log(Yii::t('UserModule.user', 'Account {nick_name} was created', array('{nick_name}' => $user->email)), CLogger::LEVEL_INFO, UserModule::$logCategory);
             //@TODO
             Yii::app()->notify->send($user, Yii::t('UserModule.user', 'Registration on {site}', array('{site}' => Yii::app()->getModule('yupe')->siteName)), '//user/email/needAccountActivationEmail', array('token' => $token));
             Yii::app()->notify->sendAdmin('Новый пользователь на сайте ' . CHtml::encode(Yii::app()->getModule('yupe')->siteName), '//user/email/newUserEmail', array('user' => $user));
             $transaction->commit();
             return $user;
         }
         throw new CException(Yii::t('UserModule.user', 'Error creating account!'));
     } catch (Exception $e) {
         Yii::log(Yii::t('UserModule.user', 'Error {error} account creating!', array('{error}' => $e->__toString())), CLogger::LEVEL_INFO, UserModule::$logCategory);
         $transaction->rollback();
         return false;
     }
 }
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:29,代码来源:UserManager.php

示例2: getIndex

 public function getIndex()
 {
     $campaign = new Campaign();
     $image = $campaign->getCampaignImage();
     $users = new Users();
     $member = $users->getRecentUsers();
     $this->layout->foot = View::make("landing.foot")->with(array('data' => $image, 'data2' => $member));
     $this->layout->title = "Welcome to Sagip.ph";
     if (Session::has('userid')) {
         $username = Session::get('username');
         $logstatus = true;
         $userid = Session::get('userid');
         $profile = new Profile();
         $pic = "#";
         $result = $profile->getProfile($userid);
         if ($result) {
             $pic = $result->profilepic;
         }
         $data = array('username' => $username, 'logstatus' => $logstatus, 'profilepic' => $pic);
         $campaign = new Campaign();
         $data2 = $campaign->getCampaignHome();
         $this->layout->head = View::make("landing.head")->with($data);
         $this->layout->body = View::make("landing.bodycontributordash")->with($data);
     } else {
         $logstatus = false;
         $data = array('logstatus' => $logstatus);
         $campaign = new Campaign();
         $data2 = $campaign->getCampaignHome();
         $this->layout->head = View::make("landing.head")->with($data);
         $this->layout->body = View::make("landing.bodycontributordash")->with($data);
     }
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:32,代码来源:ContributorController.php

示例3: createUser

 public function createUser(RegistrationForm $form)
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         $user = new User('registration');
         $profile = new Profile('registration');
         $data = $form->getAttributes();
         // Устанавливаем атрибуты пользователя
         $user->setAttributes(array('email' => $data['email']));
         // Генерируем для пользователя новый пароль
         $password = $this->hasher->generateRandomPassword();
         $user->hash = $this->hasher->hashPassword($password);
         // Устанавливаем роль пользователя
         $user->role = User::USER_ROLE;
         $profile->setAttributes(array('name' => $data['name'], 'gender' => $data['gender'], 'birth_date' => $data['date'], 'birth_time' => $form->getTime(), 'city_id' => $data['city_id']));
         $profile->subscriber = Profile::SUBSCRIBER_YES;
         if ($user->save() && ($token = $this->tokenStorage->createAccountActivationToken($user)) !== false) {
             $profile->user_id = $user->id;
             if (!$profile->save()) {
                 throw new CException(Yii::t('UserModule.user', 'Error creating profile!'));
             }
             $event = new CEvent($this, array('user' => $user, 'password' => $password, 'token' => $token, 'programId' => $data['programId'], 'subscriptionType' => $data['subscriptionType']));
             $this->onSuccessRegistration($event);
             Yii::log(Yii::t('UserModule.user', 'Account {nick_name} was created', array('{nick_name}' => $user->email)), CLogger::LEVEL_INFO, UserModule::$logCategory);
             $transaction->commit();
             return $user;
         }
         throw new CException(Yii::t('UserModule.user', 'Error creating account!'));
     } catch (Exception $e) {
         Yii::log(Yii::t('UserModule.user', 'Error {error} account creating!', array('{error}' => $e->__toString())), CLogger::LEVEL_INFO, UserModule::$logCategory);
         $transaction->rollback();
         return false;
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:34,代码来源:UserManager.php

示例4: plugin_pdf_MassiveActionsProcess

function plugin_pdf_MassiveActionsProcess($data)
{
    switch ($data["action"]) {
        case "plugin_pdf_DoIt":
            foreach ($data['item'] as $key => $val) {
                if ($val) {
                    $tab_id[] = $key;
                }
            }
            $_SESSION["plugin_pdf"]["type"] = $data["itemtype"];
            $_SESSION["plugin_pdf"]["tab_id"] = serialize($tab_id);
            echo "<script type='text/javascript'>\n               location.href='../plugins/pdf/front/export.massive.php'</script>";
            break;
        case "plugin_pdf_allow":
            $profglpi = new Profile();
            $prof = new PluginPdfProfile();
            foreach ($data['item'] as $key => $val) {
                if ($profglpi->getFromDB($key) && $profglpi->fields['interface'] != 'helpdesk') {
                    if ($prof->getFromDB($key)) {
                        $prof->update(array('id' => $key, 'use' => $data['use']));
                    } else {
                        if ($data['use']) {
                            $prof->add(array('id' => $key, 'use' => $data['use']));
                        }
                    }
                }
            }
            break;
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:hook.php

示例5: updateUserUrls

function updateUserUrls()
{
    printfnq("Updating user URLs...\n");
    // XXX: only update user URLs where out-of-date
    $qry = "SELECT * FROM profile order by id asc";
    $pflQry = new Profile();
    $pflQry->query($qry);
    $members = array();
    while ($pflQry->fetch()) {
        $members[] = clone $pflQry;
    }
    $pflQry->free();
    foreach ($members as $member) {
        $user = $member->getUser();
        printfv("Updating user {$user->nickname}...");
        try {
            $profile = $user->getProfile();
            updateProfileUrl($profile);
            updateAvatarUrls($profile);
            // Broadcast for remote users
            common_broadcast_profile($profile);
        } catch (Exception $e) {
            printv("Error updating URLs: " . $e->getMessage());
        }
        printfv("DONE.");
    }
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:27,代码来源:updateurls.php

示例6: aProfile

 private function aProfile($pid)
 {
     $this->caller->requireAuthentication();
     require_once FRAMEWORK_PATH . 'models/profile.php';
     if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
         if ($pid == $this->registry->getObject('authenticate')->getUser()->getUserID()) {
             $profile = new Profile($this->registry, $pid);
             if ($profile->isValid()) {
                 $data = $this->caller->getRequestData();
                 $profile->setName($this->registry->getObject('db')->sanitizeData($data['name']));
                 $profile->setDinoName($this->registry->getObject('db')->sanitizeData($data['dino_name']));
                 // etc, set all appropriate methods
                 $profile->save();
                 header('HTTP/1.0 204 No Content');
                 exit;
             } else {
                 header('HTTP/1.0 404 Not Found');
                 exit;
             }
         } else {
             header('HTTP/1.0 403 Forbidden');
             exit;
         }
     } else {
         $profile = new Profile($this->registry, $pid);
         if ($profile->isValid()) {
             header('HTTP/1.0 200 OK');
             echo json_encode($profile->toArray());
             exit;
         } else {
             header('HTTP/1.0 404 Not Found');
             exit;
         }
     }
 }
开发者ID:simontakite,项目名称:cookbooks,代码行数:35,代码来源:profiles.php

示例7: update_profile

function update_profile($profile_id, $data)
{
    $yes_no = array('YES', 'NO');
    $urls = $_SESSION['OCS']['url_service'];
    $profiles = get_profiles();
    $profile = $profiles[$profile_id];
    $updatedProfile = new Profile($profile_id, $data['new_label'] ?: $profile->getLabel());
    foreach ($data['restrictions'] as $key => $val) {
        $updatedProfile->setRestriction($key, $val);
    }
    foreach ($data['config'] as $key => $val) {
        $updatedProfile->setConfig($key, $val);
    }
    foreach ($data['blacklist'] as $key => $val) {
        if ($val == 'YES') {
            $updatedProfile->addToBlacklist($key);
        }
    }
    foreach ($data['pages'] as $key => $val) {
        if ($urls->getUrl($key) and $val == 'on') {
            $updatedProfile->addPage($key);
        }
    }
    $serializer = new XMLProfileSerializer();
    $xml = $serializer->serialize($updatedProfile);
    if (file_put_contents(DOCUMENT_REAL_ROOT . '/config/profiles/' . $profile->getName() . '.xml', $xml)) {
        return $profile->getName();
    } else {
        return false;
    }
}
开发者ID:remicollet,项目名称:OCSInventory-ocsreports,代码行数:31,代码来源:profile_functions.php

示例8: postIndex

 public function postIndex()
 {
     $input = Input::only('first_name', 'last_name', 'email', 'username', 'password', 'domain_id');
     $domain_id = Cookie::get('domain_hash') ? Cookie::get('domain_hash') : 'NULL';
     $rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'register', 'errors' => $v, 'input' => TRUE));
     }
     $profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => ''));
     $profile->save();
     $user = new User(array('domain_id' => Cookie::get('domain_hash') ? Cookie::get('domain_hash') : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => Cookie::get('domain_hash') ? 4 : 3));
     $user->profile()->associate($profile);
     $user->save();
     if ($user->id) {
         if ($user->status == 4) {
             $this->add_phone_number($user->id);
         }
         $cookie = Cookie::forget('rndext');
         $confirmation = App::make('email-confirmation');
         $confirmation->send($user);
         Mail::send('emails.register', array('new_user' => $input['username']), function ($message) {
             $message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to(Input::get('email'))->subject(_('New user registration'));
         });
         Event::fire('logger', array(array('account_register', array('id' => $user->id, 'username' => $user->username), 2)));
         //			return Output::push(array(
         //				'path' => 'register',
         //				'messages' => array('success' => _('You have registered successfully')),
         //				));
         return Redirect::to('register')->with('success', _('You have registered successfully'))->withCookie($cookie);
     } else {
         return Output::push(array('path' => 'register', 'messages' => array('fail' => _('Fail to register')), 'input' => TRUE));
     }
 }
开发者ID:digideskio,项目名称:voip-id,代码行数:34,代码来源:RegisterController.php

示例9: displayTabContentForItem

 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     return;
     $profile = new Profile();
     $found_profiles = $profile->find("`interface` = 'central'");
     $tab_profile = new self();
     $found_tab_profiles = $tab_profile->find("`plugin_custom_tabs_id` = " . $item->getID());
     echo "<form method='POST' action='tabprofile.form.php' />";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . __("Visibility") . "</th></tr>";
     $odd = 0;
     foreach ($found_profiles as $profiles_id => $profile_fields) {
         if ($odd % 2 === 0) {
             echo "<tr>";
         }
         echo "<td>" . $profile_fields['name'] . "</td>";
         echo "<td>";
         Dropdown::showYesNo("tab_profile[{$profiles_id}]", 0);
         echo "</td>";
         if ($odd % 2 === 1) {
             echo "</tr>";
         }
         $odd++;
     }
     if ($odd % 2 === 0) {
         echo "</tr>";
     }
     echo "<tr><td colspan='4'><div class='center'>";
     echo "<input type='submit' name='update' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
     echo "</div></td></tr>";
     echo "</table>";
     Html::closeForm();
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:34,代码来源:tabprofile.class.php

示例10: getGraders

 static function getGraders($groupid)
 {
     $qry = 'SELECT profile.* ' . 'FROM profile JOIN grades_group ' . 'ON profile.id = grades_group.userid ' . 'WHERE grades_group.groupid = ' . $groupid;
     $graders = new Profile();
     $graders->query($qry);
     return $graders;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:7,代码来源:Gradesgroup.php

示例11: registerUser

 private function registerUser($username, $data = NULL)
 {
     try {
         $gingerKey = sfConfig::get('app_portail_ginger_key');
         if ($gingerKey != "abc") {
             $ginger = new \Ginger\Client\GingerClient(sfConfig::get('app_portail_ginger_key'));
             $cotisants = $ginger->getUser($username);
         } else {
             $cotisants = new stdClass();
             $cotisants->mail = $username . "@etu.utc.fr";
             $cotisants->prenom = "Le";
             $cotisants->nom = "Testeur";
             $cotisants->type = "etu";
         }
         if (!$data) {
             $data = new sfGuardUser();
         }
         $data->setUsername($username);
         $data->setEmailAddress($cotisants->mail);
         $data->setFirstName($cotisants->prenom);
         $data->setLastName($cotisants->nom);
         $data->setIsActive(true);
         $data->save();
         $profile = new Profile();
         $profile->setUser($data);
         $profile->setDomain($cotisants->type);
         $profile->save();
         return $data;
     } catch (\Ginger\Client\ApiException $ex) {
         $this->setFlash('error', "Il n'a pas été possible de vous identifier. Merci de contacter simde@assos.utc.fr en précisant votre login et le code d'erreur " . $ex->getCode() . ".");
     }
     return false;
 }
开发者ID:TheoJD,项目名称:portail,代码行数:33,代码来源:sfUTCCASUser.class.php

示例12: createUser

 /**
  * for person create user, assign Customer office role, send Inivation email
  * @param int $person_id
  * @return boolean
  */
 public function createUser($person_id)
 {
     $m = Person::model();
     $model = $m->findByPk($person_id);
     //person may be already registred as user
     if (!empty($model->user_id)) {
         return TRUE;
     }
     //create user
     $password = $this->randomPassword();
     $mUser = new User();
     $mUser->attributes = array('username' => $model->email, 'password' => UserModule::encrypting($password), 'email' => $model->email, 'superuser' => 0, 'status' => User::STATUS_ACTIVE);
     $mUser->activkey = UserModule::encrypting(microtime() . $password);
     if (!$mUser->save()) {
         return FALSE;
     }
     //attach user to person
     $model->user_id = $mUser->id;
     $model->save();
     //create user profile
     $profile = new Profile();
     $profile->user_id = $mUser->id;
     $profile->first_name = $model->first_name;
     $profile->last_name = $model->last_name;
     $profile->save();
     unset($profile);
     //add Customer office role
     Rights::assign(DbrUser::RoleCustomerOffice, $mUser->id);
     //send email
     Yii::import('vendor.dbrisinajumi.person.components.invitationEmail');
     $e = new invitationEmail();
     $name = $model->first_name . ' ' . $model->last_name;
     $e->sendInvitate($model->email, $password, $model->email, $name);
     return true;
 }
开发者ID:dbrisinajumi,项目名称:person,代码行数:40,代码来源:Person.php

示例13: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $user = new User();
     $profile = new Profile();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation(array($user, $profile));
     if (isset($_POST['User'], $_POST['Profile'])) {
         // populate input into $model and $profile
         $user->attributes = $_POST['User'];
         $profile->attributes = $_POST['Profile'];
         // validate both $model and $profile
         $valid = $user->validate();
         $valid = $profile->validate() && $valid;
         if ($valid) {
             if ($user->save()) {
                 $profile->user_id = $user->id;
                 $profile->email = $user->username;
                 if ($profile->save()) {
                     $this->redirect(array('view', 'id' => $user->id));
                 }
             }
         }
     }
     $this->render('create', array('user' => $user, 'profile' => $profile));
 }
开发者ID:nbayteam,项目名称:project1,代码行数:29,代码来源:UserController.php

示例14: actionRegistration

	/**
	 * Registration user
	 */
	public function actionRegistration() 
	{
        
        if(Y::module()->isRegistrationClose) $this->redirect('close');
		$model = new RegistrationForm;
        $profile=new Profile;
        $profile->regMode = true;
            
		// ajax validator
		if(isset($_POST['ajax']) && $_POST['ajax']==='registration-form')
			Y::end(UActiveForm::validate(array($model,$profile)));
		
		if (Y::userId()) {
			$this->redirect(Y::module()->cabinetUrl);
		} else {
			if(isset($_POST['RegistrationForm'])) {
				$model->attributes=$_POST['RegistrationForm'];
				$profile->attributes= isset($_POST['Profile'])?$_POST['Profile']:array();
				if($model->validate()&&$profile->validate())
				{
					$soucePassword = $model->password;
					$model->activkey=UserModule::encrypting(microtime().$soucePassword);
					$model->password=UserModule::encrypting($soucePassword);
					$model->verifyPassword=UserModule::encrypting($model->verifyPassword);
					$model->createtime=time();
					$model->lastvisit=((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin)?time():0;
					$model->superuser=0;
					$model->status=((Y::module()->activeAfterRegister)?User::STATUS_ACTIVE:User::STATUS_NOACTIVE);
						
					if ($model->save()) {
						$profile->user_id=$model->id;
						$profile->save();
						if (Y::module()->sendActivationMail) {
							$activation_url = $this->createAbsoluteUrl('/user/activation',array("activkey" => $model->activkey, "email" => $model->email));
							UserModule::sendMail($model->email,Users::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),Users::t("Please activate you account go to {activation_url}",array('{activation_url}'=>$activation_url)));
						}
							
						if ((Y::module()->loginNotActiv||(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false))&&Y::module()->autoLogin) {
							$identity=new UserIdentity($model->username,$soucePassword);
								$identity->authenticate();
								Y::user()->login($identity,0);
								$this->redirect(Y::module()->returnUrl);
						} else {
							if (!Y::module()->activeAfterRegister&&!Y::module()->sendActivationMail) {
								Y::flash('/user/registration',Users::t("Thank you for your registration. Contact Admin to activate your account."));
							} elseif(Y::module()->activeAfterRegister&&Y::module()->sendActivationMail==false) {
								Y::flash('/user/registration',Users::t("Thank you for your registration. Please {{login}}.",array('{{login}}'=>CHtml::link(Users::t('Login'),Y::module()->loginUrl))));
							} elseif(Y::module()->loginNotActiv) {
								Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email or login."));
							} else {
								Y::flash('/user/registration',Users::t("Thank you for your registration. Please check your email."));
							}
							$this->refresh();
						}
					}
				} else $profile->validate();
			}
		    $this->render('/user/registration',array('model'=>$model,'profile'=>$profile,'lang'=>Yii::app()->language));
	    }
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:63,代码来源:RegistrationController.php

示例15: profile

 function profile()
 {
     // get the data to save. low on security because the user can only save to himself from here
     if ($this->input->post()) {
         $this->form_validation->set_rules('display_name', _('Display Name'), 'trim|max_length[30]|xss_clean');
         $this->form_validation->set_rules('twitter', _('Twitter username'), 'trim|max_length[20]|xss_clean');
         $this->form_validation->set_rules('bio', _('Bio'), 'trim|max_length[140]|xss_clean');
         if ($this->form_validation->run()) {
             $profile = new Profile($this->tank_auth->get_user_id());
             // use the from_array to be sure what's being inputted
             $profile->display_name = $this->form_validation->set_value('display_name');
             $profile->twitter = $this->form_validation->set_value('twitter');
             $profile->bio = $this->form_validation->set_value('bio');
             if ($profile->save()) {
                 $data["saved"] = TRUE;
             }
         }
     }
     $user = new User($this->tank_auth->get_user_id());
     $profile = new Profile($this->tank_auth->get_user_id());
     $data["user_id"] = $user->id;
     $data["user_name"] = $user->username;
     $data["user_email"] = $user->email;
     $data["user_display_name"] = $profile->display_name;
     $data["user_twitter"] = $profile->twitter;
     $data["user_bio"] = $profile->bio;
     $this->viewdata["function_title"] = _("Your profile");
     $this->viewdata["main_content_view"] = $this->load->view('account/profile/profile', $data, TRUE);
     $this->load->view("account/default.php", $this->viewdata);
 }
开发者ID:KasaiDot,项目名称:FoOlSlide,代码行数:30,代码来源:index.php


注:本文中的Profile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。