diff --git a/badge_positions_list.php b/badge_positions_list.php
index 9070d5acbf..6dec79464a 100644
--- a/badge_positions_list.php
+++ b/badge_positions_list.php
@@ -3,6 +3,7 @@
use src\Utils\Text\Formatter;
use src\Controllers\MeritBadgeController;
use src\Controllers\ViewBadgeHeadController;
+use src\Models\GeoCache\GeoCacheCommons;
require_once(__DIR__.'/lib/common.inc.php');
@@ -33,7 +34,6 @@
$content = "";
$positionsMeritBadge = $meritBadgeCtrl->buildArrayGainedPositions($userid, $badge_id);
-$cacheTypesIcons = cache::getCacheIconsSet();
foreach( $positionsMeritBadge as $onePositionBadge ){
@@ -55,8 +55,7 @@
$typeIcon ='';
$typeIcon = str_replace( "{src}",
- $cacheTypesIcons[$onePositionBadge->getType()]['iconSet'][1]['iconSmallFound'],
- $typeIcon );
+ GeoCacheCommons::CacheIconByType($onePositionBadge->getType(), GeoCacheCommons::STATUS_READY), $typeIcon);
$date = Formatter::date($onePositionBadge->getGainDate());
$dateSort = date("y.m.d", strtotime($onePositionBadge->getGainDate()));
diff --git a/cacheratings.php b/cacheratings.php
index 5b89217548..cfce4cd043 100644
--- a/cacheratings.php
+++ b/cacheratings.php
@@ -4,7 +4,6 @@
//prepare the templates and include all necessary
require_once(__DIR__.'/lib/common.inc.php');
-require_once(__DIR__.'/lib/caches.inc.php');
require_once(__DIR__.'/src/Views/lib/icons.inc.php');
global $usr;
diff --git a/config/geocache.default.php b/config/geocache.default.php
index c1ff3ce536..f00b3bf909 100644
--- a/config/geocache.default.php
+++ b/config/geocache.default.php
@@ -16,7 +16,7 @@
*
* (All other size-related features will automatically adjust to the sizes
* which are in use for existing caches.)
- *
+ *
* The order does not matter.
*/
$geocache['enabledSizes'] = [
@@ -27,3 +27,10 @@
GeoCacheCommons::SIZE_XLARGE,
GeoCacheCommons::SIZE_NONE,
];
+
+/**
+ * Types of geocache which are forbidden on creation (it is possible thatsuch geocaches are still in DB,
+ * but no NEW caches of this can be created
+ */
+$geocache['noNewCachesOfTypes'] = [];
+
diff --git a/config/geocache.nl.php b/config/geocache.nl.php
index a6c78b1781..fc45dddab1 100644
--- a/config/geocache.nl.php
+++ b/config/geocache.nl.php
@@ -7,3 +7,4 @@
*/
$geocache['enabledSizes'][] = GeoCacheCommons::SIZE_NANO;
+
diff --git a/config/geocache.pl.php b/config/geocache.pl.php
new file mode 100644
index 0000000000..0a067def09
--- /dev/null
+++ b/config/geocache.pl.php
@@ -0,0 +1,13 @@
+dbResultFetch($s)) {
if ($cache_record['user_id'] == $usr['userid'] || $usr['admin']) {
- require_once(__DIR__.'/lib/caches.inc.php');
// from deleted editcache.inc.php:
$submit = 'Zapisz';
@@ -739,23 +739,30 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
//build typeoptions
$types = '';
- foreach (get_cache_types_from_database() as $type) {
+ foreach (GeoCacheCommons::CacheTypesArray() as $type) {
// blockforbidden cache types
- if (($type['id'] != $cache_type) && in_array($type['id'], $config['forbidenCacheTypes']) && !$usr['admin']) {
+ if (($type != $cache_type) && in_array($type, OcConfig::getNoNewCacheOfTypesArray()) && !$usr['admin']) {
continue;
}
- if (isset($config['cacheLimitByTypePerUser'][$cache_type]) && $cacheLimitByTypePerUser[$cache_type] >= $config['cacheLimitByTypePerUser'][$cache_type] && !$usr['admin']) {
+ if (isset($config['cacheLimitByTypePerUser'][$cache_type]) &&
+ $cacheLimitByTypePerUser[$cache_type] >= $config['cacheLimitByTypePerUser'][$cache_type] &&
+ !$usr['admin']) {
continue;
}
- if (isset($cacheLimitByTypePerUser[$type['id']]) && isset($config['cacheLimitByTypePerUser'][$type['id']]) && $cacheLimitByTypePerUser[$type['id']] >= $config['cacheLimitByTypePerUser'][$type['id']] && !$usr['admin']) {
+ if (isset($cacheLimitByTypePerUser[$type]) &&
+ isset($config['cacheLimitByTypePerUser'][$type]) &&
+ $cacheLimitByTypePerUser[$type] >= $config['cacheLimitByTypePerUser'][$type] &&
+ !$usr['admin']) {
continue;
}
- if ($type['id'] == $cache_type) {
- $types .= '';
+ if ($type == $cache_type) {
+ $types .= '';
} else {
- $types .= '';
+ $types .= '';
}
}
tpl_set_var('typeoptions', $types);
@@ -766,7 +773,7 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
// blockforbidden cache sizes
if ($size != $sel_size
- && !in_array($size, OcConfig::instance()->getGeocacheConfig('enabledSizes'))
+ && !in_array($size, OcConfig::getEnabledCacheSizesArray())
) {
continue;
}
diff --git a/editlog.php b/editlog.php
index 6809a423cf..e074455743 100644
--- a/editlog.php
+++ b/editlog.php
@@ -12,6 +12,8 @@
use src\Models\GeoCache\MobileCacheMove;
use src\Models\OcConfig\OcConfig;
use src\Utils\I18n\I18n;
+use src\Models\GeoCache\GeoCacheLogCommons;
+use src\Models\GeoCache\GeoCache;
+
//prepare the templates and include all neccessary
require_once(__DIR__.'/lib/common.inc.php');
@@ -44,7 +46,6 @@
if ($log_record) {
require(__DIR__.'/src/Views/editlog.inc.php');
- require_once(__DIR__.'/lib/caches.inc.php');
require(__DIR__.'/src/Views/rating.inc.php');
if ($log_record['node'] != OcConfig::getSiteNodeId()) {
@@ -432,51 +433,93 @@
//build logtypeoptions
$logtypeoptions = '';
- foreach (get_log_types_from_database() AS $type) {
- // skip if permission=O ???? and not owner or COG
- if ($type['permission'] == 'B' && $log_record['user_id'] != $cache_user_id && !($usr['admin']))
+ foreach (GeoCacheLogCommons::logTypesArray() as $type) {
+
+ // skip types allowed only for cacheOwner (9,10,11)
+ $allowedOnlyForOwner = [GeoCacheLogCommons::LOGTYPE_READYTOSEARCH,
+ GeoCacheLogCommons::LOGTYPE_ARCHIVED,
+ GeoCacheLogCommons::LOGTYPE_TEMPORARYUNAVAILABLE];
+ if (in_array($type,$allowedOnlyForOwner) &&
+ $log_record['user_id'] != $cache_user_id && !($usr['admin'])) {
continue;
+ }
+
// Only COG can write or edit COG comment
- if ($type['id'] == 12 && !($usr['admin'])) {
+ if ($type == GeoCacheLogCommons::LOGTYPE_ADMINNOTE && !($usr['admin'])) {
continue;
}
- if ($log_record['logtype'] != $type['id'] && $log_record['cachestatus'] != 1)
- continue;
- if ($log_record['logtype'] != $type['id'] && $log_record['cachestatus'] == 1 && $log_record['user_id'] == $cache_user_id && $type['id'] != 3 && $type['id'] != 6)
+
+ // skip current type of log
+ if ($log_record['logtype'] != $type && $log_record['cachestatus'] != GeoCacheCommons::STATUS_READY) {
continue;
+ }
+
+ if ($log_record['logtype'] != $type && // not same as current type
+ $log_record['cachestatus'] == GeoCacheCommons::STATUS_READY && // not ready-to-search
+ $log_record['user_id'] == $cache_user_id && // is owner
+ $type != GeoCacheLogCommons::LOGTYPE_COMMENT &&
+ $type != GeoCacheLogCommons::LOGTYPE_MADEMAINTENANCE) {
+
+ continue;
+ }
+
if ($already_found_in_other_comment) {
- if ($type['id'] == 1 || $type['id'] == 2 || $type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11) {
+ if ($type == GeoCacheLogCommons::LOGTYPE_FOUNDIT ||
+ $type == GeoCacheLogCommons::LOGTYPE_DIDNOTFIND ||
+ $type == GeoCacheLogCommons::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLogCommons::LOGTYPE_TEMPORARYUNAVAILABLE) {
continue;
}
}
- if ($cache_type == 6 || $cache_type == 8) {
- // 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;
- }
+
+ if ($cache_type == GeoCache::TYPE_EVENT) {
+ if ($type == GeoCacheLogCommons::LOGTYPE_FOUNDIT ||
+ $type == GeoCacheLogCommons::LOGTYPE_DIDNOTFIND ||
+ $type == GeoCacheLogCommons::LOGTYPE_MOVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_NEEDMAINTENANCE ||
+ $type == GeoCacheLogCommons::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLogCommons::LOGTYPE_TEMPORARYUNAVAILABLE) {
+ continue;
}
- // Mobile cache
- if ($cache_type == 8) {
- if ($type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9) {
- continue;
- }
+ } else if ($cache_type == GeoCache::TYPE_MOVING) {
+ if ($type == GeoCacheLogCommons::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_ARCHIVED) {
+ continue;
}
} else {
- if ($log_record['user_id'] == $cache_user_id && ($type['id'] == 1 || $type['id'] == 2 || $type['id'] == 4 || $type['id'] == 5 || $type['id'] == 7 || $type['id'] == 8)) {
+
+ if ($log_record['user_id'] == $cache_user_id && // is owner
+ ($type == GeoCacheLogCommons::LOGTYPE_FOUNDIT ||
+ $type == GeoCacheLogCommons::LOGTYPE_DIDNOTFIND ||
+ $type == GeoCacheLogCommons::LOGTYPE_MOVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_NEEDMAINTENANCE ||
+ $type == GeoCacheLogCommons::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_WILLATTENDED)) {
continue;
}
- if ($log_record['user_id'] != $cache_user_id && ($type['id'] == 4 || $type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11)) {
+
+ if ($log_record['user_id'] != $cache_user_id &&
+ ($type == GeoCacheLogCommons::LOGTYPE_MOVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLogCommons::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLogCommons::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLogCommons::LOGTYPE_TEMPORARYUNAVAILABLE)) {
continue;
}
}
- $lang_db = I18n::getLangForDbTranslations('log_types');
-
- if ($type['id'] == $log_type) {
- $logtypeoptions .= '' . "\n";
+ if ($type == $log_type) {
+ $logtypeoptions .= '' . "\n";
} else {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
}
diff --git a/editwp.php b/editwp.php
index 33dee72250..cf62025057 100644
--- a/editwp.php
+++ b/editwp.php
@@ -2,6 +2,7 @@
use src\Utils\Database\XDb;
use src\Utils\I18n\I18n;
+use src\Models\GeoCache\WaypointCommons;
//prepare the templates and include all neccessary
require_once(__DIR__.'/lib/common.inc.php');
@@ -67,18 +68,19 @@
$tplname = 'editwp';
- require_once(__DIR__.'/lib/caches.inc.php');
require(__DIR__.'/src/Views/newcache.inc.php');
$wp_type = isset($_POST['type']) ? $_POST['type'] : $wp_record['type'];
//build typeoptions
$types = '';
+ $types .= '';
} else {
- $types .= '';
+ $types .= '';
}
}
tpl_set_var('typeoptions', $types);
diff --git a/getLogEntries.php b/getLogEntries.php
index 07a12dbcdd..9995f20059 100644
--- a/getLogEntries.php
+++ b/getLogEntries.php
@@ -10,6 +10,7 @@
use src\Models\GeoCache\GeoCache;
use src\Models\OcConfig\OcConfig;
use src\Models\Coordinates\Coordinates;
+use src\Utils\DateTime\Year;
require_once (__DIR__.'/lib/common.inc.php');
require(__DIR__.'/src/Views/lib/icons.inc.php');
@@ -164,8 +165,8 @@
$dateTimeTmpArray = explode(' ', $record['date']);
$tmplog = mb_ereg_replace('{time}', substr($dateTimeTmpArray[1], 0, -3), $tmplog);
- // display user activity (by Łza 2012)
- if ((date('m') == 4) and ( date('d') == 1)) {
+ // display user activity
+ if (Year::isPrimaAprilisToday() && OcConfig::isPAUserStatsRandEnabled()) {
$tmplog_username_aktywnosc = ' (
' . rand(1, 9) . ') ';
} else {
$tmplog_username_aktywnosc = ' (
' . ($record['ukryte'] + $record['znalezione'] + $record['nieznalezione']) . ') ';
diff --git a/images/oc_logo_1A.png b/images/oc_logo_1A.png
deleted file mode 100644
index 7b8e1e13cf..0000000000
Binary files a/images/oc_logo_1A.png and /dev/null differ
diff --git a/lib/ClassPathDictionary.php b/lib/ClassPathDictionary.php
index c6b8f52a33..052e09096c 100644
--- a/lib/ClassPathDictionary.php
+++ b/lib/ClassPathDictionary.php
@@ -42,7 +42,6 @@ class ClassPathDictionary
* !!! please preserve alphabetical order. !!!
*/
private static $classDictionary = array(
- 'cache' => 'lib/cache.php',
'myninc' => 'lib/myn.inc.php',
'powerTrailBase' => 'powerTrail/powerTrailBase.php',
'powerTrailController' => 'powerTrail/powerTrailController.php',
diff --git a/lib/cache.php b/lib/cache.php
deleted file mode 100644
index ef469891dd..0000000000
--- a/lib/cache.php
+++ /dev/null
@@ -1,192 +0,0 @@
- array(
- 'description' => 'Ready for search',
- 'translation' => 'cacheStatus_1',
- ),
- self::STATUS_UNAVAILABLE => array(
- 'description' => 'Temporarily unavailable',
- 'translation' => 'cacheStatus_2',
- ),
- self::STATUS_ARCHIVED => array(
- 'description' => 'Archived',
- 'translation' => 'cacheStatus_3',
- ),
- self::STATUS_WAITAPPROVERS => array(
- 'description' => 'Hidden by approvers to check',
- 'translation' => 'cacheStatus_4',
- ),
- self::STATUS_NOTYETAVAILABLE => array(
- 'description' => 'Not yet available',
- 'translation' => 'cacheStatus_5',
- ),
- self::STATUS_BLOCKED => array(
- 'description' => 'Blocked by COG',
- 'translation' => 'cacheStatus_6',
- ),
- );
- private static $type = array(
- self::TYPE_OTHERTYPE => array(
- 'name' => 'other',
- 'icon' => 'unknown.png',
- 'translation' => 'cacheType_5'
- ),
- self::TYPE_TRADITIONAL => array(
- 'name' => 'traditional',
- 'icon' => 'traditional.png',
- 'translation' => 'cacheType_1'
- ),
- self::TYPE_MULTICACHE => array(
- 'name' => 'multicache',
- 'icon' => 'multi.png',
- 'translation' => 'cacheType_2',
- ),
- self::TYPE_VIRTUAL => array(
- 'name' => 'virtual',
- 'icon' => 'virtual.png',
- 'translation' => 'cacheType_8'
- ),
- self::TYPE_WEBCAM => array(
- 'name' => 'webcam',
- 'icon' => 'webcam.png',
- 'translation' => 'cacheType_7'
- ),
- self::TYPE_EVENT => array(
- 'name' => 'event',
- 'icon' => 'event.png',
- 'translation' => 'cacheType_6'
- ),
- self::TYPE_QUIZ => array(
- 'name' => 'quiz',
- 'icon' => 'quiz.png',
- 'translation' => 'cacheType_3'
- ),
- 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',
- ),
- );
- private static $iconPath = 'images/cache/';
- private static $iconSmallStr = '16x16-';
- private static $iconFoundStr = '-found';
- private static $iconArchivedStr = '-a';
- private static $iconTmpUnavStr = '-n';
-
- private function __construct()
- {
- $this->cacheTypeIcons = self::getCacheIconsSet();
- }
-
- public static function instance()
- {
- static $inst = null;
- if ($inst === null) {
- $inst = new cache();
- }
- return $inst;
- }
-
- /**
- * prepare array contain set of icons for diffrent cachetypes
- */
- public static function getCacheIconsSet()
- {
- $cacheTypeIcons = self::$type;
- foreach ($cacheTypeIcons as $cacheTypeId => $cacheType) {
- $cacheTypeIcons[$cacheTypeId]['iconSet'] = array(
- 1 => array(//active, published
- 'iconFound' => self::$iconPath . self::getFoundCacheIcon($cacheType['icon']),
- 'iconSmall' => self::$iconPath . self::$iconSmallStr . $cacheType['icon'],
- 'iconSmallFound' => self::$iconPath . self::getFoundCacheIcon(self::$iconSmallStr . $cacheType['icon']),
- 'iconSmallOwner' => self::$iconPath . self::getOwnerCacheIcon(self::$iconSmallStr . $cacheType['icon']),
- ),
- 2 => array(//tempUnavailable
- 'iconFound' => self::$iconPath . self::getFoundCacheIcon($cacheType['icon'], self::$iconTmpUnavStr),
- 'iconSmall' => self::$iconPath . self::$iconSmallStr . $cacheType['icon'],
- 'iconSmallFound' => self::$iconPath . self::getFoundCacheIcon(self::$iconSmallStr . $cacheType['icon'], self::$iconTmpUnavStr),
- 'iconSmallOwner' => self::$iconPath . self::getOwnerCacheIcon(self::$iconSmallStr . $cacheType['icon'], self::$iconTmpUnavStr),
- ),
- 3 => array(// archived
- 'iconFound' => self::$iconPath . self::getFoundCacheIcon($cacheType['icon'], self::$iconArchivedStr),
- 'iconSmall' => self::$iconPath . self::$iconSmallStr . $cacheType['icon'],
- 'iconSmallFound' => self::$iconPath . self::getFoundCacheIcon(self::$iconSmallStr . $cacheType['icon'], self::$iconArchivedStr),
- 'iconSmallOwner' => self::$iconPath . self::getOwnerCacheIcon(self::$iconSmallStr . $cacheType['icon'], self::$iconArchivedStr),
- ),
- );
- }
- return $cacheTypeIcons;
- }
-
- private static function getFoundCacheIcon($cacheIcon, $statusStr = '')
- {
- $tmp = explode('.', $cacheIcon);
- $tmp[0] = $tmp[0] . $statusStr . '-found';
- return implode('.', $tmp);
- }
-
- private static function getOwnerCacheIcon($cacheIcon, $statusStr = '')
- {
- $tmp = explode('.', $cacheIcon);
- $tmp[0] = $tmp[0] . $statusStr . '-s-owner';
- return implode('.', $tmp);
- }
-
- public function getCacheTypeIcons()
- {
- return $this->cacheTypeIcons;
- }
-
-
-
- public function getCacheTypes()
- {
- return self::$type;
- }
-
- public function getCacheStatuses()
- {
- return $this->status;
- }
-
-}
diff --git a/lib/caches.inc.php b/lib/caches.inc.php
deleted file mode 100644
index 339fbaf7e9..0000000000
--- a/lib/caches.inc.php
+++ /dev/null
@@ -1,54 +0,0 @@
- 'New coordinates',
'viewlog_aktywnosc' => 'Total user activity (total of caches found, not found and hidden)',
'viewlog_kordy' => 'Cache coordinates after moving',
- 'log_type_temp_unavailable' => 'Temporarily unavailable',
- 'log_type_available' => 'Ready to find',
'log_mobile_init' => 'Starting coordinates',
'error_coords_not_ok' => 'Wrong coordinates!',
'error_nofulltext' => 'Invalid entry. Change the name to search.',
@@ -1021,11 +1019,7 @@
'lxg01' => 'Wrong date. Please enter correct date: DD-MM-YYYY',
'lxg02' => 'Rate cache, or select you do not want rate this cache.',
'lxg05' => 'Send log entry',
- 'lxg08' => 'Write a note',
- 'lxg09' => 'Moved',
- 'lxg10' => 'Needs maintenance',
'lxg11' => 'OC Team Comment',
- 'made_service' => 'Maintenance performed',
'remove_desc_01' => 'Should the description in',
'remove_desc_02' => 'from the cache',
'remove_desc_03' => 'be removed?',
diff --git a/lib/myn.inc.php b/lib/myn.inc.php
index 434bd69c54..68a3585dfe 100644
--- a/lib/myn.inc.php
+++ b/lib/myn.inc.php
@@ -1,6 +1,13 @@
paramQuery($q, $params);
- $rec = $db->dbResultFetch($s);
- if (isset($rec['user_id'])) {
- return true;
- } else {
- return false;
- }
- }
-
+/**
+ * @deprecated
+ *
+ * Don't use this - myn class should be removed soon
+ */
public static function checkCacheStatusByUser($record, $userId)
{
- $cacheTypesIcons = cache::getCacheIconsSet();
- if (isset($record['user_id']) && $record['user_id'] == $userId) {
- return $cacheTypesIcons[$record['cache_type']]['iconSet'][1]['iconSmallOwner'];
- } elseif (isset($record['cache_id']) && self::is_cache_found($record['cache_id'], $userId)) {
- return $cacheTypesIcons[$record['cache_type']]['iconSet'][1]['iconSmallFound'];
+ if (isset($record['user_id']) && $record['user_id'] == $userId) { //for owner
+ return GeoCacheCommons::CacheIconByType(
+ $record['cache_type'], GeoCacheCommons::STATUS_READY, null, false, true);
+
+ } else if (isset($record['cache_id']) && self::is_cache_found($record['cache_id'], $userId)){
+ return GeoCacheCommons::CacheIconByType(
+ $record['cache_type'], GeoCacheCommons::STATUS_READY, GeoCacheLog::LOGTYPE_FOUNDIT, false, false);
+
} else {
- return $cacheTypesIcons[$record['cache_type']]['iconSet'][1]['iconSmall'];
+
+ return GeoCacheCommons::CacheIconByType($record['cache_type'], GeoCacheCommons::STATUS_READY);
}
}
}
diff --git a/lib/search.html.inc.php b/lib/search.html.inc.php
index 48b2560c2b..5c80f7d536 100644
--- a/lib/search.html.inc.php
+++ b/lib/search.html.inc.php
@@ -7,6 +7,7 @@
use src\Utils\Uri\OcCookie;
use src\Models\Coordinates\Coordinates;
use src\Utils\I18n\I18n;
+use src\Models\GeoCache\GeoCacheCommons;
/**
* This script is used (can be loaded) by /search.php
@@ -405,7 +406,7 @@ function fHideColumn($nr, $set)
}
}
;
- $tmpline = str_replace('{cachetype}', htmlspecialchars(cache_type_from_id($caches_record['cache_type']), ENT_COMPAT, 'UTF-8'), $tmpline);
+ $tmpline = str_replace('{cachetype}', tr(GeoCacheCommons::CacheTypeTranslationKey($caches_record['cache_type'])), $tmpline);
// sp2ong short_desc ermitteln TODO: nicht die erste sondern die richtige wählen
$tmpline = str_replace('{wp_oc}', htmlspecialchars($caches_record['wp_oc'], ENT_COMPAT, 'UTF-8'), $tmpline);
diff --git a/lib/search.txt.inc.php b/lib/search.txt.inc.php
index 452fa64758..6317200db0 100644
--- a/lib/search.txt.inc.php
+++ b/lib/search.txt.inc.php
@@ -18,11 +18,6 @@
require_once (__DIR__.'/../lib/calculation.inc.php');
-
-$cache = cache::instance();
-$cacheTypesArr = $cache->getCacheTypeIcons();
-$cacheStatusArr = $cache->getCacheStatuses();
-
$txtLine = chr(239) . chr(187) . chr(191) .tr('search_text_01')." {mod_suffix}{cachename} ".tr('search_text_02')." {owner}
".tr('search_text_03')." {lat} {lon}
".tr('search_text_04')." {status}
@@ -253,9 +248,9 @@
} else {
$thisline = str_replace('{rr_comment}', html2txt("
--------
".$r['rr_comment']), $thisline);
}
- $thisline = str_replace('{type}', tr($cacheTypesArr[$r['type_id']]['translation']), $thisline);
+ $thisline = str_replace('{type}', tr(GeoCacheCommons::CacheTypeTranslationKey($r['type_id']), $thisline);
$thisline = str_replace('{container}', tr(GeoCacheCommons::CacheSizeTranslationKey($r['size'])), $thisline);
- $thisline = str_replace('{status}', tr($cacheStatusArr[$r['status']]['translation']), $thisline);
+ $thisline = str_replace('{status}', tr(GeoCacheCommons::CacheStatusTranslationKey($r['status'])), $thisline);
$difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
$thisline = str_replace('{difficulty}', $difficulty, $thisline);
diff --git a/lib/settingsDefault.inc.php b/lib/settingsDefault.inc.php
index 6d0c9e8f37..865d8e4273 100644
--- a/lib/settingsDefault.inc.php
+++ b/lib/settingsDefault.inc.php
@@ -5,7 +5,7 @@
* settings.inc.php file (e.g. $config['debugDB'] = true;).
*/
-require_once (__DIR__.'/cache.php');
+use src\Models\GeoCache\GeoCacheCommons;
// enable detailed cache access logging
$enable_cache_access_logs = false;
@@ -40,8 +40,6 @@
'headerLogo' => 'oc_logo.png',
/** main logo; winter version, displayed during december and january. */
'headerLogoWinter' => 'oc_logo_winter.png',
- /** main logo; prima aprilis version (april fools), displayed only on april 1st. */
- 'headerLogo1stApril' => 'oc_logo_1A.png',
/** qrcode logo: show qrcode image and link the prefered way. */
'qrCodeLogo' => 'qrcode_bg.jpg',
'qrCodeUrl' => 'https://opencaching.pl/viewcache.php?wp=OP3C90',
@@ -65,24 +63,14 @@
* another site.
*/
'otherSites_minfinds' => 100,
- /**
- * not allowed cache types (user cannot create caches of this types).
- *
- * Cachetypes must be lib/cache.php constant TYPE_*
- */
- 'forbidenCacheTypes' => array(
- cache::TYPE_VIRTUAL,
- cache::TYPE_WEBCAM,
- cache::TYPE_GEOPATHFINAL
- ),
/**
* cache limits for user. If user is allowed to place limited nomber of specified cache type,
* place cachetype and limit here.
*
- * Cachetypes must be lib/cache.php constant TYPE_*
+ * Cachetypes must be GeoCacheCommons constant TYPE_*
*/
'cacheLimitByTypePerUser' => array(
- cache::TYPE_OWNCACHE => 1,
+ GeoCacheCommons::TYPE_OWNCACHE => 1,
),
/** The filter fragment selecting provinces from nuts_codes table. */
'provinceNutsCondition' => '`code` like \'PL__\'',
diff --git a/log.php b/log.php
index 93404de943..4f720a0c44 100644
--- a/log.php
+++ b/log.php
@@ -37,7 +37,6 @@
$view->loadJquery();
-require_once(__DIR__.'/lib/caches.inc.php');
require(__DIR__.'/src/Views/rating.inc.php');
if(!isset($_REQUEST['cacheid'])){
@@ -661,7 +660,7 @@
tpl_set_var('display', "none");
}
- foreach (get_log_types_from_database() AS $type) {
+ foreach (GeoCacheLogCommons::logTypesArray() AS $type) {
// do not allow 'finding' or 'not finding' own or archived cache
// (events can be logged) $geoCache->getStatus() == 2 || $geoCache->getStatus() == 3
@@ -674,37 +673,44 @@
//3 = Write a note;
if ($user->hasOcTeamRole() && $geoCache->getStatus() == GeoCache::STATUS_WAITAPPROVERS){
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
} else {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
//4 = Moved
if ($geoCache->getCacheType() == GeoCache::TYPE_MOVING ||
$geoCache->getCacheType() == GeoCache::TYPE_OWNCACHE ) {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
//5 = Needs maintenace
if ($user->getUserId() != $geoCache->getOwnerId()) {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
- $logtypeoptions .= '' . "\n";
+
+ $logtypeoptions .= '' . "\n";
//12 = OC Team Comment
if ($user->hasOcTeamRole()) {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
// service log by Łza
// if curently logged user is a cache owner and cache status is "avilable"
// then add log type option "temp. unavailable";
//11 = Temporarily unavailable
- if ($user->getUserId() == $geoCache->getOwnerId() &&
- $geoCache->getStatus() == GeoCache::STATUS_READY) {
+ if ($user->getUserId() == $geoCache->getOwnerId() && $geoCache->getStatus() == GeoCache::STATUS_READY) {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
// if curently logged user is a cache owner and cache status is "temp. unavailable"
@@ -713,28 +719,18 @@
if ( $user->getUserId() == $geoCache->getOwnerId() &&
$geoCache->getStatus() == GeoCache::STATUS_UNAVAILABLE ) {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
break;
}
-
-
- // skip if permission=O and not owner
- if ($type['permission'] == 'O' &&
- $user->getUserId() != $geoCache->getOwnerId() &&
- $type['permission']){
-
- continue;
- }
-
-
// if virtual, webcam = archived -> allow only comment log type
if (($geoCache->getCacheType() == GeoCache::TYPE_VIRTUAL ||
$geoCache->getCacheType() == GeoCache::TYPE_WEBCAM )
&& $geoCache->getStatus() == GeoCache::STATUS_ARCHIVED) {
- if ($type['id'] != 3) {
+ if ($type != GeoCacheLog::LOGTYPE_COMMENT) {
continue;
}
}
@@ -746,7 +742,7 @@
//so zero time here to allow logging WILLATTENDED or ATTENDED in the day of event
// if user logged event as willattended before or event it's over, do not display logtype 'attended'
- if ($type['id'] == GeoCacheLog::LOGTYPE_WILLATTENDED) {
+ if ($type == GeoCacheLog::LOGTYPE_WILLATTENDED) {
if ($geoCache->hasUserLogByType($user, GeoCacheLog::LOGTYPE_WILLATTENDED) ||
$now > $geoCache->getDatePlaced()) {
continue;
@@ -754,60 +750,86 @@
}
// if user logged event as attended before or event has not happened yet,
//do not display logtype 'attended'
- if ($type['id'] == GeoCacheLog::LOGTYPE_ATTENDED) {
+ if ($type == GeoCacheLog::LOGTYPE_ATTENDED) {
if ($geoCache->hasUserLogByType($user, GeoCacheLog::LOGTYPE_ATTENDED) ||
$now < $geoCache->getDatePlaced()) {
continue;
}
}
if ($user->hasOcTeamRole()) {
- if ($type['id'] == 1 || $type['id'] == 2 || $type['id'] == 4 ||
- $type['id'] == 5 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11) {
+ if ($type == GeoCacheLog::LOGTYPE_FOUNDIT ||
+ $type == GeoCacheLog::LOGTYPE_DIDNOTFIND ||
+ $type == GeoCacheLog::LOGTYPE_MOVED ||
+ $type == GeoCacheLog::LOGTYPE_NEEDMAINTENANCE ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE) {
continue;
}
} else {
- if ($type['id'] == 1 || $type['id'] == 2 || $type['id'] == 4 ||
- $type['id'] == 5 || $type['id'] == 9 || $type['id'] == 10 ||
- $type['id'] == 11 || $type['id'] == 12) {
+ if ($type == GeoCacheLog::LOGTYPE_FOUNDIT ||
+ $type == GeoCacheLog::LOGTYPE_DIDNOTFIND ||
+ $type == GeoCacheLog::LOGTYPE_MOVED ||
+ $type == GeoCacheLog::LOGTYPE_NEEDMAINTENANCE ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE ||
+ $type == GeoCacheLog::LOGTYPE_ADMINNOTE) {
continue;
}
}
- } else {
+ } else { // NOT-EVENT
if ($geoCache->getCacheType() == GeoCache::TYPE_MOVING) {
if ($user->hasOcTeamRole()) {
// skip will attend/attended if the cache no event
- if ($type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11) {
+ if ($type == GeoCacheLog::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE) {
continue;
}
} else {
- if ($type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11 || $type['id'] == 12) {
+ if ($type == GeoCacheLog::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE ||
+ $type == GeoCacheLog::LOGTYPE_ADMINNOTE) {
continue;
}
}
} else {
// skip will attend/attended/Moved if the cache no event and Mobile
if ($user->hasOcTeamRole()) {
- if ($type['id'] == 4 || $type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11) {
+ if ($type == GeoCacheLog::LOGTYPE_MOVED ||
+ $type == GeoCacheLog::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE) {
continue;
}
} else {
- if ($type['id'] == 4 || $type['id'] == 7 || $type['id'] == 8 || $type['id'] == 9 || $type['id'] == 10 || $type['id'] == 11 || $type['id'] == 12) {
+ if ($type == GeoCacheLog::LOGTYPE_MOVED ||
+ $type == GeoCacheLog::LOGTYPE_ATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_WILLATTENDED ||
+ $type == GeoCacheLog::LOGTYPE_ARCHIVED ||
+ $type == GeoCacheLog::LOGTYPE_READYTOSEARCH ||
+ $type == GeoCacheLog::LOGTYPE_TEMPORARYUNAVAILABLE ||
+ $type == GeoCacheLog::LOGTYPE_ADMINNOTE) {
continue;
}
}
}
}
- if (isset($type[I18n::getCurrentLang()])){
- $lang_db = I18n::getCurrentLang();
- } else {
- $lang_db = "en";
- }
-
- if ($type['id'] == $log_type) {
- $logtypeoptions .= '' . "\n";
+ if ($type == $log_type) {
+ $logtypeoptions .= '' . "\n";
} else {
- $logtypeoptions .= '' . "\n";
+ $logtypeoptions .= '' . "\n";
}
}
diff --git a/log_cache_multi.php b/log_cache_multi.php
index 7b01b7af8c..8bb7489076 100644
--- a/log_cache_multi.php
+++ b/log_cache_multi.php
@@ -97,7 +97,6 @@
if ($usr == false || (!isset($_FILES['userfile']) && !isset($_SESSION['log_cache_multi_data']))) {
tpl_redirect('log_cache_multi_send.php');
} else {
- require_once(__DIR__.'/lib/caches.inc.php');
$tplname = 'log_cache_multi';
$myHtml = "";
diff --git a/log_cache_multi_panel.php b/log_cache_multi_panel.php
index 8133c97c49..e9845e16c5 100644
--- a/log_cache_multi_panel.php
+++ b/log_cache_multi_panel.php
@@ -1,5 +1,7 @@