aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-15 03:30:24 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-15 03:30:24 +0100
commit878e96202e8a22e4857b98e29b0a1fce68eccbc9 (patch)
treef9233c3b48a0cd6e0ac2536ddcc1897201595ad4 /app/controllers
parent4af233e1f736eb2256e5e1696418635165467855 (diff)
Grosse refactorisation pour permettre le chargement automatique des classes
C'est parti de changements pour https://github.com/marienfressinaud/FreshRSS/issues/255 et finalement j'ai continué la refactorisation... Ajout de préfixes FreshRSS_ et Minz_ sur le modèle de SimplePie_. Toutes les classes sont maintenant en chargement automatique (devrait améliorer les performances en évitant de charger plein de classes inutilisées, et faciliter la maintenance). Suppression de set_include_path(). Si souhaité, certaines classes de Minz pourraient être déplacées dans un sous-répertoire, par exemple les exceptions. Tests et relecture nécessaires.
Diffstat (limited to 'app/controllers')
-rwxr-xr-xapp/controllers/configureController.php234
-rwxr-xr-xapp/controllers/entryController.php44
-rw-r--r--app/controllers/errorController.php8
-rwxr-xr-xapp/controllers/feedController.php142
-rwxr-xr-xapp/controllers/indexController.php78
-rwxr-xr-xapp/controllers/javascriptController.php4
6 files changed, 255 insertions, 255 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php
index deec54a2b..0e7fbbdde 100755
--- a/app/controllers/configureController.php
+++ b/app/controllers/configureController.php
@@ -1,33 +1,33 @@
<?php
-class configureController extends ActionController {
+class FreshRSS_configure_Controller extends Minz_ActionController {
public function firstAction () {
if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
+ Minz_Error::error (
403,
- array ('error' => array (Translate::t ('access_denied')))
+ array ('error' => array (Minz_Translate::t ('access_denied')))
);
}
- $catDAO = new CategoryDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
$catDAO->checkDefault ();
}
public function categorizeAction () {
- $feedDAO = new FeedDAO ();
- $catDAO = new CategoryDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
$catDAO->checkDefault ();
$defaultCategory = $catDAO->getDefault ();
$defaultId = $defaultCategory->id ();
- if (Request::isPost ()) {
- $cats = Request::param ('categories', array ());
- $ids = Request::param ('ids', array ());
- $newCat = trim (Request::param ('new_category', ''));
+ if (Minz_Request::isPost ()) {
+ $cats = Minz_Request::param ('categories', array ());
+ $ids = Minz_Request::param ('ids', array ());
+ $newCat = trim (Minz_Request::param ('new_category', ''));
foreach ($cats as $key => $name) {
if (strlen ($name) > 0) {
- $cat = new Category ($name);
+ $cat = new FreshRSS_Category ($name);
$values = array (
'name' => $cat->name (),
'color' => $cat->color ()
@@ -40,7 +40,7 @@ class configureController extends ActionController {
}
if ($newCat != '') {
- $cat = new Category ($newCat);
+ $cat = new FreshRSS_Category ($newCat);
$values = array (
'id' => $cat->id (),
'name' => $cat->name (),
@@ -55,11 +55,11 @@ class configureController extends ActionController {
// notif
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('categories_updated')
+ 'content' => Minz_Translate::t ('categories_updated')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
}
$this->view->categories = $catDAO->listCategories (false);
@@ -67,17 +67,17 @@ class configureController extends ActionController {
$this->view->feeds = $feedDAO->listFeeds ();
$this->view->flux = false;
- View::prependTitle (Translate::t ('categories_management') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('categories_management') . ' - ');
}
public function feedAction () {
- $catDAO = new CategoryDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
$this->view->categories = $catDAO->listCategories (false);
- $feedDAO = new FeedDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
$this->view->feeds = $feedDAO->listFeeds ();
- $id = Request::param ('id');
+ $id = Minz_Request::param ('id');
if ($id == false && !empty ($this->view->feeds)) {
$id = current ($this->view->feeds)->id ();
}
@@ -87,22 +87,22 @@ class configureController extends ActionController {
$this->view->flux = $this->view->feeds[$id];
if (!$this->view->flux) {
- Error::error (
+ Minz_Error::error (
404,
- array ('error' => array (Translate::t ('page_not_found')))
+ array ('error' => array (Minz_Translate::t ('page_not_found')))
);
} else {
- if (Request::isPost () && $this->view->flux) {
- $name = Request::param ('name', '');
- $description = Request::param('description', '');
- $website = Request::param('website', '');
- $url = Request::param('url', '');
- $hist = Request::param ('keep_history', 'no');
- $cat = Request::param ('category', 0);
- $path = Request::param ('path_entries', '');
- $priority = Request::param ('priority', 0);
- $user = Request::param ('http_user', '');
- $pass = Request::param ('http_pass', '');
+ if (Minz_Request::isPost () && $this->view->flux) {
+ $name = Minz_Request::param ('name', '');
+ $description = Minz_Request::param('description', '');
+ $website = Minz_Request::param('website', '');
+ $url = Minz_Request::param('url', '');
+ $hist = Minz_Request::param ('keep_history', 'no');
+ $cat = Minz_Request::param ('category', 0);
+ $path = Minz_Request::param ('path_entries', '');
+ $priority = Minz_Request::param ('priority', 0);
+ $user = Minz_Request::param ('http_user', '');
+ $pass = Minz_Request::param ('http_pass', '');
$keep_history = false;
if ($hist == 'yes') {
@@ -131,58 +131,58 @@ class configureController extends ActionController {
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feed_updated')
+ 'content' => Minz_Translate::t ('feed_updated')
);
} else {
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('error_occurred_update')
+ 'content' => Minz_Translate::t ('error_occurred_update')
);
}
- Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true);
+ Minz_Session::_param ('notification', $notif);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true);
}
- View::prependTitle (Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - ' . $this->view->flux->name () . ' - ');
}
} else {
- View::prependTitle (Translate::t ('rss_feed_management') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('rss_feed_management') . ' - ');
}
}
public function displayAction () {
- if (Request::isPost ()) {
+ if (Minz_Request::isPost ()) {
$current_token = $this->view->conf->token ();
- $language = Request::param ('language', 'en');
- $nb = Request::param ('posts_per_page', 10);
- $mode = Request::param ('view_mode', 'normal');
- $view = Request::param ('default_view', 'a');
- $auto_load_more = Request::param ('auto_load_more', 'no');
- $display = Request::param ('display_posts', 'no');
- $onread_jump_next = Request::param ('onread_jump_next', 'no');
- $lazyload = Request::param ('lazyload', 'no');
- $sort = Request::param ('sort_order', 'DESC');
- $old = Request::param ('old_entries', 3);
- $mail = Request::param ('mail_login', false);
- $anon = Request::param ('anon_access', 'no');
- $token = Request::param ('token', $current_token);
- $openArticle = Request::param ('mark_open_article', 'no');
- $openSite = Request::param ('mark_open_site', 'no');
- $scroll = Request::param ('mark_scroll', 'no');
- $reception = Request::param ('mark_upon_reception', 'no');
- $theme = Request::param ('theme', 'default');
- $topline_read = Request::param ('topline_read', 'no');
- $topline_favorite = Request::param ('topline_favorite', 'no');
- $topline_date = Request::param ('topline_date', 'no');
- $topline_link = Request::param ('topline_link', 'no');
- $bottomline_read = Request::param ('bottomline_read', 'no');
- $bottomline_favorite = Request::param ('bottomline_favorite', 'no');
- $bottomline_sharing = Request::param ('bottomline_sharing', 'no');
- $bottomline_tags = Request::param ('bottomline_tags', 'no');
- $bottomline_date = Request::param ('bottomline_date', 'no');
- $bottomline_link = Request::param ('bottomline_link', 'no');
+ $language = Minz_Request::param ('language', 'en');
+ $nb = Minz_Request::param ('posts_per_page', 10);
+ $mode = Minz_Request::param ('view_mode', 'normal');
+ $view = Minz_Request::param ('default_view', 'a');
+ $auto_load_more = Minz_Request::param ('auto_load_more', 'no');
+ $display = Minz_Request::param ('display_posts', 'no');
+ $onread_jump_next = Minz_Request::param ('onread_jump_next', 'no');
+ $lazyload = Minz_Request::param ('lazyload', 'no');
+ $sort = Minz_Request::param ('sort_order', 'DESC');
+ $old = Minz_Request::param ('old_entries', 3);
+ $mail = Minz_Request::param ('mail_login', false);
+ $anon = Minz_Request::param ('anon_access', 'no');
+ $token = Minz_Request::param ('token', $current_token);
+ $openArticle = Minz_Request::param ('mark_open_article', 'no');
+ $openSite = Minz_Request::param ('mark_open_site', 'no');
+ $scroll = Minz_Request::param ('mark_scroll', 'no');
+ $reception = Minz_Request::param ('mark_upon_reception', 'no');
+ $theme = Minz_Request::param ('theme', 'default');
+ $topline_read = Minz_Request::param ('topline_read', 'no');
+ $topline_favorite = Minz_Request::param ('topline_favorite', 'no');
+ $topline_date = Minz_Request::param ('topline_date', 'no');
+ $topline_link = Minz_Request::param ('topline_link', 'no');
+ $bottomline_read = Minz_Request::param ('bottomline_read', 'no');
+ $bottomline_favorite = Minz_Request::param ('bottomline_favorite', 'no');
+ $bottomline_sharing = Minz_Request::param ('bottomline_sharing', 'no');
+ $bottomline_tags = Minz_Request::param ('bottomline_tags', 'no');
+ $bottomline_date = Minz_Request::param ('bottomline_date', 'no');
+ $bottomline_link = Minz_Request::param ('bottomline_link', 'no');
$this->view->conf->_language ($language);
$this->view->conf->_postsPerPage (intval ($nb));
@@ -243,81 +243,81 @@ class configureController extends ActionController {
'bottomline_link' => $this->view->conf->bottomlineLink () ? 'yes' : 'no',
);
- $confDAO = new RSSConfigurationDAO ();
+ $confDAO = new FreshRSS_ConfigurationDAO ();
$confDAO->update ($values);
- Session::_param ('conf', $this->view->conf);
- Session::_param ('mail', $this->view->conf->mailLogin ());
+ Minz_Session::_param ('conf', $this->view->conf);
+ Minz_Session::_param ('mail', $this->view->conf->mailLogin ());
- Session::_param ('language', $this->view->conf->language ());
+ Minz_Session::_param ('language', $this->view->conf->language ());
Translate::reset ();
// notif
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('configuration_updated')
+ 'content' => Minz_Translate::t ('configuration_updated')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'display'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'display'), true);
}
- $this->view->themes = RSSThemes::get();
+ $this->view->themes = FreshRSS_Themes::get();
- View::prependTitle (Translate::t ('general_and_reading_management') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('general_and_reading_management') . ' - ');
- $entryDAO = new EntryDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
$this->view->nb_total = $entryDAO->count ();
$this->view->size_total = $entryDAO->size ();
}
public function sharingAction () {
- if (Request::isPost ()) {
+ if (Minz_Request::isPost ()) {
$this->view->conf->_sharing (array (
- 'shaarli' => Request::param ('shaarli', ''),
- 'poche' => Request::param ('poche', ''),
- 'diaspora' => Request::param ('diaspora', ''),
- 'twitter' => Request::param ('twitter', 'no') === 'yes',
- 'g+' => Request::param ('g+', 'no') === 'yes',
- 'facebook' => Request::param ('facebook', 'no') === 'yes',
- 'email' => Request::param ('email', 'no') === 'yes',
- 'print' => Request::param ('print', 'no') === 'yes'
+ 'shaarli' => Minz_Request::param ('shaarli', ''),
+ 'poche' => Minz_Request::param ('poche', ''),
+ 'diaspora' => Minz_Request::param ('diaspora', ''),
+ 'twitter' => Minz_Request::param ('twitter', 'no') === 'yes',
+ 'g+' => Minz_Request::param ('g+', 'no') === 'yes',
+ 'facebook' => Minz_Request::param ('facebook', 'no') === 'yes',
+ 'email' => Minz_Request::param ('email', 'no') === 'yes',
+ 'print' => Minz_Request::param ('print', 'no') === 'yes'
));
- $confDAO = new RSSConfigurationDAO ();
+ $confDAO = new FreshRSS_ConfigurationDAO ();
$confDAO->update ($this->view->conf->sharing ());
- Session::_param ('conf', $this->view->conf);
+ Minz_Session::_param ('conf', $this->view->conf);
// notif
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('configuration_updated')
+ 'content' => Minz_Translate::t ('configuration_updated')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true);
}
- View::prependTitle (Translate::t ('sharing_management') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('sharing_management') . ' - ');
- $entryDAO = new EntryDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
$this->view->nb_total = $entryDAO->count ();
}
public function importExportAction () {
- $catDAO = new CategoryDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
$this->view->categories = $catDAO->listCategories ();
- $this->view->req = Request::param ('q');
+ $this->view->req = Minz_Request::param ('q');
if ($this->view->req == 'export') {
- View::_title ('freshrss_feeds.opml');
+ Minz_View::_title ('freshrss_feeds.opml');
$this->view->_useLayout (false);
header('Content-Type: application/xml; charset=utf-8');
header('Content-disposition: attachment; filename=freshrss_feeds.opml');
- $feedDAO = new FeedDAO ();
- $catDAO = new CategoryDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
$list = array ();
foreach ($catDAO->listCategories () as $key => $cat) {
@@ -326,7 +326,7 @@ class configureController extends ActionController {
}
$this->view->categories = $list;
- } elseif ($this->view->req == 'import' && Request::isPost ()) {
+ } elseif ($this->view->req == 'import' && Minz_Request::isPost ()) {
if ($_FILES['file']['error'] == 0) {
// on parse le fichier OPML pour récupérer les catégories et les flux associés
try {
@@ -336,20 +336,20 @@ class configureController extends ActionController {
// On redirige vers le controller feed qui va se charger d'insérer les flux en BDD
// les flux sont mis au préalable dans des variables de Request
- Request::_param ('q', 'null');
- Request::_param ('categories', $categories);
- Request::_param ('feeds', $feeds);
- Request::forward (array ('c' => 'feed', 'a' => 'massiveImport'));
- } catch (OpmlException $e) {
+ Minz_Request::_param ('q', 'null');
+ Minz_Request::_param ('categories', $categories);
+ Minz_Request::_param ('feeds', $feeds);
+ Minz_Request::forward (array ('c' => 'feed', 'a' => 'massiveImport'));
+ } catch (FreshRSS_Opml_Exception $e) {
Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('bad_opml_file')
+ 'content' => Minz_Translate::t ('bad_opml_file')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward (array (
+ Minz_Request::forward (array (
'c' => 'configure',
'a' => 'importExport'
), true);
@@ -357,13 +357,13 @@ class configureController extends ActionController {
}
}
- $feedDAO = new FeedDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
$this->view->feeds = $feedDAO->listFeeds ();
// au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste
$this->view->flux = false;
- View::prependTitle (Translate::t ('import_export_opml') . ' - ');
+ Minz_View::prependTitle (Translate::t ('import_export_opml') . ' - ');
}
public function shortcutAction () {
@@ -379,8 +379,8 @@ class configureController extends ActionController {
'prev_entry', 'next_page', 'prev_page', 'collapse_entry',
'load_more');
- if (Request::isPost ()) {
- $shortcuts = Request::param ('shortcuts');
+ if (Minz_Request::isPost ()) {
+ $shortcuts = Minz_Request::param ('shortcuts');
$shortcuts_ok = array ();
foreach ($shortcuts as $key => $value) {
@@ -396,20 +396,20 @@ class configureController extends ActionController {
'shortcuts' => $this->view->conf->shortcuts ()
);
- $confDAO = new RSSConfigurationDAO ();
+ $confDAO = new FreshRSS_ConfigurationDAO ();
$confDAO->update ($values);
- Session::_param ('conf', $this->view->conf);
+ Minz_Session::_param ('conf', $this->view->conf);
// notif
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('shortcuts_updated')
+ 'content' => Minz_Translate::t ('shortcuts_updated')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true);
}
- View::prependTitle (Translate::t ('shortcuts_management') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('shortcuts_management') . ' - ');
}
}
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php
index c01139ba4..a332ca8a9 100755
--- a/app/controllers/entryController.php
+++ b/app/controllers/entryController.php
@@ -1,46 +1,46 @@
<?php
-class entryController extends ActionController {
+class FreshRSS_entry_Controller extends Minz_ActionController {
public function firstAction () {
if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
+ Minz_Error::error (
403,
- array ('error' => array (Translate::t ('access_denied')))
+ array ('error' => array (Minz_Translate::t ('access_denied')))
);
}
$this->params = array ();
$this->redirect = false;
- $ajax = Request::param ('ajax');
+ $ajax = Minz_Request::param ('ajax');
if ($ajax) {
$this->view->_useLayout (false);
}
}
public function lastAction () {
- $ajax = Request::param ('ajax');
+ $ajax = Minz_Request::param ('ajax');
if (!$ajax && $this->redirect) {
- Request::forward (array (
+ Minz_Request::forward (array (
'c' => 'index',
'a' => 'index',
'params' => $this->params
), true);
} else {
- Request::_param ('ajax');
+ Minz_Request::_param ('ajax');
}
}
public function readAction () {
$this->redirect = true;
- $id = Request::param ('id');
- $is_read = Request::param ('is_read');
- $get = Request::param ('get');
- $nextGet = Request::param ('nextGet', $get);
- $idMax = Request::param ('idMax', 0);
+ $id = Minz_Request::param ('id');
+ $is_read = Minz_Request::param ('is_read');
+ $get = Minz_Request::param ('get');
+ $nextGet = Minz_Request::param ('nextGet', $get);
+ $idMax = Minz_Request::param ('idMax', 0);
$is_read = !!$is_read;
- $entryDAO = new EntryDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
if ($id == false) {
if (!$get) {
$entryDAO->markReadEntries ($idMax);
@@ -68,9 +68,9 @@ class entryController extends ActionController {
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feeds_marked_read')
+ 'content' => Minz_Translate::t ('feeds_marked_read')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
} else {
$entryDAO->markRead ($id, $is_read);
}
@@ -79,10 +79,10 @@ class entryController extends ActionController {
public function bookmarkAction () {
$this->redirect = true;
- $id = Request::param ('id');
+ $id = Minz_Request::param ('id');
if ($id) {
- $entryDAO = new EntryDAO ();
- $entryDAO->markFavorite ($id, Request::param ('is_favorite'));
+ $entryDAO = new FreshRSS_EntryDAO ();
+ $entryDAO->markFavorite ($id, Minz_Request::param ('is_favorite'));
}
}
@@ -93,18 +93,18 @@ class entryController extends ActionController {
// La table des entrées a tendance à grossir énormément
// Cette action permet d'optimiser cette table permettant de grapiller un peu de place
// Cette fonctionnalité n'est à appeler qu'occasionnellement
- $entryDAO = new EntryDAO();
+ $entryDAO = new FreshRSS_EntryDAO();
$entryDAO->optimizeTable();
invalidateHttpCache();
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('optimization_complete')
+ 'content' => Minz_Translate::t ('optimization_complete')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
- Request::forward(array(
+ Minz_Request::forward(array(
'c' => 'configure',
'a' => 'display'
), true);
diff --git a/app/controllers/errorController.php b/app/controllers/errorController.php
index 092609280..d1c2f8fec 100644
--- a/app/controllers/errorController.php
+++ b/app/controllers/errorController.php
@@ -1,8 +1,8 @@
<?php
-class ErrorController extends ActionController {
+class FreshRSS_error_Controller extends Minz_ActionController {
public function indexAction () {
- switch (Request::param ('code')) {
+ switch (Minz_Request::param ('code')) {
case 403:
$this->view->code = 'Error 403 - Forbidden';
break;
@@ -19,8 +19,8 @@ class ErrorController extends ActionController {
$this->view->code = 'Error 404 - Not found';
}
- $this->view->logs = Request::param ('logs');
+ $this->view->logs = Minz_Request::param ('logs');
- View::prependTitle ($this->view->code . ' - ');
+ Minz_View::prependTitle ($this->view->code . ' - ');
}
}
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
index 24b8627ff..e4014c326 100755
--- a/app/controllers/feedController.php
+++ b/app/controllers/feedController.php
@@ -1,22 +1,22 @@
<?php
-class feedController extends ActionController {
+class FreshRSS_feed_Controller extends Minz_ActionController {
public function firstAction () {
$token = $this->view->conf->token();
- $token_param = Request::param ('token', '');
+ $token_param = Minz_Request::param ('token', '');
$token_is_ok = ($token != '' && $token == $token_param);
- $action = Request::actionName ();
+ $action = Minz_Request::actionName ();
if (login_is_conf ($this->view->conf) &&
!is_logged () &&
!($token_is_ok && $action == 'actualize')) {
- Error::error (
+ Minz_Error::error (
403,
- array ('error' => array (Translate::t ('access_denied')))
+ array ('error' => array (Minz_Translate::t ('access_denied')))
);
}
- $this->catDAO = new CategoryDAO ();
+ $this->catDAO = new FreshRSS_CategoryDAO ();
$this->catDAO->checkDefault ();
}
@@ -32,21 +32,21 @@ class feedController extends ActionController {
public function addAction () {
@set_time_limit(300);
- if (Request::isPost ()) {
- $url = Request::param ('url_rss');
- $cat = Request::param ('category', false);
+ if (Minz_Request::isPost ()) {
+ $url = Minz_Request::param ('url_rss');
+ $cat = Minz_Request::param ('category', false);
if ($cat === false) {
$def_cat = $this->catDAO->getDefault ();
$cat = $def_cat->id ();
}
- $user = Request::param ('username');
- $pass = Request::param ('password');
+ $user = Minz_Request::param ('username');
+ $pass = Minz_Request::param ('password');
$params = array ();
$transactionStarted = false;
try {
- $feed = new Feed ($url);
+ $feed = new FreshRSS_Feed ($url);
$feed->_category ($cat);
$httpAuth = '';
@@ -57,7 +57,7 @@ class feedController extends ActionController {
$feed->load ();
- $feedDAO = new FeedDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
$values = array (
'url' => $feed->url (),
'category' => $feed->category (),
@@ -72,25 +72,25 @@ class feedController extends ActionController {
// on est déjà abonné à ce flux
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('already_subscribed', $feed->name ())
+ 'content' => Minz_Translate::t ('already_subscribed', $feed->name ())
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
} else {
$id = $feedDAO->addFeed ($values);
if (!$id) {
// problème au niveau de la base de données
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('feed_not_added', $feed->name ())
+ 'content' => Minz_Translate::t ('feed_not_added', $feed->name ())
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
} else {
$feed->_id ($id);
$feed->faviconPrepare();
$is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0;
- $entryDAO = new EntryDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
$entries = $feed->entries ();
usort($entries, 'self::entryDateComparer');
@@ -118,68 +118,68 @@ class feedController extends ActionController {
// ok, ajout terminé
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feed_added', $feed->name ())
+ 'content' => Minz_Translate::t ('feed_added', $feed->name ())
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
// permet de rediriger vers la page de conf du flux
$params['id'] = $feed->id ();
}
}
- } catch (BadUrlException $e) {
+ } catch (FreshRSS_BadUrl_Exception $e) {
Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('invalid_url', $url)
+ 'content' => Minz_Translate::t ('invalid_url', $url)
);
- Session::_param ('notification', $notif);
- } catch (FeedException $e) {
+ Minz_Session::_param ('notification', $notif);
+ } catch (FreshRSS_Feed_Exception $e) {
Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('internal_problem_feed')
+ 'content' => Minz_Translate::t ('internal_problem_feed')
);
- Session::_param ('notification', $notif);
- } catch (FileNotExistException $e) {
+ Minz_Session::_param ('notification', $notif);
+ } catch (Minz_FileNotExistException $e) {
// Répertoire de cache n'existe pas
Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('internal_problem_feed')
+ 'content' => Minz_Translate::t ('internal_problem_feed')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
}
if ($transactionStarted) {
$feedDAO->rollBack ();
}
- Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true);
}
}
public function truncateAction () {
- if (Request::isPost ()) {
- $id = Request::param ('id');
- $feedDAO = new FeedDAO ();
+ if (Minz_Request::isPost ()) {
+ $id = Minz_Request::param ('id');
+ $feedDAO = new FreshRSS_FeedDAO ();
$n = $feedDAO->truncate($id);
$notif = array(
'type' => $n === false ? 'bad' : 'good',
- 'content' => Translate::t ('n_entries_deleted', $n)
+ 'content' => Minz_Translate::t ('n_entries_deleted', $n)
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
invalidateHttpCache();
- Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true);
}
}
public function actualizeAction () {
@set_time_limit(300);
- $feedDAO = new FeedDAO ();
- $entryDAO = new EntryDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
- $id = Request::param ('id');
- $force = Request::param ('force', false);
+ $id = Minz_Request::param ('id');
+ $force = Minz_Request::param ('force', false);
// on créé la liste des flux à mettre à actualiser
// si on veut mettre un flux à jour spécifiquement, on le met
@@ -236,7 +236,7 @@ class feedController extends ActionController {
$feedDAO->updateLastUpdate ($feed->id ());
$feedDAO->commit ();
$flux_update++;
- } catch (FeedException $e) {
+ } catch (FreshRSS_Feed_Exception $e) {
Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE);
$feedDAO->updateLastUpdate ($feed->id (), 1);
}
@@ -254,19 +254,19 @@ class feedController extends ActionController {
// on a mis un seul flux à jour
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feed_actualized', $feed->name ())
+ 'content' => Minz_Translate::t ('feed_actualized', $feed->name ())
);
} elseif ($flux_update > 1) {
// plusieurs flux on été mis à jour
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('n_feeds_actualized', $flux_update)
+ 'content' => Minz_Translate::t ('n_feeds_actualized', $flux_update)
);
} else {
// aucun flux n'a été mis à jour, oups
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('no_feed_actualized')
+ 'content' => Minz_Translate::t ('no_feed_actualized')
);
}
@@ -277,9 +277,9 @@ class feedController extends ActionController {
$url['params'] = array ('get' => 'f_' . $feed->id ());
}
- if (Request::param ('ajax', 0) === 0) {
- Session::_param ('notification', $notif);
- Request::forward ($url, true);
+ if (Minz_Request::param ('ajax', 0) === 0) {
+ Minz_Session::_param ('notification', $notif);
+ Minz_Request::forward ($url, true);
} else {
// Une requête Ajax met un seul flux à jour.
// Comme en principe plusieurs requêtes ont lieu,
@@ -288,9 +288,9 @@ class feedController extends ActionController {
// ressenti utilisateur
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feeds_actualized')
+ 'content' => Minz_Translate::t ('feeds_actualized')
);
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
// et on désactive le layout car ne sert à rien
$this->view->_useLayout (false);
}
@@ -299,11 +299,11 @@ class feedController extends ActionController {
public function massiveImportAction () {
@set_time_limit(300);
- $entryDAO = new EntryDAO ();
- $feedDAO = new FeedDAO ();
+ $entryDAO = new FreshRSS_EntryDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
- $categories = Request::param ('categories', array (), true);
- $feeds = Request::param ('feeds', array (), true);
+ $categories = Minz_Request::param ('categories', array (), true);
+ $feeds = Minz_Request::param ('feeds', array (), true);
// on ajoute les catégories en masse dans une fonction à part
$this->addCategories ($categories);
@@ -341,78 +341,78 @@ class feedController extends ActionController {
$error = true;
}
}
- } catch (FeedException $e) {
+ } catch (FreshRSS_Feed_Exception $e) {
$error = true;
Minz_Log::record ($e->getMessage (), Minz_Log::WARNING);
}
}
if ($error) {
- $res = Translate::t ('feeds_imported_with_errors');
+ $res = Minz_Translate::t ('feeds_imported_with_errors');
} else {
- $res = Translate::t ('feeds_imported');
+ $res = Minz_Translate::t ('feeds_imported');
}
$notif = array (
'type' => 'good',
'content' => $res
);
- Session::_param ('notification', $notif);
- Session::_param ('actualize_feeds', true);
+ Minz_Session::_param ('notification', $notif);
+ Minz_Session::_param ('actualize_feeds', true);
// et on redirige vers la page d'accueil
- Request::forward (array (
+ Minz_Request::forward (array (
'c' => 'index',
'a' => 'index'
), true);
}
public function deleteAction () {
- if (Request::isPost ()) {
- $type = Request::param ('type', 'feed');
- $id = Request::param ('id');
+ if (Minz_Request::isPost ()) {
+ $type = Minz_Request::param ('type', 'feed');
+ $id = Minz_Request::param ('id');
- $feedDAO = new FeedDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
if ($type == 'category') {
if ($feedDAO->deleteFeedByCategory ($id)) {
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('category_emptied')
+ 'content' => Minz_Translate::t ('category_emptied')
);
//TODO: Delete old favicons
} else {
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('error_occured')
+ 'content' => Minz_Translate::t ('error_occured')
);
}
} else {
if ($feedDAO->deleteFeed ($id)) {
$notif = array (
'type' => 'good',
- 'content' => Translate::t ('feed_deleted')
+ 'content' => Minz_Translate::t ('feed_deleted')
);
Feed::faviconDelete($id);
} else {
$notif = array (
'type' => 'bad',
- 'content' => Translate::t ('error_occured')
+ 'content' => Minz_Translate::t ('error_occured')
);
}
}
- Session::_param ('notification', $notif);
+ Minz_Session::_param ('notification', $notif);
if ($type == 'category') {
- Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true);
} else {
- Request::forward (array ('c' => 'configure', 'a' => 'feed'), true);
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed'), true);
}
}
}
private function addCategories ($categories) {
- $catDAO = new CategoryDAO ();
+ $catDAO = new FreshRSS_CategoryDAO ();
foreach ($categories as $cat) {
if (!$catDAO->searchByName ($cat->name ())) {
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php
index 9c1e18f0b..16a053ba3 100755
--- a/app/controllers/indexController.php
+++ b/app/controllers/indexController.php
@@ -1,6 +1,6 @@
<?php
-class indexController extends ActionController {
+class FreshRSS_index_Controller extends Minz_ActionController {
private $get = false;
private $nb_not_read_cat = 0;
private $entryDAO;
@@ -9,16 +9,16 @@ class indexController extends ActionController {
function __construct($router) {
parent::__construct($router);
- $this->entryDAO = new EntryDAO ();
- $this->feedDAO = new FeedDAO ();
- $this->catDAO = new CategoryDAO ();
+ $this->entryDAO = new FreshRSS_EntryDAO ();
+ $this->feedDAO = new FreshRSS_FeedDAO ();
+ $this->catDAO = new FreshRSS_CategoryDAO ();
}
public function indexAction () {
- $output = Request::param ('output');
+ $output = Minz_Request::param ('output');
$token = $this->view->conf->token();
- $token_param = Request::param ('token', '');
+ $token_param = Minz_Request::param ('token', '');
$token_is_ok = ($token != '' && $token === $token_param);
// check if user is log in
@@ -30,7 +30,7 @@ class indexController extends ActionController {
}
// construction of RSS url of this feed
- $params = Request::params ();
+ $params = Minz_Request::params ();
$params['output'] = 'rss';
if (isset ($params['search'])) {
$params['search'] = urlencode ($params['search']);
@@ -51,10 +51,10 @@ class indexController extends ActionController {
$this->view->_useLayout (false);
header('Content-Type: application/rss+xml; charset=utf-8');
} else {
- View::appendScript (Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js')));
+ Minz_View::appendScript (Minz_Url::display ('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js')));
if ($output === 'global') {
- View::appendScript (Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
+ Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
}
}
@@ -65,14 +65,14 @@ class indexController extends ActionController {
$this->view->get_c = '';
$this->view->get_f = '';
- $get = Request::param ('get', 'a');
+ $get = Minz_Request::param ('get', 'a');
$getType = $get[0];
$getId = substr ($get, 2);
if (!$this->checkAndProcessType ($getType, $getId)) {
Minz_Log::record ('Not found [' . $getType . '][' . $getId . ']', Minz_Log::DEBUG);
- Error::error (
+ Minz_Error::error (
404,
- array ('error' => array (Translate::t ('page_not_found')))
+ array ('error' => array (Minz_Translate::t ('page_not_found')))
);
return;
}
@@ -80,25 +80,25 @@ class indexController extends ActionController {
$this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1);
// mise à jour des titres
- $this->view->rss_title = $this->view->currentName . ' | ' . View::title();
+ $this->view->rss_title = $this->view->currentName . ' | ' . Minz_View::title();
if ($this->view->nb_not_read > 0) {
- View::appendTitle (' (' . $this->view->nb_not_read . ')');
+ Minz_View::appendTitle (' (' . $this->view->nb_not_read . ')');
}
- View::prependTitle (
+ Minz_View::prependTitle (
$this->view->currentName .
($this->nb_not_read_cat > 0 ? ' (' . $this->nb_not_read_cat . ')' : '') .
' - '
);
// On récupère les différents éléments de filtrage
- $this->view->state = $state = Request::param ('state', $this->view->conf->defaultView ());
- $filter = Request::param ('search', '');
+ $this->view->state = $state = Minz_Request::param ('state', $this->view->conf->defaultView ());
+ $filter = Minz_Request::param ('search', '');
if (!empty($filter)) {
$state = 'all'; //Search always in read and unread articles
}
- $this->view->order = $order = Request::param ('order', $this->view->conf->sortOrder ());
- $nb = Request::param ('nb', $this->view->conf->postsPerPage ());
- $first = Request::param ('next', '');
+ $this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sortOrder ());
+ $nb = Minz_Request::param ('nb', $this->view->conf->postsPerPage ());
+ $first = Minz_Request::param ('next', '');
if ($state === 'not_read') { //Any unread article in this category at all?
switch ($getType) {
@@ -143,11 +143,11 @@ class indexController extends ActionController {
}
$this->view->entries = $entries;
- } catch (EntriesGetterException $e) {
+ } catch (FreshRSS_EntriesGetter_Exception $e) {
Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE);
- Error::error (
+ Minz_Error::error (
404,
- array ('error' => array (Translate::t ('page_not_found')))
+ array ('error' => array (Minz_Translate::t ('page_not_found')))
);
}
}
@@ -160,11 +160,11 @@ class indexController extends ActionController {
private function checkAndProcessType ($getType, $getId) {
switch ($getType) {
case 'a':
- $this->view->currentName = Translate::t ('your_rss_feeds');
+ $this->view->currentName = Minz_Translate::t ('your_rss_feeds');
$this->view->get_c = $getType;
return true;
case 's':
- $this->view->currentName = Translate::t ('your_favorites');
+ $this->view->currentName = Minz_Translate::t ('your_favorites');
$this->view->get_c = $getType;
return true;
case 'c':
@@ -200,35 +200,35 @@ class indexController extends ActionController {
}
public function aboutAction () {
- View::prependTitle (Translate::t ('about') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('about') . ' - ');
}
public function logsAction () {
if (login_is_conf ($this->view->conf) && !is_logged ()) {
- Error::error (
+ Minz_Error::error (
403,
- array ('error' => array (Translate::t ('access_denied')))
+ array ('error' => array (Minz_Translate::t ('access_denied')))
);
}
- View::prependTitle (Translate::t ('logs') . ' - ');
+ Minz_View::prependTitle (Minz_Translate::t ('logs') . ' - ');
- if (Request::isPost ()) {
+ if (Minz_Request::isPost ()) {
file_put_contents(LOG_PATH . '/application.log', '');
}
$logs = array();
try {
- $logDAO = new LogDAO ();
+ $logDAO = new FreshRSS_LogDAO ();
$logs = $logDAO->lister ();
$logs = array_reverse ($logs);
- } catch(FileNotExistException $e) {
+ } catch (Minz_FileNotExistException $e) {
}
//gestion pagination
- $page = Request::param ('page', 1);
- $this->view->logsPaginator = new Paginator ($logs);
+ $page = Minz_Request::param ('page', 1);
+ $this->view->logsPaginator = new Minz_Paginator ($logs);
$this->view->logsPaginator->_nbItemsPerPage (50);
$this->view->logsPaginator->_currentPage ($page);
}
@@ -237,9 +237,9 @@ class indexController extends ActionController {
$this->view->_useLayout (false);
$url = 'https://verifier.login.persona.org/verify';
- $assert = Request::param ('assertion');
+ $assert = Minz_Request::param ('assertion');
$params = 'assertion=' . $assert . '&audience=' .
- urlencode (Url::display (null, 'php', true));
+ urlencode (Minz_Url::display (null, 'php', true));
$ch = curl_init ();
$options = array (
CURLOPT_URL => $url,
@@ -253,12 +253,12 @@ class indexController extends ActionController {
$res = json_decode ($result, true);
if ($res['status'] === 'okay' && $res['email'] === $this->view->conf->mailLogin ()) {
- Session::_param ('mail', $res['email']);
+ Minz_Session::_param ('mail', $res['email']);
invalidateHttpCache();
} else {
$res = array ();
$res['status'] = 'failure';
- $res['reason'] = Translate::t ('invalid_login');
+ $res['reason'] = Minz_Translate::t ('invalid_login');
}
header('Content-Type: application/json; charset=UTF-8');
@@ -267,7 +267,7 @@ class indexController extends ActionController {
public function logoutAction () {
$this->view->_useLayout (false);
- Session::_param ('mail');
+ Minz_Session::_param ('mail');
invalidateHttpCache();
}
}
diff --git a/app/controllers/javascriptController.php b/app/controllers/javascriptController.php
index 291474130..e7e25f656 100755
--- a/app/controllers/javascriptController.php
+++ b/app/controllers/javascriptController.php
@@ -1,13 +1,13 @@
<?php
-class javascriptController extends ActionController {
+class FreshRSS_javascript_Controller extends Minz_ActionController {
public function firstAction () {
$this->view->_useLayout (false);
header('Content-type: text/javascript');
}
public function actualizeAction () {
- $feedDAO = new FeedDAO ();
+ $feedDAO = new FreshRSS_FeedDAO ();
$this->view->feeds = $feedDAO->listFeeds ();
}
}