From ca073c1b56bb3d95b555cebd19633b9bdbecc70c Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 16 Oct 2019 15:08:08 +0900 Subject: [PATCH] Fix JS key in object check function instead of using "in" which could return true for other entries in the object use the proper hasOwnProperty call --- www/includes/admin_smarty.php | 2 +- www/layout/admin/javascript/edit.jq.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/www/includes/admin_smarty.php b/www/includes/admin_smarty.php index cc64eadd..26cd267a 100644 --- a/www/includes/admin_smarty.php +++ b/www/includes/admin_smarty.php @@ -78,7 +78,7 @@ $cms->DATA['ADMIN'] = $login->acl['admin']; // the template part to include into the body $cms->DATA['TEMPLATE_NAME'] = $TEMPLATE_NAME; $cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE; -$cms->DATA['TEMPLATE_TRANSLATE'] = $TEMPLATE_TRANSLATE; +$cms->DATA['TEMPLATE_TRANSLATE'] = isset($TEMPLATE_TRANSLATE) ? $TEMPLATE_TRANSLATE : null; $cms->DATA['PAGE_FILE_NAME'] = $PAGE_FILE_NAME; // LANG $cms->DATA['LANG'] = $lang; diff --git a/www/layout/admin/javascript/edit.jq.js b/www/layout/admin/javascript/edit.jq.js index ce359edc..b632be95 100644 --- a/www/layout/admin/javascript/edit.jq.js +++ b/www/layout/admin/javascript/edit.jq.js @@ -295,10 +295,12 @@ function isObject(val) { * @param {Object} object object to search key in * @return {Boolean} true/false if key exists in object */ -const keyInObject = (key, object) => (key in object) ? true : false; +// const keyInObject = (key, object) => (key in object) ? true : false; +const keyInObject = (key, object) => (Object.prototype.hasOwnProperty.call(object, key)) ? true : false; /*function keyInObject(key, object) { - return (key in object) ? true : false; + // return (key in object) ? true : false; + return (Object.prototype.hasOwnProperty.call(object, key)) ? true : false; }*/ /**