| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      /**
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * @category        admin
 
     | 
  
  
    | 
      5
     | 
    
       * @package         groups
 
     | 
  
  
    | 
      6
     | 
    
       * @author          WebsiteBaker Project
 
     | 
  
  
    | 
      7
     | 
    
       * @copyright       2004-2009, Ryan Djurovich
 
     | 
  
  
    | 
      8
     | 
    
       * @copyright       2009-2011, Website Baker Org. e.V.
 
     | 
  
  
    | 
      9
     | 
    
       * @link			http://www.websitebaker2.org/
 
     | 
  
  
    | 
      10
     | 
    
       * @license         http://www.gnu.org/licenses/gpl.html
 
     | 
  
  
    | 
      11
     | 
    
       * @platform        WebsiteBaker 2.8.x
 
     | 
  
  
    | 
      12
     | 
    
       * @requirements    PHP 5.2.2 and higher
 
     | 
  
  
    | 
      13
     | 
    
       * @version         $Id: save.php 1493 2011-08-11 14:56:05Z Luisehahne $
 
     | 
  
  
    | 
      14
     | 
    
       * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/groups/save.php $
 
     | 
  
  
    | 
      15
     | 
    
       * @lastmodified    $Date: 2011-08-11 16:56:05 +0200 (Thu, 11 Aug 2011) $
 
     | 
  
  
    | 
      16
     | 
    
       *
 
     | 
  
  
    | 
      17
     | 
    
       */
 
     | 
  
  
    | 
      18
     | 
    
      
 
     | 
  
  
    | 
      19
     | 
    
      // Print admin header
 
     | 
  
  
    | 
      20
     | 
    
      require('../../config.php');
     | 
  
  
    | 
      21
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      22
     | 
    
      // suppress to print the header, so no new FTAN will be set
 
     | 
  
  
    | 
      23
     | 
    
      $admin = new admin('Access', 'groups_modify', false);
     | 
  
  
    | 
      24
     | 
    
      // Create a javascript back link
 
     | 
  
  
    | 
      25
     | 
    
      $js_back = ADMIN_URL.'/groups/index.php';
 
     | 
  
  
    | 
      26
     | 
    
      
 
     | 
  
  
    | 
      27
     | 
    
      if (!$admin->checkFTAN())
 
     | 
  
  
    | 
      28
     | 
    
      {
     | 
  
  
    | 
      29
     | 
    
      	$admin->print_header();
 
     | 
  
  
    | 
      30
     | 
    
      	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
 
     | 
  
  
    | 
      31
     | 
    
      }
 
     | 
  
  
    | 
      32
     | 
    
      
 
     | 
  
  
    | 
      33
     | 
    
      // Check if group group_id is a valid number and doesnt equal 1
 
     | 
  
  
    | 
      34
     | 
    
      $group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
     | 
  
  
    | 
      35
     | 
    
      if( ($group_id < 2 ) )
 
     | 
  
  
    | 
      36
     | 
    
      {
     | 
  
  
    | 
      37
     | 
    
      	// if($admin_header) { $admin->print_header(); }
     | 
  
  
    | 
      38
     | 
    
      	$admin->print_header();
 
     | 
  
  
    | 
      39
     | 
    
      	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'] );
 
     | 
  
  
    | 
      40
     | 
    
      }
 
     | 
  
  
    | 
      41
     | 
    
      
 
     | 
  
  
    | 
      42
     | 
    
      // Gather details entered
 
     | 
  
  
    | 
      43
     | 
    
      $group_name = $admin->get_post_escaped('group_name');
     | 
  
  
    | 
      44
     | 
    
      
 
     | 
  
  
    | 
      45
     | 
    
      // Check values
 
     | 
  
  
    | 
      46
     | 
    
      if($group_name == "") {
     | 
  
  
    | 
      47
     | 
    
      	$admin->print_error($MESSAGE['GROUPS']['GROUP_NAME_BLANK'], $js_back);
 
     | 
  
  
    | 
      48
     | 
    
      }
 
     | 
  
  
    | 
      49
     | 
    
      // After check print the header
 
     | 
  
  
    | 
      50
     | 
    
      $admin->print_header();
 
     | 
  
  
    | 
      51
     | 
    
      
 
     | 
  
  
    | 
      52
     | 
    
      // Get system permissions
 
     | 
  
  
    | 
      53
     | 
    
      require_once(ADMIN_PATH.'/groups/get_permissions.php');
 
     | 
  
  
    | 
      54
     | 
    
      
 
     | 
  
  
    | 
      55
     | 
    
      // Update the database
 
     | 
  
  
    | 
      56
     | 
    
      $query = "UPDATE `".TABLE_PREFIX."groups` SET `name` = '$group_name', `system_permissions` = '$system_permissions', `module_permissions` = '$module_permissions', `template_permissions` = '$template_permissions' WHERE `group_id` = '$group_id'";
 
     | 
  
  
    | 
      57
     | 
    
      
 
     | 
  
  
    | 
      58
     | 
    
      $database->query($query);
 
     | 
  
  
    | 
      59
     | 
    
      if($database->is_error()) {
     | 
  
  
    | 
      60
     | 
    
      	$admin->print_error($database->get_error());
 
     | 
  
  
    | 
      61
     | 
    
      } else {
     | 
  
  
    | 
      62
     | 
    
      	$admin->print_success($MESSAGE['GROUPS']['SAVED'], ADMIN_URL.'/groups/index.php');
 
     | 
  
  
    | 
      63
     | 
    
      }
 
     | 
  
  
    | 
      64
     | 
    
      
 
     | 
  
  
    | 
      65
     | 
    
      // Print admin footer
 
     | 
  
  
    | 
      66
     | 
    
      $admin->print_footer();
 
     |