remove unnecessary need_auth()

This commit is contained in:
Max Pozdeev 2020-09-08 14:50:06 +03:00
parent bd698949a5
commit 4929663437
6 changed files with 5 additions and 7 deletions

View file

@ -15,7 +15,7 @@ $db = DBConnection::instance();
if(isset($_GET['loadLists']))
{
if (need_auth() && !is_logged()) $sqlWhere = 'WHERE published=1';
if (!is_logged()) $sqlWhere = 'WHERE published=1';
else $sqlWhere = '';
$t = array();
$t['total'] = 0;
@ -571,7 +571,6 @@ function prepareTaskRow($r)
function check_read_access($listId = null)
{
$db = DBConnection::instance();
if(Config::get('password') == '') return true;
if(is_logged()) return true;
if($listId !== null)
{

View file

@ -38,7 +38,6 @@ else printCSV($listData, $data);
function have_write_access()
{
if(Config::get('password') == '') return true;
if(is_logged()) return true;
return false;
}

View file

@ -94,7 +94,7 @@ function is_logged()
function is_readonly()
{
if (need_auth() && !is_logged()) return true;
if ( !is_logged() ) return true;
return false;
}

View file

@ -10,7 +10,7 @@ require_once('./init.php');
$lang = Lang::instance();
if (need_auth() && !is_logged())
if ( !is_logged() )
{
die("Access denied!<br/> Disable password protection or Log in.");
}

View file

@ -27,7 +27,7 @@ if(!isset($config['db']))
if($config['db'] != '')
{
require_once('./init.php');
if (need_auth() && !is_logged())
if ( !is_logged() )
{
die("Access denied!<br> Disable password protection or Log in.");
}

View file

@ -30,7 +30,7 @@ $().ready(function(){
mttUrl: "<?php mttinfo('mtt_url'); ?>",
db: mytinytodoStorageAjax,
needAuth: <?php echo need_auth() ? "true" : "false"; ?>,
isLogged: <?php echo (need_auth() && is_logged()) ? "true" : "false"; ?>,
isLogged: <?php echo is_logged() ? "true" : "false"; ?>,
showdate: <?php echo (Config::get('showdate') && !Config::get('mobile')) ? "true" : "false"; ?>,
singletab: <?php echo (isset($_GET['singletab']) || Config::get('mobile')) ? "true" : "false"; ?>,
duedatepickerformat: "<?php echo htmlspecialchars(Config::get('dateformat2')); ?>",