[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Warnings: Trying to access array offset, Undefined key at tiki-references.php
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68aadd4e36513_2cbd58f44672c6@gitlab-sidekiq-low-urgency-cpu-bound-v2-65dcf9c9f4-hg9h7.mail> |
ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
274ed533 by ushindi bienvenu at 2025-08-24T09:29:43+00:00
[FIX] Warnings: Trying to access array offset, Undefined key at tiki-references.php
---
* [FIX] Warnings: Trying to access array offset, Undefined key at tiki-references.php
See merge request tikiwiki/tiki!8388
- - - - -
2 changed files:
- templates/tiki-references.tpl
- tiki-references.php
Changes:
=====================================
templates/tiki-references.tpl
=====================================
@@ -1,7 +1,7 @@
{title help="References" admpage="wiki" url="tiki-references.php"}{tr}References{/tr}{/title}
<div class="t_navbar mb-4">
{if isset($referenceinfo.ref_id)}
- {button href="?add=1" class="btn btn-primary" _text="{tr}Add a new library reference{/tr}"}
+ {button href="?add=1#contenttabs_admin_references-2" class="btn btn-primary" _text="{tr}Add a new library reference{/tr}"}
{/if}
</div>
{tabset name='tabs_admin_references'}
@@ -134,67 +134,67 @@
<div class="tiki-form-group row" id="ref_biblio_code_block" {if empty($referenceinfo.biblio_code)}style="display: none;"{/if}>
<label class="col-sm-3 col-md-2 col-form-label" for="ref_biblio_code">{tr}Biblio Code{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_biblio_code' class="form-control" name='ref_biblio_code' value="{$referenceinfo.biblio_code|escape}">
+ <input type="text" id='ref_biblio_code' class="form-control" name='ref_biblio_code' value="{$referenceinfo.biblio_code|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_author">{tr}Author{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_author' class="form-control" name='ref_author' value="{$referenceinfo.author|escape}">
+ <input type="text" id='ref_author' class="form-control" name='ref_author' value="{$referenceinfo.author|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Title{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_title' class="form-control" name='ref_title' value="{$referenceinfo.title|escape}">
+ <input type="text" id='ref_title' class="form-control" name='ref_title' value="{$referenceinfo.title|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Year{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_year' class="form-control" name='ref_year' value="{$referenceinfo.year|escape}">
+ <input type="text" id='ref_year' class="form-control" name='ref_year' value="{$referenceinfo.year|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Part{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_part' class="form-control" name='ref_part' value="{$referenceinfo.part|escape}">
+ <input type="text" id='ref_part' class="form-control" name='ref_part' value="{$referenceinfo.part|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}URI{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_uri' class="form-control" name='ref_uri' value="{$referenceinfo.uri|escape}">
+ <input type="text" id='ref_uri' class="form-control" name='ref_uri' value="{$referenceinfo.uri|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Code{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_code' class="form-control" name='ref_code' value="{$referenceinfo.code|escape}">
+ <input type="text" id='ref_code' class="form-control" name='ref_code' value="{$referenceinfo.code|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Publisher{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_publisher' class="form-control" name='ref_publisher' value="{$referenceinfo.publisher|escape}">
+ <input type="text" id='ref_publisher' class="form-control" name='ref_publisher' value="{$referenceinfo.publisher|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Location{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_location' class="form-control" name='ref_location' value="{$referenceinfo.location|escape}">
+ <input type="text" id='ref_location' class="form-control" name='ref_location' value="{$referenceinfo.location|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Style{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_style' class="form-control" name='ref_style' value="{$referenceinfo.style|escape}">
+ <input type="text" id='ref_style' class="form-control" name='ref_style' value="{$referenceinfo.style|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
<label class="col-sm-3 col-md-2 col-form-label" for="ref_title">{tr}Template{/tr}</label>
<div class="col-sm-7 col-md-6">
- <input type="text" id='ref_template' class="form-control" name='ref_template' value="{$referenceinfo.template|escape}">
+ <input type="text" id='ref_template' class="form-control" name='ref_template' value="{$referenceinfo.template|default:''|escape}">
</div>
</div>
<div class="tiki-form-group row">
=====================================
tiki-references.php
=====================================
@@ -26,7 +26,7 @@ $inputConfiguration = [
'ref_year' => 'digits', //post
'ref_style' => 'word', //post
'ref_template' => 'digits', //post
- 'find' => 'alpha', //post
+ 'find' => 'string', //post
'maxRecords' => 'int', //post
'offset' => 'digits', //get
'addreference' => 'bool', //post
@@ -56,7 +56,7 @@ $msg = "";
$page_id = TikiLib::lib('tiki')->get_page_id_from_name($page);
$action = $getInput($_REQUEST, 'action');
$ref_id = $getInput($_REQUEST, 'referenceId');
-$ref_auto_biblio_code = empty($_REQUEST['ref_auto_biblio_code']) ? 'off' : $_REQUEST['ref_auto_biblio_code'];
+$ref_auto_biblio_code = empty($_REQUEST['ref_auto_biblio_code']) ? 'off' : 'on';
$ref_biblio_code = $getInput($_REQUEST, 'ref_biblio_code');
$ref_author = $getInput($_REQUEST, 'ref_author');
$ref_title = $getInput($_REQUEST, 'ref_title');
@@ -106,7 +106,7 @@ if (isset($_REQUEST['addreference'])) {
$record = array_shift($record['data']);
$record['success'] = true;
$record['id'] = $record['ref_id'];
- if ($_REQUEST['response'] == 'json') {
+ if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'json') {
echo json_encode($record);
return;
}
@@ -115,7 +115,7 @@ if (isset($_REQUEST['addreference'])) {
foreach ($errors as $error) {
$msg .= tra($error);
}
- if ($_REQUEST['response'] == 'json') {
+ if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'json') {
echo json_encode([
'success' => false,
'msg' => $msg
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/274ed533a6622bfb667c90ed9c1b55dea66375db
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/274ed533a6622bfb667c90ed9c1b55dea66375db
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs