| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      // $Id: index.php 1112 2009-08-08 14:28:54Z Ruebenwurzel $
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      /*
 
     | 
  
  
    | 
      6
     | 
    
      
 
     | 
  
  
    | 
      7
     | 
    
       Website Baker Project <http://www.websitebaker.org/>
 
     | 
  
  
    | 
      8
     | 
    
       Copyright (C) 2004-2009, Ryan Djurovich
 
     | 
  
  
    | 
      9
     | 
    
      
 
     | 
  
  
    | 
      10
     | 
    
       Website Baker is free software; you can redistribute it and/or modify
 
     | 
  
  
    | 
      11
     | 
    
       it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      12
     | 
    
       the Free Software Foundation; either version 2 of the License, or
 
     | 
  
  
    | 
      13
     | 
    
       (at your option) any later version.
 
     | 
  
  
    | 
      14
     | 
    
      
 
     | 
  
  
    | 
      15
     | 
    
       Website Baker is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      16
     | 
    
       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      17
     | 
    
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      18
     | 
    
       GNU General Public License for more details.
 
     | 
  
  
    | 
      19
     | 
    
      
 
     | 
  
  
    | 
      20
     | 
    
       You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      21
     | 
    
       along with Website Baker; if not, write to the Free Software
 
     | 
  
  
    | 
      22
     | 
    
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
     | 
  
  
    | 
      23
     | 
    
      
 
     | 
  
  
    | 
      24
     | 
    
      */
 
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
      // Print admin header
 
     | 
  
  
    | 
      27
     | 
    
      require('../../config.php');
     | 
  
  
    | 
      28
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      29
     | 
    
      $admin = new admin('Access', 'groups');
     | 
  
  
    | 
      30
     | 
    
      
 
     | 
  
  
    | 
      31
     | 
    
      // Create new template object for the modify/remove menu
 
     | 
  
  
    | 
      32
     | 
    
      $template = new Template(THEME_PATH.'/templates');
 
     | 
  
  
    | 
      33
     | 
    
      $template->set_file('page', 'groups.htt');
     | 
  
  
    | 
      34
     | 
    
      $template->set_block('page', 'main_block', 'main');
     | 
  
  
    | 
      35
     | 
    
      $template->set_block('main_block', 'manage_users_block', 'users');
     | 
  
  
    | 
      36
     | 
    
      // insert urls
 
     | 
  
  
    | 
      37
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      38
     | 
    
      	'ADMIN_URL' => ADMIN_URL,
 
     | 
  
  
    | 
      39
     | 
    
      	'WB_URL' => WB_URL,
 
     | 
  
  
    | 
      40
     | 
    
      	'WB_PATH' => WB_PATH,
 
     | 
  
  
    | 
      41
     | 
    
      	'THEME_URL' => THEME_URL
 
     | 
  
  
    | 
      42
     | 
    
      	)
 
     | 
  
  
    | 
      43
     | 
    
      );
 
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      // Get existing value from database
 
     | 
  
  
    | 
      46
     | 
    
      $database = new database();
 
     | 
  
  
    | 
      47
     | 
    
      $query = "SELECT group_id,name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'";
 
     | 
  
  
    | 
      48
     | 
    
      $results = $database->query($query);
 
     | 
  
  
    | 
      49
     | 
    
      if($database->is_error()) {
     | 
  
  
    | 
      50
     | 
    
      	$admin->print_error($database->get_error(), 'index.php');
 
     | 
  
  
    | 
      51
     | 
    
      }
 
     | 
  
  
    | 
      52
     | 
    
      
 
     | 
  
  
    | 
      53
     | 
    
      // Insert values into the modify/remove menu
 
     | 
  
  
    | 
      54
     | 
    
      $template->set_block('main_block', 'list_block', 'list');
     | 
  
  
    | 
      55
     | 
    
      if($results->numRows() > 0) {
     | 
  
  
    | 
      56
     | 
    
      	// Insert first value to say please select
 
     | 
  
  
    | 
      57
     | 
    
      	$template->set_var('VALUE', '');
     | 
  
  
    | 
      58
     | 
    
      	$template->set_var('NAME', $TEXT['PLEASE_SELECT'].'...');
     | 
  
  
    | 
      59
     | 
    
      	$template->parse('list', 'list_block', true);
     | 
  
  
    | 
      60
     | 
    
      	// Loop through groups
 
     | 
  
  
    | 
      61
     | 
    
      	while($group = $results->fetchRow()) {
     | 
  
  
    | 
      62
     | 
    
      		$template->set_var('VALUE', $group['group_id']);
     | 
  
  
    | 
      63
     | 
    
      		$template->set_var('NAME', $group['name']);
     | 
  
  
    | 
      64
     | 
    
      		$template->parse('list', 'list_block', true);
     | 
  
  
    | 
      65
     | 
    
      	}
 
     | 
  
  
    | 
      66
     | 
    
      } else {
     | 
  
  
    | 
      67
     | 
    
      	// Insert single value to say no groups were found
 
     | 
  
  
    | 
      68
     | 
    
      	$template->set_var('NAME', $TEXT['NONE_FOUND']);
     | 
  
  
    | 
      69
     | 
    
      	$template->parse('list', 'list_block', true);
     | 
  
  
    | 
      70
     | 
    
      }
 
     | 
  
  
    | 
      71
     | 
    
      
 
     | 
  
  
    | 
      72
     | 
    
      // Insert permissions values
 
     | 
  
  
    | 
      73
     | 
    
      if($admin->get_permission('groups_add') != true) {
     | 
  
  
    | 
      74
     | 
    
      	$template->set_var('DISPLAY_ADD', 'hide');
     | 
  
  
    | 
      75
     | 
    
      }
 
     | 
  
  
    | 
      76
     | 
    
      if($admin->get_permission('groups_modify') != true) {
     | 
  
  
    | 
      77
     | 
    
      	$template->set_var('DISPLAY_MODIFY', 'hide');
     | 
  
  
    | 
      78
     | 
    
      }
 
     | 
  
  
    | 
      79
     | 
    
      if($admin->get_permission('groups_delete') != true) {
     | 
  
  
    | 
      80
     | 
    
      	$template->set_var('DISPLAY_DELETE', 'hide');
     | 
  
  
    | 
      81
     | 
    
      }
 
     | 
  
  
    | 
      82
     | 
    
      
 
     | 
  
  
    | 
      83
     | 
    
      // Insert language headings
 
     | 
  
  
    | 
      84
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      85
     | 
    
      	'HEADING_MODIFY_DELETE_GROUP' => $HEADING['MODIFY_DELETE_GROUP'],
 
     | 
  
  
    | 
      86
     | 
    
      	'HEADING_ADD_GROUP' => $HEADING['ADD_GROUP']
 
     | 
  
  
    | 
      87
     | 
    
      	)
 
     | 
  
  
    | 
      88
     | 
    
      );
 
     | 
  
  
    | 
      89
     | 
    
      // Insert language text and messages
 
     | 
  
  
    | 
      90
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      91
     | 
    
      	'TEXT_MODIFY' => $TEXT['MODIFY'],
 
     | 
  
  
    | 
      92
     | 
    
      	'TEXT_DELETE' => $TEXT['DELETE'],
 
     | 
  
  
    | 
      93
     | 
    
      	'TEXT_MANAGE_USERS' => ( $admin->get_permission('users') == true ) ? $TEXT['MANAGE_USERS']: "",
     | 
  
  
    | 
      94
     | 
    
      	'CONFIRM_DELETE' => $MESSAGE['GROUPS']['CONFIRM_DELETE']
 
     | 
  
  
    | 
      95
     | 
    
      	)
 
     | 
  
  
    | 
      96
     | 
    
      );
 
     | 
  
  
    | 
      97
     | 
    
      if ( $admin->get_permission('users') == true ) $template->parse("users", "manage_users_block", true);
     | 
  
  
    | 
      98
     | 
    
      // Parse template object
 
     | 
  
  
    | 
      99
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      100
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      101
     | 
    
      
 
     | 
  
  
    | 
      102
     | 
    
      // Setup template for add group form
 
     | 
  
  
    | 
      103
     | 
    
      $template = new Template(THEME_PATH.'/templates');
 
     | 
  
  
    | 
      104
     | 
    
      $template->set_file('page', 'groups_form.htt');
     | 
  
  
    | 
      105
     | 
    
      $template->set_block('page', 'main_block', 'main');
     | 
  
  
    | 
      106
     | 
    
      $template->set_var('DISPLAY_EXTRA', 'none');
     | 
  
  
    | 
      107
     | 
    
      $template->set_var('ACTION_URL', ADMIN_URL.'/groups/add.php');
     | 
  
  
    | 
      108
     | 
    
      $template->set_var('SUBMIT_TITLE', $TEXT['ADD']);
     | 
  
  
    | 
      109
     | 
    
      $template->set_var('ADVANCED_ACTION', 'index.php');
     | 
  
  
    | 
      110
     | 
    
      
 
     | 
  
  
    | 
      111
     | 
    
      // Tell the browser whether or not to show advanced options
 
     | 
  
  
    | 
      112
     | 
    
      if ( true == (isset( $_POST['advanced']) AND ( strpos( $_POST['advanced'], ">>") > 0 ) ) ) {
     | 
  
  
    | 
      113
     | 
    
      	$template->set_var('DISPLAY_ADVANCED', '');
     | 
  
  
    | 
      114
     | 
    
      	$template->set_var('DISPLAY_BASIC', 'none');
     | 
  
  
    | 
      115
     | 
    
      	$template->set_var('ADVANCED', 'yes');
     | 
  
  
    | 
      116
     | 
    
      	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
     | 
  
  
    | 
      117
     | 
    
      } else {
     | 
  
  
    | 
      118
     | 
    
      	$template->set_var('DISPLAY_ADVANCED', 'none');
     | 
  
  
    | 
      119
     | 
    
      	$template->set_var('DISPLAY_BASIC', '');
     | 
  
  
    | 
      120
     | 
    
      	$template->set_var('ADVANCED', 'no');
     | 
  
  
    | 
      121
     | 
    
      	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
     | 
  
  
    | 
      122
     | 
    
      }
 
     | 
  
  
    | 
      123
     | 
    
      
 
     | 
  
  
    | 
      124
     | 
    
      // Insert permissions values
 
     | 
  
  
    | 
      125
     | 
    
      if($admin->get_permission('groups_add') != true) {
     | 
  
  
    | 
      126
     | 
    
      	$template->set_var('DISPLAY_ADD', 'hide');
     | 
  
  
    | 
      127
     | 
    
      }
 
     | 
  
  
    | 
      128
     | 
    
      
 
     | 
  
  
    | 
      129
     | 
    
      // Insert values into module list
 
     | 
  
  
    | 
      130
     | 
    
      $template->set_block('main_block', 'module_list_block', 'module_list');
     | 
  
  
    | 
      131
     | 
    
      $result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page'");
     | 
  
  
    | 
      132
     | 
    
      if($result->numRows() > 0) {
     | 
  
  
    | 
      133
     | 
    
      	while($addon = $result->fetchRow()) {
     | 
  
  
    | 
      134
     | 
    
      		$template->set_var('VALUE', $addon['directory']);
     | 
  
  
    | 
      135
     | 
    
      		$template->set_var('NAME', $addon['name']);
     | 
  
  
    | 
      136
     | 
    
      		$template->parse('module_list', 'module_list_block', true);
     | 
  
  
    | 
      137
     | 
    
      	}
 
     | 
  
  
    | 
      138
     | 
    
      }
 
     | 
  
  
    | 
      139
     | 
    
      
 
     | 
  
  
    | 
      140
     | 
    
      // Insert values into template list
 
     | 
  
  
    | 
      141
     | 
    
      $template->set_block('main_block', 'template_list_block', 'template_list');
     | 
  
  
    | 
      142
     | 
    
      $result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
     | 
  
  
    | 
      143
     | 
    
      if($result->numRows() > 0) {
     | 
  
  
    | 
      144
     | 
    
      	while($addon = $result->fetchRow()) {
     | 
  
  
    | 
      145
     | 
    
      		$template->set_var('VALUE', $addon['directory']);
     | 
  
  
    | 
      146
     | 
    
      		$template->set_var('NAME', $addon['name']);
     | 
  
  
    | 
      147
     | 
    
      		$template->parse('template_list', 'template_list_block', true);
     | 
  
  
    | 
      148
     | 
    
      	}
 
     | 
  
  
    | 
      149
     | 
    
      }
 
     | 
  
  
    | 
      150
     | 
    
      
 
     | 
  
  
    | 
      151
     | 
    
      // Insert language text and messages
 
     | 
  
  
    | 
      152
     | 
    
      $template->set_var(array(
 
     | 
  
  
    | 
      153
     | 
    
      								'TEXT_RESET' => $TEXT['RESET'],
 
     | 
  
  
    | 
      154
     | 
    
      								'TEXT_ACTIVE' => $TEXT['ACTIVE'],
 
     | 
  
  
    | 
      155
     | 
    
      								'TEXT_DISABLED' => $TEXT['DISABLED'],
 
     | 
  
  
    | 
      156
     | 
    
      								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
 
     | 
  
  
    | 
      157
     | 
    
      								'TEXT_USERNAME' => $TEXT['USERNAME'],
 
     | 
  
  
    | 
      158
     | 
    
      								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
 
     | 
  
  
    | 
      159
     | 
    
      								'TEXT_RETYPE_PASSWORD' => $TEXT['RETYPE_PASSWORD'],
 
     | 
  
  
    | 
      160
     | 
    
      								'TEXT_DISPLAY_NAME' => $TEXT['DISPLAY_NAME'],
 
     | 
  
  
    | 
      161
     | 
    
      								'TEXT_EMAIL' => $TEXT['EMAIL'],
 
     | 
  
  
    | 
      162
     | 
    
      								'TEXT_GROUP' => $TEXT['GROUP'],
 
     | 
  
  
    | 
      163
     | 
    
      								'TEXT_SYSTEM_PERMISSIONS' => $TEXT['SYSTEM_PERMISSIONS'],
 
     | 
  
  
    | 
      164
     | 
    
      								'TEXT_MODULE_PERMISSIONS' => $TEXT['MODULE_PERMISSIONS'],
 
     | 
  
  
    | 
      165
     | 
    
      								'TEXT_TEMPLATE_PERMISSIONS' => $TEXT['TEMPLATE_PERMISSIONS'],
 
     | 
  
  
    | 
      166
     | 
    
      								'TEXT_NAME' => $TEXT['NAME'],
 
     | 
  
  
    | 
      167
     | 
    
      								'SECTION_PAGES' => $MENU['PAGES'],
 
     | 
  
  
    | 
      168
     | 
    
      								'SECTION_MEDIA' => $MENU['MEDIA'],
 
     | 
  
  
    | 
      169
     | 
    
      								'SECTION_MODULES' => $MENU['MODULES'],
 
     | 
  
  
    | 
      170
     | 
    
      								'SECTION_TEMPLATES' => $MENU['TEMPLATES'],
 
     | 
  
  
    | 
      171
     | 
    
      								'SECTION_SETTINGS' => $MENU['SETTINGS'],
 
     | 
  
  
    | 
      172
     | 
    
      								'SECTION_LANGUAGES' => $MENU['LANGUAGES'],
 
     | 
  
  
    | 
      173
     | 
    
      								'SECTION_USERS' => $MENU['USERS'],
 
     | 
  
  
    | 
      174
     | 
    
      								'SECTION_GROUPS' => $MENU['GROUPS'],
 
     | 
  
  
    | 
      175
     | 
    
      								'SECTION_ADMINTOOLS' => $MENU['ADMINTOOLS'],
 
     | 
  
  
    | 
      176
     | 
    
      								'TEXT_VIEW' => $TEXT['VIEW'],
 
     | 
  
  
    | 
      177
     | 
    
      								'TEXT_ADD' => $TEXT['ADD'],
 
     | 
  
  
    | 
      178
     | 
    
      								'TEXT_LEVEL' => $TEXT['LEVEL'],
 
     | 
  
  
    | 
      179
     | 
    
      								'TEXT_MODIFY' => $TEXT['MODIFY'],
 
     | 
  
  
    | 
      180
     | 
    
      								'TEXT_DELETE' => $TEXT['DELETE'],
 
     | 
  
  
    | 
      181
     | 
    
      								'TEXT_MODIFY_CONTENT' => $TEXT['MODIFY_CONTENT'],
 
     | 
  
  
    | 
      182
     | 
    
      								'TEXT_MODIFY_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
 
     | 
  
  
    | 
      183
     | 
    
      								'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'],
 
     | 
  
  
    | 
      184
     | 
    
      								'TEXT_CREATE_FOLDER' => $TEXT['CREATE_FOLDER'],
 
     | 
  
  
    | 
      185
     | 
    
      								'TEXT_RENAME' => $TEXT['RENAME'],
 
     | 
  
  
    | 
      186
     | 
    
      								'TEXT_UPLOAD_FILES' => $TEXT['UPLOAD_FILES'],
 
     | 
  
  
    | 
      187
     | 
    
      								'TEXT_BASIC' => $TEXT['BASIC'],
 
     | 
  
  
    | 
      188
     | 
    
      								'TEXT_ADVANCED' => $TEXT['ADVANCED'],
 
     | 
  
  
    | 
      189
     | 
    
      								'CHANGING_PASSWORD' => $MESSAGE['USERS']['CHANGING_PASSWORD'],
 
     | 
  
  
    | 
      190
     | 
    
      								'CHECKED' => ' checked="checked"',
 
     | 
  
  
    | 
      191
     | 
    
      								'ADMIN_URL' => ADMIN_URL,
 
     | 
  
  
    | 
      192
     | 
    
      								'WB_URL' => WB_URL,
 
     | 
  
  
    | 
      193
     | 
    
      								'WB_PATH' => WB_PATH,
 
     | 
  
  
    | 
      194
     | 
    
      								'THEME_URL' => THEME_URL
 
     | 
  
  
    | 
      195
     | 
    
      								)
 
     | 
  
  
    | 
      196
     | 
    
      						);
 
     | 
  
  
    | 
      197
     | 
    
      
 
     | 
  
  
    | 
      198
     | 
    
      // Parse template for add group form
 
     | 
  
  
    | 
      199
     | 
    
      $template->parse('main', 'main_block', false);
     | 
  
  
    | 
      200
     | 
    
      $template->pparse('output', 'page');
     | 
  
  
    | 
      201
     | 
    
      
 
     | 
  
  
    | 
      202
     | 
    
      // Print the admin footer
 
     | 
  
  
    | 
      203
     | 
    
      $admin->print_footer();
 
     | 
  
  
    | 
      204
     | 
    
      
 
     | 
  
  
    | 
      205
     | 
    
      ?>
 
     |