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; }
} $log_text = processEditorInput($oldDescMode, $descMode, $log_text); //validate date $date_ok = false; if (is_numeric($log_date_month) && is_numeric($log_date_day) && is_numeric($log_date_year) && ("{$log_time_hour}{$log_time_minute}" == "" || is_numeric($log_time_hour)) && ($log_time_minute == "" || is_numeric($log_time_minute))) { $date_ok = checkdate($log_date_month, $log_date_day, $log_date_year) && $log_date_year >= 2000 && $log_time_hour >= 0 && $log_time_hour <= 23 && $log_time_minute >= 0 && $log_time_minute <= 59; if ($date_ok) { if (isset($_POST['submitform'])) { $checkMkTime = mktime($log_time_hour + 0, $log_time_minute + 0, 0, $log_date_month, $log_date_day, $log_date_year); if ($checkMkTime >= time()) { $date_ok = false; } } } } $logtype_ok = logtype_ok($log_record['cache_id'], $log_type, $log_record['logtype']); // not a found log? then ignore the rating if ($log_type != 1 && $log_type != 7) { $top_option = 0; } $pw_ok = true; if ($use_log_pw && $log_type == 1) { if (!isset($_POST['log_pw']) || mb_strtolower($log_pw) != mb_strtolower($_POST['log_pw'])) { $pw_ok = false; $all_ok = false; } } // ignore unauthorized team comments if (!teamcomment_allowed($log_record['cache_id'], $log_type, $log_record['oc_team_comment'])) { $oc_team_comment = 0; }
} } //call eventhandler require_once $rootpath . 'lib/eventhandler.inc.php'; event_new_log($cache_id, $usr['userid'] + 0); } //redirect to viewcache $no_tpl_build = true; //include('viewcache.php'); tpl_redirect('viewcache.php?cacheid=' . $cache_id); } else { // build logtype options $logtype_names = get_logtype_names(); $allowed_logtypes = get_cache_log_types($cache_id, 0); $default_log_type = isset($_REQUEST['logtype']) ? $_REQUEST['logtype'] + 0 : 0; if (!logtype_ok($cache_id, $default_log_type, 0)) { $default_log_type = $allowed_logtypes[0]; } $logtypeoptions = ''; foreach ($allowed_logtypes as $logtype) { $selected = $logtype == $default_log_type ? ' selected="selected"' : ''; $logtypeoptions .= '<option value="' . $logtype . '"' . $selected . '>' . htmlspecialchars($logtype_names[$logtype], ENT_COMPAT, 'UTF-8') . '</option>' . "\n"; } //set tpl vars tpl_set_var('cachename', htmlspecialchars($cachename, ENT_COMPAT, 'UTF-8')); tpl_set_var('cacheid', htmlspecialchars($cache_id, ENT_COMPAT, 'UTF-8')); tpl_set_var('logday', htmlspecialchars($log_date_day, ENT_COMPAT, 'UTF-8')); tpl_set_var('logmonth', htmlspecialchars($log_date_month, ENT_COMPAT, 'UTF-8')); tpl_set_var('logyear', htmlspecialchars($log_date_year, ENT_COMPAT, 'UTF-8')); tpl_set_var('loghour', htmlspecialchars($log_time_hour, ENT_COMPAT, 'UTF-8')); tpl_set_var('logminute', htmlspecialchars($log_time_minute, ENT_COMPAT, 'UTF-8'));