public function authenticate() { $profile=ProfileTable::load($this->_username); if (!$profile) return new Zend_Auth_Result(-1, null, array()); if (!$profile->checkPassword($this->_password)) return new Zend_Auth_Result(-3, null, array()); return new Zend_Auth_Result(1, $profile, array()); }
public function executeAjaxSearch(sfWebRequest $request) { $query = $request->getGetParameter('query'); $profiles = ProfileTable::findProfilesByNameSimilarTo($query); $display_string = "<table>"; foreach ($profiles as $profile) { $display_string .= "<tr>"; $url = $this->generateUrl('profile', array('uid' => $profile['uid'])); $display_string .= "<td><img src = http://rks.ath.cx:8080/nexus+/web/images/" . $profile['pic'] . " width = '30' height = '30'/><a class = 'ajax_search_result' href = {$url}>" . $profile['name'] . "</a></td>"; $display_string .= "</tr>"; } $display_string .= "</table>"; $this->renderText($display_string); //sleep(1); return sfView::NONE; }
function showUsers($list) { echo '<table>'; /* show avatar, username, location, bio (with link to profile) */ foreach ($list as $user) { echo '<tr><td style="padding-bottom: 1em;">'; $profile = ProfileTable::load($user); if ($profile->getAvatar()) { echo '<a href="/profile/show/' . $user . '">' . '<img src="' . $profile->getAvatar() . '" width="64" height="64" /></a>' . '<br />'; } echo '<a href="/profile/show/' . $user . '">' . $user . '</a>'; echo '</td><td style="padding-bottom: 1em;">'; echo $profile->getBio(); echo "<br />"; echo '<span style="font-size: 80%;">' . $profile->getLocation() . '</span>'; echo '</td></tr>'; } echo '</table>'; }
public function processsignupAction() { $request = $this->getRequest(); // Check if we have a POST request if (!$request->isPost()) return $this->_helper->redirector('index'); // Get our form and validate it; display signup form if entries // are invalid $form = $this->getSignupForm(); if (!$form->isValid($request->getPost())) { $this->view->loginForm = $this->getLoginForm(); $this->view->signupForm = $form; return $this->render('index'); } // create the new profile. this function will return null // if the profile already exists $ar=$form->getValues(); $username=$ar['username']; try { $profile = ProfileTable::create($username); } catch (Exception $e) { $this->handleError($e); } if (!$profile) { // already exists $form->setDescription('Username already exists, please choose '. 'another one!'); $this->view->loginForm = $this->getLoginForm(); $this->view->signupForm = $form; return $this->render('index'); } else { // initialize with an empty password $profile->setId($username); $profile->setPasswordPlain(''); ProfileTable::store($profile); // The user was created! Authenticate the user against his empty // password and redirect him to the profile page. $adapter=$this->getAuthAdapter(array('username' => $username, 'password' => '')); $auth=Zend_Auth::getInstance(); $result=$auth->authenticate($adapter); if (!$result->isValid()) die("This should never happen..."); $this->_helper->redirector('index', 'profile'); } }
public function showAction() { $request=$this->getRequest(); $other_id=basename($request->getRequestUri()); $other_profile=ProfileTable::load($other_id); $this->view->profile=$other_profile; // check if we are following this user $profile=Zend_Auth::getInstance()->getIdentity(); $user=UserTable::load($profile->getId()); if ($user->isFollowing($other_id)) $this->view->is_following=true; else $this->view->is_following=false; $other_user=UserTable::load($other_id); // get number of followers $this->view->followers_count=$other_user->getFollowersCount(); // get most recent followers (max 5) $this->view->followers=$other_user->getFollowers(0, 5); // get number of users i am following $this->view->following_count=$other_user->getFollowingCount(); // get most recent followings (max 5) $this->view->following=$other_user->getFollowing(0, 5); // get number of my tweets $this->view->my_stream_count=$other_user->getMyStreamCount(); // get my most recent tweets (max 5) $this->view->my_stream=$other_user->getMyStream(0, 5); }
public function executeUpdateInfoSupp(sfWebRequest $request) { $this->forward404Unless($this->profile = Doctrine_Core::getTable('profile')->find(array($request->getParameter('id'))), sprintf('Object article does not exist (%s).', $request->getParameter('id'))); $this->profileUser = ProfileTable::getInstance()->getProfileForUser($this->getUser()->getGuardUser()->getId())->fetchOne(); if ($this->profileUser->getId() == $this->profile->getId()) { $this->form = new ProfileFormInfoSupp($this->profile); $this->processFormInfoSupp($request, $this->form); } }