[chg] start proper fork of original Shaarli

This commit is contained in:
Knah Tsaeb 2015-06-26 17:29:17 +02:00
parent 9047fb2fd5
commit ff50f9c69e
5 changed files with 38 additions and 20 deletions

View File

@ -28,9 +28,12 @@ $GLOBALS['config']['PAGECACHE'] = 'pagecache'; // Page cache directory.
$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage.
// Care if favicon is active and local cache are false serve page can be long
$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
// Note: You must have publisher.php in the same directory as Shaarli index.php
$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli.
$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours
// Note: You must have publisher.php in the same directory as Shaarli index.php
$GLOBALS['config']['UPDATECHECK_URL'] = 'http://book.knah-tsaeb.org/shaarli_version.txt'; // Define last version of myShaarli
$GLOBALS['config']['UPDATECHECK_DOWNLOAD'] = 'https://forge.leslibres.org/projects/shaarli/repository';
$GLOBALS['config']['ENABLE_UPDATECHECK'] = TRUE;
$GLOBALS['config']['externalThumbshot'] = ''; // Url for external thumbnailer
// exemple : http://images.thumbshots.com/image.aspx?cid=dgdfgdfg&v=1&w=120&url=
// the last param must be a url
@ -42,7 +45,7 @@ $GLOBALS['config']['contactLink'] = ''; // Define link for contact Example : htt
// Optionnal config file.
if (is_file($GLOBALS['config']['DATADIR'].'/options.php')) require($GLOBALS['config']['DATADIR'].'/options.php');
define('shaarli_version','0.0.41 beta');
define('myShaarli_version','1.0.0 alpha');
define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code.
define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code.
// http://server.com/x/shaarli --> /shaarli/
@ -148,22 +151,34 @@ function checkphpversion()
// other= the available version.
function checkUpdate()
{
if (!isLoggedIn()) return ''; // Do not check versions for visitors.
if (empty($GLOBALS['config']['ENABLE_UPDATECHECK'])) return ''; // Do not check if the user doesn't want to.
// Get latest version number at most once a day.
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL'])))
{
$version=shaarli_version;
list($httpstatus,$headers,$data) = getHTTP('http://sebsauvage.net/files/shaarli_version.txt',2);
if (strpos($httpstatus,'200 OK')!==false) $version=$data;
// If failed, nevermind. We don't want to bother the user with that.
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date
if (!isLoggedIn()){
return false; // Do not check versions for visitors.
}
if (empty($GLOBALS['config']['ENABLE_UPDATECHECK'])){
return false; // Do not check if the user doesn't want to.
}
// Get latest version number at most once a day.
if (!is_file($GLOBALS['config']['UPDATECHECK_FILENAME']) || (filemtime($GLOBALS['config']['UPDATECHECK_FILENAME'])<time()-($GLOBALS['config']['UPDATECHECK_INTERVAL']))){
$version=myShaarli_version;
list($httpstatus,$headers,$data) = getHTTP($GLOBALS['config']['UPDATECHECK_URL'],2);
if (strpos($httpstatus,'200 OK')!==false){
$version=$data;
}
// If failed, nevermind. We don't want to bother the user with that.
file_put_contents($GLOBALS['config']['UPDATECHECK_FILENAME'],$version); // touch file date
}
// Compare versions:
$newestversion=file_get_contents($GLOBALS['config']['UPDATECHECK_FILENAME']);
if (version_compare($newestversion,shaarli_version)==1) return $newestversion;
return '';
if (version_compare(myShaarli_version,$newestversion)==0){
return false;
}
if (version_compare(myShaarli_version,$newestversion)==1){
return 'You have future version ?!';
}
if (version_compare(myShaarli_version,$newestversion)==-1){
return 'New update of myShaarli available.';
}
return false;
}

1
shaarli_version.txt Normal file
View File

@ -0,0 +1 @@
1.0.0 alpha

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>{include="includes"}</head>
<body>
<body onload="document.configform.title.focus();">
<div id="pageheader">
{include="page.header"}
{$timezone_js}
@ -9,7 +9,7 @@
<input type="hidden" name="token" value="{$token}">
<table border="0" cellpadding="20">
<tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}" autofocus></td></tr>
<tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr>
<tr><td><b>Title link:</b></td><td><input type="text" name="titleLink" id="titleLink" size="50" value="{$titleLink}"></td></tr>

View File

@ -1,9 +1,10 @@
<div id="footer">
<b><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli">Shaarli {$version|htmlspecialchars}</a></b> - The personal, minimalist, super-fast, no-database delicious clone. By <a href="http://sebsauvage.net" target="_blank">sebsauvage.net</a>. Theme by <a href="http://blog.idleman.fr" target="_blank">idleman.fr</a>. </br>
Other change as made by <a href="https://forge.leslibres.org/projects/shaarli/repository/show?rev=myShaarli">Knah Tsaeb</a>{if="$GLOBALS['config']['contactLink']"} for contact me <a href="{$GLOBALS['config']['contactLink']}">use this link</a>{/if}.
<a href="https://forge.leslibres.org/projects/shaarli/repository/show?rev=myShaarli">myShaarli are made by Knah Tsaeb</a> is based on <b><a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli">Shaarli 0.0.41 beta</a></b> - The personal, minimalist, super-fast, no-database delicious clone. By <a href="http://sebsauvage.net" target="_blank">sebsauvage.net</a>.<br/>
Original theme by <a href="http://blog.idleman.fr" target="_blank">idleman.fr</a>.<br/>
{if="$GLOBALS['config']['contactLink']"} For contact me <a href="{$GLOBALS['config']['contactLink']}">use this link</a>{/if}.
</div>
{if="$newversion"}
<div id="newversion"><span style="text-decoration:blink;">&#x25CF;</span> Shaarli {$newversion|htmlspecialchars} is <a href="http://sebsauvage.net/wiki/doku.php?id=php:shaarli#download">available</a>.</div>
<div id="newversion">&#x25CF;<a href="{$GLOBALS['config']['UPDATECHECK_DOWNLOAD']}">{$newversion|htmlspecialchars}</a></div>
{/if}
{if="isLoggedIn()"}
<script language="JavaScript">function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script>

View File

@ -5,6 +5,7 @@
<div id="pageheader">
{include="page.header"}
<div id="toolsdiv">
<b>myShaarli version:</b>{#myShaarli_version#}<br><br>
{if="!$GLOBALS['config']['OPEN_SHAARLI']"}<a href="?do=changepasswd"><b>Change password</b> <span>: Change your password.</span></a><br><br>{/if}
<a href="?do=configure"><b>Configure your Shaarli</b> <span>: Change Title, timezone...</span></a><br><br>
<a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br>