b2evolution PHP Cross Reference Blogging Systems

Source: /inc/files/views/_filetype.form.php - 116 lines - 5236 bytes - Text - Print

Description: This file implements the File type form. 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 File type form.
   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)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.
  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   * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license
  22   * PROGIDISTRI S.A.S.'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 admin
  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 mbruneau: Marc BRUNEAU / PROGIDISTRI
  31   *
  32   * @version $Id: _filetype.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   * @var FileType
  38   */
  39  global $edited_Filetype;
  40  
  41  global $force_upload_forbiddenext;
  42  global $rsc_path;
  43  
  44  // Determine if we are creating or updating...
  45  global $action;
  46  $creating = is_create_action( $action );
  47  
  48  
  49  $Form = new Form( NULL, 'ftyp_checkchanges', 'post', 'compact' );
  50  
  51  $Form->global_icon( T_('Delete this filetype!'), 'delete', regenerate_url( 'action', 'action=delete' ) );
  52  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url( 'action' ) );
  53  
  54  $Form->begin_form( 'fform', $creating ?  T_('New file type') : T_('File type') );
  55  
  56      $Form->add_crumb( 'filetype' );
  57      $Form->hidden_ctrl();
  58      $Form->hidden( 'action', $creating ? 'create' : 'update' );
  59  
  60      if( ! $creating ) $Form->hidden( 'ftyp_ID', $edited_Filetype->ID );
  61  
  62      $Form->text_input( 'ftyp_extensions', $edited_Filetype->extensions, 40, T_('Extensions'), '', array( 'maxlength'=>30, 'required'=>true, 'note'=>sprintf('E.g. &laquo;%s&raquo;'.', '.T_('separated by whitespace'), 'html') ) );
  63  
  64      $Form->text_input( 'ftyp_name', $edited_Filetype->name, 40, T_('File type name'), sprintf('E.g. &laquo;%s&raquo;', 'HTML file'), array( 'maxlength'=> 30, 'required'=>true ) );
  65  
  66      $Form->text_input( 'ftyp_mimetype', $edited_Filetype->mimetype, 40, T_('Mime type'), sprintf('E.g. &laquo;%s&raquo;', 'text/html'), array( 'maxlength'=> 50, 'required'=>true ) );
  67  
  68      $Form->select_input_array( 'ftyp_icon', $edited_Filetype->icon, get_available_filetype_icons(), T_('Icon') );
  69  
  70      $Form->radio( 'ftyp_viewtype',
  71                                  $edited_Filetype->viewtype,
  72                                   array(
  73                                                  array( 'browser', T_( 'Open with browser (popup)' ), T_( 'Let the browser handle the file in a popup.' ) ),
  74                                                  array( 'text', T_( 'Open with text viewer (popup)' ), T_( 'Use the online text viewer (recommended for .txt)' ) ),
  75                                                  array( 'image', T_( 'Open with image viewer (popup)' ), T_( 'Use the online image viewer (recommended for .gif .png .jpg)' ) ),
  76                                                  array( 'external', T_( 'Open with external app (no popup)' ), T_( 'Let the browser handle the file in a popup. Note: if you do not want Word to open inside of IE, you must uncheck "browse in same window" in Windows\' file types.' ) ),
  77                                                  array( 'download', T_( 'Download to disk (no popup)' ), T_( 'Tell the browser to save the file to disk instead of displaying it.' ) )
  78                                              ),
  79                                      T_( 'View type' ),
  80                                      true // separate lines
  81                               );
  82  
  83      // Check if the extension is in the array of the not allowed upload extensions from _advanced.php
  84      $not_allowed = false;
  85      $extensions = explode ( ' ', $edited_Filetype->extensions );
  86      foreach($extensions as $extension)
  87      {
  88          if( in_array( $extension, $force_upload_forbiddenext ) )
  89          {
  90              $not_allowed = true;
  91              continue;
  92          }
  93      }
  94  
  95      $Form->radio( 'ftyp_allowed',  $edited_Filetype->allowed,
  96                      array(
  97                              array( 'any', T_( 'Allow anyone (including anonymous users) to upload/rename files of this type' ) ),
  98                              array( 'registered', T_( 'Allow only registered users to upload/rename files of this type' ) ),
  99                              array( 'admin', T_( 'Allow only admins to upload/rename files of this type' ) )
 100                          ),
 101                      T_( 'Allow upload' ), true );
 102  
 103  if( $creating )
 104  {
 105      $Form->end_form( array( array( 'submit', 'submit', T_('Record'), 'SaveButton' ),
 106                                                      array( 'submit', 'submit', T_('Record, then Create New'), 'SaveButton' ),
 107                                                      array( 'submit', 'submit', T_('Record, then Create Similar'), 'SaveButton' ),
 108                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 109  }
 110  else
 111  {
 112      $Form->end_form( array( array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
 113                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 114  }
 115  
 116  ?>

title

Description

title

Description

title

Description

title

title

Body