phpwcms PHP Cross Reference Content Management Systems

Source: /fileinfo.php - 210 lines - 8400 bytes - Summary - Text - Print

Description: phpwcms content management system

   1  <?php
   2  /**
   3   * phpwcms content management system
   4   *
   5   * @author Oliver Georgi <oliver@phpwcms.de>
   6   * @copyright Copyright (c) 2002-2014, Oliver Georgi
   7   * @license http://opensource.org/licenses/GPL-2.0 GNU GPL-2
   8   * @link http://www.phpwcms.de
   9   *
  10   **/
  11  
  12  session_start();
  13  
  14  $phpwcms = array();
  15  require_once ('config/phpwcms/conf.inc.php');
  16  
  17  if(empty($_SESSION["wcs_user_lang"])) {
  18      session_destroy();
  19      headerRedirect($phpwcms['site'].$phpwcms["root"]);
  20  
  21  } else {
  22      require ('include/inc_lang/backend/en/lang.ext.inc.php');
  23      $cust_lang = 'include/inc_lang/backend/'.substr($_SESSION["wcs_user_lang"],0,2).'/lang.ext.inc.php';
  24      if(is_file($cust_lang)) include($cust_lang);
  25  }
  26  require_once  ('include/inc_lib/default.inc.php');
  27  require_once  (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php');
  28  
  29  require_once  ("include/inc_lib/general.inc.php");
  30  checkLogin();
  31  require_once  ("include/inc_lib/backend.functions.inc.php");
  32  require_once  ("include/inc_lib/imagick.convert.inc.php");
  33  require_once  ("include/inc_lib/autolink.inc.php");
  34  
  35  $file_id    = (isset($_GET["fid"])) ? intval($_GET["fid"]) : 0;
  36  $public        = (isset($_GET["public"])) ? true : false;
  37  
  38  if($file_id) {
  39  
  40      $file_key = get_list_of_file_keywords();
  41  
  42      if($public) {
  43          //public file
  44          $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_id=".$file_id." ";
  45          $sql .= "AND f_kid=1 AND f_trash=0 AND f_aktiv=1 AND (f_public=1";
  46          if(empty($_SESSION["wcs_user_admin"])) {
  47              $sql .= " OR f_uid=".intval($_SESSION["wcs_user_id"]);
  48          }
  49          $sql .= ") LIMIT 1";
  50      } else {
  51          //private file
  52          $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_id=".$file_id.' AND ';
  53          $sql .= "f_kid=1 AND f_trash IN (0, 1) ";
  54          if(empty($_SESSION["wcs_user_admin"])) {
  55              $sql .= "AND f_uid=".intval($_SESSION["wcs_user_id"]).' ';
  56          }
  57          $sql .= "LIMIT 1";
  58      }
  59      if($result = mysql_query($sql, $db) or die("error")) {
  60          if($row = mysql_fetch_assoc($result)) {
  61              $filename = html_specialchars($row["f_name"]);
  62  
  63              $thumb_image = get_cached_image(array(
  64                  "target_ext"    =>    $row["f_ext"],
  65                  "image_name"    =>    $row["f_hash"] . '.' . $row["f_ext"],
  66                  "thumb_name"    =>    md5($row["f_hash"].'538538'.$phpwcms["sharpen_level"].$phpwcms['colorspace']),
  67                  "max_width"        =>    538,
  68                  "max_height"    =>    538
  69              ));
  70  
  71  ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  72  <html xmlns="http://www.w3.org/1999/xhtml">
  73  <head>
  74      <title><?php echo $BL['FILEINFO_TITLE'] ?>: <?php echo $filename ?></title>
  75      <meta http-equiv="Content-Type" content="text/html; charset=<?php echo PHPWCMS_CHARSET ?>" />
  76      <meta http-equiv="Expires" content="0" />
  77      <meta http-equiv="Pragma" content="no-cache" />
  78      <meta http-equiv="cache-control" content="no-cache" />
  79      <meta name="robots" content="noindex, nofollow" />
  80      <script src="include/inc_js/phpwcms.js" type="text/javascript"></script>
  81  <?php
  82      echo '    <script type="text/javascript">
  83  	function ResizeAndCenter(){
  84          var width = 590;
  85      ';
  86      if($thumb_image != false) {
  87          echo '
  88          var height = screen.availHeight;
  89          if(height < 490) {
  90              height=420;
  91          } else {
  92              height=570;
  93          }
  94      ';
  95      } else {
  96          echo '    var height = 300;';
  97      }
  98  
  99      echo '
 100          window.moveTo(5,5);
 101          window.resizeTo(width,height);
 102      }
 103          </script>
 104      ';
 105  
 106  ?>
 107  
 108      <link href="include/inc_css/phpwcms.css" rel="stylesheet" type="text/css" />
 109  </head>
 110  
 111  <body onload="ResizeAndCenter();">
 112  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#C1D2E2" summary="">
 113    <tr bgcolor="#C1D2E2"><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="8" /></td></tr>
 114    <tr bgcolor="#C1D2E2">
 115      <td width="10"><img src="img/leer.gif" alt="" width="10" height="1" /></td>
 116      <td width="20"><img src='img/icons/small_<?php echo extimg($row["f_ext"]) ?>' alt="" border="0" /></td>
 117      <td width="518" class="h14b"><strong><?php echo $filename ?></strong></td>
 118      <td width="10"><img src="img/leer.gif" alt="" width="10" height="1" /></td>
 119    </tr>
 120    <tr bgcolor="#C1D2E2"><td colspan="4"><img src="img/leer.gif" alt="" width="10" height="6" /></td></tr>
 121    <tr bgcolor="#363E57"><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 122    <tr><td colspan="4" bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 123    <tr>
 124      <td bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="1" /></td>
 125      <td bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="1" /></td>
 126      <td bgcolor="#F5F8F9"><table width="518" border="0" cellpadding="0" cellspacing="0" summary="">
 127        <tr>
 128          <td width="422" class="v10"><?php echo $BL['CREATED'] ?>: <strong><?php echo date($BL['DATE_FORMAT'], intval($row["f_created"])) ?></strong>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $BL['SIZE'] ?>: <strong><?php echo fsizelong($row["f_size"]) ?></strong></td>
 129          <td width="96" align="right"><?php
 130          if(!$row["f_trash"]) {
 131          ?><a href="include/inc_act/act_download.php?dl=<?php
 132  
 133          echo $row["f_id"];
 134          //download public file too
 135          if($public) echo '&amp;pl=1';
 136  
 137          ?>" target="_blank" title="<?php echo $BL['DOWNLOAD_FILE'].": ".$filename ?>"><img src="img/button/download_disc_large.gif" alt="" width="61" height="13" border="0" /></a><?php
 138          } else {
 139           echo "<img src=\"img/button/file_in_trash.gif\" width=\"61\" height=\"13\" border=\"0\" title=\"".$BL['FILE_IN_TRASH']."\">";
 140          }
 141          ?><img src="img/leer.gif" alt="" width="9" height="1" /><img src="img/button/aktiv_12x13_<?php echo $row["f_aktiv"] ?>.gif" alt="" width="12" height="13" /><img src="img/button/public_12x13_<?php echo $row["f_public"] ?>.gif" alt="" width="12" height="13" /></td>
 142        </tr>
 143      </table></td>
 144      <td bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="1" /></td>
 145    </tr>
 146    <tr><td colspan="4" bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 147    <tr><td colspan="4" bgcolor="#CDDEE4"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 148    <tr><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 149    <tr>
 150      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 151      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 152      <td class="v10"><?php echo $BL['KEYWORDS'].": ".html_specialchars($row["f_shortinfo"].add_keywords_to_search ($file_key, $row["f_keywords"])) ?></td>
 153      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 154    </tr>
 155    <tr><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 156  <?php
 157  
 158      if($thumb_image != false) {
 159  ?>
 160    <tr><td colspan="4" bgcolor="#CDDEE4"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 161    <tr><td colspan="4" bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 162    <tr>
 163      <td bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="1" /></td>
 164      <td colspan="2" align="center" bgcolor="#F5F8F9"><?php
 165  
 166      echo '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].'>';
 167  
 168      ?></td>
 169      <td bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 170    </tr>
 171    <tr><td colspan="4" bgcolor="#F5F8F9"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 172  <?php
 173      }
 174      if($row["f_longinfo"]) {
 175  ?>
 176    <tr><td colspan="4" bgcolor="#CDDEE4"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 177    <tr><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 178    <tr>
 179      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 180      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 181      <td class="v10"><?php echo nl2br(auto_link(html_specialchars($row["f_longinfo"]))) ?></td>
 182      <td><img src="img/leer.gif" alt="" width="1" height="5" /></td>
 183    </tr>
 184    <tr><td colspan="4"><img src="img/leer.gif" alt="" width="1" height="5" /></td></tr>
 185    <?php } ?>
 186    <tr><td colspan="4" bgcolor="#CDDEE4"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 187    <tr bgcolor="#EBF2F4">
 188      <td><img src="img/leer.gif" alt="" width="10" height="10" /></td>
 189      <td><img src="img/leer.gif" alt="" width="20" height="1" /></td>
 190      <td><img src="img/leer.gif" alt="" width="518" height="1" /></td>
 191      <td><img src="img/leer.gif" alt="" width="10" height="10" /></td>
 192    </tr>
 193  </table>
 194  </body>
 195  </html>
 196  <?php
 197          } else {
 198              $fehler = 1;
 199          }
 200      } else {
 201          $fehler = 1;
 202      }
 203  } else {
 204      $fehler = 1;
 205  }
 206  
 207  if(isset($fehler)) {
 208      echo $BL['DOWNLOAD_ERR3'];
 209  }
 210  ?>

title

Description

title

Description

title

Description

title

title

Body