Remove some code duplication and fix some minor issues
This commit is contained in:
parent
4f7ea89925
commit
33a4bf2202
@ -4,7 +4,7 @@
|
||||
define('HTTP_TIMEOUT', '20');
|
||||
|
||||
// HTTP_MAX_RESPONSE_SIZE => Maximum accepted size of the response body in MB (default 2MB)
|
||||
defined('HTTP_MAX_RESPONSE_SIZE') or define('HTTP_MAX_RESPONSE_SIZE', 2097152);
|
||||
define('HTTP_MAX_RESPONSE_SIZE', 2097152);
|
||||
|
||||
// DATA_DIRECTORY => default is data (writable directory)
|
||||
define('DATA_DIRECTORY', __DIR__.'/data');
|
||||
|
@ -17,7 +17,7 @@ Router\get_action('unread', function() {
|
||||
$group_id = Request\int_param('group_id', null);
|
||||
$feed_ids = array();
|
||||
|
||||
if (!is_null($group_id)) {
|
||||
if (! is_null($group_id)) {
|
||||
$feed_ids = Model\Group\get_feeds_by_group($group_id);
|
||||
}
|
||||
|
||||
|
@ -74,25 +74,13 @@ function escape($value)
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
|
||||
function flash($html)
|
||||
function flash($type, $html)
|
||||
{
|
||||
$data = '';
|
||||
|
||||
if (isset($_SESSION['flash_message'])) {
|
||||
$data = sprintf($html, escape($_SESSION['flash_message']));
|
||||
unset($_SESSION['flash_message']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function flash_error($html)
|
||||
{
|
||||
$data = '';
|
||||
|
||||
if (isset($_SESSION['flash_error_message'])) {
|
||||
$data = sprintf($html, escape($_SESSION['flash_error_message']));
|
||||
unset($_SESSION['flash_error_message']);
|
||||
if (isset($_SESSION[$type])) {
|
||||
$data = sprintf($html, escape($_SESSION[$type]));
|
||||
unset($_SESSION[$type]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@ -79,7 +79,7 @@ function get_group_id($title)
|
||||
/**
|
||||
* Get all feed ids assigned to a group
|
||||
*
|
||||
* @param array $group_id
|
||||
* @param integer $group_id
|
||||
* @return array
|
||||
*/
|
||||
function get_feeds_by_group($group_id)
|
||||
|
@ -103,7 +103,6 @@ function refresh()
|
||||
* Remove the current RememberMe session and the cookie
|
||||
*
|
||||
* @access public
|
||||
* @param integer $user_id User id
|
||||
*/
|
||||
function destroy()
|
||||
{
|
||||
|
@ -51,8 +51,8 @@
|
||||
</nav>
|
||||
</header>
|
||||
<section class="page" data-item-page="<?= $menu ?>">
|
||||
<?= Helper\flash('<div class="alert alert-success">%s</div>') ?>
|
||||
<?= Helper\flash_error('<div class="alert alert-error">%s</div>') ?>
|
||||
<?= Helper\flash('flash_message', '<div class="alert alert-success">%s</div>') ?>
|
||||
<?= Helper\flash('flash_error_message', '<div class="alert alert-error">%s</div>') ?>
|
||||
<?= $content_for_layout ?>
|
||||
</section>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user