Changeset 20337

Show
Ignore:
Timestamp:
10/01/08 07:40:30 (3 months ago)
Author:
anatoo
Message:

足りてなかったアクション追加など

Location:
events/phpframework/plain_php/trunk/action
Files:
6 added
1 removed
7 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/plain_php/trunk/action/AcountCreateAction.php

    r20039 r20337  
    1919        } 
    2020         
    21         if (empty($email)) { 
    22             $t->addMessage('メールアドレスが空です。'); 
     21        if (strlen($user_name) < 5) { 
     22            $t->addMessage('ユーザー名は最低5文字以上入力してください。');         
    2323            return $t; 
    2424        } 
    25          
    26         if (empty($password)) { 
    27             $t->addMessage('パスワードが空です。');         
    28             return $t; 
    29         } 
    30          
    31         if (strlen($password) < 6) { 
    32             $t->addMessage('パスワードは最低六文字以上入力してください。');         
    33             return $t; 
    34         } 
    35          
    3625         
    3726        if (in_array($user_name,  
     
    5342        } 
    5443         
     44        if (empty($email)) { 
     45            $t->addMessage('メールアドレスが空です。'); 
     46            return $t; 
     47        } 
     48         
    5549        if (!preg_match('/^([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i', $email)) { 
    5650            $t->addMessage('不正なメールアドレスです。'); 
     
    5852        } 
    5953         
     54        if (empty($password)) { 
     55            $t->addMessage('パスワードが空です。');         
     56            return $t; 
     57        } 
     58         
     59        if (strlen($password) < 6) { 
     60            $t->addMessage('パスワードは最低6文字以上入力してください。');         
     61            return $t; 
     62        } 
     63         
     64 
     65         
     66         
    6067        $token = md5($user_name . (string)time()); 
    6168        $this->getAcountService()->insert($user_name, $email, $password, $token); 
     69         
     70        $activate_url = $this->baseUrl . '/activate/' . $token; 
     71        send_mail($email, 'Phwittrへようこそ!',  
     72            'ようこそ! ' . $user_name . ' 
     73  
     74下のリンクで ' . $user_name . 'のアカウントを有効にしてください。 
     75  ' . $activate_url . ' 
     76 
     77それでは 
     78Phwittr',  
     79            $this->getConfig()->mail_from); 
    6280         
    6381        $t->setTemplateName('acount_create'); 
  • events/phpframework/plain_php/trunk/action/AcountSettingsAction.php

    r20039 r20337  
    4444        $as = $this->getAcountService(); 
    4545        $as->updateEmail($session->user_id, $email); 
    46         if ($t->user['private_flag'] !== $private_flag)  
    47             $private_flag ? $as->setPrivate($session->user_id) : $as->setPublic($session->user_id); 
    48          
     46        if ($t->user['private_flag'] !== $private_flag) { 
     47            if (!$private_flag) { 
     48                $result = $as->setPublic($session->user_id); 
     49            } else { 
     50                $result = $as->setPrivate($session->user_id); 
     51            } 
     52        } 
     53        $t->user = $this->getAcountService()->fetchByID($session->user_id); 
     54             
    4955        $t->addMessage('設定を保存しました'); 
    5056        return $t; 
  • events/phpframework/plain_php/trunk/action/FriendsAction.php

    r20039 r20337  
    1313        $r = new TemplateResponse('followings'); 
    1414        $r->user_name = $session->user_name; 
     15        $r->session = $session; 
    1516        $r->page = intval($this->req->GET('page', 0)); 
    1617        if ($r->page < 0) $r->page = 0; 
  • events/phpframework/plain_php/trunk/action/StatusUpdateAction.php

    r20039 r20337  
    1313        $url = $this->req->HTTP_REFERER; 
    1414        $comment = $this->req->POST('comment', ''); 
    15         // @todo このへん上位モデルを作っておくべきか 
     15 
    1616        if (preg_match('#^@([[:word:]]{1,30})#', $comment, $matches)) {  
    1717            $reply_user = $this->getAcountService()->fetchByUserName($matches[1]); 
     
    2626            $this->getStatusService()->reply($this->getSession()->user_id, $comment, $reply_user_id); 
    2727             
    28         throw new RedirectResponse($url); 
     28        throw new RedirectResponse($this->baseUrl . '/home'); 
    2929    } 
    3030} 
  • events/phpframework/plain_php/trunk/action/StatusesAction.php

    r20039 r20337  
    88         
    99        $st = $this->getStatusService()->fetch($this->args[0]) or raise(new NotFoundResponse); 
    10         $st['title_comment'] = h($st['comment']); 
    11         $st['comment'] = preg_replace('#@([[:word:]]{1,30})#',  
    12                                       '@<a href="' . $this->baseUrl . '/$1">$1</a>',  
    13                                       h($st['comment'])); 
    1410        $t->status = $st; 
    1511        $t->session = $this->getSession(); 
  • events/phpframework/plain_php/trunk/action/UserAction.php

    r20039 r20337  
    3535        $r->follower_count = $fs->fetchFollowerCount($user['id']); 
    3636         
     37        if ($r->is_logined) { 
     38            $r->is_self = $is_self = $r->session->user_id === $user['id']; 
     39            $r->is_following = $is_self || $fs->isFollowing($r->session->user_id, $user['id']); 
     40            $r->is_requesting = !$is_self && $fs->isRequesting($r->session->user_id, $user['id']); 
     41            $r->is_requesting_self = !$is_self && $fs->isRequesting($user['id'], $r->session->user_id); 
     42        } 
     43         
    3744        return $r; 
    3845    } 
  • events/phpframework/plain_php/trunk/action/UserFriendsAction.php

    r20039 r20337  
    1414        $r = new TemplateResponse('user_followings'); 
    1515        $r->user = $user; 
     16        $r->session = $this->getSession(); 
    1617        $r->user_name = $user['user_name']; 
    1718        $r->page = intval($this->req->GET('page', 0));