[ Index ] |
|
Code source de Phorum 5.1.25 |
1 <?php 2 3 //////////////////////////////////////////////////////////////////////////////// 4 // // 5 // Copyright (C) 2006 Phorum Development Team // 6 // http://www.phorum.org // 7 // // 8 // This program is free software. You can redistribute it and/or modify // 9 // it under the terms of either the current Phorum License (viewable at // 10 // phorum.org) or the Phorum License that was distributed with this file // 11 // // 12 // This program is distributed in the hope that it will be useful, // 13 // but WITHOUT ANY WARRANTY, without even the implied warranty of // 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // 15 // // 16 // You should have received a copy of the Phorum License // 17 // along with this program. // 18 //////////////////////////////////////////////////////////////////////////////// 19 20 if(!defined("PHORUM")) return; 21 22 $previewmessage = $message; 23 24 // Add the message author's signature to the message body. 25 if (isset($message["user_id"]) && !empty($message["user_id"])) { 26 $user = phorum_user_get($message["user_id"]); 27 $user_info = phorum_hook("read_user_info", array($user["user_id"] => $user)); 28 $user = array_shift($user_info); 29 if ($user && $message["show_signature"]) { 30 $previewmessage["body"] .= "\n\n" . $user["signature"]; 31 } 32 } 33 34 // Add the list of attachments. 35 if ($attach_count) 36 { 37 define('PREVIEW_NO_ATTACHMENT_CLICK', 38 "javascript:alert('" . $PHORUM["DATA"]["LANG"]["PreviewNoClickAttach"] . "')"); 39 40 // Create the URL and formatted size for attachment files. 41 foreach ($previewmessage["attachments"] as $nr => $data) { 42 $previewmessage["attachments"][$nr]["url"] = 43 phorum_get_url(PHORUM_FILE_URL, "file={$data['file_id']}"); 44 $previewmessage["attachments"][$nr]["size"] = 45 phorum_filesize($data["size"]); 46 } 47 } 48 49 // Format the message using the default formatting. 50 include_once ("./include/format_functions.php"); 51 $previewmessages = phorum_format_messages(array($previewmessage)); 52 $previewmessage = array_shift($previewmessages); 53 54 // Recount the number of attachments. Formatting mods might have changed 55 // the number of attachments we have to display using default formatting. 56 $attach_count = 0; 57 if (isset($previewmessage["attachments"])) { 58 foreach ($previewmessage["attachments"] as $attachment) { 59 if ($attachment["keep"]) { 60 $attach_count ++; 61 } 62 } 63 } 64 65 if ($attach_count) 66 { 67 // Disable clicking on attachments in the preview (to prevent the 68 // browser from jumping to a viewing page, which might break the 69 // editing flow). This is not done in the previous loop where the 70 // URL is set, so the formatting code for things like inline 71 // attachments can be used. 72 foreach ($previewmessage["attachments"] as $nr => $data) { 73 $previewmessage["attachments"][$nr]["url"] = PREVIEW_NO_ATTACHMENT_CLICK; 74 } 75 } else { 76 unset($previewmessage["attachments"]); 77 } 78 79 // Fill the author for new postings with the username 80 // for authenticated users, if editing the author 81 // field is not allowed. 82 if (($mode == "post" || $mode == "reply") && 83 !$PHORUM["DATA"]["OPTION_ALLOWED"]["edit_author"] && 84 $PHORUM["DATA"]["LOGGEDIN"]) { 85 $previewmessage["author"] = 86 $message["author"] = 87 $PHORUM["user"]["username"]; 88 } 89 90 // Fill the datestamp for new postings. 91 if ($mode != "edit") { 92 $previewmessage["datestamp"] = time(); 93 } 94 95 // Format datestamp. 96 $previewmessage["datestamp"] = phorum_date($PHORUM["short_date"], $previewmessage["datestamp"]); 97 $previewmessage["author"] = htmlspecialchars($previewmessage["author"]); 98 99 $PHORUM["DATA"]["PREVIEW"] = $previewmessage; 100 101 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |