/**
  * Formats and prints one file in the list in the thumbnails view
  *
  * @see media_printfile_thumbs()
  */
 function _mod_media_printfile_thumbs($item, $auth, $jump = false, $display_namespace = false)
 {
     global $lang;
     global $conf;
     // Prepare filename
     $file = $this->_getOriginalFileName($item['id']);
     if ($file === false) {
         $file = utf8_decodeFN($item['file']);
     }
     // build fake media id
     $ns = getNS($item['id']);
     $fakeId = $ns === false ? $file : "{$ns}:{$file}";
     $fakeId_escaped = hsc($fakeId);
     // output
     echo '<li><dl title="' . $fakeId_escaped . '">' . NL;
     echo '<dt>';
     if ($item['isimg']) {
         media_printimgdetail($item, true);
     } else {
         echo '<a name="d_:' . $item['id'] . '" class="image" title="' . $fakeId_escaped . '" href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '">';
         echo media_printicon($fakeId_escaped);
         echo '</a>';
     }
     echo '</dt>' . NL;
     if (!$display_namespace) {
         $name = hsc($file);
     } else {
         $name = $fakeId_escaped;
     }
     echo '<dd class="name"><a href="' . media_managerURL(array('image' => $fakeId, 'ns' => $ns, 'tab_details' => 'view')) . '" name="h_:' . $item['id'] . '">' . $name . '</a></dd>' . NL;
     if ($item['isimg']) {
         $size = '';
         $size .= (int) $item['meta']->getField('File.Width');
         $size .= '&#215;';
         $size .= (int) $item['meta']->getField('File.Height');
         echo '<dd class="size">' . $size . '</dd>' . NL;
     } else {
         echo '<dd class="size">&#160;</dd>' . NL;
     }
     $date = dformat($item['mtime']);
     echo '<dd class="date">' . $date . '</dd>' . NL;
     $filesize = filesize_h($item['size']);
     echo '<dd class="filesize">' . $filesize . '</dd>' . NL;
     echo '</dl></li>' . NL;
 }
