Skip to content

Cache type changes (OCNA migration) #2087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions editcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,18 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
// mp3 update end()

if (!isset($_POST['size'])) {
if ($cache_type == GeoCache::TYPE_VIRTUAL || $cache_type == GeoCache::TYPE_WEBCAM ||
$cache_type == GeoCache::TYPE_EVENT) {
if ($cache_type == GeoCache::TYPE_VIRTUAL || $cache_type == GeoCache::TYPE_WEBCAM || $cache_type == GeoCache::TYPE_EVENT ||
$cache_type == GeoCache::TYPE_BITCACHE || $cache_type == GeoCache::TYPE_GUESTBOOK ||
$cache_type == GeoCache::TYPE_BENCHMARK || $cache_type == GeoCache::TYPE_CHALLENGE) {
$sel_size = GeoCache::SIZE_NONE;
} else {
$sel_size = $cache_record['size'];
}
} else {
$sel_size = isset($_POST['size']) ? $_POST['size'] : $cache_record['size'];
if ($cache_type == GeoCache::TYPE_VIRTUAL || $cache_type == GeoCache::TYPE_WEBCAM || $cache_type == GeoCache::TYPE_EVENT) {
if ($cache_type == GeoCache::TYPE_VIRTUAL || $cache_type == GeoCache::TYPE_WEBCAM || $cache_type == GeoCache::TYPE_EVENT ||
$cache_type == GeoCache::TYPE_BITCACHE || $cache_type == GeoCache::TYPE_GUESTBOOK ||
$cache_type == GeoCache::TYPE_BENCHMARK || $cache_type == GeoCache::TYPE_CHALLENGE) {
$sel_size = GeoCache::SIZE_NONE;
}
}
Expand Down Expand Up @@ -406,9 +409,9 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
//check cache size
$size_not_ok = false;
if ($sel_size != GeoCache::SIZE_NONE &&
( $cache_type == GeoCache::TYPE_VIRTUAL ||
$cache_type == GeoCache::TYPE_WEBCAM ||
$cache_type == GeoCache::TYPE_EVENT )) {
( $cache_type == GeoCache::TYPE_VIRTUAL || $cache_type == GeoCache::TYPE_WEBCAM || $cache_type == GeoCache::TYPE_EVENT ||
$cache_type == GeoCache::TYPE_BITCACHE || $cache_type == GeoCache::TYPE_GUESTBOOK ||
$cache_type == GeoCache::TYPE_BENCHMARK || $cache_type == GeoCache::TYPE_CHALLENGE )) {
$error = true;
$size_not_ok = true;
}
Expand Down
5 changes: 3 additions & 2 deletions editlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
$date_not_ok = true;
}

// TYPE_EVENT
if ($cache_type == 6) {
switch ($log_type) {
case 1:
Expand Down Expand Up @@ -449,15 +450,15 @@
continue;
}
}
if ($cache_type == 6 || $cache_type == 8) {
if ($cache_type == 6 || $cache_type == 9) {
// Event cache
if ($cache_type == 6) {
if ($type['id'] == 1 || $type['id'] == 2 || $type['id'] == 4 || $type['id'] == 5 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11) {
continue;
}
}
// Mobile cache
if ($cache_type == 8) {
if ($cache_type == 9) {
if ($type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9) {
continue;
}
Expand Down
68 changes: 44 additions & 24 deletions lib/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
final class cache
{

const TYPE_OTHERTYPE = 1;
const TYPE_TRADITIONAL = 2;
const TYPE_MULTICACHE = 3;
const TYPE_VIRTUAL = 4;
const TYPE_WEBCAM = 5;
const TYPE_EVENT = 6;
const TYPE_QUIZ = 7;
const TYPE_MOVING = 8;
const TYPE_GEOPATHFINAL = 9;
const TYPE_OWNCACHE = 10;

const TYPE_OTHERTYPE = 1;
const TYPE_TRADITIONAL = 2;
const TYPE_MULTICACHE = 3;
const TYPE_VIRTUAL = 4;
const TYPE_WEBCAM = 5;
const TYPE_EVENT = 6;
const TYPE_QUIZ = 7;
const TYPE_MOVING = 9;
const TYPE_OWNCACHE = 11;
const TYPE_BITCACHE = 12;
const TYPE_GUESTBOOK = 13;
const TYPE_BENCHMARK = 14;
const TYPE_CHALLENGE = 15;

const SIZE_OTHER = 1; // Not specified
const SIZE_MICRO = 2;
const SIZE_SMALL = 3;
const SIZE_NORMAL = 4;
const SIZE_LARGE = 5;
const SIZE_VERYLARGE = 6;
const SIZE_NOCONTAINER = 7;
const SIZE_NONE = 7; // No container
const SIZE_NANO = 8;

const STATUS_READY = 1;
const STATUS_UNAVAILABLE = 2;
Expand Down Expand Up @@ -59,27 +64,27 @@ final class cache
self::TYPE_OTHERTYPE => array(
'name' => 'other',
'icon' => 'unknown.png',
'translation' => 'cacheType_5'
'translation' => 'cacheType_1'
),
self::TYPE_TRADITIONAL => array(
'name' => 'traditional',
'icon' => 'traditional.png',
'translation' => 'cacheType_1'
'translation' => 'cacheType_2'
),
self::TYPE_MULTICACHE => array(
'name' => 'multicache',
'icon' => 'multi.png',
'translation' => 'cacheType_2',
'translation' => 'cacheType_3',
),
self::TYPE_VIRTUAL => array(
'name' => 'virtual',
'icon' => 'virtual.png',
'translation' => 'cacheType_8'
'translation' => 'cacheType_4'
),
self::TYPE_WEBCAM => array(
'name' => 'webcam',
'icon' => 'webcam.png',
'translation' => 'cacheType_7'
'translation' => 'cacheType_5'
),
self::TYPE_EVENT => array(
'name' => 'event',
Expand All @@ -89,22 +94,37 @@ final class cache
self::TYPE_QUIZ => array(
'name' => 'quiz',
'icon' => 'quiz.png',
'translation' => 'cacheType_3'
'translation' => 'cacheType_7'
),
self::TYPE_MOVING => array(
'name' => 'moving',
'icon' => 'moving.png',
'translation' => 'cacheType_4'
),
self::TYPE_GEOPATHFINAL => array(
'name' => 'podcast',
'icon' => 'podcache.png',
'translation' => 'cacheType_9'
),
self::TYPE_OWNCACHE => array(
'name' => 'own-cache',
'icon' => 'owncache.png',
'translation' => 'cacheType_10',
'translation' => 'cacheType_11',
),
self::TYPE_BITCACHE => array(
'name' => 'bit-cache',
'icon' => 'bitcache.png',
'translation' => 'cacheType_12',
),
self::TYPE_GUESTBOOK => array(
'name' => 'guestbook',
'icon' => 'guestbook.png',
'translation' => 'cacheType_13',
),
self::TYPE_BENCHMARK => array(
'name' => 'benchmark',
'icon' => 'benchmark.png',
'translation' => 'cacheType_14',
),
self::TYPE_CHALLENGE => array(
'name' => 'challenge',
'icon' => 'challenge.png',
'translation' => 'cacheType_15',
),
);
private static $iconPath = 'images/cache/';
Expand Down
3 changes: 2 additions & 1 deletion lib/caches.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function get_cache_types_from_database()
function get_wp_types_from_database($cachetype)
{
$wp_types = array();
if ($cachetype == '2' || $cachetype == '4' || $cachetype == '5' || $cachetype == '6' || $cachetype == '9') {
if ($cachetype == '2' || $cachetype == '4' || $cachetype == '5' || $cachetype == '6' ||
$cachetype == '12' || $cachetype == '13' || $cachetype == '14' || $cachetype == '15') {
$param = "id=-1 OR id=4 OR id=5 OR id=6";
} else {
$param = "id=-1 OR id=1 OR id=2 OR id=3 OR id=4 OR id=5 OR id=6";
Expand Down
33 changes: 22 additions & 11 deletions lib/format.gpx.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
$gpxContainer[4] = 'Regular'; // OC: SIZE_REGULAR
$gpxContainer[5] = 'Large'; // OC: SIZE_LARGE
$gpxContainer[6] = 'Very Large'; // OC: SIZE_XLARGE
$gpxContainer[7] = 'No container'; // OC: SIZE_NONE
$gpxContainer[7] = 'Virtual'; // OC: SIZE_NONE
$gpxContainer[8] = 'Nano'; // OC: SIZE_NANO

// size strings for oc:size (OC GPX extension)
Expand All @@ -177,9 +177,12 @@
$gpxType[6] = 'Event Cache'; // OC: TYPE_EVENT
// OC specific cache types
$gpxType[7] = 'Unknown Cache'; // OC: TYPE_QUIZ
$gpxType[8] = 'Unknown Cache'; // OC: TYPE_MOVING
$gpxType[9] = 'Unknown Cache'; // OC: TYPE_GEOPATHFINAL
$gpxType[10] = 'Unknown Cache'; // OC: TYPE_OWNCACHE
$gpxType[9] = 'Traditional'; // OC: TYPE_MOVING
$gpxType[11] = 'Traditional'; // OC: TYPE_OWNCACHE
$gpxType[12] = 'Virtual'; // OC: TYPE_BITCACHE
$gpxType[13] = 'Traditional'; // OC: TYPE_GUESTBOOK
$gpxType[14] = 'Virtual'; // OC: TYPE_BENCHMARK
$gpxType[15] = 'Unknown Cache'; // OC: TYPE_CHALLENGE

// type strings for oc:type (OC GPX extension)
$gpxOcType[1] = 'Other Cache';
Expand All @@ -189,9 +192,12 @@
$gpxOcType[5] = 'Webcam Cache';
$gpxOcType[6] = 'Event Cache';
$gpxOcType[7] = 'Quiz Cache';
$gpxOcType[8] = 'Moving Cache';
$gpxOcType[9] = 'Podcast Cache';
$gpxOcType[10] = 'Own Cache';
$gpxOcType[9] = 'Moving Cache';
$gpxOcType[11] = 'Own Cache';
$gpxOcType[12] = 'BIT Cache';
$gpxOcType[13] = 'Guestbook Cache';
$gpxOcType[14] = 'Benchmark Cache';
$gpxOcType[15] = 'Challenge Cache';

/* Groundspeak IDs:
2 Traditional Cache
Expand Down Expand Up @@ -220,16 +226,21 @@

// OC type names
// Note: these names should be defined with cache types. See well_defined project.
// well known types
$gpxGeocacheTypeText[1] = 'Unknown Cache';
$gpxGeocacheTypeText[2] = 'Traditional Cache';
$gpxGeocacheTypeText[3] = 'Multi-Cache';
$gpxGeocacheTypeText[4] = 'Virtual Cache';
$gpxGeocacheTypeText[5] = 'Webcam Cache';
$gpxGeocacheTypeText[6] = 'Event Cache';
$gpxGeocacheTypeText[7] = 'Puzzle Cache';
$gpxGeocacheTypeText[8] = 'Moving Cache';
$gpxGeocacheTypeText[9] = 'Podcast cache';
$gpxGeocacheTypeText[10] = 'Own cache';
// OC specific cache types
$gpxGeocacheTypeText[7] = 'Quiz';
$gpxGeocacheTypeText[9] = 'Moving Cache';
$gpxGeocacheTypeText[11] = 'Own Cache';
$gpxGeocacheTypeText[12] = 'BIT Cache';
$gpxGeocacheTypeText[13] = 'Guestbook Cache';
$gpxGeocacheTypeText[14] = 'Benchmark Cache';
$gpxGeocacheTypeText[15] = 'Challenge Cache';

// ************************************************************************
// Logs
Expand Down
Loading