plugins/admin/GroupManager.php
author Dan
Wed, 26 Mar 2008 02:56:23 -0400
changeset 509 175df10e0b56
parent 504 bc8e0e9ee01d
child 536 218a627eb53e
permissions -rw-r--r--
Added a copy of Firebug Lite for debugging purposes. License is uncertain but being treated as MPL. (If is is not MPL then it is under something more permissive that permits relicensing anyway)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
347
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     1
<?php
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     2
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     3
/*
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
504
bc8e0e9ee01d Added support for embedding language data into plugins; updated all version numbers on plugin files
Dan
parents: 411
diff changeset
     5
 * Version 1.1.3 (Caoineag alpha 3)
347
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     6
 * Copyright (C) 2006-2007 Dan Fuhry
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     7
 *
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    10
 *
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    13
 */
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    14
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    15
// Usergroup editor
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    16
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    17
function page_Admin_GroupManager()
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    18
{
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    19
  global $db, $session, $paths, $template, $plugins; // Common objects
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    20
  global $lang;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    21
  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    22
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    23
    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    24
    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    25
    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    26
    return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    27
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    28
  
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    29
  if(isset($_POST['do_create_stage1']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    30
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    31
    if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['create_group_name']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    32
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    33
      echo '<p>' . $lang->get('acpug_err_group_name_invalid') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    34
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    35
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    36
    echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    37
    echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    38
          <table border="0" style="width:100%;" cellspacing="1" cellpadding="4">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    39
          <tr><th colspan="2">' . $lang->get('acpug_heading_creating_group') . ' '.htmlspecialchars($_POST['create_group_name']).'</th></tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    40
          <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    41
            <td class="row1">' . $lang->get('acpug_field_group_mod') . '</td><td class="row1">' . $template->username_field('group_mod') . '</td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    42
          </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    43
          <tr><td class="row2">' . $lang->get('acpug_field_group_type') . '</td><td class="row2">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    44
            <label><input type="radio" name="group_status" value="'.GROUP_CLOSED.'" checked="checked" /> ' . $lang->get('groupcp_type_hidden') . '</label><br />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    45
            <label><input type="radio" name="group_status" value="'.GROUP_REQUEST.'" /> ' . $lang->get('groupcp_type_closed') . '</label><br />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    46
            <label><input type="radio" name="group_status" value="'.GROUP_OPEN.'" /> ' . $lang->get('groupcp_type_request') . '</label><br />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    47
            <label><input type="radio" name="group_status" value="'.GROUP_HIDDEN.'" /> ' . $lang->get('groupcp_type_open') . '</label>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    48
          </td></tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    49
          <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    50
            <th class="subhead" colspan="2">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    51
              <input type="hidden" name="create_group_name" value="'.htmlspecialchars($_POST['create_group_name']).'" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    52
              <input type="submit" name="do_create_stage2" value="' . $lang->get('acpug_btn_create_stage2') . '" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    53
            </th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    54
          </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    55
          </table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    56
          </div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    57
    echo '</form>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    58
    return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    59
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    60
  elseif(isset($_POST['do_create_stage2']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    61
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    62
    if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['create_group_name']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    63
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    64
      echo '<p>' . $lang->get('acpug_err_group_name_invalid') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    65
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    66
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    67
    if(!in_array(intval($_POST['group_status']), Array(GROUP_CLOSED, GROUP_OPEN, GROUP_HIDDEN, GROUP_REQUEST)))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    68
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    69
      echo '<p>Hacking attempt</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    70
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    71
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    72
    $e = $db->sql_query('SELECT group_id FROM '.table_prefix.'groups WHERE group_name=\''.$db->escape($_POST['create_group_name']).'\';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    73
    if(!$e)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    74
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    75
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    76
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    77
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    78
    if($db->numrows() > 0)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    79
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    80
      echo '<p>' . $lang->get('acpug_err_already_exist') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    81
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    82
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    83
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    84
    $q = $db->sql_query('INSERT INTO '.table_prefix.'groups(group_name,group_type) VALUES( \''.$db->escape($_POST['create_group_name']).'\', ' . intval($_POST['group_status']) . ' )');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    85
    if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    86
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    87
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    88
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    89
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    90
    $e = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['group_mod']).'\';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    91
    if(!$e)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    92
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    93
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    94
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    95
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    96
    if($db->numrows() < 1)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    97
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    98
      echo '<p>' . $lang->get('acpug_err_bad_username') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
    99
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   100
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   101
    $row = $db->fetchrow();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   102
    $id = $row['user_id'];
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   103
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   104
    $e = $db->sql_query('SELECT group_id FROM '.table_prefix.'groups WHERE group_name=\''.$db->escape($_POST['create_group_name']).'\';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   105
    if(!$e)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   106
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   107
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   108
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   109
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   110
    if($db->numrows() < 1)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   111
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   112
      echo '<p>' . $lang->get('acpug_err_bad_insert_id') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   113
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   114
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   115
    $row = $db->fetchrow();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   116
    $gid = $row['group_id'];
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   117
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   118
    $e = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,is_mod) VALUES('.$gid.', '.$id.', 1);');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   119
    if(!$e)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   120
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   121
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   122
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   123
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   124
    $g_name = htmlspecialchars($_POST['create_group_name']);
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   125
    echo "<div class='info-box'>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   126
            <b>" . $lang->get('acpug_heading_info') . "</b><br />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   127
            " . $lang->get('acpug_msg_create_success', array('g_name' => $g_name)) . "
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   128
          </div>";
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   129
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   130
  if(isset($_POST['do_edit']) || isset($_POST['edit_do']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   131
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   132
    // Fetch the group name
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   133
    $q = $db->sql_query('SELECT group_name,system_group FROM '.table_prefix.'groups WHERE group_id='.intval($_POST['group_edit_id']).';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   134
    if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   135
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   136
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   137
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   138
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   139
    if($db->numrows() < 1)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   140
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   141
      echo '<p>Error: couldn\'t look up group name</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   142
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   143
    $row = $db->fetchrow();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   144
    $name = htmlspecialchars($row['group_name']);
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   145
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   146
    if(isset($_POST['edit_do']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   147
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   148
      if(isset($_POST['edit_do']['del_group']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   149
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   150
        if ( $row['system_group'] == 1 )
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   151
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   152
          echo '<div class="error-box">' . $lang->get('acpug_err_nodelete_system_group', array('g_name' => $name)) . '</div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   153
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   154
        else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   155
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   156
          $q = $db->sql_query('DELETE FROM '.table_prefix.'group_members WHERE group_id='.intval($_POST['group_edit_id']).';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   157
          if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   158
          {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   159
            echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   160
            return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   161
          }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   162
          $q = $db->sql_query('DELETE FROM '.table_prefix.'groups WHERE group_id='.intval($_POST['group_edit_id']).';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   163
          if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   164
          {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   165
            echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   166
            return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   167
          }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   168
          echo '<div class="info-box">' . $lang->get('acpug_msg_delete_success', array('g_name' => $name, 'a_flags' => 'href="javascript:ajaxPage(\'' . $paths->nslist['Admin'] . 'GroupManager\');"')) . '</div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   169
          return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   170
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   171
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   172
      if(isset($_POST['edit_do']['save_name']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   173
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   174
        if(!preg_match('/^([A-z0-9 -]+)$/', $_POST['group_name']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   175
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   176
          echo '<p>' . $lang->get('acpug_err_group_name_invalid') . '</p>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   177
          return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   178
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   179
        $q = $db->sql_query('UPDATE '.table_prefix.'groups SET group_name=\''.$db->escape($_POST['group_name']).'\'
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   180
            WHERE group_id='.intval($_POST['group_edit_id']).';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   181
        if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   182
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   183
          echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   184
          return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   185
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   186
        else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   187
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   188
          echo '<div class="info-box" style="margin: 0 0 10px 0;"">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   189
                  ' . $lang->get('acpug_msg_name_update_success') . '
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   190
                </div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   191
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   192
        $name = htmlspecialchars($_POST['group_name']);
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   193
        
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   194
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   195
      $q = $db->sql_query('SELECT member_id FROM '.table_prefix.'group_members
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   196
                             WHERE group_id='.intval($_POST['group_edit_id']).';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   197
      if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   198
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   199
        echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   200
        return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   201
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   202
      if($db->numrows() > 0)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   203
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   204
        while($row = $db->fetchrow($q))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   205
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   206
          if(isset($_POST['edit_do']['del_' . $row['member_id']]))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   207
          {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   208
            $e = $db->sql_query('DELETE FROM '.table_prefix.'group_members WHERE member_id='.$row['member_id']);
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   209
            if(!$e)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   210
            {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   211
              echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   212
              return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   213
            }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   214
          }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   215
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   216
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   217
      $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   218
      if(isset($_POST['edit_do']['add_member']))
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   219
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   220
        $q = $db->sql_query('SELECT user_id FROM '.table_prefix.'users WHERE username=\''.$db->escape($_POST['edit_add_username']).'\';');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   221
        if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   222
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   223
          echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   224
          return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   225
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   226
        if($db->numrows() > 0)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   227
        {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   228
          $row = $db->fetchrow();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   229
          $user_id = $row['user_id'];
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   230
          $is_mod = ( isset( $_POST['add_mod'] ) ) ? '1' : '0';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   231
          $q = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,is_mod) VALUES('.intval($_POST['group_edit_id']).','.$user_id.','.$is_mod.');');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   232
          if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   233
          {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   234
            echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   235
            return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   236
          }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   237
          else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   238
          {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   239
            echo '<div class="info-box" style="margin: 0 0 10px 0;"">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   240
                    ' . $lang->get('acpug_msg_user_added', array('username' => htmlspecialchars($_POST['edit_add_username']))) . '
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   241
                  </div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   242
          }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   243
        }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   244
        else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   245
          echo '<div class="warning-box">' . $lang->get('acpug_err_username_not_exist', array('username' => htmlspecialchars($_POST['edit_add_username']))) . '</div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   246
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   247
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   248
    $sg_disabled = ( $row['system_group'] == 1 ) ?
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   249
             ' value="' . $lang->get('acpug_btn_cant_delete') . '" disabled="disabled" style="color: #FF9773" ' :
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   250
             ' value="' . $lang->get('acpug_btn_delete_group') . '" style="color: #FF3713" ';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   251
    echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   252
    echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   253
          <table border="0" style="width:100%;" cellspacing="1" cellpadding="4">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   254
          <tr><th>' . $lang->get('acpug_heading_edit_name') . '</th></tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   255
          <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   256
            <td class="row1">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   257
              ' . $lang->get('acpug_field_group_name') . ' <input type="text" name="group_name" value="'.$name.'" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   258
            </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   259
          </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   260
          <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   261
            <th class="subhead">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   262
              <input type="submit" name="edit_do[save_name]" value="' . $lang->get('acpug_btn_save_name') . '" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   263
              <input type="submit" name="edit_do[del_group]" '.$sg_disabled.' />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   264
            </th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   265
          </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   266
          </table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   267
          </div>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   268
          <input type="hidden" name="group_edit_id" value="'.htmlspecialchars($_POST['group_edit_id']).'" />';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   269
    echo '</form>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   270
    echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   271
    echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   272
          <table border="0" style="width:100%;" cellspacing="1" cellpadding="4">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   273
          <tr><th colspan="3">' . $lang->get('acpug_heading_edit_members') . '</th></tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   274
    $q = $db->sql_query('SELECT m.member_id,m.is_mod,u.username FROM '.table_prefix.'group_members AS m
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   275
                           LEFT JOIN '.table_prefix.'users AS u
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   276
                             ON u.user_id=m.user_id
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   277
                             WHERE m.group_id='.intval($_POST['group_edit_id']).'
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   278
                           ORDER BY m.is_mod DESC, u.username ASC;');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   279
    if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   280
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   281
      echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   282
      return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   283
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   284
    if($db->numrows() < 1)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   285
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   286
      echo '<tr><td colspan="3" class="row1">' . $lang->get('acpug_msg_no_members') . '</td></tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   287
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   288
    else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   289
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   290
      $cls = 'row2';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   291
      while($row = $db->fetchrow())
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   292
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   293
        $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   294
        $mod = ( $row['is_mod'] == 1 ) ? $lang->get('acpug_lbl_member_mod') : '';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   295
        echo '<tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   296
                <td class="'.$cls.'" style="width: 100%;">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   297
                  ' . $row['username'] . '
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   298
                </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   299
                <td class="'.$cls.'">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   300
                  '.$mod.'
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   301
                </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   302
                <td class="'.$cls.'">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   303
                  <input type="submit" name="edit_do[del_'.$row['member_id'].']" value="' . $lang->get('acpug_btn_remove_member') . '" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   304
                </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   305
              </tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   306
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   307
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   308
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   309
    echo '</table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   310
          </div>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   311
          <input type="hidden" name="group_edit_id" value="'.htmlspecialchars($_POST['group_edit_id']).'" />';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   312
    echo '</form>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   313
    echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   314
    echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   315
          <table border="0" style="width:100%;" cellspacing="1" cellpadding="4">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   316
            <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   317
              <th>' . $lang->get('acpug_heading_add_member') . '</th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   318
            </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   319
            <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   320
              <td class="row1">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   321
                ' . $lang->get('acpug_field_username') . ' ' . $template->username_field('edit_add_username') . '
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   322
              </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   323
            </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   324
            <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   325
              <td class="row2">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   326
                <label><input type="checkbox" name="add_mod" /> ' . $lang->get('acpug_field_make_mod') . '</label>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   327
                ' . $lang->get('acpug_field_make_mod_hint') . '
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   328
              </td>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   329
            </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   330
            <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   331
              <th class="subhead">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   332
                <input type="submit" name="edit_do[add_member]" value="' . $lang->get('acpug_btn_add_user') . '" />
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   333
              </th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   334
            </tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   335
          </table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   336
          </div>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   337
          <input type="hidden" name="group_edit_id" value="'.htmlspecialchars($_POST['group_edit_id']).'" />';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   338
    echo '</form>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   339
    return;
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   340
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   341
  echo '<h3>' . $lang->get('acpug_heading_main') . '</h3>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   342
  echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   343
  $q = $db->sql_query('SELECT group_id,group_name FROM '.table_prefix.'groups ORDER BY group_name ASC;');
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   344
  if(!$q)
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   345
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   346
    echo $db->get_error();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   347
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   348
  else
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   349
  {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   350
    echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   351
          <table border="0" cellspacing="1" cellpadding="4" style="width: 100%;">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   352
          <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   353
          <th>' . $lang->get('acpug_heading_edit_existing') . '</th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   354
          </tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   355
    echo '<tr><td class="row2"><select name="group_edit_id">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   356
    while ( $row = $db->fetchrow() )
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   357
    {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   358
      if ( $row['group_name'] != 'Everyone' )
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   359
      {
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   360
        echo '<option value="' . $row['group_id'] . '">' . htmlspecialchars( $row['group_name'] ) . '</option>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   361
      }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   362
    }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   363
    $db->free_result();
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   364
    echo '</select></td></tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   365
    echo '<tr><td class="row1" style="text-align: center;"><input type="submit" name="do_edit" value="' . $lang->get('acpug_btn_edit_stage1') . '" /></td></tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   366
          </table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   367
          </div>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   368
          </form><br />';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   369
  }
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   370
  echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   371
  echo '<div class="tblholder">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   372
        <table border="0" cellspacing="1" cellpadding="4" style="width: 100%;">
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   373
        <tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   374
        <th colspan="2">' . $lang->get('acpug_heading_create_new') . '</th>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   375
        </tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   376
  echo '<tr><td class="row2">' . $lang->get('acpug_field_group_name') . '</td><td class="row2"><input type="text" name="create_group_name" /></td></tr>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   377
  echo '<tr><td colspan="2" class="row1" style="text-align: center;"><input type="submit" name="do_create_stage1" value="' . $lang->get('acpug_btn_create_stage1') . ' &raquo;" /></td></tr>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   378
        </table>
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   379
        </div>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   380
  echo '</form>';
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   381
}
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   382
299a90e28abc Localized and separated Admin:GroupManager
Dan
parents:
diff changeset
   383
?>