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');
|
define('HTTP_TIMEOUT', '20');
|
||||||
|
|
||||||
// HTTP_MAX_RESPONSE_SIZE => Maximum accepted size of the response body in MB (default 2MB)
|
// 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)
|
// DATA_DIRECTORY => default is data (writable directory)
|
||||||
define('DATA_DIRECTORY', __DIR__.'/data');
|
define('DATA_DIRECTORY', __DIR__.'/data');
|
||||||
|
@ -74,25 +74,13 @@ function escape($value)
|
|||||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
|
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function flash($html)
|
function flash($type, $html)
|
||||||
{
|
{
|
||||||
$data = '';
|
$data = '';
|
||||||
|
|
||||||
if (isset($_SESSION['flash_message'])) {
|
if (isset($_SESSION[$type])) {
|
||||||
$data = sprintf($html, escape($_SESSION['flash_message']));
|
$data = sprintf($html, escape($_SESSION[$type]));
|
||||||
unset($_SESSION['flash_message']);
|
unset($_SESSION[$type]);
|
||||||
}
|
|
||||||
|
|
||||||
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']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -79,7 +79,7 @@ function get_group_id($title)
|
|||||||
/**
|
/**
|
||||||
* Get all feed ids assigned to a group
|
* Get all feed ids assigned to a group
|
||||||
*
|
*
|
||||||
* @param array $group_id
|
* @param integer $group_id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_feeds_by_group($group_id)
|
function get_feeds_by_group($group_id)
|
||||||
|
@ -103,7 +103,6 @@ function refresh()
|
|||||||
* Remove the current RememberMe session and the cookie
|
* Remove the current RememberMe session and the cookie
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $user_id User id
|
|
||||||
*/
|
*/
|
||||||
function destroy()
|
function destroy()
|
||||||
{
|
{
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<section class="page" data-item-page="<?= $menu ?>">
|
<section class="page" data-item-page="<?= $menu ?>">
|
||||||
<?= Helper\flash('<div class="alert alert-success">%s</div>') ?>
|
<?= Helper\flash('flash_message', '<div class="alert alert-success">%s</div>') ?>
|
||||||
<?= Helper\flash_error('<div class="alert alert-error">%s</div>') ?>
|
<?= Helper\flash('flash_error_message', '<div class="alert alert-error">%s</div>') ?>
|
||||||
<?= $content_for_layout ?>
|
<?= $content_for_layout ?>
|
||||||
</section>
|
</section>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user