1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-10-31 15:35:05 -04:00
This commit is contained in:
Nicolas Lœuillet 2013-09-20 10:21:39 +02:00
parent 705250b93d
commit 00dbaf90bc
55 changed files with 479 additions and 884 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@ composer.phar
db/poche.sqlite
output
phpdoc*
inc/poche/myconfig.inc.php
inc/poche/config.inc.php

5
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "inc/3rdparty/site_config"]
path = inc/3rdparty/site_config
url = git://github.com/inthepoche/site_config.git
url = git@github.com:inthepoche/site_config.git
[submodule "themes"]
path = themes
url = git@github.com:inthepoche/poche-themes.git

@ -1 +0,0 @@
Subproject commit fe9f0d3f60d44a8701f3ecab0c4077a4ed39bfe8

View File

@ -60,11 +60,15 @@ class Database {
$id_user = intval($this->getLastId($sequence));
$sql = 'INSERT INTO users_config ( user_id, name, value ) VALUES (?, ?, ?)';
$params = array($id_user, 'pager', '10');
$params = array($id_user, 'pager', PAGINATION);
$query = $this->executeQuery($sql, $params);
$sql = 'INSERT INTO users_config ( user_id, name, value ) VALUES (?, ?, ?)';
$params = array($id_user, 'language', 'en_EN.UTF8');
$params = array($id_user, 'language', LANG);
$query = $this->executeQuery($sql, $params);
$sql = 'INSERT INTO users_config ( user_id, name, value ) VALUES (?, ?, ?)';
$params = array($id_user, 'theme', DEFAULT_THEME);
$query = $this->executeQuery($sql, $params);
return TRUE;
@ -101,10 +105,16 @@ class Database {
return $user;
}
public function updatePassword($id, $password)
public function updatePassword($userId, $password)
{
$sql_update = "UPDATE users SET password=? WHERE id=?";
$params_update = array($password, $id);
$this->updateUserConfig($userId, 'password', $password);
}
public function updateUserConfig($userId, $key, $value) {
$sql_update = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?";
$params_update = array($value, $userId, $key);
$query = $this->executeQuery($sql_update, $params_update);
}

View File

@ -10,86 +10,54 @@
class Poche
{
public static $canRenderTemplates = true;
public static $configFileAvailable = true;
public $user;
public $store;
public $tpl;
public $messages;
public $pagination;
private $currentTheme = '';
private $notInstalledMessage = '';
# @todo make this dynamic (actually install themes and save them in the database including author information et cetera)
private $installedThemes = array(
'default' => array('requires' => array()),
'dark' => array('requires' => array('default')),
'dmagenta' => array('requires' => array('default')),
'solarized' => array('requires' => array('default')),
'solarized-dark' => array('requires' => array('default'))
);
function __construct()
public function __construct()
{
$this->initTpl();
if (!$this->checkBeforeInstall()) {
exit;
if (! $this->configFileIsAvailable()) {
return;
}
$this->store = new Database();
$this->init();
if (! $this->themeIsInstalled()) {
return;
}
$this->initTpl();
if (! $this->systemIsInstalled()) {
return;
}
$this->store = new Database();
$this->messages = new Messages();
# installation
if(!$this->store->isInstalled())
{
if (! $this->store->isInstalled()) {
$this->install();
}
}
/**
* all checks before installation.
* @return boolean
*/
private function checkBeforeInstall()
{
$msg = '';
$allIsGood = TRUE;
if (!is_writable(CACHE)) {
Tools::logm('you don\'t have write access on cache directory');
die('You don\'t have write access on cache directory.');
}
else if (file_exists('./install/update.php') && !DEBUG_POCHE) {
$msg = '<h1>setup</h1><p><strong>It\'s your first time here?</strong> Please copy /install/poche.sqlite in db folder. Then, delete install folder.<br /><strong>If you have already installed poche</strong>, an update is needed <a href="install/update.php">by clicking here</a>.</p>';
$allIsGood = FALSE;
}
else if (file_exists('./install') && !DEBUG_POCHE) {
$msg = '<h1>setup</h1><p><strong>If you want to update your poche</strong>, you just have to delete /install folder. <br /><strong>To install your poche with sqlite</strong>, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.</p>';
$allIsGood = FALSE;
}
else if (STORAGE == 'sqlite' && !is_writable(STORAGE_SQLITE)) {
Tools::logm('you don\'t have write access on sqlite file');
$msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>';
$allIsGood = FALSE;
}
if (!$allIsGood) {
echo $this->tpl->render('error.twig', array(
'msg' => $msg
));
}
return $allIsGood;
}
private function initTpl()
{
# template engine
$loader = new Twig_Loader_Filesystem(TPL);
if (DEBUG_POCHE) {
$twig_params = array();
}
else {
$twig_params = array('cache' => CACHE);
}
$this->tpl = new Twig_Environment($loader, $twig_params);
$this->tpl->addExtension(new Twig_Extensions_Extension_I18n());
# filter to display domain name of an url
$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
$this->tpl->addFilter($filter);
# filter for reading time
$filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
$this->tpl->addFilter($filter);
}
private function init()
{
Tools::initPhp();
@ -98,8 +66,7 @@ class Poche
if (isset($_SESSION['poche_user']) && $_SESSION['poche_user'] != array()) {
$this->user = $_SESSION['poche_user'];
}
else {
} else {
# fake user, just for install & login screens
$this->user = new User();
$this->user->setConfig($this->getDefaultConfig());
@ -114,13 +81,149 @@ class Poche
# Pagination
$this->pagination = new Paginator($this->user->getConfigValue('pager'), 'p');
# Set up theme
$themeDirectory = $this->user->getConfigValue('theme');
if ($themeDirectory === false) {
$themeDirectory = DEFAULT_THEME;
}
$this->currentTheme = $themeDirectory;
}
public function configFileIsAvailable() {
if (! self::$configFileAvailable) {
$this->notInstalledMessage = 'You have to rename <strong>inc/poche/config.inc.php.new</strong> to <strong>inc/poche/config.inc.php</strong>.';
return false;
}
return true;
}
public function themeIsInstalled() {
# Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet
if (! self::$canRenderTemplates) {
$this->notInstalledMessage = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://inthepoche.com/?pages/Documentation">the documentation.</a>';
return false;
}
# Check if the selected theme and its requirements are present
if (! is_dir(THEME . '/' . $this->getTheme())) {
$this->notInstalledMessage = 'The currently selected theme (' . $this->getTheme() . ') does not seem to be properly installed (Missing directory: ' . THEME . '/' . $this->getTheme() . ')';
self::$canRenderTemplates = false;
return false;
}
foreach ($this->installedThemes[$this->getTheme()]['requires'] as $requiredTheme) {
if (! is_dir(THEME . '/' . $requiredTheme)) {
$this->notInstalledMessage = 'The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this->getTheme() . ')';
self::$canRenderTemplates = false;
return false;
}
}
return true;
}
/**
* all checks before installation.
* @todo move HTML to template
* @return boolean
*/
public function systemIsInstalled()
{
$msg = '';
$configSalt = defined('SALT') ? constant('SALT') : '';
if (empty($configSalt)) {
$msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>';
} else if (! is_writable(CACHE)) {
Tools::logm('you don\'t have write access on cache directory');
$msg = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>';
} else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) {
Tools::logm('sqlite file doesn\'t exist');
$msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder.</p>';
} else if (file_exists(ROOT . '/install/update.php') && ! DEBUG_POCHE) {
$msg = '<h1>setup</h1><p><strong>It\'s your first time here?</strong> Please copy /install/poche.sqlite in db folder. Then, delete install folder.<br /><strong>If you have already installed poche</strong>, an update is needed <a href="install/update.php">by clicking here</a>.</p>';
} else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) {
$msg = '<h1>setup</h1><p><strong>If you want to update your poche</strong>, you just have to delete /install folder. <br /><strong>To install your poche with sqlite</strong>, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.</p>';
} else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) {
Tools::logm('you don\'t have write access on sqlite file');
$msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>';
}
if (! empty($msg)) {
$this->notInstalledMessage = $msg;
return false;
}
return true;
}
public function getNotInstalledMessage() {
return $this->notInstalledMessage;
}
private function initTpl()
{
$loaderChain = new Twig_Loader_Chain();
# add the current theme as first to the loader chain so Twig will look there first for overridden template files
try {
$loaderChain->addLoader(new Twig_Loader_Filesystem(THEME . '/' . $this->getTheme()));
} catch (Twig_Error_Loader $e) {
# @todo isInstalled() should catch this, inject Twig later
die('The currently selected theme (' . $this->getTheme() . ') does not seem to be properly installed (' . THEME . '/' . $this->getTheme() .' is missing)');
}
# add all required themes to the loader chain
foreach ($this->installedThemes[$this->getTheme()]['requires'] as $requiredTheme) {
try {
$loaderChain->addLoader(new Twig_Loader_Filesystem(THEME . '/' . DEFAULT_THEME));
} catch (Twig_Error_Loader $e) {
# @todo isInstalled() should catch this, inject Twig later
die('The required "' . $requiredTheme . '" theme is missing for the current theme (' . $this->getTheme() . ')');
}
}
if (DEBUG_POCHE) {
$twig_params = array();
} else {
$twig_params = array('cache' => CACHE);
}
$this->tpl = new Twig_Environment($loaderChain, $twig_params);
$this->tpl->addExtension(new Twig_Extensions_Extension_I18n());
# filter to display domain name of an url
$filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain');
$this->tpl->addFilter($filter);
# filter for reading time
$filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
$this->tpl->addFilter($filter);
# filter for simple filenames in config view
$filter = new Twig_SimpleFilter('getPrettyFilename', function($string) { return str_replace(ROOT, '', $string); });
$this->tpl->addFilter($filter);
}
private function install()
{
Tools::logm('poche still not installed');
echo $this->tpl->render('install.twig', array(
'token' => Session::getToken()
'token' => Session::getToken(),
'theme' => $this->getTheme(),
'poche_url' => Tools::getPocheUrl()
));
if (isset($_GET['install'])) {
if (($_POST['password'] == $_POST['password_repeat'])
@ -140,13 +243,41 @@ class Poche
}
exit();
}
public function getTheme() {
return $this->currentTheme;
}
public function getInstalledThemes() {
$handle = opendir(THEME);
$themes = array();
while (($theme = readdir($handle)) !== false) {
# Themes are stored in a directory, so all directory names are themes
# @todo move theme installation data to database
if (! is_dir(THEME . '/' . $theme) || in_array($theme, array('..', '.'))) {
continue;
}
$current = false;
if ($theme === $this->getTheme()) {
$current = true;
}
$themes[] = array('name' => $theme, 'current' => $current);
}
return $themes;
}
public function getDefaultConfig()
{
{
return array(
'pager' => PAGINATION,
'language' => LANG,
);
'theme' => DEFAULT_THEME
);
}
/**
@ -231,7 +362,9 @@ class Poche
$prod = $this->getPocheVersion('prod');
$compare_dev = version_compare(POCHE_VERSION, $dev);
$compare_prod = version_compare(POCHE_VERSION, $prod);
$themes = $this->getInstalledThemes();
$tpl_vars = array(
'themes' => $themes,
'dev' => $dev,
'prod' => $prod,
'compare_dev' => $compare_dev,
@ -316,6 +449,44 @@ class Poche
}
}
}
public function updateTheme()
{
# no data
if (empty($_POST['theme'])) {
}
# we are not going to change it to the current theme...
if ($_POST['theme'] == $this->getTheme()) {
$this->messages->add('w', _('still using the "' . $this->getTheme() . '" theme!'));
Tools::redirect('?view=config');
}
$themes = $this->getInstalledThemes();
$actualTheme = false;
foreach ($themes as $theme) {
if ($theme['name'] == $_POST['theme']) {
$actualTheme = true;
break;
}
}
if (! $actualTheme) {
$this->messages->add('e', _('that theme does not seem to be installed'));
Tools::redirect('?view=config');
}
$this->store->updateUserConfig($this->user->getId(), 'theme', $_POST['theme']);
$this->messages->add('s', _('you have changed your theme preferences'));
$currentConfig = $_SESSION['poche_user']->config;
$currentConfig['theme'] = $_POST['theme'];
$_SESSION['poche_user']->setConfig($currentConfig);
Tools::redirect('?view=config');
}
/**
* checks if login & password are correct and save the user in session.

View File

@ -84,9 +84,9 @@ class Tools
public static function getTplFile($view)
{
$tpl_file = 'home.twig';
switch ($view)
{
$default_tpl = 'home.twig';
switch ($view) {
case 'install':
$tpl_file = 'install.twig';
break;
@ -102,9 +102,20 @@ class Tools
case 'view':
$tpl_file = 'view.twig';
break;
case 'login':
$tpl_file = 'login.twig';
break;
case 'error':
$tpl_file = 'error.twig';
break;
default:
break;
$tpl_file = $default_tpl;
break;
}
return $tpl_file;
}
@ -228,27 +239,6 @@ class Tools
return $minutes;
}
public static function createMyConfig()
{
$myconfig_file = './inc/poche/myconfig.inc.php';
if (!is_writable('./inc/poche/')) {
self::logm('you don\'t have write access to create ./inc/poche/myconfig.inc.php');
die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
}
if (!file_exists($myconfig_file))
{
$fp = fopen($myconfig_file, 'w');
fwrite($fp, '<?php'."\r\n");
fwrite($fp, "define ('POCHE_VERSION', '1.0-beta4');" . "\r\n");
fwrite($fp, "define ('SALT', '" . md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand()) . "');" . "\r\n");
fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
fclose($fp);
}
}
public static function getDocLanguage($userlanguage) {
$lang = explode('.', $userlanguage);
return str_replace('_', '-', $lang[0]);

View File

@ -3,49 +3,54 @@
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <support@inthepoche.com>
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
require_once __DIR__ . '/../../inc/poche/define.inc.php';
define ('SALT', ''); # put a strong string here
define ('LANG', 'en_EN.utf8');
# /!\ Be careful if you change the lines below /!\
if (!file_exists(__DIR__ . '/../../vendor/autoload.php')) {
die('Twig does not seem installed. Have a look at <a href="inthepoche.com/doc">the documentation.</a>');
}
define ('STORAGE', 'sqlite'); # postgres, mysql or sqlite
require_once __DIR__ . '/../../inc/poche/User.class.php';
require_once __DIR__ . '/../../inc/poche/Url.class.php';
require_once __DIR__ . '/../../inc/3rdparty/class.messages.php';
require_once __DIR__ . '/../../inc/poche/Poche.class.php';
require_once __DIR__ . '/../../inc/3rdparty/Readability.php';
require_once __DIR__ . '/../../inc/poche/PocheReadability.php';
require_once __DIR__ . '/../../inc/3rdparty/Encoding.php';
require_once __DIR__ . '/../../inc/poche/Database.class.php';
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../inc/3rdparty/simple_html_dom.php';
require_once __DIR__ . '/../../inc/3rdparty/paginator.php';
require_once __DIR__ . '/../../inc/3rdparty/Session.class.php';
define ('STORAGE_SQLITE', ROOT . '/db/poche.sqlite'); # if you are using sqlite, where the database file is located
require_once __DIR__ . '/../../inc/3rdparty/simplepie/SimplePieAutoloader.php';
require_once __DIR__ . '/../../inc/3rdparty/simplepie/SimplePie/Core.php';
require_once __DIR__ . '/../../inc/3rdparty/content-extractor/ContentExtractor.php';
require_once __DIR__ . '/../../inc/3rdparty/content-extractor/SiteConfig.php';
require_once __DIR__ . '/../../inc/3rdparty/humble-http-agent/HumbleHttpAgent.php';
require_once __DIR__ . '/../../inc/3rdparty/humble-http-agent/SimplePie_HumbleHttpAgent.php';
require_once __DIR__ . '/../../inc/3rdparty/humble-http-agent/CookieJar.php';
require_once __DIR__ . '/../../inc/3rdparty/feedwriter/FeedItem.php';
require_once __DIR__ . '/../../inc/3rdparty/feedwriter/FeedWriter.php';
require_once __DIR__ . '/../../inc/3rdparty/feedwriter/DummySingleItemFeed.php';
require_once __DIR__ . '/../../inc/3rdparty/FlattrItem.class.php';
# only for postgres & mysql
define ('STORAGE_SERVER', 'localhost');
define ('STORAGE_DB', 'poche');
define ('STORAGE_USER', 'poche');
define ('STORAGE_PASSWORD', 'poche');
if (DOWNLOAD_PICTURES) {
require_once __DIR__ . '/../../inc/poche/pochePictures.php';
}
#################################################################################
# Do not trespass unless you know what you are doing
#################################################################################
if (!ini_get('date.timezone') || !@date_default_timezone_set(ini_get('date.timezone'))) {
date_default_timezone_set('UTC');
}
define ('MODE_DEMO', FALSE);
define ('DEBUG_POCHE', true);
define ('DOWNLOAD_PICTURES', FALSE);
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
define ('SHARE_TWITTER', TRUE);
define ('SHARE_MAIL', TRUE);
define ('SHARE_SHAARLI', FALSE);
define ('SHAARLI_URL', 'http://myshaarliurl.com');
define ('FLATTR', TRUE);
define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
define ('NOT_FLATTRABLE', '0');
define ('FLATTRABLE', '1');
define ('FLATTRED', '2');
define ('ABS_PATH', 'assets/');
$poche = new Poche();
define ('DEFAULT_THEME', 'default');
define ('THEME', ROOT . '/themes');
define ('LOCALE', ROOT . '/locale');
define ('CACHE', ROOT . '/cache');
define ('PAGINATION', '10');
define ('POCHE_VERSION', '1.0-beta5');
define ('IMPORT_POCKET_FILE', ROOT . '/ril_export.html');
define ('IMPORT_READABILITY_FILE', ROOT . '/readability');
define ('IMPORT_INSTAPAPER_FILE', ROOT . '/instapaper-export.html');

56
inc/poche/config.inc.php.new Executable file
View File

@ -0,0 +1,56 @@
<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
define ('SALT', ''); # put a strong string here
define ('LANG', 'en_EN.utf8');
define ('STORAGE', 'sqlite'); # postgres, mysql or sqlite
define ('STORAGE_SQLITE', ROOT . '/db/poche.sqlite'); # if you are using sqlite, where the database file is located
# only for postgres & mysql
define ('STORAGE_SERVER', 'localhost');
define ('STORAGE_DB', 'poche');
define ('STORAGE_USER', 'poche');
define ('STORAGE_PASSWORD', 'poche');
#################################################################################
# Do not trespass unless you know what you are doing
#################################################################################
define ('MODE_DEMO', FALSE);
define ('DEBUG_POCHE', true);
define ('DOWNLOAD_PICTURES', FALSE);
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
define ('SHARE_TWITTER', TRUE);
define ('SHARE_MAIL', TRUE);
define ('SHARE_SHAARLI', FALSE);
define ('SHAARLI_URL', 'http://myshaarliurl.com');
define ('FLATTR', TRUE);
define ('FLATTR_API', 'https://api.flattr.com/rest/v2/things/lookup/?url=');
define ('NOT_FLATTRABLE', '0');
define ('FLATTRABLE', '1');
define ('FLATTRED', '2');
define ('ABS_PATH', 'assets/');
define ('DEFAULT_THEME', 'default');
define ('THEME', ROOT . '/themes');
define ('LOCALE', ROOT . '/locale');
define ('CACHE', ROOT . '/cache');
define ('PAGINATION', '10');
define ('POCHE_VERSION', '1.0-beta5');
define ('IMPORT_POCKET_FILE', ROOT . '/ril_export.html');
define ('IMPORT_READABILITY_FILE', ROOT . '/readability');
define ('IMPORT_INSTAPAPER_FILE', ROOT . '/instapaper-export.html');

72
inc/poche/global.inc.php Normal file
View File

@ -0,0 +1,72 @@
<?php
/**
* poche, a read it later open source system
*
* @category poche
* @author Nicolas Lœuillet <nicolas@loeuillet.org>
* @copyright 2013
* @license http://www.wtfpl.net/ see COPYING file
*/
# the poche system root directory (/inc)
define('INCLUDES', dirname(__FILE__) . '/..');
# the poche root directory
define('ROOT', INCLUDES . '/..');
require_once INCLUDES . '/poche/Tools.class.php';
require_once INCLUDES . '/poche/User.class.php';
require_once INCLUDES . '/poche/Url.class.php';
require_once INCLUDES . '/3rdparty/class.messages.php';
require_once INCLUDES . '/poche/Poche.class.php';
require_once INCLUDES . '/3rdparty/Readability.php';
require_once INCLUDES . '/poche/PocheReadability.php';
require_once INCLUDES . '/3rdparty/Encoding.php';
require_once INCLUDES . '/poche/Database.class.php';
require_once INCLUDES . '/3rdparty/simple_html_dom.php';
require_once INCLUDES . '/3rdparty/paginator.php';
require_once INCLUDES . '/3rdparty/Session.class.php';
require_once INCLUDES . '/3rdparty/simplepie/SimplePieAutoloader.php';
require_once INCLUDES . '/3rdparty/simplepie/SimplePie/Core.php';
require_once INCLUDES . '/3rdparty/content-extractor/ContentExtractor.php';
require_once INCLUDES . '/3rdparty/content-extractor/SiteConfig.php';
require_once INCLUDES . '/3rdparty/humble-http-agent/HumbleHttpAgent.php';
require_once INCLUDES . '/3rdparty/humble-http-agent/SimplePie_HumbleHttpAgent.php';
require_once INCLUDES . '/3rdparty/humble-http-agent/CookieJar.php';
require_once INCLUDES . '/3rdparty/feedwriter/FeedItem.php';
require_once INCLUDES . '/3rdparty/feedwriter/FeedWriter.php';
require_once INCLUDES . '/3rdparty/feedwriter/DummySingleItemFeed.php';
require_once INCLUDES . '/3rdparty/FlattrItem.class.php';
# Composer its autoloader for automatically loading Twig
if (! file_exists(ROOT . '/vendor/autoload.php')) {
Poche::$canRenderTemplates = false;
} else {
require_once ROOT . '/vendor/autoload.php';
}
# system configuration; database credentials et cetera
if (! file_exists(INCLUDES . '/poche/config.inc.php')) {
Poche::$configFileAvailable = false;
} else {
require_once INCLUDES . '/poche/config.inc.php';
}
if (Poche::$configFileAvailable && DOWNLOAD_PICTURES) {
require_once INCLUDES . '/poche/pochePictures.php';
}
if (!ini_get('date.timezone') || !@date_default_timezone_set(ini_get('date.timezone'))) {
date_default_timezone_set('UTC');
}
#XSRF protection with token
if (!empty($_POST)) {
if (!Session::isToken($_POST['token'])) {
die(_('Wrong token'));
}
unset($_SESSION['token']);
}

View File

@ -8,13 +8,11 @@
* @license http://www.wtfpl.net/ see COPYING file
*/
if (file_exists(__DIR__ . '/inc/poche/myconfig.inc.php')) {
require_once __DIR__ . '/inc/poche/myconfig.inc.php';
}
require_once './inc/poche/Tools.class.php';
Tools::createMyConfig();
require_once 'inc/poche/global.inc.php';
include dirname(__FILE__).'/inc/poche/config.inc.php';
# Start Poche
$poche = new Poche();
$notInstalledMessage = $poche -> getNotInstalledMessage();
# Parse GET & REFERER vars
$referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
@ -24,47 +22,57 @@ $id = Tools::checkVar('id');
$_SESSION['sort'] = Tools::checkVar('sort', 'id');
$url = new Url((isset ($_GET['url'])) ? $_GET['url'] : '');
# vars to _always_ send to templates
$tpl_vars = array(
'referer' => $referer,
'view' => $view,
'poche_url' => Tools::getPocheUrl(),
'title' => _('poche, a read it later open source system'),
'token' => Session::getToken(),
'theme' => $poche->getTheme()
);
if (! empty($notInstalledMessage)) {
if (! Poche::$canRenderTemplates || ! Poche::$configFileAvailable) {
# We cannot use Twig to display the error message
die($notInstalledMessage);
} else {
# Twig is installed, put the error message in the template
$tpl_file = Tools::getTplFile('error');
$tpl_vars = array_merge($tpl_vars, array('msg' => $poche->getNotInstalledMessage()));
echo $poche->tpl->render($tpl_file, $tpl_vars);
exit;
}
}
# poche actions
if (isset($_GET['login'])) {
# hello you
$poche->login($referer);
}
elseif (isset($_GET['logout'])) {
} elseif (isset($_GET['logout'])) {
# see you soon !
$poche->logout();
}
elseif (isset($_GET['config'])) {
} elseif (isset($_GET['config'])) {
# Update password
$poche->updatePassword();
}
elseif (isset($_GET['import'])) {
} elseif (isset($_GET['import'])) {
$import = $poche->import($_GET['from']);
}
elseif (isset($_GET['export'])) {
} elseif (isset($_GET['export'])) {
$poche->export();
} elseif (isset($_GET['updatetheme'])) {
$poche->updateTheme();
}
elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
$plain_url = new Url(base64_encode($_GET['plainurl']));
$poche->action('add', $plain_url);
}
# vars to send to templates
$tpl_vars = array(
'lang' => Tools::getDocLanguage($poche->user->getConfigValue('language')),
'referer' => $referer,
'view' => $view,
'poche_url' => Tools::getPocheUrl(),
'title' => _('poche, a read it later open source system'),
'token' => Session::getToken(),
);
if (Session::isLogged()) {
$poche->action($action, $url, $id);
$tpl_file = Tools::getTplFile($view);
$tpl_vars = array_merge($tpl_vars, $poche->displayView($view, $id));
}
else {
$tpl_file = 'login.twig';
} else {
$tpl_file = Tools::getTplFile('login');
}
# because messages can be added in $poche->action(), we have to add this entry now (we can add it before)

1
themes Submodule

@ -0,0 +1 @@
Subproject commit e124e4241ab374f2d825891377e5c4011d48edf0

View File

@ -1,3 +0,0 @@
<script type="text/javascript">
top["bookmarklet-url@inthepoche.com"]=""+"<!DOCTYPE html>"+"<html>"+"<head>"+"<title>poche it !</title>"+'<link rel="icon" href="{{poche_url}}tpl/img/favicon.ico" />'+"</head>"+"<body>"+"<script>"+"window.onload=function(){"+"window.setTimeout(function(){"+"history.back();"+"},250);"+"};"+"</scr"+"ipt>"+"</body>"+"</html>"
</script>

View File

@ -1,4 +0,0 @@
<footer class="w600p center mt3 smaller txtright">
<p>{% trans "powered by" %} <a href="http://inthepoche.com">poche</a></p>
{% if constant('DEBUG_POCHE') == 1 %}<p><strong>{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE_VERSION')}}. {% trans "storage:" %} {{constant('STORAGE')}}</strong></p>{% endif %}
</footer>

View File

@ -1,12 +0,0 @@
<link rel="shortcut icon" type="image/x-icon" href="./tpl/img/favicon.ico" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="./tpl/img/apple-touch-icon-144x144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="./tpl/img/apple-touch-icon-72x72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="./tpl/img/apple-touch-icon-precomposed.png">
<link rel="stylesheet" href="./tpl/css/knacss.css" media="all">
<link rel="stylesheet" href="./tpl/css/style.css" media="all">
<link rel="stylesheet" href="./tpl/css/style-{{ constant('THEME') }}.css" media="all" title="{{ constant('THEME') }} theme">
<link rel="stylesheet" href="./tpl/css/messages.css" media="all">
<link rel="stylesheet" href="./tpl/css/print.css" media="print">
<link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<script src="./tpl/js/jquery-2.0.3.min.js"></script>
<script type="text/javascript">$(document).ready(function(){$("body").prepend('<a href="#top" class="top_link" title="{% trans "back to top" %}"><img src="./tpl/img/{{ constant("THEME") }}/backtotop.png" alt={% trans "back to top" %}"/></a>');$(window).scroll(function(){posScroll=$(document).scrollTop();if(posScroll>=400)$(".top_link").fadeIn(600);else $(".top_link").fadeOut(600)})})</script>

View File

@ -1,7 +0,0 @@
<ul id="links">
<li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "home" %}</a></li>
<li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
<li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
<li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
<li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>

View File

@ -1 +0,0 @@
{{ messages | raw }}

View File

@ -1,7 +0,0 @@
<header class="w600p center mbm">
<h1>
{% if view == 'home' %}{% block logo %}<img src="./tpl/img/logo.png" alt="logo poche" />{% endblock %}
{% else %}<a href="./" title="{% trans "back to home" %}" >{{ block('logo') }}</a>
{% endif %}
</h1>
</header>

View File

@ -1,61 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{% trans "config" %}{% endblock %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
<h2>{% trans "Poching a link" %}</h2>
<p>{% trans "You can poche a link by several methods:" %} (<a href="http://inthepoche.com/doc" title="{% trans "read the documentation" %}">?</a>)</p>
<ul>
<li>firefox: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/poche.xpi" title="download the firefox extension">{% trans "download the extension" %}</a></li>
<li>chrome: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/poche.crx" title="download the chrome extension">{% trans "download the extension" %}</a></li>
<li>android: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/Poche.apk" title="download the application">{% trans "download the application" %}</a></li>
<li>
<form method="get" action="index.php">
<label class="addurl" for="plainurl">{% trans "by filling this field" %}:</label>
<input autofocus required placeholder="Ex:mywebsite.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<input type="submit" value="{% trans "poche it!" %}" />
</form>
</li>
<li>{% trans "bookmarklet: drag & drop this link to your bookmarks bar" %} <a id="bookmarklet" ondragend="this.click();" title="i am a bookmarklet, use me !" href="javascript:if(top['bookmarklet-url@inthepoche.com']){top['bookmarklet-url@inthepoche.com'];}else{(function(){var%20url%20=%20location.href%20||%20url;window.open('{{ poche_url }}?action=add&url='%20+%20btoa(url),'_self');})();void(0);}">{% trans "poche it!" %}</a></li>
</ul>
<h2>{% trans "Updating poche" %}</h2>
<ul>
<li>{% trans "your version" %} : <strong>{{ constant('POCHE_VERSION') }}</strong></li>
<li>{% trans "latest stable version" %} : {{ prod }}. {% if compare_prod == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent stable version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
{% if constant('DEBUG_POCHE') == 1 %}<li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent development version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>{% endif %}
</ul>
<h2>{% trans "Change your password" %}</h2>
<form method="post" action="?config" name="loginform">
<fieldset class="w500p">
<div class="row">
<label class="col w150p" for="password">{% trans "New password:" %}</label>
<input class="col" type="password" id="password" name="password" placeholder="{% trans "Password" %}" tabindex="2">
</div>
<div class="row">
<label class="col w150p" for="password_repeat">{% trans "Repeat your new password:" %}</label>
<input class="col" type="password" id="password_repeat" name="password_repeat" placeholder="{% trans "Password" %}" tabindex="3">
</div>
<div class="row mts txtcenter">
<button class="bouton" type="submit" tabindex="4">{% trans "Update" %}</button>
</div>
</fieldset>
<input type="hidden" name="returnurl" value="{{ referer }}">
<input type="hidden" name="token" value="{{ token }}">
</form>
<h2>{% trans "Import" %}</h2>
<p>{% trans "Please execute the import script locally, it can take a very long time." %}</p>
<p>{% trans "More infos in the official doc:" %} <a href="http://inthepoche.com/doc">inthepoche.com</a></p>
<ul>
<li><a href="./?import&from=pocket">{% trans "import from Pocket" %}</a> {{ '(you must have a %s file on your server)'|trans|format(constant('IMPORT_POCKET_FILE')) }}</li>
<li><a href="./?import&from=readability">{% trans "import from Readability" %}</a> {{ '(you must have a %s file on your server)'|trans|format(constant('IMPORT_READABILITY_FILE')) }}</li>
<li><a href="./?import&from=instapaper">{% trans "import from Instapaper" %}</a> {{ '(you must have a %s file on your server)'|trans|format(constant('IMPORT_INSTAPAPER_FILE')) }}</li>
</ul>
<h2>{% trans "Export your poche datas" %}</h2>
<p><a href="./?export" target="_blank">{% trans "Click here" %}</a> {% trans "to export your poche datas." %}</p>
{% endblock %}

File diff suppressed because one or more lines are too long

View File

@ -1,13 +0,0 @@
.messages { width: 400px; -moz-border-radius: 4px; border-radius: 4px; display: block; padding: 10px 0; margin: 10px auto 10px; clear: both; }
.messages a.closeMessage { margin: -14px -8px 0 0; display:none; width: 16px; height: 16px; float: right; background: url(../img/messages/close.png) no-repeat; }
/*.messages:hover a.closeMessage { visibility:visible; }*/
.messages p { margin: 3px 0 3px 10px !important; padding: 0 10px 0 23px !important; font-size: 14px; line-height: 16px; }
.messages.error { border: 1px solid #C42608; color: #c00 !important; background: #FFF0EF; }
.messages.error p { background: url(../img/messages/cross.png ) no-repeat 0px 50%; color:#c00 !important; }
.messages.success {background: #E0FBCC; border: 1px solid #6DC70C; }
.messages.success p { background: url(../img/messages/tick.png) no-repeat 0px 50%; color: #2B6301 !important; }
.messages.warning { background: #FFFCD3; border: 1px solid #EBCD41; color: #000; }
.messages.warning p { background: url(../img/messages/warning.png ) no-repeat 0px 50%; color: #5F4E01; }
.messages.information, .messages.info { background: #DFEBFB; border: 1px solid #82AEE7; }
.messages.information p, .messages.info p { background: url(../img/messages/help.png ) no-repeat 0px 50%; color: #064393; }
.messages.information a { text-decoration: underline; }

View File

@ -1,19 +0,0 @@
body > header,
body > footer,
a.top_link,
div.tools,
header div
{
display: none !important;
}
article
{
border: none !important;
}
div.vieworiginal a::after
{
margin-left: 5px;
content: "("attr(href)")";
}

View File

@ -1,55 +0,0 @@
a.back span {
background: url('../img/light/left.png');
}
a.top span {
background: url('../img/light/top.png');
}
a.fav span {
background: url('../img/light/star-on.png');
}
a.fav span:hover {
background: url('../img/light/star-off.png');
}
a.fav-off span {
background: url('../img/light/star-off.png');
}
a.fav-off span:hover {
background: url('../img/light/star-on.png');
}
a.archive span {
background: url('../img/light/checkmark-on.png');
}
a.archive span:hover {
background: url('../img/light/checkmark-off.png');
}
a.archive-off span {
background: url('../img/light/checkmark-off.png');
}
a.archive-off span:hover {
background: url('../img/light/checkmark-on.png');
}
a.twitter span {
background: url('../img/light/twitter.png');
}
a.shaarli span {
background: url('../img/light/shaarli.png');
}
a.flattr span {
background: url('../img/light/flattr.png');
}
a.email span {
background: url('../img/light/envelop.png');
}
a.delete span {
background: url('../img/light/remove.png');
}

View File

@ -1,300 +0,0 @@
body {
font-size: 16px;
font-family: 'Roboto', Verdana, Geneva, sans-serif;
margin: 10px;
color: #000;
}
header {
text-align: center;
}
header h1 {
font-size: 1.3em;
}
a, a:hover, a:visited {
color: #000;
}
.bouton {
background-color: #000;
color: #fff;
border: none;
border-radius: 2px;
}
.bouton:hover {
background-color: #222;
color: #f1f1f1;
cursor: pointer;
}
#main {
margin: 0 auto;
}
#main #links {
padding: 0;
list-style-type: none;
text-align: center;
font-size: 0.9em;
}
#main #links li {
display: inline;
}
#main #links li .current {
background-color: #000;
color: #fff;
-webkit-border-radius: 2px;
border-radius: 2px;
}
#main #sort {
padding: 0;
list-style-type: none;
text-align: center;
opacity: 0.5;
}
#main #sort li {
display: inline;
font-size: 0.9em;
}
#main #sort img:hover {
cursor: pointer;
}
#links a {
text-decoration: none;
padding: 5px 10px;
}
#links a:hover {
background-color: #040707;
color: #F1F1F1;
-webkit-border-radius: 2px;
border-radius: 2px;
}
/*** ***/
/*** LINKS DISPLAY ***/
#main .tool {
text-decoration: none;
cursor: pointer;
}
#main #content {
margin-top: 20px;
}
#main #content h2 {
font-size: 1.3em;
text-decoration: none;
}
#main #content .entrie {
border-bottom: 1px dashed #222;
}
/* First entry */
#main #content .results + .entrie {
clear: both;
}
#main .entrie .tools {
list-style-type: none;
}
#main .entrie .tools + p {
min-height: 5.5em;
}
/*
#main .entrie .tools li {
display: inline;
}
*/
.tools {
float: right;
text-align: right;
opacity: 0.5;
}
.tools p {
font-size: 0.8em;
}
/*
.tools ul {
padding: 0; margin: 0;
list-style-type: none;
}
.tools ul li {
line-height: 20px;
}
.tools .tool {
cursor: pointer;
}*/
#main .entrie .tools .tool span, #article .tools .tool span {
display: inline-block;
width: 16px;
height: 16px;
/* Hide textual content */
text-indent: -9999px;
text-align: left;
overflow: hidden;
}
/*** ***/
/*** ARTICLE PAGE ***/
#article {
margin: 0 auto;
}
#article header, #article article {
border-bottom: 1px solid #222;
}
#article header {
text-align: left;
}
#article header a {
text-decoration: none;
}
.vieworiginal a, .vieworiginal a:hover, .vieworiginal a:visited {
text-decoration: none;
color: #888;
}
.backhome {
display: inline;
}
#article .tools {
position: relative;
display: inline;
top: 0;
right: 0;
width: 100%;
}
#article .tools ul li {
display: inline;
}
.results {
overflow: hidden;
padding-bottom: 20px;
padding-top: 10px;
}
.nb-results {
float: left;
font-size: 0.9em;
line-height: 24px;
vertical-align: middle;
}
/* Pagination */
.pagination {
float: right;
text-align: right;
}
.pagination a {
border: 1px solid #d5d5d5;
color: #333;
font-size: 11px;
font-weight: bold;
height: 25px;
padding: 4px 8px;
text-decoration: none;
margin: 2px;
}
.pagination a:hover, .pagination a:active {
background-color: #efefef;
}
.pagination .current {
background-color: #ccc;
border: 1px solid #d5d5d5;
color: #000;
font-size: 11px;
font-weight: bold;
height: 25px;
padding: 4px 8px;
text-decoration: none;
margin: 2px;
}
.pagination .disabled {
display: none;
}
#bookmarklet {
padding: 5px;
border: 1px dashed #808080;
background: #fff;
cursor: move;
}
.top_link {
position: fixed;
right: 15px;
bottom: 15px;
display: none;
padding: 20px;
background: #ccc;
-moz-border-radius: 40px;
-webkit-border-radius: 40px;
border-radius: 40px;
opacity: 0.9;
z-index: 2000;
}
footer {
clear: both;
}
.reading-time {
font-size: 0.8em;
}
#inputform {
display: none;
text-align: center;
max-width: 300px;
margin-left: auto;
margin-right: auto;
margin-top: 5px;
padding-bottom: 5px;
background-color: rgba(0, 0, 0, 0.9);
opacity: 0.8;
color: #fff;
border-radius: 3px;
}
a.back span,
a.top span,
a.fav span,
a.fav span:hover,
a.fav-off span,
a.fav-off span:hover,
a.archive span,
a.archive span:hover,
a.archive-off span,
a.archive-off span:hover,
a.twitter span,
a.flattr span,
a.email span,
a.delete span {
background-repeat: no-repeat;
}

