Changeset 20593
- Timestamp:
- 10/03/08 12:53:45 (3 months ago)
- Location:
- events/phpframework
- Files:
-
- 3 added
- 13 modified
-
piece_framework/trunk/web/frontend/webapp/templates/Globals/Guest.html (added)
-
piece_framework/trunk/web/frontend/webapp/templates/Globals/Index.html (added)
-
piece_framework/trunk/web/frontend/webapp/templates/Globals/User.html (added)
-
rhaco/trunk/index.php (modified) (3 diffs)
-
rhaco/trunk/library/Phwittr.php (modified) (4 diffs)
-
rhaco/trunk/library/PhwittrStatus.php (modified) (1 diff)
-
rhaco/trunk/library/PhwittrUser.php (modified) (1 diff)
-
rhaco/trunk/library/model/StandBy.php (modified) (1 diff)
-
rhaco/trunk/library/model/table/FollowTable.php (modified) (8 diffs)
-
rhaco/trunk/library/model/table/FollowingTable.php (modified) (13 diffs)
-
rhaco/trunk/library/model/table/ReplytoTable.php (modified) (13 diffs)
-
rhaco/trunk/library/model/table/StandByTable.php (modified) (8 diffs)
-
rhaco/trunk/library/model/table/StatusTable.php (modified) (11 diffs)
-
rhaco/trunk/library/model/table/TmpRegistrationTable.php (modified) (12 diffs)
-
rhaco/trunk/library/model/table/UserTable.php (modified) (28 diffs)
-
rhaco/trunk/resources/templates/default/js/application.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/rhaco/trunk/index.php
r20591 r20593 16 16 17 17 $db = new DbUtil(User::connection()); 18 RequestLogin::silent(new RequestLoginConditionDb($db, new User())); 18 19 $parser = Urls::parser( 19 20 array( … … 61 62 'method' => 'disFollow', 62 63 ), 63 64 // Request 65 '^friend_requests$' => array( 66 'class' => 'PhwittrUser', 67 'method' => 'friend_requests', 68 ), 69 '^friend_requests\/accept\/(\d+)$' => array( 70 'class' => 'PhwittrUser', 71 'method' => 'acceptRequest', 72 ), 73 '^friend_requests\/deny\/(\d+)$' => array( 74 'class' => 'PhwittrUser', 75 'method' => 'denyRequest', 76 ), 77 64 78 // ログイン/サインアップ 65 79 '^login$' => array( … … 129 143 $parser->setVariable('pf', new PhwittrFormatter()); 130 144 $parser->write(); 145 -
events/phpframework/rhaco/trunk/library/Phwittr.php
r20587 r20593 50 50 $login = $this->getLoginSession(); 51 51 if($this->isLogin() && $user->getId() == $login->getId()){ 52 $criteria = new C( 52 $selectC = new Criteria(Q::eq(Follow::columnUserId(), $user->getId())); 53 } else { 54 $selectC = new Criteria(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(User::columnPrivateFlag(), false)); 55 } 56 57 $parser = $this->read( 58 new Status(), 59 new C( 53 60 Q::eq(Status::columnUserId(), $user->getId()), 54 61 Q::orc( … … 56 63 Status::columnUserId(), 57 64 Follow::columnFollowId(), 58 new Criteria(Q::eq(Follow::columnUserId(), $user->getId()))65 $selectC 59 66 ) 60 67 ), 61 68 Q::orderDesc(Status::columnCreatedAt()) 62 ); 63 } else { 64 $criteria = new C( 65 Q::eq(Status::columnUserId(), $user->getId()), 66 Q::orc( 67 Q::selectIn( 68 Status::columnUserId(), 69 Follow::columnFollowId(), 70 new Criteria(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(User::columnPrivateFlag(), false)) 71 ) 72 ), 73 Q::orderDesc(Status::columnCreatedAt()) 74 ); 75 } 76 77 $parser = $this->read( 78 new Status(), 79 $criteria 69 ) 80 70 ); 81 71 $parser->setVariable('user', $user); … … 134 124 Header::inline(Rhaco::constant(VAR_UPLOAD_PATH).'/default.gif', 'default', 'image/gif'); 135 125 Rhaco::end(); 136 }137 138 function _getLoginedParser(){139 if(RequestLogin::isLogin()){140 $user = RequestLogin::getLoginSession();141 $parser = new HtmlParser();142 $parser->setVariable('user', $user);143 $parser->setVariable('following', $this->_getFollowing($user));144 return $parser;145 }146 return false;147 126 } 148 127 … … 206 185 207 186 function loginRequired(){ 208 if(RequestLogin::silent(new RequestLoginConditionDb($this->dbUtil, new User()))){ 187 if(RequestLogin::isLoginSession()) return RequestLogin::getLoginSession(); 188 if(RequestLogin::isLoginCookie() && RequestLogin::silent(new RequestLoginConditionDb($this->dbUtil, new User()))){ 209 189 return RequestLogin::getLoginSession(); 210 190 } 191 RequestLogin::loginRequired(new RequestLoginConditionDb($this->dbUtil, new User())); 211 192 Header::redirect(Rhaco::url('login')); 212 193 Rhaco::end(); -
events/phpframework/rhaco/trunk/library/PhwittrStatus.php
r20589 r20593 40 40 $status = $this->dbUtil->insert($this->toObject(new Status())); 41 41 } 42 switch($this->getVariable('type', 'html')){ 43 case 'json': 44 if(Variable::istype('TableObjectBase', $status)){ 45 // success 46 $replyUserName = $status->getReplyUserName(); 47 $status->comment = PhwittrFormatter::c($status->comment); 48 $status->createdAt = TemplateFormatter::dateformat($status->createdAt); 49 $status->replyTo = ($status->replyUserId) ? sprintf(' in reply to <a href="%s">%s</a>', Rhaco::url($replyUserName), $replyUserName) : ''; 50 $response = array( 51 'error' => 0, 52 'message' => 'status updated!', 53 'status' => $status, 54 'user' => $user, 55 ); 56 } else { 57 // fail 58 $error = array_shift(ExceptionTrigger::get('Status_comment')); 59 $response = array( 60 'error' => 1, 61 'message' => $error->getMessage(), 62 ); 63 } 64 $response = V::toJson($response); 65 header('Content-type: application/json; charset=UTF-8'); 66 header(sprintf("X-JSON: (%s)", $response)); 67 echo $response; 68 break; 69 default: 70 if(Variable::istype('TableObjectBase', $status)) 71 $this->setSession('notice', 'status updated!'); 72 Header::redirect(Rhaco::url('home')); 42 if(Variable::istype('TableObjectBase', $status)){ 43 // success 44 $replyUserName = $status->getReplyUserName(); 45 $status->comment = PhwittrFormatter::c($status->comment); 46 $status->createdAt = TemplateFormatter::dateformat($status->createdAt); 47 $status->replyTo = ($status->replyUserId) ? sprintf(' in reply to <a href="%s">%s</a>', Rhaco::url($replyUserName), $replyUserName) : ''; 48 $response = array( 49 'error' => 0, 50 'message' => 'status updated!', 51 'status' => $status, 52 'user' => $user, 53 ); 54 } else { 55 // fail 56 $error = array_shift(ExceptionTrigger::get('Status_comment')); 57 $response = array( 58 'error' => 1, 59 'message' => $error->getMessage(), 60 ); 73 61 } 62 $response = V::toJson($response); 63 header('Content-type: application/json; charset=UTF-8'); 64 header(sprintf("X-JSON: (%s)", $response)); 65 echo $response; 74 66 Rhaco::end(); 75 67 } -
events/phpframework/rhaco/trunk/library/PhwittrUser.php
r20592 r20593 168 168 } 169 169 170 function friend_requests(){ 171 $user = $this->loginRequired(); 172 if($user->privateFlag == false){ 173 Header::redirect(Rhaco::url('home')); 174 } 175 $parser = $this->read(new StandBy(), new C(Q::eq(StandBy::columnRequestId(), $user->getId()), Q::fact())); 176 $parser->setTemplate(Rhaco::constant('THEME').'/friend_requests.html'); 177 $parser->setVariable('user', $user); 178 $parser->setVariable('following', $this->_getFollowing($user)); 179 return $parser; 180 } 181 function acceptRequest($id){ 182 $user = $this->loginRequired(); 183 $request = $this->dbUtil->get(new StandBy($id)); 184 if(Variable::istype('TableObjectBase', $request) && $request->requestId == $user->id){ 185 $request->accept($this->dbUtil); 186 } 187 Header::redirect(Rhaco::url('friend_requests')); 188 } 189 function denyRequest($id){ 190 $user = $this->loginRequired(); 191 $request = $this->dbUtil->get(new StandBy($id)); 192 if(Variable::istype('TableObjectBase', $request) && $request->requestId == $user->id){ 193 $request->deny($this->dbUtil); 194 } 195 Header::redirect(Rhaco::url('friend_requests')); 196 } 197 170 198 function login(){ 171 199 $user = $this->loginRequired(); -
events/phpframework/rhaco/trunk/library/model/StandBy.php
r14912 r20593 1 1 <?php 2 2 Rhaco::import("model.table.StandByTable"); 3 Rhaco::import('model.Follow'); 3 4 /** 4 5 * 5 6 */ 6 7 class StandBy extends StandByTable{ 7 8 // 相互接続した方がいいのかな? 9 function accept(&$db){ 10 $follow = new Follow(); 11 $follow->setUserId($this->userId); 12 $follow->setFollowId($this->requestId); 13 if($follow->save($db)){ 14 $db->delete($this); 15 return true; 16 } 17 return false; 18 } 19 function deny(&$db){ 20 return $db->delete($this); 21 } 8 22 } 9 23 -
events/phpframework/rhaco/trunk/library/model/table/FollowTable.php
r20590 r20593 50 50 function columnId(){ 51 51 if(!Rhaco::isVariable("_R_D_C_","Follow::Id")){ 52 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true," );52 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,",__CLASS__); 53 53 $column->label(Message::_("id")); 54 54 Rhaco::addVariable("_R_D_C_",$column,"Follow::Id"); … … 58 58 /** 59 59 * 60 * @return serial */ 60 * @return serial 61 */ 61 62 function setId($value){ 62 63 $this->id = TableObjectUtil::cast($value,"serial"); … … 74 75 function columnUserId(){ 75 76 if(!Rhaco::isVariable("_R_D_C_","Follow::UserId")){ 76 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=Follow::FollowId," );77 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=Follow::FollowId,",__CLASS__); 77 78 $column->label(Message::_("user_id")); 78 79 Rhaco::addVariable("_R_D_C_",$column,"Follow::UserId"); … … 82 83 /** 83 84 * 84 * @return integer */ 85 * @return integer 86 */ 85 87 function setUserId($value){ 86 88 $this->userId = TableObjectUtil::cast($value,"integer"); … … 98 100 function columnFollowId(){ 99 101 if(!Rhaco::isVariable("_R_D_C_","Follow::FollowId")){ 100 $column = new Column("column=follow_id,variable=followId,type=integer,size=22,require=true,unique=true,uniqueWith=Follow::UserId," );102 $column = new Column("column=follow_id,variable=followId,type=integer,size=22,require=true,unique=true,uniqueWith=Follow::UserId,",__CLASS__); 101 103 $column->label(Message::_("follow_id")); 102 104 Rhaco::addVariable("_R_D_C_",$column,"Follow::FollowId"); … … 106 108 /** 107 109 * 108 * @return integer */ 110 * @return integer 111 */ 109 112 function setFollowId($value){ 110 113 $this->followId = TableObjectUtil::cast($value,"integer"); … … 122 125 function columnCreatedAt(){ 123 126 if(!Rhaco::isVariable("_R_D_C_","Follow::CreatedAt")){ 124 $column = new Column("column=created_at,variable=createdAt,type=timestamp," );127 $column = new Column("column=created_at,variable=createdAt,type=timestamp,",__CLASS__); 125 128 $column->label(Message::_("created_at")); 126 129 Rhaco::addVariable("_R_D_C_",$column,"Follow::CreatedAt"); … … 130 133 /** 131 134 * 132 * @return timestamp */ 135 * @return timestamp 136 */ 133 137 function setCreatedAt($value){ 134 138 $this->createdAt = TableObjectUtil::cast($value,"timestamp"); -
events/phpframework/rhaco/trunk/library/model/table/FollowingTable.php
r20590 r20593 26 26 function columnId(){ 27 27 if(!Rhaco::isVariable("_R_D_C_","Following::Id")){ 28 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId() ),"Following::Id");28 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId(),__CLASS__),"Following::Id"); 29 29 } 30 30 return Rhaco::getVariable("_R_D_C_",null,"Following::Id"); … … 32 32 function columnName(){ 33 33 if(!Rhaco::isVariable("_R_D_C_","Following::Name")){ 34 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName() ),"Following::Name");34 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName(),__CLASS__),"Following::Name"); 35 35 } 36 36 return Rhaco::getVariable("_R_D_C_",null,"Following::Name"); … … 38 38 function columnPassword(){ 39 39 if(!Rhaco::isVariable("_R_D_C_","Following::Password")){ 40 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword() ),"Following::Password");40 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword(),__CLASS__),"Following::Password"); 41 41 } 42 42 return Rhaco::getVariable("_R_D_C_",null,"Following::Password"); … … 44 44 function columnEmail(){ 45 45 if(!Rhaco::isVariable("_R_D_C_","Following::Email")){ 46 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail() ),"Following::Email");46 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail(),__CLASS__),"Following::Email"); 47 47 } 48 48 return Rhaco::getVariable("_R_D_C_",null,"Following::Email"); … … 50 50 function columnImage(){ 51 51 if(!Rhaco::isVariable("_R_D_C_","Following::Image")){ 52 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage() ),"Following::Image");52 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage(),__CLASS__),"Following::Image"); 53 53 } 54 54 return Rhaco::getVariable("_R_D_C_",null,"Following::Image"); … … 56 56 function columnPrivateFlag(){ 57 57 if(!Rhaco::isVariable("_R_D_C_","Following::PrivateFlag")){ 58 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag() ),"Following::PrivateFlag");58 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag(),__CLASS__),"Following::PrivateFlag"); 59 59 } 60 60 return Rhaco::getVariable("_R_D_C_",null,"Following::PrivateFlag"); … … 62 62 function columnCreatedAt(){ 63 63 if(!Rhaco::isVariable("_R_D_C_","Following::CreatedAt")){ 64 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt() ),"Following::CreatedAt");64 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt(),__CLASS__),"Following::CreatedAt"); 65 65 } 66 66 return Rhaco::getVariable("_R_D_C_",null,"Following::CreatedAt"); … … 68 68 function columnUpdatedAt(){ 69 69 if(!Rhaco::isVariable("_R_D_C_","Following::UpdatedAt")){ 70 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt() ),"Following::UpdatedAt");70 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt(),__CLASS__),"Following::UpdatedAt"); 71 71 } 72 72 return Rhaco::getVariable("_R_D_C_",null,"Following::UpdatedAt"); … … 74 74 function columnDeleteFlag(){ 75 75 if(!Rhaco::isVariable("_R_D_C_","Following::DeleteFlag")){ 76 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag() ),"Following::DeleteFlag");76 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag(),__CLASS__),"Following::DeleteFlag"); 77 77 } 78 78 return Rhaco::getVariable("_R_D_C_",null,"Following::DeleteFlag"); … … 80 80 function columnHash(){ 81 81 if(!Rhaco::isVariable("_R_D_C_","Following::Hash")){ 82 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash() ),"Following::Hash");82 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash(),__CLASS__),"Following::Hash"); 83 83 } 84 84 return Rhaco::getVariable("_R_D_C_",null,"Following::Hash"); … … 86 86 function columnStatusCount(){ 87 87 if(!Rhaco::isVariable("_R_D_C_","Following::StatusCount")){ 88 Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount() ),"Following::StatusCount");88 Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount(),__CLASS__),"Following::StatusCount"); 89 89 } 90 90 return Rhaco::getVariable("_R_D_C_",null,"Following::StatusCount"); … … 92 92 function columnFollowingCount(){ 93 93 if(!Rhaco::isVariable("_R_D_C_","Following::FollowingCount")){ 94 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount() ),"Following::FollowingCount");94 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount(),__CLASS__),"Following::FollowingCount"); 95 95 } 96 96 return Rhaco::getVariable("_R_D_C_",null,"Following::FollowingCount"); … … 98 98 function columnFollowerCount(){ 99 99 if(!Rhaco::isVariable("_R_D_C_","Following::FollowerCount")){ 100 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount() ),"Following::FollowerCount");100 Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount(),__CLASS__),"Following::FollowerCount"); 101 101 } 102 102 return Rhaco::getVariable("_R_D_C_",null,"Following::FollowerCount"); -
events/phpframework/rhaco/trunk/library/model/table/ReplytoTable.php
r20590 r20593 24 24 function columnId(){ 25 25 if(!Rhaco::isVariable("_R_D_C_","Replyto::Id")){ 26 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId() ),"Replyto::Id");26 Rhaco::addVariable("_R_D_C_",new Column(parent::columnId(),__CLASS__),"Replyto::Id"); 27 27 } 28 28 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Id"); … … 30 30 function columnName(){ 31 31 if(!Rhaco::isVariable("_R_D_C_","Replyto::Name")){ 32 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName() ),"Replyto::Name");32 Rhaco::addVariable("_R_D_C_",new Column(parent::columnName(),__CLASS__),"Replyto::Name"); 33 33 } 34 34 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Name"); … … 36 36 function columnPassword(){ 37 37 if(!Rhaco::isVariable("_R_D_C_","Replyto::Password")){ 38 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword() ),"Replyto::Password");38 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword(),__CLASS__),"Replyto::Password"); 39 39 } 40 40 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Password"); … … 42 42 function columnEmail(){ 43 43 if(!Rhaco::isVariable("_R_D_C_","Replyto::Email")){ 44 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail() ),"Replyto::Email");44 Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail(),__CLASS__),"Replyto::Email"); 45 45 } 46 46 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Email"); … … 48 48 function columnImage(){ 49 49 if(!Rhaco::isVariable("_R_D_C_","Replyto::Image")){ 50 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage() ),"Replyto::Image");50 Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage(),__CLASS__),"Replyto::Image"); 51 51 } 52 52 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Image"); … … 54 54 function columnPrivateFlag(){ 55 55 if(!Rhaco::isVariable("_R_D_C_","Replyto::PrivateFlag")){ 56 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag() ),"Replyto::PrivateFlag");56 Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag(),__CLASS__),"Replyto::PrivateFlag"); 57 57 } 58 58 return Rhaco::getVariable("_R_D_C_",null,"Replyto::PrivateFlag"); … … 60 60 function columnCreatedAt(){ 61 61 if(!Rhaco::isVariable("_R_D_C_","Replyto::CreatedAt")){ 62 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt() ),"Replyto::CreatedAt");62 Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt(),__CLASS__),"Replyto::CreatedAt"); 63 63 } 64 64 return Rhaco::getVariable("_R_D_C_",null,"Replyto::CreatedAt"); … … 66 66 function columnUpdatedAt(){ 67 67 if(!Rhaco::isVariable("_R_D_C_","Replyto::UpdatedAt")){ 68 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt() ),"Replyto::UpdatedAt");68 Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt(),__CLASS__),"Replyto::UpdatedAt"); 69 69 } 70 70 return Rhaco::getVariable("_R_D_C_",null,"Replyto::UpdatedAt"); … … 72 72 function columnDeleteFlag(){ 73 73 if(!Rhaco::isVariable("_R_D_C_","Replyto::DeleteFlag")){ 74 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag() ),"Replyto::DeleteFlag");74 Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag(),__CLASS__),"Replyto::DeleteFlag"); 75 75 } 76 76 return Rhaco::getVariable("_R_D_C_",null,"Replyto::DeleteFlag"); … … 78 78 function columnHash(){ 79 79 if(!Rhaco::isVariable("_R_D_C_","Replyto::Hash")){ 80 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash() ),"Replyto::Hash");80 Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash(),__CLASS__),"Replyto::Hash"); 81 81 } 82 82 return Rhaco::getVariable("_R_D_C_",null,"Replyto::Hash"); … … 84 84 function columnStatusCount(){ 85 85 if(!Rhaco::isVariable("_R_D_C_","Replyto::StatusCount")){ 86 &nb
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)