b2evolution PHP Cross Reference Blogging Systems

Source: /inc/files/views/_file_permissions.form.php - 127 lines - 4481 bytes - Text - Print

Description: This file implements the UI for file permissions This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the UI for file permissions
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * {@internal License choice
  12   * - If you have received this file as part of a package, please find the license.txt file in
  13   *   the same folder or the closest folder above for complete license terms.
  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15   *   then you must choose one of the following licenses before using the file:
  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18   * }}
  19   *
  20   * {@internal Open Source relicensing agreement:
  21   * Daniel HAHLER grants Francois PLANQUE the right to license
  22   * Daniel HAHLER's contributions to this file and the b2evolution project
  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  24   * }}
  25   *
  26   * @package evocore
  27   *
  28   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  29   * @author fplanque: Francois PLANQUE
  30   * @author blueyed: Daniel HAHLER
  31   *
  32   * @version $Id: _file_permissions.form.php 6136 2014-03-08 07:59:48Z manuel $
  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  
  37  /**
  38   * @global Filelist
  39   */
  40  global $selected_Filelist;
  41  
  42  global $more_than_one_selected_file, $perms_read_readonly, $field_options_read_readonly;
  43  
  44  
  45  $Form = new Form( NULL, 'fm_perms_checkchanges' );
  46  
  47  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url() );
  48  
  49  $Form->begin_form( 'fform', T_('Change permissions') );
  50  
  51      $Form->add_crumb( 'file' );
  52      $Form->hidden_ctrl();
  53      $Form->hiddens_by_key( get_memorized() );
  54      $Form->hidden( 'action', 'edit_perms' );
  55  
  56      if( $more_than_one_selected_file )
  57      { // more than one file, provide default
  58          $Form->begin_fieldset( T_('Default') );
  59  
  60          if( $perms_read_readonly )
  61          {
  62              $Form->radio_input( 'edit_perms_default', $edit_perms_default, $field_options_read_readonly, T_('Default permissions') );
  63          }
  64          else
  65          {
  66              $Form->text_input( 'edit_perms_default', $edit_perms_default, 3, T_('Default permissions') );
  67          }
  68  
  69          $Form->info_field( '', '<a id="checkallspan_edit_perms_set" href="#" onclick="toggleCheckboxes(\'fm_perms_checkchanges\', \'use_default_perms[]\', \'edit_perms_set\'); return false;">'.T_('check all').'</a>' );
  70  
  71          $Form->end_fieldset();
  72      }
  73  
  74      if( $more_than_one_selected_file )
  75      { // generate checkbox input to use with every file
  76          $Form->output = false;
  77          $Form->switch_layout('none');
  78          $use_default_perms_checkbox = $Form->checkbox_input(
  79              'use_default_perms[]', $checked = 0, T_('Use default value'),
  80              array( 'value' => '%file_ID%', 'id' => 'use_default_perms_%file_ID%' ) );
  81          $Form->switch_layout(NULL);
  82          $Form->output = true;
  83      }
  84  
  85      $selected_Filelist->restart();
  86  
  87      $Form->begin_fieldset();
  88      while( $l_File = & $selected_Filelist->get_next() )
  89      {
  90          if( $perms_read_readonly )
  91          { // readonly/write only (WINDOWS): display radio inputs to change readonly/write
  92              $field_options = $field_options_read_readonly;
  93              $field_params = array();
  94              if( !empty($use_default_perms_checkbox) )
  95              {
  96                  $field_params['field_suffix'] = str_replace( '%file_ID%', $l_File->get_md5_ID(), $use_default_perms_checkbox );
  97              }
  98  
  99              $l_perms = $l_File->get_perms( 'octal' );
 100              if( $l_perms == 555 )
 101              {
 102                  $field_options[0]['checked'] = 'checked';
 103              }
 104              else
 105              {
 106                  $field_options[1]['checked'] = 'checked';
 107              }
 108              $Form->radio_input( 'perms['.$l_File->get_md5_ID().']', false, $field_options, $l_File->get_rdfp_rel_path(), $field_params );
 109          }
 110          else
 111          { // display a text input with UNIX perms
 112              $field_params = array();
 113              if( !empty($use_default_perms_checkbox) )
 114              {
 115                  $field_params['field_suffix'] = str_replace( '%file_ID%', $l_File->get_md5_ID(), $use_default_perms_checkbox );
 116              }
 117  
 118              $Form->text_input( 'perms['.$l_File->get_md5_ID().']', $l_File->get_perms( 'octal' ), 3, $l_File->get_rdfp_rel_path(), $field_params );
 119          }
 120      }
 121      $Form->end_fieldset();
 122  
 123  $Form->end_form( array(
 124          array( 'submit', 'submit', T_('Set new permissions'), 'ActionButton' ),
 125          array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 126  
 127  ?>

title

Description

title

Description

title

Description

title

title

Body