aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-16 19:45:39 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-03-16 19:45:39 +0100
commite685b541487b814cbab87ea2b6a6a4d12cd72f06 (patch)
tree184cf3d29662b0fa1cc6ea8e0250c972abc25715 /app
parentdbdda1d0c19b48d06b30879e8fe78679f79cc0c4 (diff)
parent996c387f50f9b65f271b3cd13b9d63165236b6d2 (diff)
Merge branch 'dev' into 163-export
Diffstat (limited to 'app')
-rwxr-xr-xapp/Controllers/entryController.php3
-rwxr-xr-xapp/Controllers/feedController.php12
-rwxr-xr-xapp/Controllers/indexController.php4
-rw-r--r--app/Controllers/usersController.php8
-rw-r--r--app/Models/Configuration.php15
-rw-r--r--app/Models/Feed.php11
-rw-r--r--app/Models/Share.php3
-rw-r--r--app/Models/Themes.php1
-rw-r--r--app/i18n/en.php4
-rw-r--r--app/i18n/fr.php4
-rw-r--r--app/layout/aside_feed.phtml5
-rw-r--r--app/layout/layout.phtml8
-rw-r--r--app/layout/nav_menu.phtml20
-rw-r--r--app/views/configure/sharing.phtml2
-rw-r--r--app/views/configure/users.phtml23
-rw-r--r--app/views/helpers/view/normal_view.phtml4
-rwxr-xr-xapp/views/helpers/view/rss_view.phtml2
17 files changed, 88 insertions, 41 deletions
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
index ca7122a7c..bbcb990f5 100755
--- a/app/Controllers/entryController.php
+++ b/app/Controllers/entryController.php
@@ -100,6 +100,9 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
$entryDAO = new FreshRSS_EntryDAO();
$entryDAO->optimizeTable();
+ $feedDAO = new FreshRSS_FeedDAO();
+ $feedDAO->updateCachedValues();
+
invalidateHttpCache();
$notif = array (
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index c718fcd5c..16516ad39 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -30,6 +30,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$url = Minz_Request::param ('url_rss');
$cat = Minz_Request::param ('category', false);
+ if ($cat === 'nc') {
+ $new_cat = Minz_Request::param ('new_category');
+ if (empty($new_cat['name'])) {
+ $cat = false;
+ } else {
+ $cat = $this->catDAO->addCategory($new_cat);
+ }
+ }
if ($cat === false) {
$def_cat = $this->catDAO->getDefault ();
$cat = $def_cat->id ();
@@ -128,7 +136,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
$notif = array (
'type' => 'bad',
- 'content' => Minz_Translate::t ('internal_problem_feed')
+ 'content' => Minz_Translate::t ('internal_problem_feed', Minz_Url::display(array('a' => 'logs')))
);
Minz_Session::_param ('notification', $notif);
} catch (Minz_FileNotExistException $e) {
@@ -136,7 +144,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
$notif = array (
'type' => 'bad',
- 'content' => Minz_Translate::t ('internal_problem_feed')
+ 'content' => Minz_Translate::t ('internal_problem_feed', Minz_Url::display(array('a' => 'logs')))
);
Minz_Session::_param ('notification', $notif);
}
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 73f454715..9da1e5022 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -25,16 +25,14 @@ class FreshRSS_index_Controller extends Minz_ActionController {
}
}
- // construction of RSS url of this feed
$params = Minz_Request::params ();
- $params['output'] = 'rss';
if (isset ($params['search'])) {
$params['search'] = urlencode ($params['search']);
}
if (!Minz_Configuration::allowAnonymous()) {
$params['token'] = $token;
}
- $this->view->rss_url = array (
+ $this->view->url = array (
'c' => 'index',
'a' => 'index',
'params' => $params
diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php
index b03989cd7..fa967cedc 100644
--- a/app/Controllers/usersController.php
+++ b/app/Controllers/usersController.php
@@ -69,13 +69,19 @@ class FreshRSS_users_Controller extends Minz_ActionController {
$anon_refresh = Minz_Request::param('anon_refresh', false);
$anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no');
$auth_type = Minz_Request::param('auth_type', 'none');
+ $unsafe_autologin = Minz_Request::param('unsafe_autologin', false);
+ $api_enabled = Minz_Request::param('api_enabled', false);
if ($anon != Minz_Configuration::allowAnonymous() ||
$auth_type != Minz_Configuration::authType() ||
- $anon_refresh != Minz_Configuration::allowAnonymousRefresh()) {
+ $anon_refresh != Minz_Configuration::allowAnonymousRefresh() ||
+ $unsafe_autologin != Minz_Configuration::unsafeAutologinEnabled() ||
+ $api_enabled != Minz_Configuration::apiEnabled()) {
Minz_Configuration::_authType($auth_type);
Minz_Configuration::_allowAnonymous($anon);
Minz_Configuration::_allowAnonymousRefresh($anon_refresh);
+ Minz_Configuration::_enableAutologin($unsafe_autologin);
+ Minz_Configuration::_enableApi($api_enabled);
$ok &= Minz_Configuration::writeFile();
}
}
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 827a1d166..80031369e 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -193,7 +193,9 @@ class FreshRSS_Configuration {
if (!is_array($value)) {
continue;
}
- if (array_key_exists('url', $value)) {
+
+ // Verify URL and add default value when needed
+ if (isset($value['url'])) {
$is_url = (
filter_var ($value['url'], FILTER_VALIDATE_URL) ||
(version_compare(PHP_VERSION, '5.3.3', '<') &&
@@ -203,10 +205,15 @@ class FreshRSS_Configuration {
if (!$is_url) {
continue;
}
- if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) {
- $value['name'] = $value['type'];
- }
+ } else {
+ $value['url'] = null;
}
+
+ // Add a default name
+ if (empty($value['name'])) {
+ $value['name'] = $value['type'];
+ }
+
$this->data['sharing'][] = $value;
}
}
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 73f9c32fb..bce3bd24f 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -254,11 +254,12 @@ class FreshRSS_Feed extends Minz_Model {
$elinks = array();
foreach ($item->get_enclosures() as $enclosure) {
$elink = $enclosure->get_link();
- if (array_key_exists($elink, $elinks)) continue;
- $elinks[$elink] = '1';
- $mime = strtolower($enclosure->get_type());
- if (strpos($mime, 'image/') === 0) {
- $content .= '<br /><img src="' . $elink . '" alt="" />';
+ if (empty($elinks[$elink])) {
+ $elinks[$elink] = '1';
+ $mime = strtolower($enclosure->get_type());
+ if (strpos($mime, 'image/') === 0) {
+ $content .= '<br /><img src="' . $elink . '" alt="" />';
+ }
}
}
diff --git a/app/Models/Share.php b/app/Models/Share.php
index 887fcef05..b146db722 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -3,9 +3,6 @@
class FreshRSS_Share {
static public function generateUrl($options, $selected, $link, $title) {
- if (!array_key_exists('url', $selected)) {
- $selected['url'] = '';
- }
$share = $options[$selected['type']];
$matches = array(
'~URL~',
diff --git a/app/Models/Themes.php b/app/Models/Themes.php
index c7099a1df..ed746b7e9 100644
--- a/app/Models/Themes.php
+++ b/app/Models/Themes.php
@@ -77,6 +77,7 @@ class FreshRSS_Themes extends Minz_Model {
'down' => '▽',
'favorite' => '★',
'help' => 'ⓘ',
+ 'key' => '⚿',
'link' => '↗',
'login' => '🔒',
'logout' => '🔓',
diff --git a/app/i18n/en.php b/app/i18n/en.php
index 7f812dce6..e9bed39a7 100644
--- a/app/i18n/en.php
+++ b/app/i18n/en.php
@@ -89,7 +89,7 @@ return array (
'already_subscribed' => 'You have already subscribed to <em>%s</em>',
'feed_added' => 'RSS feed <em>%s</em> has been added',
'feed_not_added' => '<em>%s</em> could not be added',
- 'internal_problem_feed' => 'The RSS feed could not be added. Check FressRSS logs for details.',
+ 'internal_problem_feed' => 'The RSS feed could not be added. <a href="%s">Check FressRSS logs</a> for details.',
'invalid_url' => 'URL <em>%s</em> is invalid',
'feed_actualized' => '<em>%s</em> has been updated',
'n_feeds_actualized' => '%d feeds have been updated',
@@ -180,6 +180,8 @@ return array (
'persona_connection_email' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>',
'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)',
'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles',
+ 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ',
+ 'api_enabled' => 'Allow <abbr>API</abbr> access <small>(required for mobile apps)</small>',
'auth_token' => 'Authentication token',
'explain_token' => 'Allows to access RSS output of the default user without authentication.<br /><kbd>%s?output=rss&token=%s</kbd>',
'login_configuration' => 'Login',
diff --git a/app/i18n/fr.php b/app/i18n/fr.php
index 6aa25f7db..24f3741c8 100644
--- a/app/i18n/fr.php
+++ b/app/i18n/fr.php
@@ -89,7 +89,7 @@ return array (
'already_subscribed' => 'Vous êtes déjà abonné à <em>%s</em>',
'feed_added' => 'Le flux <em>%s</em> a bien été ajouté',
'feed_not_added' => '<em>%s</em> n’a pas pu être ajouté',
- 'internal_problem_feed' => 'Le flux n’a pas pu être ajouté. Consulter les logs de FreshRSS pour plus de détails.',
+ 'internal_problem_feed' => 'Le flux n’a pas pu être ajouté. <a href="%s">Consulter les logs de FreshRSS</a> pour plus de détails.',
'invalid_url' => 'L’url <em>%s</em> est invalide',
'feed_actualized' => '<em>%s</em> a été mis à jour',
'n_feeds_actualized' => '%d flux ont été mis à jour',
@@ -180,6 +180,8 @@ return array (
'persona_connection_email' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>',
'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)',
'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux',
+ 'unsafe_autologin' => 'Autoriser les connexion automatiques non-sûres au format : ',
+ 'api_enabled' => 'Autoriser l’accès par <abbr>API</abbr> <small>(nécessaire pour les applis mobiles)</small>',
'auth_token' => 'Jeton d’identification',
'explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.<br /><kbd>%s?output=rss&token=%s</kbd>',
'login_configuration' => 'Identification',
diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml
index 63f171924..899cafe02 100644
--- a/app/layout/aside_feed.phtml
+++ b/app/layout/aside_feed.phtml
@@ -20,9 +20,14 @@
<?php echo $cat->name (); ?>
</option>
<?php } ?>
+ <option value="nc"><?php echo Minz_Translate::t ('new_category'); ?></option>
</select>
</li>
+ <li class="input" style="display:none">
+ <input type="text" name="new_category[name]" id="new_category_name" autocomplete="off" placeholder="<?php echo Minz_Translate::t ('new_category'); ?>" />
+ </li>
+
<li class="separator"></li>
<li class="dropdown-header"><?php echo Minz_Translate::t ('http_authentication'); ?></li>
diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml
index 1501df3c3..63255b54f 100644
--- a/app/layout/layout.phtml
+++ b/app/layout/layout.phtml
@@ -18,8 +18,12 @@
<?php } ?>
<link rel="shortcut icon" type="image/x-icon" sizes="16x16 64x64" href="<?php echo Minz_Url::display('/favicon.ico'); ?>" />
<link rel="icon msapplication-TileImage apple-touch-icon" type="image/png" sizes="256x256" href="<?php echo Minz_Url::display('/themes/icons/favicon-256.png'); ?>" />
-<?php if (isset ($this->rss_url)) { ?>
- <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display ($this->rss_url); ?>" />
+<?php
+ if (isset($this->url)) {
+ $rss_url = $this->url;
+ $rss_url['params']['output'] = 'rss';
+?>
+ <link rel="alternate" type="application/rss+xml" title="<?php echo $this->rss_title; ?>" href="<?php echo Minz_Url::display ($rss_url); ?>" />
<?php } ?>
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('starred', true); ?>">
<link rel="prefetch" href="<?php echo FreshRSS_Themes::icon('non-starred', true); ?>">
diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml
index 097809e08..ffdc95b24 100644
--- a/app/layout/nav_menu.phtml
+++ b/app/layout/nav_menu.phtml
@@ -99,17 +99,6 @@
</div>
<?php } ?>
- <?php
- $params = Minz_Request::params ();
- if (isset ($params['search'])) {
- $params['search'] = urlencode ($params['search']);
- }
- $url = array (
- 'c' => 'index',
- 'a' => 'index',
- 'params' => $params
- );
- ?>
<div class="dropdown" id="nav_menu_views">
<div id="dropdown-views" class="dropdown-target"></div>
<a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Minz_Translate::t ('display'); ?> <?php echo FreshRSS_Themes::icon('down'); ?></a>
@@ -117,7 +106,7 @@
<li class="dropdown-close"><a href="#close">❌</a></li>
<?php
- $url_output = $url;
+ $url_output = $this->url;
if ($actual_view !== 'normal') { ?>
<li class="item">
<?php $url_output['params']['output'] = 'normal'; ?>
@@ -144,7 +133,7 @@
<li class="separator"></li>
<?php
- $url_state = $url;
+ $url_state = $this->url;
$url_state['params']['state'] = 'all';
?>
<li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>">
@@ -181,7 +170,7 @@
<li class="item">
<?php
- $url_order = $url;
+ $url_order = $this->url;
if ($this->order === 'DESC') {
$url_order['params']['order'] = 'ASC';
?>
@@ -201,7 +190,8 @@
<li class="separator"></li>
<li class="item">
- <a class="view_rss" target="_blank" href="<?php echo Minz_Url::display ($this->rss_url); ?>">
+ <?php $url_output['params']['output'] = 'rss'; ?>
+ <a class="view_rss" target="_blank" href="<?php echo Minz_Url::display ($url_output); ?>">
<?php echo Minz_Translate::t ('rss_view'); ?>
</a>
</li>
diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml
index b50e6ddc4..ddb404ef5 100644
--- a/app/views/configure/sharing.phtml
+++ b/app/views/configure/sharing.phtml
@@ -35,7 +35,7 @@
<a href='#' class='share add'><?php echo FreshRSS_Themes::icon('add'); ?></a>
<select>
<?php foreach($this->conf->shares as $key => $params):?>
- <option value='<?php echo $key?>' data-form='<?php echo $params['form']?>' data-help='<?php echo $params['help']?>'><?php echo Minz_Translate::t($key) ?></option>
+ <option value='<?php echo $key?>' data-form='<?php echo $params['form']?>' data-help='<?php if (!empty($params['help'])) {echo $params['help'];}?>'><?php echo Minz_Translate::t($key) ?></option>
<?php endforeach; ?>
</select>
</div>
diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml
index 3f3f19418..fdc94cd18 100644
--- a/app/views/configure/users.phtml
+++ b/app/views/configure/users.phtml
@@ -21,6 +21,7 @@
<label class="group-name" for="passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
<div class="group-controls">
<input type="password" id="passwordPlain" name="passwordPlain" autocomplete="off" pattern=".{7,}" <?php echo cryptAvailable() ? '' : 'disabled="disabled" '; ?>/>
+ <a class="btn toggle-password"/><?php echo FreshRSS_Themes::icon('key'); ?></a>
<noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
</div>
</div>
@@ -90,6 +91,17 @@
</div>
</div>
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="unsafe_autologin">
+ <input type="checkbox" name="unsafe_autologin" id="unsafe_autologin" value="1"<?php echo Minz_Configuration::unsafeAutologinEnabled() ? ' checked="checked"' : '',
+ Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />
+ <?php echo Minz_Translate::t('unsafe_autologin'); ?>
+ <kbd>p/i/?a=formLogin&amp;u=Alice&amp;p=1234</kbd>
+ </label>
+ </div>
+ </div>
+
<?php if (Minz_Configuration::canLogIn()) { ?>
<div class="form-group">
<label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label>
@@ -102,6 +114,16 @@
</div>
<?php } ?>
+ <div class="form-group">
+ <div class="group-controls">
+ <label class="checkbox" for="api_enabled">
+ <input type="checkbox" name="api_enabled" id="api_enabled" value="1"<?php echo Minz_Configuration::apiEnabled() ? ' checked="checked"' : '',
+ Minz_Configuration::needsLogin() ? '' : ' disabled="disabled"'; ?> />
+ <?php echo Minz_Translate::t('api_enabled'); ?>
+ </label>
+ </div>
+ </div>
+
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>
@@ -157,6 +179,7 @@
<label class="group-name" for="new_user_passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label>
<div class="group-controls">
<input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" />
+ <a class="btn toggle-password"/><?php echo FreshRSS_Themes::icon('key'); ?></a>
<noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript>
</div>
</div>
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml
index ff535c60a..b0f90b4c9 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/helpers/view/normal_view.phtml
@@ -28,7 +28,7 @@ if (!empty($this->entries)) {
<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
?><div id="new-article">
- <a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a>
+ <a href="<?php echo Minz_Url::display ($this->url); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a>
</div><?php
foreach ($this->entries as $item) {
if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) {
@@ -138,7 +138,7 @@ if (!empty($this->entries)) {
<?php foreach ($sharing as $share) :?>
<li class="item share">
<a target="_blank" href="<?php echo FreshRSS_Share::generateUrl($this->conf->shares, $share, $item->link(), $item->title() . ' . ' . $feed->name())?>">
- <?php echo array_key_exists('name', $share) ? $share['name'] : Minz_Translate::t ($share['type']);?>
+ <?php echo Minz_Translate::t ($share['name']);?>
</a>
</li>
<?php endforeach;?>
diff --git a/app/views/helpers/view/rss_view.phtml b/app/views/helpers/view/rss_view.phtml
index 620bf1388..2c6ca610b 100755
--- a/app/views/helpers/view/rss_view.phtml
+++ b/app/views/helpers/view/rss_view.phtml
@@ -6,7 +6,7 @@
<description><?php echo Minz_Translate::t ('rss_feeds_of', $this->rss_title); ?></description>
<pubDate><?php echo date('D, d M Y H:i:s O'); ?></pubDate>
<lastBuildDate><?php echo gmdate('D, d M Y H:i:s'); ?> GMT</lastBuildDate>
- <atom:link href="<?php echo Minz_Url::display ($this->rss_url, 'html', true); ?>" rel="self" type="application/rss+xml" />
+ <atom:link href="<?php echo Minz_Url::display ($this->url, 'html', true); ?>" rel="self" type="application/rss+xml" />
<?php
foreach ($this->entries as $item) {
?>