Exemple #2
0
/**
 * display recent changes
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Matthias Grimm <*****@*****.**>
 * @author Ben Coburn <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function html_recent($first = 0, $show_changes = 'both')
{
    global $conf;
    global $lang;
    global $ID;
    /* we need to get one additionally log entry to be able to
     * decide if this is the last page or is there another one.
     * This is the cheapest solution to get this information.
     */
    $flags = 0;
    if ($show_changes == 'mediafiles' && $conf['mediarevisions']) {
        $flags = RECENTS_MEDIA_CHANGES;
    } elseif ($show_changes == 'pages') {
        $flags = 0;
    } elseif ($conf['mediarevisions']) {
        $show_changes = 'both';
        $flags = RECENTS_MEDIA_PAGES_MIXED;
    }
    $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags);
    if (count($recents) == 0 && $first != 0) {
        $first = 0;
        $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags);
    }
    $hasNext = false;
    if (count($recents) > $conf['recent']) {
        $hasNext = true;
        array_pop($recents);
        // remove extra log entry
    }
    print p_locale_xhtml('recent');
    if (getNS($ID) != '') {
        print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>';
    }
    $form = new Doku_Form(array('id' => 'dw__recent', 'method' => 'GET'));
    $form->addHidden('sectok', null);
    $form->addHidden('do', 'recent');
    $form->addHidden('id', $ID);
    if ($conf['mediarevisions']) {
        $form->addElement(form_makeListboxField('show_changes', array('pages' => $lang['pages_changes'], 'mediafiles' => $lang['media_changes'], 'both' => $lang['both_changes']), $show_changes, $lang['changes_type'], '', '', array('class' => 'quickselect')));
        $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply']));
    }
    $form->addElement(form_makeOpenTag('ul'));
    foreach ($recents as $recent) {
        $date = dformat($recent['date']);
        if ($recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) {
            $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
        } else {
            $form->addElement(form_makeOpenTag('li'));
        }
        $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
        if ($recent['media']) {
            $form->addElement(media_printicon($recent['id']));
        } else {
            $icon = DOKU_BASE . 'lib/images/fileicons/file.png';
            $form->addElement('<img src="' . $icon . '" alt="' . $filename . '" class="icon" />');
        }
        $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
        $form->addElement($date);
        $form->addElement(form_makeCloseTag('span'));
        if ($recent['media']) {
            $diff = count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']));
            if ($diff) {
                $href = media_managerURL(array('tab_details' => 'history', 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
            }
        } else {
            $href = wl($recent['id'], "do=diff", false, '&');
        }
        if ($recent['media'] && !$diff) {
            $form->addElement('<img src="' . DOKU_BASE . 'lib/images/blank.gif" width="15" height="11" alt="" />');
        } else {
            $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href)));
            $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/diff.png', 'width' => 15, 'height' => 11, 'title' => $lang['diff'], 'alt' => $lang['diff'])));
            $form->addElement(form_makeCloseTag('a'));
        }
        if ($recent['media']) {
            $href = media_managerURL(array('tab_details' => 'history', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
        } else {
            $href = wl($recent['id'], "do=revisions", false, '&');
        }
        $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => $href)));
        $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/history.png', 'width' => 12, 'height' => 14, 'title' => $lang['btn_revs'], 'alt' => $lang['btn_revs'])));
        $form->addElement(form_makeCloseTag('a'));
        if ($recent['media']) {
            $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
            $class = file_exists(mediaFN($recent['id'])) ? 'wikilink1' : ($class = 'wikilink2');
            $form->addElement(form_makeOpenTag('a', array('class' => $class, 'href' => $href)));
            $form->addElement($recent['id']);
            $form->addElement(form_makeCloseTag('a'));
        } else {
            $form->addElement(html_wikilink(':' . $recent['id'], useHeading('navigation') ? null : $recent['id']));
        }
        $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
        $form->addElement(' &ndash; ' . htmlspecialchars($recent['sum']));
        $form->addElement(form_makeCloseTag('span'));
        $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
        if ($recent['user']) {
            $form->addElement(editorinfo($recent['user']));
            if (auth_ismanager()) {
                $form->addElement(' (' . $recent['ip'] . ')');
            }
        } else {
            $form->addElement($recent['ip']);
        }
        $form->addElement(form_makeCloseTag('span'));
        $form->addElement(form_makeCloseTag('div'));
        $form->addElement(form_makeCloseTag('li'));
    }
    $form->addElement(form_makeCloseTag('ul'));
    $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav')));
    $last = $first + $conf['recent'];
    if ($first > 0) {
        $first -= $conf['recent'];
        if ($first < 0) {
            $first = 0;
        }
        $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev')));
        $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $first . ']', 'value' => $lang['btn_newer'], 'accesskey' => 'n', 'title' => $lang['btn_newer'] . ' [N]', 'class' => 'button show')));
        $form->addElement(form_makeCloseTag('div'));
    }
    if ($hasNext) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next')));
        $form->addElement(form_makeTag('input', array('type' => 'submit', 'name' => 'first[' . $last . ']', 'value' => $lang['btn_older'], 'accesskey' => 'p', 'title' => $lang['btn_older'] . ' [P]', 'class' => 'button show')));
        $form->addElement(form_makeCloseTag('div'));
    }
    $form->addElement(form_makeCloseTag('div'));
    html_form('recent', $form);
}
    }
    ?>
                    </dl>
                    <?php 
    //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw'));
    ?>
                </div>
                <div class="clearer"></div>
            </div><!-- /.content -->

            <p class="back">
                <?php 
    $imgNS = getNS($IMG);
    $authNS = auth_quickaclcheck("{$imgNS}:*");
    if ($authNS >= AUTH_UPLOAD && function_exists('media_managerURL')) {
        $mmURL = media_managerURL(array('ns' => $imgNS, 'image' => $IMG));
        echo '<a href="' . $mmURL . '">' . $lang['img_manager'] . '</a><br />';
    }
    ?>
                &larr; <?php 
    echo $lang['img_backto'];
    ?>
 <?php 
    tpl_pagelink($ID);
    ?>
            </p>

        <?php 
}
?>
    </div>
    print nl2br(hsc(tpl_img_getTag('simple.title')));
    ?>
      </p>

      <p>&larr; <?php 
    echo $lang['img_backto'];
    ?>
 <?php 
    tpl_pagelink($ID);
    ?>
