예제 #1
0
 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 protected function prepare(array $args = array())
 {
     if ($this->needPost && !$this->isPost()) {
         // TRANS: Client error. POST is a HTTP command. It should not be translated.
         $this->clientError(_('This method requires a POST.'), 405);
     }
     // needPost, of course, overrides canPost if true
     if (!$this->canPost) {
         $this->canPost = $this->needPost;
     }
     $this->args = common_copy_args($args);
     // This could be set with get_called_action and then
     // chop off 'Action' from the class name. In lower case.
     $this->action = strtolower($this->trimmed('action'));
     if ($this->ajax || $this->boolean('ajax')) {
         // check with GNUsocial::isAjax()
         GNUsocial::setAjax(true);
     }
     if ($this->needLogin) {
         $this->checkLogin();
         // if not logged in, this redirs/excepts
     }
     $this->updateScopedProfile();
     return true;
 }