本文整理汇总了PHP中serendipity_setFormToken函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_setFormToken函数的具体用法?PHP serendipity_setFormToken怎么用?PHP serendipity_setFormToken使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_setFormToken函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'entry_display':
if (!is_array($eventData)) {
return false;
}
$elements = count($eventData);
for ($i = 0; $i < $elements; $i++) {
if (empty($eventData[$i]['body'])) {
continue;
}
# see if we want the edit link. (Only in extended mode)
/* Disable because Serendipity 0.8 delivers this.
if ($addData['extended']) {
if ($_SESSION['serendipityAuthedUser'] === true && ($_SESSION['serendipityUserlevel'] >= USERLEVEL_CHIEF || $_SESSION['serendipityAuthorid'] == $eventData[$i]['authorid'])) {
$eventData[$i]['add_footer'] .= ' | ';
$eventData[$i]['add_footer'] .= '<a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=edit&serendipity[id]=' . $eventData[$i]['id'] . '">';
$eventData[$i]['add_footer'] .= EDIT;
$eventData[$i]['add_footer'] .= '</a>';
}
}
*/
if ($_SESSION['serendipityAuthedUser'] === true && ($_SESSION['serendipityUserlevel'] >= USERLEVEL_CHIEF || $_SESSION['serendipityAuthorid'] == $eventData[$i]['authorid'])) {
if (!isset($eventData[$i]['add_footer'])) {
$eventData[$i]['add_footer'] = '';
}
$eventData[$i]['add_footer'] .= ' | ';
$eventData[$i]['add_footer'] .= '<a href="' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[action]=admin&serendipity[adminModule]=entries&serendipity[adminAction]=delete&serendipity[id]=' . $eventData[$i]['id'] . '&' . serendipity_setFormToken('url') . '">';
$eventData[$i]['add_footer'] .= DELETE;
$eventData[$i]['add_footer'] .= '</a>';
}
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
示例2: showElementEntrylist
function showElementEntrylist($filter = array(), $limit = 0)
{
global $serendipity;
$filter_sql = implode(' AND ', $filter);
$orderby = 'timestamp DESC';
// Fetch the entries
$entries = serendipity_fetchEntries(false, false, $limit, true, false, $orderby, $filter_sql);
$rows = 0;
if (!is_array($entries)) {
return;
}
foreach ($entries as $entry) {
$rows++;
// 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';
?>
">
<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(function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET), 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 . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['author']) : htmlspecialchars($entry['author'], ENT_COMPAT, LANG_CHARSET));
if (count($entry['categories'])) {
echo ' ' . IN . ' ';
$cats = array();
foreach ($entry['categories'] as $cat) {
$caturl = serendipity_categoryURL($cat);
$cats[] = '<a href="' . $caturl . '">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($cat['category_name']) : htmlspecialchars($cat['category_name'], ENT_COMPAT, LANG_CHARSET)) . '</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'];
?>
&<?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>
//.........这里部分代码省略.........
示例3: show_plugins
/**
* Show the list of plugins
*
* Shows a HTML list of all installed plugins, complete with config/delete/sort order options
*
* @access public
* @param boolean Indicates if event plugins (TRUE) or sidebar plugins (FALSE) shall be shown
* @return null
*/
function show_plugins($event_only = false, $sidebars = null)
{
static $opts = array('event' => PLUGIN_ACTIVE, 'eventh' => PLUGIN_INACTIVE);
global $serendipity;
$sql_filter = '';
if (is_array($sidebars)) {
foreach ($sidebars as $sidebar) {
$up = strtoupper($sidebar);
if ($sidebar == 'hide') {
$opts[$sidebar] = HIDDEN;
} elseif (defined('SIDEBAR_' . $up)) {
$opts[$sidebar] = constant('SIDEBAR_' . $up);
} elseif (defined($up)) {
$opts[$sidebar] = constant($up);
} else {
$opts[$sidebar] = $up;
}
$sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' ";
}
}
if (!$event_only) {
$sql = "SELECT * from {$serendipity['dbPrefix']}plugins\n WHERE placement != 'event'\n AND placement != 'eventh'\n " . $sql_filter;
$invisible_plugins = serendipity_db_query($sql);
if (is_array($invisible_plugins)) {
$sidebars[] = 'NONE';
$opts['NONE'] = NONE;
}
}
$eyecandy = !isset($serendipity['eyecandy']) || serendipity_db_bool($serendipity['eyecandy']);
if (!$eyecandy) {
echo ' <form action="?serendipity[adminModule]=plugins" method="post">';
} elseif (!$event_only) {
echo '<script type="text/javascript"> function templatePluginMoverInit() { ';
$is_first = true;
foreach ($sidebars as $sidebar) {
?>
<?php
echo $is_first ? 'var ' : '';
?>
list = document.getElementById("<?php
echo $sidebar;
?>
_col");
DragDrop.makeListContainer(list, 'g1');
list.onDragOver = function() { this.style["border"] = "1px solid #4d759b"; };
list.onDragOut = function() { this.style["border"] = "none"; };
<?php
$is_first = false;
}
echo ' } addLoadEvent(templatePluginMoverInit);</script>';
echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSort(); return true">';
echo ' <input type="hidden" name="serendipity[pluginorder]" id="order" value="" />';
} else {
echo '<script type="text/javascript">addLoadEvent(pluginMoverInitEvent);</script>';
echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSortEvent(); return true">';
echo ' <input type="hidden" name="serendipity[pluginorder]" id="eventorder" value="" />';
}
echo serendipity_setFormToken();
?>
<table class="pluginmanager" border="0" cellpadding="5" cellspacing="3" width="100%">
<tr>
<?php
$errors = array();
/* Block display the plugins per placement location. */
if ($event_only) {
$plugin_placements = array('event', 'eventh');
} else {
$plugin_placements = $sidebars;
}
$total = 0;
foreach ($plugin_placements as $plugin_placement) {
if (!$event_only && $plugin_placement == 'NONE') {
$is_invisible = true;
} else {
$is_invisible = false;
}
$ptitle = $opts[$plugin_placement];
$pid = $plugin_placement;
echo '<td class="pluginmanager_side pluginmanager_' . ($event_only ? 'event' : 'sidebar') . '">';
echo '<div class="heading">' . $ptitle . '</div>';
echo '<ol id="' . $pid . '_col" class="pluginmanager_container">';
if ($is_invisible) {
$plugins = $invisible_plugins;
} else {
$plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
}
if (!is_array($plugins)) {
continue;
}
$sort_idx = 0;
foreach ($plugins as $plugin_data) {
//.........这里部分代码省略.........
示例4: serendipity_showMedia
/**
* Prints a media item
*
* @param array Array of image metadata
* @param string URL for maintenance tasks
* @param boolean Whether to show maintenance task items
* @param int how many media items to display per row
* @param boolean Enclose within a table cell?
* @param array Additional Smarty variables
* @return string Generated HTML
*
*/
function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lineBreak = 3, $enclose = true, $smarty_vars = array())
{
global $serendipity;
$form_hidden = '';
// do not add, if not for the default media list form
if (($serendipity['GET']['adminAction'] == 'default' || empty($serendipity['GET']['adminAction'])) && !$serendipity['GET']['fid']) {
foreach ($serendipity['GET'] as $g_key => $g_val) {
// do not add token, since this is assigned separately to properties and list forms
if (!is_array($g_val) && $g_key != 'page' && $g_key != 'token') {
$form_hidden .= ' <input type="hidden" name="serendipity[' . $g_key . ']" value="' . serendipity_specialchars($g_val) . '">' . "\n";
}
}
}
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
$order_fields = serendipity_getImageFields();
// reset filename for building template filters, since this is hardcoded as 'only_filename'
unset($order_fields['i.name']);
$media = array('manage' => $manage, 'multiperm' => serendipity_checkPermission('adminImagesDirectories'), 'lineBreak' => $lineBreak, 'lineBreakP' => round(1 / $lineBreak * 100), 'url' => $url, 'enclose' => $enclose, 'token' => serendipity_setFormToken(), 'form_hidden' => $form_hidden, 'blimit_path' => empty($smarty_vars['limit_path']) ? '' : basename($smarty_vars['limit_path']), 'only_path' => $serendipity['GET']['only_path'], 'only_filename' => $serendipity['GET']['only_filename'], 'sortorder' => $serendipity['GET']['sortorder'], 'keywords_selected' => $serendipity['GET']['keywords'], 'filter' => $serendipity['GET']['filter'], 'sort_order' => $order_fields, 'simpleFilters' => $serendipity['simpleFilters'], 'hideSubdirFiles' => $serendipity['GET']['hideSubdirFiles'], 'authors' => serendipity_fetchUsers(), 'sort_row_interval' => array(8, 16, 50, 100), 'nr_files' => count($file), 'keywords' => explode(';', $serendipity['mediaKeywords']), 'thumbSize' => $serendipity['thumbSize'], 'sortParams' => array('perpage', 'order', 'ordermode'));
$media = array_merge($media, $smarty_vars);
$media['files'] =& $file;
if (count($paths) > 0) {
$media['paths'] =& $paths;
} else {
$media['paths'] =& serendipity_getMediaPaths();
}
$serendipity['smarty']->assignByRef('media', $media);
if ($enclose) {
serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
return serendipity_smarty_show('admin/media_pane.tpl');
} else {
serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
return serendipity_smarty_show('admin/media_properties.tpl');
}
}
示例5: serendipity_printEntryForm
/**
* Prints the form for editing/creating new blog entries
*
* This is the core file where your edit form appears. The Heart Of Gold, so to say.
*
* @access public
* @param string The URL where the entry form is submitted to
* @param array An array of hidden input fields that should be passed on to the HTML FORM
* @param array The entry superarray with your entry's contents
* @param string Any error messages that might have occured on the last run
* @return null
*/
function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = array(), $errMsg = "")
{
global $serendipity;
$draftD = '';
$draftP = '';
$categoryselector_expanded = false;
$template_vars = array();
serendipity_plugin_api::hook_event('backend_entryform', $entry);
if (isset($entry['isdraft']) && serendipity_db_bool($entry['isdraft']) || !isset($entry['isdraft']) && $serendipity['publishDefault'] == 'draft') {
$draftD = ' selected="selected"';
$template_vars['draft_mode'] = 'draft';
} else {
$draftP = ' selected="selected"';
$template_vars['draft_mode'] = 'publish';
}
if (isset($entry['moderate_comments']) && serendipity_db_bool($entry['moderate_comments'])) {
$template_vars['moderate_comments'] = true;
$moderate_comments = ' checked="checked"';
} elseif (!isset($entry['moderate_comments']) && ($serendipity['moderateCommentsDefault'] == 'true' || $serendipity['moderateCommentsDefault'] === true)) {
// This is the default on creation of a new entry and depends on the "moderateCommentsDefault" variable of the configuration.
$moderate_comments = ' checked="checked"';
$template_vars['moderate_comments'] = true;
} else {
$moderate_comments = '';
$template_vars['moderate_comments'] = false;
}
if (isset($entry['allow_comments']) && serendipity_db_bool($entry['allow_comments'])) {
$template_vars['allow_comments'] = true;
$allow_comments = ' checked="checked"';
} elseif ((!isset($entry['allow_comments']) || $entry['allow_comments'] !== 'false') && (!isset($serendipity['allowCommentsDefault']) || $serendipity['allowCommentsDefault'] == 'true' || $serendipity['allowCommentsDefault'] === true)) {
// This is the default on creation of a new entry and depends on the "allowCommentsDefault" variable of the configuration.
$template_vars['allow_comments'] = true;
$allow_comments = ' checked="checked"';
} else {
$template_vars['allow_comments'] = false;
$allow_comments = '';
}
// Fix category list. If the entryForm is displayed after a POST request, the additional category information is lost.
if (is_array($entry['categories']) && !is_array($entry['categories'][0])) {
$categories = (array) $entry['categories'];
$entry['categories'] = array();
foreach ($categories as $catid) {
$entry['categories'][] = serendipity_fetchCategoryInfo($catid);
}
}
$selected = array();
if (is_array($entry['categories'])) {
if (count($entry['categories']) > 1) {
$categoryselector_expanded = true;
}
foreach ($entry['categories'] as $cat) {
$selected[] = $cat['categoryid'];
}
}
if (count($selected) > 1 || isset($serendipity['POST']['categories']) && is_array($serendipity['POST']['categories']) && sizeof($serendipity['POST']['categories']) > 1) {
$categoryselector_expanded = true;
}
if (is_array($cats = serendipity_fetchCategories())) {
$cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED);
foreach ($cats as $cat) {
if (in_array($cat['categoryid'], $selected)) {
$cat['is_selected'] = true;
}
$cat['depth_pad'] = str_repeat(' ', $cat['depth']);
$template_vars['category_options'][] = $cat;
}
}
if (!empty($serendipity['GET']['title'])) {
$entry['title'] = utf8_decode(urldecode($serendipity['GET']['title']));
}
if (!empty($serendipity['GET']['body'])) {
$entry['body'] = utf8_decode(urldecode($serendipity['GET']['body']));
}
if (!empty($serendipity['GET']['url'])) {
$entry['body'] .= "\n" . '<a class="block_level" href="' . serendipity_specialchars(utf8_decode(urldecode($serendipity['GET']['url']))) . '">' . $entry['title'] . '</a>';
}
$template_vars['formToken'] = serendipity_setFormToken();
if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation']) {
$template_vars['allowDateManipulation'] = true;
}
if ((!empty($entry['extended']) || !empty($serendipity['COOKIE']['toggle_extended'])) && !$serendipity['wysiwyg']) {
$template_vars['show_wysiwyg'] = true;
}
$template_vars['wysiwyg_advanced'] = true;
$template_vars['timestamp'] = serendipity_serverOffsetHour(isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time());
$template_vars['reset_timestamp'] = serendipity_serverOffsetHour(time());
$template_vars['hiddens'] = $hiddens;
$template_vars['errMsg'] = $errMsg;
//.........这里部分代码省略.........
示例6: serendipity_showMedia
/**
* Prints a media item
*
* @param array Array of image metadata
* @param string URL for maintenance tasks
* @param boolean Whether to show maintenance task items
* @param int how many media items to display per row
* @param boolean Enclose within a table cell?
* @param array Additional Smarty variables
* @param boolean If TRUE, will echo Smarty output.
* @return string Smarty block name
*
*/
function serendipity_showMedia(&$file, &$paths, $url = '', $manage = false, $lineBreak = 3, $enclose = true, $smarty_vars = array(), $smarty_display = true)
{
global $serendipity;
$form_hidden = '';
foreach ($serendipity['GET'] as $g_key => $g_val) {
if (!is_array($g_val) && $g_key != 'page') {
$form_hidden .= '<input type="hidden" name="serendipity[' . $g_key . ']" value="' . htmlspecialchars($g_val) . '" />';
}
}
serendipity_smarty_init();
$media = array('manage' => $manage, 'lineBreak' => $lineBreak, 'lineBreakP' => round(1 / $lineBreak * 100), 'url' => $url, 'enclose' => $enclose, 'zoomIMG' => serendipity_getTemplateFile('admin/img/big_zoom.png'), 'renameIMG' => serendipity_getTemplateFile('admin/img/big_rename.png'), 'resizeIMG' => serendipity_getTemplateFile('admin/img/big_resize.png'), 'rotatecwIMG' => serendipity_getTemplateFile('admin/img/big_rotate_cw.png'), 'rotateccwIMG' => serendipity_getTemplateFile('admin/img/big_rotate_ccw.png'), 'configureIMG' => serendipity_getTemplateFile('admin/img/configure.png'), 'deleteIMG' => serendipity_getTemplateFile('admin/img/big_delete.png'), 'prevIMG' => serendipity_getTemplateFile('admin/img/previous.png'), 'nextIMG' => serendipity_getTemplateFile('admin/img/next.png'), 'token' => serendipity_setFormToken(), 'form_hidden' => $form_hidden, 'blimit_path' => basename($limit_path), 'only_path' => $serendipity['GET']['only_path'], 'only_filename' => $serendipity['GET']['only_filename'], 'sortorder' => $serendipity['GET']['sortorder'], 'keywords_selected' => $serendipity['GET']['keywords'], 'filter' => $serendipity['GET']['filter'], 'sort_order' => serendipity_getImageFields(), 'authors' => serendipity_fetchUsers(), 'sort_row_interval' => array(8, 16, 50, 100), 'nr_files' => count($file), 'keywords' => explode(';', $serendipity['mediaKeywords']));
$media = array_merge($media, $smarty_vars);
$media['files'] =& $file;
if (count($paths) > 0) {
$media['paths'] =& $paths;
} else {
$media['paths'] =& serendipity_getMediaPaths();
}
$serendipity['smarty']->assign_by_ref('media', $media);
if ($enclose) {
serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
$block = 'admin/media_pane.tpl';
if ($smarty_display) {
$serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_pane.tpl', 'serendipityPath'));
}
} else {
serendipity_smarty_fetch('MEDIA_ITEMS', 'admin/media_items.tpl');
$block = 'admin/media_properties.tpl';
if ($smarty_display) {
$serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_properties.tpl', 'serendipityPath'));
}
}
return $block;
}
示例7: serendipity_mb
$comment['fullBody'] = $comment['body'];
$comment['summary'] = serendipity_mb('substr', $comment['body'], 0, 100);
if (strlen($comment['fullBody']) > strlen($comment['summary'])) {
$comment['excerpt'] = true;
// When summary is not the full body, strip HTML tags from summary, as it might break and leave unclosed HTML.
$comment['fullBody'] = nl2br(serendipity_specialchars($comment['fullBody']));
$comment['summary'] = nl2br(strip_tags($comment['summary']));
}
}
}
$data['comments'] = $comments;
$entries = serendipity_fetchEntries(false, false, (int) $serendipity['dashboardLimit'], true, false, 'timestamp DESC', 'e.timestamp >= ' . serendipity_serverOffsetHour());
$entriesAmount = count($entries);
if ($entriesAmount < (int) $serendipity['dashboardDraftLimit']) {
// there is still space for drafts
$drafts = serendipity_fetchEntries(false, false, (int) $serendipity['dashboardDraftLimit'] - $entriesAmount, true, false, 'timestamp DESC', "isdraft = 'true' AND e.timestamp <= " . serendipity_serverOffsetHour());
if (is_array($entries) && is_array($drafts)) {
$entries = array_merge($entries, $drafts);
} else {
if (is_array($drafts)) {
// $entries is not an array, thus empty
$entries = $drafts;
}
}
}
$data['entries'] = $entries;
$data['urltoken'] = serendipity_setFormToken('url');
$data['token'] = serendipity_setFormToken();
$data['no_create'] = $serendipity['no_create'];
echo serendipity_smarty_show('admin/overview.inc.tpl', $data);
/* vim: set sts=4 ts=4 expandtab : */
示例8: serendipity_printEntryForm
//.........这里部分代码省略.........
}
}
if (count($selected) > 1 || isset($serendipity['POST']['categories']) && is_array($serendipity['POST']['categories']) && sizeof($serendipity['POST']['categories']) > 1) {
$categoryselector_expanded = true;
}
if (is_array($cats = serendipity_fetchCategories())) {
$cats = serendipity_walkRecursive($cats, 'categoryid', 'parentid', VIEWMODE_THREADED);
foreach ($cats as $cat) {
if (in_array($cat['categoryid'], $selected)) {
$cat['is_selected'] = true;
}
$cat['depth_pad'] = str_repeat(' ', $cat['depth']);
$template_vars['category_options'][] = $cat;
$cat_list .= '<option value="' . $cat['categoryid'] . '"' . ($cat['is_selected'] ? ' selected="selected"' : '') . '>' . $cat['depth_pad'] . $cat['category_name'] . '</option>' . "\n";
}
}
$cat_list .= '</select>' . $n;
if (!empty($serendipity['GET']['title'])) {
$entry['title'] = utf8_decode(urldecode($serendipity['GET']['title']));
}
if (!empty($serendipity['GET']['body'])) {
$entry['body'] = utf8_decode(urldecode($serendipity['GET']['body']));
}
if (!empty($serendipity['GET']['url'])) {
$entry['body'] .= "\n" . '<br /><a href="' . htmlspecialchars(utf8_decode(urldecode($serendipity['GET']['url']))) . '">' . $entry['title'] . '</a>';
}
$hidden = '';
foreach ($hiddens as $key => $value) {
$hidden .= ' <input type="hidden" name="' . $key . '" value="' . $value . '" />' . $n;
}
$hidden .= ' <input type="hidden" id="entryid" name="serendipity[id]" value="' . (isset($entry['id']) ? $entry['id'] : '') . '" />' . $n;
$hidden .= ' <input type="hidden" name="serendipity[timestamp]" value="' . (isset($entry['timestamp']) ? serendipity_serverOffsetHour($entry['timestamp']) : serendipity_serverOffsetHour(time())) . '" />' . $n;
$hidden .= ' <input type="hidden" name="serendipity[preview]" value="false" />';
$hidden .= ' ' . serendipity_setFormToken();
if (is_object($serendipity['smarty']) || !$_SESSION['no_smarty'] && serendipity_smarty_init()) {
$use_smarty = true;
} else {
$use_smarty = false;
}
if (is_object($serendipity['smarty'])) {
if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation']) {
$template_vars['allowDateManipulation'] = true;
}
if ((!empty($entry['extended']) || !empty($serendipity['COOKIE']['toggle_extended'])) && !$serendipity['wysiwyg']) {
$template_vars['show_wysiwyg'] = true;
}
if (preg_match($serendipity['EditorBrowsers'], $_SERVER['HTTP_USER_AGENT'])) {
$template_vars['wysiwyg_advanced'] = true;
}
$template_vars['timestamp'] = serendipity_serverOffsetHour(isset($entry['timestamp']) && $entry['timestamp'] > 0 ? $entry['timestamp'] : time());
$template_vars['reset_timestamp'] = serendipity_serverOffsetHour(time());
$template_vars['hidden'] = $hidden;
$template_vars['errMsg'] = $errMsg;
$template_vars['entry'] =& $entry;
$template_vars['targetURL'] = $targetURL;
$template_vars['cat_count'] = count($cats) + 1;
$template_vars['cat_state'] = $categoryselector_expanded ? 'on' : 'off';
$template_vars['wysiwyg'] = $serendipity['wysiwyg'];
$template_vars['serendipityRightPublish'] = $_SESSION['serendipityRightPublish'];
$template_vars['wysiwyg_blocks'] = array('body' => 'serendipity[body]', 'extended' => 'serendipity[extended]');
$template_vars['entry_template'] = serendipity_getTemplateFile('admin/entries.tpl', 'serendipityPath');
$serendipity['smarty']->registerPlugin('modifier', 'emit_htmlarea_code', 'serendipity_emit_htmlarea_code');
$serendipity['smarty']->assign('admin_view', 'entryform');
serendipity_plugin_api::hook_event('backend_entryform_smarty', $template_vars);
$serendipity['smarty']->assignByRef('entry_vars', $template_vars);
$serendipity['smarty']->display($template_vars['entry_template']);
示例9: showMediaLibrary
function showMediaLibrary($messages = false, $addvar_check = false)
{
global $serendipity;
if (!serendipity_checkPermission('adminImagesView')) {
return;
}
if (!empty($messages)) {
echo '<div class="imageMessage"><ul>';
foreach ($messages as $message) {
echo '<li>' . $message . '</li>';
}
echo '</ul></div>';
}
// After upload, do not show the list to be able to proceed to
// media selection.
if ($addvar_check && !empty($GLOBALS['image_selector_addvars'])) {
return true;
}
?>
<script type="text/javascript" language="javascript">
<!--
function rename(id, fname) {
if(newname = prompt('<?php
echo ENTER_NEW_NAME;
?>
' + fname, fname)) {
location.href='?<?php
echo serendipity_setFormToken('url');
?>
&serendipity[adminModule]=images&serendipity[adminAction]=rename&serendipity[fid]='+ escape(id) + '&serendipity[newname]='+ escape(newname);
}
}
//-->
</script>
<?php
if (!isset($serendipity['thumbPerPage'])) {
$serendipity['thumbPerPage'] = 2;
}
serendipity_displayImageList(isset($serendipity['GET']['page']) ? $serendipity['GET']['page'] : 1, $serendipity['thumbPerPage'], true);
}
示例10: showevents
function showevents()
{
global $serendipity;
if (!empty($serendipity['POST']['mycalendarAction']) || !empty($serendipity['POST']['event'])) {
$this->createevents();
}
$events = $this->getevents();
$events[] = array('eventid' => 0, 'eventname' => '', 'eventurl' => '', 'eventurltitle' => '', 'eventdate' => time(), 'eventdate2' => time());
echo '<h2>' . PLUGIN_MYCALENDAR_TITLE . '</h2>';
echo PLUGIN_MYCALENDAR_DESC . '<br /><br />';
echo PLUGIN_MYCALENDAR_EVENTLIST . '<br /><br />';
echo '
<script type="text/javascript">
function removeEvent(id) {
document.getElementById(\'eventname_\' + id).value = \'\';
document.getElementById(\'eventurl_\' + id).value = \'\';
document.getElementById(\'eventaction\').value = \'GO\';
document.getElementById(\'eventform\').submit();
}
isOneDayEvent = new Array();
function changeDate(id) {
if (isOneDayEvent[id]) {
document.getElementsByName(\'serendipity[event][\' + id + \'][day2]\')[0].selectedIndex =
document.getElementsByName(\'serendipity[event][\' + id + \'][day]\')[0].selectedIndex;
document.getElementsByName(\'serendipity[event][\' + id + \'][month2]\')[0].selectedIndex =
document.getElementsByName(\'serendipity[event][\' + id + \'][month]\')[0].selectedIndex;
document.getElementsByName(\'serendipity[event][\' + id + \'][year2]\')[0].selectedIndex =
document.getElementsByName(\'serendipity[event][\' + id + \'][year]\')[0].selectedIndex;
}
}
function changeDate2(id) {
isOneDayEvent[id] = false;
}
</script>
<form id="eventform" action="?" method="post">';
echo serendipity_setFormToken();
echo '<div>
<input type="hidden" name="serendipity[adminModule]" value="event_display" />
<input type="hidden" name="serendipity[adminAction]" value="mycalendar" />
</div>
<table align="center" width="100%" cellpadding="10" cellspacing="0">
<tr>
<th>#</th>
<th>' . PLUGIN_MYCALENDAR_EVENTNAME . '</th>
<th>' . PLUGIN_MYCALENDAR_EVENTURI . '</th>
<th>' . PLUGIN_MYCALENDAR_EVENTDATE . '</th>
<th>' . PLUGIN_MYCALENDAR_EVENTDATE2 . '</th>
</tr>';
foreach ($events as $idx => $event) {
$even = $idx % 2 ? 'even' : 'uneven';
$year = date('Y', $event['eventdate']);
$month = date('m', $event['eventdate']);
$day = date('d', $event['eventdate']);
$year2 = date('Y', $event['eventdate2']);
$month2 = date('m', $event['eventdate2']);
$day2 = date('d', $event['eventdate2']);
echo "<tr style='padding: 10px;' class='serendipity_admin_list_item serendipity_admin_list_item_{$even}'>\n";
echo " <td><em>{$idx}</em></td>\n";
echo " <td><input class='input_textbox' id='eventname_{$event['eventid']}' type='text' name=\"serendipity[event][{$event['eventid']}][eventname]\" value=\"" . (function_exists('serendipity_specialchars') ? serendipity_specialchars($event['eventname']) : htmlspecialchars($event['eventname'], ENT_COMPAT, LANG_CHARSET)) . "\" /></td>\n";
echo " <td><input class='input_textbox' id='eventurl_{$event['eventid']}' style='width: 100%' type='text' name=\"serendipity[event][{$event['eventid']}][eventurl]\" value=\"" . (function_exists('serendipity_specialchars') ? serendipity_specialchars($event['eventurl']) : htmlspecialchars($event['eventurl'], ENT_COMPAT, LANG_CHARSET)) . "\" /></td>\n";
echo " <td>";
echo $this->getDropdown('day', $event['eventid'], range(1, 31), $day, false, 'changeDate(' . $event['eventid'] . ')') . ".";
echo $this->getDropdown('month', $event['eventid'], range(1, 12), $month, false, 'changeDate(' . $event['eventid'] . ')') . ".";
echo $this->getDropdown('year', $event['eventid'], range(date('Y'), date('Y') + 2), $year, false, 'changeDate(' . $event['eventid'] . ')');
if ($event['eventdate'] < time() - 86400) {
echo ' <a href="#" onclick="javascript:removeEvent(\'' . $event['eventid'] . '\');"><img src="' . serendipity_getTemplateFile('admin/img/delete.png') . '" alt="' . DELETE . '" border="0" /></a>';
}
echo " </td>\n";
echo " <td>";
echo $this->getDropdown('day2', $event['eventid'], range(1, 31), $day2, false, 'changeDate2(' . $event['eventid'] . ')') . ".";
echo $this->getDropdown('month2', $event['eventid'], range(1, 12), $month2, false, 'changeDate2(' . $event['eventid'] . ')') . ".";
echo $this->getDropdown('year2', $event['eventid'], range(date('Y'), date('Y') + 2), $year2, false, 'changeDate2(' . $event['eventid'] . ')');
echo '<script type="text/javascript">';
if ($event['eventdate'] == $event['eventdate2']) {
echo "isOneDayEvent[{$event['eventid']}] = true;";
} else {
echo "isOneDayEvent[{$event['eventid']}] = false;";
}
echo "</script>";
echo " </td>\n";
echo "</tr>\n";
echo "<tr style='padding: 10px;' class='serendipity_admin_list_item serendipity_admin_list_item_{$even}'>\n";
echo " <td> </td>\n";
echo " <td>" . PLUGIN_MYCALENDAR_EVENTURI_TITLE . ": </td>\n";
echo " <td colspan='3'><input class='input_textbox' style='width: 100%' type='text' name=\"serendipity[event][{$event['eventid']}][eventurltitle]\" value=\"" . (function_exists('serendipity_specialchars') ? serendipity_specialchars($event['eventurltitle']) : htmlspecialchars($event['eventurltitle'], ENT_COMPAT, LANG_CHARSET)) . "\" /></td>\n";
echo "</tr>\n";
}
echo '
<tr>
<td colspan="4"><br />
<input class="serendipityPrettyButton input_button" type="submit" id="eventaction" name="serendipity[mycalendarAction]" value="' . GO . '" />
</td>
</tr>
</table>
</form>';
}
示例11: event_hook
//.........这里部分代码省略.........
$val = $serendipity['GET']['filter']['title'];
$and .= "AND e.title LIKE '%" . serendipity_db_escape_string($val) . "%'";
$searchString .= "&serendipity['filter']['title']=" . htmlspecialchars($val);
}
// Sorting (controls go after filtering controls in form above)
$sort_order = array('votetime' => DATE, 'user_agent' => USER_AGENT, 'title' => TITLE, 'entryid' => 'ID');
if (empty($serendipity['GET']['sort']['ordermode']) || $serendipity['GET']['sort']['ordermode'] != 'ASC') {
$desc = true;
$serendipity['GET']['sort']['ordermode'] = 'DESC';
}
if (!empty($serendipity['GET']['sort']['order']) && !empty($sort_order[$serendipity['GET']['sort']['order']])) {
$curr_order = $serendipity['GET']['sort']['order'];
$orderby = serendipity_db_escape_string($curr_order . ' ' . $serendipity['GET']['sort']['ordermode']);
} else {
$curr_order = 'votetime';
$orderby = 'votetime ' . serendipity_db_escape_string($serendipity['GET']['sort']['ordermode']);
}
print "\n<div>" . SORT_BY . "\n<select name='serendipity[sort][order]'>\n";
foreach ($sort_order as $order => $val) {
print "\n <option value='{$order}'" . ($curr_order == $order ? " selected='selected'" : '') . ">{$val}</option>\n";
}
print "\n</select>\n<select name='serendipity[sort][ordermode]'>\n <option value='DESC'" . ($desc ? "selected='selected'" : '') . ">" . SORT_ORDER_DESC . "</option>\n <option value='ASC'" . ($desc ? '' : "selected='selected'") . ">" . SORT_ORDER_ASC . "</option>\n</select>\n</div>\n<input type='submit' name='submit' value=' - " . GO . " - ' class='serendipityPrettyButton input_button' /> \n</form>\n";
// Paging (partly ripped from include/admin/comments.inc.php)
$commentsPerPage = (int) (!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 25);
$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}karmalog l WHERE 1 = 1 " . $and, true);
$totalVotes = $sql['total'];
$pages = $commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalVotes / (int) $commentsPerPage);
$page = (int) $serendipity['GET']['page'];
if ($page == 0 || $page > $pages) {
$page = 1;
}
if ($page > 1) {
$linkPrevious = $url . '&serendipity[page]=' . ($page - 1) . $searchString;
}
if ($pages > $page) {
$linkNext = $url . '&serendipity[page]=' . ($page + 1) . $searchString;
}
if ($commentsPerPage == COMMENTS_FILTER_ALL) {
$limit = '';
} else {
$limit = serendipity_db_limit_sql(serendipity_db_limit(($page - 1) * (int) $commentsPerPage, (int) $commentsPerPage));
}
// Variables for display
if ($linkPrevious) {
$linkPrevious = '<a href="' . $linkPrevious . '" class="serendipityIconLink"><img src="' . serendipity_getTemplateFile('admin/img/previous.png') . '" /></a>';
} else {
$linkPrevious = ' ';
}
if ($linkNext) {
$linkNext = '<a href="' . $linkNext . '" class="serendipityIconLinkRight"><img src="' . serendipity_getTemplateFile('admin/img/next.png') . '" /></a>';
} else {
$linkNext = ' ';
}
$paging = sprintf(PAGE_BROWSE_COMMENTS, $page, $pages, $totalVotes);
// Retrieve the next batch of karma votes
// [entryid, points, ip, user_agent, votetime]
$sql = serendipity_db_query("SELECT l.entryid AS entryid, l.points AS points, l.ip AS ip, l.user_agent AS user_agent, l.votetime AS votetime, e.title AS title FROM {$serendipity['dbPrefix']}karmalog l\n LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = l.entryid)\n WHERE 1 = 1 " . $and . "\n ORDER BY {$orderby} {$limit}");
// Start the form for display and deleting
if (is_array($sql)) {
print "<form action='' method='post' name='formMultiDelete' id='formMultiDelete'>\n" . serendipity_setFormToken() . "\n<script type='text/javascript'>\nfunction invertSelection() {\n var f = document.formMultiDelete;\n for (var i = 0; i < f.elements.length; i++) {\n if( f.elements[i].type == 'checkbox' ) {\n f.elements[i].checked = !(f.elements[i].checked);\n }\n }\n}\n</script>\n";
// Print the header paging table
print "\n<table width='100%' style='border-collapse: collapse;'>\n <tr>\n <td align='left'>{$linkPrevious}</td>\n <td align='center'>{$paging}</td>\n <td align='right'>{$linkNext}</td>\n </tr>\n</table>\n";
// Start the vote table
print "\n<table class='karmalog' width='100%'>\n";
// Print each vote
$i = 0;
foreach ($sql as $vote) {
$i++;
// entryid, title, points, ip, user_agent, votetime
$entrylink = serendipity_archiveURL($vote['entryid'], $vote['title'], 'serendipityHTTPPath', true);
$entryFilterHtml = "<a class='serendipityIconLink' href='{$url}&serendipity[filter][entryid]={$vote['entryid']}'><img src='" . serendipity_getTemplateFile('admin/img/zoom.png') . "' /></a>";
$ipFilterHtml = "<a class='serendipityIconLink' href='{$url}&serendipity[filter][ip]={$vote['ip']}'><img src='" . serendipity_getTemplateFile('admin/img/zoom.png') . "' /></a>";
$timestr = strftime('%H:%M:%S<br />%n%a %b %d %Y', $vote['votetime']);
$cssClass = 'serendipity_admin_list_item serendipity_admin_list_item_';
$cssClass .= $i % 2 == 0 ? 'even' : 'uneven';
$barClass = str_replace(array('.', ' '), array('_', '_'), $this->image_name);
$barHtml = $this->createRatingBar(null, $vote['points'], 1, $barClass);
$barHtml = sprintf($barHtml, 'what', $vote['points'], '1');
print "\n <tr class='{$cssClass}'>\n <td rowspan='2' width='20' align='center'>\n <input class='input_checkbox' type='checkbox' name='serendipity[delete][{$i}]' value='{$i}' tabindex='{$i}' />\n <input type='hidden' name='serendipity[karmalog{$i}][points]' value='{$vote['points']}' />\n <input type='hidden' name='serendipity[karmalog{$i}][entryid]' value='{$vote['entryid']}' />\n <input type='hidden' name='serendipity[karmalog{$i}][votetime]' value='{$vote['votetime']}' />\n <input type='hidden' name='serendipity[karmalog{$i}][ip]' value='{$vote['ip']}' />\n <input type='hidden' name='serendipity[karmalog{$i}][user_agent]' value='{$vote['user_agent']}' />\n </td>\n <td>{$barHtml}</td>\n <td colspan='2'><a href='{$entrylink}' title='{$vote['entryid']}' alt='{$vote['title']}'>{$vote['title']}</a> {$entryFilterHtml}</td>\n </tr>\n <tr class='{$cssClass}'>\n <td>{$timestr}</td>\n <td>{$vote['ip']} {$ipFilterHtml}</td>\n <td>{$vote['user_agent']}</td>\n </tr>\n";
}
// End the vote table
print "\n </table>\n ";
if (is_array($sql)) {
print "\n<input type='button' name='toggle' value='" . INVERT_SELECTIONS . "' onclick='invertSelection()' class='serendipityPrettyButton input_button' /> \n<input class='serendipityPrettyButton input_button' type='submit' value='" . PLUGIN_KARMA_DELETE_VOTES . "' name='serendipity[delete_button]' />\n<input class='serendipityPrettyButton input_button' type='submit' value='" . PLUGIN_KARMA_APPROVE_VOTES . "' name='serendipity[approve_button]' />\n</form>\n";
}
// Print the footer paging table
print "\n<table width='100%' style='border-collapse: collapse;'>\n <tr>\n <td align='left'>{$linkPrevious}</td>\n <td align='center'>{$paging}</td>\n <td align='right'>{$linkNext}</td>\n </tr>\n</table>\n";
} else {
print "\n<div class='serendipityAdminMsgNotice'>No entries to display.</div>\n";
}
return true;
break;
default:
return false;
}
// End switch on event hooks
} else {
return false;
}
}
示例12: template_option
$template_loaded_config = NULL;
}
}
if (is_array($template_config)) {
serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config);
$data["has_config"] = true;
if ($serendipity['POST']['adminAction'] == 'configure' && serendipity_checkFormToken()) {
$storage = new template_option();
$storage->import($template_config);
foreach ($serendipity['POST']['template'] as $option => $value) {
$storage->set_config($option, $value);
}
$data["adminAction"] = "configure";
$data["save_time"] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
}
$data["form_token"] = serendipity_setFormToken();
include_once S9Y_INCLUDE_PATH . 'include/functions_plugins_admin.inc.php';
$template_vars =& serendipity_loadThemeOptions($template_config);
$template_options = new template_option();
$template_options->import($template_config);
$template_options->values =& $template_vars;
$data["configuration"] = serendipity_plugin_config($template_options, $template_vars, $serendipity['template'], $serendipity['template'], $template_options->keys, true, true, true, true, 'template', $template_config_groups);
serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
} else {
serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
}
$i = 0;
$stack = array();
serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
$themes = serendipity_fetchTemplates();
$data['templates'] = array();
示例13: serendipity_setFormToken
?>
" alt="<?php
echo DELETE;
?>
" /><?php
echo DELETE;
?>
</a>
<a target="_blank" onclick="cf = window.open(this.href, 'CommentForm', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1'); cf.focus(); return false;" href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=reply&serendipity[id]=<?php
echo $comment['id'];
?>
&serendipity[entry_id]=<?php
echo $comment['entry_id'];
?>
&serendipity[noBanner]=true&serendipity[noSidebar]=true&<?php
echo serendipity_setFormToken('url');
?>
" title="<?php
echo REPLY;
?>
" class="serendipityIconLink"><img src="<?php
echo serendipity_getTemplateFile('admin/img/user_editor.png');
?>
" alt="<?php
echo REPLY;
?>
" /><?php
echo REPLY;
?>
</a>
<?php
示例14: serendipity_smarty_init
serendipity_smarty_init();
if (empty($serendipity['GET']['step']) && $serendipity['GET']['page'] < 1) {
$media = array('GET_STRING' => serendipity_build_query($_GET), 'frameset' => true);
$serendipity['smarty']->assign_by_ref('media', $media);
$serendipity['smarty']->display(serendipity_getTemplateFile('admin/media_choose.tpl', 'serendipityPath'));
return;
}
$import_vars = $serendipity['GET'];
unset($import_vars['step']);
unset($import_vars['only_path']);
$showFile = 'admin/media_choose.tpl';
$body_id = 'serendipityAdminBodyImageSelector';
if ($serendipity['GET']['step'] === 'tree') {
$body_id = 'serendipityAdminBodyImageSelectorTree';
}
$media = array('body_id' => $body_id, 'only_path' => $serendipity['GET']['only_path'], 'css' => serendipity_rewriteURL('serendipity_admin.css'), 'css_tree' => serendipity_getTemplateFile('treeview/tree.css'), 'css_front' => serendipity_rewriteURL('serendipity.css'), 'token_url' => serendipity_setFormToken('url'), 'imgID' => (int) $serendipity['GET']['image'], 'from' => $serendipity['GET']['from'], 'GET_STRING' => serendipity_build_query($import_vars, 'serendipity', '&'), 'paths' => serendipity_getMediaPaths());
switch ($serendipity['GET']['step']) {
case '1':
if (isset($serendipity['GET']['adminAction'])) {
// Embedded upload form
if (!empty($serendipity['POST']['textarea'])) {
$serendipity['GET']['textarea'] = $serendipity['POST']['textarea'];
}
if (!empty($serendipity['POST']['htmltarget'])) {
$serendipity['GET']['htmltarget'] = $serendipity['POST']['htmltarget'];
}
if (!empty($serendipity['POST']['filename_only'])) {
$serendipity['GET']['filename_only'] = $serendipity['POST']['filename_only'];
}
$image_selector_addvars = array('step' => 1, 'textarea' => !empty($serendipity['GET']['textarea']) ? $serendipity['GET']['textarea'] : '', 'htmltarget' => !empty($serendipity['GET']['htmltarget']) ? $serendipity['GET']['htmltarget'] : '', 'filename_only' => !empty($serendipity['GET']['filename_only']) ? $serendipity['GET']['filename_only'] : '');
switch ($serendipity['GET']['adminAction']) {
示例15: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
// called when admin sidebar is being "built"
case 'backend_sidebar_entries_images':
?>
<li class="serendipitySideBarMenuLink serendipitySideBarMenuMediaLinks"><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=flickr">
<?php
echo PLUGIN_EVENT_FLICKR_NAME;
?>
</a></li><?php
break;
// called when admin sidebar is been "drawn"
// called when admin sidebar is been "drawn"
case 'backend_sidebar_entries_event_display_flickr':
// he, is user allowed to import images ?!?
if (!serendipity_checkPermission('adminImagesAdd')) {
// TODO: add a message to the user ?!?
break;
}
// if method is POST, we must have a valid form token !
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !serendipity_checkFormToken()) {
// TODO: add a message to the user ?!?
break;
}
?>
<?php
echo PLUGIN_EVENT_FLICKR_IMPORT_BLAHBLAH;
?>
<script type="text/javascript">
function flickr_showPage(p) {
var f = document.getElementById('flickr_uploadform');
f.elements['serendipity[flickr_page]'].value = p;
f.submit();
}
function flickr_doImport(url) {
var f = document.getElementById('flickr_uploadform');
f.elements['serendipity[adminModule]'].value = 'images';
f.elements['serendipity[adminAction]'].value = 'add';
f.elements['serendipity[imageurl]'].value = url;
f.submit();
}
function flickr_toggleExtended() {
var d = document.getElementById('flickr_extendedCriteria');
d.style.display = (d.style.display != '') ? '' : 'none';
}
</script>
<h3><? echo PLUGIN_EVENT_FLICKR_IMPORT; ?></h3>
<form action="?" method="POST" id="flickr_uploadform" enctype="multipart/form-data" onsubmit="">
<?php
echo serendipity_setFormToken();
?>
<?php
// these two fields will only be used when an image has been chosen for dl
?>
<input type="hidden" name="serendipity[imageurl]" value="" />
<input type="hidden" name="serendipity[imageimporttype]" value="image" />
<input type="hidden" name="serendipity[action]" value="admin" />
<input type="hidden" name="serendipity[adminModule]" value="event_display" />
<input type="hidden" name="serendipity[adminAction]" value="flickr" />
<input type="hidden" name="serendipity[flickr_page]" value="1" />
Flickr username: <input class="input_textbox" name="serendipity[flickr_username]" value="<?php
echo function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['POST']['flickr_username']) : htmlspecialchars($serendipity['POST']['flickr_username'], ENT_COMPAT, LANG_CHARSET);
?>
" />
<input type="submit" value="<?php
echo GO;
?>
" class="serendipityPrettyButton input_button" /><br /><br />
<a style="border: 0pt none ; text-decoration: none;" href="#" onclick="flickr_toggleExtended(); return false"
title="<?php
echo TOGGLE_OPTION;
?>
">
<img border="0" src="<?php
echo serendipity_getTemplateFile('img/plus.png');
?>
" /> <?php
echo TOGGLE_ALL;
?>
</a>
<div id="flickr_extendedCriteria" <?php
echo strlen($serendipity['POST']['flickr_username']) ? '' : 'style="display:none;"';
?>
>
<p><?php
echo PLUGIN_EVENT_FLICKR_TAGS;
?>
<input class="input_textbox" name="serendipity[flickr_tags]" value="<?php
echo function_exists('serendipity_specialchars') ? serendipity_specialchars($serendipity['POST']['flickr_tags']) : htmlspecialchars($serendipity['POST']['flickr_tags'], ENT_COMPAT, LANG_CHARSET);
?>
" />
<?php
echo PLUGIN_EVENT_FLICKR_KEYWORDS;
?>
//.........这里部分代码省略.........