Ejemplo n.º 1
0
 public function executeLoginInfo(sfWebRequest $request)
 {
     if (!$this->getUser()->isAtLeast(Users::MANAGER)) {
         if ($this->getUser()->getId() != $request->getParameter('user_ref')) {
             $this->forwardToSecureAction();
         }
     }
     $this->forward404Unless($this->user = Doctrine::getTable('Users')->find($request->getparameter('user_ref')), sprintf('User does not exist (%s).', $request->getParameter('user_ref')));
     $this->loginInfo = Doctrine::getTable('UsersLoginInfos')->find($request->getParameter('id'));
     if (!$this->loginInfo) {
         $this->loginInfo = new UsersLoginInfos();
         $this->loginInfo->setUserRef($request->getParameter('user_ref'));
     }
     if (!$this->getUser()->isAtLeast(Users::MANAGER) && $this->loginInfo->getLoginType() != 'local') {
         $this->forwardToSecureAction();
     }
     $this->form = new UsersLoginInfosForm($this->loginInfo);
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('users_login_infos'));
         if ($request->getParameter('user_ref') != $this->form->getValue('user_ref') && !$this->getUser()->isA(Users::ADMIN)) {
             $this->forwardToSecureAction();
         }
         if ($this->form->isValid()) {
             try {
                 $this->form->save();
             } catch (Exception $e) {
                 return $this->renderText($e->getMessage());
             }
             return $this->renderText('ok');
         }
     }
 }
Ejemplo n.º 2
0
 public function executeAjaxRegist(sfWebRequest $request)
 {
     $this->nickname = $this->getUser()->getMember()->getName();
     $y = $request->getParameter('y');
     if (empty($y)) {
         $y = date('Y');
     }
     $m = $request->getParameter('m');
     if (empty($m)) {
         $m = date('m');
     }
     $d = $request->getParameter('d');
     if (empty($d)) {
         $d = date('d');
     }
     $this->data = $request->getParameter('keitai') . $request->getParameter('sh') . $request->getparameter('sm') . $request->getparameter('eh') . $request->getParameter('em');
     $this->rest = $request->getParameter('rest');
     $this->comment = $request->getParameter('comment');
     $this->y = $y;
     $this->m = $m;
     $this->d = $d;
     $this->setLayout(false);
     return sfView::SUCCESS;
 }