// 2. It can be used as a tweak to control which log's date is relevant // for the rating, e.g. when logging a second found on a recycled or // renewed cache [listing]. } else { sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']); } } // do not use slave server for the next time ... db_slave_exclude(); //display cache page tpl_redirect('viewcache.php?cacheid=' . urlencode($log_record['cache_id']) . '&log=A#log' . urlencode($log_id)); exit; } // build logtype options $disable_statuschange = $log_record['cache_user_id'] == $login->userid && !is_latest_log($log_record['cache_id'], $log_record['log_id']); $logtype_names = get_logtype_names(); $allowed_logtypes = get_cache_log_types($log_record['cache_id'], $log_record['logtype'], !$disable_statuschange); $logtypeoptions = ''; foreach ($allowed_logtypes as $logtype) { $selected = $log_record['logtype'] == $logtype ? ' selected="selected"' : ''; $logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>'; $logtypeoptions .= htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8'); $logtypeoptions .= '</option>' . "\n"; } $disable_typechange = $disable_statuschange && $log_record['is_status_log']; tpl_set_var('type_edit_disabled', $disable_typechange ? $type_edit_disabled : ''); // TODO: Enforce the 'diables' when processing the posted data. // It's not that urgent, because nothing can be broken by changing // past status log types (it was even allowed up to OC 3.0.17); // just the log history may look weird. if (teamcomment_allowed($log_record['cache_id'], 3, $log_record['oc_team_comment'])) {
function getUserLogTypes($userLogType, $oldLogType = 0) { global $translate, $login; $logTypes = array(); $logtypeNames = get_logtype_names(); $allowedLogtypes = get_cache_log_types($this->getCacheId(), $oldLogType); $defaultLogType = $userLogType; if (!logtype_ok($this->getCacheId(), $defaultLogType, $oldLogType)) { $defaultLogType = $allowedLogtypes[0]; } // prepare array $i = 0; foreach ($allowedLogtypes as $logtype) { $logTypes[$i]['selected'] = $logtype == $defaultLogType ? true : false; $logTypes[$i]['name'] = $logtypeNames[$logtype]; $logTypes[$i]['id'] = $logtype; $i++; } // return return $logTypes; }