PHP User::SetId Examples

PHP User::SetId - 7 examples found. These are the top rated real world PHP examples of User::SetId extracted from open source projects. You can rate examples to help us improve the quality of examples.
 function OnPostback()
 {
     # get object
     $this->user = $this->editor->GetDataObject();
     # save data if valid
     if ($this->IsValid()) {
         $id = $this->GetAuthenticationManager()->SaveUser($this->user);
         $this->user->SetId($id);
         $this->GetAuthenticationManager()->SaveUserSecurity($this->user);
         $this->Redirect($this->user->GetUserProfileUrl());
     }
 }
 /**
  * @access public
  * @return void
  * @param int[] $a_ids
  * @desc Read from the db the comments for the supplied review item
  */
 public function ReadCommentsForReviewItem(ReviewItem $review_item)
 {
     $s_person = $this->GetSettings()->GetTable('User');
     $s_message = $this->GetSettings()->GetTable('ForumMessage');
     # prepare command
     $s_sql = 'SELECT ' . $s_person . '.user_id, ' . $s_person . '.known_as, ' . 'location, ' . $s_person . ".date_added AS sign_up_date, " . $s_person . '.total_messages, ' . $s_message . '.id, ' . $s_message . '.message, ' . $s_message . ".date_added AS message_date " . 'FROM ' . $s_message . ' INNER JOIN ' . $s_person . ' ON ' . $s_message . '.user_id = ' . $s_person . '.user_id ' . 'WHERE ' . $s_message . '.item_id = ' . Sql::ProtectNumeric($review_item->GetId(), false, false) . ' AND item_type = ' . Sql::ProtectNumeric($review_item->GetType(), false, false);
     if ($this->GetReverseOrder()) {
         $s_sql .= ' ORDER BY sort_override DESC, ' . $s_message . '.date_added DESC';
     } else {
         $s_sql .= ' ORDER BY sort_override, ' . $s_message . '.date_added ASC';
     }
     # get data
     $result = $this->GetDataConnection()->query($s_sql);
     $this->Clear();
     $o_topic = new ForumTopic($this->GetSettings());
     while ($o_row = $result->fetch()) {
         $o_person = new User();
         $o_person->SetId($o_row->user_id);
         $o_person->SetName($o_row->known_as);
         $o_person->SetSignUpdate($o_row->sign_up_date);
         $o_person->SetLocation($o_row->location);
         $o_person->SetTotalMessages($o_row->total_messages);
         $o_message = new ForumMessage($this->GetSettings(), AuthenticationManager::GetUser());
         $o_message->SetId($o_row->id);
         $o_message->SetDate($o_row->message_date);
         $o_message->SetBody($o_row->message);
         $o_message->SetUser($o_person);
         $o_message->SetReviewItem($review_item);
         $o_topic->Add($o_message);
     }
     $this->Add($o_topic);
     $result->closeCursor();
 }
 /**
  * @return void
  * @desc Re-build from data posted by this control the data object this control
  * is editing
  */
 function BuildPostedDataObject()
 {
     $user = new User();
     $user->SetId($_POST['item']);
     $user->SetFirstName($_POST['name_first']);
     $user->SetLastName($_POST['name_last']);
     $user->SetName($_POST['known_as']);
     $user->SetEmail($_POST['email']);
     $user->SetAccountDisabled(isset($_POST['disabled']));
     $roles = $this->roles_editor->DataObjects()->GetItems();
     foreach ($roles as $role) {
         $user->Roles()->Add($role);
     }
     $this->SetDataObject($user);
 }
Example #4
0
 function Authenticate()
 {
     $user = new User();
     $user->SetDatabase($this->database);
     $this->logged_in = false;
     if (isset($_COOKIE['cookie_userid']) && isset($_COOKIE['cookie_username']) && isset($_COOKIE['cookie_password'])) {
         $user->SetId($_COOKIE["cookie_userid"]);
         $user->SetUsername($_COOKIE["cookie_username"]);
         $user->SetEncryptedPassword($_COOKIE["cookie_password"]);
         if ($user->UserExists()) {
             if ($user->CheckPassword()) {
                 $this->logged_in = true;
             }
         }
     }
 }
require '../../' . $WEB_SITE . 'src/cdUser.php';
require '../../' . $WEB_SITE . 'src/cdSession.php';
require '../../' . $WEB_SITE . 'src/cdUserInfo.php';
require '../../' . $WEB_SITE . 'src/cdGuardian.php';
$screen_module_name = "Usuário(s)";
if (isset($_POST["p_action"])) {
    $action = $_POST["p_action"];
    $message = "";
    if ($action == 1) {
        $user_id = $_POST["p_user_id"];
        $length = count($user_id);
        if ($length > 0) {
            for ($i = 0; $i < $length; $i++) {
                $user = new User();
                $user->SetDatabase($database);
                $user->SetId($user_id[$i]);
                $user->SelectById();
                $user->SetActive(1);
                $user->Update();
            }
            $message = $screen_module_name . " ativado(s) com sucesso.";
        } else {
            $message = "Não há usuários para serem ativados.";
        }
    }
}
?>

<html>
	<head>
		<title>Schifer's</title>
Example #6
0
        if ($user_password1 != $user_password2) {
            $message = "Senhas não conferem.";
        } else {
            if ($user->Update()) {
                $message = $screen_module_name . " alterado com sucesso.";
                $user_password1 = "";
                $user_password2 = "";
            } else {
                $message = "Problemas na operação.";
            }
        }
    }
    if ($action == 4) {
        $user = new User();
        $user->SetDatabase($database);
        $user->SetId($user_id);
        if ($user->Delete()) {
            $message = $screen_module_name . " excluído com sucesso.";
            $user_id = "";
            $user_username = "";
            $user_password1 = "";
            $user_password2 = "";
            $user_active = "";
        } else {
            $message = "Problemas na operação.";
        }
    }
}
?>

<html>
 /**
  * When a user's credentials have been validated, get more info on that user
  * @param int $user_id
  * @return User
  */
 public function ReadDataForValidUser($user_id)
 {
     $user = null;
     $sql = "SELECT user_id, known_as, name_first, name_last, email, \r\n        disabled, activated, requested_email\r\n        FROM nsa_user WHERE user_id = " . Sql::ProtectNumeric($user_id);
     $result = $this->GetDataConnection()->query($sql);
     $row = $result->fetch();
     if ($row) {
         $user = new User();
         $user->SetId($row->user_id);
         $user->SetName($row->known_as);
         $user->SetFirstName($row->name_first);
         $user->SetLastName($row->name_last);
         $user->SetEmail($row->email);
         $user->SetRequestedEmail($row->requested_email);
         $user->SetAccountActivated($row->activated);
         $user->SetAccountDisabled($row->disabled);
     }
     return $user;
 }