+version x.x.x - Darkmere ()
+
+ + Fixed bug #8 It is possible to add empty tags and categories.
+ Special chars check done on server side. JS has problems with unicode.
+
+
version 2.5.1 - Caves of Circe (2020-03-22)
+
+ Bugfix release
version 2.5 - Winnowing Hall (2020-03-21)
-2.5.1 - Caves of Circe
+2.5.x - Darkmere
let listBox = document.getElementById(targetStartString + '-listbox');
let newTagTemplate = document.getElementById(targetStartString + '-template');
- if(saveInput && listBox && elem && newTagTemplate) {
+ let checkString = _checkForSpaceString(elem.value,'nospace');
+
+ if(saveInput && listBox && elem && newTagTemplate && checkString) {
let toAdd = elem.value;
let newSaveValue = _appendToCommaString(saveInput.value,toAdd);
let aEl = el.querySelector('a');
aEl.setAttribute('onclick', "removeTag('"+newTagString+"','"+targetStartString+"');");
-
-
return el;
-}
\ No newline at end of file
+}
+
+/**
+ * simple check if the string is empty or contains whitespace chars
+ * @param stringTocheck
+ * @returns {boolean}
+ * @private
+ */
+function _checkForSpaceString(stringTocheck) {
+ let check = stringTocheck.replace(/\s/gm,'');
+ if(check === stringTocheck && check.length > 0) {
+ return true;
+ }
+ return false;
+}
# time settings
date_default_timezone_set('Europe/Berlin');
-define('DEBUG',false);
+define('DEBUG',true);
## check request
$_urlToParse = filter_var($_SERVER['QUERY_STRING'],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
*/
static function prepareTagOrCategoryStr($string) {
$ret = array();
+ $_ret = array();
$string = trim($string, ", ");
if(strstr($string, ",")) {
$_t = explode(",", $string);
- foreach($_t as $new) {
- $ret[$new] = $new;
+ foreach($_t as $n) {
+ $_ret[$n] = $n;
}
unset($_t);
- unset($new);
+ unset($n);
- foreach($ret as $e) {
+ foreach($_ret as $e) {
if(strstr($e, " ")) {
unset($ret[$e]);
$_t = explode(" ", $e);
foreach($_t as $new) {
$new = trim($new);
- if(!empty($new)) {
+ $_c = self::validate($new,'nospace');
+ if(!empty($new) && $_c === true) {
$ret[$new] = $new;
}
}
}
+ else {
+ $new = trim($e);
+ $_c = self::validate($new,'nospace');
+ if(!empty($new) && $_c === true) {
+ $ret[$new] = $new;
+ }
+ }
}
}
else {
$_t = explode(" ", $string);
foreach($_t as $new) {
$new = trim($new);
- if(!empty($new)) {
+ $_c = self::validate($new,'nospace');
+ if(!empty($new) && $_c === true) {
$ret[$new] = $new;
}
}
<input type="text" placeholder="tagname"
name="taglistinput" list="tag-datalist" value="" onkeypress="addTag(event,'tag')" />
</div>
- <p class="help">Enter a new one or select an existing from the suggested and press enter.</p>
+ <p class="help">Enter a new one or select an existing from the suggested and press enter. Special chars check after save!</p>
</div>
<datalist id="tag-datalist">
<?php foreach($existingTags as $t) { ?>
<input type="text" placeholder="categoryname"
name="categorylistinput" list="category-datalist" value="" onkeypress="addTag(event,'category')" />
</div>
- <p class="help">Enter a new one or select an existing from the suggested and press enter.</p>
+ <p class="help">Enter a new one or select an existing from the suggested and press enter. Special chars check after save!</p>
</div>
<datalist id="category-datalist">
<?php foreach($existingCategories as $c) { ?>