Răsfoiți Sursa

Improve system of queries

- Coding style
- More checks server side
- Default query name is "Query n°X"
- List of queries is moved into nav_menu, in a dropdown
- Better system to remove fields in JS (to a.remove elements, give an
  attibute data-remove="id_to_remove")
- Fix a bug in lib/Mine/Request.php (htmlspecialchars_utf8 can be applied on
  arrays now)
- Few theme improvements
- Add an element .no-mobile to apply to elements which should not appear on
  mobiles

See https://github.com/marienfressinaud/FreshRSS/pull/498
Marien Fressinaud 11 ani în urmă
părinte
comite
a7e8332809

+ 44 - 22
app/Controllers/configureController.php

@@ -302,8 +302,14 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	
 	public function queriesAction () {
 		if (Minz_Request::isPost ()) {
-			$params = Minz_Request::params();
-			$this->view->conf->_queries (isset($params['queries']) ? $params['queries'] : array());
+			$queries = Minz_Request::param('queries', array());
+
+			foreach ($queries as $key => $query) {
+				if (!$query['name']) {
+					$query['name'] = Minz_Translate::t('query_number', $key + 1);
+				}
+			}
+			$this->view->conf->_queries($queries);
 			$this->view->conf->save();
 
 			$notif = array (
@@ -316,25 +322,39 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 		} else {
 			$this->view->query_get = array();
 			foreach ($this->view->conf->queries as $key => $query) {
-				if (isset($query['get'])) {
-					switch ($query['get'][0]) {
-						case 'c':
-							$dao = new FreshRSS_CategoryDAO();
-							$category = $dao->searchById(substr($query['get'], 2));
-							$this->view->query_get[$key] = array(
-								'type' => 'category',
-								'name' => $category->name(),
-							);
-							break;
-						case 'f':
-							$dao = new FreshRSS_FeedDAO();
-							$feed = $dao->searchById(substr($query['get'], 2));
-							$this->view->query_get[$key] = array(
-								'type' => 'feed',
-								'name' => $feed->name(),
-							);
-							break;
-					}
+				if (!isset($query['get'])) {
+					continue;
+				}
+
+				switch ($query['get'][0]) {
+				case 'c':
+					$dao = new FreshRSS_CategoryDAO();
+					$category = $dao->searchById(substr($query['get'], 2));
+					$this->view->query_get[$key] = array(
+						'type' => 'category',
+						'name' => $category->name(),
+					);
+					break;
+				case 'f':
+					$dao = new FreshRSS_FeedDAO();
+					$feed = $dao->searchById(substr($query['get'], 2));
+					$this->view->query_get[$key] = array(
+						'type' => 'feed',
+						'name' => $feed->name(),
+					);
+					break;
+				case 's':
+					$this->view->query_get[$key] = array(
+						'type' => 'favorite',
+						'name' => 'favorite',
+					);
+					break;
+				case 'a':
+					$this->view->query_get[$key] = array(
+						'type' => 'all',
+						'name' => 'all',
+					);
+					break;
 				}
 			}
 		}
@@ -345,12 +365,14 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	public function addQueryAction () {
 		$queries = $this->view->conf->queries;
 		$query = Minz_Request::params();
+		$query['name'] = Minz_Translate::t('query_number', count($queries) + 1);
 		unset($query['output']);
 		unset($query['token']);
 		$queries[] = $query;
 		$this->view->conf->_queries($queries);
 		$this->view->conf->save();
-		
+
+		// Minz_Request::forward(array('params' => $query), true);
 		Minz_Request::forward(array('c' => 'configure', 'a' => 'queries'), true);
 	}
 }

+ 7 - 1
app/Models/Configuration.php

@@ -223,7 +223,13 @@ class FreshRSS_Configuration {
 	public function _queries ($values) {
 		$this->data['queries'] = array();
 		foreach ($values as $value) {
-			$this->data['queries'][] = array_filter($value);
+			$value = array_filter($value);
+			$params = $value;
+			unset($params['name']);
+			unset($params['url']);
+			$value['url'] = Minz_Url::display(array('params' => $params));
+
+			$this->data['queries'][] = $value;
 		}
 	}
 	public function _theme($value) {

+ 28 - 21
app/i18n/en.php

@@ -16,27 +16,34 @@ return array (
 	'feeds'				=> 'Feeds',
 	'shortcuts'			=> 'Shortcuts',
 	'queries'			=> 'User queries',
-	'query-search'			=> 'Search for "%s"',
-	'query-order-asc'		=> 'Display oldest articles first',
-	'query-order-desc'		=> 'Display newest articles first',
-	'query-get-category'		=> 'Display "%s" category',
-	'query-get-feed'		=> 'Display "%s" feed',
-	'query-state-0'			=> 'Display all articles',
-	'query-state-1'			=> 'Display read articles',
-	'query-state-2'			=> 'Display unread articles',
-	'query-state-3'			=> 'Display all articles',
-	'query-state-4'			=> 'Display favorite articles',
-	'query-state-5'			=> 'Display read favorite articles',
-	'query-state-6'			=> 'Display unread favorite articles',
-	'query-state-7'			=> 'Display favorite articles',
-	'query-state-8'			=> 'Display not favorite articles',
-	'query-state-9'			=> 'Display read not favorite articles',
-	'query-state-10'		=> 'Display unread not favorite articles',
-	'query-state-11'		=> 'Display not favorite articles',
-	'query-state-12'		=> 'Display all articles',
-	'query-state-13'		=> 'Display read articles',
-	'query-state-14'		=> 'Display unread articles',
-	'query-state-15'		=> 'Display all articles',
+	'query_search'			=> 'Search for "%s"',
+	'query_order_asc'		=> 'Display oldest articles first',
+	'query_order_desc'		=> 'Display newest articles first',
+	'query_get_category'		=> 'Display "%s" category',
+	'query_get_feed'		=> 'Display "%s" feed',
+	'query_get_all'			=> 'Display all articles',
+	'query_get_favorite'		=> 'Display favorite articles',
+	'query_state_0'			=> 'Display all articles',
+	'query_state_1'			=> 'Display read articles',
+	'query_state_2'			=> 'Display unread articles',
+	'query_state_3'			=> 'Display all articles',
+	'query_state_4'			=> 'Display favorite articles',
+	'query_state_5'			=> 'Display read favorite articles',
+	'query_state_6'			=> 'Display unread favorite articles',
+	'query_state_7'			=> 'Display favorite articles',
+	'query_state_8'			=> 'Display not favorite articles',
+	'query_state_9'			=> 'Display read not favorite articles',
+	'query_state_10'		=> 'Display unread not favorite articles',
+	'query_state_11'		=> 'Display not favorite articles',
+	'query_state_12'		=> 'Display all articles',
+	'query_state_13'		=> 'Display read articles',
+	'query_state_14'		=> 'Display unread articles',
+	'query_state_15'		=> 'Display all articles',
+	'query_number'			=> 'Query n°%d',
+	'add_query'			=> 'Add a query',
+	'no_query'			=> 'You have not create user query yet.',
+	'query_filter'			=> 'Filter applied:',
+	'no_query_filter'		=> 'No filter',
 	'about'				=> 'About',
 	'stats'				=> 'Statistics',
 

+ 28 - 21
app/i18n/fr.php

@@ -16,27 +16,34 @@ return array (
 	'feeds'				=> 'Flux',
 	'shortcuts'			=> 'Raccourcis',
 	'queries'			=> 'Filtres utilisateurs',
-	'query-search'			=> 'Chercher "%s"',
-	'query-order-asc'		=> 'Afficher les articles les plus anciens en premier',
-	'query-order-desc'		=> 'Afficher les articles les plus récents en premier',
-	'query-get-category'		=> 'Afficher la catégorie "%s"',
-	'query-get-feed'		=> 'Afficher le flux "%s"',
-	'query-state-0'			=> 'Afficher tous les articles',
-	'query-state-1'			=> 'Afficher les articles lus',
-	'query-state-2'			=> 'Afficher les articles non lus',
-	'query-state-3'			=> 'Afficher tous les articles',
-	'query-state-4'			=> 'Afficher les articles favoris',
-	'query-state-5'			=> 'Afficher les articles lus et favoris',
-	'query-state-6'			=> 'Afficher les articles non lus et favoris',
-	'query-state-7'			=> 'Afficher les articles favoris',
-	'query-state-8'			=> 'Afficher les articles non favoris',
-	'query-state-9'			=> 'Afficher les articles lus et non favoris',
-	'query-state-10'		=> 'Afficher les articles non lus et non favoris',
-	'query-state-11'		=> 'Afficher les articles non favoris',
-	'query-state-12'		=> 'Afficher tous les articles',
-	'query-state-13'		=> 'Afficher les articles lus',
-	'query-state-14'		=> 'Afficher les articles non lus',
-	'query-state-15'		=> 'Afficher tous les articles',
+	'query_search'			=> 'Recherche de "%s"',
+	'query_order_asc'		=> 'Afficher les articles les plus anciens en premier',
+	'query_order_desc'		=> 'Afficher les articles les plus récents en premier',
+	'query_get_category'		=> 'Afficher la catégorie "%s"',
+	'query_get_feed'		=> 'Afficher le flux "%s"',
+	'query_get_all'			=> 'Afficher tous les articles',
+	'query_get_favorite'		=> 'Afficher les articles favoris',
+	'query_state_0'			=> 'Afficher tous les articles',
+	'query_state_1'			=> 'Afficher les articles lus',
+	'query_state_2'			=> 'Afficher les articles non lus',
+	'query_state_3'			=> 'Afficher tous les articles',
+	'query_state_4'			=> 'Afficher les articles favoris',
+	'query_state_5'			=> 'Afficher les articles lus et favoris',
+	'query_state_6'			=> 'Afficher les articles non lus et favoris',
+	'query_state_7'			=> 'Afficher les articles favoris',
+	'query_state_8'			=> 'Afficher les articles non favoris',
+	'query_state_9'			=> 'Afficher les articles lus et non favoris',
+	'query_state_10'		=> 'Afficher les articles non lus et non favoris',
+	'query_state_11'		=> 'Afficher les articles non favoris',
+	'query_state_12'		=> 'Afficher tous les articles',
+	'query_state_13'		=> 'Afficher les articles lus',
+	'query_state_14'		=> 'Afficher les articles non lus',
+	'query_state_15'		=> 'Afficher tous les articles',
+	'query_number'			=> 'Filtre n°%d',
+	'add_query'			=> 'Créer un filtre',
+	'no_query'			=> 'Vous n’avez pas encore créé de filtre.',
+	'query_filter'			=> 'Filtres appliqués :',
+	'no_query_filter'		=> 'Aucun filtre appliqué',
 	'about'				=> 'À propos',
 	'stats'				=> 'Statistiques',
 

+ 0 - 17
app/layout/aside_flux.phtml

@@ -36,23 +36,6 @@
 				</a>
 			</div>
 		</li>
-		
-		<?php 
-		$count = 0;
-		foreach ($this->conf->queries as $query_conf):
-			$count++;
-			$name = $count;
-			if (isset($query_conf['name'])) {
-				$name = $query_conf['name'];
-				unset($query_conf['name']);
-			}
-			$url_user_query = array('c' => 'index', 'a' => 'index', 'params' => $query_conf); ?>
-		<li>
-			<div class="category">
-				<a  data-unread="0" class="btn" href="<?php echo Minz_Url::display($url_user_query)?>"><?php echo $name?></a>
-			</div>
-		</li>
-		<?php endforeach; ?>
 
 		<?php
 		foreach ($this->cat_aside as $cat) {

+ 44 - 19
app/layout/nav_menu.phtml

@@ -7,18 +7,20 @@
 	<?php } ?>
 
 	<?php if ($this->loginOk) { ?>
-	<?php $url_state = $this->url;
-		if ($this->state & FreshRSS_Entry::STATE_READ) {
-			$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
-			$checked = 'true';
-			$class = 'active';
-		} else {
-			$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
-			$checked = 'false';
-			$class = '';
-		}
-	?>
 	<div class="stick">
+		<?php
+			$url_state = $this->url;
+
+			if ($this->state & FreshRSS_Entry::STATE_READ) {
+				$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
+				$checked = 'true';
+				$class = 'active';
+			} else {
+				$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
+				$checked = 'false';
+				$class = '';
+			}
+		?>
 		<a id="toggle-read"
 		   class="btn <?php echo $class; ?>"
 		   aria-checked="<?php echo $checked; ?>"
@@ -26,6 +28,7 @@
 		   title="<?php echo Minz_Translate::t ('show_read'); ?>">
 			<?php echo FreshRSS_Themes::icon('read'); ?>
 		</a>
+
 		<?php
 			if ($this->state & FreshRSS_Entry::STATE_NOT_READ) {
 				$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;
@@ -44,6 +47,7 @@
 		   title="<?php echo Minz_Translate::t ('show_not_reads'); ?>">
 			<?php echo FreshRSS_Themes::icon('unread'); ?>
 		</a>
+
 		<?php
 			if ($this->state & FreshRSS_Entry::STATE_FAVORITE) {
 				$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;
@@ -62,6 +66,7 @@
 		   title="<?php echo Minz_Translate::t ('show_favorite'); ?>">
 			<?php echo FreshRSS_Themes::icon('starred'); ?>
 		</a>
+
 		<?php
 			if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
 				$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;
@@ -80,6 +85,34 @@
 		   title="<?php echo Minz_Translate::t ('show_not_favorite'); ?>">
 			<?php echo FreshRSS_Themes::icon('non-starred'); ?>
 		</a>
+
+		<div class="dropdown">
+			<div id="dropdown-query" class="dropdown-target"></div>
+
+			<a class="dropdown-toggle btn" href="#dropdown-query"><?php echo FreshRSS_Themes::icon('bookmark-add'); ?></a>
+			<ul class="dropdown-menu">
+				<li class="dropdown-close"><a href="#close">❌</a></li>
+
+				<li class="dropdown-header"><?php echo Minz_Translate::t('queries'); ?> <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo FreshRSS_Themes::icon('configure'); ?></a></li>
+
+				<?php foreach ($this->conf->queries as $query) { ?>
+				<li class="item">
+					<a href="<?php echo $query['url']; ?>"><?php echo $query['name']; ?></a>
+				</li>
+				<?php } ?>
+
+				<?php if (count($this->conf->queries) > 0) { ?>
+				<li class="separator no-mobile"></li>
+				<?php } ?>
+
+				<?php
+					$url_query = $this->url;
+					$url_query['c'] = 'configure';
+					$url_query['a'] = 'addQuery';
+				?>
+				<li class="item no-mobile"><a href="<?php echo Minz_Url::display($url_query); ?>"><?php echo Minz_Translate::t('add_query'); ?></a></li>
+			</ul>
+		</div>
 	</div>
 	<?php
 		$get = false;
@@ -233,14 +266,6 @@
 	<a class="btn" href="<?php echo Minz_Url::display ($url_order); ?>" title="<?php echo Minz_Translate::t ($title); ?>">
 		<?php echo FreshRSS_Themes::icon($icon); ?>
 	</a>
-
-	<?php if ($this->loginOk) {
-		$url_query = $this->url;
-		$url_query['c'] = 'configure';
-		$url_query['a'] = 'addQuery';
-	?>
-	<a id="save_query" class="btn" href="<?php echo Minz_Url::display ($url_query); ?>"><?php echo FreshRSS_Themes::icon('bookmark-add'); ?></a>
-	<?php } ?>
 	
 	<?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?>
 	<a id="actualize" class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><?php echo FreshRSS_Themes::icon('refresh'); ?></a>

+ 75 - 30
app/views/configure/queries.phtml

@@ -1,45 +1,90 @@
-<?php $this->partial ('aside_configure'); ?>
+<?php $this->partial('aside_configure'); ?>
 
 <div class="post">
-	<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
-
-	<form method="post" action="<?php echo _url ('configure', 'queries'); ?>">
-		<legend><?php echo Minz_Translate::t ('queries'); ?></legend>
-
-		<?php foreach ($this->conf->queries as $key => $query):?>
-			<div class="form-group">
-				<label class="group-name"><?php echo $key + 1?></label>
-				<div class="group-controls">
-					<input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo isset($query['search']) ? $query['search'] : ""; ?>"/>
-					<input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo isset($query['state']) ? $query['state'] : ""; ?>"/>
-					<input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo isset($query['order']) ? $query['order'] : ""; ?>"/>
-					<input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo isset($query['get']) ? $query['get'] : ""; ?>"/>
-					<input type="text" id="queries_<?php echo $key; ?>_name" name="queries[<?php echo $key; ?>][name]" value="<?php echo isset($query['name']) ? $query['name'] : ""; ?>"/>
-					<a href='#' class='query remove'><?php echo FreshRSS_Themes::icon('close'); ?></a>
+	<a href="<?php echo _url('index', 'index'); ?>"><?php echo Minz_Translate::t('back_to_rss_feeds'); ?></a>
+
+	<form method="post" action="<?php echo _url('configure', 'queries'); ?>">
+		<legend><?php echo Minz_Translate::t('queries'); ?></legend>
+
+		<?php foreach ($this->conf->queries as $key => $query) { ?>
+		<div class="form-group" id="query-group-<?php echo $key; ?>">
+			<label class="group-name" for="queries_<?php echo $key; ?>_name">
+				<?php echo Minz_Translate::t('query_number', $key + 1); ?>
+			</label>
+
+			<div class="group-controls">
+				<input type="hidden" id="queries_<?php echo $key; ?>_search" name="queries[<?php echo $key; ?>][search]" value="<?php echo isset($query['search']) ? $query['search'] : ""; ?>"/>
+				<input type="hidden" id="queries_<?php echo $key; ?>_state" name="queries[<?php echo $key; ?>][state]" value="<?php echo isset($query['state']) ? $query['state'] : ""; ?>"/>
+				<input type="hidden" id="queries_<?php echo $key; ?>_order" name="queries[<?php echo $key; ?>][order]" value="<?php echo isset($query['order']) ? $query['order'] : ""; ?>"/>
+				<input type="hidden" id="queries_<?php echo $key; ?>_get" name="queries[<?php echo $key; ?>][get]" value="<?php echo isset($query['get']) ? $query['get'] : ""; ?>"/>
+
+				<div class="stick">
+					<input class="extend"
+					       type="text"
+					       id="queries_<?php echo $key; ?>_name"
+					       name="queries[<?php echo $key; ?>][name]"
+					       value="<?php echo $query['name']; ?>"
+					/>
+
+					<a class="btn" href="<?php echo $query['url']; ?>">
+						<?php echo FreshRSS_Themes::icon('link'); ?>
+					</a>
+
+					<a class="btn btn-attention remove" href="#" data-remove="query-group-<?php echo $key; ?>">
+						<?php echo FreshRSS_Themes::icon('close'); ?>
+					</a>
+				</div>
+
+				<?php
+					$exist = (isset($query['search']) ? 1 : 0)
+						   + (isset($query['state']) ? 1 : 0)
+						   + (isset($query['order']) ? 1 : 0)
+						   + (isset($query['get']) ? 1 : 0);
+					// If the only filter is "all" articles, we consider there is no filter
+					$exist = ($exist === 1 && isset($query['get']) && $query['get'] === 'a') ? 0 : $exist;
+				?>
+
+				<?php if ($exist === 0) { ?>
+				<div class="alert alert-warn">
+					<div class="alert-head"><?php echo Minz_Translate::t('no_query_filter'); ?></div>
+				</div>
+				<?php } else { ?>
+				<div class="alert alert-success">
+					<div class="alert-head"><?php echo Minz_Translate::t('query_filter'); ?></div>
+
 					<ul>
-						<?php if (isset($query['search'])):?>
-							<li><?php echo Minz_Translate::t ('query-search', $query['search']); ?></li>
-						<?php endif; ?>
-						<?php if (isset($query['state'])):?>
-							<li><?php echo Minz_Translate::t ('query-state-' . $query['state']); ?></li>
-						<?php endif; ?>
-						<?php if (isset($query['order'])):?>
-							<li><?php echo Minz_Translate::t ('query-order-' . strtolower($query['order'])); ?></li>
-						<?php endif; ?>
-						<?php if (isset($query['get'])):?>
-							<li><?php echo Minz_Translate::t ('query-get-' . $this->query_get[$key]['type'], $this->query_get[$key]['name']); ?></li>
-						<?php endif; ?>
+						<?php if (isset($query['search'])) { $exist = true; ?>
+						<li class="item"><?php echo Minz_Translate::t('query_search', $query['search']); ?></li>
+						<?php } ?>
+
+						<?php if (isset($query['state'])) { $exist = true; ?>
+						<li class="item"><?php echo Minz_Translate::t('query_state_' . $query['state']); ?></li>
+						<?php } ?>
+
+						<?php if (isset($query['order'])) { $exist = true; ?>
+						<li class="item"><?php echo Minz_Translate::t('query_order_' . strtolower($query['order'])); ?></li>
+						<?php } ?>
+
+						<?php if (isset($query['get'])) { $exist = true; ?>
+						<li class="item"><?php echo Minz_Translate::t('query_get_' . $this->query_get[$key]['type'], $this->query_get[$key]['name']); ?></li>
+						<?php } ?>
 					</ul>
 				</div>
+				<?php } ?>
 			</div>
-		<?php endforeach; ?>
-		
+		</div>
+		<?php } ?>
+
+		<?php if (count($this->conf->queries) > 0) { ?>
 		<div class="form-group form-actions">
 			<div class="group-controls">
 				<button type="submit" class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
 				<button type="reset" class="btn"><?php echo Minz_Translate::t ('cancel'); ?></button>
 			</div>
 		</div>
+		<?php } else { ?>
+		<p class="alert alert-warn"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t('no_query'); ?></p>
+		<?php } ?>
 	</form>
 
 </div>

+ 7 - 7
app/views/configure/sharing.phtml

@@ -4,35 +4,35 @@
 	<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
 
 	<form method="post" action="<?php echo _url ('configure', 'sharing'); ?>"
-		data-simple='<div class="form-group"><label class="group-name">##label##</label><div class="group-controls"><a href="#" class="share remove btn btn-attention"><?php echo FreshRSS_Themes::icon('close'); ?></a>
+		data-simple='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls"><a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo FreshRSS_Themes::icon('close'); ?></a>
 			<input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" /></div></div>'
-		data-advanced='<div class="form-group"><label class="group-name">##label##</label><div class="group-controls">
+		data-advanced='<div class="form-group" id="group-share-##key##"><label class="group-name">##label##</label><div class="group-controls">
 			<input type="hidden" id="share_##key##_type" name="share[##key##][type]" value="##type##" />
 			<div class="stick">
 			<input type="text" id="share_##key##_name" name="share[##key##][name]" class="extend" value="" placeholder="<?php echo Minz_Translate::t ('share_name'); ?>" size="64" />
 			<input type="url" id="share_##key##_url" name="share[##key##][url]" class="extend" value="" placeholder="<?php echo Minz_Translate::t ('share_url'); ?>" size="64" />
-			<a href="#" class="share remove btn btn-attention"><?php echo FreshRSS_Themes::icon('close'); ?></a></div>
+			<a href="#" class="remove btn btn-attention" data-remove="group-share-##key##"><?php echo FreshRSS_Themes::icon('close'); ?></a></div>
 			<a target="_blank" class="btn" title="<?php echo Minz_Translate::t('more_information'); ?>" href="##help##"><?php echo FreshRSS_Themes::icon('help'); ?></a>
 			</div></div>'>
 		<legend><?php echo Minz_Translate::t ('sharing'); ?></legend>
 		<?php foreach ($this->conf->sharing as $key => $sharing): ?>
 			<?php $share = $this->conf->shares[$sharing['type']]; ?>
-			<div class="form-group">
+			<div class="form-group" id="group-share-<?php echo $key; ?>">
 				<label class="group-name">
 					<?php echo Minz_Translate::t ($sharing['type']); ?>
 				</label>
 				<div class="group-controls">
 					<input type='hidden' id='share_<?php echo $key;?>_type' name="share[<?php echo $key;?>][type]" value='<?php echo $sharing['type']?>' />
-					<?php if ($share['form'] === 'advanced'){ ?>
+					<?php if ($share['form'] === 'advanced') { ?>
 						<div class="stick">
 							<input type="text" id="share_<?php echo $key;?>_name" name="share[<?php echo $key;?>][name]" class="extend" value="<?php echo $sharing['name']?>" placeholder="<?php echo Minz_Translate::t ('share_name'); ?>" size="64" />
 							<input type="url" id="share_<?php echo $key;?>_url" name="share[<?php echo $key;?>][url]" class="extend" value="<?php echo $sharing['url']?>" placeholder="<?php echo Minz_Translate::t ('share_url'); ?>" size="64" />
-							<a href='#' class='share remove btn btn-attention'><?php echo FreshRSS_Themes::icon('close'); ?></a>
+							<a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo FreshRSS_Themes::icon('close'); ?></a>
 						</div>
 
 						<a target="_blank" class="btn" title="<?php echo Minz_Translate::t('more_information'); ?>" href="<?php echo $share['help']?>"><?php echo FreshRSS_Themes::icon('help'); ?></a>
 					<?php } else { ?>
-					<a href='#' class='share remove btn btn-attention'><?php echo FreshRSS_Themes::icon('close'); ?></a>
+					<a href='#' class='remove btn btn-attention' data-remove="group-share-<?php echo $key; ?>"><?php echo FreshRSS_Themes::icon('close'); ?></a>
 					<?php } ?>
 				</div>
 			</div>

+ 3 - 2
lib/Minz/Request.php

@@ -28,6 +28,9 @@ class Minz_Request {
 		return self::$params;
 	}
 	static function htmlspecialchars_utf8 ($p) {
+		if (is_array($p)) {
+			return array_map('self::htmlspecialchars_utf8', $p);
+		}
 		return htmlspecialchars($p, ENT_COMPAT, 'UTF-8');
 	}
 	public static function param ($key, $default = false, $specialchars = false) {
@@ -35,8 +38,6 @@ class Minz_Request {
 			$p = self::$params[$key];
 			if(is_object($p) || $specialchars) {
 				return $p;
-			} elseif(is_array($p)) {
-				return array_map('self::htmlspecialchars_utf8', $p);
 			} else {
 				return self::htmlspecialchars_utf8($p);
 			}

+ 11 - 10
p/scripts/main.js

@@ -975,11 +975,6 @@ function init_print_action() {
 function init_share_observers() {
 	shares = $('.form-group:not(".form-actions")').length;
 
-	$('.post').on('click', '.share.remove', function(e) {
-		e.preventDefault();
-		$(this).parents('.form-group').remove();
-	});
-
 	$('.share.add').on('click', function(e) {
 		var opt = $(this).siblings('select').find(':selected');
 		var row = $(this).parents('form').data(opt.data('form'));
@@ -994,10 +989,16 @@ function init_share_observers() {
 	});
 }
 
-function init_queries_observers() {
-	$('.post').on('click', '.query.remove', function(e) {
-		e.preventDefault();
-		$(this).parents('.form-group').remove();
+function init_remove_observers() {
+	$('.post').on('click', 'a.remove', function(e) {
+		var remove_what = $(this).attr('data-remove');
+
+		if (remove_what !== undefined) {
+			var remove_obj = $('#' + remove_what);
+			remove_obj.remove();
+		}
+
+		return false;
 	});
 }
 
@@ -1061,7 +1062,7 @@ function init_all() {
 		window.setInterval(refreshUnreads, 120000);
 	} else {
 		init_share_observers();
-		init_queries_observers();
+		init_remove_observers();
 		init_feed_observers();
 		init_password_observers();
 	}

+ 5 - 1
p/themes/Origine/origine.css

@@ -362,6 +362,10 @@ a.btn {
 	padding: 0 25px;
 	line-height: 2.5em;
 }
+.dropdown-menu > .item > span {
+	padding: 0 25px;
+	line-height: 2em;
+}
 .dropdown-menu > .item:hover {
 	background: #0062BE;
 	color: #fff;
@@ -400,7 +404,7 @@ a.btn {
 	font-size: 0.9em;
 }
 .alert-head {
-	font-size: 1.2em;
+	font-size: 1.15em;
 }
 .alert > a {
 	color: inherit;

+ 11 - 2
p/themes/Origine/template.css

@@ -180,7 +180,8 @@ a.btn {
 .dropdown-menu > .item {
 	display: block;
 }
-.dropdown-menu > .item > a {
+.dropdown-menu > .item > a,
+.dropdown-menu > .item > span {
 	display: block;
 }
 .dropdown-menu > .item[aria-checked="true"] > a:before {
@@ -220,10 +221,16 @@ a.btn {
 	display: block;
 	width: 90%;
 }
+.group-controls .alert {
+	width: 100%
+}
 .alert-head {
 	margin: 0;
 	font-weight: bold;
 }
+.alert ul {
+	margin: 5px 20px;
+}
 
 /*=== Icons */
 .icon {
@@ -587,7 +594,9 @@ a.btn {
 	.aside .btn-important,
 	.aside .feeds .dropdown,
 	.flux_header .item.website span,
-	.item.date, .day .date {
+	.item.date, .day .date,
+	.dropdown-menu > .no-mobile,
+	.no-mobile {
 		display: none;
 	}
 	.nav-login {