Skip to content
Permalink
Browse files

corrected variable and cookie naming, added configurable masslog count

to message, added cookie documentation, updates #217
  • Loading branch information...
bohrsty committed Jul 22, 2013
1 parent 6505894 commit 0780546f13312280d429bd65791922d83b672b34
Showing with 25 additions and 19 deletions.
  1. +5 −0 doc/cookies.txt
  2. +18 −17 htdocs/log.php
  3. +2 −2 htdocs/templates2/ocstyle/log_cache.tpl
@@ -41,3 +41,8 @@ Name: 'oclogdate'
Type: temporary, discarded when browser closes
Contents: date of last submitted log
File: log.php

Name: 'ocsuppressmasslogwarn'
Type: temporary, expires at midnight
Contents: suppression of masslog warning
File: log.php
@@ -72,27 +72,27 @@
}
// check if masslog warning is accepted (in cookie)
$masslogSaved = isset($_COOKIE['ocmasslogwarn']);
if ($masslogSaved)
$cookieMasslogSaved = $_COOKIE['ocmasslogwarn'] + 0;
$masslogCookieSet = isset($_COOKIE['ocsuppressmasslogwarn']);
if ($masslogCookieSet)
$masslogCookieContent = $_COOKIE['ocsuppressmasslogwarn'] + 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'));
if (isset($_REQUEST['suppressMasslogWarning']) && $_REQUEST['suppressMasslogWarning'] == 1)
setcookie('ocsuppressmasslogwarn', '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;
$masslogAccepted = (isset($_REQUEST['notShowMasslogAgain'])) ? $_REQUEST['notShowMasslogAgain'] : ($masslogSaved ? $cookieMasslogSaved : 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;
$suppressMasslogWarning = (isset($_REQUEST['suppressMasslogWarning'])) ? $_REQUEST['suppressMasslogWarning'] : ($masslogCookieSet ? $masslogCookieContent : 0);
// if not a found log, ignore the rating
$rateOption = ($logType == 1 || $logType == 7) + 0;
@@ -253,7 +253,8 @@
$tpl->assign('octeamcomment', ($ocTeamComment || (!$cache->statusUserLogAllowed() && $useradmin)) ? true : false);
$tpl->assign('octeamcommentclass', (!$cache->statusUserLogAllowed() && $useradmin) ? 'redtext' : '');
// masslogs
$tpl->assign('masslog', cachelog::isMasslogging($user->getUserId()) && $masslogAccepted == 0);
$tpl->assign('masslogCount', $opt['logic']['masslog']['count']);
$tpl->assign('masslog', cachelog::isMasslogging($user->getUserId()) && $suppressMasslogWarning == 0);
// show number of found on log page
$tpl->assign('showstatfounds', $user->showStatFounds());
@@ -64,13 +64,13 @@ function _chkFound () {
<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}
{t 1=$masslogCount}You submitted more than %1 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>
<input type="checkbox" name="suppressMasslogWarning" value="1" class="checkbox" id="suppressMasslogWarning" /> <label for="suppressMasslogWarning">{t}I know what I am doing, do not show again today.{/t}</label>
</p>
{/if}
{if $showstatfounds==true}

0 comments on commit 0780546

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