Changeset 15508 for events

Show
Ignore:
Timestamp:
07/08/08 23:40:10 (5 years ago)
Author:
riaf
Message:

trunk(for 1.6) 追従
コードの整理
ログイン周りの整理

Location:
events/phpframework/rhaco/trunk
Files:
1 removed
17 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/rhaco/trunk/__init__.php

    r13849 r15508  
    99 
    1010require_once '__settings__.php'; 
    11 Rhaco::import('model.LoginCondition'); 
     11Rhaco::import('network.http.model.RequestLoginConditionDb'); 
     12Rhaco::import('database.DbUtil'); 
    1213Rhaco::import('model.User'); 
    1314 
  • events/phpframework/rhaco/trunk/index.php

    r14540 r15508  
    118118    $db 
    119119); 
     120$request = new Request(); 
     121if($request->isSession('notice')){ 
     122    $parser->setVariable('notice', $request->getSession('notice')); 
     123    $request->clearSession('notice'); 
     124} 
    120125if(RequestLogin::isLogin()){ 
    121126    $parser->setVariable('isLogin', true); 
  • events/phpframework/rhaco/trunk/library/Phwittr.php

    r14540 r15508  
    1515Rhaco::import('model.Follow'); 
    1616Rhaco::import('model.Status'); 
     17Rhaco::import('model.StandBy'); 
    1718 
    1819/** 
     
    205206     
    206207    function loginRequired(){ 
    207         RequestLogin::loginRequired(new LoginCondition($this->dbUtil)); 
    208         return RequestLogin::getLoginSession(); 
     208        if(RequestLogin::silent(new RequestLoginConditionDb($this->dbUtil, new User()))){ 
     209            return RequestLogin::getLoginSession(); 
     210        } 
     211        Header::redirect(Rhaco::url('login')); 
     212        Rhaco::end(); 
    209213    } 
    210214} 
  • events/phpframework/rhaco/trunk/library/PhwittrStatus.php

    r14550 r15508  
    1515        $status = $this->dbUtil->get(new Status($statusId), new C(Q::fact())); 
    1616        if(Variable::istype('TableObjectBase', $status)){ 
     17            $user = $status->factUserId; 
    1718            if($status->factUserId->hasPermission($this->dbUtil, RequestLogin::getLoginSession())){ 
    18                 $user = $status->factUserId; 
    1919                $parser = new HtmlParser(Rhaco::constant('THEME'). '/status_detail.html'); 
    2020                $parser->setVariable('object', $status); 
     
    4444                if(Variable::istype('TableObjectBase', $status)){ 
    4545                    // success 
    46                     $status->user = sprintf('<a href="%s"><img src="%s" width="48" height="48" alt="%s"/></a> <a href="%s">%s</a>', Rhaco::url($user->getName()), Rhaco::url('picture/thumbnail/'.$user->getImage()), $user->getName(), Rhaco::url($user->getName()), $user->getName()); 
    4746                    $replyUserName = $status->getReplyUserName(); 
    4847                    $status->comment = PhwittrFormatter::c($status->comment); 
     
    5352                        'message' => 'status updated!', 
    5453                        'status' => $status, 
     54                        'user' => $user, 
    5555                    ); 
    5656                } else { 
     
    6868                break; 
    6969            default: 
     70                if(Variable::istype('TableObjectBase', $status)) 
     71                    $this->setSession('notice', 'status updated!'); 
    7072                Header::redirect(Rhaco::url('home')); 
    7173        } 
  • events/phpframework/rhaco/trunk/library/PhwittrUser.php

    r14912 r15508  
    1717            Header::redirect(Rhaco::url('home')); 
    1818        } 
    19         $parser = $this->confirmedCreate(Rhaco::url(), new TmpRegistration()); 
     19        $parser = $this->confirmedCreate(new TmpRegistration(), Rhaco::url()); 
    2020        if($this->isPost()){ 
    2121            $parser->setTemplate(Rhaco::constant('THEME') . '/account/create_confirm.html'); 
     
    5858        $user = $this->loginRequired(); 
    5959        $this->clearVariable('id', 'password', 'createdAt', 'updatedAt', 'deleteFlag', 'statusCount', 'followingCount', 'followerCount'); 
    60         $user = $this->dbUtil->get(new User($user->getId())); 
    6160        $this->setVariable('privateFlag', ($this->isVariable('privateFlag')) ? 1 : 0); 
    62         $parser = $this->update(Rhaco::url('account/settings'), $this->toObject($user)); 
     61        $parser = $this->update(new User(), new C(Q::eq(User::columnId(), $user->getId())), Rhaco::url('account/settings')); 
    6362        $parser->setTemplate(Rhaco::constant('THEME') . '/account/settings.html'); 
    6463        $parser->setVariable('user', $user); 
     
    9695            } catch(PicturizeException $e){ 
    9796                L::warning($e->getMessage()); 
     97                $this->setSession('notice', $e->getMessage()); 
    9898                Header::redirect(Rhaco::url('account/picture')); 
    9999            } 
     
    101101            $user->setImage($user->getId() . $file->getExtension()); 
    102102            if($user->save($this->dbUtil)){ 
     103                $this->setSession('notice', 'Nice Picture!'); 
    103104                Header::redirect(Rhaco::url('account/picture')); 
    104105            } 
     
    121122        $user->setImage(''); 
    122123        $user->save($this->dbUtil); 
     124        $this->setSession('notice', 'Picture deleted.'); 
    123125        Header::redirect(Rhaco::url('account/picture')); 
    124126    } 
     
    126128    function follow($followId){ 
    127129        $user = $this->loginRequired(); 
    128         $response = array('error' => 1, 'message' => 'unknown error'); 
     130        $response = array('error' => 1, 'message' => 'POST してくれ。'); 
    129131        if($this->isPost()){ 
    130             $followUser = $this->dbUtil->get(new User($followId)); 
    131             if(Variable::istype('TableObjectBase', $followUser)){ 
    132                 $follow = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(Follow::columnFollowId(), $followUser->getId()))); 
    133                 if(Variable::istype('TableObjectBase', $follow)){ 
    134                     $response = array('error' => 1, 'message' => 'you already following '. $followUser->getName()); 
    135                 } else { 
    136                     $followed = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $followUser->id), Q::eq(Follow::columnFollowId(), $user->id))); 
    137                     // 登録処理 
    138                     if($followUser->privateFlag && !Variable::istype('TableObjectBase', $followed)){ 
    139                         $request = new StandBy(); 
    140                         $request->setUserId($user->id); 
    141                         $request->setRequestId($followUser->id); 
    142                         if($request->save($this->dbUtil)){ 
    143                             $response = array('error' => 0, 'message' => 'You requested a follow from '. $followUser->name. '.'); 
    144                         } 
    145                     } else { 
    146                         $follow = new Follow(); 
    147                         $follow->setUserId($user->getId()); 
    148                         $follow->setFollowId($followUser->getId()); 
    149                         if($follow->save($this->dbUtil)){ 
    150                             $response = array('error' => 0, 'message' => 'You are now following '.$followUser->getName().'.'); 
    151                         } 
    152                     } 
    153                 } 
     132            $follow = new Follow(); 
     133            $follow->setUserId($user->getId()); 
     134            $follow->setFollowId($followUser->getId()); 
     135            if($follow->save($this->dbUtil)){ 
     136                $response = array('error' => 0, 'message' => 'You are now following '.$followUser->getName().'.'); 
     137            } else { 
     138                // TODO: Exception 
     139                $response = array('error' => 1, 'message' => 'なんかしらんけど follow できんかった'); 
    154140            } 
    155         } else { 
    156             Rhaco::end(); 
    157141        } 
    158142        $response = V::toJson($response); 
     
    161145        echo $response; 
    162146        Rhaco::end(); 
    163         Header::redirect(Rhaco::url('home')); 
    164147    } 
    165148     
    166149    function disFollow($followId){ 
    167150        $user = $this->loginRequired(); 
    168         $response = array('error' => 1, 'message' => 'unknown error'); 
     151        $response = array('error' => 1, 'message' => 'POST してくれ。'); 
    169152        if($this->isPost()){ 
    170153            $followUser = $this->dbUtil->get(new User($followId)); 
    171154            $follow = $this->dbUtil->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $user->getId()), Q::eq(Follow::columnFollowId(), $followId))); 
    172155            if(Variable::istype('TableObjectBase', $follow)){ 
    173                 if($user->privateFlag){ 
    174                     $this->dbUtil->delete(new Follow(), new C(Q::eq(Follow::columnFollowId(), $user->getId()), Q::eq(Follow::columnUserId(), $followId))); 
    175                     $request = new StandBy(); 
    176                     $request->setUserId($followUser->id); 
    177                     $request->setRequestId($user->id); 
    178                     $request->save($this->dbUtil); 
    179                 } 
    180156                if($this->dbUtil->delete($follow)){ 
    181157                    $response = array('error' => 0, 'message' => 'You are no longer following '.$followUser->getName().'.'); 
     158                } else { 
     159                    $response = array('error' => 1, 'message' => '削除できなかったよ?なんで?'); 
    182160                } 
    183161            } 
    184         } else { 
    185             Rhaco::end(); 
    186162        } 
    187163        $response = V::toJson($response); 
     
    190166        echo $response; 
    191167        Rhaco::end(); 
    192         Header::redirect(Rhaco::url('home')); 
    193168    } 
    194169     
    195170    function login(){ 
    196171        RequestLogin::loginRequired(new LoginCondition($this->dbUtil)); 
     172        $user = RequestLogin::getLoginSession(); 
     173        $this->setSession('notice', 'Hi! ' . $user->name); 
    197174        Header::redirect(Rhaco::url('home')); 
    198175    } 
  • events/phpframework/rhaco/trunk/library/model/Follow.php

    r14550 r15508  
    1616 */ 
    1717class Follow extends FollowTable{ 
     18    function beforeInsert(&$db){ 
     19        // TODO: エラー時はexception投げましょう 
     20        $user = (Variable::istype('TableObjectBase', $this->factUserId)) ? $this->factUserId : $db->get(new User($this->userId)); 
     21        $followUser = $this->dbUtil->get(new User($this->followId)); 
     22        if(Variable::istype('TableObjectBase', $followUser)){ 
     23            $followed = $db->get(new Follow(), new C(Q::eq(Follow::columnUserId(), $followUser->id), Q::eq(Follow::columnFollowId(), $user->id))); 
     24            if($followUser->privateFlag && !Variable::istype('TableObjectBase', $followed)){ 
     25                $request = new StandBy(); 
     26                $request->setUserId($user->id); 
     27                $request->setRequestId($followUser->id); 
     28                if($request->save($this->dbUtil)){ 
     29                    return true; 
     30                } 
     31            } 
     32        } else { 
     33            return false; 
     34        } 
     35    } 
     36 
     37    function beforeDelete(&$db){ 
     38        $user = (Variable::istype('TableObjectBase', $this->factUserId)) ? $this->factUserId : $db->get(new User($this->userId)); 
     39        if($user->privateFlag){ 
     40            $this->dbUtil->delete(new Follow(), new C(Q::eq(Follow::columnFollowId(), $this->userId), Q::eq(Follow::columnUserId(), $this->followId))); 
     41            $request = new StandBy(); 
     42            $request->setUserId($this->followId); 
     43            $request->setRequestId($this->userId); 
     44            $request->save($db); 
     45        } 
     46    } 
     47 
    1848    function afterInsert(&$db){ 
    1949        $this->recount($db, true); 
  • events/phpframework/rhaco/trunk/library/model/User.php

    r14536 r15508  
    1616class User extends UserTable{ 
    1717    function hasPermission(&$db, $user=null){ 
    18         if(!$this->privateFlag){ 
     18        if(!$this->privateFlag || $this->id === $user->id){ 
    1919            return true; 
    2020        } 
     
    3030    function beforeInsert($db){ 
    3131        $this->password = sha1($this->password); 
     32        $this->hash = $this->_generateCookiekey($this->id, $this->name, $this->password); 
     33    } 
     34    function beforeUpdate($db){ 
     35        $this->hash = $this->_generateCookiekey($this->id, $this->name, $this->password); 
    3236    } 
    3337    function afterUpdate($db){ 
     
    3943        return true; 
    4044    } 
     45 
     46    function loginCondition(&$db, &$var, $request){ 
     47        if(!$request->isPost()){ 
     48            return false; 
     49        } 
     50        $login = $request->getVariable('login'); 
     51        if(strpos($login, '@') !== false){ 
     52            $criterion = Q::eq(User::columnEmail(), $login); 
     53        } else { 
     54            $criterion = Q::eq(User::columnName(), $login); 
     55        } 
     56        $user = $db->get( 
     57            new User(), 
     58            new C( 
     59                $criterion, 
     60                Q::eq(User::columnPassword(), sha1($request->getVariable('password'))) 
     61            ) 
     62        ); 
     63        if(Variable::istype('TableObjectBase', $user)){ 
     64            $var = $user; 
     65            RequestLogin::setLoginCookie($this->_generateCookiekey($user->id, $user->name, $user->password)); 
     66            return true; 
     67        } 
     68        return false; 
     69    } 
     70    function loginConditionCookie(&$db, &$var, $cookiekey){ 
     71        $user = $db->get(new User(), new C(Q::eq(User::columnHash(), $cookiekey))); 
     72        if(Variable::istype('TableObjectBase', $user)){ 
     73            $var = $user; 
     74            return true; 
     75        } 
     76        return false; 
     77    } 
     78    function _generateCookiekey(){ 
     79        return sha1(implode(Rhaco::constant('CONTEXT_URL'), func_get_args())); 
     80    } 
    4181} 
    4282 
  • events/phpframework/rhaco/trunk/library/model/table/FollowTable.php

    r14912 r15508  
    33Rhaco::import("database.model.TableObjectBase"); 
    44Rhaco::import("database.model.DbConnection"); 
     5Rhaco::import("database.TableObjectUtil"); 
     6Rhaco::import("database.model.Table"); 
     7Rhaco::import("database.model.Column"); 
    58/** 
    69 * #ignore 
     
    3033        } 
    3134        function connection(){ 
    32                 return new DbConnection("phwittr"); 
     35                if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 
     36                        Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 
     37                } 
     38                return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 
    3339        } 
    3440        function table(){ 
    35                 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."follow",__CLASS__); 
     41                if(!Rhaco::isVariable("_R_D_T_","Follow")){ 
     42                        Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."follow",__CLASS__),"Follow"); 
     43                } 
     44                return Rhaco::getVariable("_R_D_T_",null,"Follow"); 
    3645        } 
    3746        /** 
     
    4049         */ 
    4150        function columnId(){ 
    42                 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
    43                 $column->label(Message::_("id")); 
    44                 return $column; 
     51                if(!Rhaco::isVariable("_R_D_C_","Follow::Id")){ 
     52                        $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
     53                        $column->label(Message::_("id")); 
     54                        Rhaco::addVariable("_R_D_C_",$column,"Follow::Id"); 
     55                } 
     56                return Rhaco::getVariable("_R_D_C_",null,"Follow::Id"); 
    4557        } 
    46         /**  */ 
     58        /** 
     59         *  
     60         * @return serial        */ 
    4761        function setId($value){ 
    4862                $this->id = TableObjectUtil::cast($value,"serial"); 
    4963        } 
    50         /**  */ 
     64        /** 
     65         *  
     66         */ 
    5167        function getId(){ 
    5268                return $this->id; 
     
    5773         */ 
    5874        function columnUserId(){ 
    59                 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=Follow::FollowId,"); 
    60                 $column->label(Message::_("user_id")); 
    61                 return $column; 
     75                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->label(Message::_("user_id")); 
     78                        Rhaco::addVariable("_R_D_C_",$column,"Follow::UserId"); 
     79                } 
     80                return Rhaco::getVariable("_R_D_C_",null,"Follow::UserId"); 
    6281        } 
    63         /**  */ 
     82        /** 
     83         *  
     84         * @return integer       */ 
    6485        function setUserId($value){ 
    6586                $this->userId = TableObjectUtil::cast($value,"integer"); 
    6687        } 
    67         /**  */ 
     88        /** 
     89         *  
     90         */ 
    6891        function getUserId(){ 
    6992                return $this->userId; 
     
    7497         */ 
    7598        function columnFollowId(){ 
    76                 $column = new Column("column=follow_id,variable=followId,type=integer,size=22,require=true,unique=true,uniqueWith=Follow::UserId,"); 
    77                 $column->label(Message::_("follow_id")); 
    78                 return $column; 
     99                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,"); 
     101                        $column->label(Message::_("follow_id")); 
     102                        Rhaco::addVariable("_R_D_C_",$column,"Follow::FollowId"); 
     103                } 
     104                return Rhaco::getVariable("_R_D_C_",null,"Follow::FollowId"); 
    79105        } 
    80         /**  */ 
     106        /** 
     107         *  
     108         * @return integer       */ 
    81109        function setFollowId($value){ 
    82110                $this->followId = TableObjectUtil::cast($value,"integer"); 
    83111        } 
    84         /**  */ 
     112        /** 
     113         *  
     114         */ 
    85115        function getFollowId(){ 
    86116                return $this->followId; 
     
    91121         */ 
    92122        function columnCreatedAt(){ 
    93                 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
    94                 $column->label(Message::_("created_at")); 
    95                 return $column; 
     123                if(!Rhaco::isVariable("_R_D_C_","Follow::CreatedAt")){ 
     124                        $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
     125                        $column->label(Message::_("created_at")); 
     126                        Rhaco::addVariable("_R_D_C_",$column,"Follow::CreatedAt"); 
     127                } 
     128                return Rhaco::getVariable("_R_D_C_",null,"Follow::CreatedAt"); 
    96129        } 
    97         /**  */ 
     130        /** 
     131         *  
     132         * @return timestamp     */ 
    98133        function setCreatedAt($value){ 
    99134                $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 
    100135        } 
    101         /**  */ 
     136        /** 
     137         *  
     138         */ 
    102139        function getCreatedAt(){ 
    103140                return $this->createdAt; 
  • events/phpframework/rhaco/trunk/library/model/table/FollowingTable.php

    r14912 r15508  
    44Rhaco::import("database.model.DbConnection"); 
    55Rhaco::import("model.User"); 
     6Rhaco::import("database.TableObjectUtil"); 
     7Rhaco::import("database.model.Table"); 
     8Rhaco::import("database.model.Column"); 
    69/** 
    710 * #ignore 
     
    1316 
    1417        function table(){ 
    15                 return new Table(parent::table(),__CLASS__); 
     18                if(!Rhaco::isVariable("_R_D_T_","Following")){ 
     19                        Rhaco::addVariable("_R_D_T_",new Table(parent::table(),__CLASS__),"Following"); 
     20                } 
     21                return Rhaco::getVariable("_R_D_T_",null,"Following"); 
    1622        } 
    1723        function columns(){ 
    18                 return array(Following::columnId(),Following::columnName(),Following::columnPassword(),Following::columnEmail(),Following::columnImage(),Following::columnPrivateFlag(),Following::columnCreatedAt(),Following::columnUpdatedAt(),Following::columnDeleteFlag(),Following::columnStatusCount(),Following::columnFollowingCount(),Following::columnFollowerCount(),); 
     24                return array(Following::columnId(),Following::columnName(),Following::columnPassword(),Following::columnEmail(),Following::columnImage(),Following::columnPrivateFlag(),Following::columnCreatedAt(),Following::columnUpdatedAt(),Following::columnDeleteFlag(),Following::columnHash(),Following::columnStatusCount(),Following::columnFollowingCount(),Following::columnFollowerCount(),); 
    1925        } 
    2026        function columnId(){ 
    21                 return new Column(parent::columnId()); 
     27                if(!Rhaco::isVariable("_R_D_C_","Following::Id")){ 
     28                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnId()),"Following::Id"); 
     29                } 
     30                return Rhaco::getVariable("_R_D_C_",null,"Following::Id");                       
    2231        } 
    2332        function columnName(){ 
    24                 return new Column(parent::columnName()); 
     33                if(!Rhaco::isVariable("_R_D_C_","Following::Name")){ 
     34                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnName()),"Following::Name"); 
     35                } 
     36                return Rhaco::getVariable("_R_D_C_",null,"Following::Name");                     
    2537        } 
    2638        function columnPassword(){ 
    27                 return new Column(parent::columnPassword()); 
     39                if(!Rhaco::isVariable("_R_D_C_","Following::Password")){ 
     40                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword()),"Following::Password"); 
     41                } 
     42                return Rhaco::getVariable("_R_D_C_",null,"Following::Password");                         
    2843        } 
    2944        function columnEmail(){ 
    30                 return new Column(parent::columnEmail()); 
     45                if(!Rhaco::isVariable("_R_D_C_","Following::Email")){ 
     46                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail()),"Following::Email"); 
     47                } 
     48                return Rhaco::getVariable("_R_D_C_",null,"Following::Email");                    
    3149        } 
    3250        function columnImage(){ 
    33                 return new Column(parent::columnImage()); 
     51                if(!Rhaco::isVariable("_R_D_C_","Following::Image")){ 
     52                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage()),"Following::Image"); 
     53                } 
     54                return Rhaco::getVariable("_R_D_C_",null,"Following::Image");                    
    3455        } 
    3556        function columnPrivateFlag(){ 
    36                 return new Column(parent::columnPrivateFlag()); 
     57                if(!Rhaco::isVariable("_R_D_C_","Following::PrivateFlag")){ 
     58                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag()),"Following::PrivateFlag"); 
     59                } 
     60                return Rhaco::getVariable("_R_D_C_",null,"Following::PrivateFlag");                      
    3761        } 
    3862        function columnCreatedAt(){ 
    39                 return new Column(parent::columnCreatedAt()); 
     63                if(!Rhaco::isVariable("_R_D_C_","Following::CreatedAt")){ 
     64                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt()),"Following::CreatedAt"); 
     65                } 
     66                return Rhaco::getVariable("_R_D_C_",null,"Following::CreatedAt");                        
    4067        } 
    4168        function columnUpdatedAt(){ 
    42                 return new Column(parent::columnUpdatedAt()); 
     69                if(!Rhaco::isVariable("_R_D_C_","Following::UpdatedAt")){ 
     70                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt()),"Following::UpdatedAt"); 
     71                } 
     72                return Rhaco::getVariable("_R_D_C_",null,"Following::UpdatedAt");                        
    4373        } 
    4474        function columnDeleteFlag(){ 
    45                 return new Column(parent::columnDeleteFlag()); 
     75                if(!Rhaco::isVariable("_R_D_C_","Following::DeleteFlag")){ 
     76                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag()),"Following::DeleteFlag"); 
     77                } 
     78                return Rhaco::getVariable("_R_D_C_",null,"Following::DeleteFlag");                       
     79        } 
     80        function columnHash(){ 
     81                if(!Rhaco::isVariable("_R_D_C_","Following::Hash")){ 
     82                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash()),"Following::Hash"); 
     83                } 
     84                return Rhaco::getVariable("_R_D_C_",null,"Following::Hash");                     
    4685        } 
    4786        function columnStatusCount(){ 
    48                 return new Column(parent::columnStatusCount()); 
     87                if(!Rhaco::isVariable("_R_D_C_","Following::StatusCount")){ 
     88                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount()),"Following::StatusCount"); 
     89                } 
     90                return Rhaco::getVariable("_R_D_C_",null,"Following::StatusCount");                      
    4991        } 
    5092        function columnFollowingCount(){ 
    51                 return new Column(parent::columnFollowingCount()); 
     93                if(!Rhaco::isVariable("_R_D_C_","Following::FollowingCount")){ 
     94                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount()),"Following::FollowingCount"); 
     95                } 
     96                return Rhaco::getVariable("_R_D_C_",null,"Following::FollowingCount");                   
    5297        } 
    5398        function columnFollowerCount(){ 
    54                 return new Column(parent::columnFollowerCount()); 
     99                if(!Rhaco::isVariable("_R_D_C_","Following::FollowerCount")){ 
     100                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount()),"Following::FollowerCount"); 
     101                } 
     102                return Rhaco::getVariable("_R_D_C_",null,"Following::FollowerCount");                    
    55103        } 
    56104        function setDependStandBys($value){ 
  • events/phpframework/rhaco/trunk/library/model/table/ReplytoTable.php

    r14912 r15508  
    44Rhaco::import("database.model.DbConnection"); 
    55Rhaco::import("model.User"); 
     6Rhaco::import("database.TableObjectUtil"); 
     7Rhaco::import("database.model.Table"); 
     8Rhaco::import("database.model.Column"); 
    69/** 
    710 * #ignore 
     
    1114 
    1215        function table(){ 
    13                 return new Table(parent::table(),__CLASS__); 
     16                if(!Rhaco::isVariable("_R_D_T_","Replyto")){ 
     17                        Rhaco::addVariable("_R_D_T_",new Table(parent::table(),__CLASS__),"Replyto"); 
     18                } 
     19                return Rhaco::getVariable("_R_D_T_",null,"Replyto"); 
    1420        } 
    1521        function columns(){ 
    16                 return array(Replyto::columnId(),Replyto::columnName(),Replyto::columnPassword(),Replyto::columnEmail(),Replyto::columnImage(),Replyto::columnPrivateFlag(),Replyto::columnCreatedAt(),Replyto::columnUpdatedAt(),Replyto::columnDeleteFlag(),Replyto::columnStatusCount(),Replyto::columnFollowingCount(),Replyto::columnFollowerCount(),); 
     22                return array(Replyto::columnId(),Replyto::columnName(),Replyto::columnPassword(),Replyto::columnEmail(),Replyto::columnImage(),Replyto::columnPrivateFlag(),Replyto::columnCreatedAt(),Replyto::columnUpdatedAt(),Replyto::columnDeleteFlag(),Replyto::columnHash(),Replyto::columnStatusCount(),Replyto::columnFollowingCount(),Replyto::columnFollowerCount(),); 
    1723        } 
    1824        function columnId(){ 
    19                 return new Column(parent::columnId()); 
     25                if(!Rhaco::isVariable("_R_D_C_","Replyto::Id")){ 
     26                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnId()),"Replyto::Id"); 
     27                } 
     28                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Id");                         
    2029        } 
    2130        function columnName(){ 
    22                 return new Column(parent::columnName()); 
     31                if(!Rhaco::isVariable("_R_D_C_","Replyto::Name")){ 
     32                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnName()),"Replyto::Name"); 
     33                } 
     34                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Name");                       
    2335        } 
    2436        function columnPassword(){ 
    25                 return new Column(parent::columnPassword()); 
     37                if(!Rhaco::isVariable("_R_D_C_","Replyto::Password")){ 
     38                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnPassword()),"Replyto::Password"); 
     39                } 
     40                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Password");                   
    2641        } 
    2742        function columnEmail(){ 
    28                 return new Column(parent::columnEmail()); 
     43                if(!Rhaco::isVariable("_R_D_C_","Replyto::Email")){ 
     44                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnEmail()),"Replyto::Email"); 
     45                } 
     46                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Email");                      
    2947        } 
    3048        function columnImage(){ 
    31                 return new Column(parent::columnImage()); 
     49                if(!Rhaco::isVariable("_R_D_C_","Replyto::Image")){ 
     50                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnImage()),"Replyto::Image"); 
     51                } 
     52                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Image");                      
    3253        } 
    3354        function columnPrivateFlag(){ 
    34                 return new Column(parent::columnPrivateFlag()); 
     55                if(!Rhaco::isVariable("_R_D_C_","Replyto::PrivateFlag")){ 
     56                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnPrivateFlag()),"Replyto::PrivateFlag"); 
     57                } 
     58                return Rhaco::getVariable("_R_D_C_",null,"Replyto::PrivateFlag");                        
    3559        } 
    3660        function columnCreatedAt(){ 
    37                 return new Column(parent::columnCreatedAt()); 
     61                if(!Rhaco::isVariable("_R_D_C_","Replyto::CreatedAt")){ 
     62                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnCreatedAt()),"Replyto::CreatedAt"); 
     63                } 
     64                return Rhaco::getVariable("_R_D_C_",null,"Replyto::CreatedAt");                  
    3865        } 
    3966        function columnUpdatedAt(){ 
    40                 return new Column(parent::columnUpdatedAt()); 
     67                if(!Rhaco::isVariable("_R_D_C_","Replyto::UpdatedAt")){ 
     68                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnUpdatedAt()),"Replyto::UpdatedAt"); 
     69                } 
     70                return Rhaco::getVariable("_R_D_C_",null,"Replyto::UpdatedAt");                  
    4171        } 
    4272        function columnDeleteFlag(){ 
    43                 return new Column(parent::columnDeleteFlag()); 
     73                if(!Rhaco::isVariable("_R_D_C_","Replyto::DeleteFlag")){ 
     74                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnDeleteFlag()),"Replyto::DeleteFlag"); 
     75                } 
     76                return Rhaco::getVariable("_R_D_C_",null,"Replyto::DeleteFlag");                         
     77        } 
     78        function columnHash(){ 
     79                if(!Rhaco::isVariable("_R_D_C_","Replyto::Hash")){ 
     80                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnHash()),"Replyto::Hash"); 
     81                } 
     82                return Rhaco::getVariable("_R_D_C_",null,"Replyto::Hash");                       
    4483        } 
    4584        function columnStatusCount(){ 
    46                 return new Column(parent::columnStatusCount()); 
     85                if(!Rhaco::isVariable("_R_D_C_","Replyto::StatusCount")){ 
     86                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnStatusCount()),"Replyto::StatusCount"); 
     87                } 
     88                return Rhaco::getVariable("_R_D_C_",null,"Replyto::StatusCount");                        
    4789        } 
    4890        function columnFollowingCount(){ 
    49                 return new Column(parent::columnFollowingCount()); 
     91                if(!Rhaco::isVariable("_R_D_C_","Replyto::FollowingCount")){ 
     92                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowingCount()),"Replyto::FollowingCount"); 
     93                } 
     94                return Rhaco::getVariable("_R_D_C_",null,"Replyto::FollowingCount");                     
    5095        } 
    5196        function columnFollowerCount(){ 
    52                 return new Column(parent::columnFollowerCount()); 
     97                if(!Rhaco::isVariable("_R_D_C_","Replyto::FollowerCount")){ 
     98                        Rhaco::addVariable("_R_D_C_",new Column(parent::columnFollowerCount()),"Replyto::FollowerCount"); 
     99                } 
     100                return Rhaco::getVariable("_R_D_C_",null,"Replyto::FollowerCount");                      
    53101        } 
    54102} 
  • events/phpframework/rhaco/trunk/library/model/table/StandByTable.php

    r14912 r15508  
    33Rhaco::import("database.model.TableObjectBase"); 
    44Rhaco::import("database.model.DbConnection"); 
     5Rhaco::import("database.TableObjectUtil"); 
     6Rhaco::import("database.model.Table"); 
     7Rhaco::import("database.model.Column"); 
    58/** 
    69 * #ignore 
     
    3134        } 
    3235        function connection(){ 
    33                 return new DbConnection("phwittr"); 
     36                if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 
     37                        Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 
     38                } 
     39                return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 
    3440        } 
    3541        function table(){ 
    36                 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."request",__CLASS__); 
     42                if(!Rhaco::isVariable("_R_D_T_","StandBy")){ 
     43                        Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."request",__CLASS__),"StandBy"); 
     44                } 
     45                return Rhaco::getVariable("_R_D_T_",null,"StandBy"); 
    3746        } 
    3847        /** 
     
    4150         */ 
    4251        function columnId(){ 
    43                 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
    44                 $column->label(Message::_("id")); 
    45                 return $column; 
     52                if(!Rhaco::isVariable("_R_D_C_","StandBy::Id")){ 
     53                        $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
     54                        $column->label(Message::_("id")); 
     55                        Rhaco::addVariable("_R_D_C_",$column,"StandBy::Id"); 
     56                } 
     57                return Rhaco::getVariable("_R_D_C_",null,"StandBy::Id"); 
    4658        } 
    47         /**  */ 
     59        /** 
     60         *  
     61         * @return serial        */ 
    4862        function setId($value){ 
    4963                $this->id = TableObjectUtil::cast($value,"serial"); 
    5064        } 
    51         /**  */ 
     65        /** 
     66         *  
     67         */ 
    5268        function getId(){ 
    5369                return $this->id; 
     
    5874         */ 
    5975        function columnUserId(){ 
    60                 $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=StandBy::RequestId,"); 
    61                 $column->label(Message::_("user_id")); 
    62                 return $column; 
     76                if(!Rhaco::isVariable("_R_D_C_","StandBy::UserId")){ 
     77                        $column = new Column("column=user_id,variable=userId,type=integer,size=22,unique=true,reference=User::Id,uniqueWith=StandBy::RequestId,"); 
     78                        $column->label(Message::_("user_id")); 
     79                        Rhaco::addVariable("_R_D_C_",$column,"StandBy::UserId"); 
     80                } 
     81                return Rhaco::getVariable("_R_D_C_",null,"StandBy::UserId"); 
    6382        } 
    64         /**  */ 
     83        /** 
     84         *  
     85         * @return integer       */ 
    6586        function setUserId($value){ 
    6687                $this->userId = TableObjectUtil::cast($value,"integer"); 
    6788        } 
    68         /**  */ 
     89        /** 
     90         *  
     91         */ 
    6992        function getUserId(){ 
    7093                return $this->userId; 
     
    7598         */ 
    7699        function columnRequestId(){ 
    77                 $column = new Column("column=request_id,variable=requestId,type=integer,size=22,require=true,unique=true,reference=Following::Id,uniqueWith=StandBy::UserId,"); 
    78                 $column->label(Message::_("request_id")); 
    79                 return $column; 
     100                if(!Rhaco::isVariable("_R_D_C_","StandBy::RequestId")){ 
     101                        $column = new Column("column=request_id,variable=requestId,type=integer,size=22,require=true,unique=true,reference=Following::Id,uniqueWith=StandBy::UserId,"); 
     102                        $column->label(Message::_("request_id")); 
     103                        Rhaco::addVariable("_R_D_C_",$column,"StandBy::RequestId"); 
     104                } 
     105                return Rhaco::getVariable("_R_D_C_",null,"StandBy::RequestId"); 
    80106        } 
    81         /**  */ 
     107        /** 
     108         *  
     109         * @return integer       */ 
    82110        function setRequestId($value){ 
    83111                $this->requestId = TableObjectUtil::cast($value,"integer"); 
    84112        } 
    85         /**  */ 
     113        /** 
     114         *  
     115         */ 
    86116        function getRequestId(){ 
    87117                return $this->requestId; 
     
    92122         */ 
    93123        function columnCreatedAt(){ 
    94                 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
    95                 $column->label(Message::_("created_at")); 
    96                 return $column; 
     124                if(!Rhaco::isVariable("_R_D_C_","StandBy::CreatedAt")){ 
     125                        $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
     126                        $column->label(Message::_("created_at")); 
     127                        Rhaco::addVariable("_R_D_C_",$column,"StandBy::CreatedAt"); 
     128                } 
     129                return Rhaco::getVariable("_R_D_C_",null,"StandBy::CreatedAt"); 
    97130        } 
    98         /**  */ 
     131        /** 
     132         *  
     133         * @return timestamp     */ 
    99134        function setCreatedAt($value){ 
    100135                $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 
    101136        } 
    102         /**  */ 
     137        /** 
     138         *  
     139         */ 
    103140        function getCreatedAt(){ 
    104141                return $this->createdAt; 
  • events/phpframework/rhaco/trunk/library/model/table/StatusTable.php

    r14912 r15508  
    33Rhaco::import("database.model.TableObjectBase"); 
    44Rhaco::import("database.model.DbConnection"); 
     5Rhaco::import("database.TableObjectUtil"); 
     6Rhaco::import("database.model.Table"); 
     7Rhaco::import("database.model.Column"); 
    58/** 
    69 * #ignore 
     
    3538        } 
    3639        function connection(){ 
    37                 return new DbConnection("phwittr"); 
     40                if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 
     41                        Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 
     42                } 
     43                return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 
    3844        } 
    3945        function table(){ 
    40                 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."status",__CLASS__); 
     46                if(!Rhaco::isVariable("_R_D_T_","Status")){ 
     47                        Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."status",__CLASS__),"Status"); 
     48                } 
     49                return Rhaco::getVariable("_R_D_T_",null,"Status"); 
    4150        } 
    4251        /** 
     
    4554         */ 
    4655        function columnId(){ 
    47                 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
    48                 $column->label(Message::_("id")); 
    49                 return $column; 
    50         } 
    51         /**  */ 
     56                if(!Rhaco::isVariable("_R_D_C_","Status::Id")){ 
     57                        $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
     58                        $column->label(Message::_("id")); 
     59                        Rhaco::addVariable("_R_D_C_",$column,"Status::Id"); 
     60                } 
     61                return Rhaco::getVariable("_R_D_C_",null,"Status::Id"); 
     62        } 
     63        /** 
     64         *  
     65         * @return serial        */ 
    5266        function setId($value){ 
    5367                $this->id = TableObjectUtil::cast($value,"serial"); 
    5468        } 
    55         /**  */ 
     69        /** 
     70         *  
     71         */ 
    5672        function getId(){ 
    5773                return $this->id; 
     
    6278         */ 
    6379        function columnUserId(){ 
    64                 $column = new Column("column=user_id,variable=userId,type=integer,size=22,reference=User::Id,"); 
    65                 $column->label(Message::_("user_id")); 
    66                 return $column; 
    67         } 
    68         /**  */ 
     80                if(!Rhaco::isVariable("_R_D_C_","Status::UserId")){ 
     81                        $column = new Column("column=user_id,variable=userId,type=integer,size=22,reference=User::Id,"); 
     82                        $column->label(Message::_("user_id")); 
     83                        Rhaco::addVariable("_R_D_C_",$column,"Status::UserId"); 
     84                } 
     85                return Rhaco::getVariable("_R_D_C_",null,"Status::UserId"); 
     86        } 
     87        /** 
     88         *  
     89         * @return integer       */ 
    6990        function setUserId($value){ 
    7091                $this->userId = TableObjectUtil::cast($value,"integer"); 
    7192        } 
    72         /**  */ 
     93        /** 
     94         *  
     95         */ 
    7396        function getUserId(){ 
    7497                return $this->userId; 
     
    79102         */ 
    80103        function columnComment(){ 
    81                 $column = new Column("column=comment,variable=comment,type=string,size=140,require=true,"); 
    82                 $column->label(Message::_("comment")); 
    83                 return $column; 
    84         } 
    85         /**  */ 
     104                if(!Rhaco::isVariable("_R_D_C_","Status::Comment")){ 
     105                        $column = new Column("column=comment,variable=comment,type=string,size=140,require=true,"); 
     106                        $column->label(Message::_("comment")); 
     107                        Rhaco::addVariable("_R_D_C_",$column,"Status::Comment"); 
     108                } 
     109                return Rhaco::getVariable("_R_D_C_",null,"Status::Comment"); 
     110        } 
     111        /** 
     112         *  
     113         * @return string        */ 
    86114        function setComment($value){ 
    87115                $this->comment = TableObjectUtil::cast($value,"string"); 
    88116        } 
    89         /**  */ 
     117        /** 
     118         *  
     119         */ 
    90120        function getComment(){ 
    91121                return $this->comment; 
     
    96126         */ 
    97127        function columnReplyUserId(){ 
    98                 $column = new Column("column=reply_user_id,variable=replyUserId,type=integer,size=22,"); 
    99                 $column->label(Message::_("reply_user_id")); 
    100                 return $column; 
    101         } 
    102         /**  */ 
     128                if(!Rhaco::isVariable("_R_D_C_","Status::ReplyUserId")){ 
     129                        $column = new Column("column=reply_user_id,variable=replyUserId,type=integer,size=22,"); 
     130                        $column->label(Message::_("reply_user_id")); 
     131                        Rhaco::addVariable("_R_D_C_",$column,"Status::ReplyUserId"); 
     132                } 
     133                return Rhaco::getVariable("_R_D_C_",null,"Status::ReplyUserId"); 
     134        } 
     135        /** 
     136         *  
     137         * @return integer       */ 
    103138        function setReplyUserId($value){ 
    104139                $this->replyUserId = TableObjectUtil::cast($value,"integer"); 
    105140        } 
    106         /**  */ 
     141        /** 
     142         *  
     143         */ 
    107144        function getReplyUserId(){ 
    108145                return $this->replyUserId; 
     
    113150         */ 
    114151        function columnCreatedAt(){ 
    115                 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
    116                 $column->label(Message::_("created_at")); 
    117                 return $column; 
    118         } 
    119         /**  */ 
     152                if(!Rhaco::isVariable("_R_D_C_","Status::CreatedAt")){ 
     153                        $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
     154                        $column->label(Message::_("created_at")); 
     155                        Rhaco::addVariable("_R_D_C_",$column,"Status::CreatedAt"); 
     156                } 
     157                return Rhaco::getVariable("_R_D_C_",null,"Status::CreatedAt"); 
     158        } 
     159        /** 
     160         *  
     161         * @return timestamp     */ 
    120162        function setCreatedAt($value){ 
    121163                $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 
    122164        } 
    123         /**  */ 
     165        /** 
     166         *  
     167         */ 
    124168        function getCreatedAt(){ 
    125169                return $this->createdAt; 
     
    138182                return $column; 
    139183        } 
    140         /**  */ 
     184        /** 
     185         *  
     186         * @return string        */ 
    141187        function setReplyUserName($value){ 
    142188                $this->replyUserName = TableObjectUtil::cast($value,"string"); 
    143189        } 
    144         /**  */ 
     190        /** 
     191         *  
     192         */ 
    145193        function getReplyUserName(){ 
    146194                return $this->replyUserName; 
  • events/phpframework/rhaco/trunk/library/model/table/TmpRegistrationTable.php

    r14912 r15508  
    33Rhaco::import("database.model.TableObjectBase"); 
    44Rhaco::import("database.model.DbConnection"); 
     5Rhaco::import("database.TableObjectUtil"); 
     6Rhaco::import("database.model.Table"); 
     7Rhaco::import("database.model.Column"); 
    58/** 
    69 * #ignore 
     
    3538        } 
    3639        function connection(){ 
    37                 return new DbConnection("phwittr"); 
     40                if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 
     41                        Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 
     42                } 
     43                return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 
    3844        } 
    3945        function table(){ 
    40                 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."tmp_registration",__CLASS__); 
     46                if(!Rhaco::isVariable("_R_D_T_","TmpRegistration")){ 
     47                        Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."tmp_registration",__CLASS__),"TmpRegistration"); 
     48                } 
     49                return Rhaco::getVariable("_R_D_T_",null,"TmpRegistration"); 
    4150        } 
    4251        /** 
     
    4554         */ 
    4655        function columnId(){ 
    47                 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
    48                 $column->label(Message::_("id")); 
    49                 return $column; 
    50         } 
    51         /**  */ 
     56                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Id")){ 
     57                        $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
     58                        $column->label(Message::_("id")); 
     59                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Id"); 
     60                } 
     61                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Id"); 
     62        } 
     63        /** 
     64         *  
     65         * @return serial        */ 
    5266        function setId($value){ 
    5367                $this->id = TableObjectUtil::cast($value,"serial"); 
    5468        } 
    55         /**  */ 
     69        /** 
     70         *  
     71         */ 
    5672        function getId(){ 
    5773                return $this->id; 
     
    6278         */ 
    6379        function columnName(){ 
    64                 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 
    65                 $column->label(Message::_("name")); 
    66                 return $column; 
    67         } 
    68         /**  */ 
     80                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Name")){ 
     81                        $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 
     82                        $column->label(Message::_("name")); 
     83                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Name"); 
     84                } 
     85                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Name"); 
     86        } 
     87        /** 
     88         *  
     89         * @return string        */ 
    6990        function setName($value){ 
    7091                $this->name = TableObjectUtil::cast($value,"string"); 
    7192        } 
    72         /**  */ 
     93        /** 
     94         *  
     95         */ 
    7396        function getName(){ 
    7497                return $this->name; 
     
    79102         */ 
    80103        function columnPassword(){ 
    81                 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 
    82                 $column->label(Message::_("password")); 
    83                 return $column; 
    84         } 
    85         /**  */ 
     104                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Password")){ 
     105                        $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 
     106                        $column->label(Message::_("password")); 
     107                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Password"); 
     108                } 
     109                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Password"); 
     110        } 
     111        /** 
     112         *  
     113         * @return string        */ 
    86114        function setPassword($value){ 
    87115                $this->password = TableObjectUtil::cast($value,"string"); 
    88116        } 
    89         /**  */ 
     117        /** 
     118         *  
     119         */ 
    90120        function getPassword(){ 
    91121                return $this->password; 
     
    96126         */ 
    97127        function columnEmail(){ 
    98                 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 
    99                 $column->label(Message::_("email")); 
    100                 return $column; 
    101         } 
    102         /**  */ 
     128                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Email")){ 
     129                        $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 
     130                        $column->label(Message::_("email")); 
     131                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Email"); 
     132                } 
     133                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Email"); 
     134        } 
     135        /** 
     136         *  
     137         * @return email         */ 
    103138        function setEmail($value){ 
    104139                $this->email = TableObjectUtil::cast($value,"email"); 
    105140        } 
    106         /**  */ 
     141        /** 
     142         *  
     143         */ 
    107144        function getEmail(){ 
    108145                return $this->email; 
     
    113150         */ 
    114151        function columnHash(){ 
    115                 $column = new Column("column=hash,variable=hash,type=string,"); 
    116                 $column->label(Message::_("hash")); 
    117                 return $column; 
    118         } 
    119         /**  */ 
     152                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::Hash")){ 
     153                        $column = new Column("column=hash,variable=hash,type=string,"); 
     154                        $column->label(Message::_("hash")); 
     155                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::Hash"); 
     156                } 
     157                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::Hash"); 
     158        } 
     159        /** 
     160         *  
     161         * @return string        */ 
    120162        function setHash($value){ 
    121163                $this->hash = TableObjectUtil::cast($value,"string"); 
    122164        } 
    123         /**  */ 
     165        /** 
     166         *  
     167         */ 
    124168        function getHash(){ 
    125169                return $this->hash; 
     
    130174         */ 
    131175        function columnCreatedAt(){ 
    132                 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
    133                 $column->label(Message::_("created_at")); 
    134                 return $column; 
    135         } 
    136         /**  */ 
     176                if(!Rhaco::isVariable("_R_D_C_","TmpRegistration::CreatedAt")){ 
     177                        $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
     178                        $column->label(Message::_("created_at")); 
     179                        Rhaco::addVariable("_R_D_C_",$column,"TmpRegistration::CreatedAt"); 
     180                } 
     181                return Rhaco::getVariable("_R_D_C_",null,"TmpRegistration::CreatedAt"); 
     182        } 
     183        /** 
     184         *  
     185         * @return timestamp     */ 
    137186        function setCreatedAt($value){ 
    138187                $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 
    139188        } 
    140         /**  */ 
     189        /** 
     190         *  
     191         */ 
    141192        function getCreatedAt(){ 
    142193                return $this->createdAt; 
  • events/phpframework/rhaco/trunk/library/model/table/UserTable.php

    r14912 r15508  
    33Rhaco::import("database.model.TableObjectBase"); 
    44Rhaco::import("database.model.DbConnection"); 
     5Rhaco::import("database.TableObjectUtil"); 
     6Rhaco::import("database.model.Table"); 
     7Rhaco::import("database.model.Column"); 
    58/** 
    69 * #ignore 
     
    2629        /**  */ 
    2730        var $deleteFlag; 
     31        /**  */ 
     32        var $hash; 
    2833        /**  */ 
    2934        var $statusCount; 
     
    5156                $this->updatedAt = time(); 
    5257                $this->deleteFlag = 0; 
     58                $this->hash = null; 
    5359                $this->statusCount = 0; 
    5460                $this->followingCount = 0; 
     
    5763        } 
    5864        function connection(){ 
    59                 return new DbConnection("phwittr"); 
     65                if(!Rhaco::isVariable("_R_D_CON_","phwittr")){ 
     66                        Rhaco::addVariable("_R_D_CON_",new DbConnection("phwittr"),"phwittr"); 
     67                } 
     68                return Rhaco::getVariable("_R_D_CON_",null,"phwittr"); 
    6069        } 
    6170        function table(){ 
    62                 return new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."user",__CLASS__); 
     71                if(!Rhaco::isVariable("_R_D_T_","User")){ 
     72                        Rhaco::addVariable("_R_D_T_",new Table(Rhaco::constant("DATABASE_phwittr_PREFIX")."user",__CLASS__),"User"); 
     73                } 
     74                return Rhaco::getVariable("_R_D_T_",null,"User"); 
    6375        } 
    6476        /** 
     
    6779         */ 
    6880        function columnId(){ 
    69                 $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
    70                 $column->label(Message::_("id")); 
    71                 $column->depend("Status::UserId","Follow::UserId","StandBy::UserId"); 
    72                 return $column; 
    73         } 
    74         /**  */ 
     81                if(!Rhaco::isVariable("_R_D_C_","User::Id")){ 
     82                        $column = new Column("column=id,variable=id,type=serial,size=22,primary=true,"); 
     83                        $column->label(Message::_("id")); 
     84                        $column->depend("Status::UserId","Follow::UserId","StandBy::UserId"); 
     85                        Rhaco::addVariable("_R_D_C_",$column,"User::Id"); 
     86                } 
     87                return Rhaco::getVariable("_R_D_C_",null,"User::Id"); 
     88        } 
     89        /** 
     90         *  
     91         * @return serial        */ 
    7592        function setId($value){ 
    7693                $this->id = TableObjectUtil::cast($value,"serial"); 
    7794        } 
    78         /**  */ 
     95        /** 
     96         *  
     97         */ 
    7998        function getId(){ 
    8099                return $this->id; 
     
    85104         */ 
    86105        function columnName(){ 
    87                 $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 
    88                 $column->label(Message::_("name")); 
    89                 return $column; 
    90         } 
    91         /**  */ 
     106                if(!Rhaco::isVariable("_R_D_C_","User::Name")){ 
     107                        $column = new Column("column=name,variable=name,type=string,size=30,require=true,unique=true,chartype=/^[A-Za-z0-9_-]+$/,"); 
     108                        $column->label(Message::_("name")); 
     109                        Rhaco::addVariable("_R_D_C_",$column,"User::Name"); 
     110                } 
     111                return Rhaco::getVariable("_R_D_C_",null,"User::Name"); 
     112        } 
     113        /** 
     114         *  
     115         * @return string        */ 
    92116        function setName($value){ 
    93117                $this->name = TableObjectUtil::cast($value,"string"); 
    94118        } 
    95         /**  */ 
     119        /** 
     120         *  
     121         */ 
    96122        function getName(){ 
    97123                return $this->name; 
     
    102128         */ 
    103129        function columnPassword(){ 
    104                 $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 
    105                 $column->label(Message::_("password")); 
    106                 return $column; 
    107         } 
    108         /**  */ 
     130                if(!Rhaco::isVariable("_R_D_C_","User::Password")){ 
     131                        $column = new Column("column=password,variable=password,type=string,size=100,require=true,"); 
     132                        $column->label(Message::_("password")); 
     133                        Rhaco::addVariable("_R_D_C_",$column,"User::Password"); 
     134                } 
     135                return Rhaco::getVariable("_R_D_C_",null,"User::Password"); 
     136        } 
     137        /** 
     138         *  
     139         * @return string        */ 
    109140        function setPassword($value){ 
    110141                $this->password = TableObjectUtil::cast($value,"string"); 
    111142        } 
    112         /**  */ 
     143        /** 
     144         *  
     145         */ 
    113146        function getPassword(){ 
    114147                return $this->password; 
     
    119152         */ 
    120153        function columnEmail(){ 
    121                 $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 
    122                 $column->label(Message::_("email")); 
    123                 return $column; 
    124         } 
    125         /**  */ 
     154                if(!Rhaco::isVariable("_R_D_C_","User::Email")){ 
     155                        $column = new Column("column=email,variable=email,type=email,size=255,require=true,"); 
     156                        $column->label(Message::_("email")); 
     157                        Rhaco::addVariable("_R_D_C_",$column,"User::Email"); 
     158                } 
     159                return Rhaco::getVariable("_R_D_C_",null,"User::Email"); 
     160        } 
     161        /** 
     162         *  
     163         * @return email         */ 
    126164        function setEmail($value){ 
    127165                $this->email = TableObjectUtil::cast($value,"email"); 
    128166        } 
    129         /**  */ 
     167        /** 
     168         *  
     169         */ 
    130170        function getEmail(){ 
    131171                return $this->email; 
     
    136176         */ 
    137177        function columnImage(){ 
    138                 $column = new Column("column=image,variable=image,type=string,size=50,"); 
    139                 $column->label(Message::_("image")); 
    140                 return $column; 
    141         } 
    142         /**  */ 
     178                if(!Rhaco::isVariable("_R_D_C_","User::Image")){ 
     179                        $column = new Column("column=image,variable=image,type=string,size=50,"); 
     180                        $column->label(Message::_("image")); 
     181                        Rhaco::addVariable("_R_D_C_",$column,"User::Image"); 
     182                } 
     183                return Rhaco::getVariable("_R_D_C_",null,"User::Image"); 
     184        } 
     185        /** 
     186         *  
     187         * @return string        */ 
    143188        function setImage($value){ 
    144189                $this->image = TableObjectUtil::cast($value,"string"); 
    145190        } 
    146         /**  */ 
     191        /** 
     192         *  
     193         */ 
    147194        function getImage(){ 
    148195                return $this->image; 
     
    153200         */ 
    154201        function columnPrivateFlag(){ 
    155                 $column = new Column("column=private_flag,variable=privateFlag,type=boolean,"); 
    156                 $column->label(Message::_("private_flag")); 
    157                 return $column; 
    158         } 
    159         /**  */ 
     202                if(!Rhaco::isVariable("_R_D_C_","User::PrivateFlag")){ 
     203                        $column = new Column("column=private_flag,variable=privateFlag,type=boolean,"); 
     204                        $column->label(Message::_("private_flag")); 
     205                        Rhaco::addVariable("_R_D_C_",$column,"User::PrivateFlag"); 
     206                } 
     207                return Rhaco::getVariable("_R_D_C_",null,"User::PrivateFlag"); 
     208        } 
     209        /** 
     210         *  
     211         * @return boolean       */ 
    160212        function setPrivateFlag($value){ 
    161213                $this->privateFlag = TableObjectUtil::cast($value,"boolean"); 
    162214        } 
    163         /**  */ 
     215        /** 
     216         *  
     217         */ 
    164218        function getPrivateFlag(){ 
    165219                return $this->privateFlag; 
    166220        } 
     221        /**  */ 
     222        function isPrivateFlag(){ 
     223                return $this->privateFlag; 
     224        } 
    167225        /** 
    168226         *  
     
    170228         */ 
    171229        function columnCreatedAt(){ 
    172                 $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
    173                 $column->label(Message::_("created_at")); 
    174                 return $column; 
    175         } 
    176         /**  */ 
     230                if(!Rhaco::isVariable("_R_D_C_","User::CreatedAt")){ 
     231                        $column = new Column("column=created_at,variable=createdAt,type=timestamp,"); 
     232                        $column->label(Message::_("created_at")); 
     233                        Rhaco::addVariable("_R_D_C_",$column,"User::CreatedAt"); 
     234                } 
     235                return Rhaco::getVariable("_R_D_C_",null,"User::CreatedAt"); 
     236        } 
     237        /** 
     238         *  
     239         * @return timestamp     */ 
    177240        function setCreatedAt($value){ 
    178241                $this->createdAt = TableObjectUtil::cast($value,"timestamp"); 
    179242        } 
    180         /**  */ 
     243        /** 
     244         *  
     245         */ 
    181246        function getCreatedAt(){ 
    182247                return $this->createdAt; 
     
    191256         */ 
    192257        function columnUpdatedAt(){ 
    193                 $column = new Column("column=updated_at,variable=updatedAt,type=timestamp,"); 
    194                 $column->label(Message::_("updated_at")); 
    195                 return $column; 
    196         } 
    197         /**  */ 
     258                if(!Rhaco::isVariable("_R_D_C_","User::UpdatedAt")){ 
     259                        $column = new Column("column=updated_at,variable=updatedAt,type=timestamp,"); 
     260                        $column->label(Message::_("updated_at")); 
     261                        Rhaco::addVariable("_R_D_C_",$column,"User::UpdatedAt"); 
     262                } 
     263                return Rhaco::getVariable("_R_D_C_",null,"User::UpdatedAt"); 
     264        } 
     265        /** 
     266         *  
     267         * @return timestamp     */ 
    198268        function setUpdatedAt($value){ 
    199269                $this->updatedAt = TableObjectUtil::cast($value,"timestamp"); 
    200270        } 
    201         /**  */ 
     271        /** 
     272         *  
     273         */ 
    202274        function getUpdatedAt(){ 
    203275                return $this->updatedAt; 
     
    212284         */ 
    213285        function columnDeleteFlag(){ 
    214                 $column = new Column("column=delete_flag,variable=deleteFlag,type=boolean,"); 
    215                 $column->label(Message::_("delete_flag")); 
    216                 return $column; 
    217         } 
    218         /**  */ 
     286                if(!Rhaco::isVariable("_R_D_C_","User::DeleteFlag")){ 
     287                        $column = new Column("column=delete_flag,variable=deleteFlag,type=boolean,"); 
     288                        $column->label(Message::_("delete_flag")); 
     289                        Rhaco::addVariable("_R_D_C_",$column,"User::DeleteFlag"); 
     290                } 
     291                return Rhaco::getVariable("_R_D_C_",null,"User::DeleteFlag"); 
     292        } 
     293        /** 
     294         *  
     295         * @return boolean       */ 
    219296        function setDeleteFlag($value){ 
    220297                $this->deleteFlag = TableObjectUtil::cast($value,"boolean"); 
    221298        } 
    222         /**  */ 
     299        /** 
     300         *  
     301         */ 
    223302        function getDeleteFlag(){ 
    224303                return $this->deleteFlag; 
    225304        } 
     305        /**  */ 
     306        function isDeleteFlag(){ 
     307                return $this->deleteFlag; 
     308        } 
     309        /** 
     310         *  
     311         * @return database.model.Column 
     312         */ 
     313        function columnHash(){ 
     314                if(!Rhaco::isVariable("_R_D_C_","User::Hash")){ 
     315                        $column = new Column("column=hash,variable=hash,type=string,"); 
     316                        $column->label(Message::_("hash")); 
     317                        Rhaco::addVariable("_R_D_C_",$column,"User::Hash"); 
     318                } 
     319                return Rhaco::getVariable("_R_D_C_",null,"User::Hash"); 
     320        } 
     321        /** 
     322         *  
     323         * @return string        */ 
     324        function setHash($value){ 
     325                $this->hash = TableObjectUtil::cast($value,"string"); 
     326        } 
     327        /** 
     328         *  
     329         */ 
     330        function getHash(){ 
     331                return $this->hash; 
     332        } 
    226333        /** 
    227334         *  
     
    229336         */ 
    230337        function columnStatusCount(){ 
    231                 $column = new Column("column=status_count,variable=statusCount,type=integer,size=22,"); 
    232                 $column->label(Message::_("status_count")); 
    233                 return $column; 
    234         } 
    235         /**  */ 
     338                if(!Rhaco::isVariable("_R_D_C_","User::StatusCount")){ 
     339                        $column = new Column("column=status_count,variable=statusCount,type=integer,size=22,"); 
     340                        $column->label(Message::_("status_count")); 
     341                        Rhaco::addVariable("_R_D_C_",$column,"User::StatusCount"); 
     342                } 
     343                return Rhaco::getVariable("_R_D_C_",null,"User::StatusCount"); 
     344        } 
     345        /** 
     346         *  
     347         * @return integer       */ 
    236348        function setStatusCount($value){ 
    237349                $this->statusCount = TableObjectUtil::cast($value,"integer"); 
    238350        } 
    239         /**  */ 
     351        /** 
     352         *  
     353         */ 
    240354        function getStatusCount(){ 
    241355                return $this->statusCount; 
     
    246360         */ 
    247361        function columnFollowingCount(){ 
    248                 $column = new Column("column=following_count,variable=followingCount,type=integer,size=22,"); 
    249                 $column->label(Message::_("following_count")); 
    250                 return $column; 
    251         } 
    252         /**  */ 
     362                if(!Rhaco::isVariable("_R_D_C_","User::FollowingCount")){ 
     363                        $column = new Column("column=following_count,variable=followingCount,type=integer,size=22,"); 
     364                        $column->label(Message::_("following_count")); 
     365                        Rhaco::addVariable("_R_D_C_",$column,"User::FollowingCount"); 
     366                } 
     367                return Rhaco::getVariable("_R_D_C_",null,"User::FollowingCount"); 
     368        } 
     369        /** 
     370         *  
     371         * @return integer       */ 
    253372        function setFollowingCount($value){ 
    254373                $this->followingCount = TableObjectUtil::cast($value,"integer"); 
    255374        } 
    256         /**  */ 
     375        /** 
     376         *  
     377         */ 
    257378        function getFollowingCount(){ 
    258379                return $this->followingCount; 
     
    263384         */ 
    264385        function columnFollowerCount(){ 
    265                 $column = new Column("column=follower_count,variable=followerCount,type=integer,size=22,"); 
    266                 $column->label(Message::_("follower_count")); 
    267                 return $column; 
    268         } 
    269         /**  */ 
     386                if(!Rhaco::isVariable("_R_D_C_","User::FollowerCount")){ 
     387                        $column = new Column("column=follower_count,variable=followerCount,type=integer,size=22,"); 
     388                        $column->label(Message::_("follower_count")); 
     389                        Rhaco::addVariable("_R_D_C_",$column,"User::FollowerCount"); 
     390                } 
     391                return Rhaco::getVariable("_R_D_C_",null,"User::FollowerCount"); 
     392        } 
     393        /** 
     394         *  
     395         * @return integer       */ 
    270396        function setFollowerCount($value){ 
    271397                $this->followerCount = TableObjectUtil::cast($value,"integer"); 
    272398        } 
    273         /**  */ 
     399        /** 
     400         *  
     401         */ 
    274402        function getFollowerCount(){ 
    275403                return $this->followerCount; 
  • events/phpframework/rhaco/trunk/resources/templates/default/js/application.js

    r14159 r15508  
    4848                        } else { 
    4949                                status_countup(); 
    50                                 status_load(response['status']); 
     50                                status_load(response['status'], response['user']); 
    5151                        } 
    5252                }, 
     
    5858}); 
    5959 
    60 function status_load(status){ 
     60function status_load(status, user){ 
    6161        $('#timelines').prepend( 
    62                 '<dt>' + status['user'] + "</dt>\n" 
     62                '<dt><a href="'+phwittr_url+user['name']+'"><img src="'+phwittr_url+'picture/thumbnail/'+user['image'] 
     63                 + '" width="48" height="48" alt="'+user['name']+'"/></a> ' 
     64                 + '<a href="'+phwittr_url+user['name']+'">' + user['name'] + "</a></dt>\n" 
    6365                 + '<dd>' + status['comment'] + "</dd>\n" 
    6466                 + '<dd class="meta"><a href="'+phwittr_url+'statuses/'+status['id']+'">' + status['createdAt'] + "</a>" + status['replyTo'] 
    6567                 + "</dd>\n" 
    6668        ); 
     69        // わからん。やり方教えれ。 
     70        // window.Hatena.Star.EntryLoader.loadNewEntries($('#timelines dd').get()[0]); 
    6771} 
    6872 
  • events/phpframework/rhaco/trunk/resources/templates/default/layout.html

    r14534 r15508  
    2323          } 
    2424        }; 
     25<rt:if param="{$notice}"> 
     26        $(function(){ 
     27                notice('{$notice}'); 
     28        }); 
     29</rt:if> 
    2530        </script> 
    2631        <title><rt:block name="title">{$rhaco.constant('SITE_NAME')}</rt:block></title> 
  • events/phpframework/rhaco/trunk/setup/project.xml

    r14912 r15508  
    1313            <column name="delete_flag" type="boolean" default="0" /> 
    1414            <!-- 以下、勝手に追加 --> 
     15            <column name="hash" type="string" /> 
    1516            <column name="status_count" type="integer" default="0" /> 
    1617            <column name="following_count" type="integer" default="0" />