diff options
| author | 2013-03-02 00:36:12 +0100 | |
|---|---|---|
| committer | 2013-03-02 00:36:12 +0100 | |
| commit | cae1efd552ed0618b13120e07c346cbe28cbd00a (patch) | |
| tree | 173a36c7c889c45d1590f0942e5a776c65e84db0 /app | |
| parent | 2232b03bb48a012d8d3902dd32c7612dc112e0f9 (diff) | |
Corrections quelques bugs + modif fichier config BDD + ajout fichier build.sh pour générer la lib Minz
Diffstat (limited to 'app')
| -rw-r--r-- | app/configuration/application.ini | 2 | ||||
| -rw-r--r-- | app/configuration/routes.php | 136 | ||||
| -rwxr-xr-x | app/controllers/feedController.php | 18 | ||||
| -rw-r--r-- | app/models/Feed.php | 27 | ||||
| -rw-r--r-- | app/views/configure/feed.phtml | 2 |
5 files changed, 32 insertions, 153 deletions
diff --git a/app/configuration/application.ini b/app/configuration/application.ini index 149bc6c5b..2beb60324 100644 --- a/app/configuration/application.ini +++ b/app/configuration/application.ini @@ -1,6 +1,6 @@ [general]
environment = "development"
-use_url_rewriting = true
+use_url_rewriting = false
sel_application = "flux rss lalala ~~~"
base_url = "/~marien/rss/public" ; pas de slash à la fin /!\
diff --git a/app/configuration/routes.php b/app/configuration/routes.php deleted file mode 100644 index d32dca3ee..000000000 --- a/app/configuration/routes.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -return array ( - // Index - array ( - 'route' => '/\?q=([\w\d\-_]+)&p=([\d]+)', - 'controller' => 'index', - 'action' => 'index', - 'params' => array ('get', 'page') - ), - array ( - 'route' => '/\?q=([\w\d\-_]+)', - 'controller' => 'index', - 'action' => 'index', - 'params' => array ('get') - ), - array ( - 'route' => '/\?p=([\d]+)', - 'controller' => 'index', - 'action' => 'index', - 'params' => array ('page') - ), - array ( - 'route' => '/login.php', - 'controller' => 'index', - 'action' => 'login' - ), - array ( - 'route' => '/logout.php', - 'controller' => 'index', - 'action' => 'logout' - ), - array ( - 'route' => '/mode.php\?m=([\w_]+)', - 'controller' => 'index', - 'action' => 'changeMode', - 'params' => array ('mode') - ), - - // Scripts - array ( - 'route' => '/scripts/main.js', - 'controller' => 'javascript', - 'action' => 'main' - ), - - // API - array ( - 'route' => '/api/get_favorites', - 'controller' => 'api', - 'action' => 'getFavorites' - ), - array ( - 'route' => '/api/get_nb_not_read', - 'controller' => 'api', - 'action' => 'getNbNotRead' - ), - - // Entry - array ( - 'route' => '/articles/marquer.php\?id=([\w\d\-_]{6})&lu=([\d]{1})', - 'controller' => 'entry', - 'action' => 'read', - 'params' => array ('id', 'is_read') - ), - array ( - 'route' => '/articles/marquer.php\?lu=([\d]{1})', - 'controller' => 'entry', - 'action' => 'read', - 'params' => array ('is_read') - ), - array ( - 'route' => '/articles/marquer.php\?id=([\w\d\-_]{6})&favori=([\d]{1})', - 'controller' => 'entry', - 'action' => 'bookmark', - 'params' => array ('id', 'is_favorite') - ), - - - // Feed - array ( - 'route' => '/flux/ajouter.php', - 'controller' => 'feed', - 'action' => 'add' - ), - array ( - 'route' => '/flux/actualiser.php', - 'controller' => 'feed', - 'action' => 'actualize' - ), - array ( - 'route' => '/flux/supprimer.php\?id=([\w\d\-_]{6})', - 'controller' => 'feed', - 'action' => 'delete', - 'params' => array ('id') - ), - - // Configure - array ( - 'route' => '/configuration/flux.php', - 'controller' => 'configure', - 'action' => 'feed' - ), - array ( - 'route' => '/configuration/flux.php\?id=([\w\d\-_]{6})', - 'controller' => 'configure', - 'action' => 'feed', - 'params' => array ('id') - ), - array ( - 'route' => '/configuration/categories.php', - 'controller' => 'configure', - 'action' => 'categorize' - ), - array ( - 'route' => '/configuration/global.php', - 'controller' => 'configure', - 'action' => 'display' - ), - array ( - 'route' => '/configuration/import_export.php', - 'controller' => 'configure', - 'action' => 'importExport' - ), - array ( - 'route' => '/configuration/import_export.php\?q=([\w]{6})', - 'controller' => 'configure', - 'action' => 'importExport', - 'params' => array ('q') - ), - array ( - 'route' => '/configuration/raccourcis.php', - 'controller' => 'configure', - 'action' => 'shortcut' - ), -); diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 9a56e97cf..585405ee7 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -10,11 +10,11 @@ class feedController extends ActionController { } else { if (Request::isPost ()) { $url = Request::param ('url_rss'); - + try { $feed = new Feed ($url); $feed->load (); - + $feedDAO = new FeedDAO (); $values = array ( 'id' => $feed->id (), @@ -26,7 +26,7 @@ class feedController extends ActionController { 'lastUpdate' => time () ); $feedDAO->addFeed ($values); - + $entryDAO = new EntryDAO (); $entries = $feed->entries (); foreach ($entries as $entry) { @@ -44,13 +44,21 @@ class feedController extends ActionController { ); $entryDAO->addEntry ($values); } - + // notif $notif = array ( 'type' => 'good', 'content' => 'Le flux <em>' . $feed->url () . '</em> a bien été ajouté' ); Session::_param ('notification', $notif); + } catch (FileNotExistException $e) { + Log::record ($e->getMessage (), Log::ERROR); + // notif + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème de configuration a empêché l\'ajout du flux. Voir les logs pour plus d\'informations' + ); + Session::_param ('notification', $notif); } catch (Exception $e) { // notif $notif = array ( @@ -59,7 +67,7 @@ class feedController extends ActionController { ); Session::_param ('notification', $notif); } - + Request::forward (array (), true); } } diff --git a/app/models/Feed.php b/app/models/Feed.php index 2db9af40d..67874925f 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -84,16 +84,23 @@ class Feed extends Model { public function load () { if (!is_null ($this->url)) { - $feed = new SimplePie (); - $feed->set_feed_url ($this->url); - $feed->set_cache_location (CACHE_PATH); - $feed->init (); - - $title = $feed->get_title (); - $this->_name (!is_null ($title) ? $title : $this->url); - $this->_website ($feed->get_link ()); - $this->_description ($feed->get_description ()); - $this->loadEntries ($feed); + if (CACHE_PATH === false) { + throw new FileNotExistException ( + 'CACHE_PATH', + MinzException::ERROR + ); + } else { + $feed = new SimplePie (); + $feed->set_feed_url ($this->url); + $feed->set_cache_location (CACHE_PATH); + $feed->init (); + + $title = $feed->get_title (); + $this->_name (!is_null ($title) ? $title : $this->url); + $this->_website ($feed->get_link ()); + $this->_description ($feed->get_description ()); + $this->loadEntries ($feed); + } } } private function loadEntries ($feed) { diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 54867ba9a..0acec1872 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -38,9 +38,9 @@ </div> <input type="submit" value="Valider" /> + <?php } ?> <button formaction="<?php echo Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>">Supprimer</button> - <?php } ?> </form> <?php } else { ?> <div class="nothing">Aucun flux sélectionné</div> |
