Skip to content
Permalink
Browse files

added checkbox to suppress masslog warning until midnight, makes count

of identical logs for masslog configurable in settings, updates #217
  • Loading branch information...
bohrsty committed Jul 21, 2013
1 parent 882f8c2 commit 6505894992a4db3bae0a01fc7d21f5de80ee5471
@@ -251,6 +251,12 @@
*
*/
$opt['logic']['rating']['percentageOfFounds'] = 10;
/*
* count of identical logs (date and text) that shows a warning message on
* next log
*/
$opt['logic']['masslog']['count'] = 20;
/* Well known node id's - required for synchronization
* 1 Opencaching Deutschland (www.opencaching.de)
@@ -295,6 +295,8 @@ static function isDuplicate($cacheId, $userId, $logType, $logDate, $logText)
static function isMasslogging($userId)
{
global $opt;
// check for wrong-dated mass logs
$rs = sql("
SELECT `date`, `text`
@@ -330,7 +332,7 @@ static function isMasslogging($userId)
else
$masslogs = 0;
return ($masslogs > 20);
return ($masslogs > $opt['logic']['masslog']['count']);
}
}
?>
@@ -70,17 +70,29 @@
$defaultLogMonth = substr($_COOKIE['oclogdate'],4,2);
$defaultLogDay = substr($_COOKIE['oclogdate'],6,2);
}
// check if masslog warning is accepted (in cookie)
$masslogSaved = isset($_COOKIE['ocmasslogwarn']);
if ($masslogSaved)
$cookieMasslogSaved = $_COOKIE['ocmasslogwarn'] + 0;
else
{
// save masslog acception in cookie that expires on midnight if clicked
if (isset($_REQUEST['notShowMasslogAgain']) && $_REQUEST['notShowMasslogAgain'] == 1)
setcookie('ocmasslogwarn', '1', strtotime('tomorrow'));
}
$logText = (isset($_POST['logtext'])) ? ($_POST['logtext']) : '';
$logType = (isset($_REQUEST['logtype'])) ? ($_REQUEST['logtype']+0) : null;
$logDateDay = (isset($_POST['logday'])) ? trim($_POST['logday']) : ($datesaved ? $defaultLogDay : date('d'));
$logDateMonth = (isset($_POST['logmonth'])) ? trim($_POST['logmonth']) : ($datesaved ? $defaultLogMonth : date('m'));
$logDateYear = (isset($_POST['logyear'])) ? trim($_POST['logyear']) : ($datesaved ? $defaultLogYear : date('Y'));
$logTimeHour = (isset($_POST['loghour'])) ? trim($_POST['loghour']) : "";
$logTimeMinute = (isset($_POST['logminute'])) ? trim($_POST['logminute']) : "";
$rateOption = (isset($_POST['ratingoption'])) ? $_POST['ratingoption']+0 : 0;
$rateCache = (isset($_POST['rating'])) ? $_POST['rating']+0 : 0;
$ocTeamComment = (isset($_REQUEST['teamcomment'])) ? $_REQUEST['teamcomment'] != 0 : 0;
$logText = (isset($_POST['logtext'])) ? ($_POST['logtext']) : '';
$logType = (isset($_REQUEST['logtype'])) ? ($_REQUEST['logtype']+0) : null;
$logDateDay = (isset($_POST['logday'])) ? trim($_POST['logday']) : ($datesaved ? $defaultLogDay : date('d'));
$logDateMonth = (isset($_POST['logmonth'])) ? trim($_POST['logmonth']) : ($datesaved ? $defaultLogMonth : date('m'));
$logDateYear = (isset($_POST['logyear'])) ? trim($_POST['logyear']) : ($datesaved ? $defaultLogYear : date('Y'));
$logTimeHour = (isset($_POST['loghour'])) ? trim($_POST['loghour']) : "";
$logTimeMinute = (isset($_POST['logminute'])) ? trim($_POST['logminute']) : "";
$rateOption = (isset($_POST['ratingoption'])) ? $_POST['ratingoption']+0 : 0;
$rateCache = (isset($_POST['rating'])) ? $_POST['rating']+0 : 0;
$ocTeamComment = (isset($_REQUEST['teamcomment'])) ? $_REQUEST['teamcomment'] != 0 : 0;
$masslogAccepted = (isset($_REQUEST['notShowMasslogAgain'])) ? $_REQUEST['notShowMasslogAgain'] : ($masslogSaved ? $cookieMasslogSaved : 0);
// if not a found log, ignore the rating
$rateOption = ($logType == 1 || $logType == 7) + 0;
@@ -241,7 +253,7 @@
$tpl->assign('octeamcomment', ($ocTeamComment || (!$cache->statusUserLogAllowed() && $useradmin)) ? true : false);
$tpl->assign('octeamcommentclass', (!$cache->statusUserLogAllowed() && $useradmin) ? 'redtext' : '');
// masslogs
$tpl->assign('masslog', cachelog::isMasslogging($user->getUserId()));
$tpl->assign('masslog', cachelog::isMasslogging($user->getUserId()) && $masslogAccepted == 0);
// show number of found on log page
$tpl->assign('showstatfounds', $user->showStatFounds());
@@ -61,20 +61,23 @@ function _chkFound () {
<img src="resource2/{$opt.template.style}/images/description/22x22-logs.png" style="align: left; margin-right: 10px;" width="22" height="22" alt="{t}New log-entry{/t}" />
{t 1=$cachelink}Add log-entry for the cache %1{/t}
</div>
<form action="log.php" method="post" enctype="application/x-www-form-urlencoded" name="logform" dir="ltr">
{if $masslog==true}
<p class="redtext">
{t}You submitted more than 20 identical logs. Please make sure that you are entering the date of your cache visit, not the current date - also when "late logging" old finds.{/t}
</p>
<p>
{t}Wrong log dates can impair several OC functions like searching by last log date. Also, the owner and other caches may think that the cache has been currently found (date and type of the last log are shown in the owner's caches list!), which can adversely affect cache maintenance and lead to more DNFs.{/t}
</p>
<p>
<input type="checkbox" name="notShowMasslogAgain" value="1" class="checkbox" id="notShowMasslogAgain" /> <label for="notShowMasslogAgain">{t}I know what I am doing, do not show again today.{/t}</label>
</p>
{/if}
{if $showstatfounds==true}
<p class="align-right">
<b>{t 1=$userFound}You found %1 caches until now.{/t}</b>
</p>
{/if}
<form action="log.php" method="post" enctype="application/x-www-form-urlencoded" name="logform" dir="ltr">
<input type="hidden" name="cacheid" value="{$cacheid}"/>
<input type="hidden" name="version3" value="1"/>
<input id="descMode" type="hidden" name="descMode" value="1" />

0 comments on commit 6505894

Please sign in to comment.
You can’t perform that action at this time.