plugins/admin/PageGroups.php
author Dan
Thu, 26 Feb 2009 01:28:18 -0500
changeset 846 0d2d0dfbe443
parent 801 eb8b23f11744
child 1021 5990ac411f34
permissions -rw-r--r--
Plugin backend: bugfix: installing a plugin should now properly import its strings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
     1
<?php
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
     2
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
     3
/*
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
801
eb8b23f11744 Two big commits in one day I know, but redid password storage to use HMAC-SHA1. Consolidated much AES processing to three core methods in session that should handle everything automagically. Installation works; upgrades should. Rebranded as 1.1.6.
Dan
parents: 750
diff changeset
     5
 * Version 1.1.6 (Caoineag beta 1)
536
218a627eb53e Rebrand as 1.1.4 (Caoineag alpha 4)
Dan
parents: 504
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
     7
 *
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
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
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
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.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    10
 *
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
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
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    13
 */
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    14
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    15
function page_Admin_PageGroups()
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    16
{
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    17
  global $db, $session, $paths, $template, $plugins; // Common objects
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    18
  global $lang;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    19
  if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    20
  {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    21
    $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    22
    echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    23
    echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    24
    return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    25
  }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    26
  
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    27
  if ( isset($_POST['action']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    28
  {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    29
    if ( isset($_POST['action']['create']) || isset($_POST['action']['create_stage2']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    30
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    31
      switch ( isset($_POST['action']['create_stage2']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    32
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    33
        case true:
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    34
          if ( empty($_POST['pg_name']) || empty($_POST['group_type']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    35
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    36
            echo '<div class="error-box">' . $lang->get('acppg_err_need_name') . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    37
            return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    38
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    39
          if ( $_POST['group_type'] == PAGE_GRP_TAGGED && empty($_POST['member_tag']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    40
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    41
            echo '<div class="error-box">' . $lang->get('acppg_err_need_tag') . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    42
            return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    43
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    44
          if ( $_POST['group_type'] == PAGE_GRP_CATLINK && empty($_POST['member_cat']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    45
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    46
            echo '<div class="error-box">' . $lang->get('acppg_err_need_cat') . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    47
            return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    48
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    49
          if ( $_POST['group_type'] == PAGE_GRP_NORMAL && empty($_POST['member_page_0']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    50
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    51
            echo '<div class="error-box">' . $lang->get('acppg_err_need_page') . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    52
            return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    53
          }
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
    54
          if ( $_POST['group_type'] == PAGE_GRP_REGEX && empty($_POST['regex']) )
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
    55
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
    56
            echo '<div class="error-box">' . $lang->get('acppg_err_need_regex') . '</div>';
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
    57
            return;
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
    58
          }
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
    59
          if ( $_POST['group_type'] != PAGE_GRP_TAGGED && $_POST['group_type'] != PAGE_GRP_CATLINK && $_POST['group_type'] != PAGE_GRP_NORMAL && $_POST['group_type'] != PAGE_GRP_REGEX )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    60
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    61
            echo '<div class="error-box">Umm, you sent an invalid group type. I\'d put a real error message here but this will only be shown if you try to hack the system.</div>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    62
            return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    63
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    64
          // All checks passed, create the group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    65
          switch($_POST['group_type'])
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    66
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    67
            case PAGE_GRP_TAGGED:
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    68
              $name = $db->escape($_POST['pg_name']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    69
              $tag  = $db->escape($_POST['member_tag']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    70
              $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_TAGGED . ', \'' . $name . '\', \'' . $tag . '\');';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    71
              $q = $db->sql_query($sql);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    72
              if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    73
                $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    74
              break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    75
            case PAGE_GRP_CATLINK:
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    76
              $name = $db->escape($_POST['pg_name']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    77
              $cat  = $db->escape($_POST['member_cat']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    78
              $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_CATLINK . ', \'' . $name . '\', \'' . $cat . '\');';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    79
              $q = $db->sql_query($sql);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    80
              if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    81
                $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    82
              break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    83
            case PAGE_GRP_NORMAL:
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    84
              $name = $db->escape($_POST['pg_name']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    85
              $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name) VALUES(' . PAGE_GRP_NORMAL . ', \'' . $name . '\');';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    86
              $q = $db->sql_query($sql);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    87
              if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    88
                $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    89
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    90
              $ins_id = $db->insert_id();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    91
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    92
              // Page list
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    93
              $keys = array_keys($_POST);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    94
              $arr_pages = array();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    95
              foreach ( $keys as $val )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    96
              {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    97
                if ( preg_match('/^member_page_([0-9]+?)$/', $val) && !empty($_POST[$val]) && isPage($_POST[$val]) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    98
                {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
    99
                  $arr_pages[] = $_POST[$val];
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   100
                }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   101
              }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   102
              $arr_sql = array();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   103
              foreach ( $arr_pages as $page )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   104
              {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   105
                list($id, $ns) = RenderMan::strToPageID($page);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   106
                $id = sanitize_page_id($id);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   107
                $arr_sql[] = '(' . $ins_id . ',\'' . $db->escape($id) . '\', \'' . $ns . '\')';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   108
              }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   109
              $sql = 'INSERT INTO '.table_prefix.'page_group_members(pg_id,page_id,namespace) VALUES' . implode(',', $arr_sql) . ';';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   110
              $q = $db->sql_query($sql);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   111
              if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   112
                $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   113
              break;
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   114
            case PAGE_GRP_REGEX:
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   115
              $name  = $db->escape($_POST['pg_name']);
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   116
              $regex = $db->escape($_POST['regex']);
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   117
              $sql = 'INSERT INTO '.table_prefix.'page_groups(pg_type,pg_name,pg_target) VALUES(' . PAGE_GRP_REGEX . ', \'' . $name . '\', \'' . $regex . '\');';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   118
              $q = $db->sql_query($sql);
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   119
              if ( !$q )
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   120
                $db->_die();
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   121
              break;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   122
          }
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   123
          echo '<div class="info-box">' . $lang->get('acppg_msg_create_success', array('group_name' => htmlspecialchars($_POST['pg_name']))) . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   124
          break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   125
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   126
      // A little Javascript magic
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   127
      ?>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   128
      <script language="javascript" type="text/javascript">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   129
        function pg_create_typeset(selector)
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   130
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   131
          var pg_normal  = <?php echo PAGE_GRP_NORMAL; ?>;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   132
          var pg_tagged  = <?php echo PAGE_GRP_TAGGED; ?>;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   133
          var pg_catlink = <?php echo PAGE_GRP_CATLINK; ?>;
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   134
          var pg_regex   = <?php echo PAGE_GRP_REGEX; ?>;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   135
          var selection = false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   136
          // Get selection
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   137
          for ( var i = 0; i < selector.childNodes.length; i++ )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   138
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   139
            var child = selector.childNodes[i];
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   140
            if ( !child || child.tagName != 'OPTION' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   141
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   142
              continue;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   143
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   144
            if ( child.selected )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   145
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   146
              selection = child.value;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   147
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   148
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   149
          if ( !selection )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   150
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   151
            alert('Cannot get field value');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   152
            return true;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   153
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   154
          selection = parseInt(selection);
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   155
          if ( selection != pg_normal && selection != pg_tagged && selection != pg_catlink && selection != pg_regex )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   156
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   157
            alert('Invalid field value');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   158
            return true;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   159
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   160
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   161
          // We have the selection and it's validated; show the appropriate field group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   162
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   163
          if ( selection == pg_normal )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   164
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   165
            document.getElementById('pg_create_title_catlink').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   166
            document.getElementById('pg_create_catlink_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   167
            document.getElementById('pg_create_catlink_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   168
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   169
            document.getElementById('pg_create_title_tagged').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   170
            document.getElementById('pg_create_tagged_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   171
            document.getElementById('pg_create_tagged_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   172
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   173
            document.getElementById('pg_create_title_normal').style.display = 'inline';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   174
            document.getElementById('pg_create_normal_1').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   175
            document.getElementById('pg_create_normal_2').style.display = 'block';
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   176
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   177
            document.getElementById('pg_create_title_regex').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   178
            document.getElementById('pg_create_regex_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   179
            document.getElementById('pg_create_regex_2').style.display = 'none';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   180
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   181
          else if ( selection == pg_catlink )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   182
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   183
            document.getElementById('pg_create_title_catlink').style.display = 'inline';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   184
            document.getElementById('pg_create_catlink_1').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   185
            document.getElementById('pg_create_catlink_2').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   186
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   187
            document.getElementById('pg_create_title_tagged').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   188
            document.getElementById('pg_create_tagged_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   189
            document.getElementById('pg_create_tagged_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   190
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   191
            document.getElementById('pg_create_title_normal').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   192
            document.getElementById('pg_create_normal_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   193
            document.getElementById('pg_create_normal_2').style.display = 'none';
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   194
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   195
            document.getElementById('pg_create_title_regex').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   196
            document.getElementById('pg_create_regex_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   197
            document.getElementById('pg_create_regex_2').style.display = 'none';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   198
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   199
          else if ( selection == pg_tagged )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   200
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   201
            document.getElementById('pg_create_title_catlink').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   202
            document.getElementById('pg_create_catlink_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   203
            document.getElementById('pg_create_catlink_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   204
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   205
            document.getElementById('pg_create_title_tagged').style.display = 'inline';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   206
            document.getElementById('pg_create_tagged_1').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   207
            document.getElementById('pg_create_tagged_2').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   208
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   209
            document.getElementById('pg_create_title_normal').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   210
            document.getElementById('pg_create_normal_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   211
            document.getElementById('pg_create_normal_2').style.display = 'none';
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   212
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   213
            document.getElementById('pg_create_title_regex').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   214
            document.getElementById('pg_create_regex_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   215
            document.getElementById('pg_create_regex_2').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   216
          }
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   217
          else if ( selection == pg_regex )
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   218
          {
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   219
            document.getElementById('pg_create_title_catlink').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   220
            document.getElementById('pg_create_catlink_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   221
            document.getElementById('pg_create_catlink_2').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   222
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   223
            document.getElementById('pg_create_title_tagged').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   224
            document.getElementById('pg_create_tagged_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   225
            document.getElementById('pg_create_tagged_2').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   226
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   227
            document.getElementById('pg_create_title_normal').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   228
            document.getElementById('pg_create_normal_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   229
            document.getElementById('pg_create_normal_2').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   230
            
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   231
            document.getElementById('pg_create_title_regex').style.display = 'inline';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   232
            document.getElementById('pg_create_regex_1').style.display = 'block';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   233
            document.getElementById('pg_create_regex_2').style.display = 'block';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   234
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   235
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   236
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   237
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   238
        // Set to pg_normal on page load
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   239
        var pg_createform_init = function()
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   240
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   241
          document.getElementById('pg_create_title_catlink').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   242
          document.getElementById('pg_create_catlink_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   243
          document.getElementById('pg_create_catlink_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   244
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   245
          document.getElementById('pg_create_title_tagged').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   246
          document.getElementById('pg_create_tagged_1').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   247
          document.getElementById('pg_create_tagged_2').style.display = 'none';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   248
          
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   249
          document.getElementById('pg_create_title_regex').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   250
          document.getElementById('pg_create_regex_1').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   251
          document.getElementById('pg_create_regex_2').style.display = 'none';
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   252
          
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   253
          document.getElementById('pg_create_title_normal').style.display = 'inline';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   254
          document.getElementById('pg_create_normal_1').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   255
          document.getElementById('pg_create_normal_2').style.display = 'block';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   256
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   257
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   258
        function pg_create_more_fields()
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   259
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   260
          var targettd = document.getElementById('pg_create_normal_2');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   261
          var id = 0;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   262
          for ( var i = 0; i < targettd.childNodes.length; i++ )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   263
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   264
            var child = targettd.childNodes[i];
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   265
            if ( child.tagName == 'INPUT' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   266
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   267
              if ( child.type == 'button' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   268
              {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   269
                var newInp = document.createElement('input');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   270
                // <input type="text" name="member_page_1" id="pg_create_member_1" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   271
                newInp.type    = 'text';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   272
                newInp.name    = 'member_page_' + id;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   273
                newInp.id      = 'pg_create_member_' + id;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   274
                newInp.onkeyup = function(e) { return ajaxPageNameComplete(this); };
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   275
                newInp.size    = '30';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   276
                newInp.style.marginTop = '3px';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   277
                targettd.insertBefore(newInp, child);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   278
                targettd.insertBefore(document.createElement('br'), child);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   279
                break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   280
              }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   281
              else // if ( child.type == 'text' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   282
              {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   283
                id++;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   284
              }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   285
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   286
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   287
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   288
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   289
      </script>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   290
      <?php
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   291
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   292
      // Build category list
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   293
      $q = $db->sql_query('SELECT name,urlname FROM '.table_prefix.'pages WHERE namespace=\'Category\';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   294
      if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   295
        $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   296
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   297
      if ( $db->numrows() < 1 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   298
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   299
        $catlist = $lang->get('acppg_err_no_cats');
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   300
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   301
      else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   302
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   303
        $catlist = '<select name="member_cat">';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   304
        while ( $row = $db->fetchrow() )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   305
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   306
          $catlist .= '<option value="' . htmlspecialchars($row['urlname']) . '">' . htmlspecialchars($row['name']) . '</option>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   307
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   308
        $catlist .= '</select>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   309
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   310
      
117
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 81
diff changeset
   311
      echo '<script type="text/javascript">
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 81
diff changeset
   312
              var __pg_edit_submitAuthorized = true;
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 81
diff changeset
   313
            </script>';
7cfdbb2fd17a Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
Dan
parents: 81
diff changeset
   314
      
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   315
      echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized || !__pg_edit_submitAuthorized) return false;" enctype="multipart/form-data">';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   316
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   317
      echo '<div class="tblholder">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   318
            <table border="0" cellspacing="1" cellpadding="4">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   319
              <tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   320
              <th colspan="2">' . $lang->get('acppg_th_create') . '</th>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   321
              </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   322
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   323
      // Name
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   324
      echo '<tr>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   325
              <td class="row2">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   326
              ' . $lang->get('acppg_field_group_name') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   327
              <small>' . $lang->get('acppg_field_group_name_hint') . '</small>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   328
              </td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   329
              <td class="row1">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   330
              <input type="text" name="pg_name" size="30" />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   331
              </td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   332
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   333
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   334
      // Group type
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   335
      echo '<tr>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   336
              <td class="row2">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   337
              ' . $lang->get('acppg_field_group_type') . '
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   338
              </td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   339
              <td class="row1">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   340
              <select name="group_type" onchange="pg_create_typeset(this);">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   341
                <option value="' . PAGE_GRP_NORMAL  . '" selected="selected">' . $lang->get('acppg_gtype_static') . '</option>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   342
                <option value="' . PAGE_GRP_TAGGED  . '">' . $lang->get('acppg_gtype_tagged') . '</option>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   343
                <option value="' . PAGE_GRP_CATLINK . '">' . $lang->get('acppg_gtype_catlink') . '</option>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   344
                <option value="' . PAGE_GRP_REGEX   . '">' . $lang->get('acppg_gtype_regex_long') . '</option>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   345
              </select>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   346
              </td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   347
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   348
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   349
      // Titles
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   350
      echo '<tr>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   351
              <th colspan="2">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   352
                <span id="pg_create_title_normal">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   353
                  ' . $lang->get('acppg_gtype_static') . '
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   354
                </span>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   355
                <span id="pg_create_title_tagged">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   356
                  ' . $lang->get('acppg_gtype_tagged') . '
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   357
                </span>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   358
                <span id="pg_create_title_catlink">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   359
                  ' . $lang->get('acppg_gtype_catlink') . '
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   360
                </span>
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   361
                <span id="pg_create_title_regex">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   362
                  ' . $lang->get('acppg_gtype_regex') . '
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   363
                </span>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   364
              </th>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   365
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   366
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   367
      echo '<tr>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   368
              <td class="row2">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   369
                <div id="pg_create_normal_1">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   370
                  ' . $lang->get('acppg_field_member_pages') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   371
                  <small>' . $lang->get('acppg_field_member_pages_hint') . '</small>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   372
                </div>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   373
                <div id="pg_create_catlink_1">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   374
                  ' . $lang->get('acppg_field_target_category') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   375
                  <small>' . $lang->get('acppg_field_target_category_hint') . '</small>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   376
                </div>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   377
                <div id="pg_create_tagged_1">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   378
                  ' . $lang->get('acppg_field_target_tag') . '
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   379
                </div>
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   380
                <div id="pg_create_regex_1">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   381
                  ' . $lang->get('acppg_field_target_regex') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   382
                  <small>' . $lang->get('acppg_field_target_regex_hint') . '</small>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   383
              </td>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   384
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   385
      echo '  <td class="row1">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   386
                <div id="pg_create_normal_2" />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   387
                  <input type="text" style="margin-top: 3px;" name="member_page_0" id="pg_create_member_0" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   388
                  <input type="text" style="margin-top: 3px;" name="member_page_1" id="pg_create_member_1" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   389
                  <input type="text" style="margin-top: 3px;" name="member_page_2" id="pg_create_member_2" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   390
                  <input type="text" style="margin-top: 3px;" name="member_page_3" id="pg_create_member_3" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   391
                  <input type="text" style="margin-top: 3px;" name="member_page_4" id="pg_create_member_4" onkeyup="return ajaxPageNameComplete(this);" size="30" /><br />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   392
                  <input type="button" onclick="pg_create_more_fields(); return false;" style="margin-top: 5px;" value="&nbsp;&nbsp;+&nbsp;&nbsp;" />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   393
                </div>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   394
                <div id="pg_create_tagged_2">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   395
                  <input type="text" name="member_tag" size="30" />
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   396
                </div>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   397
                <div id="pg_create_catlink_2">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   398
                  ' . $catlist . '
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   399
                </div>
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   400
                <div id="pg_create_regex_2">
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   401
                  <input type="text" name="regex" size="60" /> 
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
   402
                </div>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   403
              </td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   404
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   405
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   406
      // Submit button
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   407
      echo '<tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   408
              <th class="subhead" colspan="2"><input type="submit" name="action[create_stage2]" value="' . $lang->get('acppg_btn_create_finish') . '" style="font-weight: bold;" /> <input type="submit" name="action[noop]" value="' . $lang->get('etc_cancel') . '" style="font-weight: normal;" /></th>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   409
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   410
            
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   411
      echo '</table>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   412
            </div>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   413
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   414
      echo '</form>';
750
650924c35957 Fixed: Admin:PageGroups create form did not init properly
Dan
parents: 685
diff changeset
   415
      
650924c35957 Fixed: Admin:PageGroups create form did not init properly
Dan
parents: 685
diff changeset
   416
      echo '<script type="text/javascript">pg_createform_init();</script>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   417
      return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   418
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   419
    else if ( isset($_POST['action']['del']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   420
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   421
      // Confirmation to delete a group (this is really only a stub)
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   422
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   423
      $delete_id = array_keys($_POST['action']['del']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   424
      $delete_id = intval($delete_id[0]);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   425
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   426
      if ( !empty($delete_id) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   427
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   428
        echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   429
        echo '<input type="hidden" name="delete_id" value="' . $delete_id . '" />' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   430
        echo '<div class="tblholder">' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   431
        echo '  <table border="0" cellspacing="1" cellpadding="4">' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   432
        echo '    <tr><th>' . $lang->get('acppg_th_delete_confirm') . '</th></tr>' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   433
        echo '    <tr><td class="row2" style="text-align: center; padding: 20px 0;">' . $lang->get('acppg_msg_delete_confirm') . '</td></tr>' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   434
        echo '    <tr><td class="row1" style="text-align: center;">' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   435
        echo '        <input type="submit" name="action[del_confirm]" value="' . $lang->get('acppg_btn_delete_confirm') . '" style="font-weight: bold;" />' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   436
        echo '        <input type="submit" name="action[noop]" value="' . $lang->get('etc_cancel') . '" style="font-weight: normal;" />' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   437
        echo '        </td></tr>' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   438
        echo '  </table>' . "\n";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   439
        echo '</form>' . "\n";
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   440
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   441
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   442
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   443
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   444
    else if ( isset($_POST['action']['del_confirm']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   445
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   446
      $delete_id = intval($_POST['delete_id']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   447
      if ( empty($delete_id) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   448
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   449
        echo 'Hack attempt';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   450
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   451
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   452
      // Obtain group name
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   453
      $q = $db->sql_query('SELECT pg_name FROM '.table_prefix.'page_groups WHERE pg_id=' . $delete_id . ';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   454
      if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   455
        $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   456
      if ( $db->numrows() < 1 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   457
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   458
        echo 'Page group dun exist.';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   459
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   460
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   461
      $row = $db->fetchrow();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   462
      $db->free_result();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   463
      $pg_name = $row['pg_name'];
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   464
      unset($row);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   465
      // Delete the group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   466
      $q = $db->sql_query('DELETE FROM '.table_prefix.'page_groups WHERE pg_id=' . $delete_id . ';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   467
      if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   468
        $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   469
      $q = $db->sql_query('DELETE FROM '.table_prefix.'page_group_members WHERE pg_id=' . $delete_id . ';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   470
      if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   471
        $db->_die();
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   472
      
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   473
      $del_msg = $lang->get('acppg_msg_delete_success', array('pg_name' => htmlspecialchars($pg_name)));
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   474
      echo "<div class=\"info-box\">$del_msg</div>";
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   475
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   476
    else if ( isset($_POST['action']['edit']) && !isset($_POST['action']['noop']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   477
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   478
      if ( isset($_POST['action']['edit_save']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   479
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   480
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   481
     
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   482
      if ( isset($_POST['action']['edit']['add_page']) && isset($_GET['src']) && $_GET['src'] == 'ajax' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   483
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   484
        $return = array('successful' => false);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   485
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   486
        //
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   487
        // Add the specified page to the group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   488
        //
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   489
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   490
        // Get ID of the group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   491
        $edit_id = intval($_POST['pg_id']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   492
        if ( !$edit_id )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   493
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   494
          $return = array('mode' => 'error', 'text' => 'Hack attempt');
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   495
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   496
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   497
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   498
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   499
        // Run some validation - check that page exists and that it's not already in the group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   500
        $page = $_POST['new_page'];
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   501
        if ( empty($page) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   502
        {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   503
          $return = array('mode' => 'error', 'text' => $lang->get('acppg_err_ajaxadd_need_title'));
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   504
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   505
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   506
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   507
        
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   508
        /*
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   509
        // We're gonna allow adding nonexistent pages for now
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   510
        if ( !isPage($page) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   511
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   512
          $return = array('mode' => 'error', 'text' => 'The page you are trying to add (' . htmlspecialchars($page) . ') does not exist.');
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   513
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   514
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   515
        }
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   516
        */
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   517
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   518
        list($page_id, $namespace) = RenderMan::strToPageID($page);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   519
        $page_id = sanitize_page_id($page_id);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   520
        
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   521
        if ( !isset($paths->namespace[$namespace]) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   522
        {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   523
          $return = array('mode' => 'error', 'text' => 'Invalid namespace return from RenderMan::strToPageID()');
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   524
          echo enano_json_encode($return);
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   525
          return;
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   526
        }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   527
        
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   528
        $q = $db->sql_query('SELECT "x" FROM '.table_prefix.'page_group_members WHERE pg_id=' . $edit_id . ' AND page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $namespace . '\';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   529
        if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   530
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   531
          $return = array('mode' => 'error', 'text' => $db->get_error());
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   532
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   533
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   534
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   535
        if ( $db->numrows() > 0 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   536
        {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   537
          $return = array('mode' => 'error', 'text' => $lang->get('acppg_err_ajaxadd_already_in'));
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   538
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   539
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   540
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   541
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   542
        $q = $db->sql_query('INSERT INTO '.table_prefix.'page_group_members(pg_id, page_id, namespace) VALUES(' . $edit_id . ', \'' . $db->escape($page_id) . '\', \'' . $namespace . '\');');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   543
        if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   544
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   545
          $return = array('mode' => 'error', 'text' => $db->get_error());
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   546
          echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   547
          return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   548
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   549
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   550
        $title = "($namespace) " . get_page_title($paths->nslist[$namespace] . $page_id);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   551
        
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   552
        $return = array('mode' => 'info', 'text' => $lang->get('acppg_ajaxadd_success'), 'successful' => true, 'title' => $title, 'member_id' => $db->insert_id());
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   553
        
334
c72b545f1304 More localization work. Resolved major issue with JSON parser not parsing files over ~50KB. Switched JSON parser to the one from the Zend Framework (BSD licensed). Forced to split enano.json into five different files.
Dan
parents: 326
diff changeset
   554
        echo enano_json_encode($return);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   555
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   556
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   557
      
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   558
      if ( isset($_POST['action']['edit_save']) && isset($_POST['pg_name']) )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   559
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   560
        $edit_id = $_POST['action']['edit'];
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   561
        $edit_id = intval($edit_id);
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   562
        if ( !empty($edit_id) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   563
        {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   564
          // Update group name
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   565
          $new_name = $_POST['pg_name'];
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   566
          if ( empty($new_name) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   567
          {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   568
            echo '<div class="error-box">' . $lang->get('acppg_err_save_need_name') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   569
          }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   570
          else
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   571
          {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   572
            $q = $db->sql_query('SELECT pg_name FROM '.table_prefix.'page_groups WHERE pg_id=' . $edit_id . ';');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   573
            if ( !$q )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   574
              $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   575
            $row = $db->fetchrow();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   576
            $db->free_result();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   577
            if ( $new_name != $row['pg_name'] )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   578
            {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   579
              $new_name = $db->escape(trim($new_name));
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   580
              $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_name=\'' . $new_name . '\' WHERE pg_id=' . $edit_id . ';');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   581
              if ( !$q )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   582
                $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   583
              else
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   584
                echo '<div class="info-box">' . $lang->get('acppg_msg_save_name_updated') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   585
            }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   586
            if ( $_POST['pg_type'] == PAGE_GRP_TAGGED )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   587
            {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   588
              $target = $_POST['pg_target'];
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   589
              $target = sanitize_tag($target);
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   590
              if ( empty($target) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   591
              {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   592
                echo '<div class="error-box">' . $lang->get('acppg_err_save_need_tag') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   593
              }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   594
              else
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   595
              {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   596
                $target = $db->escape($target);
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   597
                $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   598
                if ( !$q )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   599
                  $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   600
                else
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   601
                  echo '<div class="info-box">' . $lang->get('acppg_msg_save_tag_updated') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   602
              }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   603
            }
183
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   604
            else if ( $_POST['pg_type'] == PAGE_GRP_REGEX )
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   605
            {
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   606
              $target = $_POST['pg_target'];
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   607
              if ( empty($target) )
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   608
              {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   609
                echo '<div class="error-box">' . $lang->get('acppg_err_save_need_regex') . '</div>';
183
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   610
              }
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   611
              else
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   612
              {
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   613
                $target = $db->escape($target);
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   614
                $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   615
                if ( !$q )
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   616
                  $db->_die();
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   617
                else
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   618
                  echo '<div class="info-box">' . $lang->get('acppg_msg_save_regex_updated') . '</div>';
183
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   619
              }
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   620
            }
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   621
            else if ( $_POST['pg_type'] == PAGE_GRP_CATLINK )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   622
            {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   623
              $target = $_POST['pg_target'];
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   624
              if ( empty($target) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   625
              {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   626
                echo '<div class="error-box">' . $lang->get('acppg_err_save_bad_category') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   627
              }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   628
              else
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   629
              {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   630
                $target = $db->escape($target);
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   631
                $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   632
                if ( !$q )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   633
                  $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   634
                else
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   635
                  echo '<div class="info-box">' . $lang->get('acppg_msg_save_cat_updated') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   636
              }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   637
            }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   638
          }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   639
        }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   640
      }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   641
      else if ( isset($_POST['action']['edit_save']) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   642
      {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   643
        $edit_id = $_POST['action']['edit'];
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   644
        $edit_id = intval($edit_id);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   645
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   646
      else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   647
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   648
        $edit_id = array_keys($_POST['action']['edit']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   649
        $edit_id = intval($edit_id[0]);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   650
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   651
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   652
      if ( empty($edit_id) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   653
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   654
        echo 'Hack attempt';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   655
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   656
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   657
      
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   658
      if ( isset($_POST['action']['edit_save']['do_rm']) && !isset($_POST['pg_name']) )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   659
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   660
        $vals = array_keys($_POST['action']['edit_save']['rm']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   661
        $good = array();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   662
        foreach ( $vals as $id )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   663
        {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   664
          if ( strval(intval($id)) == $id )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   665
            $good[] = $id;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   666
        }
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   667
        $subquery = ( count($good) > 0 ) ? 'pg_member_id=' . implode(' OR pg_member_id=', $good) : "'foo'='bar'";
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   668
        if ( $subquery == "'foo'='bar'" )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   669
        {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   670
          echo '<div class="warning-box">' . $lang->get('acppg_err_save_no_pages') . '</div>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   671
        }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   672
        else
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   673
        {
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   674
          $sql = 'DELETE FROM '.table_prefix."page_group_members WHERE ( $subquery ) AND pg_id=$edit_id;";
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   675
          if ( !$db->sql_query($sql) )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   676
          {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   677
            $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   678
          }
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   679
          echo '<div class="info-box">' . $lang->get('acppg_msg_save_pages_deleted') . '</div>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   680
        }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   681
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   682
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   683
      // Fetch information about page group
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   684
      $q = $db->sql_query('SELECT pg_name, pg_type, pg_target FROM '.table_prefix.'page_groups WHERE pg_id=' . $edit_id . ';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   685
      if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   686
        $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   687
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   688
      if ( $db->numrows() < 1 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   689
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   690
        echo 'Bad request - can\'t load page group from database.';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   691
        return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   692
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   693
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   694
      $row = $db->fetchrow();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   695
      $db->free_result();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   696
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   697
      echo '<form name="pg_edit_frm" action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   698
      echo '<input type="hidden" name="action[edit]" value="' . $edit_id . '" />';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   699
      echo '<input type="hidden" name="pg_type" value="' . $row['pg_type'] . '" />';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   700
      echo '<div class="tblholder">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   701
              <table border="0" cellspacing="1" cellpadding="4">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   702
                <tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   703
                  <th colspan="3">' . $lang->get('acppg_th_editing_group') . ' ' . htmlspecialchars($row['pg_name']) . '</th>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   704
                </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   705
      // Group name
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   706
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   707
      echo '    <tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   708
                  <td class="row2">' . $lang->get('acppg_field_group_name') . '</td>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   709
                  <td class="row1" colspan="2"><input type="text" name="pg_name" value="' . htmlspecialchars($row['pg_name']) . '" size="30" /></td>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   710
                </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   711
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   712
      $ajax_page_add = false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   713
                
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   714
      // This is where the going gets tricky.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   715
      // For static groups, we need to have each page listed out with a removal button, and a form to add new pages.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   716
      // For category links, we need a select box with each category in it, and
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   717
      // For tag sets, just a text box to enter a new tag.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   718
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   719
      // You can guess which one I dreaded.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   720
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   721
      switch ( $row['pg_type'] )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   722
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   723
        case PAGE_GRP_NORMAL:
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   724
          
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   725
          // You have guessed correct.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   726
          // *Sits in chair for 10 minutes listening to the radio in an effort to put off writing the code you see below*
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   727
          
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   728
          echo '<tr><th colspan="3" class="subhead"><input type="submit" name="action[edit_save]" value="' . $lang->get('acppg_btn_save_name') . '" /></th></tr>';
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   729
          echo '</table></div>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   730
          echo '</form>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   731
          echo '<form name="pg_static_rm_frm" action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" enctype="multipart/form-data">';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   732
          echo '<input type="hidden" name="action[edit]" value="' . $edit_id . '" />';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   733
          echo '<div class="tblholder">
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   734
                  <table border="0" cellspacing="1" cellpadding="4">
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   735
                    <tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   736
                      <th colspan="3">' . $lang->get('acppg_th_remove_selected') . '</th>
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   737
                    </tr>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   738
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   739
          $q = $db->sql_query('SELECT m.pg_member_id,m.page_id,m.namespace FROM '.table_prefix.'page_group_members AS m
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   740
                                 LEFT JOIN '.table_prefix.'pages AS p
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   741
                                   ON ( p.urlname = m.page_id AND p.namespace = m.namespace )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   742
                                 WHERE m.pg_id=' . $edit_id . ';');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   743
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   744
          if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   745
            $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   746
          
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   747
          $delim = ceil( $db->numrows($q) / 2 );
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   748
          if ( $delim < 5 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   749
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   750
            $delim = 0xFFFFFFFE;
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   751
            // stupid hack. I'm XSSing my own code.
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   752
            $colspan = '2" id="pg_edit_tackon2me';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   753
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   754
          else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   755
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   756
            $colspan = "1";
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   757
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   758
          
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   759
          echo '<tr><td class="row2" rowspan="2">' . $lang->get('acppg_field_remove') . '</td><td class="row1" colspan="' . $colspan . '">';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   760
          $i = 0;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   761
          
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   762
          while ( $row = $db->fetchrow($q) )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   763
          {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   764
            $i++;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   765
            if ( $i == $delim )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   766
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   767
              echo '</td><td class="row1" id="pg_edit_tackon2me">';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   768
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   769
            $page_name = '(' . $row['namespace'] . ') ' . get_page_title($paths->nslist[$row['namespace']] . $row['page_id']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   770
            echo '<label><input type="checkbox" name="action[edit_save][rm][' . $row['pg_member_id'] . ']" /> ' . htmlspecialchars($page_name) . '</label><br />';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   771
          }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   772
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   773
          echo '</td></tr>';
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   774
          echo '<tr><th colspan="2" class="subhead" style="width: 70%;"><input type="submit" name="action[edit_save][do_rm]" value="' . $lang->get('acppg_btn_do_remove') . '" /></th></tr>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   775
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   776
          // More javascript magic!
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   777
          ?>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   778
          <script type="text/javascript">
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   779
            var __pg_edit_submitAuthorized = true;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   780
            var __ol_pg_edit_setup = function()
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   781
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   782
              var input = document.getElementById('inptext_pg_add_member');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   783
              input.onkeyup = function(e) { ajaxPageNameComplete(this); };
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   784
              <?php
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   785
              // stupid jEdit hack
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   786
              echo "input.onkeypress = function(e) { if ( e.keyCode == 13 ) { setTimeout('__pg_edit_ajaxadd(document.getElementById(\'' + this.id + '\'));', 500); } };";
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   787
              ?>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   788
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   789
            addOnloadHook(__ol_pg_edit_setup);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   790
            var __pg_edit_objcache = false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   791
            function __pg_edit_ajaxadd(obj)
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   792
            {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   793
              if ( __pg_edit_objcache )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   794
                return false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   795
              __pg_edit_objcache = obj;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   796
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   797
              if ( obj.nextSibling )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   798
              {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   799
                if ( obj.nextSibling.tagName == 'DIV' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   800
                {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   801
                  obj.parentNode.removeChild(obj.nextSibling);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   802
                }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   803
              }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   804
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   805
              // set width on parent, to prevent wrapping of ajax loading image
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   806
              var w = $(obj).Width();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   807
              w = w + 24;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   808
              obj.parentNode.style.width = w + 'px';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   809
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   810
              // append the ajaxy loading image
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   811
              var img = document.createElement('img');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   812
              img.src = scriptPath + '/images/loading.gif';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   813
              img.style.marginLeft = '4px';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   814
              insertAfter(obj.parentNode, img, obj);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   815
              
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   816
              var url = makeUrlNS('Admin', 'PageGroups', 'src=ajax');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   817
              var page_add = escape(obj.value);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   818
              var pg_id = document.forms.pg_edit_frm['action[edit]'].value;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   819
              ajaxPost(url, 'action[edit][add_page]=&pg_id=' + pg_id + '&new_page=' + page_add, function()
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   820
                {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   821
                  if ( ajax.readyState == 4 )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   822
                  {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   823
                    var obj = __pg_edit_objcache;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   824
                    __pg_edit_objcache = false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   825
                    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   826
                    // kill the loading graphic
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   827
                    obj.parentNode.removeChild(obj.nextSibling);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   828
                    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   829
                    var resptext = String(ajax.responseText + '');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   830
                    if ( resptext.substr(0, 1) != '{' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   831
                    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   832
                      // This ain't JSON baby.
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   833
                      alert('Invalid JSON response:\n' + resptext);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   834
                      return false;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   835
                    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   836
                    var json = parseJSON(resptext);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   837
                    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   838
                    var div = document.createElement('div');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   839
                    if ( json.mode == 'info' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   840
                    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   841
                      div.className = 'info-box-mini';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   842
                    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   843
                    else if ( json.mode == 'error' )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   844
                    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   845
                      div.className = 'error-box-mini';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   846
                    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   847
                    div.appendChild(document.createTextNode(json.text));
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   848
                    insertAfter(obj.parentNode, div, obj);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   849
                    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   850
                    if ( json.successful )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   851
                    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   852
                      var td = document.getElementById('pg_edit_tackon2me');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   853
                      var lbl = document.createElement('label');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   854
                      var check = document.createElement('input');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   855
                      check.type = 'checkbox';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   856
                      check.name = 'action[edit_save][rm][' + json.member_id + ']';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   857
                      lbl.appendChild(check);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   858
                      lbl.appendChild(document.createTextNode(' ' + json.title));
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   859
                      td.appendChild(lbl);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   860
                      td.appendChild(document.createElement('br'));
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   861
                    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   862
                    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   863
                  }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   864
                });
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   865
            }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   866
          </script>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   867
          <?php
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   868
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   869
          $ajax_page_add = true;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   870
          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   871
          break;
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   872
        case PAGE_GRP_TAGGED:
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   873
          echo '<tr>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   874
                  <td class="row2">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   875
                    ' . $lang->get('acppg_field_target_tag') . '
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   876
                  </td>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   877
                  <td class="row1">
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   878
                    <input type="text" name="pg_target" value="' . htmlspecialchars($row['pg_target']) . '" size="30" />
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   879
                  </td>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   880
                </tr>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   881
          break;
183
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   882
        case PAGE_GRP_REGEX:
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   883
          echo '<tr>
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   884
                  <td class="row2">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   885
                    ' . $lang->get('acppg_field_target_regex') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   886
                    <small>' . $lang->get('acppg_field_target_regex_hint') . '</small>
183
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   887
                  </td>
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   888
                  <td class="row1">
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   889
                    <input type="text" name="pg_target" value="' . htmlspecialchars($row['pg_target']) . '" size="30" />
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   890
                  </td>
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   891
                </tr>';
91127e62f38f Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops)
Dan
parents: 156
diff changeset
   892
          break;
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   893
        case PAGE_GRP_CATLINK:
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   894
          
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   895
          // Build category list
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   896
          $q = $db->sql_query('SELECT name,urlname FROM '.table_prefix.'pages WHERE namespace=\'Category\';');
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   897
          if ( !$q )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   898
            $db->_die();
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   899
          
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   900
          if ( $db->numrows() < 1 )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   901
          {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   902
            $catlist = 'There aren\'t any categories on this site.';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   903
          }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   904
          else
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   905
          {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   906
            $catlist = '<select name="pg_target">';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   907
            while ( $catrow = $db->fetchrow() )
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   908
            {
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   909
              $selected = ( $catrow['urlname'] == $row['pg_target'] ) ? ' selected="selected"' : '';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   910
              $catlist .= '<option value="' . htmlspecialchars($catrow['urlname']) . '"' . $selected . '>' . htmlspecialchars($catrow['name']) . '</option>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   911
            }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   912
            $catlist .= '</select>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   913
          }
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   914
          
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   915
          echo '<tr>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   916
                  <td class="row2">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   917
                    ' . $lang->get('acppg_field_target_category') . '<br />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   918
                    <small>' . $lang->get('acppg_field_target_category_hint2') . '</small>
81
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   919
                  </td>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   920
                  <td class="row1">
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   921
                    ' . $catlist . '
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   922
                  </td>
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   923
                </tr>';
d7fc25acd3f3 Replaced the menu in the admin theme with something much more visually pleasureable; minor fix in Special:UploadFile; finished patching a couple of XSS problems from Banshee; finished Admin:PageGroups; removed unneeded code in flyin.js; finished tag system (except tag cloud); 1.0.1 release candidate
Dan
parents: 80
diff changeset
   924
          
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   925
          break;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   926
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   927
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   928
      if ( $ajax_page_add )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   929
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   930
        echo '<tr><th colspan="3"><input type="submit" name="action[noop]" value="' . $lang->get('acppg_btn_cancel_all') . '" /></th></tr>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   931
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   932
      else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   933
      {
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   934
        echo '<tr><th colspan="3" class="subhead">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   935
                <input type="submit" name="action[edit_save]" value="' . $lang->get('acppg_btn_save_update') . '" />
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   936
                <input type="submit" name="action[noop]" value="' . $lang->get('acppg_btn_cancel_all') . '" />
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   937
              </th></tr>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   938
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   939
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   940
      echo '  </table>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   941
            </div>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   942
      echo '</form>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   943
      
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   944
      if ( $ajax_page_add )
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   945
      {
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   946
        // This needs to be outside of the form.
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   947
        echo '<div class="tblholder"><table border="0" cellspacing="1" cellpadding="4"><tr>';
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   948
        echo '<th colspan="2">' . $lang->get('acppg_th_onthefly') . '</th></tr>';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   949
        echo '<tr>';
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   950
        // Add pages AJAX form
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   951
        echo '<td class="row2">' . $lang->get('acppg_field_add_page') . '<br /><small>' . $lang->get('acppg_field_add_page_hint') . '</small></td>';
80
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   952
        echo '<td class="row1"><input type="text" size="30" name="pg_add_member" id="inptext_pg_add_member" /></td>';
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   953
        echo '</tr></table></div>';
cb7dde69c301 Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
parents: 75
diff changeset
   954
      }
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   955
      
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   956
      return;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   957
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   958
    else if ( isset($_POST['action']['noop']) )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   959
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   960
      // Do nothing - skip to main form (noop is usually invoked by a cancel button in a form above)
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   961
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   962
    else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   963
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   964
      echo '<div class="error-box">Invalid format of $_POST[action].</div>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   965
    }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   966
  }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   967
  // No action defined - show default menu
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   968
  
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   969
  echo '<h2>' . $lang->get('acppg_heading_main') . '</h2>';
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   970
  echo '<p>' . $lang->get('acppg_hint_intro') . '</p>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   971
  
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   972
  $q = $db->sql_query('SELECT pg_id, pg_type, pg_name, pg_target FROM '.table_prefix.'page_groups;');
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   973
  if ( !$q )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   974
    $db->_die();
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   975
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   976
  echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized) return false;" enctype="multipart/form-data">';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   977
  
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   978
  echo '<div class="tblholder">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   979
          <table border="0" cellspacing="1" cellpadding="4">
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   980
            <tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   981
              <th>' . $lang->get('acppg_col_group_name') . '</th>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   982
              <th>' . $lang->get('acppg_col_type') . '</th>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   983
              <th>' . $lang->get('acppg_col_target') . '</th>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   984
              <th colspan="2">' . $lang->get('acppg_col_actions') . '</th>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   985
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   986
  
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   987
  if ( $row = $db->fetchrow($q) )
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   988
  {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   989
    do
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   990
    {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   991
      $name = htmlspecialchars($row['pg_name']);
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   992
      $type = 'Invalid';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   993
      switch ( $row['pg_type'] )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   994
      {
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   995
        case PAGE_GRP_CATLINK:
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   996
          $type = $lang->get('acppg_gtype_catlink');
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   997
          break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
   998
        case PAGE_GRP_TAGGED:
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
   999
          $type = $lang->get('acppg_gtype_tagged');
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1000
          break;
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1001
        case PAGE_GRP_NORMAL:
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1002
          $type = $lang->get('acppg_gtype_static');
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1003
          break;
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
  1004
        case PAGE_GRP_REGEX:
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1005
          $type = $lang->get('acppg_gtype_regex');
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
  1006
          break;
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1007
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1008
      $target = '';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1009
      if ( $row['pg_type'] == PAGE_GRP_TAGGED )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1010
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1011
        $target = $lang->get('acppg_lbl_tag') . ' ' . htmlspecialchars($row['pg_target']);
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1012
      }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1013
      else if ( $row['pg_type'] == PAGE_GRP_CATLINK )
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1014
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1015
        $target = $lang->get('acppg_lbl_category') . ' ' . htmlspecialchars(get_page_title($paths->nslist['Category'] . sanitize_page_id($row['pg_target'])));
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1016
      }
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
  1017
      else if ( $row['pg_type'] == PAGE_GRP_REGEX )
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
  1018
      {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1019
        $target = $lang->get('acppg_lbl_regex') . ' <tt>' . htmlspecialchars($row['pg_target']) . '</tt>';
156
edbff85d43e8 Feature add: new page group type: regular expression match (PCRE)
Dan
parents: 142
diff changeset
  1020
      }
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1021
      $btn_edit = '<input type="submit" name="action[edit][' . $row['pg_id'] . ']" value="' . $lang->get('acppg_btn_edit') . '" />';
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1022
      $btn_del = '<input type="submit" name="action[del][' . $row['pg_id'] . ']" value="' . $lang->get('acppg_btn_delete') . '" />';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1023
      echo "<tr>
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1024
              <td class=\"row1\">$name</td>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1025
              <td class=\"row2\">$type</td>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1026
              <td class=\"row1\">$target</td>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1027
              <td class=\"row3\" style=\"text-align: center;\">$btn_edit</td>
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1028
              <td class=\"row3\" style=\"text-align: center;\">$btn_del</td>
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1029
            </tr>";
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1030
    }
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1031
    while ( $row = $db->fetchrow($q) );
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1032
  }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1033
  else
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1034
  {
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1035
    echo '  <tr><td class="row3" colspan="5" style="text-align: center;">' . $lang->get('acppg_msg_no_groups') . '</td></tr>';
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1036
  }
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1037
  
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1038
  echo '    <tr>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1039
              <th class="subhead" colspan="5">
345
4ccdfeee9a11 WiP commit for admin panel localization. All modules up to Admin:UserManager (working down the list) are localized except Admin:ThemeManager, which is due for a rewrite
Dan
parents: 334
diff changeset
  1040
                <input type="submit" name="action[create]" value="' . $lang->get('acppg_btn_create_new') . '" />
75
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1041
              </th>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1042
            </tr>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1043
  
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1044
  echo '  </table>
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1045
        </div>';
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1046
        
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1047
  echo '</form>';          
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1048
    
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1049
}
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1050
1f85c1c609fd Oops, forgot to add PageGroups.php in plugins/admin/
Dan
parents:
diff changeset
  1051
?>