Merge remote-tracking branch 'bohrsty/217_masslog_warning' into next

This commit is contained in:
following
2013-07-22 00:10:51 +02:00
4 changed files with 36 additions and 13 deletions
+6
View File
@@ -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)
+3 -1
View File
@@ -295,6 +295,8 @@ class cachelog
static function isMasslogging($userId)
{
global $opt;
// check for wrong-dated mass logs
$rs = sql("
SELECT `date`, `text`
@@ -330,7 +332,7 @@ class cachelog
else
$masslogs = 0;
return ($masslogs > 20);
return ($masslogs > $opt['logic']['masslog']['count']);
}
}
?>
+23 -11
View File
@@ -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());
+4 -1
View File
@@ -61,6 +61,7 @@ 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}
@@ -68,13 +69,15 @@ function _chkFound () {
<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" />