// See how many logs are in the db for the cache if logprinting is selected // If not or just five logs may printed, the system will set this fixed values for calling the DB. $rscount = 99; //Preset the value $rsreturn = array(88); //Preset the value if (isset($_REQUEST['log']) && $_REQUEST['log'] == 'N') { $rscount = 0; } elseif (isset($_REQUEST['log']) && $_REQUEST['log'] == 'A') { $rsreturn = cache::getLogsCount($cacheid); $rscount = current($rsreturn); } else { $rscount = 5; } $tpl->assign('logcount', $rscount); $logs = cache::getLogsArray($cacheid, 0, $rscount); if (isset($logs[$rscount - 1])) { unset($logs[$rscount - 1]); $tpl->assign('showalllogs', true); } $loganz = sizeof($logs); $tpl->assign('logs', $logs); $tpl->assign('loganz', $loganz); /*end insertion Uwe 20091215*/ /* nature protection areas */ $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName` \r\n\t FROM `cache_npa_areas` \r\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \r\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \r\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=0\r\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\r\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasWarning', $rs); sql_free_result($rs); $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName` \r\n\t FROM `cache_npa_areas` \r\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id` \r\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id` \r\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=1\r\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\r\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasNoWarning', $rs);
$start = 0; } } $count = 5000; if (isset($_REQUEST['count'])) { $count = $_REQUEST['count']; if (!is_numeric($count)) { $count = 5000; } } //$tpl->caching = true; //$tpl->cache_lifetime = 31*24*60*60; //$tpl->cache_id = $cache_id . '|' . $start . '|' . $count; if ($cache_id != 0) { //get cache record $rs = sql("SELECT `caches`.`cache_id`, `caches`.`wp_oc` AS `wpoc`, `caches`.`user_id` AS `userid`, `caches`.`name`, IFNULL(`stat_caches`.`found`, 0) AS `found`, IFNULL(`stat_caches`.`notfound`, 0) AS `notfound`, IFNULL(`stat_caches`.`note`, 0) AS `note`, `cache_status`.`allow_user_view` FROM `caches` INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id` LEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id` WHERE `caches`.`cache_id`='&1'", $cache_id); $rCache = sql_fetch_array($rs); sql_free_result($rs); if ($rCache === false) { $tpl->error(ERROR_CACHE_NOT_EXISTS); } else { if ($rCache['allow_user_view'] != 1 && $rCache['userid'] != $login->userid) { $tpl->error(ERROR_NO_ACCESS); } } } else { $tpl->error(ERROR_CACHE_NOT_EXISTS); } $tpl->assign('cache', $rCache); $tpl->assign('logs', cache::getLogsArray($cache_id, $start, $count)); $tpl->display();
if (isset($_REQUEST['count'])) { $count = $_REQUEST['count']; if (!is_numeric($count)) { $count = 5000; } } $admin_access = ($login->admin && ADMIN_USER) > 0; $deleted = @$_REQUEST['deleted'] > 0 && $admin_access; //$tpl->caching = true; //$tpl->cache_lifetime = 31*24*60*60; //$tpl->cache_id = $cache_id . '|' . $start . '|' . $count; if ($cache_id != 0) { //get cache record $rs = sql("\n\t\t\tSELECT\n\t\t\t\t`caches`.`cache_id`, `caches`.`wp_oc` AS `wpoc`, `caches`.`cache_id` AS `cacheid`,\n\t\t\t\t`caches`.`user_id` AS `userid`, `caches`.`name`,\n\t\t\t\t`caches`.`status` AS `status`,\n\t\t\t\t`caches`.`type` AS `type`,\n\t\t\t\t`caches`.`protect_old_coords` OR `user`.`is_active_flag`=0 AS `protect_old_coords`,\n\t\t\t\tIFNULL(`stat_caches`.`found`, 0) AS `found`,\n\t\t\t\tIFNULL(`stat_caches`.`notfound`, 0) AS `notfound`,\n\t\t\t\tIFNULL(`stat_caches`.`will_attend`, 0) AS `willattend`,\n\t\t\t\tIFNULL(`stat_caches`.`note`, 0) AS `note`,\n\t\t\t\t`cache_status`.`allow_user_view`\n\t\t\tFROM `caches`\n\t\t\tINNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`\n\t\t\tLEFT JOIN `stat_caches` ON `caches`.`cache_id`=`stat_caches`.`cache_id`\n\t\t\tINNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`\n\t\t\tWHERE `caches`.`cache_id`='&1'", $cache_id); $rCache = sql_fetch_array($rs); sql_free_result($rs); if ($rCache === false) { $tpl->error(ERROR_CACHE_NOT_EXISTS); } else { if ($rCache['allow_user_view'] != 1 && $rCache['userid'] != $login->userid && !$admin_access) { $tpl->error(ERROR_NO_ACCESS); } } } else { $tpl->error(ERROR_CACHE_NOT_EXISTS); } $rCache['adminlog'] = $login->admin & ADMIN_USER; $tpl->assign('cache', $rCache); $tpl->assign('logs', cache::getLogsArray($cache_id, $start, $count, $deleted, $rCache['protect_old_coords'])); $tpl->assign('tagloadlogs', $tagloadlogs); $tpl->display();
$rscount = 0; break; case 'A': $rscount = current(cache::getLogsCount($cacheid)); // This option is also used when referencing logs, e.g. from log lists // and picture galleries. break; default: // This is currently used only for the print view function // with parameters 5 or 10. if ($_REQUEST['log'] >= 0 && $_REQUEST['log'] <= 100) { $rscount = $_REQUEST['log'] + 0; } } } $logs = cache::getLogsArray($cacheid, 0, $rscount + 1, false, $rCache['protect_old_coords']); if (isset($logs[$rscount])) { unset($logs[$rscount]); $tpl->assign('morelogs', true); } $loganz = sizeof($logs); $tpl->assign('logs', $logs); $tpl->assign('loganz', $loganz); /*end insertion Uwe 20091215*/ /* nature protection areas */ $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName`\n\t FROM `cache_npa_areas`\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id`\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id`\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=0\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasWarning', $rs); sql_free_result($rs); $rs = sql("SELECT `npa_areas`.`id` AS `npaId`, `npa_areas`.`type_id` AS `npaType`, `npa_areas`.`name` AS `npaName`, `npa_types`.`name` AS `npaTypeName`\n\t FROM `cache_npa_areas`\n\t INNER JOIN `npa_areas` ON `cache_npa_areas`.`npa_id`=`npa_areas`.`id`\n\t INNER JOIN `npa_types` ON `npa_areas`.`type_id`=`npa_types`.`id`\n\t WHERE `cache_npa_areas`.`cache_id`='&1' AND `npa_types`.`no_warning`=1\n\t GROUP BY `npa_areas`.`type_id`, `npa_areas`.`name`\n\t ORDER BY `npa_types`.`ordinal` ASC", $cacheid); $tpl->assign_rs('npaareasNoWarning', $rs);