Skip to content

Next few changes - see commit messages #2109

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

Merged
merged 8 commits into from
Feb 17, 2020
Merged
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
5 changes: 2 additions & 3 deletions badge_positions_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -33,7 +34,6 @@
$content = "";

$positionsMeritBadge = $meritBadgeCtrl->buildArrayGainedPositions($userid, $badge_id);
$cacheTypesIcons = cache::getCacheIconsSet();

foreach( $positionsMeritBadge as $onePositionBadge ){

Expand All @@ -55,8 +55,7 @@

$typeIcon ='<img src="{src}" />';
$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()));
Expand Down
1 change: 0 additions & 1 deletion cacheratings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion config/geocache.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [
Expand All @@ -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'] = [];

1 change: 1 addition & 0 deletions config/geocache.nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

$geocache['enabledSizes'][] = GeoCacheCommons::SIZE_NANO;

13 changes: 13 additions & 0 deletions config/geocache.pl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use src\Models\GeoCache\GeoCacheCommons;

/**
* Configuration of geocache properties for OCPL
*/

/**
* 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'][] = GeoCacheCommons::TYPE_MOVING;
10 changes: 9 additions & 1 deletion config/geocache.ro.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
use src\Models\GeoCache\GeoCacheCommons;

/**
* Configuration of geocache properties for OC RO
* Configuration of geocache properties for OC RO
*/

$geocache['enabledSizes'][] = GeoCacheCommons::SIZE_NANO;
$geocache['enabledSizes'][] = GeoCacheCommons::SIZE_OTHER;



/**
* 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'][] = GeoCacheCommons::TYPE_GEOPATHFINAL;
13 changes: 13 additions & 0 deletions config/geocache.uk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use src\Models\GeoCache\GeoCacheCommons;

/**
* Configuration of geocache properties for OCUK
*/

/**
* 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'][] = GeoCacheCommons::TYPE_GEOPATHFINAL;
28 changes: 28 additions & 0 deletions config/primaAprilis.default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* DEFAULT general site properties for ALL nodes
*/

$config = [];

/**
* Completly disable all prima-aprilis activities
*/
$config['disableAllPrimaAprilisChanges'] = false;

/**
* Enable "dance" of start page elements
*/
$config['danceEnabled'] = true;


/**
* Enable randomization of user stats
*/
$config['randUserStats'] = true;

/**
* Change username in user profile
*/
$config['fakeUserNameInProfile'] = true;
25 changes: 16 additions & 9 deletions editcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use src\Utils\Gis\Countries;
use src\Utils\Uri\SimpleRouter;
use src\Controllers\PictureController;
use src\Models\GeoCache\GeoCacheCommons;

require_once(__DIR__.'/lib/common.inc.php');

Expand Down Expand Up @@ -84,7 +85,6 @@ function build_drop_seq($item_row, $selected_seq, $max_drop, $thisid, $drop_type
if ($cache_record = $dbc->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';
Expand Down Expand Up @@ -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 .= '<option value="' . $type['id'] . '" selected="selected">' . htmlspecialchars($type[I18n::getCurrentLang()], ENT_COMPAT, 'UTF-8') . '</option>';
if ($type == $cache_type) {
$types .= '<option value="' . $type . '" selected="selected">' .
htmlspecialchars( tr(GeoCacheCommons::CacheTypeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>';
} else {
$types .= '<option value="' . $type['id'] . '">' . htmlspecialchars($type[I18n::getCurrentLang()], ENT_COMPAT, 'UTF-8') . '</option>';
$types .= '<option value="' . $type . '">' .
htmlspecialchars( tr( GeoCacheCommons::CacheTypeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>';
}
}
tpl_set_var('typeoptions', $types);
Expand All @@ -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;
}
Expand Down
97 changes: 70 additions & 27 deletions editlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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 .= '<option value="' . $type['id'] . '" selected="selected">' . htmlspecialchars($type[$lang_db], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
if ($type == $log_type) {
$logtypeoptions .= '<option value="' . $type . '" selected="selected">' .
htmlspecialchars(tr(GeoCacheLogCommons::typeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
} else {
$logtypeoptions .= '<option value="' . $type['id'] . '">' . htmlspecialchars($type[$lang_db], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
$logtypeoptions .= '<option value="' . $type . '">' .
htmlspecialchars(tr(GeoCacheLogCommons::typeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
}
}

Expand Down
10 changes: 6 additions & 4 deletions editwp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 = '<option disabled selected="selected">' . tr('choose_waypoint_type') . '</options>';
foreach (get_wp_types_from_database($cache_record['type']) as $type) {
foreach (WaypointCommons::getTypesArray($cache_record['type']) as $type) {

if ($type['id'] == $wp_type) {
$types .= '<option value="' . $type['id'] . '" selected="selected">' . htmlspecialchars($type[I18n::getCurrentLang()], ENT_COMPAT, 'UTF-8') . '</option>';
$types .= '<option value="' . $type . '" selected="selected">' .
htmlspecialchars(tr (WaypointCommons::typeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>';
} else {
$types .= '<option value="' . $type['id'] . '">' . htmlspecialchars($type[I18n::getCurrentLang()], ENT_COMPAT, 'UTF-8') . '</option>';
$types .= '<option value="' . $type . '">' .
htmlspecialchars(tr (WaypointCommons::typeTranslationKey($type)), ENT_COMPAT, 'UTF-8') . '</option>';
}
}
tpl_set_var('typeoptions', $types);
Expand Down
5 changes: 3 additions & 2 deletions getLogEntries.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 = ' (<img src="/images/blue/thunder_ico.png" alt="user activity" width="13" height="13" border="0" title="' . tr('viewlog_aktywnosc') . '"/>' . rand(1, 9) . ') ';
} else {
$tmplog_username_aktywnosc = ' (<img src="/images/blue/thunder_ico.png" alt="user activity" width="13" height="13" border="0" title="' . tr('viewlog_aktywnosc') . ' [' . $record['znalezione'] . '+' . $record['nieznalezione'] . '+' . $record['ukryte'] . ']"/>' . ($record['ukryte'] + $record['znalezione'] + $record['nieznalezione']) . ') ';
Expand Down
Binary file removed images/oc_logo_1A.png
Binary file not shown.
1 change: 0 additions & 1 deletion lib/ClassPathDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading