diff --git a/.dockerignore b/.dockerignore index 71a4650..22e6dc7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,5 @@ .gitignore .dockerignore .travis.yml +tests +scripts diff --git a/.gitattributes b/.gitattributes index e074c0c..ac2077b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,5 +29,4 @@ vendor/bin/ export-ignore vendor/fguillot/picofeed/picofeed export-ignore # unittests -phpunit.xml export-ignore **/tests/ export-ignore diff --git a/.gitignore b/.gitignore index fe61f8e..718dfad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,47 +1,13 @@ -# Compiled source # -################### -*.com -*.class -*.dll -*.exe -*.o -*.so -*.pyc - -# Packages # -############ -# it's better to unpack these files and commit the raw source -# git has its own built in compression methods -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Logs and databases # -###################### *.log -*.sql *.sqlite *.sqlite-journal - -# OS generated files # -###################### .DS_Store -ehthumbs.db Icon? Thumbs.db *.swp .*.swp *~ *.lock -*.out - -# IDE generated files # -###################### .idea .buildpath .project @@ -50,12 +16,9 @@ Thumbs.db *.sublime-workspace .nbproject nbproject - -# App specific # -################ config.php -!models/* -!controllers/* +!app/models/* +!app/controllers/* +!app/templates/* rules/*.php data/favicons/*.* -/nbproject/private/ diff --git a/controllers/.htaccess b/app/.htaccess similarity index 100% rename from controllers/.htaccess rename to app/.htaccess diff --git a/check_setup.php b/app/check_setup.php similarity index 97% rename from check_setup.php rename to app/check_setup.php index 6c8a181..82db613 100644 --- a/check_setup.php +++ b/app/check_setup.php @@ -74,5 +74,5 @@ if (! is_writable(FAVICON_DIRECTORY)) { // Include password_compat for PHP < 5.5 if (version_compare(PHP_VERSION, '5.5.0', '<')) { - require __DIR__.'/lib/password.php'; + require __DIR__.'/libraries/password.php'; } diff --git a/app/common.php b/app/common.php new file mode 100644 index 0000000..936da90 --- /dev/null +++ b/app/common.php @@ -0,0 +1,37 @@ + 'sqlite', + 'filename' => Model\Database\get_path(), + )); + + if ($db->schema()->check(Schema\VERSION)) { + return $db; + } + else { + $errors = $db->getLogMessages(); + + $html = 'Unable to migrate the database schema, please copy and paste this message and create a bug report:
';
+ $html .= (isset($errors[0]) ? $errors[0] : 'Unknown SQL error').PHP_EOL.PHP_EOL;
+ $html .= '- PHP version: '.phpversion().PHP_EOL;
+ $html .= '- SAPI: '.php_sapi_name().PHP_EOL;
+ $html .= '- PDO Sqlite version: '.phpversion('pdo_sqlite').PHP_EOL;
+ $html .= '- Sqlite version: '.$db->getDriver()->getDatabaseVersion().PHP_EOL;
+ $html .= '- OS: '.php_uname();
+ $html .= '
';
+
+ die($html);
+ }
+});
diff --git a/common.php b/app/constants.php
similarity index 64%
rename from common.php
rename to app/constants.php
index 2422645..f212733 100644
--- a/common.php
+++ b/app/constants.php
@@ -1,18 +1,12 @@
'sqlite',
- 'filename' => Model\Database\get_path(),
- ));
-
- if ($db->schema()->check(Schema\VERSION)) {
- return $db;
- }
- else {
- $errors = $db->getLogMessages();
-
- $html = 'Unable to migrate the database schema, please copy and paste this message and create a bug report:';
- $html .= (isset($errors[0]) ? $errors[0] : 'Unknown SQL error').PHP_EOL.PHP_EOL;
- $html .= '- PHP version: '.phpversion().PHP_EOL;
- $html .= '- SAPI: '.php_sapi_name().PHP_EOL;
- $html .= '- PDO Sqlite version: '.phpversion('pdo_sqlite').PHP_EOL;
- $html .= '- Sqlite version: '.$db->getDriver()->getDatabaseVersion().PHP_EOL;
- $html .= '- OS: '.php_uname();
- $html .= '
';
-
- die($html);
- }
-});
diff --git a/controllers/bookmark.php b/app/controllers/bookmark.php
similarity index 100%
rename from controllers/bookmark.php
rename to app/controllers/bookmark.php
diff --git a/controllers/common.php b/app/controllers/common.php
similarity index 100%
rename from controllers/common.php
rename to app/controllers/common.php
diff --git a/controllers/config.php b/app/controllers/config.php
similarity index 100%
rename from controllers/config.php
rename to app/controllers/config.php
diff --git a/controllers/console.php b/app/controllers/console.php
similarity index 100%
rename from controllers/console.php
rename to app/controllers/console.php
diff --git a/controllers/feed.php b/app/controllers/feed.php
similarity index 100%
rename from controllers/feed.php
rename to app/controllers/feed.php
diff --git a/controllers/history.php b/app/controllers/history.php
similarity index 100%
rename from controllers/history.php
rename to app/controllers/history.php
diff --git a/controllers/item.php b/app/controllers/item.php
similarity index 100%
rename from controllers/item.php
rename to app/controllers/item.php
diff --git a/controllers/search.php b/app/controllers/search.php
similarity index 100%
rename from controllers/search.php
rename to app/controllers/search.php
diff --git a/controllers/user.php b/app/controllers/user.php
similarity index 100%
rename from controllers/user.php
rename to app/controllers/user.php
diff --git a/lib/Request.php b/app/core/Request.php
similarity index 94%
rename from lib/Request.php
rename to app/core/Request.php
index e4a66ed..b9d6b6f 100644
--- a/lib/Request.php
+++ b/app/core/Request.php
@@ -7,26 +7,22 @@ function get_server_variable($variable)
return isset($_SERVER[$variable]) ? $_SERVER[$variable] : '';
}
-
function param($name, $default_value = null)
{
return isset($_GET[$name]) ? $_GET[$name] : $default_value;
}
-
function int_param($name, $default_value = 0)
{
return isset($_GET[$name]) && ctype_digit($_GET[$name]) ? (int) $_GET[$name] : $default_value;
}
-
function value($name)
{
$values = values();
return isset($values[$name]) ? $values[$name] : null;
}
-
function values()
{
if (! empty($_POST)) {
@@ -42,13 +38,11 @@ function values()
return array();
}
-
function body()
{
return file_get_contents('php://input');
}
-
function file_content($field)
{
if (isset($_FILES[$field])) {
@@ -58,25 +52,21 @@ function file_content($field)
return '';
}
-
function uri()
{
return $_SERVER['REQUEST_URI'];
}
-
function is_post()
{
return $_SERVER['REQUEST_METHOD'] === 'POST';
}
-
function get_user_agent()
{
- return get_server_variable('HTTP_USER_AGENT') ?: t('Unknown');
+ return get_server_variable('HTTP_USER_AGENT') ?: 'Unknown';
}
-
function get_ip_address()
{
$keys = array(
@@ -99,5 +89,5 @@ function get_ip_address()
}
}
- return t('Unknown');
+ return 'Unknown';
}
diff --git a/lib/Response.php b/app/core/Response.php
similarity index 99%
rename from lib/Response.php
rename to app/core/Response.php
index e8dd552..9384fd5 100644
--- a/lib/Response.php
+++ b/app/core/Response.php
@@ -7,7 +7,6 @@ function force_download($filename)
header('Content-Disposition: attachment; filename="'.$filename.'"');
}
-
function status($status_code)
{
$sapi_name = php_sapi_name();
@@ -19,14 +18,12 @@ function status($status_code)
}
}
-
function redirect($url, $status_code = 302)
{
header('Location: '.$url, true, $status_code);
exit;
}
-
function json(array $data, $status_code = 200)
{
status($status_code);
@@ -37,7 +34,6 @@ function json(array $data, $status_code = 200)
exit;
}
-
function text($data, $status_code = 200)
{
status($status_code);
@@ -48,7 +44,6 @@ function text($data, $status_code = 200)
exit;
}
-
function html($data, $status_code = 200)
{
status($status_code);
@@ -59,7 +54,6 @@ function html($data, $status_code = 200)
exit;
}
-
function xml($data, $status_code = 200)
{
status($status_code);
@@ -70,7 +64,6 @@ function xml($data, $status_code = 200)
exit;
}
-
function raw($data, $status_code = 200)
{
status($status_code);
@@ -78,7 +71,6 @@ function raw($data, $status_code = 200)
exit;
}
-
function binary($data, $status_code = 200)
{
status($status_code);
@@ -90,7 +82,6 @@ function binary($data, $status_code = 200)
exit;
}
-
function csp(array $policies = array())
{
$policies['default-src'] = "'self'";
@@ -115,25 +106,21 @@ function csp(array $policies = array())
header('Content-Security-Policy: '.$values);
}
-
function nosniff()
{
header('X-Content-Type-Options: nosniff');
}
-
function xss()
{
header('X-XSS-Protection: 1; mode=block');
}
-
function hsts()
{
header('Strict-Transport-Security: max-age=31536000');
}
-
function xframe($mode = 'DENY', array $urls = array())
{
header('X-Frame-Options: '.$mode.' '.implode(' ', $urls));
diff --git a/lib/Router.php b/app/core/Router.php
similarity index 82%
rename from lib/Router.php
rename to app/core/Router.php
index 2011403..dacbf6a 100644
--- a/lib/Router.php
+++ b/app/core/Router.php
@@ -2,10 +2,11 @@
namespace Router;
-// Load controllers: bootstrap('controllers', 'controller1', 'controller2')
+use Closure;
+
function bootstrap()
{
- $files = \func_get_args();
+ $files = func_get_args();
$base_path = array_shift($files);
foreach ($files as $file) {
@@ -38,7 +39,7 @@ function before_action($name, $value = null)
}
// Execute an action
-function action($name, \Closure $callback)
+function action($name, Closure $callback)
{
$handler = isset($_GET['action']) ? $_GET['action'] : 'default';
@@ -50,7 +51,7 @@ function action($name, \Closure $callback)
}
// Execute an action only for POST requests
-function post_action($name, \Closure $callback)
+function post_action($name, Closure $callback)
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
action($name, $callback);
@@ -58,7 +59,7 @@ function post_action($name, \Closure $callback)
}
// Execute an action only for GET requests
-function get_action($name, \Closure $callback)
+function get_action($name, Closure $callback)
{
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
action($name, $callback);
@@ -66,7 +67,7 @@ function get_action($name, \Closure $callback)
}
// Run when no action have been executed before
-function notfound(\Closure $callback)
+function notfound(Closure $callback)
{
before('notfound');
before_action('notfound');
diff --git a/lib/Session.php b/app/core/Session.php
similarity index 99%
rename from lib/Session.php
rename to app/core/Session.php
index 1e77e75..74aaee1 100644
--- a/lib/Session.php
+++ b/app/core/Session.php
@@ -4,7 +4,6 @@ namespace Session;
const SESSION_LIFETIME = 2678400;
-
function open($base_path = '/', $save_path = '', $session_lifetime = SESSION_LIFETIME)
{
if ($save_path !== '') {
@@ -40,19 +39,16 @@ function open($base_path = '/', $save_path = '', $session_lifetime = SESSION_LIF
}
}
-
function close()
{
session_destroy();
}
-
function flash($message)
{
$_SESSION['flash_message'] = $message;
}
-
function flash_error($message)
{
$_SESSION['flash_error_message'] = $message;
diff --git a/lib/Template.php b/app/core/Template.php
similarity index 95%
rename from lib/Template.php
rename to app/core/Template.php
index a73d523..332ba25 100644
--- a/lib/Template.php
+++ b/app/core/Template.php
@@ -2,7 +2,7 @@
namespace Template;
-const PATH = 'templates/';
+const PATH = __DIR__.'/../templates/';
// Template\load('template_name', ['bla' => 'value']);
function load()
@@ -28,7 +28,6 @@ function load()
return ob_get_clean();
}
-
function layout($template_name, array $template_args = array(), $layout_name = 'layout')
{
return load($layout_name, $template_args + array('content_for_layout' => load($template_name, $template_args)));
diff --git a/app/core/Translator.php b/app/core/Translator.php
new file mode 100644
index 0000000..d7b46a8
--- /dev/null
+++ b/app/core/Translator.php
@@ -0,0 +1,143 @@
+= 0; --$i) {
+ if (isset($locales[$identifier][$i])) {
+ return $locales[$identifier][$i];
+ }
+ }
+
+ return $default;
+}
+
+function load($language)
+{
+ setlocale(LC_TIME, $language.'.UTF-8');
+
+ $path = PATH.$language;
+ $locales = array();
+
+ if (is_dir($path)) {
+ $dir = new \DirectoryIterator($path);
+
+ foreach ($dir as $fileinfo) {
+ if (strpos($fileinfo->getFilename(), '.php') !== false) {
+ $locales = array_merge($locales, include $fileinfo->getPathname());
+ }
+ }
+ }
+
+ container($locales);
+}
+
+function container($locales = null)
+{
+ static $values = array();
+
+ if ($locales !== null) {
+ $values = $locales;
+ }
+
+ return $values;
+}
diff --git a/app/functions.php b/app/functions.php
new file mode 100644
index 0000000..28ab051
--- /dev/null
+++ b/app/functions.php
@@ -0,0 +1,26 @@
+ '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/cs_CZ/translations.php b/app/locales/cs_CZ/translations.php
similarity index 99%
rename from locales/cs_CZ/translations.php
rename to app/locales/cs_CZ/translations.php
index 9c9e543..eac43be 100644
--- a/locales/cs_CZ/translations.php
+++ b/app/locales/cs_CZ/translations.php
@@ -245,6 +245,4 @@ return array(
'Item title links to' => 'Titulek článku odkazuje na',
'Original' => 'Originál',
'Last login:' => 'Poslední přihlášení:',
- 'Search' => 'Hledat',
- 'There are no results for your search' => 'Žádné výsledky vašeho hledání',
);
diff --git a/locales/de_DE/translations.php b/app/locales/de_DE/translations.php
similarity index 99%
rename from locales/de_DE/translations.php
rename to app/locales/de_DE/translations.php
index 5aba224..be17992 100644
--- a/locales/de_DE/translations.php
+++ b/app/locales/de_DE/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/en_US/translations.php b/app/locales/en_US/translations.php
similarity index 100%
rename from locales/en_US/translations.php
rename to app/locales/en_US/translations.php
diff --git a/locales/es_ES/translations.php b/app/locales/es_ES/translations.php
similarity index 99%
rename from locales/es_ES/translations.php
rename to app/locales/es_ES/translations.php
index e709873..1dec4b2 100644
--- a/locales/es_ES/translations.php
+++ b/app/locales/es_ES/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/fr_FR/translations.php b/app/locales/fr_FR/translations.php
similarity index 100%
rename from locales/fr_FR/translations.php
rename to app/locales/fr_FR/translations.php
diff --git a/locales/it_IT/translations.php b/app/locales/it_IT/translations.php
similarity index 99%
rename from locales/it_IT/translations.php
rename to app/locales/it_IT/translations.php
index 6cd72a7..72a3bf5 100644
--- a/locales/it_IT/translations.php
+++ b/app/locales/it_IT/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/ja_JP/translations.php b/app/locales/ja_JP/translations.php
similarity index 99%
rename from locales/ja_JP/translations.php
rename to app/locales/ja_JP/translations.php
index a90b283..221ff68 100644
--- a/locales/ja_JP/translations.php
+++ b/app/locales/ja_JP/translations.php
@@ -247,6 +247,4 @@ return array(
'Item title links to' => 'アイテムのタイトルのリンク先',
'Original' => '元のページ',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/pt_BR/translations.php b/app/locales/pt_BR/translations.php
similarity index 99%
rename from locales/pt_BR/translations.php
rename to app/locales/pt_BR/translations.php
index 80cd3e0..ee7840b 100644
--- a/locales/pt_BR/translations.php
+++ b/app/locales/pt_BR/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/ru_RU/translations.php b/app/locales/ru_RU/translations.php
similarity index 99%
rename from locales/ru_RU/translations.php
rename to app/locales/ru_RU/translations.php
index 536c777..bb320b2 100644
--- a/locales/ru_RU/translations.php
+++ b/app/locales/ru_RU/translations.php
@@ -245,6 +245,4 @@ return array(
'Item title links to' => 'Заголовок статьи ведет на',
'Original' => 'Оригинал',
'Last login:' => 'Последний вход:',
- 'Search' => 'Поиск',
- 'There are no results for your search' => 'По вашему запросу ничего не нашлось',
);
diff --git a/locales/sr_RS/translations.php b/app/locales/sr_RS/translations.php
similarity index 99%
rename from locales/sr_RS/translations.php
rename to app/locales/sr_RS/translations.php
index 0d74004..5d1c38a 100644
--- a/locales/sr_RS/translations.php
+++ b/app/locales/sr_RS/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/sr_RS@latin/translations.php b/app/locales/sr_RS@latin/translations.php
similarity index 99%
rename from locales/sr_RS@latin/translations.php
rename to app/locales/sr_RS@latin/translations.php
index 45ba9c2..172ab78 100644
--- a/locales/sr_RS@latin/translations.php
+++ b/app/locales/sr_RS@latin/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/tr_TR/translations.php b/app/locales/tr_TR/translations.php
similarity index 99%
rename from locales/tr_TR/translations.php
rename to app/locales/tr_TR/translations.php
index fe7b497..c2ed44b 100644
--- a/locales/tr_TR/translations.php
+++ b/app/locales/tr_TR/translations.php
@@ -245,6 +245,4 @@ return array(
'Item title links to' => 'Öğe başlığıyla ilişkili bağlantılar',
'Original' => 'Orijinal',
'Last login:' => 'En son sisteme giriş zamanı:',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/locales/zh_CN/translations.php b/app/locales/zh_CN/translations.php
similarity index 99%
rename from locales/zh_CN/translations.php
rename to app/locales/zh_CN/translations.php
index cd707d0..5ff2989 100644
--- a/locales/zh_CN/translations.php
+++ b/app/locales/zh_CN/translations.php
@@ -245,6 +245,4 @@ return array(
// 'Item title links to' => '',
// 'Original' => '',
// 'Last login:' => '',
- // 'Search' => '',
- // 'There are no results for your search' => '',
);
diff --git a/models/auto_update.php b/app/models/auto_update.php
similarity index 100%
rename from models/auto_update.php
rename to app/models/auto_update.php
diff --git a/models/config.php b/app/models/config.php
similarity index 100%
rename from models/config.php
rename to app/models/config.php
diff --git a/models/database.php b/app/models/database.php
similarity index 100%
rename from models/database.php
rename to app/models/database.php
diff --git a/models/favicon.php b/app/models/favicon.php
similarity index 100%
rename from models/favicon.php
rename to app/models/favicon.php
diff --git a/models/feed.php b/app/models/feed.php
similarity index 100%
rename from models/feed.php
rename to app/models/feed.php
diff --git a/models/group.php b/app/models/group.php
similarity index 100%
rename from models/group.php
rename to app/models/group.php
diff --git a/models/item.php b/app/models/item.php
similarity index 100%
rename from models/item.php
rename to app/models/item.php
diff --git a/models/proxy.php b/app/models/proxy.php
similarity index 100%
rename from models/proxy.php
rename to app/models/proxy.php
diff --git a/models/remember_me.php b/app/models/remember_me.php
similarity index 100%
rename from models/remember_me.php
rename to app/models/remember_me.php
diff --git a/models/service.php b/app/models/service.php
similarity index 100%
rename from models/service.php
rename to app/models/service.php
diff --git a/models/user.php b/app/models/user.php
similarity index 100%
rename from models/user.php
rename to app/models/user.php
diff --git a/models/schema.php b/app/schemas/sqlite.php
similarity index 99%
rename from models/schema.php
rename to app/schemas/sqlite.php
index df80225..6437407 100644
--- a/models/schema.php
+++ b/app/schemas/sqlite.php
@@ -4,7 +4,6 @@ namespace Schema;
use PDO;
use Helper;
-use Model\Config;
const VERSION = 44;
diff --git a/templates/about.php b/app/templates/about.php
similarity index 100%
rename from templates/about.php
rename to app/templates/about.php
diff --git a/templates/add.php b/app/templates/add.php
similarity index 100%
rename from templates/add.php
rename to app/templates/add.php
diff --git a/templates/api.php b/app/templates/api.php
similarity index 100%
rename from templates/api.php
rename to app/templates/api.php
diff --git a/templates/bookmark_links.php b/app/templates/bookmark_links.php
similarity index 100%
rename from templates/bookmark_links.php
rename to app/templates/bookmark_links.php
diff --git a/templates/bookmarks.php b/app/templates/bookmarks.php
similarity index 100%
rename from templates/bookmarks.php
rename to app/templates/bookmarks.php
diff --git a/templates/config.php b/app/templates/config.php
similarity index 100%
rename from templates/config.php
rename to app/templates/config.php
diff --git a/templates/confirm_auto_update.php b/app/templates/confirm_auto_update.php
similarity index 100%
rename from templates/confirm_auto_update.php
rename to app/templates/confirm_auto_update.php
diff --git a/templates/confirm_flush_items.php b/app/templates/confirm_flush_items.php
similarity index 100%
rename from templates/confirm_flush_items.php
rename to app/templates/confirm_flush_items.php
diff --git a/templates/confirm_remove_feed.php b/app/templates/confirm_remove_feed.php
similarity index 100%
rename from templates/confirm_remove_feed.php
rename to app/templates/confirm_remove_feed.php
diff --git a/templates/console.php b/app/templates/console.php
similarity index 100%
rename from templates/console.php
rename to app/templates/console.php
diff --git a/templates/database.php b/app/templates/database.php
similarity index 100%
rename from templates/database.php
rename to app/templates/database.php
diff --git a/templates/edit_feed.php b/app/templates/edit_feed.php
similarity index 100%
rename from templates/edit_feed.php
rename to app/templates/edit_feed.php
diff --git a/templates/feed_items.php b/app/templates/feed_items.php
similarity index 100%
rename from templates/feed_items.php
rename to app/templates/feed_items.php
diff --git a/templates/feeds.php b/app/templates/feeds.php
similarity index 100%
rename from templates/feeds.php
rename to app/templates/feeds.php
diff --git a/templates/help.php b/app/templates/help.php
similarity index 100%
rename from templates/help.php
rename to app/templates/help.php
diff --git a/templates/help_layer.php b/app/templates/help_layer.php
similarity index 100%
rename from templates/help_layer.php
rename to app/templates/help_layer.php
diff --git a/templates/history.php b/app/templates/history.php
similarity index 100%
rename from templates/history.php
rename to app/templates/history.php
diff --git a/templates/import.php b/app/templates/import.php
similarity index 100%
rename from templates/import.php
rename to app/templates/import.php
diff --git a/templates/item.php b/app/templates/item.php
similarity index 100%
rename from templates/item.php
rename to app/templates/item.php
diff --git a/templates/keyboard_shortcuts.php b/app/templates/keyboard_shortcuts.php
similarity index 100%
rename from templates/keyboard_shortcuts.php
rename to app/templates/keyboard_shortcuts.php
diff --git a/templates/layout.php b/app/templates/layout.php
similarity index 100%
rename from templates/layout.php
rename to app/templates/layout.php
diff --git a/templates/login.php b/app/templates/login.php
similarity index 100%
rename from templates/login.php
rename to app/templates/login.php
diff --git a/templates/new_db.php b/app/templates/new_db.php
similarity index 100%
rename from templates/new_db.php
rename to app/templates/new_db.php
diff --git a/templates/paging.php b/app/templates/paging.php
similarity index 100%
rename from templates/paging.php
rename to app/templates/paging.php
diff --git a/templates/search.php b/app/templates/search.php
similarity index 100%
rename from templates/search.php
rename to app/templates/search.php
diff --git a/templates/search_form.php b/app/templates/search_form.php
similarity index 100%
rename from templates/search_form.php
rename to app/templates/search_form.php
diff --git a/templates/services.php b/app/templates/services.php
similarity index 100%
rename from templates/services.php
rename to app/templates/services.php
diff --git a/templates/show_item.php b/app/templates/show_item.php
similarity index 100%
rename from templates/show_item.php
rename to app/templates/show_item.php
diff --git a/templates/show_more.php b/app/templates/show_more.php
similarity index 100%
rename from templates/show_more.php
rename to app/templates/show_more.php
diff --git a/templates/status_links.php b/app/templates/status_links.php
similarity index 100%
rename from templates/status_links.php
rename to app/templates/status_links.php
diff --git a/templates/unread_items.php b/app/templates/unread_items.php
similarity index 100%
rename from templates/unread_items.php
rename to app/templates/unread_items.php
diff --git a/composer.json b/composer.json
index 64188ab..7ff2931 100644
--- a/composer.json
+++ b/composer.json
@@ -25,29 +25,29 @@
},
"autoload": {
"files": [
- "helpers/app.php",
- "helpers/csrf.php",
- "helpers/favicon.php",
- "helpers/form.php",
- "helpers/template.php",
- "lib/Translator.php",
- "lib/Request.php",
- "lib/Response.php",
- "lib/Router.php",
- "lib/Session.php",
- "lib/Template.php",
- "models/config.php",
- "models/service.php",
- "models/user.php",
- "models/feed.php",
- "models/item.php",
- "models/proxy.php",
- "models/schema.php",
- "models/auto_update.php",
- "models/database.php",
- "models/remember_me.php",
- "models/group.php",
- "models/favicon.php"
+ "app/schemas/sqlite.php",
+ "app/helpers/app.php",
+ "app/helpers/csrf.php",
+ "app/helpers/favicon.php",
+ "app/helpers/form.php",
+ "app/helpers/template.php",
+ "app/core/translator.php",
+ "app/core/request.php",
+ "app/core/response.php",
+ "app/core/router.php",
+ "app/core/session.php",
+ "app/core/template.php",
+ "app/models/config.php",
+ "app/models/service.php",
+ "app/models/user.php",
+ "app/models/feed.php",
+ "app/models/item.php",
+ "app/models/proxy.php",
+ "app/models/auto_update.php",
+ "app/models/database.php",
+ "app/models/remember_me.php",
+ "app/models/group.php",
+ "app/models/favicon.php"
],
"classmap": [
"vendor/fguillot/json-rpc/src/",
diff --git a/fever/index.php b/fever/index.php
index dedfe90..356d5cf 100644
--- a/fever/index.php
+++ b/fever/index.php
@@ -1,6 +1,6 @@
= 0; --$i) {
- if (isset($locales[$identifier][$i])) {
- return $locales[$identifier][$i];
- }
- }
-
- return $default;
- }
-
- function load($language)
- {
- setlocale(LC_TIME, $language.'.UTF-8');
-
- $path = PATH.$language;
- $locales = array();
-
- if (is_dir($path)) {
- $dir = new \DirectoryIterator($path);
-
- foreach ($dir as $fileinfo) {
- if (strpos($fileinfo->getFilename(), '.php') !== false) {
- $locales = array_merge($locales, include $fileinfo->getPathname());
- }
- }
- }
-
- container($locales);
- }
-
-
- function container($locales = null)
- {
- static $values = array();
-
- if ($locales !== null) {
- $values = $locales;
- }
-
- return $values;
- }
-}
-
-namespace {
-
- function tne()
- {
- return call_user_func_array('\Translator\translate_no_escaping', func_get_args());
- }
-
- function t()
- {
- return call_user_func_array('\Translator\translate', func_get_args());
- }
-
- function c()
- {
- return call_user_func_array('\Translator\currency', func_get_args());
- }
-
- function n()
- {
- return call_user_func_array('\Translator\number', func_get_args());
- }
-
- function dt()
- {
- return call_user_func_array('\Translator\datetime', func_get_args());
- }
-}
diff --git a/models/.htaccess b/models/.htaccess
deleted file mode 100644
index 14249c5..0000000
--- a/models/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
\ No newline at end of file
diff --git a/producer.php b/producer.php
index aca112f..15dd221 100644
--- a/producer.php
+++ b/producer.php
@@ -2,7 +2,7 @@
use Pheanstalk\Pheanstalk;
-require __DIR__.'/common.php';
+require __DIR__.'/app/common.php';
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);
diff --git a/scripts/find-strings.sh b/scripts/find-strings.sh
index 87e17b3..60ee7d7 100755
--- a/scripts/find-strings.sh
+++ b/scripts/find-strings.sh
@@ -3,7 +3,7 @@
REF_LANG=${1:-fr_FR}
###
-APP_DIR=`dirname $0`/../
+APP_DIR=`dirname $0`/../app
LANG_FILE=$APP_DIR/locales/$REF_LANG/translations.php
TMPFILE=`mktemp`
@@ -20,4 +20,4 @@ do
done < $TMPFILE
# delete the work file
-rm $TMPFILE
\ No newline at end of file
+rm $TMPFILE
diff --git a/scripts/sync-locales.php b/scripts/sync-locales.php
index f3169e3..ea6cccd 100755
--- a/scripts/sync-locales.php
+++ b/scripts/sync-locales.php
@@ -2,7 +2,7 @@
isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== $reference_lang && $fileInfo->getFilename() !== 'en_US') {
-
- $filename = 'locales/'.$fileInfo->getFilename().'/translations.php';
+ $filename = 'app/locales/'.$fileInfo->getFilename().'/translations.php';
echo $fileInfo->getFilename(), ' (', $filename, ')', PHP_EOL;
diff --git a/templates/.htaccess b/templates/.htaccess
deleted file mode 100644
index 14249c5..0000000
--- a/templates/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
\ No newline at end of file
diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php
index bcd8cef..4e98b7f 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -6,27 +6,27 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
- 'b799c009807ac0660ab624d18f619399' => $baseDir . '/helpers/app.php',
- '4b6f1c38c1cab2809f0444d3a253f8f7' => $baseDir . '/helpers/csrf.php',
- '1ec82876b83b01f4d5d91ab48a9cf9df' => $baseDir . '/helpers/favicon.php',
- '3956a461ed00a30b727001d1c861a9b9' => $baseDir . '/helpers/form.php',
- 'f4ed4710801c5f157356a94c00aae76c' => $baseDir . '/helpers/template.php',
- '2ba60f191527015eb45c05a71d95b69f' => $baseDir . '/lib/Translator.php',
- '1d58cdba7ce052ff0ce0219a932c284a' => $baseDir . '/lib/Request.php',
- '8e1ed5229092ce48fdcef0a911fd739d' => $baseDir . '/lib/Response.php',
- '4782391ac54646918f4edda27244ef7a' => $baseDir . '/lib/Router.php',
- '8254a9abcf2a29f2c9e0505482e542ca' => $baseDir . '/lib/Session.php',
- 'ff80894032fd9c2cba066a346e2e80a4' => $baseDir . '/lib/Template.php',
- '044f1c6c1ed68d7380e7cf9c1cbf264f' => $baseDir . '/models/config.php',
- '66494fdbaa467880453e0c3bf7e1b4b6' => $baseDir . '/models/service.php',
- '1f1a35303269c57e110e7f2e8ad5322c' => $baseDir . '/models/user.php',
- '13b4e62b011b583c99539e59127b04c8' => $baseDir . '/models/feed.php',
- 'a34e2b55c1e205f246bb314c6ece3ece' => $baseDir . '/models/item.php',
- '5f0802749b9b6c20dcc4a40bad2c5ab5' => $baseDir . '/models/proxy.php',
- '5fd6b051860571d955491546dde72b3e' => $baseDir . '/models/schema.php',
- '19b5b92aaacb0223866ea24a70b6a079' => $baseDir . '/models/auto_update.php',
- '70b7654853824fd9bf3e8f66157a36b3' => $baseDir . '/models/database.php',
- '6b591661432612d3117d7448ab74aebf' => $baseDir . '/models/remember_me.php',
- '7a00c855e2b58e86f58b8e0eed83ebdb' => $baseDir . '/models/group.php',
- '5d5d97d152d4281dff599cbd7871bf65' => $baseDir . '/models/favicon.php',
+ '1c6478a893aa3a9ae898668d7af7b441' => $baseDir . '/app/schemas/sqlite.php',
+ 'f0aaf41fd213d5a97cf56c060c89445c' => $baseDir . '/app/helpers/app.php',
+ '5d8e3de7e01942090f1b7b4dbdfb5577' => $baseDir . '/app/helpers/csrf.php',
+ '3f7c6586b45b98746d18450089390313' => $baseDir . '/app/helpers/favicon.php',
+ 'e96e91c85d691b966391981f72a31834' => $baseDir . '/app/helpers/form.php',
+ 'b8d3001d29a919647064eeaec3f6551e' => $baseDir . '/app/helpers/template.php',
+ '7793918f03299c5c8c900e412e166b4f' => $baseDir . '/app/core/translator.php',
+ '69d59b59e8b15a53cc782e283523018d' => $baseDir . '/app/core/request.php',
+ '3fd802226a33a97ae29d1f8315ff66a9' => $baseDir . '/app/core/response.php',
+ 'dbd9090b0db725af4a3cd765a9d2e39a' => $baseDir . '/app/core/router.php',
+ '98faa6699f100c5ddb2013d85f9dfabb' => $baseDir . '/app/core/session.php',
+ '93228d441890e5962b0566344884332c' => $baseDir . '/app/core/template.php',
+ 'bc98222aedc910930f5b76b8c84f334e' => $baseDir . '/app/models/config.php',
+ 'c3080c7edf4a590ce36fc4f3561968dc' => $baseDir . '/app/models/service.php',
+ '73671a34a21e27508f85cea36a9837de' => $baseDir . '/app/models/user.php',
+ 'e8bcd5701df9db676003b87e27b091c9' => $baseDir . '/app/models/feed.php',
+ '7318478c1ab18cc398507355a29a93c3' => $baseDir . '/app/models/item.php',
+ '0bdc342df97b8a477df96dbb288b21bf' => $baseDir . '/app/models/proxy.php',
+ 'd06207bd4580f7e9250cf39d0d648fc5' => $baseDir . '/app/models/auto_update.php',
+ '6a19d5803b084354df8269801d4e98e4' => $baseDir . '/app/models/database.php',
+ 'ee585b658e324609d721bc6f959e85c8' => $baseDir . '/app/models/remember_me.php',
+ 'fc49fda782025f9f73852265b1fa7760' => $baseDir . '/app/models/group.php',
+ '785cebb801997d40232b8337459f1606' => $baseDir . '/app/models/favicon.php',
);
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 9342f3e..1d8f7a8 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -7,29 +7,29 @@ namespace Composer\Autoload;
class ComposerStaticInitfd7e8d436e1dc450edc3153ac8bc31b4
{
public static $files = array (
- 'b799c009807ac0660ab624d18f619399' => __DIR__ . '/../..' . '/helpers/app.php',
- '4b6f1c38c1cab2809f0444d3a253f8f7' => __DIR__ . '/../..' . '/helpers/csrf.php',
- '1ec82876b83b01f4d5d91ab48a9cf9df' => __DIR__ . '/../..' . '/helpers/favicon.php',
- '3956a461ed00a30b727001d1c861a9b9' => __DIR__ . '/../..' . '/helpers/form.php',
- 'f4ed4710801c5f157356a94c00aae76c' => __DIR__ . '/../..' . '/helpers/template.php',
- '2ba60f191527015eb45c05a71d95b69f' => __DIR__ . '/../..' . '/lib/Translator.php',
- '1d58cdba7ce052ff0ce0219a932c284a' => __DIR__ . '/../..' . '/lib/Request.php',
- '8e1ed5229092ce48fdcef0a911fd739d' => __DIR__ . '/../..' . '/lib/Response.php',
- '4782391ac54646918f4edda27244ef7a' => __DIR__ . '/../..' . '/lib/Router.php',
- '8254a9abcf2a29f2c9e0505482e542ca' => __DIR__ . '/../..' . '/lib/Session.php',
- 'ff80894032fd9c2cba066a346e2e80a4' => __DIR__ . '/../..' . '/lib/Template.php',
- '044f1c6c1ed68d7380e7cf9c1cbf264f' => __DIR__ . '/../..' . '/models/config.php',
- '66494fdbaa467880453e0c3bf7e1b4b6' => __DIR__ . '/../..' . '/models/service.php',
- '1f1a35303269c57e110e7f2e8ad5322c' => __DIR__ . '/../..' . '/models/user.php',
- '13b4e62b011b583c99539e59127b04c8' => __DIR__ . '/../..' . '/models/feed.php',
- 'a34e2b55c1e205f246bb314c6ece3ece' => __DIR__ . '/../..' . '/models/item.php',
- '5f0802749b9b6c20dcc4a40bad2c5ab5' => __DIR__ . '/../..' . '/models/proxy.php',
- '5fd6b051860571d955491546dde72b3e' => __DIR__ . '/../..' . '/models/schema.php',
- '19b5b92aaacb0223866ea24a70b6a079' => __DIR__ . '/../..' . '/models/auto_update.php',
- '70b7654853824fd9bf3e8f66157a36b3' => __DIR__ . '/../..' . '/models/database.php',
- '6b591661432612d3117d7448ab74aebf' => __DIR__ . '/../..' . '/models/remember_me.php',
- '7a00c855e2b58e86f58b8e0eed83ebdb' => __DIR__ . '/../..' . '/models/group.php',
- '5d5d97d152d4281dff599cbd7871bf65' => __DIR__ . '/../..' . '/models/favicon.php',
+ '1c6478a893aa3a9ae898668d7af7b441' => __DIR__ . '/../..' . '/app/schemas/sqlite.php',
+ 'f0aaf41fd213d5a97cf56c060c89445c' => __DIR__ . '/../..' . '/app/helpers/app.php',
+ '5d8e3de7e01942090f1b7b4dbdfb5577' => __DIR__ . '/../..' . '/app/helpers/csrf.php',
+ '3f7c6586b45b98746d18450089390313' => __DIR__ . '/../..' . '/app/helpers/favicon.php',
+ 'e96e91c85d691b966391981f72a31834' => __DIR__ . '/../..' . '/app/helpers/form.php',
+ 'b8d3001d29a919647064eeaec3f6551e' => __DIR__ . '/../..' . '/app/helpers/template.php',
+ '7793918f03299c5c8c900e412e166b4f' => __DIR__ . '/../..' . '/app/core/translator.php',
+ '69d59b59e8b15a53cc782e283523018d' => __DIR__ . '/../..' . '/app/core/request.php',
+ '3fd802226a33a97ae29d1f8315ff66a9' => __DIR__ . '/../..' . '/app/core/response.php',
+ 'dbd9090b0db725af4a3cd765a9d2e39a' => __DIR__ . '/../..' . '/app/core/router.php',
+ '98faa6699f100c5ddb2013d85f9dfabb' => __DIR__ . '/../..' . '/app/core/session.php',
+ '93228d441890e5962b0566344884332c' => __DIR__ . '/../..' . '/app/core/template.php',
+ 'bc98222aedc910930f5b76b8c84f334e' => __DIR__ . '/../..' . '/app/models/config.php',
+ 'c3080c7edf4a590ce36fc4f3561968dc' => __DIR__ . '/../..' . '/app/models/service.php',
+ '73671a34a21e27508f85cea36a9837de' => __DIR__ . '/../..' . '/app/models/user.php',
+ 'e8bcd5701df9db676003b87e27b091c9' => __DIR__ . '/../..' . '/app/models/feed.php',
+ '7318478c1ab18cc398507355a29a93c3' => __DIR__ . '/../..' . '/app/models/item.php',
+ '0bdc342df97b8a477df96dbb288b21bf' => __DIR__ . '/../..' . '/app/models/proxy.php',
+ 'd06207bd4580f7e9250cf39d0d648fc5' => __DIR__ . '/../..' . '/app/models/auto_update.php',
+ '6a19d5803b084354df8269801d4e98e4' => __DIR__ . '/../..' . '/app/models/database.php',
+ 'ee585b658e324609d721bc6f959e85c8' => __DIR__ . '/../..' . '/app/models/remember_me.php',
+ 'fc49fda782025f9f73852265b1fa7760' => __DIR__ . '/../..' . '/app/models/group.php',
+ '785cebb801997d40232b8337459f1606' => __DIR__ . '/../..' . '/app/models/favicon.php',
);
public static $prefixLengthsPsr4 = array (
diff --git a/worker.php b/worker.php
index b0481c4..bcd9bea 100644
--- a/worker.php
+++ b/worker.php
@@ -2,7 +2,7 @@
use Pheanstalk\Pheanstalk;
-require __DIR__.'/common.php';
+require __DIR__.'/app/common.php';
if (php_sapi_name() !== 'cli') {
die('This script can run only from the command line.'.PHP_EOL);