[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/js/tinymce/jscripts/tiny_mce/plugins/filemanager/InsertFile/ -> config.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - Insert File Dialog, File Manager -plugin for tinymce        *
   4      * http://www.eGroupWare.org                                                *
   5      * Authors Al Rashid <alrashid@klokan.sk>                                   *
   6      *     and Xiang Wei ZHUO <wei@zhuo.org>                                    *
   7      * Modified for eGW by Cornelius Weiss <egw@von-und-zu-weiss.de>            *
   8      * --------------------------------------------                             *
   9      * This program is free software; you can redistribute it and/or modify it  *
  10      * under the terms of the GNU General Public License as published by the    *
  11      * Free Software Foundation; version 2 of the License.                      *
  12      \**************************************************************************/
  13      
  14      /* $Id: config.inc.php 19850 2005-11-16 10:53:38Z nelius_weiss $ */
  15      
  16      /**
  17      *    USAGE: If you like to use this plugin, insinde the eGW framework, you have to do two things
  18      *    1.    Add 'plugins : "filemanager",theme_advanced_buttons3_add : "filemanager"' to the $plugins variable on tinymce call
  19      *    2.    supply an array in the session with like this example shows:
  20      *            $UploadImage = array(
  21      *                'app' => 'news_admin',
  22      *                'upload_dir' => $GLOBALS['egw_info']['user']['preferences']['news_admin']['uploaddir'],
  23      *                'admin_method' => $GLOBALS['egw']->link('/index.php', 'menuaction=app.file.method');; 
  24      *            $GLOBALS['egw']->session->appsession('UploadImage','phpgwapi',$UploadImage);
  25      *        
  26      **/
  27      
  28      $GLOBALS['egw_info']['flags'] = Array(
  29          'currentapp'    =>    'home',
  30          'noheader'    =>    True,
  31          'nonavbar'    =>    True,
  32          'noappheader'    =>    True,
  33          'noappfooter'    =>    True,
  34          'nofooter'    =>    True
  35      );
  36  
  37      if(!isset($GLOBALS['egw']) || !is_object($GLOBALS['egw']))
  38      {
  39          if(@include('../../../../../../../../header.inc.php'))
  40          {
  41              // I know this is very ugly
  42          }
  43          else
  44          {
  45              @include('../../../../../../../../../header.inc.php');
  46          }
  47      }
  48      
  49      $sessdata = $GLOBALS['egw']->session->appsession('UploadImage','phpgwapi');
  50      // upload_dir needs a ending slash
  51      $sessdata['upload_dir'] = substr($sessdata['upload_dir'],-1) == '/' ? $sessdata['upload_dir'] : $sessdata['upload_dir'] . '/';
  52      if(is_writeable($sessdata['upload_dir']))
  53      {
  54          $MY_DOCUMENT_ROOT = $BASE_DIR = $sessdata['upload_dir'];
  55          if (isset($sessdata['upload_url']) && !empty($sessdata['upload_url']))
  56          {
  57              // base url must not have a ending slash
  58              $MY_BASE_URL = substr($sessdata['upload_url'],-1) == '/' ? substr($sessdata['upload_url'],0,-1) : $sessdata['upload_url'];
  59          }
  60          else
  61          {
  62              $MY_BASE_URL = preg_replace('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','',$sessdata['upload_dir']);
  63              if (empty($MY_BASE_URL)) $MY_BASE_URL = '/';
  64          }
  65          $BASE_URL = $MY_URL_TO_OPEN_FILE = $MY_BASE_URL;
  66      }
  67      else
  68      {
  69          echo '<p><b>'.lang('Error').'</b></p>';
  70          echo '<p>'.lang('Upload directory does not exist, or is not writeable by webserver').'</p>';
  71          echo $GLOBALS['egw_info']['user']['apps']['admin'] ? 
  72              lang('%1Choose an other directory%2<br />or make %3 writeable by webserver','<a href="'.$sessdata['admin_method'].'">','</a>',$sessdata['upload_dir']) : 
  73              lang('Notify your Administrator to correct this Situation');
  74          die();
  75      }
  76      
  77  define('IMAGE_CLASS', 'GD');
  78  /* MY_ALLOW_CREATE   Boolean (false or true) whether creating folders is allowed or not. */
  79  $MY_ALLOW_CREATE     = true;
  80  /* $MY_ALLOW_DELETE  Boolean (false or true) whether deleting files and folders is allowed or not. */
  81  $MY_ALLOW_DELETE     = true;
  82  /* $MY_ALLOW_RENAME  Boolean (false or true) whether renaming files and folders is allowed or not. */
  83  $MY_ALLOW_RENAME     = true;
  84  /* $MY_ALLOW_MOVE    Boolean (false or true) whether moving files and folders is allowed or not. */
  85  $MY_ALLOW_MOVE       = true;
  86  /* $MY_ALLOW_UPLOAD  Boolean (false or true) whether uploading files is allowed or not. */
  87  $MY_ALLOW_UPLOAD     = true;
  88  /* MY_LIST_EXTENSIONS This array specifies which files are listed in dialog. Setting to null causes that all files are listed,case insensitive. */
  89  $MY_LIST_EXTENSIONS  = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
  90  /*
  91   MY_ALLOW_EXTENSIONS
  92   MY_DENY_EXTENSIONS
  93   MY_ALLOW_EXTENSIONS and MY_DENY_EXTENSIONS arrays specify which file types can be uploaded.
  94   Setting to null skips this check. The scheme is:
  95   1) If MY_DENY_EXTENSIONS is not null check if it does _not_ contain file extension of the file to be uploaded.
  96      If it does skip the upload procedure.
  97   2) If MY_ALLOW_EXTENSIONS is not null check if it _does_ contain file extension of the file to be uploaded.
  98      If it doesn't skip the upload procedure.
  99   3) Upload file.
 100   NOTE: File extensions arrays are case insensitive.
 101          You should always include server side executable file types in MY_DENY_EXTENSIONS !!!
 102  */
 103  $MY_ALLOW_EXTENSIONS = array('html', 'doc', 'xls', 'txt', 'gif', 'jpeg', 'jpg', 'png', 'pdf', 'zip', 'pdf');
 104  $MY_DENY_EXTENSIONS  = array('php', 'php3', 'php4', 'phtml', 'shtml', 'cgi', 'pl');
 105  /*
 106   $MY_ALLOW_UPLOAD
 107   Maximum allowed size for uploaded files (in bytes).
 108   NOTE2: see also upload_max_filesize setting in your php.ini file
 109   NOTE: 2*1024*1024 means 2 MB (megabytes) which is the default php.ini setting
 110  */
 111  $MY_MAX_FILE_SIZE                 = 2*1024*1024;
 112  
 113  /*
 114   $MY_LANG
 115   Interface language. See the lang directory for translation files.
 116   NOTE: You should set appropriately MY_CHARSET and $MY_DATETIME_FORMAT variables
 117  */
 118  $MY_LANG                = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];//'en';
 119  
 120  /*
 121   $MY_CHARSET
 122   Character encoding for all Insert File dialogs.
 123   WARNING: For non english and non iso-8859-1 / utf8 users mostly !!!
 124   This setting affect also how the name of folder you create via Insert File Dialog
 125   and the name of file uploaded via Insert File Dialog will be encoded on your remote
 126   server filesystem. Note also the difference between how file names in multipart/data
 127   form are encoded by Internet Explorer (plain text depending on the webpage charset)
 128   and Mozilla (encoded according to RFC 1738).
 129   This should be fixed in next versions. Any help is VERY appreciated.
 130  */
 131  $MY_CHARSET             = $GLOBALS['egw']->translation->charset();//'iso-8859-1';
 132  
 133  /*
 134   MY_DATETIME_FORMAT
 135   Datetime format for displaying file modification time in Insert File Dialog and in inserted link, see MY_LINK_FORMAT
 136  */
 137  $MY_DATETIME_FORMAT     = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.
 138      ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'); //"d.m.Y H:i";
 139  
 140  /*
 141   MY_LINK_FORMAT
 142   The string to be inserted into textarea.
 143   This is the most crucial setting. I apologize for not using the DOM functions any more,
 144   but inserting raw string allow more customization for everyone.
 145   The following strings are replaced by corresponding values of selected files/folders:
 146   _editor_url  the url of htmlarea root folder - you should set it in your document (see htmlarea help)
 147   IF_ICON      file type icon filename (see plugins/InsertFile/images/ext directory)
 148   IF_URL       relative path to file relative to $MY_DOCUMENT_ROOT
 149   IF_CAPTION   file/folder name
 150   IF_SIZE      file size in (B, kB, or MB)
 151   IF_DATE      last modification time acording to $MY_DATETIME_FORMAT format
 152  */
 153  // $MY_LINK_FORMAT         = '<span class="filelink"><img src="editor_url/plugins/filemanager/InsertFile/IF_ICON" alt="IF_URL" border="0">&nbsp;<a href="IF_URL">IF_CAPTION</a> &nbsp;<span style="font-size:70%">IF_SIZE &nbsp;IF_DATE</span></span>&nbsp;';
 154  
 155  /* parse_icon function  please insert additional file types (extensions) and theis corresponding icons in switch statement */
 156  function parse_icon($ext) {
 157          switch (strtolower($ext)) {
 158                  case 'doc': return 'doc_small.gif';
 159                  case 'rtf': return 'doc_small.gif';
 160                  case 'txt': return 'txt_small.gif';
 161                  case 'xls': return 'xls_small.gif';
 162                  case 'csv': return 'xls_small.gif';
 163                  case 'ppt': return 'ppt_small.gif';
 164                  case 'html': return 'html_small.gif';
 165                  case 'htm': return 'html_small.gif';
 166                  case 'php': return 'script_small.gif';
 167                  case 'php3': return 'script_small.gif';
 168                  case 'cgi': return 'script_small.gif';
 169                  case 'pdf': return 'pdf_small.gif';
 170                  case 'rar': return 'rar_small.gif';
 171                  case 'zip': return 'zip_small.gif';
 172                  case 'gz': return 'gz_small.gif';
 173                  case 'jpg': return 'jpg_small.gif';
 174                  case 'gif': return 'gif_small.gif';
 175                  case 'png': return 'png_small.gif';
 176                  case 'bmp': return 'image_small.gif';
 177                  case 'exe': return 'binary_small.gif';
 178                  case 'bin': return 'binary_small.gif';
 179                  case 'avi': return 'mov_small.gif';
 180                  case 'mpg': return 'mov_small.gif';
 181                  case 'moc': return 'mov_small.gif';
 182                  case 'asf': return 'mov_small.gif';
 183                  case 'mp3': return 'sound_small.gif';
 184                  case 'wav': return 'sound_small.gif';
 185                  case 'org': return 'sound_small.gif';
 186          default:
 187                  return 'def_small.gif';
 188          }
 189  }
 190  
 191  // DO NOT EDIT BELOW
 192  $MY_NAME = 'insertfiledialog';
 193  //$lang_file = 'lang/lang-'.$MY_LANG.'.php';
 194  // using the eGW translation system
 195  $lang_file = 'lang/lang.php';
 196  if (is_file($lang_file)) require($lang_file);
 197  else require ('lang/lang-en.php');
 198  $MY_PATH = '/';
 199  $MY_UP_PATH = '/';
 200  
 201  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7