Changeset 14534
- Timestamp:
- 06/24/08 22:18:30 (5 years ago)
- Location:
- events/phpframework/rhaco/trunk
- Files:
-
- 3 added
- 4 modified
-
index.php (modified) (3 diffs)
-
library/Phwittr.php (modified) (2 diffs)
-
library/PhwittrUser.php (modified) (1 diff)
-
resources/templates/default/account/password.html (added)
-
resources/templates/default/account/settings.html (added)
-
resources/templates/default/layout.html (modified) (1 diff)
-
resources/templates/default/protected.html (added)
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/rhaco/trunk/index.php
r14011 r14534 18 18 $parser = Urls::parser( 19 19 array( 20 // Index Page 20 21 '^$' => array( 21 22 'class' => 'Phwittr', 22 23 'method' => 'index', 23 ),24 '^home$' => array(25 'class' => 'Phwittr',26 'method' => 'home',27 ),28 '^status\/update$' => array(29 'class' => 'PhwittrStatus',30 'method' => 'status_update',31 ),32 '^account\/archive$' => array(33 'class' => 'Phwittr',34 'method' => 'archive',35 24 ), 36 25 '^public_timeline$' => array( … … 42 31 'method' => 'replies', 43 32 ), 33 34 // 更新 35 '^status\/update$' => array( 36 'class' => 'PhwittrStatus', 37 'method' => 'status_update', 38 ), 39 40 // Home Page (Logged in) 41 '^home$' => array( 42 'class' => 'Phwittr', 43 'method' => 'home', 44 ), 45 '^account\/archive$' => array( 46 'class' => 'Phwittr', 47 'method' => 'archive', 48 ), 44 49 '^statuses\/(\d+)$' => array( 45 50 'class' => 'PhwittrStatus', 46 51 'method' => 'status_detail', 52 ), 53 54 // Follow 55 '^friendships\/create\/(\d+)$' => array( 56 'class' => 'PhwittrUser', 57 'method' => 'follow', 58 ), 59 '^friendships\/destroy\/(\d+)$' => array( 60 'class' => 'PhwittrUser', 61 'method' => 'disFollow', 62 ), 63 64 // ログイン/サインアップ 65 '^login$' => array( 66 'class' => 'PhwittrUser', 67 'method' => 'login', 68 ), 69 '^logout$' => array( 70 'class' => 'PhwittrUser', 71 'method' => 'logout', 47 72 ), 48 73 '^signup$' => array( … … 54 79 'method' => 'signup', 55 80 ), 56 '^login$' => array(81 '^account\/settings$' => array( 57 82 'class' => 'PhwittrUser', 58 'method' => ' login',83 'method' => 'settings', 59 84 ), 60 '^ logout$' => array(85 '^account\/password$' => array( 61 86 'class' => 'PhwittrUser', 62 'method' => ' logout',87 'method' => 'passwordChange', 63 88 ), 89 // '^account\/picture$' => array( 90 // 'class' => 'PhwittrUser', 91 // 'method' => 'picture', 92 // ), 64 93 '^account\/confirm\/(.*?)$' => array( 65 94 'class' => 'PhwittrUser', 66 95 'method' => 'confirm', 67 96 ), 68 '^friendships\/create\/(\d+)$' => array( 69 'class' => 'PhwittrUser', 70 'method' => 'follow', 71 ), 72 '^friendships\/destroy\/(\d+)$' => array( 73 'class' => 'PhwittrUser', 74 'method' => 'disFollow', 75 ), 97 76 98 // 最後じゃないとダメよ 77 99 '^([A-Za-z0-9_-]+)$' => array( -
events/phpframework/rhaco/trunk/library/Phwittr.php
r13964 r14534 46 46 } 47 47 48 $parser = $this->read( 49 new Status(), 50 new Criteria( 48 // protected な人とか居るよねえ。こんな雰囲気で良いのかなあ 49 $login = $this->getLoginSession(); 50 if($this->isLogin() && $user->getId() == $login->getId()){ 51 $criteria = new C( 51 52 Q::eq(Status::columnUserId(), $user->getId()), 52 53 Q::orc( … … 58 59 ), 59 60 Q::orderDesc(Status::columnCreatedAt()) 60 ) 61 ); 62 } else { 63 $criteria = new C( 64 Q::eq(Status::columnUserId(), $user->getId()), 65 Q::orc( 66 Q::selectIn( 67 Status::columnUserId(), 68 Follow::columnFollowId(), 69 new Criteria(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(User::columnPrivateFlag(), false)) 70 ) 71 ), 72 Q::orderDesc(Status::columnCreatedAt()) 73 ); 74 } 75 76 $parser = $this->read( 77 new Status(), 78 $criteria 61 79 ); 62 80 $parser->setVariable('user', $user); -
events/phpframework/rhaco/trunk/library/PhwittrUser.php
r14125 r14534 53 53 return $parser; 54 54 } 55 55 56 function settings(){ 57 $user = $this->loginRequired(); 58 $this->clearVariable('id', 'password', 'createdAt', 'updatedAt', 'deleteFlag', 'statusCount', 'followingCount', 'followerCount'); 59 $user = $this->dbUtil->get(new User($user->getId())); 60 $this->setVariable('privateFlag', ($this->isVariable('privateFlag')) ? 1 : 0); 61 $parser = $this->update(Rhaco::url('account/settings'), $this->toObject($user)); 62 $parser->setTemplate(Rhaco::constant('THEME') . '/account/settings.html'); 63 return $parser; 64 } 65 66 function passwordChange(){ 67 $user = $this->loginRequired(); 68 $user = $this->dbUtil->get(new User($user->getId())); 69 if( 70 $this->isPost() 71 && sha1($this->getVariable('oldPassword')) == $user->getPassword() 72 && $this->getVariable('password') == $this->getVariable('passwordConf') 73 ){ 74 $user->setPassword(sha1($this->getVariable('password'))); 75 if($user->save($this->dbUtil)){ 76 Header::redirect(Rhaco::url('account/password')); 77 } 78 } 79 return new HtmlParser(Rhaco::constant('THEME') .'/account/password.html'); 80 } 81 56 82 function follow($followId){ 57 83 $user = $this->loginRequired(); -
events/phpframework/rhaco/trunk/resources/templates/default/layout.html
r14159 r14534 39 39 <ul> 40 40 <li><a href="{$rhaco.url()}">home</a></li> 41 <li><a href="http://phwittr.riaf.jp.s.hatena.ne.jp/">Favorites</a></li>42 41 <li><a href="{$rhaco.url('public_timeline')}">everyone</a></li> 43 42 <rt:if param="{$isLogin}"> 44 43 <li><a href="{$rhaco.url('replies')}">replies</a></li> 45 44 <li><a href="{$rhaco.url('account/archive')}">archive</a></li> 45 <li><a href="{$rhaco.url('account/settings')}">settings</a></li> 46 46 <li><a href="{$rhaco.url('logout')}">logout</a></li> 47 47 <rt:else />
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)