/** * Shows the entry panel overview * * Shows a list of existing entries, with pagination and cookie-remember settings. * * @access public * @return null */ function serendipity_drawList() { global $serendipity, $sort_order, $per_page; $filter_import = array('author', 'category', 'isdraft'); $sort_import = array('perPage', 'ordermode', 'order'); foreach ($filter_import as $f_import) { serendipity_restoreVar($serendipity['COOKIE']['entrylist_filter_' . $f_import], $serendipity['GET']['filter'][$f_import]); serendipity_JSsetCookie('entrylist_filter_' . $f_import, $serendipity['GET']['filter'][$f_import]); } foreach ($sort_import as $s_import) { serendipity_restoreVar($serendipity['COOKIE']['entrylist_sort_' . $s_import], $serendipity['GET']['sort'][$s_import]); serendipity_JSsetCookie('entrylist_sort_' . $s_import, $serendipity['GET']['sort'][$s_import]); } $perPage = !empty($serendipity['GET']['sort']['perPage']) ? $serendipity['GET']['sort']['perPage'] : $per_page[0]; $page = (int) $serendipity['GET']['page']; $offSet = $perPage * $page; if (empty($serendipity['GET']['sort']['ordermode']) || $serendipity['GET']['sort']['ordermode'] != 'ASC') { $serendipity['GET']['sort']['ordermode'] = 'DESC'; } if (!empty($serendipity['GET']['sort']['order']) && !empty($sort_order[$serendipity['GET']['sort']['order']])) { $orderby = serendipity_db_escape_string($serendipity['GET']['sort']['order'] . ' ' . $serendipity['GET']['sort']['ordermode']); } else { $orderby = 'timestamp ' . serendipity_db_escape_string($serendipity['GET']['sort']['ordermode']); } $filter = array(); if (!empty($serendipity['GET']['filter']['author'])) { $filter[] = "e.authorid = '" . serendipity_db_escape_string($serendipity['GET']['filter']['author']) . "'"; } if (!empty($serendipity['GET']['filter']['category'])) { $filter[] = "ec.categoryid = '" . serendipity_db_escape_string($serendipity['GET']['filter']['category']) . "'"; } if (!empty($serendipity['GET']['filter']['isdraft'])) { if ($serendipity['GET']['filter']['isdraft'] == 'draft') { $filter[] = "e.isdraft = 'true'"; } elseif ($serendipity['GET']['filter']['isdraft'] == 'publish') { $filter[] = "e.isdraft = 'false'"; } } if (!empty($serendipity['GET']['filter']['body'])) { if ($serendipity['dbType'] == 'mysql') { $filter[] = "MATCH (title,body,extended) AGAINST ('" . serendipity_db_escape_string($serendipity['GET']['filter']['body']) . "')"; $full = true; } } $filter_sql = implode(' AND ', $filter); // Fetch the entries $entries = serendipity_fetchEntries(false, false, serendipity_db_limit($offSet, $perPage + 1), true, false, $orderby, $filter_sql); ?> <div class="serendipity_admin_list"> <form action="?" method="get"> <input type="hidden" name="serendipity[action]" value="admin" /> <input type="hidden" name="serendipity[adminModule]" value="entries" /> <input type="hidden" name="serendipity[adminAction]" value="editSelect" /> <table width="100%" class="serendipity_admin_filters"> <tr> <td class="serendipity_admin_filters_headline" colspan="6"><strong><?php echo FILTERS; ?> </strong> - <?php echo FIND_ENTRIES; ?> </td> </tr> <tr> <td valign="top" width="80"><?php echo AUTHOR; ?> </td> <td valign="top"> <select name="serendipity[filter][author]"> <option value="">--</option> <?php $users = serendipity_fetchUsers('', null, true); if (is_array($users)) { foreach ($users as $user) { if (isset($user['artcount']) && $user['artcount'] < 1) { continue; } echo '<option value="' . $user['authorid'] . '" ' . (isset($serendipity['GET']['filter']['author']) && $serendipity['GET']['filter']['author'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . htmlspecialchars($user['realname']) . '</option>' . "\n"; } } ?> </select> <select name="serendipity[filter][isdraft]"> <option value="all"><?php echo COMMENTS_FILTER_ALL; ?> </option> <option value="draft" <?php echo isset($serendipity['GET']['filter']['isdraft']) && $serendipity['GET']['filter']['isdraft'] == 'draft' ? 'selected="selected"' : ''; ?> ><?php echo DRAFT; ?> </option> <option value="publish" <?php echo isset($serendipity['GET']['filter']['isdraft']) && $serendipity['GET']['filter']['isdraft'] == 'publish' ? 'selected="selected"' : ''; ?> ><?php echo PUBLISH; ?> </option> </select> </td> <td valign="top" width="80"><?php echo CATEGORY; ?> </td> <td valign="top"> <select name="serendipity[filter][category]"> <option value="">--</option> <?php $categories = serendipity_fetchCategories(); $categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED); foreach ($categories as $cat) { echo '<option value="' . $cat['categoryid'] . '"' . ($serendipity['GET']['filter']['category'] == $cat['categoryid'] ? ' selected="selected"' : '') . '>' . str_repeat(' ', $cat['depth']) . htmlspecialchars($cat['category_name']) . '</option>' . "\n"; } ?> </select> </td> <td valign="top" width="80"><?php echo CONTENT; ?> </td> <td valign="top"><input class="input_textbox" size="10" type="text" name="serendipity[filter][body]" value="<?php echo isset($serendipity['GET']['filter']['body']) ? htmlspecialchars($serendipity['GET']['filter']['body']) : ''; ?> " /></td> </tr> <tr> <td class="serendipity_admin_filters_headline" colspan="6"><strong><?php echo SORT_ORDER; ?> </strong></td> </tr> <tr> <td> <?php echo SORT_BY; ?> </td> <td> <select name="serendipity[sort][order]"> <?php foreach ($sort_order as $so_key => $so_val) { echo '<option value="' . $so_key . '" ' . (isset($serendipity['GET']['sort']['order']) && $serendipity['GET']['sort']['order'] == $so_key ? 'selected="selected"' : '') . '>' . $so_val . '</option>' . "\n"; } ?> </select> </td> <td><?php echo SORT_ORDER; ?> </td> <td> <select name="serendipity[sort][ordermode]"> <option value="DESC" <?php echo isset($serendipity['GET']['sort']['ordermode']) && $serendipity['GET']['sort']['ordermode'] == 'DESC' ? 'selected="selected"' : ''; ?> ><?php echo SORT_ORDER_DESC; ?> </option> <option value="ASC" <?php echo isset($serendipity['GET']['sort']['ordermode']) && $serendipity['GET']['sort']['ordermode'] == 'ASC' ? 'selected="selected"' : ''; ?> ><?php echo SORT_ORDER_ASC; ?> </option> </select> </td> <td><?php echo ENTRIES_PER_PAGE; ?> </td> <td> <select name="serendipity[sort][perPage]"> <?php foreach ($per_page as $per_page_nr) { echo '<option value="' . $per_page_nr . '" ' . (isset($serendipity['GET']['sort']['perPage']) && $serendipity['GET']['sort']['perPage'] == $per_page_nr ? 'selected="selected"' : '') . '>' . $per_page_nr . '</option>' . "\n"; } ?> </select> </td> </tr> <tr> <td align="right" colspan="6"><input type="submit" name="go" value="<?php echo GO; ?> " class="serendipityPrettyButton input_button" /></td> </tr> </table> </form> <table class="serendipity_admin_list" cellpadding="5" width="100%"> <?php if (is_array($entries)) { $count = count($entries); $qString = '?serendipity[adminModule]=entries&serendipity[adminAction]=editSelect'; foreach ((array) $serendipity['GET']['sort'] as $k => $v) { $qString .= '&serendipity[sort][' . $k . ']=' . $v; } foreach ((array) $serendipity['GET']['filter'] as $k => $v) { $qString .= '&serendipity[filter][' . $k . ']=' . $v; } $linkPrevious = $qString . '&serendipity[page]=' . ($page - 1); $linkNext = $qString . '&serendipity[page]=' . ($page + 1); ?> <tr> <td> <?php if ($offSet > 0) { ?> <a href="<?php echo $linkPrevious; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/previous.png'); ?> " /><?php echo PREVIOUS; ?> </a> <?php } ?> </td> <td align="right"> <?php if ($count > $perPage) { ?> <a href="<?php echo $linkNext; ?> " class="serendipityIconLinkRight"><?php echo NEXT; ?> <img src="<?php echo serendipity_getTemplateFile('admin/img/next.png'); ?> " /></a> <?php } ?> </td> </tr> </table> <script type="text/javascript"> function invertSelection() { var f = document.formMultiDelete; for (var i = 0; i < f.elements.length; i++) { if (f.elements[i].type == 'checkbox') { f.elements[i].checked = !(f.elements[i].checked); } } } </script> <form action="?" method="post" name="formMultiDelete" id="formMultiDelete"> <?php echo serendipity_setFormToken(); ?> <input type="hidden" name="serendipity[action]" value="admin" /> <input type="hidden" name="serendipity[adminModule]" value="entries" /> <input type="hidden" name="serendipity[adminAction]" value="multidelete" /> <?php // Print the entries $rows = 0; foreach ($entries as $entry) { $rows++; if ($rows > $perPage) { continue; } // Find out if the entry has been modified later than 30 minutes after creation if ($entry['timestamp'] <= $entry['last_modified'] - 60 * 30) { $lm = '<a href="#" title="' . LAST_UPDATED . ': ' . serendipity_formatTime(DATE_FORMAT_SHORT, $entry['last_modified']) . '" onclick="alert(this.title)"><img src="' . serendipity_getTemplateFile('admin/img/clock.png') . '" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a>'; } else { $lm = ''; } if (!$serendipity['showFutureEntries'] && $entry['timestamp'] >= serendipity_serverOffsetHour()) { $entry_pre = '<a href="#" title="' . ENTRY_PUBLISHED_FUTURE . '" onclick="alert(this.title)"><img src="' . serendipity_getTemplateFile('admin/img/clock_future.png') . '" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a> '; } else { $entry_pre = ''; } if (serendipity_db_bool($entry['properties']['ep_is_sticky'])) { $entry_pre .= ' ' . STICKY_POSTINGS . ': '; } if (serendipity_db_bool($entry['isdraft'])) { $entry_pre .= ' ' . DRAFT . ': '; } ?> <!-- <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo $rows % 2 ? 'even' : 'uneven'; ?> "> --> <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo $rows % 2 ? 'even' : 'uneven'; ?> "> <table width="100%" cellspacing="0" cellpadding="3"> <tr> <td> <strong><?php echo $entry_pre; ?> <a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=<?php echo $entry['id']; ?> " title="#<?php echo $entry['id']; ?> "><?php echo serendipity_truncateString(htmlspecialchars($entry['title']), 50); ?> </a></strong> </td> <td align="right"> <?php echo serendipity_formatTime(DATE_FORMAT_SHORT, $entry['timestamp']) . ' ' . $lm; ?> </td> </tr> <tr> <td> <?php echo POSTED_BY . ' ' . htmlspecialchars($entry['author']); if (count($entry['categories'])) { echo ' ' . IN . ' '; $cats = array(); foreach ($entry['categories'] as $cat) { $caturl = serendipity_categoryURL($cat); $cats[] = '<a href="' . $caturl . '">' . htmlspecialchars($cat['category_name']) . '</a>'; } echo implode(', ', $cats); } $entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp'])); $entry['preview_link'] = '?serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=preview&serendipity[id]=' . $entry['id']; ?> </td> <td align="right"> <?php if (serendipity_db_bool($entry['isdraft']) || !$serendipity['showFutureEntries'] && $entry['timestamp'] >= serendipity_serverOffsetHour()) { ?> <a target="_blank" href="<?php echo $entry['preview_link']; ?> " title="<?php echo PREVIEW . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?> " alt="<?php echo PREVIEW; ?> " /><?php echo PREVIEW; ?> </a> <?php } else { ?> <a target="_blank" href="<?php echo $entry['link']; ?> " title="<?php echo VIEW . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?> " alt="<?php echo VIEW; ?> " /><?php echo VIEW; ?> </a> <?php } ?> <a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=<?php echo $entry['id']; ?> " title="<?php echo EDIT . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/edit.png'); ?> " alt="<?php echo EDIT; ?> " /><?php echo EDIT; ?> </a> <a href="?<?php echo serendipity_setFormToken('url'); ?> &serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=delete&serendipity[id]=<?php echo $entry['id']; ?> " title="<?php echo DELETE . ' #' . $entry['id']; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/delete.png'); ?> " alt="<?php echo DELETE; ?> " /><?php echo DELETE; ?> </a> <input class="input_checkbox" type="checkbox" name="serendipity[multiDelete][]" value="<?php echo $entry['id']; ?> " /> </td> </tr> </table> </div> <?php } // end entries output ?> <table class="serendipity_admin_list" cellpadding="5" width="100%"> <tr> <td> <?php if ($offSet > 0) { ?> <a href="<?php echo $linkPrevious; ?> " class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/previous.png'); ?> " /><?php echo PREVIOUS; ?> </a> <?php } ?> </td> <td align="right"> <?php if ($count > $perPage) { ?> <a href="<?php echo $linkNext; ?> " class="serendipityIconLinkRight"><?php echo NEXT; ?> <img src="<?php echo serendipity_getTemplateFile('admin/img/next.png'); ?> " /></a> <?php } ?> </td> </tr> </table> <table class="serendipity_admin_list" cellpadding="0" width="100%"> <tr> <td align="right"> <input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS; ?> " onclick="invertSelection()" class="serendipityPrettyButton input_button" /> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_ENTRIES; ?> " class="serendipityPrettyButton input_button" /> </td> </tr> </table> </form> <div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo ($rows + 1) % 2 ? 'even' : 'uneven'; ?> "> <table width="100%" cellspacing="0" cellpadding="3"> <tr> <td> <form action="?" method="get"> <input type="hidden" name="serendipity[action]" value="admin" /> <input type="hidden" name="serendipity[adminModule]" value="entries" /> <input type="hidden" name="serendipity[adminAction]" value="editSelect" /> <?php echo EDIT_ENTRY; ?> : #<input class="input_textbox" type="text" size="3" name="serendipity[id]" /> <input type="submit" name="serendipity[editSubmit]" value="<?php echo GO; ?> " class="serendipityPrettyButton input_button" /> </form> </td> </tr> </table> </div> <?php } else { // We've got nothing ?> <tr> <td align="center" class="serendipityAdminMsgNote"> <img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="<?php echo serendipity_getTemplateFile('admin/img/admin_msg_note.png'); ?> " alt="" /> <?php echo NO_ENTRIES_TO_PRINT; ?> </td> </tr> </table> <?php } ?> </div> <?php }
function showBackend() { global $serendipity; // check sidebar plugin availability $sbplav = !$this->sb_plugin_status() ? true : false; if (isset($serendipity['GET']['staticid']) && !isset($serendipity['POST']['staticpage'])) { $serendipity['POST']['staticpage'] = (int) $serendipity['GET']['staticid']; } if (isset($serendipity['GET']['pre']) && is_array($serendipity['GET']['pre'])) { // Allow to create a new staticpage from a bookmark link $serendipity['POST']['plugin'] = $serendipity['GET']['pre']; $serendipity['POST']['staticpage'] = '__new'; $serendipity['POST']['staticSubmit'] = true; } if ($serendipity['version'][0] < 2) { echo '<script type="text/javascript" src="' . $serendipity['serendipityHTTPPath'] . 'serendipity_define.js.php"></script>' . "\n"; echo '<script type="text/javascript" src="' . $serendipity['serendipityHTTPPath'] . 'serendipity_editor.js"></script>'; } ?> <div id="serendipityStaticpagesNav"> <ul> <li <?php echo $serendipity['GET']['staticpagecategory'] == 'pageedit' ? 'id="active"' : ''; ?> ><a href="<?php echo $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pageedit'; ?> "><?php echo STATICPAGE_CATEGORY_PAGES; ?> </a></li> <li <?php echo $serendipity['GET']['staticpagecategory'] == 'pageorder' ? 'id="active"' : ''; ?> ><a href="<?php echo $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pageorder'; ?> "><?php echo STATICPAGE_CATEGORY_PAGEORDER; ?> </a></li> <li <?php echo $serendipity['GET']['staticpagecategory'] == 'pagetype' || $serendipity['POST']['staticpagecategory'] == 'pagetype' ? 'id="active"' : ''; ?> ><a href="<?php echo $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pagetype'; ?> "><?php echo STATICPAGE_CATEGORY_PAGETYPES; ?> </a></li> <li <?php echo $serendipity['GET']['staticpagecategory'] == 'pageadd' ? 'id="active"' : ''; ?> ><a href="<?php echo $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pageadd'; ?> "><?php echo STATICPAGE_CATEGORY_PAGEADD; ?> </a></li> </ul> </div> <?php $spcat = !empty($serendipity['GET']['staticpagecategory']) ? $serendipity['GET']['staticpagecategory'] : $serendipity['POST']['staticpagecategory']; switch ($spcat) { case 'pageorder': echo '<strong>' . STATICPAGE_PAGEORDER_DESC . '</strong><br /><br />'; switch ($serendipity['GET']['moveto']) { case 'moveup': $this->move_up($serendipity['GET']['pagetomove']); break; case 'movedown': $this->move_down($serendipity['GET']['pagetomove']); break; } $pages = $this->fetchStaticPages(true); if (is_array($pages)) { $pages = serendipity_walkRecursive($pages); $sort_idx = 0; echo '<table>' . "\n"; foreach ($pages as $page) { echo '<tr>' . "\n"; echo '<td>'; echo str_repeat(' ', $page['depth']) . $page['pagetitle']; echo '</td>' . "\n"; echo '<td>'; if ($sort_idx == 0) { echo ' '; } else { echo '<a href="?serendipity[adminModule]=staticpages&serendipity[moveto]=moveup&serendipity[pagetomove]=' . $page['id'] . '&serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pageorder" style="border: 0"><img src="' . serendipity_getTemplateFile('admin/img/uparrow.png') . '" height="16" width="16" border="0" alt="' . UP . '" /></a>'; } echo '</td>' . "\n"; echo '<td>'; if ($sort_idx == count($pages) - 1) { echo ' '; } else { echo ($page['moveup'] != '' ? ' ' : '') . '<a href="?serendipity[adminModule]=staticpages&serendipity[moveto]=movedown&serendipity[pagetomove]=' . $page['id'] . '&serendipity[adminModule]=event_display&serendipity[adminAction]=staticpages&serendipity[staticpagecategory]=pageorder" style="border: 0"><img src="' . serendipity_getTemplateFile('admin/img/downarrow.png') . '" height="16" width="16" alt="' . DOWN . '" border="0" /></a>'; } echo '</td>' . "\n"; echo '</tr>' . "\n"; $sort_idx++; } echo '</table>' . "\n"; } break; case 'pagetype': if ($serendipity['POST']['pagetype'] != '__new') { $this->fetchPageType($serendipity['POST']['pagetype']); } if ($serendipity['POST']['typeSave'] == "true" && !empty($serendipity['POST']['SAVECONF'])) { $serendipity['POST']['typeSubmit'] = true; $bag = new serendipity_property_bag(); $this->introspect($bag); $name = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('name')) : htmlspecialchars($bag->get('name'), ENT_COMPAT, LANG_CHARSET); $desc = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('description')) : htmlspecialchars($bag->get('description'), ENT_COMPAT, LANG_CHARSET); $config_t = $bag->get('type_configuration'); foreach ($config_t as $config_item) { $cbag = new serendipity_property_bag(); if ($this->introspect_item_type($config_item, $cbag)) { $this->pagetype[$config_item] = serendipity_get_bool($serendipity['POST']['plugin'][$config_item]); } } echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>'; $this->updatePageType(); } if (!empty($serendipity['POST']['typeDelete']) && $serendipity['POST']['pagetype'] != '__new') { serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}staticpages_types WHERE id = " . (int) $serendipity['POST']['pagetype']); echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(RIP_ENTRY, $this->pagetype['description']) . '</div>'; } echo '<form action="serendipity_admin.php" method="post" name="serendipityEntry">'; echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />'; echo '<input type="hidden" name="serendipity[adminAction]" value="staticpages" />'; echo '<input type="hidden" name="serendipity[staticpagecategory]" value="pagetype" />'; echo '<div>'; echo '<strong>' . PAGETYPES_SELECT . '</strong><br /><br />'; echo '<select name="serendipity[pagetype]">'; echo ' <option value="__new">' . NEW_ENTRY . '</option>'; echo ' <option value="__new">-----------------</option>'; $types = $this->fetchPageTypes(); if (is_array($types)) { foreach ($types as $type) { echo ' <option value="' . $type['id'] . '" ' . ($serendipity['POST']['pagetype'] == $type['id'] ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($type['description']) : htmlspecialchars($type['description'], ENT_COMPAT, LANG_CHARSET)) . '</option>'; } } echo '</select> <input type="submit" class="serendipityPrettyButton input_button" name="serendipity[typeSubmit]" value="' . GO . '" /> <strong>-' . WORD_OR . '-</strong> <input type="submit" class="serendipityPrettyButton input_button" name="serendipity[typeDelete]" value="' . DELETE . '" />'; echo '</select>'; echo '</div>'; echo '<div>'; if ($serendipity['POST']['typeSubmit']) { echo '<input type="hidden" name="serendipity[typeSave]" value="true" />'; $this->showForm($this->config_types, $this->pagetype, 'introspect_item_type', 'get_type', 'typeSubmit'); } echo '</form>'; echo '</div>'; break; case 'pageadd': echo '<strong>' . STATICPAGE_PAGEADD_DESC . '</strong><br /><br />'; $plugins = $this->selectPlugins(); $insplugins = $this->fetchPlugins(); if (isset($serendipity['POST']['typeSubmit'])) { foreach ($insplugins as $key => $values) { if (empty($serendipity['POST']['externalPlugins'][$key])) { serendipity_db_query('DELETE FROM ' . $serendipity['dbPrefix'] . 'staticpages WHERE id = ' . (int) $values['id']); } } if (count($serendipity['POST']['externalPlugins'])) { foreach ($serendipity['POST']['externalPlugins'] as $plugin) { $this->staticpage = array('permalink' => $plugins[$plugin]['link'], 'content' => 'plugin', 'pre_content' => $plugin, 'pagetitle' => $plugins[$plugin]['name'], 'headline' => $plugins[$plugin]['name']); $this->updateStaticPage(); } } } $insplugins = $this->fetchPlugins(); if (is_array($plugins)) { echo '<form action="serendipity_admin.php" method="post" name="serendipityPlugins">'; echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />'; echo '<input type="hidden" name="serendipity[adminAction]" value="staticpages" />'; echo '<input type="hidden" name="serendipity[staticpagecategory]" value="pageadd" />'; foreach ($plugins as $key => $plugin) { if (isset($insplugins[$key])) { $c = 'checked="checked"'; } else { $c = ''; } echo '<input class="input_checkbox" type="checkbox" name="serendipity[externalPlugins][]" value="' . $key . '" ' . $c . ' />' . $plugin['name'] . '<br />'; } echo '<input type="submit" name="serendipity[typeSubmit]" class="serendipityPrettyButton input_button" value="' . GO . '">'; echo '</form>'; } echo '<strong>' . STATICPAGE_PAGEADD_PLUGINS . '</strong><br /><br />'; $this->pluginstatus(); echo '<table>'; echo '<tr id="serendipityStaticpagesTableHeader">'; echo '<th>' . EVENT_PLUGIN . '</th>'; echo '<th>' . STATICPAGE_STATUS . '</th>'; echo '</tr>'; $i = 0; foreach ($this->pluginstats as $key => $value) { echo '<tr id="serendipityStaticpagesTable' . $i++ % 2 . '">'; echo '<td>' . $key . '</td>'; echo '<td><span id="serendipityStaticpages' . $value['color'] . '">' . $value['status'] . '</span></td>'; echo '</tr>'; } echo '</table>'; break; case 'pages': default: if ($serendipity['POST']['staticpage'] != '__new') { $this->fetchStaticPage($serendipity['POST']['staticpage']); } if ($serendipity['POST']['staticSave'] == "true" && !empty($serendipity['POST']['SAVECONF'])) { $serendipity['POST']['staticSubmit'] = true; $bag = new serendipity_property_bag(); $this->introspect($bag); $name = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('name')) : htmlspecialchars($bag->get('name'), ENT_COMPAT, LANG_CHARSET); $desc = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('description')) : htmlspecialchars($bag->get('description'), ENT_COMPAT, LANG_CHARSET); $config_names = $bag->get('page_configuration'); foreach ($config_names as $config_item) { $cbag = new serendipity_property_bag(); if ($this->introspect_item($config_item, $cbag)) { $this->staticpage[$config_item] = serendipity_get_bool($serendipity['POST']['plugin'][$config_item]); } } $result = $this->updateStaticPage(); if (is_string($result)) { echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />ERROR: ' . $result . '</div>'; } else { echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>'; } } if (!empty($serendipity['POST']['staticDelete']) && $serendipity['POST']['staticpage'] != '__new') { if (!$this->getChildPage($serendipity['POST']['staticpage'])) { serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}staticpages WHERE id = " . (int) $serendipity['POST']['staticpage']); echo '<div class="serendipityAdminMsgSuccess">' . DONE . ': ' . sprintf(RIP_ENTRY, $this->staticpage['pagetitle']) . '</div>'; } else { echo '<div class="serendipityAdminMsgNote"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_note.png') . '" alt="" />' . IMPORT_NOTES . ': ' . STATICPAGE_CANNOTDELETE_MSG . '</div>'; } } echo '<form action="serendipity_admin.php" method="post" name="serendipityEntry">'; echo '<div>'; echo ' <input type="hidden" name="serendipity[adminModule]" value="event_display" />'; echo ' <input type="hidden" name="serendipity[adminAction]" value="staticpages" />'; echo ' <input type="hidden" name="serendipity[staticpagecategory]" value="pages" />'; echo '</div>'; if (empty($serendipity['POST']['backend_template'])) { if (!empty($serendipity['COOKIE']['backend_template'])) { $serendipity['POST']['backend_template'] = $serendipity['COOKIE']['backend_template']; } } else { serendipity_JSsetCookie('backend_template', $serendipity['POST']['backend_template']); } echo '<div class="sp_templateselector">'; echo '<label for="sp_templateselector">' . STATICPAGE_TEMPLATE . '</label> <select id="sp_templateselector" name="serendipity[backend_template]">'; echo '<option ' . ($serendipity['POST']['backend_template'] == 'external' ? 'selected="selected"' : '') . ' value="external">' . STATICPAGE_TEMPLATE_EXTERNAL . '</option>'; echo '<option ' . ($serendipity['POST']['backend_template'] == 'internal' ? 'selected="selected"' : '') . ' value="internal">' . STATICPAGE_TEMPLATE_INTERNAL . '</option>'; $dh = @opendir(dirname(__FILE__) . '/backend_templates'); if ($dh) { while ($file = readdir($dh)) { if ($file != 'default_staticpage_backend.tpl' && preg_match('@^(.*).tpl$@i', $file, $m)) { echo '<option ' . ($file == $serendipity['POST']['backend_template'] ? 'selected="selected"' : '') . ' value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($file) : htmlspecialchars($file, ENT_COMPAT, LANG_CHARSET)) . '">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($m[1]) : htmlspecialchars($m[1], ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n"; } } } $dh = @opendir($serendipity['templatePath'] . $serendipity['template'] . '/backend_templates'); if ($dh) { while ($file = readdir($dh)) { if ($file != 'default_staticpage_backend.tpl' && preg_match('@^(.*).tpl$@i', $file, $m)) { echo '<option ' . ($file == $serendipity['POST']['backend_template'] ? 'selected="selected"' : '') . ' value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($file) : htmlspecialchars($file, ENT_COMPAT, LANG_CHARSET)) . '">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($m[1]) : htmlspecialchars($m[1], ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n"; } } } echo '</select>'; echo '</div>'; echo '<div class="sp_pageselector">'; echo '<strong>' . STATICPAGE_SELECT . '</strong><br /><br />'; echo '<select name="serendipity[staticpage]" id="staticpage_dropdown">'; echo ' <option value="__new">' . NEW_ENTRY . '</option>'; echo ' <option value="__new">-----------------</option>'; $pages = $this->fetchStaticPages(); if (is_array($pages)) { $pages = serendipity_walkRecursive($pages); foreach ($pages as $page) { if ($this->checkPageUser($page['authorid'])) { echo ' <option value="' . $page['id'] . '" ' . ($serendipity['POST']['staticpage'] == $page['id'] ? 'selected="selected"' : '') . '>'; echo str_repeat(' ', $page['depth']) . (function_exists('serendipity_specialchars') ? serendipity_specialchars($page['pagetitle']) : htmlspecialchars($page['pagetitle'], ENT_COMPAT, LANG_CHARSET)) . '</option>'; } } } echo '</select> <input class="serendipityPrettyButton input_button" type="submit" name="serendipity[staticSubmit]" value="' . GO . '" /> <strong>-' . WORD_OR . '-</strong> <input type="submit" name="serendipity[staticDelete]" onclick="return confirm(\'' . sprintf(DELETE_SURE, '\' + document.getElementById(\'staticpage_dropdown\').options[document.getElementById(\'staticpage_dropdown\').selectedIndex].text + \'') . '\');" class="serendipityPrettyButton input_button" value="' . DELETE . '" />'; echo ' <strong>-' . WORD_OR . '-</strong> <input class="serendipityPrettyButton input_button" type="submit" name="serendipity[staticPreview]" value="' . PREVIEW . '" />'; if ($sbplav) { echo '<div style="cursor: pointer; float: right;">'; echo '<img style="vertical-align: middle;" class="attention" title="Staticpage Sidebar ' . STATICPAGE_PLUGIN_AVAILABLE . '" src="' . serendipity_getTemplateFile('admin/img/admin_msg_note.png') . '" alt="info" />'; echo '</div>'; } echo '</div>'; if (!empty($serendipity['POST']['staticPreview'])) { $link = $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[staticid]=' . $this->staticpage['id'] . '&serendipity[staticPreview]=1'; echo '<script type="text/javascript">'; echo 'var staticpage_preview = window.open("' . $link . '", "staticpage_preview");' . "\n"; echo 'staticpage_preview.focus();' . "\n"; echo '</script>'; $serendipity['POST']['staticSubmit'] = true; echo '<p>' . sprintf(PLUGIN_STATICPAGE_PREVIEW, '<a href="' . $link . '">' . $this->staticpage['pagetitle'] . '</a>') . '</p>'; } echo '<div>'; if ($serendipity['POST']['staticSubmit'] || isset($serendipity['GET']['staticid'])) { $serendipity['POST']['plugin']['custom'] = $this->staticpage['custom']; echo '<input type="hidden" name="serendipity[staticSave]" value="true" />'; $this->showForm($this->config, $this->staticpage); echo "</div>\n"; echo '</form>'; } else { echo "</div>\n"; echo '</form>'; $this->listStaticPages(); } break; } }
/** * Display the list of images in our database * * @access public * @param int The current page number * @param string The HTML linebreak to use after a row of images * @param boolean Should the toolbar for editing media files be shown? * @param string The URL to use for pagination * @param boolean Show the "upload media item" feature? * @param boolean Restrict viewing images to a specific directory * @param boolean If TRUE, will echo Smarty output. * @return string Smarty block name */ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = false, $url = NULL, $show_upload = false, $limit_path = NULL, $smarty_display = true) { global $serendipity; static $debug = false; $sortParams = array('perpage', 'order', 'ordermode'); $importParams = array('adminModule', 'htmltarget', 'filename_only', 'textarea', 'subpage', 'keywords'); $extraParems = ''; $filterParams = array('only_path', 'only_filename'); foreach ($importParams as $importParam) { if (isset($serendipity['GET'][$importParam])) { $extraParems .= 'serendipity[' . $importParam . ']=' . $serendipity['GET'][$importParam] . '&'; } } foreach ($sortParams as $sortParam) { serendipity_restoreVar($serendipity['COOKIE']['sortorder_' . $sortParam], $serendipity['GET']['sortorder'][$sortParam]); serendipity_JSsetCookie('sortorder_' . $sortParam, $serendipity['GET']['sortorder'][$sortParam]); $extraParems .= 'serendipity[sortorder][' . $sortParam . ']=' . $serendipity['GET']['sortorder'][$sortParam] . '&'; } foreach ($filterParams as $filterParam) { serendipity_restoreVar($serendipity['COOKIE'][$filterParam], $serendipity['GET'][$filterParam]); serendipity_JSsetCookie($filterParam, $serendipity['GET'][$filterParam]); if (!empty($serendipity['GET'][$filterParam])) { $extraParems .= 'serendipity[' . $filterParam . ']=' . $serendipity['GET'][$filterParam] . '&'; } } $serendipity['GET']['only_path'] = serendipity_uploadSecure($limit_path . $serendipity['GET']['only_path'], true); $serendipity['GET']['only_filename'] = str_replace(array('*', '?'), array('%', '_'), $serendipity['GET']['only_filename']); $perPage = !empty($serendipity['GET']['sortorder']['perpage']) ? $serendipity['GET']['sortorder']['perpage'] : 8; while ($perPage % $lineBreak !== 0) { $perPage++; } $start = ($page - 1) * $perPage; if ($manage && $limit_path == NULL) { ## SYNCH START ## $aExclude = array("CVS" => true, ".svn" => true); serendipity_plugin_api::hook_event('backend_media_path_exclude_directories', $aExclude); $paths = array(); $aFilesOnDisk = array(); $aResultSet = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $limit_path, '', false, NULL, 1, NULL, FALSE, $aExclude); foreach ($aResultSet as $sKey => $sFile) { if ($sFile['directory']) { if ($debug) { echo "{$sFile['relpath']} is a directory.<br />"; } array_push($paths, $sFile); } else { if ($debug) { echo "{$sFile['relpath']} is a file.<br />"; } // Store the file in our array, remove any ending slashes $aFilesOnDisk[$sFile['relpath']] = 1; } unset($aResultSet[$sKey]); } usort($paths, 'serendipity_sortPath'); if ($debug) { echo "<p>Got files: <pre>" . print_r($aFilesOnDisk, true) . "</pre></p>"; } $serendipity['current_image_hash'] = md5(serialize($aFilesOnDisk)); $nTimeStart = microtime_float(); // MTG 21/01/06: request all images from the database, delete any which don't exist // on the filesystem, and mark off files from the file list which are already // in the database $nCount = 0; if ($debug) { echo "<p>Image Sync Right: " . serendipity_checkPermission('adminImagesSync') . " Onthefly Sync: " . $serendipity['onTheFlySynch'] . " Hash: " . $serendipity['current_image_hash'] . "!=" . $serendipity['last_image_hash'] . "</p>"; } if ($serendipity['onTheFlySynch'] && serendipity_checkPermission('adminImagesSync') && ($debug || $serendipity['current_image_hash'] != $serendipity['last_image_hash'])) { $aResultSet = serendipity_db_query("SELECT path, name, extension, thumbnail_name, id\n FROM {$serendipity['dbPrefix']}images", false, 'assoc'); if ($debug) { echo "<p>Got images: <pre>" . print_r($aResultSet, true) . "</pre></p>"; } if (is_array($aResultSet)) { foreach ($aResultSet as $sKey => $sFile) { serendipity_plugin_api::hook_event('backend_thumbnail_filename_select', $sFile); $sThumbNailFile = ''; if (isset($sFile['thumbnail_filename'])) { $sThumbNailFile = $sFile['thumbnail_filename']; } else { $sThumbNailFile = $sFile['path'] . $sFile['name'] . '.' . $sFile['thumbnail_name'] . '.' . $sFile['extension']; } $sFileName = $sFile['path'] . $sFile['name'] . '.' . $sFile['extension']; if ($debug) { echo "<p>File name is {$sFileName},<br />thumbnail is {$sThumbNailFile}</p>"; } unset($aResultSet[$sKey]); if (isset($aFilesOnDisk[$sFileName])) { unset($aFilesOnDisk[$sFileName]); } else { if ($debug) { echo "Deleting Image {$sFile['id']}<br />\n"; } serendipity_deleteImage($sFile['id']); ++$nCount; } unset($aFilesOnDisk[$sThumbNailFile]); } } if ($nCount > 0) { if ($debug) { echo "<p>Cleaned up " . $nCount . " database entries</p>"; } } serendipity_set_config_var('last_image_hash', $serendipity['current_image_hash'], 0); $aUnmatchedOnDisk = array_keys($aFilesOnDisk); if ($debug) { echo "<p>Got unmatched files: <pre>" . print_r($aUnmatchedOnDisk, true) . "</pre></p>"; } $nCount = 0; foreach ($aUnmatchedOnDisk as $sFile) { if (preg_match('@\\.' . $serendipity['thumbSuffix'] . '\\.@', $sFile)) { if ($debug) { echo "<p>Skipping thumbnailed file {$sFile}</p>"; } continue; } else { if ($debug) { echo "<p>Checking {$sFile}</p>"; } } // MTG: 21/01/06: put files which have just 'turned up' into the database $aImageData = serendipity_getImageData($sFile); if (serendipity_isImage($aImageData, false, '(image)|(video)|(audio)/')) { $nPos = strrpos($sFile, "/"); if (is_bool($nPos) && !$nPos) { $sFileName = $sFile; $sDirectory = ""; } else { ++$nPos; $sFileName = substr($sFile, $nPos); $sDirectory = substr($sFile, 0, $nPos); } if ($debug) { echo "<p>Inserting image {$sFileName} from {$sDirectory} <pre>" . print_r($aImageData, true) . "</pre> into database</p>"; } # TODO: Check if the thumbnail generation goes fine with Marty's code serendipity_makeThumbnail($sFileName, $sDirectory); serendipity_insertImageInDatabase($sFileName, $sDirectory); ++$nCount; } } if ($nCount > 0) { if ($debug) { echo "<p>Inserted " . $nCount . " images into the database</p>"; } } } else { if ($debug) { echo "<p>Media Gallery database is up to date</p>"; } } /* $nTimeEnd = microtime_float ( ); $nDifference = $nTimeEnd - $nTimeStart; echo "<p> total time taken was " . $nDifference . "</p>"; */ ## SYNCH FINISHED ## } ## Aply ACL afterwards: serendipity_directoryACL($paths, 'read'); $serendipity['imageList'] = serendipity_fetchImagesFromDatabase($start, $perPage, $totalImages, isset($serendipity['GET']['sortorder']['order']) ? $serendipity['GET']['sortorder']['order'] : false, isset($serendipity['GET']['sortorder']['ordermode']) ? $serendipity['GET']['sortorder']['ordermode'] : false, isset($serendipity['GET']['only_path']) ? $serendipity['GET']['only_path'] : '', isset($serendipity['GET']['only_filename']) ? $serendipity['GET']['only_filename'] : '', isset($serendipity['GET']['keywords']) ? $serendipity['GET']['keywords'] : '', isset($serendipity['GET']['filter']) ? $serendipity['GET']['filter'] : ''); $pages = ceil($totalImages / $perPage); $linkPrevious = '?' . $extraParems . 'serendipity[page]=' . ($page - 1); $linkNext = '?' . $extraParems . 'serendipity[page]=' . ($page + 1); if (is_null($lineBreak)) { $lineBreak = floor(750 / ($serendipity['thumbSize'] + 20)); } $dprops = $keywords = array(); if ($serendipity['parseMediaOverview']) { $ids = array(); foreach ($serendipity['imageList'] as $k => $file) { $ids[] = $file['id']; } $allprops =& serendipity_fetchMediaProperties($ids); } if (count($serendipity['imageList']) > 0) { foreach ($serendipity['imageList'] as $k => $file) { if (!($serendipity['authorid'] == $file['authorid'] || $file['authorid'] == '0' || serendipity_checkPermission('adminImagesViewOthers'))) { // This is a fail-safe continue. Basically a non-matching file should already be filtered in SQL. continue; } serendipity_prepareMedia($serendipity['imageList'][$k], $url); if ($serendipity['parseMediaOverview']) { $serendipity['imageList'][$k]['props'] =& $allprops[$file['id']]; if (!is_array($serendipity['imageList'][$k]['props']['base_metadata'])) { $serendipity['imageList'][$k]['metadata'] =& serendipity_getMetaData($serendipity['imageList'][$k]['realfile'], $serendipity['imageList'][$k]['header']); } else { $serendipity['imageList'][$k]['metadata'] = $serendipity['imageList'][$k]['props']['base_metadata']; serendipity_plugin_api::hook_event('media_getproperties_cached', $serendipity['imageList'][$k]['metadata'], $serendipity['imageList'][$k]['realfile']); } serendipity_parseMediaProperties($dprops, $keywords, $serendipity['imageList'][$k], $serendipity['imageList'][$k]['props'], 3, false); } } } $smarty_vars = array('limit_path' => $limit_path, 'perPage' => $perPage, 'show_upload' => $show_upload, 'page' => $page, 'pages' => $pages, 'linkNext' => $linkNext, 'linkPrevious' => $linkPrevious, 'extraParems' => $extraParems); return serendipity_showMedia($serendipity['imageList'], $paths, $url, $manage, $lineBreak, true, $smarty_vars, $smarty_display); }
function event_hook($event, &$bag, &$eventData, $addData = null) { global $serendipity; $hooks =& $bag->get('event_hooks'); if (isset($hooks[$event])) { switch ($event) { case 'backend_sidebar_entries': if ($serendipity['version'][0] < 2) { ?> <li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=adminnotes"><?php echo PLUGIN_ADMINNOTES_TITLE; ?> </a></li> <?php } // Serendipity 2.0 now uses the new backend_sidebar_admin hook break; case 'backend_sidebar_admin': if ($serendipity['version'][0] > 1) { ?> <li><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=adminnotes"><?php echo PLUGIN_ADMINNOTES_TITLE; ?> </a></li> <?php } break; case 'backend_sidebar_entries_event_display_adminnotes': $this->shownotes(); break; case 'js_backend': ?> /* serendipity_event_adminnotes (quicknotes) start */ function fulltext_toggle(id) { if ( document.getElementById(id + '_full').style.display == '' ) { document.getElementById(id + '_full').style.display='none'; document.getElementById(id + '_summary').style.display=''; document.getElementById(id + '_text').innerHTML = '<?php echo TOGGLE_ALL; ?> '; } else { document.getElementById(id + '_full').style.display=''; document.getElementById(id + '_summary').style.display='none'; document.getElementById(id + '_text').innerHTML = '<?php echo HIDE; ?> '; } return false; } /* serendipity_event_adminnotes (quicknotes) end */ <?php break; case 'backend_frontpage_display': if ($serendipity['version'][0] > 1) { break; } ?> <script type="text/javascript"> function fulltext_toggle(id) { if ( document.getElementById(id + '_full').style.display == '' ) { document.getElementById(id + '_full').style.display='none'; document.getElementById(id + '_summary').style.display=''; document.getElementById(id + '_text').innerHTML = '<?php echo TOGGLE_ALL; ?> '; } else { document.getElementById(id + '_full').style.display=''; document.getElementById(id + '_summary').style.display='none'; document.getElementById(id + '_text').innerHTML = '<?php echo HIDE; ?> '; } return false; } </script> <?php $cutoff = $this->get_config('cutoff'); $notes = $this->getMyNotes(); $zoom = serendipity_getTemplateFile('admin/img/zoom.png'); if (is_array($notes)) { foreach ($notes as $id => $note) { echo '<div class="serendipity_note note_' . $this->output($note['notetype']) . ' note_owner_' . $note['authorid'] . ($serendipity['COOKIE']['lastnote'] < $note['noteid'] ? ' note_new' : '') . '">' . "\n"; echo ' <div class="note_subject"><strong>' . $this->output($note['subject']) . '</strong> ' . POSTED_BY . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($note['realname']) : htmlspecialchars($note['realname'], ENT_COMPAT, LANG_CHARSET)) . ' ' . ON . ' ' . serendipity_strftime(DATE_FORMAT_SHORT, $note['notetime']) . '</div>' . "\n"; if (strlen($note['body']) > $cutoff) { $output = $this->output($note['body']); echo ' <div id="' . $id . '_full" style="display: none" class="note_body">' . $output . '</div>' . "\n"; echo ' <div id="' . $id . '_summary" class="note_body">' . serendipity_mb('substr', $output, 0, $cutoff) . '...</div>' . "\n"; echo ' <div class="note_summarylink"><a href="#' . $id . '_full" onclick="fulltext_toggle(' . $id . '); return false;" title="' . VIEW . '" class="serendipityIconLink"><img src="' . $zoom . '" alt="' . TOGGLE_ALL . '" /><span id="' . $id . '_text">' . TOGGLE_ALL . '</span></a></div>'; } else { echo ' <div class="note_body">' . $this->output($note['body']) . '</div>' . "\n"; } echo "</div>\n"; } serendipity_JSsetCookie('lastnote', $notes[0]['noteid']); } break; case 'backend_dashboard': $cutoff = $this->get_config('cutoff'); $notes = $this->getMyNotes(); if (is_array($notes)) { ?> <section id="dashboard_quicknotes" class="equal_heights quick_list dashboard_widget"> <h3><?php echo PLUGIN_ADMINNOTES_TITLE; ?> </h3> <ol class="plainList"> <?php foreach ($notes as $id => $note) { ?> <li class="serendipity_note note_<?php echo $this->output($note['notetype']); ?> note_owner_<?php echo $note['authorid'] . ($serendipity['COOKIE']['lastnote'] < $note['noteid'] ? ' note_new' : ''); ?> "> <div class="note_subject"> <h3><?php echo $this->output($note['subject']); ?> </h3> <?php echo POSTED_BY . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($note['realname']) : htmlspecialchars($note['realname'], ENT_COMPAT, LANG_CHARSET)) . ' ' . ON . ' ' . serendipity_strftime(DATE_FORMAT_SHORT, $note['notetime']) . "\n"; ?> </div> <?php if (strlen($note['body']) > $cutoff) { $output = $this->output($note['body']); ?> <div id="<?php echo $id; ?> _full" style="display: none" class="note_body"> <?php echo $output . "\n"; ?> </div> <div id="<?php echo $id; ?> _summary" class="note_body"> <?php echo serendipity_mb('substr', $output, 0, $cutoff) . "…\n"; ?> </div> <div class="note_summarylink"> <button class="button_link toggle_comment_full" type="button" onclick="fulltext_toggle(<?php echo $id; ?> ); return false;" data-href="#qn<?php echo $id; ?> _full" title="<?php echo TOGGLE_ALL; ?> "><span class="icon-right-dir"></span><span class="visuallyhidden"> <?php echo TOGGLE_ALL; ?> </span></button> </div> <?php } else { ?> <div class="note_body"> <?php echo $this->output($note['body']) . "\n"; ?> </div> <?php } ?> </li> <?php } ?> </ol> </section> <?php serendipity_JSsetCookie('lastnote', $notes[0]['noteid']); } break; case 'css_backend': if (!strpos($eventData, '.note_')) { echo "\n/* plugin adminnotes start */\n"; // class exists in CSS, so a user has customized it and we don't need default if ($serendipity['version'][0] < 2) { echo file_get_contents(dirname(__FILE__) . '/notes.css'); } else { ?> .note_subject { margin: 0px 0px 1em; } .note_subject h3 { line height: 1.6; margin: 0; } .note_new { border: 2px solid rgb(0, 255, 0); margin: -0.2em; padding: 0.2em; } <?php } echo "/* plugin adminnotes end */\n\n"; } break; } } return true; }