function getAttachmentUrl($apli, $post_id, $att_id, $att_path, $att_type, $att_size, $att_inline = 0, $compteur, $visible = 0, $Mmod) { global $icon_dir, $img_dir, $forum; global $mimetype_default, $mime_dspfmt, $mime_renderers; global $DOCUMENTROOT; load_mimetypes(); $att_name = substr(strstr(basename($att_path), '.'), 1); $att_name = substr(strstr(basename($att_name), '.'), 1); $att_path = $DOCUMENTROOT . $att_path; if (!is_file($att_path)) { return ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non trouvÈ") . ' : ' . $att_name . '</span>'; } if ($att_inline) { if (isset($mime_dspfmt[$att_type])) { $display_mode = $mime_dspfmt[$att_type]; } else { $display_mode = $mime_dspfmt[$mimetype_default]; } } else { $display_mode = ATT_DSP_LINK; } if ($Mmod) { global $userdata; $marqueurM = "&Mmod=" . substr($userdata[2], 8, 6); } else { $marqueurM = ""; } $att_url = "getfile.php?att_id={$att_id}&apli={$apli}" . $marqueurM . "&att_name=" . rawurlencode($att_name); if ($visible != 1) { $visible_wrn = ' <span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non visible") . '</span>'; } switch ($display_mode) { case ATT_DSP_IMG: // display as an embedded image $size = @getImageSize("{$att_path}"); // $img_size = verifsize( $size ); $img_size = 'style="max-width: 100%; height:auto;"'; $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_IMG]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_PLAINTEXT: // display as embedded text, PRE-formatted $att_contents = str_replace("\\", "\\\\", htmlSpecialChars(join('', file($att_path)), ENT_COMPAT | ENT_HTML401, cur_charset)); $att_contents = word_wrap($att_contents); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_PLAINTEXT]); eval("\$ret=\"{$text}\";"); break; case ATT_DSP_HTML: // display as embedded HTML text //au choix la source ou la page $att_contents = word_wrap(nl2br(scr_html(join("", file($att_path))))); //$att_contents = removeHack (join ("", file ($att_path))); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_HTML]); eval("\$ret=stripSlashes(\"{$text}\");"); break; case ATT_DSP_SWF: // Embedded Macromedia Shockwave Flash $size = @getImageSize("{$att_path}"); $img_size = verifsize($size); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_SWF]); eval("\$ret=stripSlashes(\"{$text}\");"); break; default: // display as link $Fichier = new FileManagement(); // essai class PHP7 // $Fichier = new File(""); // $att_size = $Fichier->Pretty_Size($att_size); $att_size = $Fichier->file_size_format($att_size, 1); $att_icon = att_icon($att_name); $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_LINK]); eval("\$ret=stripSlashes(\"{$text}\");"); break; } return $ret; }
<tr> <th> </th> <th data-sortable="true">' . upload_translate("Fichier") . '</th> <th data-sortable="true">' . upload_translate("Type") . '</th> <th data-sortable="true">' . upload_translate("Taille") . '</th> <th data-sortable="true">' . upload_translate("Affichage intégré") . '</th> ' . $vizut . ' </tr> </thead> <tbody>'; $Fichier = new FileManagement(); // essai class PHP7 for ($i = 0; $i < $att_count; $i++) { $id = $att[$i]['att_id']; $tsz += $att[$i]['att_size']; $sz = $Fichier->file_size_format($att[$i]['att_size'], 2); if (getAttDisplayMode($att[$i]['att_type'], 'A') == ATT_DSP_LINK) { // This mime-type can't be displayed inline echo '<input type="hidden" name="inline_att[' . $id . ']" value="0" />'; $inline_box = '--'; } else { $inline_box = getListBox("inline_att[{$id}]", $inline_list, $att[$i]["inline"]); } if ($Mmod) { $visu = "<td align=\"center\">" . getCheckBox("visible_att[]", $id, $att[$i]["visible"] == 1 ? $id : -1, "") . "</td>"; $visible_list .= $id . ','; } $att_table .= ' <tr> <td>' . getCheckBox("del_att[]", $id, 0, "") . '</td> <td>' . $att[$i]['att_name'] . '</td>