[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/phpgwapi/js/htmlarea/plugins/UploadImage/popups/ImageManager/ -> config.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare - UploadImage-plugin for htmlArea                             *
   4      * http://www.eGroupWare.org                                                *
   5      * Written and (c) by Xiang Wei ZHUO <wei@zhuo.org>                         *
   6      * Modified for eGW by and (c) by Pim Snel <pim@lingewoud.nl>               *
   7      * --------------------------------------------                             *
   8      * This program is free software; you can redistribute it and/or modify it  *
   9      * under the terms of the GNU General Public License as published by the    *
  10      * Free Software Foundation; version 2 of the License.                      *
  11      \**************************************************************************/
  12      
  13      /* $Id: config.inc.php 20295 2006-02-15 12:31:25Z  $ */
  14      
  15      // FIXME: remove imageMagick shit, we only use gdlib
  16      // FIXME: autodetect safe_mode
  17      // FIXME include header nicer
  18      
  19      /*
  20          USAGE: If you like to use this plugin, insinde the eGW framework, you have to do two things
  21          1.    Add 'UploadImage' to the $plugins variable on htmlarea call
  22          2.    supply an array in the session with like this example shows:
  23                  $UploadImage = array(
  24                      'app' => 'news_admin',
  25                      'upload_dir' => $GLOBALS['phpgw_info']['user']['preferences']['news_admin']['uploaddir'],
  26                      'admin_method' => $GLOBALS['phpgw']->link('/index.php', 'menuaction=app.file.method');; 
  27                  $GLOBALS['phpgw']->session->appsession('UploadImage','phpgwapi',$UploadImage);
  28              
  29      */
  30      
  31      $phpgw_flags = Array(
  32          'currentapp'    =>    'home',
  33          'noheader'    =>    True,
  34          'nonavbar'    =>    True,
  35          'noappheader'    =>    True,
  36          'noappfooter'    =>    True,
  37          'nofooter'    =>    True
  38      );
  39      
  40      $GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
  41      
  42      if(@include('../../../../../../header.inc.php'))
  43      {
  44          // I know this is very ugly
  45      }
  46      else
  47      {
  48          @include('../../../../../../../header.inc.php');
  49      }
  50      
  51      $sessdata = $GLOBALS['phpgw']->session->appsession('UploadImage','phpgwapi');
  52      $phpgw_flags['currentapp'] = $sessdata['app'] ? $sessdata['app'] : 'jinn';
  53      
  54      define('IMAGE_CLASS', 'GD');  
  55      
  56      //In safe mode, directory creation is not permitted.
  57      $SAFE_MODE = false;
  58      
  59      switch ($phpgw_flags['currentapp'])
  60      {
  61          case 'jinn' :
  62              $BASE_DIR = $sessdata[UploadImageBaseDir];
  63              $BASE_URL = $sessdata[UploadImageBaseURL];
  64              $MAX_HEIGHT = $sessdata[UploadImageMaxHeight];
  65              $MAX_WIDTH = $sessdata[UploadImageMaxWidth];
  66              //   _debug_array($sessdata);
  67              //die();
  68              break;
  69          default : 
  70              if(is_writeable($sessdata['upload_dir']))
  71              {
  72                  $BASE_DIR = $sessdata['upload_dir'];
  73                  $BASE_URL = str_replace($GLOBALS['_SERVER']['DOCUMENT_ROOT'],'',$sessdata['upload_dir']);
  74                  break;
  75              }
  76              else
  77              {
  78                  echo '<p><b>Error</b></p>';
  79                  echo '<p>Upload directory does not exist, or is not writeable by webserver</p>';
  80                  echo $GLOBALS['egw_info']['user']['apps']['admin'] ? 
  81                      '<a href="'. $sessdata['admin_method']. '">Choose an other directory</a><br>
  82                      or make "'. $sessdata['upload_dir']. '" writeable by webserver' : 
  83                      'Notify your Administrator to correct this Situation';
  84                  die();
  85              }
  86      }
  87      
  88      if(!$MAX_HEIGHT) $MAX_HEIGHT = 10000;
  89      if(!$MAX_WIDTH) $MAX_WIDTH = 10000;
  90      
  91      
  92      //After defining which library to use, if it is NetPBM or IM, you need to
  93      //specify where the binary for the selected library are. And of course
  94      //your server and PHP must be able to execute them (i.e. safe mode is OFF).
  95      //If you have safe mode ON, or don't have the binaries, your choice is
  96      //GD only. GD does not require the following definition.
  97      //define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/netpbm/');
  98      //define('IMAGE_TRANSFORM_LIB_PATH', '"D:\\Program Files\\ImageMagick\\');
  99      
 100      $BASE_ROOT = '';
 101      $IMG_ROOT = $BASE_ROOT;
 102      
 103      // this seems to make no sense... maybe jinn needs it for some reason
 104      if ($phpgw_flags['app'] == 'jinn')
 105      {
 106          if(strrpos($BASE_DIR, '/')!= strlen($BASE_DIR)-1) 
 107          $BASE_DIR .= '/';
 108          
 109          if(strrpos($BASE_URL, '/')!= strlen($BASE_URL)-1) 
 110          $BASE_URL .= '/';
 111      }
 112  
 113      //Built in function of dirname is faulty
 114      //It assumes that the directory nane can not contain a . (period)
 115  	function dir_name($dir) 
 116      {
 117          $lastSlash = intval(strrpos($dir, '/'));
 118          if($lastSlash == strlen($dir)-1){
 119              return substr($dir, 0, $lastSlash);
 120          }
 121          else
 122          return dirname($dir);
 123      }
 124  
 125  ?>


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