Fix bugs in the new backend templates
This commit is contained in:
@@ -132,9 +132,10 @@ function &serendipity_convertToTimestamp($in) {
|
|||||||
* @param string Output format for the timestamp
|
* @param string Output format for the timestamp
|
||||||
* @param int Timestamp to use for displaying
|
* @param int Timestamp to use for displaying
|
||||||
* @param boolean Indicates, if timezone calculations shall be used.
|
* @param boolean Indicates, if timezone calculations shall be used.
|
||||||
|
* @param boolean Whether to use strftime or simply date
|
||||||
* @return string The formatted timestamp
|
* @return string The formatted timestamp
|
||||||
*/
|
*/
|
||||||
function serendipity_strftime($format, $timestamp = null, $useOffset = true) {
|
function serendipity_strftime($format, $timestamp = null, $useOffset = true, $useDate = false) {
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
static $is_win_utf = null;
|
static $is_win_utf = null;
|
||||||
|
|
||||||
@@ -143,27 +144,31 @@ function serendipity_strftime($format, $timestamp = null, $useOffset = true) {
|
|||||||
$is_win_utf = (LANG_CHARSET == 'UTF-8' && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false);
|
$is_win_utf = (LANG_CHARSET == 'UTF-8' && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($serendipity['calendar']) {
|
if ($useDate) {
|
||||||
default:
|
$out = date($format, $timestamp);
|
||||||
case 'gregorian':
|
} else {
|
||||||
if ($timestamp == null) {
|
switch($serendipity['calendar']) {
|
||||||
$timestamp = serendipity_serverOffsetHour();
|
default:
|
||||||
} elseif ($useOffset) {
|
case 'gregorian':
|
||||||
$timestamp = serendipity_serverOffsetHour($timestamp);
|
if ($timestamp == null) {
|
||||||
}
|
$timestamp = serendipity_serverOffsetHour();
|
||||||
$out = strftime($format, $timestamp);
|
} elseif ($useOffset) {
|
||||||
break;
|
$timestamp = serendipity_serverOffsetHour($timestamp);
|
||||||
|
}
|
||||||
case 'persian-utf8':
|
$out = strftime($format, $timestamp);
|
||||||
if ($timestamp == null) {
|
break;
|
||||||
$timestamp = serendipity_serverOffsetHour();
|
|
||||||
} elseif ($useOffset) {
|
case 'persian-utf8':
|
||||||
$timestamp = serendipity_serverOffsetHour($timestamp);
|
if ($timestamp == null) {
|
||||||
}
|
$timestamp = serendipity_serverOffsetHour();
|
||||||
|
} elseif ($useOffset) {
|
||||||
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
|
$timestamp = serendipity_serverOffsetHour($timestamp);
|
||||||
$out = persian_strftime_utf($format, $timestamp);
|
}
|
||||||
break;
|
|
||||||
|
require_once S9Y_INCLUDE_PATH . 'include/functions_calendars.inc.php';
|
||||||
|
$out = persian_strftime_utf($format, $timestamp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_win_utf && (empty($serendipity['calendar']) || $serendipity['calendar'] == 'gregorian')) {
|
if ($is_win_utf && (empty($serendipity['calendar']) || $serendipity['calendar'] == 'gregorian')) {
|
||||||
@@ -182,9 +187,10 @@ function serendipity_strftime($format, $timestamp = null, $useOffset = true) {
|
|||||||
* @param string Output format for the timestamp
|
* @param string Output format for the timestamp
|
||||||
* @param int Timestamp to use for displaying
|
* @param int Timestamp to use for displaying
|
||||||
* @param boolean Indicates, if timezone calculations shall be used.
|
* @param boolean Indicates, if timezone calculations shall be used.
|
||||||
|
* @param boolean Whether to use strftime or simply date
|
||||||
* @return string The formatted timestamp
|
* @return string The formatted timestamp
|
||||||
*/
|
*/
|
||||||
function serendipity_formatTime($format, $time, $useOffset = true) {
|
function serendipity_formatTime($format, $time, $useOffset = true, $useDate = false) {
|
||||||
static $cache;
|
static $cache;
|
||||||
if (!isset($cache)) {
|
if (!isset($cache)) {
|
||||||
$cache = array();
|
$cache = array();
|
||||||
@@ -196,7 +202,8 @@ function serendipity_formatTime($format, $time, $useOffset = true) {
|
|||||||
$cache[$format] = str_replace('%e', '%d', $cache[$format]);
|
$cache[$format] = str_replace('%e', '%d', $cache[$format]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return serendipity_mb('ucfirst', serendipity_strftime($cache[$format], (int)$time, $useOffset));
|
|
||||||
|
return serendipity_mb('ucfirst', serendipity_strftime($cache[$format], (int)$time, $useOffset, $useDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -140,6 +140,12 @@ function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = arr
|
|||||||
$hidden .= ' <input type="hidden" name="serendipity[preview]" value="false" />';
|
$hidden .= ' <input type="hidden" name="serendipity[preview]" value="false" />';
|
||||||
$hidden .= ' ' . serendipity_setFormToken();
|
$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 (is_object($serendipity['smarty'])) {
|
||||||
if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation']) {
|
if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation']) {
|
||||||
$template_vars['allowDateManipulation'] = true;
|
$template_vars['allowDateManipulation'] = true;
|
||||||
@@ -167,6 +173,7 @@ function serendipity_printEntryForm($targetURL, $hiddens = array(), $entry = arr
|
|||||||
'body' => 'serendipity[body]',
|
'body' => 'serendipity[body]',
|
||||||
'extended' => 'serendipity[extended]'
|
'extended' => 'serendipity[extended]'
|
||||||
);
|
);
|
||||||
|
|
||||||
$template_vars['entry_template'] = serendipity_getTemplateFile('admin/entries.tpl', 'serendipityPath');
|
$template_vars['entry_template'] = serendipity_getTemplateFile('admin/entries.tpl', 'serendipityPath');
|
||||||
|
|
||||||
$serendipity['smarty']->register_modifier('emit_htmlarea_code', 'serendipity_emit_htmlarea_code');
|
$serendipity['smarty']->register_modifier('emit_htmlarea_code', 'serendipity_emit_htmlarea_code');
|
||||||
|
|||||||
@@ -625,17 +625,18 @@ function serendipity_smarty_rss_getguid($params, &$smarty) {
|
|||||||
* @param string The strftime() format options on how to format this string
|
* @param string The strftime() format options on how to format this string
|
||||||
* @param boolean Shall timezone conversions be applied?
|
* @param boolean Shall timezone conversions be applied?
|
||||||
* @param boolean Try to detect a valid timestamp?
|
* @param boolean Try to detect a valid timestamp?
|
||||||
|
* @param boolean Use strftime or date?
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function serendipity_smarty_formatTime($timestamp, $format, $useOffset = true, $detectTimestamp = false) {
|
function serendipity_smarty_formatTime($timestamp, $format, $useOffset = true, $detectTimestamp = false, $useDate = false) {
|
||||||
if ($detectTimestamp !== false && stristr($detectTimestamp, 'date') === false) {
|
if ($detectTimestamp !== false && stristr($detectTimestamp, 'date') === false) {
|
||||||
return $timestamp;
|
return $timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined($format)) {
|
if (defined($format)) {
|
||||||
return serendipity_formatTime(constant($format), $timestamp, $useOffset);
|
return serendipity_formatTime(constant($format), $timestamp, $useOffset, $useDate);
|
||||||
} else {
|
} else {
|
||||||
return serendipity_formatTime($format, $timestamp, $useOffset);
|
return serendipity_formatTime($format, $timestamp, $useOffset, $useDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ function toggle_extended(setCookie) {
|
|||||||
button.src = plus_img;
|
button.src = plus_img;
|
||||||
if (setCookie == true) {
|
if (setCookie == true) {
|
||||||
document.cookie = 'serendipity[toggle_extended]=;';
|
document.cookie = 'serendipity[toggle_extended]=;';
|
||||||
}}
|
}
|
||||||
}}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItem(id) {
|
function showItem(id) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
{*** POSSIBLE ERROR MESSAGES END ***}
|
{*** POSSIBLE ERROR MESSAGES END ***}
|
||||||
|
|
||||||
{*** MAIN ENTRY FORM START ***}
|
{*** MAIN ENTRY FORM START ***}
|
||||||
<form {$entry_vars.entry.entry_form action="{$entry_vars.targetURL}" method="post" id="serendipityEntry" style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px">
|
<form {$entry_vars.entry.entry_form} action="{$entry_vars.targetURL}" method="post" id="serendipityEntry" style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px">
|
||||||
{$entry_vars.hidden}
|
{$entry_vars.hidden}
|
||||||
|
|
||||||
<table class="serendipityEntryEdit" border="0" width="100%">
|
<table class="serendipityEntryEdit" border="0" width="100%">
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
<td align="right">
|
<td align="right">
|
||||||
<select name="serendipity[isdraft]">
|
<select name="serendipity[isdraft]">
|
||||||
{if $entry_vars.serendipityRightPublish}
|
{if $entry_vars.serendipityRightPublish}
|
||||||
<option value="false" {if $entry_vars.draft_mode == 'publish'}selected="selected"{/if}>{CONST.PUBLISH}</option>
|
<option value="false" {if $entry_vars.draft_mode == 'publish'}selected="selected"{/if}>{$CONST.PUBLISH}</option>
|
||||||
{/if}
|
{/if}
|
||||||
<option value="true" {if $entry_vars.draft_mode == 'draft'}selected="selected"{/if}>{$CONST.DRAFT}</option>
|
<option value="true" {if $entry_vars.draft_mode == 'draft'}selected="selected"{/if}>{$CONST.DRAFT}</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="serendipity[chk_timestamp]" value="{$entry_vars.timestamp}" />
|
<input type="hidden" name="serendipity[chk_timestamp]" value="{$entry_vars.timestamp}" />
|
||||||
<input type="text" name="serendipity[new_timestamp]" id="serendipityNewTimestamp" value="{$entry_vars.timestamp|@formatTime:DATE_FORMAT_2}" />
|
<input type="text" name="serendipity[new_timestamp]" id="serendipityNewTimestamp" value="{$entry_vars.timestamp|@formatTime:DATE_FORMAT_2:true:false:true}" />
|
||||||
<a href="#" onclick="document.getElementById('serendipityNewTimestamp').value = '{$entry_vars.reset_timestamp|@formatTime:DATE_FORMAT_2}'; return false;" title="{$CONST.RESET_DATE_DESC}"><img src="{serendipity_getFile file='admin/img/clock.png'}" border="0" style="vertical-align: text-top;" alt="{$CONST.RESET_DATE}" /></a>
|
<a href="#" onclick="document.getElementById('serendipityNewTimestamp').value = '{$entry_vars.reset_timestamp|@formatTime:DATE_FORMAT_2:true:false:true}'; return false;" title="{$CONST.RESET_DATE_DESC}"><img src="{serendipity_getFile file='admin/img/clock.png'}" border="0" style="vertical-align: text-top;" alt="{$CONST.RESET_DATE}" /></a>
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
{else}
|
{else}
|
||||||
@@ -67,15 +67,17 @@
|
|||||||
var selector_store = new Array();
|
var selector_store = new Array();
|
||||||
var selector_restore = new Array();
|
var selector_restore = new Array();
|
||||||
|
|
||||||
function checkSave() {
|
function checkSave() {ldelim}
|
||||||
{serendipity_hookPlugin hook='backend_entry_checkSave' hookAll='true'}
|
{serendipity_hookPlugin hook='backend_entry_checkSave' hookAll='true'}
|
||||||
return true;
|
return true;
|
||||||
}
|
{rdelim}
|
||||||
|
|
||||||
selector_toggle['categoryselector'] = '{$entry_vars.cat_state}';
|
selector_toggle['categoryselector'] = '{$entry_vars.cat_state}';
|
||||||
addLoadEvent(showItem);
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" language="JavaScript" src="{serendipity_getFile file='admin/category_selector.js'}">
|
<script type="text/javascript" language="JavaScript" src="{serendipity_getFile file='admin/category_selector.js'}"></script>
|
||||||
|
<script type="text/javascript" language="JavaScript">
|
||||||
|
addLoadEvent(showItem);
|
||||||
|
</script>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{*** ENTRY DATE,CATEGORY END ***}
|
{*** ENTRY DATE,CATEGORY END ***}
|
||||||
@@ -128,7 +130,7 @@
|
|||||||
<table width="100%" cellpadding="0" cellspacing="0">
|
<table width="100%" cellpadding="0" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left" width="70%">
|
<td align="left" width="70%">
|
||||||
<input id="checkbox_allow_comments" type="checkbox" name="serendipity[allow_comments]" value="true" {if $entry_vars.allow_comments}checked="checked"{/if} /><label for="checkbox_allow_comments">{$CONST.COMMENTS_ENABLE; ?></label><br />
|
<input id="checkbox_allow_comments" type="checkbox" name="serendipity[allow_comments]" value="true" {if $entry_vars.allow_comments}checked="checked"{/if} /><label for="checkbox_allow_comments">{$CONST.COMMENTS_ENABLE}</label><br />
|
||||||
<input id="checkbox_moderate_comments" type="checkbox" name="serendipity[moderate_comments]" value="true" {if $entry_vars.moderate_comments}checked="checked"{/if} /><label for="checkbox_moderate_comments">{$CONST.COMMENTS_MODERATE}</label>
|
<input id="checkbox_moderate_comments" type="checkbox" name="serendipity[moderate_comments]" value="true" {if $entry_vars.moderate_comments}checked="checked"{/if} /><label for="checkbox_moderate_comments">{$CONST.COMMENTS_MODERATE}</label>
|
||||||
</td>
|
</td>
|
||||||
<td align="right" rowspan="2" valign="middle" width="30%">
|
<td align="right" rowspan="2" valign="middle" width="30%">
|
||||||
@@ -218,7 +220,7 @@
|
|||||||
{foreach from=$entry_vars.wysiwyg_blocks item="wysiwyg_block_item" key="wysiwyg_block_jsname"}
|
{foreach from=$entry_vars.wysiwyg_blocks item="wysiwyg_block_item" key="wysiwyg_block_jsname"}
|
||||||
{$wysiwyg_block_item|emit_htmlarea_code:$wysiwyg_block_jsname}
|
{$wysiwyg_block_item|emit_htmlarea_code:$wysiwyg_block_jsname}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{serendipity_refhookPlugin hook="backend_wysiwyg_finish" data=$entry_vars.wysiwyg_blocks}
|
{$entry_vars.wysiwyg_blocks|@serendipity_refhookPlugin:'backend_wysiwyg_finish'}
|
||||||
{/if}
|
{/if}
|
||||||
{*** SPAWN WYSIWYG EDITORS END ***}
|
{*** SPAWN WYSIWYG EDITORS END ***}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user