</p>
      <?php 
    $imgNS = getNS($IMG);
    $authNS = auth_quickaclcheck("{$imgNS}:*");
    if ($authNS >= AUTH_UPLOAD) {
        echo '<p><a href="' . media_managerURL(array('ns' => $imgNS, 'image' => $IMG)) . '">' . $lang['img_manager'] . '</a></p>';
    }
    ?>

      <dl class="img_tags">
        <?php 
    $config_files = getConfigFiles('mediameta');
    foreach ($config_files as $config_file) {
        if (@file_exists($config_file)) {
            include $config_file;
        }
    }
    foreach ($fields as $key => $tag) {
        $t = array();
        if (!empty($tag[0])) {
            $t = array($tag[0]);
Exemple #5
0
function ajax_mediaupload()
{
    global $NS, $MSG, $INPUT;
    if ($_FILES['qqfile']['tmp_name']) {
        $id = $INPUT->post->str('mediaid', $_FILES['qqfile']['name']);
    } elseif ($INPUT->get->has('qqfile')) {
        $id = $INPUT->get->str('qqfile');
    }
    $id = cleanID($id);
    $NS = $INPUT->str('ns');
    $ns = $NS . ':' . getNS($id);
    $AUTH = auth_quickaclcheck("{$ns}:*");
    if ($AUTH >= AUTH_UPLOAD) {
        io_createNamespace("{$ns}:xxx", 'media');
    }
    if ($_FILES['qqfile']['error']) {
        unset($_FILES['qqfile']);
    }
    if ($_FILES['qqfile']['tmp_name']) {
        $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
    }
    if ($INPUT->get->has('qqfile')) {
        $res = media_upload_xhr($NS, $AUTH);
    }
    if ($res) {
        $result = array('success' => true, 'link' => media_managerURL(array('ns' => $ns, 'image' => $NS . ':' . $id), '&'), 'id' => $NS . ':' . $id, 'ns' => $NS);
    }
    if (!$result) {
        $error = '';
        if (isset($MSG)) {
            foreach ($MSG as $msg) {
                $error .= $msg['msg'];
            }
        }
        $result = array('error' => $msg['msg'], 'ns' => $NS);
    }
    $json = new JSON();
    echo htmlspecialchars($json->encode($result), ENT_NOQUOTES);
}
Exemple #6
0
 function internalmedia($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $linking = NULL)
 {
     global $ID;
     list($src, $hash) = explode('#', $src, 2);
     resolve_mediaid(getNS($ID), $src, $exists);
     $noLink = false;
     $render = $linking == 'linkonly' ? false : true;
     $link = $this->_getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render);
     list($ext, $mime, $dl) = mimetype($src, false);
     if (substr($mime, 0, 5) == 'image' && $render) {
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), $linking == 'direct');
     } elseif ($mime == 'application/x-shockwave-flash' && $render) {
         // don't link flash movies
         $noLink = true;
     } else {
         // add file icons
         $class = preg_replace('/[^_\\-a-z0-9]+/i', '_', $ext);
         $link['class'] .= ' mediafile mf_' . $class;
         $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), true);
     }
     if ($hash) {
         $link['url'] .= '#' . $hash;
     }
     //markup non existing files
     if (!$exists) {
         $link['class'] .= ' wikilink2';
         $link['url'] = media_managerURL(array('tab_details' => 'view', 'image' => $src, 'ns' => getNS($src)), '&');
     }
     //output formatted
     if ($linking == 'nolink' || $noLink) {
         $this->doc .= $link['name'];
     } else {
         $this->doc .= $this->_formatLink($link);
     }
 }
