Exemplo n.º 1
0
 /**
  * Save blog settings
  *
  * @return     void
  */
 private function _savesettings()
 {
     if (User::isGuest()) {
         $this->setError(Lang::txt('GROUPS_LOGIN_NOTICE'));
         return;
     }
     if ($this->authorized != 'manager' && $this->authorized != 'admin') {
         $this->setError(Lang::txt('PLG_GROUPS_BLOG_NOT_AUTHORIZED'));
         return $this->_browse();
     }
     // Check for request forgeries
     Request::checkToken();
     $settings = Request::getVar('settings', array(), 'post');
     $row = \Hubzero\Plugin\Params::blank()->set($settings);
     // Get parameters
     $p = new \Hubzero\Config\Registry(Request::getVar('params', array(), 'post'));
     $row->set('params', $p->toString());
     // Store new content
     if (!$row->save()) {
         $this->setError($row->getError());
         return $this->_settings();
     }
     // Record the activity
     $recipients = array(['group', $this->group->get('gidNumber')]);
     foreach ($this->group->get('managers') as $recipient) {
         $recipients[] = ['user', $recipient];
     }
     Event::trigger('system.logActivity', ['activity' => ['action' => 'updated', 'scope' => 'blog.settings', 'scope_id' => $row->get('id'), 'description' => Lang::txt('PLG_GROUPS_BLOG_ACTIVITY_SETTINGS_UPDATED')], 'recipients' => $recipients]);
     App::redirect(Route::url('index.php?option=com_groups&cn=' . $this->group->get('cn') . '&active=' . $this->_name . '&action=settings'), Lang::txt('PLG_GROUPS_BLOG_SETTINGS_SAVED'), 'passed');
 }
Exemplo n.º 2
0
 /**
  * Save blog settings
  *
  * @return  void
  */
 private function _savesettings()
 {
     if (User::isGuest()) {
         return $this->_login();
     }
     if (User::get('id') != $this->member->get('id')) {
         $this->setError(Lang::txt('PLG_MEMBERS_BLOG_NOT_AUTHORIZED'));
         return $this->_browse();
     }
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $settings = Request::getVar('settings', array(), 'post');
     $row = \Hubzero\Plugin\Params::blank()->set($settings);
     $p = new \Hubzero\Config\Registry(Request::getVar('params', array(), 'post'));
     $row->set('params', $p->toString());
     // Store new content
     if (!$row->save()) {
         $this->setError($row->getError());
         return $this->_settings();
     }
     // Log the activity
     Event::trigger('system.logActivity', ['activity' => ['action' => 'updated', 'scope' => 'blog.settings', 'scope_id' => $row->get('id'), 'description' => Lang::txt('PLG_MEMBERS_BLOG_ACTIVITY_SETTINGS_UPDATED')], 'recipients' => [$this->member->get('id')]]);
     App::redirect(Route::url($this->member->link() . '&active=' . $this->_name . '&task=settings'), Lang::txt('PLG_MEMBERS_BLOG_SETTINGS_SAVED'));
 }