smartified entries.inc
Well to be honest, I had to cheat a little bit and add two Serendipity API functions to the list of allowed php functions in smarty secure mode.
This commit is contained in:
include/admin
@ -1,6 +1,4 @@
|
||||
<?php # $Id$
|
||||
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
|
||||
# All rights reserved. See LICENSE file for licensing details
|
||||
|
||||
if (IN_serendipity !== true) {
|
||||
die ("Don't hack!");
|
||||
@ -97,94 +95,31 @@ function serendipity_drawList() {
|
||||
$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('', 'hidden', 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>
|
||||
$users = serendipity_fetchUsers('', 'hidden', true);
|
||||
$categories = serendipity_fetchCategories();
|
||||
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
|
||||
|
||||
// set smarty flag $config_booleanize = true; in backend only? how?
|
||||
#$data[''] = '';
|
||||
$serendipity['smarty']->assign( array(
|
||||
'drawList' => true,
|
||||
'entries' => $entries,
|
||||
'sort_order' => $sort_order,
|
||||
'per_page' => $per_page,
|
||||
'urltoken' => serendipity_setFormToken('url'),
|
||||
'formtoken' => serendipity_setFormToken(),
|
||||
'users' => $users,
|
||||
'categories' => $categories,
|
||||
'offSet' => $offSet,
|
||||
'use_iframe' => $serendipity['use_iframe']
|
||||
)
|
||||
);
|
||||
|
||||
<table class="serendipity_admin_list" cellpadding="5" width="100%">
|
||||
<?php
|
||||
if (is_array($entries)) {
|
||||
$count = count($entries);
|
||||
$data['is_entries'] = true;
|
||||
$data['count'] = count($entries);
|
||||
|
||||
$qString = '?serendipity[adminModule]=entries&serendipity[adminAction]=editSelect';
|
||||
foreach ((array)$serendipity['GET']['sort'] as $k => $v) {
|
||||
$qString .= '&serendipity[sort]['. $k .']='. $v;
|
||||
@ -192,167 +127,63 @@ function serendipity_drawList() {
|
||||
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
|
||||
$data['linkPrevious'] = $qString . '&serendipity[page]=' . ($page-1);
|
||||
$data['linkNext'] = $qString . '&serendipity[page]=' . ($page+1);
|
||||
|
||||
// Print the entries
|
||||
$rows = 0;
|
||||
foreach ($entries as $entry) {
|
||||
$rows++;
|
||||
if ($rows > $perPage) {
|
||||
continue;
|
||||
}
|
||||
$entry = array();
|
||||
foreach ($entries as $ey) {
|
||||
// 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>';
|
||||
if ($ey['timestamp'] <= ($ey['last_modified'] - 60*30)) {
|
||||
$lm = '<a href="#" title="' . LAST_UPDATED . ': ' . serendipity_formatTime(DATE_FORMAT_SHORT, $ey['last_modified']) . '" onclick="alert(this.title)"><img src="'. serendipity_getTemplateFile('admin/img/clock.png') .'" alt="*" /></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> ';
|
||||
if (!$serendipity['showFutureEntries'] && $ey['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="*" /></a> ';
|
||||
} else {
|
||||
$entry_pre = '';
|
||||
}
|
||||
|
||||
if (serendipity_db_bool($entry['properties']['ep_is_sticky'])) {
|
||||
if (serendipity_db_bool($ey['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);
|
||||
if (count($ey['categories'])) {
|
||||
$cats = array();
|
||||
foreach ($ey['categories'] as $cat) {
|
||||
$caturl = serendipity_categoryURL($cat);
|
||||
$cats[] = '<a href="' . $caturl . '">' . htmlspecialchars($cat['category_name']) . '</a>';
|
||||
}
|
||||
$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'];
|
||||
?>
|
||||
$entry_cats = implode(', ', $cats);
|
||||
}
|
||||
|
||||
$entry[] = array(
|
||||
'clock' => $entry_pre,
|
||||
'id' => $ey['id'],
|
||||
'title' => htmlspecialchars($ey['title']),
|
||||
'pubdate' => date("c", (int)$ey['timestamp']),
|
||||
'stime' => serendipity_formatTime(DATE_FORMAT_SHORT, $ey['timestamp']) . ' ' .$lm,
|
||||
'author' => htmlspecialchars($ey['author']),
|
||||
'cats' => $entry_cats,
|
||||
'link' => serendipity_archiveURL($ey['id'], $ey['title'], 'serendipityHTTPPath', true, array('timestamp' => $ey['timestamp'])),
|
||||
'draft_pre' => ((serendipity_db_bool($ey['isdraft']) || (!$serendipity['showFutureEntries'] && $ey['timestamp'] >= serendipity_serverOffsetHour())) ? true : false),
|
||||
'link' => serendipity_archiveURL($ey['id'], $ey['title'], 'serendipityHTTPPath', true, array('timestamp' => $ey['timestamp'])),
|
||||
'preview_link' => '?serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=preview&serendipity[id]=' . $ey['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']; ?>&<?php echo serendipity_setFormToken('url'); ?>" 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>
|
||||
$serendipity['smarty']->assign(
|
||||
array( 'urltoken' => serendipity_setFormToken('url'),
|
||||
'formtoken' => serendipity_setFormToken(),
|
||||
'serverOffsetHours' => serendipity_serverOffsetHour(),
|
||||
'showFutureEntries' => $serendipity['showFutureEntries']
|
||||
));
|
||||
|
||||
} // entries end
|
||||
|
||||
<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
|
||||
} // End function serendipity_drawList()
|
||||
|
||||
if (!empty($serendipity['GET']['editSubmit'])) {
|
||||
@ -412,17 +243,20 @@ switch($serendipity['GET']['adminAction']) {
|
||||
|
||||
// Save the entry, or just display a preview
|
||||
$use_legacy = true;
|
||||
$data['use_legacy'] = $use_legacy;
|
||||
serendipity_plugin_api::hook_event('backend_entry_iframe', $use_legacy);
|
||||
|
||||
if ($use_legacy) {
|
||||
if ($serendipity['POST']['preview'] != 'true') {
|
||||
/* We don't need an iframe to save a draft */
|
||||
if ( $serendipity['POST']['isdraft'] == 'true' ) {
|
||||
echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
|
||||
$data['is_draft'] = true;
|
||||
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
|
||||
serendipity_updertEntry($entry);
|
||||
} else {
|
||||
if ($serendipity['use_iframe']) {
|
||||
echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE . '</div><br />';
|
||||
$data['is_iframe'] = true;
|
||||
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE . '</div><br />';
|
||||
serendipity_iframe_create('save', $entry);
|
||||
} else {
|
||||
serendipity_iframe($entry, 'save');
|
||||
@ -479,7 +313,8 @@ switch($serendipity['GET']['adminAction']) {
|
||||
}
|
||||
|
||||
if ($serendipity['use_iframe']) {
|
||||
echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_PREVIEW . '</div><br />';
|
||||
$data['is_iframepreview'] = true;
|
||||
#echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_PREVIEW . '</div><br />';
|
||||
serendipity_iframe_create('preview', $entry);
|
||||
} else {
|
||||
serendipity_iframe($entry, 'preview');
|
||||
@ -504,7 +339,6 @@ switch($serendipity['GET']['adminAction']) {
|
||||
'serendipity[adminAction]' => 'save',
|
||||
'serendipity[timestamp]' => $entry['timestamp']
|
||||
),
|
||||
|
||||
$entry
|
||||
);
|
||||
}
|
||||
@ -518,8 +352,9 @@ switch($serendipity['GET']['adminAction']) {
|
||||
|
||||
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
|
||||
serendipity_deleteEntry((int)$serendipity['GET']['id']);
|
||||
printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
echo '<br />';
|
||||
$data['is_doDelete'] = true;
|
||||
$data['rip_entry'] = printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
#echo '<br />';
|
||||
$cont_draw = true;
|
||||
|
||||
case 'doMultiDelete':
|
||||
@ -529,13 +364,15 @@ switch($serendipity['GET']['adminAction']) {
|
||||
}
|
||||
|
||||
$parts = explode(',', $serendipity['GET']['id']);
|
||||
$data['rip_entry'] = array();
|
||||
foreach($parts AS $id) {
|
||||
$id = (int)$id;
|
||||
if ($id > 0) {
|
||||
$entry = serendipity_fetchEntry('id', $id, 1, 1);
|
||||
serendipity_deleteEntry((int)$id);
|
||||
printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
echo '<br />';
|
||||
$data['is_doMultiDelete'] = true;
|
||||
$data['rip_entry'][] = printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
#echo '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -551,16 +388,9 @@ switch($serendipity['GET']['adminAction']) {
|
||||
$newLoc = '?' . serendipity_setFormToken('url') . '&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=doDelete&serendipity[id]=' . (int)$serendipity['GET']['id'];
|
||||
|
||||
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
|
||||
printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
?>
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
<a href="<?php echo htmlspecialchars($_SERVER["HTTP_REFERER"]); ?>" class="serendipityPrettyButton input_button"><?php echo NOT_REALLY; ?></a>
|
||||
<?php echo str_repeat(' ', 10); ?>
|
||||
<a href="<?php echo $newLoc; ?>" class="serendipityPrettyButton input_button"><?php echo DUMP_IT; ?></a>
|
||||
</div>
|
||||
<?php
|
||||
$data['is_delete'] = true;
|
||||
$data['newLoc'] = $newLoc;
|
||||
#printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
break;
|
||||
|
||||
case 'multidelete':
|
||||
@ -569,22 +399,16 @@ switch($serendipity['GET']['adminAction']) {
|
||||
}
|
||||
|
||||
$ids = '';
|
||||
$data['delete_entry'] = array();
|
||||
foreach($serendipity['POST']['multiDelete'] AS $idx => $id) {
|
||||
$ids .= (int)$id . ',';
|
||||
$entry = serendipity_fetchEntry('id', $id, 1, 1);
|
||||
printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
echo '<br />';
|
||||
$data['is_multidelete'] = true;
|
||||
$data['delete_entry'][] = printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
|
||||
#echo '<br />';
|
||||
}
|
||||
$newLoc = '?' . serendipity_setFormToken('url') . '&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=doMultiDelete&serendipity[id]=' . $ids;
|
||||
?>
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
<a href="<?php echo htmlspecialchars($_SERVER["HTTP_REFERER"]); ?>" class="serendipityPrettyButton input_button "><?php echo NOT_REALLY; ?></a>
|
||||
<?php echo str_repeat(' ', 10); ?>
|
||||
<a href="<?php echo $newLoc; ?>" class="serendipityPrettyButton input_button"><?php echo DUMP_IT; ?></a>
|
||||
</div>
|
||||
<?php
|
||||
$data['newLoc'] = $newLoc;
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
@ -603,5 +427,24 @@ switch($serendipity['GET']['adminAction']) {
|
||||
(isset($entry) ? $entry : array())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (!is_object($serendipity['smarty'])) {
|
||||
serendipity_smarty_init();
|
||||
}
|
||||
|
||||
$serendipity['smarty']->assign(
|
||||
array( 'comments' => $comments,
|
||||
'urltoken' => serendipity_setFormToken('url'),
|
||||
'formtoken' => serendipity_setFormToken()
|
||||
));
|
||||
|
||||
$serendipity['smarty']->assign($data);
|
||||
|
||||
$tfile = dirname(__FILE__) . "/tpl/entries.inc.tpl";
|
||||
|
||||
$content = $serendipity['smarty']->fetch('file:'. $tfile); // short notation with Smarty3 in S9y 1.7 and up
|
||||
|
||||
echo $content;
|
||||
|
||||
/* vim: set sts=4 ts=4 expandtab : */
|
||||
?>
|
||||
|
262
include/admin/tpl/entries.inc.tpl
Normal file
262
include/admin/tpl/entries.inc.tpl
Normal file
@ -0,0 +1,262 @@
|
||||
<div class="serendipity_admin_list">
|
||||
|
||||
{if $drawList}
|
||||
|
||||
<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>{$CONST.FILTERS}</strong> - {$CONST.FIND_ENTRIES}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="80">{$CONST.AUTHOR}</td>
|
||||
<td valign="top">
|
||||
<select name="serendipity[filter][author]">
|
||||
<option value="">--</option>
|
||||
{if is_array($users)}
|
||||
{foreach $users AS $user}
|
||||
{if isset($user.artcount) && $user.artcount < 1}
|
||||
{continue}
|
||||
<option value="{$user.authorid}" {(isset($smarty.get.filter.author) && ($smarty.get.filter.author == $user.authorid)) ? 'selected="selected"' : ''}>{$user.realname|escape}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
<select name="serendipity[filter][isdraft]">
|
||||
<option value="all">{$CONST.COMMENTS_FILTER_ALL}</option>
|
||||
<option value="draft" {(isset($smarty.get.filter.isdraft) && ($smarty.get.filter.isdraft == 'draft') ? 'selected="selected"' : '')}>{$CONST.DRAFT}</option>
|
||||
<option value="publish" {(isset($smarty.get.filter.isdraft) && ($smarty.get.filter.isdraft == 'publish') ? 'selected="selected"' : '')}>{$CONST.PUBLISH}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td valign="top" width="80">{$CONST.CATEGORY}</td>
|
||||
<td valign="top">
|
||||
<select name="serendipity[filter][category]">
|
||||
<option value="">--</option>
|
||||
{foreach $categories as $cat}
|
||||
<option value="{$cat.categoryid}"{($smarty.get.filter.category == $cat.categoryid) ? ' selected="selected"' : ''}>{' '|str_repeat:$cat.depth} {$cat.category_name|escape}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
<td valign="top" width="80">{$CONST.CONTENT}</td>
|
||||
<td valign="top"><input class="input_textbox" size="10" type="text" name="serendipity[filter][body]" value="{(isset($smarty.get.filter.body)) ? "$smarty.get.filter.body|escape" : ''}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="serendipity_admin_filters_headline" colspan="6"><strong>{$CONST.SORT_ORDER}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{$CONST.SORT_BY}
|
||||
</td>
|
||||
<td>
|
||||
<select name="serendipity[sort][order]">
|
||||
{foreach $sort_order as $so_key => $so_val}
|
||||
<option value="{$so_key}" {(isset($smarty.get.sort.order) && ($smarty.get.sort.order == $so_key) ? 'selected="selected"': '')}>{$so_val}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
<td>{$CONST.SORT_ORDER}</td>
|
||||
<td>
|
||||
<select name="serendipity[sort][ordermode]">
|
||||
<option value="DESC" {(isset($smarty.get.sort.ordermode) && ($smarty.get.sort.ordermode == 'DESC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_DESC}</option>
|
||||
<option value="ASC" {(isset($smarty.get.sort.ordermode) && ($smarty.get.sort.ordermode == 'ASC') ? 'selected="selected"' : '')}>{$CONST.SORT_ORDER_ASC}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>{$CONST.ENTRIES_PER_PAGE}</td>
|
||||
<td>
|
||||
<select name="serendipity[sort][perPage]">
|
||||
{foreach $per_page AS $per_page_nr}
|
||||
<option value="{$per_page_nr}" {(isset($smarty.get.sort.perPage) && ($smarty.get.sort.perPage == $per_page_nr) ? 'selected="selected"' : '')}>{$per_page_nr}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="6"><input type="submit" name="go" value="{$CONST.GO}" class="serendipityPrettyButton input_button" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
{if is_array($entries)}
|
||||
|
||||
<table class="serendipity_admin_list" cellpadding="5" width="100%">
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
{if $offSet > 0}
|
||||
<a href="{$linkPrevious}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/previous.png'}" />{$CONST.PREVIOUS}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $count > $perPage}
|
||||
<a href="{$linkNext}" class="serendipityIconLinkRight">{$CONST.NEXT}<img src="{serendipity_getFile file='admin/img/next.png'}" /></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<form action="?" method="post" name="formMultiDelete" id="formMultiDelete">
|
||||
{$formtoken}
|
||||
<input type="hidden" name="serendipity[action]" value="admin" />
|
||||
<input type="hidden" name="serendipity[adminModule]" value="entries" />
|
||||
<input type="hidden" name="serendipity[adminAction]" value="multidelete" />
|
||||
|
||||
{foreach $entries as $entry}
|
||||
{if ($entry@index > $perPage)}
|
||||
{continue}
|
||||
{/if}
|
||||
|
||||
<div class="serendipity_admin_list_item serendipity_admin_list_item_{($entry@index % 2) ? 'even' : 'uneven'}">
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="3">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{if (!$serendipity.showFutureEntries) && ($entry.timestamp >= $serverOffsetHour)}<a href="#" title="{$CONST.ENTRY_PUBLISHED_FUTURE}" onclick="alert(this.title)"><img src="{serendipity_getFile file='admin/img/clock_future.png'}" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a> {else}{/if}{if $entry.properties.ep_is_sticky == true} {$CONST.STICKY_POSTINGS}: {/if}{if $entry.isdraft == true}{$CONST.DRAFT}: {/if}<a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]={$entry.id}" title="#{$entry.id}">{$entry.title|escape|truncate:50:"…"}</a></strong>
|
||||
</td>
|
||||
<td align="right">
|
||||
{* Find out if the entry has been modified later than 30 minutes after creation *}
|
||||
{$entry.timestamp|@formatTime:"DATE_FORMAT_SHORT"} {if $entry.timestamp <= ($entry.last_modified - (60*30))}<a href="#" title="{$CONST.LAST_UPDATED}: {$entry.last_modified|@formatTime:"$CONST.DATE_FORMAT_SHORT"}" onclick="alert(this.title)"><img src="{serendipity_getFile file='admin/img/clock.png'}" alt="*" style="border: 0px none ; vertical-align: bottom;" /></a>{else}{/if}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{$CONST.POSTED_BY} {$entry.author|escape}
|
||||
{if count($entry.categories)}
|
||||
{$CONST.IN}
|
||||
{foreach $entry.categories as $cat}
|
||||
{$caturl = serendipity_categoryURL($cat)}{* serendipity_categoryURL($cat) entweder die fnction in security setting aufnehmen oder nachbilden oder raus *}
|
||||
{$cats[] = '<a href="{$caturl}">{$cat.category_name|escape)}</a>'}
|
||||
{/foreach}
|
||||
{foreach $cats AS $implode_cat}
|
||||
{$implode_cat}{if !$implode_cat@last}, {/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{* Smarty3 allows you to {$var = ['foo' => 'bar', 'sub' => [1, 2, 3]]} and {$var.foo = 'other'} *}
|
||||
{* $tst = ['timestamp' => $entry.timestamp] *}
|
||||
|
||||
</td>
|
||||
<td align="right">
|
||||
{if ($entry.isdraft == true) || (!$showFutureEntries && ($entry.timestamp >= $serverOffsetHour))}
|
||||
<a target="_blank" href="?serendipity[noBanner]=true&serendipity[noSidebar]=true&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=preview&serendipity[id]={$entry.id}&{$urltoken}" title="{$CONST.PREVIEW} #{$entry.id}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/zoom.png'}" alt="{$CONST.PREVIEW}" />{$CONST.PREVIEW}</a>
|
||||
{else}
|
||||
<a target="_blank" href="{serendipity_archiveURL($entry.id, $entry.title, "serendipityHTTPPath", true, ['timestamp' => $entry.timestamp])}" title="{$CONST.VIEW} #{$entry.id}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/zoom.png'}" alt="{$CONST.VIEW}" />{$CONST.VIEW}</a>
|
||||
{/if}
|
||||
<a href="?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]={$entry.id}" title="{$CONST.EDIT} #{$entry.id}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/edit.png'}" alt="{$CONST.EDIT}" />{$CONST.EDIT}</a>
|
||||
<a href="?{$urltoken}&serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=delete&serendipity[id]={$entry.id}" title="{$CONST.DELETE} #{$entry.id}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/delete.png'}" alt="{$CONST.DELETE}" />{$CONST.DELETE}</a>
|
||||
<input class="input_checkbox" type="checkbox" name="serendipity[multiDelete][]" value="{$entry.id}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
{/foreach}
|
||||
|
||||
{/if} {* end entries output *}
|
||||
|
||||
<table class="serendipity_admin_list" cellpadding="5" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
{if $offSet > 0}
|
||||
<a href="{$linkPrevious}" class="serendipityIconLink"><img src="{serendipity_getFile file='admin/img/previous.png'}" />{$CONST.PREVIOUS}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $count > $perPage}
|
||||
<a href="{$linkNext}" class="serendipityIconLinkRight">{$CONST.NEXT}<img src="{serendipity_getFile file='admin/img/next.png'}" /></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="serendipity_admin_list" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<input type="button" name="toggle" value="{$CONST.INVERT_SELECTIONS}" onclick="invertSelection()" class="serendipityPrettyButton input_button" />
|
||||
<input type="submit" name="toggle" value="{$CONST.DELETE_SELECTED_ENTRIES}" class="serendipityPrettyButton input_button" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="serendipity_admin_list_item serendipity_admin_list_item_{(($entry@index+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" />
|
||||
{$CONST.EDIT_ENTRY}: #<input class="input_textbox" type="text" size="3" name="serendipity[id]" /> <input type="submit" name="serendipity[editSubmit]" value="{$CONST.GO}" class="serendipityPrettyButton input_button" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{else}
|
||||
{* We've got nothing *}
|
||||
<table class="serendipity_admin_list" cellpadding="0" width="100%">
|
||||
|
||||
<tr>
|
||||
<td align="center" class="serendipityAdminMsgNote">
|
||||
<img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_note.png'}" alt="" />
|
||||
{$CONST.NO_ENTRIES_TO_PRINT}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
{/if}{* $drawList end *}
|
||||
|
||||
</div><!-- // div.serendipity_admin_list end -->
|
||||
|
||||
{if ($marty.get.adminAction && $use_legacy)}
|
||||
{if $is_Draft}
|
||||
<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_success.png'}" alt="" />{$CONST.IFRAME_SAVE_DRAFT}</div><br />
|
||||
{/if}
|
||||
{if $is_iframe}
|
||||
<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_success.png'}" alt="" />{$CONST.IFRAME_SAVE}</div><br />
|
||||
{/if}
|
||||
{if $is_iframepreview}
|
||||
<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file='admin/img/admin_msg_success.png'}" alt="" />{$CONST.IFRAME_PREVIEW}</div><br />
|
||||
{/if}
|
||||
{/if}
|
||||
{if ($marty.get.adminAction && $is_doDelete)}
|
||||
{foreach $rip_entry AS $rip}
|
||||
{$rip}
|
||||
<br />
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if ($marty.get.adminAction && $is_doMultiDelete)}
|
||||
{foreach $delete_entry AS $erase}
|
||||
{$erase}
|
||||
<br />
|
||||
{/foreach}
|
||||
{/if}
|
||||
{if ($marty.get.adminAction && ( $is_delete || $is_multidelete ))}
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
<a href="{$smarty.server.HTTP_REFERER|escape}" class="serendipityPrettyButton input_button">{$CONST.NOT_REALLY}</a>
|
||||
{' '|str_repeat:10}
|
||||
<a href="{$newLoc}" class="serendipityPrettyButton input_button">{$CONST.DUMP_IT}</a>
|
||||
</div>
|
||||
{/if}
|
Reference in New Issue
Block a user