[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/ -> image.php (source)

   1  <?php
   2  // $Id: image.php 2 2005-11-02 18:23:29Z skalpa $

   3  //  ------------------------------------------------------------------------ //

   4  //                XOOPS - PHP Content Management System                      //

   5  //                    Copyright (c) 2000 XOOPS.org                           //

   6  //                       <http://www.xoops.org/>                             //

   7  //  ------------------------------------------------------------------------ //

   8  //  This program is free software; you can redistribute it and/or modify     //

   9  //  it under the terms of the GNU General Public License as published by     //

  10  //  the Free Software Foundation; either version 2 of the License, or        //

  11  //  (at your option) any later version.                                      //

  12  //                                                                           //

  13  //  You may not change or alter any portion of this comment or credits       //

  14  //  of supporting developers from this source code or any supporting         //

  15  //  source code which is considered copyrighted (c) material of the          //

  16  //  original comment or credit authors.                                      //

  17  //                                                                           //

  18  //  This program is distributed in the hope that it will be useful,          //

  19  //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //

  20  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //

  21  //  GNU General Public License for more details.                             //

  22  //                                                                           //

  23  //  You should have received a copy of the GNU General Public License        //

  24  //  along with this program; if not, write to the Free Software              //

  25  //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //

  26  //  ------------------------------------------------------------------------ //

  27  
  28  set_magic_quotes_runtime(0);
  29  if (function_exists('mb_http_output')) {
  30      mb_http_output('pass');
  31  }
  32  $image_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
  33  if (empty($image_id)) {
  34      header('Content-type: image/gif');
  35      readfile(XOOPS_UPLOAD_PATH.'/blank.gif');
  36      exit();
  37  }
  38  $xoopsOption['nocommon'] = 1;
  39  include  './mainfile.php';
  40  include  XOOPS_ROOT_PATH.'/include/functions.php';
  41  include_once  XOOPS_ROOT_PATH.'/class/logger.php';
  42  include_once  XOOPS_ROOT_PATH."/class/module.textsanitizer.php";
  43  $xoopsLogger =& XoopsLogger::instance();
  44  $xoopsLogger->startTime();
  45  include_once  XOOPS_ROOT_PATH.'/class/database/databasefactory.php';
  46  define('XOOPS_DB_PROXY', 1);
  47  $xoopsDB =& XoopsDatabaseFactory::getDatabaseConnection();
  48  // ################# Include class manager file ##############

  49  require_once  XOOPS_ROOT_PATH.'/kernel/object.php';
  50  require_once  XOOPS_ROOT_PATH.'/class/criteria.php';
  51  $imagehandler =& xoops_gethandler('image');
  52  $criteria = new CriteriaCompo(new Criteria('i.image_display', 1));
  53  $criteria->add(new Criteria('i.image_id', $image_id));
  54  $image =& $imagehandler->getObjects($criteria, false, true);
  55  if (count($image) > 0) {
  56      header('Content-type: '.$image[0]->getVar('image_mimetype'));
  57      header('Cache-control: max-age=31536000');
  58      header('Expires: '.gmdate("D, d M Y H:i:s",time()+31536000).'GMT');
  59      header('Content-disposition: filename='.$image[0]->getVar('image_name'));
  60      header('Content-Length: '.strlen($image[0]->getVar('image_body')));
  61      header('Last-Modified: '.gmdate("D, d M Y H:i:s",$image[0]->getVar('image_created')).'GMT');
  62      echo $image[0]->getVar('image_body');
  63  } else {
  64      header('Content-type: image/gif');
  65      readfile(XOOPS_UPLOAD_PATH.'/blank.gif');
  66  }
  67  ?>


Généré le : Sun Nov 25 11:44:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics