Skip to content
Permalink
Browse files

5394: block changing OC-specific cache types and sizes by ocprop

  • Loading branch information...
following
following committed Mar 24, 2013
1 parent 76543d5 commit 7eccc1d5d1667efcc2f563905120647d22310f7c
Showing with 32 additions and 0 deletions.
  1. +16 −0 htdocs/editcache.php
  2. +5 −0 htdocs/lib/common.inc.php
  3. +11 −0 htdocs/lib2/common.inc.php
@@ -447,6 +447,22 @@ function getWaypoints($cacheid)
$activation_date = 'NULL';
}
// check for Ocprop data to ignore
if ($ocpropping)
{
$rs = sql("SELECT `type`, `size` FROM `caches` WHERE `cache_id`='&1'", $cache_id);
if ($r = sql_fetch_assoc($rs))
{
if ($r['type'] == 8 && $cache_type == 7)
$cache_type = 8;
if ($r['type'] == 10 && $cache_type == 2)
$cache_type = 10;
if ($r['size'] == 8 && ($sel_size == 1 || $sel_size == 2))
$sel_size = 8;
}
sql_free_result($rs);
}
// save to DB
// status update will trigger touching the last_modified date of all depending records
sql("UPDATE `caches` SET `name`='&1', `longitude`='&2', `latitude`='&3', `type`='&4', `date_hidden`='&5', `country`='&6', `size`='&7', `difficulty`='&8', `terrain`='&9', `status`='&10', `search_time`='&11', `way_length`='&12', `logpw`='&13', `wp_gc`='&14', `wp_nc`='&15', `date_activate` = $activation_date WHERE `cache_id`='&16'", $cache_name, $cache_lon, $cache_lat, $cache_type, date('Y-m-d', mktime(0, 0, 0, $cache_hidden_month, $cache_hidden_day, $cache_hidden_year)), $cache_country, $sel_size, $cache_difficulty, $cache_terrain, $status, $search_time, $way_length, $log_pw, $wp_gc, $wp_nc, $cache_id);
@@ -33,6 +33,8 @@ function __autoload($class_name)
require_once($file);
}
if (isset($opt['rootpath']))
$rootpath = $opt['rootpath'];
else if (isset($rootpath))
@@ -247,6 +249,9 @@ function __autoload($class_name)
}
}
// are we Ocprop?
$ocpropping = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],"Ocprop/");
// zeitmessung
require_once($rootpath . 'lib/bench.inc.php');
$bScriptExecution = new Cbench;
@@ -29,6 +29,7 @@ function __autoload($class_name)
}
}
// yepp, we will use UTF-8
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
@@ -74,6 +75,8 @@ function __autoload($class_name)
$opt['template']['style'] = $opt['template']['default']['style'];
$opt['stylepath'] = $opt['rootpath'] . 'templates2/' . $opt['template']['style'] . '/';
check_useragent();
/* setup smarty
*
*/
@@ -228,6 +231,14 @@ function set_timezone()
date_default_timezone_set($opt['php']['timezone']);
}
function check_useragent()
{
global $_SERVER, $ocpropping;
// are we Ocprop?
$ocpropping = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],"Ocprop/");
}
function fix_magic_quotes_gpc()
{
// Disable magic_quotes_runtime

0 comments on commit 7eccc1d

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