Exemple #7
0
/**
 * Userfunction for html_buildlist
 *
 * Prints a media namespace tree item
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function bootstrap_media_nstree_item($item)
{
    global $INPUT;
    $pos = strrpos($item['id'], ':');
    $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0);
    if (!$item['label']) {
        $item['label'] = $label;
    }
    $class = 'level' . $item['level'];
    // TODO: only deliver an image if it actually has a subtree...
    if ($item['open']) {
        $class .= ' open';
        $icon = '<i class="glyphicon glyphicon-minus"></i> ';
        $alt = '−';
    } else {
        $class .= ' closed';
        $icon = '<i class="glyphicon glyphicon-plus"></i> ';
        $alt = '+';
    }
    $ret = '<li class="' . $class . '">';
    if (!($INPUT->str('do') == 'media')) {
        $ret .= '<a href="' . DOKU_BASE . 'lib/exe/mediamanager.php?ns=' . idfilter($item['id']) . '" class="idx_dir">';
    } else {
        $ret .= '<a href="' . media_managerURL(array('ns' => idfilter($item['id'], false), 'tab_files' => 'files')) . '>';
    }
    $ret .= $icon;
    $ret .= $item['label'];
    $ret .= '</a>';
    return $ret;
}
Exemple #8
0
/**
 * Userfunction for html_buildlist
 *
 * Prints a media namespace tree item
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function media_nstree_item($item)
{
    global $INPUT;
    $pos = strrpos($item['id'], ':');
    $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0);
    if (empty($item['label'])) {
        $item['label'] = $label;
    }
    $ret = '';
    if (!($INPUT->str('do') == 'media')) {
        $ret .= '<a href="' . DOKU_BASE . 'lib/exe/mediamanager.php?ns=' . idfilter($item['id']) . '" class="idx_dir">';
    } else {
        $ret .= '<a href="' . media_managerURL(array('ns' => idfilter($item['id'], false), 'tab_files' => 'files')) . '" class="idx_dir">';
    }
    $ret .= $item['label'];
    $ret .= '</a>';
    return $ret;
}
Exemple #9
0
function ajax_mediaupload()
{
    global $NS, $MSG;
    if ($_FILES['qqfile']['tmp_name']) {
        $id = empty($_POST['mediaid']) ? $_FILES['qqfile']['name'] : $_POST['mediaid'];
    } elseif (isset($_GET['qqfile'])) {
        $id = $_GET['qqfile'];
    }
    $id = cleanID($id, false, true);
    $NS = $_REQUEST['ns'];
    $ns = $NS . ':' . getNS($id);
    $AUTH = auth_quickaclcheck("{$ns}:*");
    if ($AUTH >= AUTH_UPLOAD) {
        io_createNamespace("{$ns}:xxx", 'media');
    }
    if ($_FILES['qqfile']['error']) {
        unset($_FILES['qqfile']);
    }
    if ($_FILES['qqfile']['tmp_name']) {
        $res = media_upload($NS, $AUTH, $_FILES['qqfile']);
    }
    if (isset($_GET['qqfile'])) {
        $res = media_upload_xhr($NS, $AUTH);
    }
    if ($res) {
        $result = array('success' => true, 'link' => media_managerURL(array('ns' => $ns, 'image' => $NS . ':' . $id), '&'), 'id' => $NS . ':' . $id, 'ns' => $NS);
    }
    if (!$result) {
        $error = '';
        if (isset($MSG)) {
            foreach ($MSG as $msg) {
                $error .= $msg['msg'];
            }
        }
        $result = array('error' => $msg['msg'], 'ns' => $NS);
    }
    echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
}
Exemple #10
0
/**
 * Add recent changed pages to a feed object
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param  FeedCreator $rss the FeedCreator Object
 * @param  array       $data the items to add
 * @param  array       $opt  the feed options
 */
