3 # this plugin appends the list of uploaded attachments at the bottom of
4 # each page, the downloads / attachments plugin must be loaded too
6 # you could alternatively define EWIKI_AUTOVIEW to 0, and call the
7 # ewiki_attachments() wrapper function anywhere on yoursite.php
10 if (!defined("EWIKI_AUTOVIEW") || !EWIKI_AUTOVIEW) {
11 $ewiki_plugins["view_append"][] = "ewiki_view_append_attachments";
15 $ewiki_t["en"]["ATTACHMENTS"] = "attachments";
16 $ewiki_t["de"]["ATTACHMENTS"] = "Anhänge";
20 function ewiki_view_append_attachments($id, $data, $action) {
22 $o = '<hr><h4><a href="' . ewiki_script(EWIKI_ACTION_ATTACHMENTS, $id) .
23 '">' . ewiki_t("ATTACHMENTS") . '</a></h4>';
25 $scan = 's:7:"section";' . serialize($id);
26 $result = ewiki_db::SEARCH("meta", $scan);
29 while ($row = $result->get()) {
30 $ord[$row["id"]] = $row["created"];
34 foreach ($ord as $id => $uu) {
35 $row = ewiki_db::GET($id);
36 if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
39 $o .= ewiki_entry_downloads($row, "*");
48 function ewiki_attachments() {
49 global $ewiki_title, $ewiki_id;
50 return(ewiki_view_append_attachments($ewiki_title, array("id"=>$ewiki_id), "view"));