Pārlūkot izejas kodu

Ajout conf : token (#127), option load more (#125)

Le token permettra d'accéder aux flux RSS cachés derrière une
authentification
L'option load more permettra de ne pas charger automatiquement les
articles suivants une fois arrivé en bas de la page
Marien Fressinaud 12 gadi atpakaļ
vecāks
revīzija
94a50086d8
1 mainītis faili ar 29 papildinājumiem un 0 dzēšanām
  1. 29 0
      app/models/RSSConfiguration.php

+ 29 - 0
app/models/RSSConfiguration.php

@@ -19,6 +19,8 @@ class RSSConfiguration extends Model {
 	private $url_shaarli = '';
 	private $theme;
 	private $anon_access;
+	private $token;
+	private $auto_load_more;
 	
 	public function __construct () {
 		$confDAO = new RSSConfigurationDAO ();
@@ -36,6 +38,8 @@ class RSSConfiguration extends Model {
 		$this->_urlShaarli ($confDAO->url_shaarli);
 		$this->_theme ($confDAO->theme);
 		$this->_anonAccess ($confDAO->anon_access);
+		$this->_token ($confDAO->token);
+		$this->_autoLoadMore ($confDAO->auto_load_more);
 	}
 	
 	public function availableLanguages () {
@@ -92,6 +96,12 @@ class RSSConfiguration extends Model {
 	public function anonAccess () {
 		return $this->anon_access;
 	}
+	public function token () {
+		return $this->token;
+	}
+	public function autoLoadMore () {
+		return $this->autoLoadMore;
+	}
 
 	public function _language ($value) {
 		if (!isset ($this->available_languages[$value])) {
@@ -191,6 +201,16 @@ class RSSConfiguration extends Model {
 			$this->anon_access = 'no';
 		}
 	}
+	public function _token ($value) {
+		$this->token = $value;
+	}
+	public function _autoLoadMore ($value) {
+		if ($value == 'yes') {
+			$this->auto_load_more = 'yes';
+		} else {
+			$this->auto_load_more = 'no';
+		}
+	}
 }
 
 class RSSConfigurationDAO extends Model_array {
@@ -220,10 +240,13 @@ class RSSConfigurationDAO extends Model_array {
 	public $url_shaarli = '';
 	public $theme = 'default';
 	public $anon_access = 'no';
+	public $token = '';
+	public $auto_load_more = 'no';
 
 	public function __construct () {
 		parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php');
 
+		// TODO : simplifier ce code, une boucle for() devrait suffir !
 		if (isset ($this->array['language'])) {
 			$this->language = $this->array['language'];
 		}
@@ -266,6 +289,12 @@ class RSSConfigurationDAO extends Model_array {
 		if (isset ($this->array['anon_access'])) {
 			$this->anon_access = $this->array['anon_access'];
 		}
+		if (isset ($this->array['token'])) {
+			$this->token = $this->array['token'];
+		}
+		if (isset ($this->array['auto_load_more'])) {
+			$this->auto_load_more = $this->array['auto_load_more'];
+		}
 	}
 	
 	public function update ($values) {