/** * */ public function register_user_informationAction() { $dataRequest = $this->request->getJsonPost(); $fields = array("key", "name", "last_name", "email", "image", "phone", "uuid", "platform"); if ($this->_checkFields($dataRequest, $fields)) { if ($this->_validKey()) { $user = new User(); $user->setName($dataRequest->name); $user->setLastName($dataRequest->last_name); $user->setEmail($dataRequest->email); $user->setImage($dataRequest->image); $user->setPhone($dataRequest->phone); $user->setUuid($dataRequest->uuid); $user->setPlatform($dataRequest->platform); $user->setSession(true); $user->setFirstConnection($this->_dateTime->format("Y-m-d H:m:s")); $user->setLastConnection($this->_dateTime->format("Y-m-d H:m:s")); $user->setStatus(1); if ($user->save()) { $this->setJsonResponse(ControllerBase::SUCCESS, ControllerBase::FAILED_MESSAGE, array("status" => $this->strings->getString("http", "success"), "message" => $this->strings->getString("user", "insert_success"), "data" => array("user_id" => $user->getIdUser()))); } else { $this->setJsonResponse(ControllerBase::SUCCESS, ControllerBase::FAILED_MESSAGE, array("status" => $this->strings->getString("http", "error"), "message" => $this->_checkError($user), "data" => $return)); } } } }
public static function find($id) { $db = Database::getInstance(); $pstmt = $db->prepare("SELECT * FROM user WHERE email = :x"); $pstmt->execute(array(':x' => $id)); $result = $pstmt->fetch(PDO::FETCH_OBJ); $p = new User(); if ($result) { $p->setID($result->id); $p->setEmail($result->email); $p->setPassword($result->password); $p->setIsActive($result->isActive); $p->setUsername($result->username); $p->setImage($result->image); $p->setDescription($result->description); $p->setFerraille($result->ferraille); $p->setPrestige($result->prestige); $pstmt->closeCursor(); $db = Database::close(); return $p; } $pstmt->closeCursor(); $db = Database::close(); return null; }
sendResponse(400, json_encode($response)); return false; } //Insert image into bucket $result = $client->putObject(array( 'Bucket' => $cdimageBucket['Name'], 'Key' => "/img/".$newFileNameWithExt, 'SourceFile' => $_FILES['file']['tmp_name'] )); // We can poll the object until it is accessible $client->waitUntil('ObjectExists', array( 'Bucket' => $cdimageBucket['Name'], 'Key' => "/img/".$newFileNameWithExt )); $Image->create($newFileNameWithExt); //Update the user's image $User->deleteImage(); $User->setImage($Image->ID); //Set the status to 1 (success) $response['meta']['status'] = 1; $response['data']['imageURL'] = $signedURL; //Send the response sendResponse(200, json_encode($response)); return true; ?>
$charity = $db->getCharity($product->getCharity()); if (is_null($charity)) { $charity = new Charity(); } $seller = $product->getSeller(); if (is_null($seller)) { $seller = new User(); } $user = $_SESSION['user']; if (!$util->isValidUser($user)) { //Disabled until login is working! header('Location: login.php'); } else { } //temporary here $seller->setImage("images/creep.jpg"); ?> <!DOCTYPE HTML> <HTML> <HEAD> <title>DonorBid.com</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
public static function createUser($username) { $user = new User(); $user->setUser($username); $user->setName($username); $user->setEmail($username . "@imperial.ac.uk"); $user->setInfo(json_encode(array())); $user->setVisits(0); $user->setIp(0); $user->setImage(676); // FIXME - Move to const $user->setShowEmail(TRUE); $user->setShowLdap(TRUE); $user->updateName(); $user->updateEmail(); $user->updateInfo(); $user->save(); return $user; }
public function getUser($user) { $data = array(); $data[] = $user->getToken(); $query = <<<SQL \t\t\t\tSELECT \t\t\t\t\tid, \t\t\t\t\tname, \t\t\t\t\temail, \t\t\t\t\timage \t\t\t\t\tFROM \t\t\t\t\t\tam_user \t\t\t\t\tWHERE \t\t\t\t\t\ttoken = "{$data['0']}" \t\t\t\t\tLIMIT 1 SQL; //exit($this->conn->removeBreakLine($query)); $result = $this->conn->getConn()->query($query); $auxUser = new User(); while ($data = $result->fetch_object()) { $auxUser->setId($data->id); $auxUser->setName($data->name); $auxUser->setEmail($data->email); $auxUser->setImage($data->image); } $result->free(); return $auxUser; }