function rss_buildItems(&$rss, &$data, $opt)
{
    global $conf;
    global $lang;
    /* @var auth_basic $auth */
    global $auth;
    $eventData = array('rss' => &$rss, 'data' => &$data, 'opt' => &$opt);
    $event = new Doku_Event('FEED_DATA_PROCESS', $eventData);
    if ($event->advise_before(false)) {
        foreach ($data as $ditem) {
            if (!is_array($ditem)) {
                // not an array? then only a list of IDs was given
                $ditem = array('id' => $ditem);
            }
            $item = new FeedItem();
            $id = $ditem['id'];
            if (!$ditem['media']) {
                $meta = p_get_metadata($id);
            } else {
                $meta = array();
            }
            // add date
            if ($ditem['date']) {
                $date = $ditem['date'];
            } elseif ($ditem['media']) {
                $date = @filemtime(mediaFN($id));
            } elseif (@file_exists(wikiFN($id))) {
                $date = @filemtime(wikiFN($id));
            } elseif ($meta['date']['modified']) {
                $date = $meta['date']['modified'];
            } else {
                $date = 0;
            }
            if ($date) {
                $item->date = date('r', $date);
            }
            // add title
            if ($conf['useheading'] && $meta['title']) {
                $item->title = $meta['title'];
            } else {
                $item->title = $ditem['id'];
            }
            if ($conf['rss_show_summary'] && !empty($ditem['sum'])) {
                $item->title .= ' - ' . strip_tags($ditem['sum']);
            }
            // add item link
            switch ($opt['link_to']) {
                case 'page':
                    if ($ditem['media']) {
                        $item->link = media_managerURL(array('image' => $id, 'ns' => getNS($id), 'rev' => $date), '&', true);
                    } else {
                        $item->link = wl($id, 'rev=' . $date, true, '&');
                    }
                    break;
                case 'rev':
                    if ($ditem['media']) {
                        $item->link = media_managerURL(array('image' => $id, 'ns' => getNS($id), 'rev' => $date, 'tab_details' => 'history'), '&', true);
                    } else {
                        $item->link = wl($id, 'do=revisions&rev=' . $date, true, '&');
                    }
                    break;
                case 'current':
                    if ($ditem['media']) {
                        $item->link = media_managerURL(array('image' => $id, 'ns' => getNS($id)), '&', true);
                    } else {
                        $item->link = wl($id, '', true, '&');
                    }
                    break;
                case 'diff':
                default:
                    if ($ditem['media']) {
                        $item->link = media_managerURL(array('image' => $id, 'ns' => getNS($id), 'rev' => $date, 'tab_details' => 'history', 'mediado' => 'diff'), '&', true);
                    } else {
                        $item->link = wl($id, 'rev=' . $date . '&do=diff', true, '&');
                    }
            }
            // add item content
            switch ($opt['item_content']) {
                case 'diff':
                case 'htmldiff':
                    if ($ditem['media']) {
                        $revs = getRevisions($id, 0, 1, 8192, true);
                        $rev = $revs[0];
                        $src_r = '';
                        $src_l = '';
                        if ($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)), 300)) {
                            $more = 'w=' . $size[0] . '&h=' . $size[1] . 't=' . @filemtime(mediaFN($id));
                            $src_r = ml($id, $more);
                        }
                        if ($rev && ($size = media_image_preview_size($id, $rev, new JpegMeta(mediaFN($id, $rev)), 300))) {
                            $more = 'rev=' . $rev . '&w=' . $size[0] . '&h=' . $size[1];
                            $src_l = ml($id, $more);
                        }
                        $content = '';
                        if ($src_r) {
                            $content = '<table>';
                            $content .= '<tr><th width="50%">' . $rev . '</th>';
                            $content .= '<th width="50%">' . $lang['current'] . '</th></tr>';
                            $content .= '<tr align="center"><td><img src="' . $src_l . '" alt="" /></td><td>';
                            $content .= '<img src="' . $src_r . '" alt="' . $id . '" /></td></tr>';
                            $content .= '</table>';
                        }
                    } else {
                        require_once DOKU_INC . 'inc/DifferenceEngine.php';
                        $revs = getRevisions($id, 0, 1);
                        $rev = $revs[0];
                        if ($rev) {
                            $df = new Diff(explode("\n", rawWiki($id, $rev)), explode("\n", rawWiki($id, '')));
                        } else {
                            $df = new Diff(array(''), explode("\n", rawWiki($id, '')));
                        }
                        if ($opt['item_content'] == 'htmldiff') {
                            // note: no need to escape diff output, TableDiffFormatter provides 'safe' html
                            $tdf = new TableDiffFormatter();
                            $content = '<table>';
                            $content .= '<tr><th colspan="2" width="50%">' . $rev . '</th>';
                            $content .= '<th colspan="2" width="50%">' . $lang['current'] . '</th></tr>';
                            $content .= $tdf->format($df);
                            $content .= '</table>';
                        } else {
                            // note: diff output must be escaped, UnifiedDiffFormatter provides plain text
                            $udf = new UnifiedDiffFormatter();
                            $content = "<pre>\n" . hsc($udf->format($df)) . "\n</pre>";
                        }
                    }
                    break;
                case 'html':
                    if ($ditem['media']) {
                        if ($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)))) {
                            $more = 'w=' . $size[0] . '&h=' . $size[1] . 't=' . @filemtime(mediaFN($id));
                            $src = ml($id, $more);
                            $content = '<img src="' . $src . '" alt="' . $id . '" />';
                        } else {
                            $content = '';
                        }
                    } else {
                        if (@filemtime(wikiFN($id)) === $date) {
                            $content = p_wiki_xhtml($id, '', false);
                        } else {
                            $content = p_wiki_xhtml($id, $date, false);
                        }
                        // no TOC in feeds
                        $content = preg_replace('/(<!-- TOC START -->).*(<!-- TOC END -->)/s', '', $content);
                        // add alignment for images
                        $content = preg_replace('/(<img .*?class="medialeft")/s', '\\1 align="left"', $content);
                        $content = preg_replace('/(<img .*?class="mediaright")/s', '\\1 align="right"', $content);
                        // make URLs work when canonical is not set, regexp instead of rerendering!
                        if (!$conf['canonical']) {
                            $base = preg_quote(DOKU_REL, '/');
                            $content = preg_replace('/(<a href|<img src)="(' . $base . ')/s', '$1="' . DOKU_URL, $content);
                        }
                    }
                    break;
                case 'abstract':
                default:
                    if ($ditem['media']) {
                        if ($size = media_image_preview_size($id, false, new JpegMeta(mediaFN($id)))) {
                            $more = 'w=' . $size[0] . '&h=' . $size[1] . 't=' . @filemtime(mediaFN($id));
                            $src = ml($id, $more);
                            $content = '<img src="' . $src . '" alt="' . $id . '" />';
                        } else {
                            $content = '';
                        }
                    } else {
                        $content = $meta['description']['abstract'];
                    }
            }
            $item->description = $content;
            //FIXME a plugin hook here could be senseful
            // add user
            # FIXME should the user be pulled from metadata as well?
            $user = @$ditem['user'];
            // the @ spares time repeating lookup
            $item->author = '';
            if ($user && $conf['useacl'] && $auth) {
                $userInfo = $auth->getUserData($user);
                if ($userInfo) {
                    switch ($conf['showuseras']) {
                        case 'username':
                            $item->author = $userInfo['name'];
                            break;
                        default:
                            $item->author = $user;
                            break;
                    }
                } else {
                    $item->author = $user;
                }
                if ($userInfo && !$opt['guardmail']) {
                    $item->authorEmail = $userInfo['mail'];
                } else {
                    //cannot obfuscate because some RSS readers may check validity
                    $item->authorEmail = $user . '@' . $ditem['ip'];
                }
            } elseif ($user) {
                // this happens when no ACL but some Apache auth is used
                $item->author = $user;
                $item->authorEmail = $user . '@' . $ditem['ip'];
            } else {
                $item->authorEmail = 'anonymous@' . $ditem['ip'];
            }
            // add category
            if (isset($meta['subject'])) {
                $item->category = $meta['subject'];
            } else {
                $cat = getNS($id);
                if ($cat) {
                    $item->category = $cat;
                }
            }
            // finally add the item to the feed object, after handing it to registered plugins
            $evdata = array('item' => &$item, 'opt' => &$opt, 'ditem' => &$ditem, 'rss' => &$rss);
            $evt = new Doku_Event('FEED_ITEM_ADD', $evdata);
            if ($evt->advise_before()) {
                $rss->addItem($item);
            }
            $evt->advise_after();
            // for completeness
        }
    }
    $event->advise_after();
}