PageRenderTime 23ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/fileinfo.php

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