View File

@ -1,6 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{% trans "plop" %}{% endblock %}
{% block content %}
{{ msg|raw }}
<p>Don't forget <a href="http://inthepoche.com/doc">the documentation</a>.</p>
{% endblock %}

View File

@ -1 +0,0 @@
{{ export }}

View File

@ -1,49 +0,0 @@
{% extends "layout.twig" %}
{% block title %}
{% if view == 'fav' %}
{% trans "favoris" %}
{% elseif view == 'archive' %}
{% trans "archive" %}
{% else %}
{% trans "unread" %}
{% endif %}
{% endblock %}
{% block menu %}
{% include '_menu.twig' %}
{% endblock %}
{% block precontent %}
{% if entries|length > 1 %}
<ul id="sort">
<li><a href="./?sort=ia&amp;view={{ view }}"><img src="./tpl/img/{{ constant('THEME') }}/top.png" alt="{% trans "by date asc" %}" title="{% trans "by date asc" %}" /></a> {% trans "by date" %} <a href="./?sort=id&amp;view={{ view }}"><img src="./tpl/img/{{ constant('THEME') }}/down.png" alt="{% trans "by date desc" %}" title="{% trans "by date desc" %}" /></a></li>
<li><a href="./?sort=ta&amp;view={{ view }}"><img src="./tpl/img/{{ constant('THEME') }}/top.png" alt="{% trans "by title asc" %}" title="{% trans "by title asc" %}" /></a> {% trans "by title" %} <a href="./?sort=td&amp;view={{ view }}"><img src="./tpl/img/{{ constant('THEME') }}/down.png" alt="{% trans "by title desc" %}" title="{% trans "by title desc" %}" /></a></li>
</ul>
{% endif %}
{% endblock %}
{% block content %}
{% if entries is empty %}
<div class="messages warning"><p>{% trans "No link available here!" %}</p></div>
{% else %}
{% block pager %}
{% if nb_results > 1 %}
<div class="results">
<div class="nb-results">{{ nb_results }} {% trans "results" %}</div>
{{ page_links | raw }}
</div>
{% endif %}
{% endblock %}
{% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="entrie">
<h2><a href="index.php?view=view&amp;id={{ entry.id|e }}">{{ entry.title|raw }}</a></h2>
<ul class="tools">
<li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "toggle mark as read" %}</span></a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "toggle favorite" %}</span></a></li>
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "delete" %}</span></a></li>
<li class="reading-time">{{ entry.content| getReadingTime }} min</li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
<p class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></p>
</div>
{% endfor %}
{% endif %}
{{ block('pager') }}
{% endblock %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 666 B

View File

@ -1,28 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{% trans "installation" %}{% endblock %}
{% block content %}
<form method="post" action="?install" name="loginform">
<fieldset class="w500p center">
<h2 class="mbs txtcenter">{% trans "install your poche" %}</h2>
<p>
{% trans "poche is still not installed. Please fill the below form to install it. Don't hesitate to <a href='http://inthepoche.com/doc'>read the documentation on poche website</a>." %}
</p>
<p class="row">
<label class="col w150p" for="login">{% trans "Login" %}</label>
<input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus />
</p>
<p class="row">
<label class="col w150p" for="password">{% trans "Password" %}</label>
<input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2">
</p>
<p class="row">
<label class="col w150p" for="password_repeat">{% trans "Repeat your password" %}</label>
<input class="col" type="password" id="password_repeat" name="password_repeat" placeholder="Password" tabindex="3">
</p>
<p class="row mts txtcenter">
<button class="bouton" type="submit" tabindex="4">{% trans "Install" %}</button>
</p>
</fieldset>
<input type="hidden" name="token" value="{{ token }}">
</form>
{% endblock %}

File diff suppressed because one or more lines are too long

View File

@ -1,25 +0,0 @@
function supportsLocalStorage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
function savePercent(id, percent) {
if (!supportsLocalStorage()) { return false; }
localStorage["poche.article." + id + ".percent"] = percent;
return true;
}
function retrievePercent(id) {
if (!supportsLocalStorage()) { return false; }
var bheight = $(document).height();
var percent = localStorage["poche.article." + id + ".percent"];
var scroll = bheight * percent;
$('html,body').animate({scrollTop: scroll}, 'fast');
return true;
}

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<!--[if lte IE 6]><html class="no-js ie6 ie67 ie678" lang="{{ lang }}"><![endif]-->
<!--[if lte IE 7]><html class="no-js ie7 ie67 ie678" lang="{{ lang }}"><![endif]-->
<!--[if IE 8]><html class="no-js ie8 ie678" lang="{{ lang }}"><![endif]-->
<!--[if gt IE 8]><html class="no-js" lang="{{ lang }}"><![endif]-->
<html lang="{{ lang }}">
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=10">
<![endif]-->
<title>{% block title %}{% endblock %} - poche</title>
{% include '_head.twig' %}
{% include '_bookmarklet.twig' %}
</head>
<body>
{% include '_top.twig' %}
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
{% block messages %}
{% include '_messages.twig' %}
{% endblock %}
<div id="content" class="w600p center">
{% block content %}{% endblock %}
</div>
</div>
{% include '_footer.twig' %}
</body>
</html>

View File

@ -1,32 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{% trans "login to your poche" %}{% endblock %}
{% block content %}
<form method="post" action="?login" name="loginform">
<fieldset class="w500p center">
<h2 class="mbs txtcenter">{% trans "login to your poche" %}</h2>
{% if constant('MODE_DEMO') == 1 %}<p>{% trans "you are in demo mode, some features may be disabled." %}</p>{% endif %}
<div class="row">
<label class="col w150p" for="login">{% trans "Login" %}</label>
<input class="col" type="text" id="login" name="login" placeholder="Login" tabindex="1" autofocus {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
</div>
<div class="row">
<label class="col w150p" for="password">{% trans "Password" %}</label>
<input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2" {% if constant('MODE_DEMO') == 1 %}value="poche"{% endif %} />
</div>
<div class="row">
<label class="col w150p" for="longlastingsession">{% trans "Stay signed in" %}</label>
<div class="col">
<input type="checkbox" id="longlastingsession" name="longlastingsession" tabindex="3">
<small class="inbl">{% trans "(Do not check on public computers)" %}</small>
</div>
</div>
<div class="row mts txtcenter">
<button class="bouton" type="submit" tabindex="4">{% trans "Sign in" %}</button>
</div>
</fieldset>
<input type="hidden" name="returnurl" value="{{ referer }}">
<input type="hidden" name="token" value="{{ token }}">
</form>
{% endblock %}

View File

@ -1,59 +0,0 @@
{% extends "layout.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | getDomain }}){% endblock %}
{% block content %}
<div id="article">
<div class="tools">
<ul class="tools">
<li><a href="./" title="{% trans "back to home" %}" class="tool back"><span>{% trans "back to home" %}</span></a></li>
<li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "toggle mark as read" %}</span></a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "toggle favorite" %}</span></a></li>
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "delete" %}</span></a></li>
{% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@getpoche" target="_blank" class="tool twitter" title="{% trans "tweet" %}"><span>{% trans "tweet" %}</span></a></li>{% endif %}
{% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@getpoche" class="tool email" title="{% trans "email" %}"><span>{% trans "email" %}</span></a></li>{% endif %}
{% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
{% if constant('FLATTR') == 1 %}{% if flattr.status == constant('FLATTRABLE') %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span></a></li>{% elseif flattr.status == constant('FLATTRED') %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span>{{ flattr.numflattrs }}</a></li>{% endif %}{% endif %}
</ul>
</div>
<header class="mbm">
<h1>{{ entry.title|raw }}</h1>
<div class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></div>
</header>
<article>
{{ content | raw }}
<div class="vieworiginal txtright small"><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}">{{ entry.url | e | getDomain }}</a></div>
</article>
<div class="tools">
<ul class="tools">
<li><a href="./?" title="{% trans "back to home" %}" class="tool back"><span>{% trans "back to home" %}</span></a></li>
<li><a href="#top" title="{% trans "back to top" %}" class="tool top"><span>{% trans "back to top" %}</span></a></li>
<li><a title="{% trans "toggle mark as read" %}" class="tool archive {% if entry.is_read == 0 %}archive-off{% endif %}" href="./?action=toggle_archive&amp;id={{ entry.id|e }}"><span>{% trans "toggle mark as read" %}</span></a></li>
<li><a title="{% trans "toggle favorite" %}" class="tool fav {% if entry.is_fav == 0 %}fav-off{% endif %}" href="./?action=toggle_fav&amp;id={{ entry.id|e }}"><span>{% trans "toggle favorite" %}</span></a></li>
<li><a title="{% trans "delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "delete" %}</span></a></li>
{% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@getpoche" target="_blank" class="tool twitter" title="{% trans "tweet" %}"><span>{% trans "tweet" %}</span></a></li>{% endif %}
{% if constant('SHARE_MAIL') == 1 %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@getpoche" class="tool email" title="{% trans "email" %}"><span>{% trans "email" %}</span></a></li>{% endif %}
{% if constant('SHARE_SHAARLI') == 1 %}<li><a href="{{ constant('SHAARLI_URL') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans "shaarli" %}"><span>{% trans "shaarli" %}</span></a></li>{% endif %}
{% if constant('FLATTR') == 1 %}{% if flattr.status == constant('FLATTRABLE') %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span></a></li>{% elseif flattr.status == constant('FLATTRED') %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr" target="_blank" title="{% trans "flattr" %}"><span>{% trans "flattr" %}</span>{{ flattr.numflattrs }}</a></li>{% endif %}{% endif %}
</ul>
<p>{% trans "this article appears wrong?" %} <a href="https://github.com/inthepoche/poche/issues/new">{% trans "create an issue" %}</a> {% trans "or" %} <a href="mailto:support@inthepoche.com?subject=Wrong%20display%20in%20poche&amp;body={{ entry.url|url_encode }}">{% trans "contact us by mail" %}</a></p>
</div>
</div>
<script src="./tpl/js/restoreScroll.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var scrollPercent = (scrollTop) / (docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100)/100;
savePercent({{ entry.id|e }}, scrollPercentRounded);
});
retrievePercent({{ entry.id|e }});
$(window).resize(function(){
retrievePercent({{ entry.id|e }});
});
});
</script>
{% endblock %}