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


PHP Member::load方法代码示例

本文整理汇总了PHP中Member::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::load方法的具体用法?PHP Member::load怎么用?PHP Member::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Member的用法示例。


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

示例1: member__reset_password

 public function member__reset_password()
 {
     $site_root = Config::getSiteRoot();
     $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
     $password_confirm = filter_input(INPUT_POST, 'password_confirmation', FILTER_SANITIZE_STRING);
     $token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
     $hash = filter_input(INPUT_POST, 'hash', FILTER_SANITIZE_STRING);
     $referrer = $_SERVER['HTTP_REFERER'];
     // validate form token
     if (!$this->tokens->validate($token)) {
         $this->flash->set('reset_password_error', 'Invalid token.');
         URL::redirect($referrer);
     }
     // bail if cache doesnt exist or if its too old.
     // this should have been caught on the page itself,
     // but if it got submitted somehow, just redirect and the error logic will be in the plugin.
     if (!$this->cache->exists($hash) || $this->cache->getAge($hash) > $this->fetchConfig('reset_password_age_limit', 20, 'is_numeric') * 60) {
         URL::redirect($referrer);
     }
     // password check
     if (is_null($password) || $password == '') {
         $this->flash->set('reset_password_error', 'Password cannot be blank.');
         URL::redirect($referrer);
     }
     // password confirmation check
     if (!is_null($password_confirm) && $password !== $password_confirm) {
         $this->flash->set('reset_password_error', 'Passwords did not match.');
         URL::redirect($referrer);
     }
     // get username
     $cache = $this->cache->getYAML($hash);
     $username = $cache['username'];
     // change password
     $member = Member::load($username);
     $member->set('password', $password);
     $member->save();
     // delete used cache
     $this->cache->delete($hash);
     // redirect
     URL::redirect(array_get($cache, 'return', $this->fetchConfig('member_home', $site_root, null, false, false)));
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:41,代码来源:hooks.member.php

示例2: header

<?php

require_once 'includes/header.php';
require_once 'includes/form.php';
require_once 'includes/categories.php';
if (isset($_SESSION["MemberID"]) == false) {
    header("Location:index.php");
}
$oMember = new Member();
$oMember->load($_SESSION["MemberID"]);
if ($oMember->MemberLevel != 2) {
    header("Location:index.php");
}
$oForm = new Form();
if (isset($_POST["submit"])) {
    $oForm->data = $_POST;
    $oForm->checkRequired("CategoryName");
    $oForm->checkRequired("CategoryDesc");
    if ($oForm->valid == true) {
        $oNewCategory = new Category();
        $oNewCategory->CategoryName = $_POST["CategoryName"];
        $oNewCategory->CategoryDesc = $_POST["CategoryDesc"];
        $oNewCategory->save();
        header("Location:viewCategories.php?CategoryID=6");
        exit;
    }
}
$oForm->makeTextInput("Category Name", "CategoryName");
$oForm->makeTextInput("Category Description", "CategoryDesc");
$oForm->makeSubmit("Post");
?>
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:31,代码来源:newCategory.php

示例3: getList

 /**
  * Gets a list of registered users
  * 
  * @param boolean  $protected  Are we displaying information in a protected area?
  * @return array
  */
 public static function getList($protected = true)
 {
     // start a place to put users
     $users = array();
     // grab a list of files that should be users
     $list = glob(Config::getConfigPath() . '/users/*.yaml');
     // did we find anything?
     if ($list) {
         // loop through what we found, grabbing Member data along the way
         foreach ($list as $name) {
             // get delimiters surrounding the username
             $slash = strrpos($name, '/') + 1;
             $dot = strrpos($name, '.');
             // parse username
             $username = substr($name, $slash, $dot - $slash);
             // protected?
             $users[$username] = $protected ? Member::load($username) : Member::getProfile($username);
         }
     }
     // return whatever we found
     return $users;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:28,代码来源:member.php

示例4: Member

 }
 // check that username doesn't already exist
 if (!isset($errors['username']) && $username !== $original_username && Member::exists($username)) {
     $errors['username'] = Localization::fetch('username_already_exists');
 }
 // if no errors, make the member object, renaming if necessary
 $member = null;
 if (empty($errors)) {
     if ($is_new) {
         $member = new Member(array());
         $member->set('username', $username);
     } else {
         try {
             $member = Member::load($original_username);
             $member->rename($username);
             $member = Member::load($username);
         } catch (Exception $e) {
             $errors['username'] = $e->getMessage();
         }
     }
 }
 if ($errors) {
     // something isn't valid, no saving needed
     $admin_app->flash('error', Localization::fetch('error_form_submission'));
     Session::setFlash('member_old_values', $submission);
     Session::setFlash('member_errors', $errors);
     $admin_app->redirect($admin_app->request()->getReferrer());
     return;
 }
 // set variables
 foreach ($submission as $key => $value) {
开发者ID:jalmelb,项目名称:24hl2015,代码行数:31,代码来源:routes.php

示例5: getMember

 /**
  * Gets the Member object for a given $username
  * 
  * @param string  $username  Username to look up
  * @return Member|null
  */
 public static function getMember($username)
 {
     return Member::load($username);
 }
开发者ID:Synergy23,项目名称:RealEstate,代码行数:10,代码来源:auth.php

示例6: header

<?php

require_once 'includes/header.php';
require_once 'includes/member.php';
require_once 'includes/view.php';
if (isset($_SESSION["MemberID"]) == false) {
    //no one logged in
    header("Location:index.php");
} else {
    //photo
    //all member details must go here
    //can we also get post and topic details?
    $oMember = new Member();
    $iMemberID = $_SESSION["MemberID"];
    $oMember->load($iMemberID);
    //echo view::renderMember($oMember);
}
?>
    <div class="profilePhoto">
        <img src="images/placeHolder.png" alt="" class="profilePicture"/>
        <a href="changePicture">Change Profile Picture</a>
    </div>
    <div>
        <?php 
echo view::renderMember($oMember);
?>
    </div>
    <div class="profileLinks">
        <a href="viewCategories.php?CategoryID=6" class="profilePage">Browse Forums</a>
        <a href="editDetails.php" class="profilePage">Edit Details</a>
    </div>
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:31,代码来源:profile.php

示例7: member__update_profile

 /**
  * Target for the member:profile_form form
  * 
  * @return void
  */
 public function member__update_profile()
 {
     $site_root = Config::getSiteRoot();
     $referrer = Request::getReferrer();
     $return = filter_input(INPUT_POST, 'return', FILTER_SANITIZE_URL);
     // is user logged in?
     if (!Auth::isLoggedIn()) {
         URL::redirect($this->fetchConfig('login_url', $site_root, null, false, false));
     }
     // get current user
     $member = Auth::getCurrentMember();
     // get configurations
     $allowed_fields = array_get($this->loadConfigFile('fields'), 'fields', array());
     $role_definitions = $this->fetchConfig('role_definitions');
     // who are we editing?
     $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
     $username = !$username ? $member->get('username') : $username;
     // if the user isn't the current user, ensure that's allowed
     if ($username !== $member->get('username')) {
         // username is different from current user
         if (!array_get($role_definitions, 'edit_other_users', null) || !$member->hasRole($role_definitions['edit_other_users'])) {
             // this user does not have permission to do this
             $this->flash->set('update_profile_error', 'You are not allowed to edit another member’s profile.');
             URL::redirect($referrer);
         } else {
             // all set, update member
             $member = Member::load($username);
         }
     }
     // get old values
     $old_values = $member->export();
     // set up iterators and flags
     $submission = array();
     // loop through allowed fields, validating and updating
     foreach ($allowed_fields as $field => $options) {
         if (!isset($_POST[$field])) {
             // was this username? that can be included separately
             if ($field === 'username') {
                 $value = $username;
             } else {
                 // field wasn't set, skip it
                 continue;
             }
         } else {
             // set value
             $value = filter_input(INPUT_POST, $field, FILTER_SANITIZE_STRING);
         }
         // set value
         $old_values[$field] = $value;
         // don't store this value if `save_value` is set to `false`
         if (array_get($options, 'save_value', true)) {
             $member->set($field, $value);
         }
         // add to submissions, including non-save_value fields because this
         // is the list that will be validated
         $submission[$field] = $value;
     }
     // validate
     $errors = $this->tasks->validate($submission);
     if (count($errors)) {
         // errors were found, set a flash message and redirect
         $this->flash->set('update_profile_error', 'Member profile not updated.');
         $this->flash->set('update_profile_field_errors', $errors);
         $this->flash->set('update_profile_old_values', $old_values);
         URL::redirect($referrer);
     } else {
         // save member
         $member->save();
         // trigger a hook
         $this->runHook('profile_update', 'call', null, $member);
         // user saved
         $this->flash->set('update_profile_success', 'Member profile updated.');
         if ($return) {
             URL::redirect($return);
         } else {
             URL::redirect($referrer);
         }
     }
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:84,代码来源:hooks.member.php

示例8: Member

<?php

require_once 'includes/header.php';
require_once 'includes/form.php';
require_once 'includes/member.php';
$iMemberID = $_SESSION["MemberID"];
$oExisitingMember = new Member();
$oExisitingMember->load($iMemberID);
$aExisitingData = [];
$aExisitingData["MemberName"] = $oExisitingMember->MemberName;
//photo should go in here too to edit photo.
$oForm = new Form();
$oForm->data = $aExisitingData;
if (isset($_POST["submit"])) {
    $oForm->data = $_POST;
    $oForm->checkRequired("MemberName");
    //photo should go in here too to edit photo.
    if ($oForm->valid) {
        $oExisitingMember->MemberName = $_POST["MemberName"];
        $oExisitingMember->save();
        header("Location:profile.php");
    }
}
$oForm->makeTextInput("Member Name", "MemberName");
$oForm->makeSubmit("Update Details");
?>
<div class="mainBackground">
	<h3>Edit Details</h3>

	<?php 
echo $oForm->html;
开发者ID:Professorsaurus,项目名称:Assignment-3-Final-Demo,代码行数:31,代码来源:editDetails.php


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