aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-10-27 20:36:05 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-10-27 20:36:05 +0100
commit29fe97cb2ffe9d21658cc206e80644a6e2fdb9c7 (patch)
tree90cd1495f9efd48b7d8e35faee762af0ee82b396 /app
parentd677495ca3ded1a65c974fcdc29e989cdae2b583 (diff)
parent2d06b472cdf72175c42269a12cb2470ceda1c084 (diff)
Merge pull request #1011 from Alkarex/allow_robots
Config allow robots
Diffstat (limited to 'app')
-rw-r--r--app/Models/Context.php13
-rw-r--r--app/layout/layout.phtml4
2 files changed, 15 insertions, 2 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php
index dbdbfaa69..2a58bd4ba 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -10,6 +10,7 @@ class FreshRSS_Context {
public static $categories = array();
public static $name = '';
+ public static $description = '';
public static $total_unread = 0;
public static $total_starred = array(
@@ -94,6 +95,13 @@ class FreshRSS_Context {
}
/**
+ * Return true if the current request targets a feed (and not a category or all articles), false otherwise.
+ */
+ public static function isFeed() {
+ return self::$current_get['feed'] != false;
+ }
+
+ /**
* Return true if $get parameter correspond to the $current_get attribute.
*/
public static function isCurrentGet($get) {
@@ -146,8 +154,8 @@ class FreshRSS_Context {
self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE;
break;
case 'f':
- // We try to find the corresponding feed.
- $feed = FreshRSS_CategoryDAO::findFeed(self::$categories, $id);
+ // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description
+ $feed = FreshRSS_Context::$system_conf->allow_robots ? null : FreshRSS_CategoryDAO::findFeed(self::$categories, $id);
if ($feed === null) {
$feedDAO = FreshRSS_Factory::createFeedDao();
$feed = $feedDAO->searchById($id);
@@ -160,6 +168,7 @@ class FreshRSS_Context {
self::$current_get['feed'] = $id;
self::$current_get['category'] = $feed->category();
self::$name = $feed->name();
+ self::$description = $feed->description();
self::$get_unread = $feed->nbNotRead();
break;
case 'c':
diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml
index 083ffd4b3..d7e9d115b 100644
--- a/app/layout/layout.phtml
+++ b/app/layout/layout.phtml
@@ -36,7 +36,11 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="<?php echo FreshRSS_Context::$system_conf->title; ?>">
<meta name="msapplication-TileColor" content="#FFF" />
+<?php if (FreshRSS_Context::$system_conf->allow_robots) { ?>
+ <meta name="description" content="<?php echo htmlspecialchars(FreshRSS_Context::$name . ' | ' . FreshRSS_Context::$description, ENT_NOQUOTES, 'UTF-8'); ?>" />
+<?php } else { ?>
<meta name="robots" content="noindex,nofollow" />
+<?php } ?>
</head>
<body class="<?php echo Minz_Request::param('output', 'normal'); ?>">
<?php $this->partial('header'); ?>