コード例 #1
0
ファイル: post.php プロジェクト: EGreg/PHP-On-Pie
function users_contact_post()
{
    Pie_Session::start();
    Pie_Valid::nonce(true);
    extract($_REQUEST);
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    $app = Pie_Config::expect('pie', 'app');
    $subject = "Welcome! Activate your email.";
    $view = "{$app}/email/setEmail.php";
    $fields = array();
    $p = array();
    $p['subject'] =& $subject;
    $p['view'] =& $view;
    $p['fields'] =& $fields;
    Pie::event('users/setEmail', $p, 'before');
    // may change the fields
    if (isset($first_name)) {
        $user->first_name = $first_name;
    }
    if (isset($last_name)) {
        $user->last_name = $last_name;
    }
    $user->addEmail($_REQUEST['email_address'], $subject, $view, true, $fields);
    // If no exceptions were throw, save this user row
    if (isset($first_name) or isset($last_name)) {
        $user->save();
    }
}
コード例 #2
0
ファイル: post.php プロジェクト: EGreg/PHP-On-Pie
function users_account_post()
{
    Pie_Session::start();
    Pie_Valid::nonce(true);
    extract($_REQUEST);
    // Implement the action
    $user = Users::loggedInUser();
    if (!$user) {
        throw new Users_Exception_NotLoggedIn();
    }
    /*
          if (!isset($gender) and isset($user->gender)) {
                  $gender = $user->gender;                                                                                        
          }
          if (isset($orientation)) {
                  if (isset($gender) and $orientation == 'straight') {
                          $desired_gender = ($gender == 'male') ? 'female' : 'male';
                  } else if (isset($gender) and $orientation == 'gay') {
                          $desired_gender = $gender;
                  } else {
                          $desired_gender = 'either';
                  }
          }
    
          if (isset($first_name)) $user->first_name = $first_name;
          if (isset($last_name)) $user->last_name = $last_name;
          if (isset($gender)) $user->gender = $gender;
          if (isset($desired_gender)) $user->desired_gender = $desired_gender;
          if (isset($username)) $user->username = $username;
          if (isset($relationship_status)) {
                  $user->relationship_status = $relationship_status;
          }
          if (isset($birthday_year)) {
                  $user->birthday = date("Y-m-d", mktime(
                          0, 0, 0, $birthday_month, $birthday_day, $birthday_year
                  ));
          }
          if (isset($zipcode)) $user->zipcode = $zipcode;
    
    	$user->save(true);
    */
    // the $_SESSION['users']['user'] is now altered
}
コード例 #3
0
ファイル: content.php プロジェクト: EGreg/PHP-On-Pie
function users_account_response_content()
{
    Pie_Session::start();
    return Pie::tool('users/account');
}
コード例 #4
0
ファイル: Users.php プロジェクト: EGreg/PHP-On-Pie
 /**
  * Get the logged-in user's information
  * @return Users_User
  */
 static function loggedInUser($related_class_name = null)
 {
     Pie_Session::start();
     if (!isset($_SESSION['users']['user'])) {
         return null;
     }
     $user = $_SESSION['users']['user'];
     if (!$related_class_name) {
         return $user;
     }
     static $email = null;
     static $zipcode = null;
     switch ($related_class_name) {
         case 'email':
             if (isset($email)) {
                 return $email;
             }
             $email = new Users_Email();
             $email->user_id = $user;
             $email = $email->retrieve();
             return $email;
         case 'zipcode':
             if (isset($zipcode)) {
                 return $zipcode;
             }
             $zipcode = new Users_Zipcode();
             $zipcode->zipcode = $user->zipcode;
             $zipcode = $zipcode->retrieve();
             return $zipcode;
     }
 }
コード例 #5
0
ファイル: contact.php プロジェクト: EGreg/PHP-On-Pie
function users_contact_response_content()
{
    Pie_Session::start();
    return Pie::tool('users/contact');
}