예제 #1
0
파일: errors.php 프로젝트: rboyatt/mahara
 public function render_exception()
 {
     global $USER, $SESSION;
     if (defined('GROUP') && $USER->is_logged_in()) {
         $roles = $USER->get('grouproles');
         if (!isset($roles[GROUP])) {
             $group = group_current_group();
             if ($group->jointype == 'open' || get_record('group_member_invite', 'group', GROUP, 'member', $USER->get('id'))) {
                 $message = get_string('notmembermayjoin', 'group', $group->name);
                 // Error code equals 1 if we have objection=1 in url
                 if ($this->getCode() == '1') {
                     $message .= ' ' . get_string('accessdeniedobjection', 'error');
                 }
                 $SESSION->add_error_msg($message);
                 $next = substr($_SERVER['REQUEST_URI'], strlen(get_mahara_install_subdirectory()) - 1);
                 $goto = group_homepage_url($group);
                 $goto .= (strpos($goto, '?') ? '&' : '?') . 'next=' . urlencode($next);
                 redirect($goto);
             }
             if ($group->request && !get_record('group_member_request', 'group', GROUP, 'member', $USER->get('id'))) {
                 $SESSION->add_error_msg(get_string('notamember', 'group'));
                 redirect(get_config('wwwroot') . 'group/requestjoin.php?id=' . GROUP . '&returnto=view');
             }
         }
     }
     header("HTTP/1.0 403 Forbidden", true);
     return parent::render_exception();
 }
 /**
  * @param string this parameter is ignored but required by PHP
  */
 public function __construct($message = '', $code = 0, Exception $previous = null)
 {
     parent::__construct(_('Ung�ltiges oder fehlendes Sicherheits-Token.'));
 }
예제 #3
0
 /**
  * Create a new level denied exception instance.
  *
  * @param string $level
  */
 public function __construct($level)
 {
     parent::__construct("You don't have a required '" . $level . "' level.");
 }
예제 #4
0
 public function render_exception()
 {
     global $USER, $SESSION;
     if (defined('GROUP') && $USER->is_logged_in()) {
         $roles = $USER->get('grouproles');
         if (!isset($roles[GROUP])) {
             $group = group_current_group();
             if ($group->jointype == 'open' || $group->jointype == 'invite' && get_record('group_member_invite', 'group', GROUP, 'member', $USER->get('id'))) {
                 $SESSION->add_error_msg(get_string('notmembermayjoin', 'group', $group->name));
                 $next = substr($_SERVER['REQUEST_URI'], strlen(get_mahara_install_subdirectory()) - 1);
                 redirect(get_config('wwwroot') . 'group/view.php?id=' . GROUP . '&next=' . urlencode($next));
             }
             if ($group->jointype == 'request' && !get_record('group_member_request', 'group', GROUP, 'member', $USER->get('id'))) {
                 $SESSION->add_error_msg(get_string('notamember', 'group'));
                 redirect(get_config('wwwroot') . 'group/requestjoin.php?id=' . GROUP . '&returnto=view');
             }
         }
     }
     header("HTTP/1.0 403 Forbidden", true);
     return parent::render_exception();
 }
 /**
  * Create a new permission denied exception instance.
  *
  * @param string $permission
  */
 public function __construct($permission)
 {
     parent::__construct("You don't have a required '" . $permission . "' permission.");
 }