/**
  * Forum Permission Matrix
  *
  * @access	public
  * @return	void
  **/
 public function forumPermissions()
 {
     /* Check for ID */
     if ($this->request['id'] == "") {
         $this->registry->output->showError($this->lang->words['per_groupid'], 11351);
     }
     /* Permission Class */
     require_once IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php';
     $permissions = new classPublicPermissions(ipsRegistry::instance());
     /* Page Setup */
     $this->registry->output->nav[] = array($this->form_code . '&do=permsplash', $this->lang->words['per_manage']);
     $this->registry->output->nav[] = array('', $this->lang->words['per_addedit']);
     /* Query Mask */
     $this->DB->build(array('select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=" . intval($this->request['id'])));
     $this->DB->execute();
     $group = $this->DB->fetch();
     /* Data */
     $gid = $group['perm_id'];
     $gname = $group['perm_name'];
     $forum_data = $this->forumfunc->adForumsForumData();
     /* Permission Fields */
     $permission_fields = array('view' => 'perm_view', 'read' => 'perm_2', 'reply' => 'perm_3', 'start' => 'perm_4', 'upload' => 'perm_5', 'download' => 'perm_6');
     /* Loop through masks and build output array */
     $permission_rows = array();
     foreach ($forum_data as $r) {
         /* INI Perms */
         $_perms = array();
         foreach ($permission_fields as $perm => $key) {
             if ($r[$key] == '*') {
                 $_perms[$perm] = $this->lang->words['per_global'];
             } else {
                 if (preg_match("/(^|,)" . $gid . "(,|\$)/", $r[$key])) {
                     $_perms[$perm] = 'checked';
                 } else {
                     $_perms[$perm] = '';
                 }
             }
         }
         /* Root Forum */
         if ($r['root_forum']) {
             $r['css'] = 'tablerow4';
             $_perms['download'] = $_perms['upload'] = $_perms['reply'] = $_perms['start'] = $_perms['read'] = $this->lang->words['per_notused'];
         } else {
             $r['css'] = 'tablerow1';
         }
         /* Perms */
         $r['_perms'] = $_perms;
         /* Add to array */
         $permission_rows[] = $r;
     }
     /* Output */
     $this->registry->output->html .= $this->html->permissionsForum($gid, $gname, $permission_rows, $this->registry->class_forums->forumById($this->request['id']));
 }
Example #2
0
 /**
  * Builds the add/edit multi moderation form
  *
  * @param	string  $type  Either 'new' or 'edit'
  * @return	@e void
  */
 public function multiModerationForm($type = 'new')
 {
     if ($type == 'new') {
         /* Setup */
         $form_code = 'donew';
         $id = 0;
         $description = $this->lang->words['mm_addnew'];
         $button = $this->lang->words['mm_addnew'];
         /* Default Values */
         $topic_mm = array('mm_forums' => '', 'mm_title' => '', 'topic_title_st' => '', 'topic_title_end' => '', 'topic_state' => '', 'topic_pin' => '', 'topic_approve' => '', 'topic_move' => '', 'topic_move_link' => '', 'topic_reply' => '', 'topic_reply_content' => '', 'topic_reply_postcount' => '');
     } else {
         /* Setup */
         $id = intval($this->request['id']);
         $form_code = 'doedit';
         $description = $this->lang->words['mm_edit'];
         $button = $this->lang->words['mm_edit'];
         /* Default Values */
         $this->DB->build(array('select' => '*', 'from' => 'topic_mmod', 'where' => "mm_id={$id}"));
         $this->DB->execute();
         if (!($topic_mm = $this->DB->fetch())) {
             $this->registry->output->showError(sprintf($this->lang->words['mm_noinfo'], $id), 11337);
         }
     }
     /* State Drop Options */
     $state_dd = array(0 => array('leave', $this->lang->words['mm_leave']), 1 => array('close', $this->lang->words['mm_close']), 2 => array('open', $this->lang->words['mm_open']));
     /* Pinned Drop Down Options */
     $pin_dd = array(0 => array('leave', $this->lang->words['mm_leave']), 1 => array('pin', $this->lang->words['mm_pin']), 2 => array('unpin', $this->lang->words['mm_unpin']));
     /* Approved Drop Down Options */
     $app_dd = array(0 => array('0', $this->lang->words['mm_leave']), 1 => array('1', $this->lang->words['mm_approve']), 2 => array('2', $this->lang->words['mm_unapprove']));
     /* Build forum multiselect */
     $topic_mm['forums'] = "<select name='forums[]' class='textinput' size='15' multiple='multiple'>\n";
     $topic_mm['forums'] .= $topic_mm['mm_forums'] == '*' ? "<option value='all' selected='selected'>{$this->lang->words['mm_allforums']}</option>\n" : "<option value='all'>{$this->lang->words['mm_allforums']}</option>\n";
     $forum_jump = $this->forumfunc->adForumsForumData();
     foreach ($forum_jump as $i) {
         if (strstr("," . $topic_mm['mm_forums'] . ",", "," . $i['id'] . ",") and $topic_mm['mm_forums'] != '*') {
             $selected = ' selected="selected"';
         } else {
             $selected = "";
         }
         if (!empty($i['redirect_on'])) {
             continue;
         }
         $fporum_jump[] = array($i['id'], $i['depthed_name']);
         $topic_mm['forums'] .= "<option value=\"{$i['id']}\" {$selected}>{$i['depthed_name']}</option>\n";
     }
     $topic_mm['forums'] .= "</select>";
     /* Build Form Fields */
     $topic_mm['mm_title'] = $this->registry->output->formInput("mm_title", $topic_mm['mm_title']);
     $topic_mm['topic_title_st'] = $this->registry->output->formInput("topic_title_st", $topic_mm['topic_title_st']);
     $topic_mm['topic_title_end'] = $this->registry->output->formInput("topic_title_end", $topic_mm['topic_title_end']);
     $topic_mm['topic_state'] = $this->registry->output->formDropdown("topic_state", $state_dd, $topic_mm['topic_state']);
     $topic_mm['topic_pin'] = $this->registry->output->formDropdown("topic_pin", $pin_dd, $topic_mm['topic_pin']);
     $topic_mm['topic_approve'] = $this->registry->output->formDropdown("topic_approve", $app_dd, $topic_mm['topic_approve']);
     $topic_mm['topic_move'] = $this->registry->output->formDropdown("topic_move", array_merge(array(0 => array('-1', $this->lang->words['mm_nobodymovenobodygethurt'])), $fporum_jump), $topic_mm['topic_move']);
     $topic_mm['topic_move_link'] = $this->registry->output->formCheckbox('topic_move_link', $topic_mm['topic_move_link']);
     $topic_mm['topic_reply'] = $this->registry->output->formYesNo('topic_reply', $topic_mm['topic_reply']);
     $topic_mm['topic_reply_content'] = $this->registry->output->formTextarea("topic_reply_content", $topic_mm['topic_reply_content']);
     $topic_mm['topic_reply_postcount'] = $this->registry->output->formCheckbox('topic_reply_postcount', $topic_mm['topic_reply_postcount']);
     /* Output */
     $this->registry->output->html .= $this->html->multiModerationForm($id, $form_code, $description, $topic_mm, $button);
 }