[add] option for define date format
This commit is contained in:
parent
d1be6766f3
commit
cef0816903
4 changed files with 51 additions and 28 deletions
58
index.php
58
index.php
|
@ -41,6 +41,7 @@
|
||||||
$GLOBALS['config']['WALLABAG_URL'] = '';
|
$GLOBALS['config']['WALLABAG_URL'] = '';
|
||||||
$GLOBALS['config']['contactLink'] = ''; // Define link for contact Example : http://example.com/contact.php or mailo:contact@example.com
|
$GLOBALS['config']['contactLink'] = ''; // Define link for contact Example : http://example.com/contact.php or mailo:contact@example.com
|
||||||
$GLOBALS['config']['THEME'] = 'myShaarli';
|
$GLOBALS['config']['THEME'] = 'myShaarli';
|
||||||
|
$GLOBALS['config']['DATE_FORMAT'] = '%A %d %B %Y %T'; // see http://php.net/manual/en/function.strftime.php for more example
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
// You should not touch below (or at your own risks !)
|
// You should not touch below (or at your own risks !)
|
||||||
// Optionnal config file.
|
// Optionnal config file.
|
||||||
|
@ -585,7 +586,10 @@ function linkdate2iso8601($linkdate)
|
||||||
The date format is automatically chosen according to locale/languages sniffed from browser headers (see autoLocale()). */
|
The date format is automatically chosen according to locale/languages sniffed from browser headers (see autoLocale()). */
|
||||||
function linkdate2locale($linkdate)
|
function linkdate2locale($linkdate)
|
||||||
{
|
{
|
||||||
return utf8_encode(strftime('%c',linkdate2timestamp($linkdate))); // %c is for automatic date format according to locale.
|
if(empty($GLOBALS['config']['DATE_FORMAT'])){
|
||||||
|
$GLOBALS['config']['DATE_FORMAT'] = '%c';
|
||||||
|
}
|
||||||
|
return utf8_encode(strftime($GLOBALS['config']['DATE_FORMAT'],linkdate2timestamp($linkdate))); // %c is for automatic date format according to locale.
|
||||||
// Note that if you use a local which is not installed on your webserver,
|
// Note that if you use a local which is not installed on your webserver,
|
||||||
// the date will not be displayed in the chosen locale, but probably in US notation.
|
// the date will not be displayed in the chosen locale, but probably in US notation.
|
||||||
}
|
}
|
||||||
|
@ -1109,7 +1113,7 @@ function showATOM()
|
||||||
$feed.='<link rel="hub" href="'.htmlspecialchars($GLOBALS['config']['PUBSUBHUB_URL']).'" />';
|
$feed.='<link rel="hub" href="'.htmlspecialchars($GLOBALS['config']['PUBSUBHUB_URL']).'" />';
|
||||||
$feed.='<!-- End Of PubSubHubbub Discovery -->';
|
$feed.='<!-- End Of PubSubHubbub Discovery -->';
|
||||||
}
|
}
|
||||||
$feed.='<author><name>'.htmlspecialchars($pageaddr).'</name><uri>'.htmlspecialchars($pageaddr).'</uri></author>';
|
$feed.='<author><name>'.htmlspecialchars($pageaddr).'<\name><uri>'.htmlspecialchars($pageaddr).'</uri></author>';
|
||||||
$feed.='<id>'.htmlspecialchars($pageaddr).'</id>'."\n\n"; // Yes, I know I should use a real IRI (RFC3987), but the site URL will do.
|
$feed.='<id>'.htmlspecialchars($pageaddr).'</id>'."\n\n"; // Yes, I know I should use a real IRI (RFC3987), but the site URL will do.
|
||||||
$feed.=$entries;
|
$feed.=$entries;
|
||||||
$feed.='</feed><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
|
$feed.='</feed><!-- Cached version of '.htmlspecialchars(pageUrl()).' -->';
|
||||||
|
@ -1498,6 +1502,7 @@ function renderPage()
|
||||||
$GLOBALS['config']['externalThumbshot'] = $_POST['externalThumbshot'];
|
$GLOBALS['config']['externalThumbshot'] = $_POST['externalThumbshot'];
|
||||||
$GLOBALS['config']['contactLink'] = $_POST['contactLink'];
|
$GLOBALS['config']['contactLink'] = $_POST['contactLink'];
|
||||||
$_SESSION['LINKS_PER_PAGE'] = (int)$_POST['linkPerPage'];
|
$_SESSION['LINKS_PER_PAGE'] = (int)$_POST['linkPerPage'];
|
||||||
|
$GLOBALS['config']['DATE_FORMAT'] = strip_tags($_POST['dateFormat']);
|
||||||
writeConfig();
|
writeConfig();
|
||||||
echo '<script>alert("Configuration was saved.");document.location=\'?do=configure\';</script>';
|
echo '<script>alert("Configuration was saved.");document.location=\'?do=configure\';</script>';
|
||||||
exit;
|
exit;
|
||||||
|
@ -2177,7 +2182,7 @@ function lazyThumbnail($url,$href=false)
|
||||||
if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"';
|
if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"';
|
||||||
if (!empty($t['style'])) $html.=' style="'.htmlspecialchars($t['style']).'"';
|
if (!empty($t['style'])) $html.=' style="'.htmlspecialchars($t['style']).'"';
|
||||||
if (!empty($t['alt'])) $html.=' alt="'.htmlspecialchars($t['alt']).'"';
|
if (!empty($t['alt'])) $html.=' alt="'.htmlspecialchars($t['alt']).'"';
|
||||||
$html.='></noscript></a>';
|
$html.='><\noscript></a>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
@ -2431,27 +2436,32 @@ function getAllTheme(){
|
||||||
function writeConfig()
|
function writeConfig()
|
||||||
{
|
{
|
||||||
if (is_file($GLOBALS['config']['CONFIG_FILE']) && !isLoggedIn()) die('You are not authorized to alter config.'); // Only logged in user can alter config.
|
if (is_file($GLOBALS['config']['CONFIG_FILE']) && !isLoggedIn()) die('You are not authorized to alter config.'); // Only logged in user can alter config.
|
||||||
$config='<?php $GLOBALS[\'login\']='.var_export($GLOBALS['login'],true).'; $GLOBALS[\'hash\']='.var_export($GLOBALS['hash'],true).'; $GLOBALS[\'salt\']='.var_export($GLOBALS['salt'],true).'; ';
|
$config = "<?php\n";
|
||||||
$config .='$GLOBALS[\'timezone\']='.var_export($GLOBALS['timezone'],true).'; date_default_timezone_set('.var_export($GLOBALS['timezone'],true).'); $GLOBALS[\'title\']='.var_export($GLOBALS['title'],true).';';
|
$config .= '$GLOBALS[\'login\']='.var_export($GLOBALS['login'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'titleLink\']='.var_export($GLOBALS['titleLink'],true).'; ';
|
$confog .= '$GLOBALS[\'hash\'] = '.var_export($GLOBALS['hash'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'redirector\']='.var_export($GLOBALS['redirector'],true).'; ';
|
$config .= '$GLOBALS[\'salt\']='.var_export($GLOBALS['salt'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'disablesessionprotection\']='.var_export($GLOBALS['disablesessionprotection'],true).'; ';
|
$config .='$GLOBALS[\'timezone\'] = '.var_export($GLOBALS['timezone'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; ';
|
$config .= 'date_default_timezone_set('.var_export($GLOBALS['timezone'],true).');'."\n";
|
||||||
$config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; ';
|
$confif .= '$GLOBALS[\'title\']='.var_export($GLOBALS['title'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; ';
|
$config .= '$GLOBALS[\'titleLink\'] = '.var_export($GLOBALS['titleLink'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\']='.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).'; ';
|
$config .= '$GLOBALS[\'redirector\'] = '.var_export($GLOBALS['redirector'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_MARKDOWN\']='.var_export($GLOBALS['config']['ENABLE_MARKDOWN'], true).'; ';
|
$config .= '$GLOBALS[\'disablesessionprotection\'] = '.var_export($GLOBALS['disablesessionprotection'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'BAN_AFTER\']='.var_export($GLOBALS['config']['BAN_AFTER'], true).'; ';
|
$config .= '$GLOBALS[\'disablejquery\'] = '.var_export($GLOBALS['disablejquery'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'BAN_DURATION\']='.var_export($GLOBALS['config']['BAN_DURATION'], true).'; ';
|
$config .= '$GLOBALS[\'privateLinkByDefault\'] = '.var_export($GLOBALS['privateLinkByDefault'],true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'THEME\']='.var_export($GLOBALS['config']['THEME'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\'] = '.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'LINKS_PER_PAGE\']='.var_export($GLOBALS['config']['LINKS_PER_PAGE'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_UPDATECHECK\'] = '.var_export($GLOBALS['config']['ENABLE_UPDATECHECK'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'HIDE_TIMESTAMPS\']='.var_export($GLOBALS['config']['HIDE_TIMESTAMPS'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_MARKDOWN\'] = '.var_export($GLOBALS['config']['ENABLE_MARKDOWN'], true).';'."\n";;
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_THUMBNAILS\']='.var_export($GLOBALS['config']['ENABLE_THUMBNAILS'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'BAN_AFTER\'] = '.var_export($GLOBALS['config']['BAN_AFTER'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_FAVICON\']='.var_export($GLOBALS['config']['ENABLE_FAVICON'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'BAN_DURATION\'] = '.var_export($GLOBALS['config']['BAN_DURATION'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'ENABLE_LOCALCACHE\']='.var_export($GLOBALS['config']['ENABLE_LOCALCACHE'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'THEME\'] = '.var_export($GLOBALS['config']['THEME'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'externalThumbshot\']='.var_export($GLOBALS['config']['externalThumbshot'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'LINKS_PER_PAGE\'] = '.var_export($GLOBALS['config']['LINKS_PER_PAGE'], true).';'."\n";
|
||||||
$config .= '$GLOBALS[\'config\'][\'contactLink\']='.var_export($GLOBALS['config']['contactLink'], true).'; ';
|
$config .= '$GLOBALS[\'config\'][\'HIDE_TIMESTAMPS\'] = '.var_export($GLOBALS['config']['HIDE_TIMESTAMPS'], true).';'."\n";
|
||||||
$config .= ' ?>';
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_THUMBNAILS\'] = '.var_export($GLOBALS['config']['ENABLE_THUMBNAILS'], true).';'."\n";
|
||||||
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_FAVICON\'] = '.var_export($GLOBALS['config']['ENABLE_FAVICON'], true).';'."\n";
|
||||||
|
$config .= '$GLOBALS[\'config\'][\'ENABLE_LOCALCACHE\'] = '.var_export($GLOBALS['config']['ENABLE_LOCALCACHE'], true).';'."\n";
|
||||||
|
$config .= '$GLOBALS[\'config\'][\'externalThumbshot\'] = '.var_export($GLOBALS['config']['externalThumbshot'], true).';'."\n";
|
||||||
|
$config .= '$GLOBALS[\'config\'][\'contactLink\'] = '.var_export($GLOBALS['config']['contactLink'], true).';'."\n";
|
||||||
|
$config .= '$GLOBALS[\'config\'][\'DATE_FORMAT\'] = '.var_export($GLOBALS['config']['DATE_FORMAT'], true).';'."\n";
|
||||||
if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
|
if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
|
||||||
{
|
{
|
||||||
echo '<script>alert("Shaarli could not create the config file. Please make sure Shaarli has the right to write in the folder is it installed in.");document.location=\'?\';</script>';
|
echo '<script>alert("Shaarli could not create the config file. Please make sure Shaarli has the right to write in the folder is it installed in.");document.location=\'?\';</script>';
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
<div id="pageheader">
|
<div id="pageheader">
|
||||||
{include="page.header"}
|
{include="page.header"}
|
||||||
{$timezone_js}
|
{$timezone_js}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<form method="post" action="" name="configform" id="configform">
|
<form method="post" action="" name="configform" id="configform">
|
||||||
<ul class="tabs">
|
<ul class="tabs">
|
||||||
<li>
|
<li>
|
||||||
|
@ -87,6 +89,10 @@
|
||||||
<label for="hideTimestamps">Hide timestamps : </label>
|
<label for="hideTimestamps">Hide timestamps : </label>
|
||||||
<input type="checkbox" name="hideTimestamps" id="hideTimestamps" {if="!empty($GLOBALS['config']['HIDE_TIMESTAMPS'])"}checked{/if}/>
|
<input type="checkbox" name="hideTimestamps" id="hideTimestamps" {if="!empty($GLOBALS['config']['HIDE_TIMESTAMPS'])"}checked{/if}/>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="dateFormat">Date Format : </label>
|
||||||
|
<input type="text" name="dateFormat" id="dateFormat" value="{$GLOBALS['config']['DATE_FORMAT']}"/><label>See <a href="http://php.net/manual/en/function.strftime.php">PHP documentation</a></label>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -75,7 +75,7 @@ <h3 class="linktitle">{function="returnFavicon($value.url)"}<a href="{$redirecto
|
||||||
<a href="{$value.via}">Origine => {$value.via|getJustDomain}</a>
|
<a href="{$value.via}">Origine => {$value.via|getJustDomain}</a>
|
||||||
</div>{/if}
|
</div>{/if}
|
||||||
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
|
{if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
|
||||||
<span class="linkdate linkBottom" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span>
|
<span class="linkdate linkBottom" title="Permalink"><a href="?{$value.linkdate|smallHash}">{function="ucfirst(htmlspecialchars($value.localdate))"} - permalink</a> - </span>
|
||||||
{else}
|
{else}
|
||||||
<span class="linkdate linkBottom" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
|
<span class="linkdate linkBottom" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ a:hover, .linkdescription a:hover, .linktitle a:hover, .linkWallabag a:hover, .l
|
||||||
-o-animation-duration: .5s;
|
-o-animation-duration: .5s;
|
||||||
-webkit-animation-duration: .5s;
|
-webkit-animation-duration: .5s;
|
||||||
animation-duration: .5s;
|
animation-duration: .5s;
|
||||||
border: 1px solid #ccc;
|
border: .2em solid #ccc;
|
||||||
border-radius: .3em;
|
border-radius: .3em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -1047,6 +1047,13 @@ a:hover, .linkdescription a:hover, .linktitle a:hover, .linkWallabag a:hover, .l
|
||||||
height: 1.1em;
|
height: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tabs li {
|
||||||
|
background: linear-gradient(#333333,#111111);
|
||||||
|
background-color: #333333;
|
||||||
|
box-shadow: 0 1px 2px rgba(0,0,0,0.5);
|
||||||
|
border-radius: .4em;
|
||||||
|
}
|
||||||
|
|
||||||
.tabs li,[id^=tab]:checked ~
|
.tabs li,[id^=tab]:checked ~
|
||||||
[id^=tab-content] {
|
[id^=tab-content] {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
Loading…
Reference in a new issue