Skip to content

Commit

Permalink
fix(array['key']): remove some warnings if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
J9rem committed Feb 8, 2022
1 parent bc7047f commit d583666
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tools/bazar/services/FormManager.php
Expand Up @@ -98,7 +98,7 @@ public function create($data)
throw new \Exception(_t('WIKI_IN_HIBERNATION'));
}
// If ID is not set or if it is already used, find a new ID
if (!$data['bn_id_nature'] || $this->getOne($data['bn_id_nature'])) {
if (empty($data['bn_id_nature']) || $this->getOne($data['bn_id_nature'])) {
$data['bn_id_nature'] = $this->findNewId();
}

Expand Down
26 changes: 15 additions & 11 deletions tools/templates/actions/nav.php
Expand Up @@ -53,18 +53,22 @@
$listlinks = '';
foreach ($titles as $key => $title) {
$haveAccess = true;
$linkParts = $this->extractLinkParts($links[$key]);
[$url, $method, $params] = ['', '', ''];
if ($linkParts) {
$this->services->get(LinkTracker::class)->forceAddIfNotIncluded($linkParts['tag']);
$method = $linkParts['method'];
$params = $linkParts['params'];
$url = $this->href($method, $linkParts['tag'], $params);
if ($hideIfNoAccess == "true" && isset($linkParts['tag']) && !$GLOBALS['wiki']->HasAccess('read', $linkParts['tag'])) {
$haveAccess = false;
}
if (empty($links[$key])) {
$url = "";
} else {
$url = $links[$key];
$linkParts = $this->extractLinkParts($links[$key]);
[$url, $method, $params] = ['', '', ''];
if ($linkParts) {
$this->services->get(LinkTracker::class)->forceAddIfNotIncluded($linkParts['tag']);
$method = $linkParts['method'];
$params = $linkParts['params'];
$url = $this->href($method, $linkParts['tag'], $params);
if ($hideIfNoAccess == "true" && isset($linkParts['tag']) && !$GLOBALS['wiki']->HasAccess('read', $linkParts['tag'])) {
$haveAccess = false;
}
} else {
$url = $links[$key];
}
}
// class="active" if the url have the same url than the current one (independently of the method and the params)
if ($haveAccess) {
Expand Down
2 changes: 1 addition & 1 deletion tools/templates/libs/setwikidefaulttheme.functions.php
Expand Up @@ -94,7 +94,7 @@ function checkParamActionSetTemplate($post, $availableThemes)
$params['squelette'] = $post['wdtSquelette'];

// Vérifie la validité du preset.
$params['preset'] = $post['preset'] ;
$params['preset'] = $post['preset'] ?? null ;
if (!empty($params['preset']) && substr($params['preset'], -4) != '.css') {
return false;
}
Expand Down
Expand Up @@ -60,12 +60,14 @@
<label class="control-label col-lg-4"><?php print(_t('TEMPLATE_PRESETS')); ?></label>
<div class="controls col-lg-4">
<select id='presetSelect' name='preset' class="form-control">
<?php foreach ($themes[$defTheme]['presets'] as $presetKey => $preset) : ?>
<option
value="<?php echo $presetKey; ?>"
<?php echo ($presetKey === $selectedPresetName) ? 'selected': ''; ?>
><?php echo str_replace('.css', '', $presetKey); ?></option>
<?php endforeach; ?>
<?php if (isset($themes[$defTheme]['presets'])): ?>
<?php foreach ($themes[$defTheme]['presets'] as $presetKey => $preset) : ?>
<option
value="<?php echo $presetKey; ?>"
<?php echo ($presetKey === $selectedPresetName) ? 'selected': ''; ?>
><?php echo str_replace('.css', '', $presetKey); ?></option>
<?php endforeach; ?>
<?php endif; ?>
<?php foreach ($customCSSPresets as $presetKey => $preset) : ?>
<option
value="<?php echo YesWiki\Core\Service\ThemeManager::CUSTOM_CSS_PRESETS_PREFIX . $presetKey; ?>"
Expand Down

0 comments on commit d583666

Please sign in to comment.