allow OC team comment logs for any locked caches
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
$event_log_pw_field = '<tr><td colspan="2">' . t('passwort to log:') . ' <input class="input100" type="text" name="log_pw" maxlength="20" value="" /> (' . t('only for attended-logs') . ')</td></tr><tr><td class="spacer" colspan="2"></td></tr>';
|
||||
$other_log_pw_field = '<tr><td colspan="2">' . t('passwort to log:') . ' <input class="input100" type="text" name="log_pw" maxlength="20" value="" /> ' . t('(only for found-logs)') . '</td></tr><tr><td class="spacer" colspan="2"></td></tr>';
|
||||
$log_pw_field_pw_not_ok = '<tr><td colspan="2">' . t('passwort to log:') . ' <input type="text" name="log_pw" maxlength="20" size="20" value=""/><span class="errormsg"> ' . t('Invalid password!') . '</span></td></tr><tr><td class="spacer" colspan="2"></td></tr>';
|
||||
$teamcomment_field = ' <input type="checkbox" name="teamcomment" value="1" class="checkbox" {chk_sel} id="teamcomment" /> <label for="teamcomment">' . t('OC team comment') . '</label>';
|
||||
$teamcomment_field = ' <input type="checkbox" name="teamcomment" value="1" class="checkbox" {chk_sel} id="teamcomment" /> <label for="teamcomment"><span class="{textclass}">' . t('OC team comment') . '</span></label>';
|
||||
|
||||
$listed_only_oc = t('only listed here!');
|
||||
|
||||
|
||||
@@ -70,24 +70,28 @@
|
||||
$cache_type = $rCache['type'];
|
||||
$cache_status = $rCache['status'];
|
||||
$owner = $login->userid == ($rCache['user_id']);
|
||||
$admin = admin_has_open_report($cache_id);
|
||||
$admin_report = admin_has_open_report($cache_id);
|
||||
$admin_locked = $login->hasAdminPriv(ADMIN_USER) && in_array($rCache['status'], array(6,7));
|
||||
|
||||
// build result list
|
||||
//
|
||||
// Pay attention to okapi/services/logs/submit.php when changing this!
|
||||
|
||||
$allowed_logtypes = array();
|
||||
if ($owner || $admin)
|
||||
if ($owner || $admin_report || $admin_locked)
|
||||
{
|
||||
$allowed_logtypes[] = 3; // note
|
||||
if ($cache_status != 5 && (($cache_status != 4 && $cache_status != 7) || $admin))
|
||||
}
|
||||
if ($owner || $admin_report)
|
||||
{
|
||||
if ($cache_status != 5 && (($cache_status != 4 && $cache_status != 7) || $admin_report))
|
||||
{
|
||||
$allowed_logtypes[] = 10; // ready for search
|
||||
$allowed_logtypes[] = 11; // temporarily not available
|
||||
$allowed_logtypes[] = 9; // archived
|
||||
$allowed_logtypes[] = 13; // locked
|
||||
}
|
||||
if ($admin || $old_logtype == 14)
|
||||
if ($admin_report || $old_logtype == 14)
|
||||
$allowed_logtypes[] = 14; // locked, invisible
|
||||
}
|
||||
if ($cache_type == 6) // event
|
||||
@@ -100,7 +104,7 @@
|
||||
$allowed_logtypes[] = 1; // found
|
||||
$allowed_logtypes[] = 2; // not found
|
||||
}
|
||||
if (!($owner || $admin))
|
||||
if (!($owner || $admin_report || $admin_locked))
|
||||
{
|
||||
$allowed_logtypes[] = 3; // note
|
||||
}
|
||||
@@ -125,11 +129,26 @@
|
||||
return false;
|
||||
else
|
||||
{
|
||||
$rs = sql("SELECT `user_id` FROM `caches` WHERE `cache_id`='&1'", $cache_id);
|
||||
if ($r = sql_fetch_array($rs))
|
||||
$rs = sql("SELECT `user_id`,`status` FROM `caches` WHERE `cache_id`='&1'", $cache_id);
|
||||
if ($rCache = sql_fetch_array($rs))
|
||||
{
|
||||
$allowed = $login->userid != $r['user_id'] &&
|
||||
(!$opt['logic']['admin']['team_comments_only_for_reports'] || admin_has_open_report($cache_id));
|
||||
if ($login->userid == $rCache['user_id'])
|
||||
{
|
||||
// not allowed for own caches
|
||||
$allowed = false;
|
||||
}
|
||||
else if (!$opt['logic']['admin']['team_comments_only_for_reports'] || admin_has_open_report($cache_id))
|
||||
{
|
||||
// allowed for report processing by admins
|
||||
$allowed = true;
|
||||
}
|
||||
else if ($login->hasAdminPriv(ADMIN_USER) && in_array($rCache['status'], array(6,7)))
|
||||
{
|
||||
// allowed for admins && locked caches, see http://forum.opencaching-network.org/index.php?topic=3102.msg39517#msg39517
|
||||
$allowed = true;
|
||||
}
|
||||
else
|
||||
$allowed = false;
|
||||
}
|
||||
else
|
||||
$allowed = false;
|
||||
|
||||
+8
-2
@@ -59,6 +59,7 @@
|
||||
require($stylepath.'/rating.inc.php');
|
||||
|
||||
$useradmin = ($login->admin & ADMIN_USER) ? 1 : 0;
|
||||
$adminlog = false;
|
||||
|
||||
$cachename = '';
|
||||
if ($cache_id != 0)
|
||||
@@ -297,10 +298,15 @@
|
||||
tpl_set_var('submit', $submit);
|
||||
tpl_set_var('date_message', '');
|
||||
|
||||
tpl_set_var('adminlog',$adminlog);
|
||||
|
||||
$oc_team_comment = isset($_REQUEST['teamcomment']) ? ($_REQUEST['teamcomment'] != 0) : 0;
|
||||
if (teamcomment_allowed($cache_id,3))
|
||||
tpl_set_var('teamcommentoption',
|
||||
mb_ereg_replace('{chk_sel}', ($oc_team_comment ? 'checked' : ''), $teamcomment_field));
|
||||
{
|
||||
$tco = mb_ereg_replace('{chk_sel}', ($oc_team_comment || $adminlog ? 'checked' : ''), $teamcomment_field);
|
||||
$tco = mb_ereg_replace('{textclass}', ($adminlog ? 'redtext' : ''), $tco);
|
||||
tpl_set_var('teamcommentoption', $tco);
|
||||
}
|
||||
else
|
||||
tpl_set_var('teamcommentoption', '');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user