24 require_once(
'Zend/Auth.php');
25 require_once(
'ProfileTable.php');
26 require_once(
'Profile.php');
27 require_once(
'UserTable.php');
28 require_once(
'User.php');
33 require_once(
'ProfileForm.php');
35 'action' =>
'/profile/process',
42 if (!Zend_Auth::getInstance()->hasIdentity())
43 $this->_helper->redirector(
'index',
'index');
47 $profile=Zend_Auth::getInstance()->getIdentity();
49 $this->view->username=$profile->getId();
53 $this->view->followers_count=$user->getFollowersCount();
55 $this->view->followers=$user->getFollowers(0, 5);
58 $this->view->following_count=$user->getFollowingCount();
60 $this->view->following=$user->getFollowing(0, 5);
63 $this->view->my_stream_count=$user->getMyStreamCount();
65 $this->view->my_stream=$user->getMyStream(0, 5);
69 $profile=Zend_Auth::getInstance()->getIdentity();
70 $request = $this->getRequest();
71 $this->view->username=$profile->getId();
74 if (!$request->isPost())
75 return $this->_helper->redirector(
'index',
'index');
79 if (!$form->isValid($request->getPost())) {
80 $this->view->form = $form;
81 return $this->render(
'index');
85 $ar=$form->getValues();
88 if ($ar[
'username']!=$profile->getId())
89 die(
"This should never happen...");
92 $profile->setPasswordPlain($ar[
'password']);
93 if ($ar[
'display_name']!=$profile->getDisplayName())
94 $profile->setDisplayName($ar[
'display_name']);
95 if ($ar[
'email']!=$profile->getEmail())
96 $profile->setEmail($ar[
'email']);
97 if ($ar[
'location']!=$profile->getLocation())
98 $profile->setLocation($ar[
'location']);
99 if ($ar[
'webpage']!=$profile->getWebpage())
100 $profile->setWebpage($ar[
'webpage']);
101 if ($ar[
'avatar']!=$profile->getAvatar())
102 $profile->setAvatar($ar[
'avatar']);
105 $form->setDescription(
'Your profile was saved.');
106 $this->view->form = $form;
107 return $this->render(
'index');
111 $request=$this->getRequest();
112 $other_id=basename($request->getRequestUri());
114 $this->view->profile=$other_profile;
117 $profile=Zend_Auth::getInstance()->getIdentity();
119 if ($user->isFollowing($other_id))
120 $this->view->is_following=
true;
122 $this->view->is_following=
false;
127 $this->view->followers_count=$other_user->getFollowersCount();
129 $this->view->followers=$other_user->getFollowers(0, 5);
132 $this->view->following_count=$other_user->getFollowingCount();
134 $this->view->following=$other_user->getFollowing(0, 5);
137 $this->view->my_stream_count=$other_user->getMyStreamCount();
139 $this->view->my_stream=$other_user->getMyStream(0, 5);
143 $request=$this->getRequest();
144 $other=basename($request->getRequestUri());
147 $profile=Zend_Auth::getInstance()->getIdentity();
152 if ($user->isFollowing($other))
153 return $this->_helper->redirector(
'index',
'index');
156 $user->follow($other);
157 return $this->_helper->redirector->gotoUrl(
"/profile/show/$other");
161 $request=$this->getRequest();
162 $other=basename($request->getRequestUri());
165 $profile=Zend_Auth::getInstance()->getIdentity();
170 if (!$user->isFollowing($other)) {
171 return $this->_helper->redirector(
'index',
'index');
175 $user->unfollow($other);
176 return $this->_helper->redirector->gotoUrl(
"/profile/show/$other");
Copyright (C) 2007-2015 Hypertable, Inc.