Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.g..
Decoded Output download
<? function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}AUI.add("liferay-session",(e=>{const t=e.Lang,i=[],n=e.config,s=n.doc,r={active:"activated"},a={},o={src:a},g="sessionToast",l=themeDisplay.getPathMain()+"/portal/",c=e.Component.create({ATTRS:{autoExtend:{value:!1},redirectOnExpire:{value:!0},redirectUrl:{value:""},sessionLength:{getter:"_getLengthInMillis",value:0},sessionState:{value:"active"},sessionTimeoutOffset:{getter:"_getLengthInMillis",value:0},timestamp:{getter:"_getTimestamp",setter:"_setTimestamp",value:0},warningLength:{getter:"_getLengthInMillis",setter:"_setWarningLength",value:0},warningTime:{getter:"_getWarningTime",value:0}},EXTENDS:e.Base,NAME:"liferaysession",prototype:{_afterSessionStateChange(e){const t=e.details,i=e.newVal;let n=null;"src"in e&&t.length&&(n=t[0]),this.fire(r[i]||i,n)},_defActivatedFn(e){const t=this;t.set("timestamp"),e.src===a&&Liferay.Util.fetch(l+"extend_session").then((e=>{500===e.status&&t.expire()}))},_defExpiredFn(t){const i=this;e.clearInterval(i._intervalId),t.src===a&&i._expireSession()},_expireSession(){const t=this;Liferay.Util.fetch(l+"expire_session").then((i=>{i.ok?(Liferay.fire("sessionExpired"),t.get("redirectOnExpire")&&(location.href=t.get("redirectUrl"))):e.setTimeout((()=>{t._expireSession()}),1e3)}))},_getLengthInMillis:e=>1e3*e,_getTimestamp(){return Liferay.Util.Cookie.get(this._cookieKey,Liferay.Util.Cookie.TYPES.NECESSARY)||this._initTimestamp},_getWarningTime(){return this.get("sessionLength")-this.get("warningLength")},_initEvents(){const i=this;i.publish("activated",{defaultFn:e.bind("_defActivatedFn",i)}),i.publish("expired",{defaultFn:e.bind("_defExpiredFn",i)}),i.publish("warned"),i._eventHandlers=[i.on("sessionStateChange",i._onSessionStateChange),i.after("sessionStateChange",i._afterSessionStateChange),e.on("io:complete",((e,n,s)=>{(!s||s&&s.sessionExtend||!t.isBoolean(s.sessionExtend))&&i.resetInterval()})),Liferay.once("screenLoad",(()=>{i.destroy()}))]},_onSessionStateChange(e){const t=this,i=e.newVal,n=e.prevVal;"expired"===n&&n!==i?e.preventDefault():"active"===n&&n===i&&t._afterSessionStateChange(e)},_setTimestamp(e){const t=this;e=String(e||Date.now()),t._initTimestamp=e,navigator.cookieEnabled&&Liferay.Util.Cookie.set(t._cookieKey,e,Liferay.Util.Cookie.TYPES.NECESSARY,t._cookieOptions)},_setWarningLength(e){return Math.min(this.get("sessionLength"),e)},_startTimer(){const t=this,i=t.get("sessionLength"),n=t.get("sessionTimeoutOffset"),s=t.get("warningTime");t._intervalId=e.setInterval((()=>{const e=t.get("sessionState"),r=t.get("timestamp");t._initTimestamp!==r&&(t.set("timestamp",r),"active"!==e&&t.set("sessionState","active",o));const a=1e3*Math.floor((Date.now()-r)/1e3),g=t.get("autoExtend"),l=a>=i,c=a>=i-n,d=a>=s;l&&"expired"!==e?t.expire():g&&c?t.extend():!g&&d&&"warned"!==e&&t.warn();const p=t._registered;for(const e in p)p[e](a,d,l)}),1e3)},_stopTimer(){e.clearInterval(this._intervalId)},destructor(){new e.EventHandle(this._eventHandlers).detach(),this._stopTimer()},expire(){this.set("sessionState","expired",o)},extend(){this.set("sessionState","active",o)},initializer(){const t=this;t._cookieKey="LFR_SESSION_STATE_"+themeDisplay.getRealUserId(),t._cookieOptions={path:"/",secure:e.UA.secure},t._registered={},t.set("timestamp"),t._initEvents(),t._startTimer(),Liferay.fire("sessionInitialized",{session:t})},registerInterval(i){let n;const s=this._registered;return t.isFunction(i)&&(n=e.stamp(i),s[n]=i),n},resetInterval(){this._stopTimer(),this._startTimer()},unregisterInterval(e){const t=this._registered;return Object.prototype.hasOwnProperty.call(t,e)&&delete t[e],e},warn(){this.set("sessionState","warned",o)}}});c.SRC=a;const d=e.Component.create({ATTRS:{openToast:{validator:t.isFunction},pageTitle:{value:s.title}},EXTENDS:e.Plugin.Base,NAME:"liferaysessiondisplay",NS:"display",prototype:{_afterDefActivatedFn(){this._uiSetActivated()},_afterDefExpiredFn(){const e=this;e._host.unregisterInterval(e._intervalId),e._uiSetExpired()},_beforeHostWarned(){const e=this,i=e._host,n=i.get("sessionLength"),s=i.get("timestamp"),r=i.get("warningLength");let a=n;t.toInt(s)&&(a=1e3*Math.floor((Date.now()-s)/1e3));let o=n-a;o>r&&(o=r),e._getBanner();const l=document.querySelector("#".concat(g," .countdown-timer"));e._uiSetRemainingTime(o,l),e._intervalId=i.registerInterval(((t,i,s)=>{i?s||e._uiSetRemainingTime(n-t,l):e._uiSetActivated()}))},_destroyBanner(){const e=document.getElementById(g),t=null==e?void 0:e.parentElement;Liferay.destroyComponent(g),t&&t.remove(),this._banner=!1},_formatNumber:e=>t.String.padNumber(Math.floor(e),2),_formatTime(e){const n=this;return e=Number(e),t.isNumber(e)&&e>0?(e/=1e3,i[0]=n._formatNumber(e/3600),e%=3600,i[1]=n._formatNumber(e/60),e%=60,i[2]=n._formatNumber(e),e=i.join(":")):e=0,e},_getBanner(){const e=this;let t=e._banner;if(!t){const i=e.get("openToast"),n={onClick({event:t}){t.target.classList.contains("alert-link")&&e._host.extend()},renderData:{componentId:g},toastProps:{autoClose:!1,id:g,role:"alert"}};i(_objectSpread({message:e._warningText,type:"warning"},n));t=_objectSpread({open(t){e._destroyBanner(),i(_objectSpread(_objectSpread({},t),n))}},Liferay.component(g)),e._banner=t}return t},_onHostSessionStateChange(e){const t=this;"warned"===e.newVal&&t._beforeHostWarned(e)},_uiSetActivated(){const e=this;s.title=e.reset("pageTitle").get("pageTitle"),e._host.unregisterInterval(e._intervalId),e._banner&&e._destroyBanner()},_uiSetExpired(){const e=this;e._getBanner().open({message:e._expiredText,title:'Danger',type:"danger"}),s.title=e.get("pageTitle")},_uiSetRemainingTime(e,i){const n=this;if(e=n._formatTime(e),!n._alertClosed){const t=i.closest('div[role="alert"]');t&&(t.removeAttribute("role"),n._alert=t),i.innerHTML=e}s.title=t.sub('Session expires in {0}.',[e])+" | "+n.get("pageTitle")},destructor(){const e=this;e._banner&&e._destroyBanner()},initializer(){const e=this,i=e.get("host");Liferay.Util.getTop()===n.win?(e._host=i,e._toggleText={hide:'Hide',show:'Show'},e._expiredText='Due to inactivity, your session has expired. Before you continue, make sure your entered data is saved locally.',e._warningText='Due to inactivity, your session will expire in {0}. To extend your session another {1} minute(s), please press the <em>Extend</em> button. {2}',e._warningText=t.sub(e._warningText,['<span class="countdown-timer">{0}</span>',i.get("sessionLength")/6e4,'<a class="alert-link" href="javascript:void(0);">'+'Extend'+"</a>"]),i.on("sessionStateChange",e._onHostSessionStateChange,e),e.afterHostMethod("_defActivatedFn",e._afterDefActivatedFn),e.afterHostMethod("_defExpiredFn",e._afterDefExpiredFn)):i.unplug(e)}}});Liferay.SessionBase=c,Liferay.SessionDisplay=d}),"",{requires:["aui-base","aui-component","aui-timer","cookie","plugin"]});
?>
Did this file decode correctly?
Original Code
function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}AUI.add("liferay-session",(e=>{const t=e.Lang,i=[],n=e.config,s=n.doc,r={active:"activated"},a={},o={src:a},g="sessionToast",l=themeDisplay.getPathMain()+"/portal/",c=e.Component.create({ATTRS:{autoExtend:{value:!1},redirectOnExpire:{value:!0},redirectUrl:{value:""},sessionLength:{getter:"_getLengthInMillis",value:0},sessionState:{value:"active"},sessionTimeoutOffset:{getter:"_getLengthInMillis",value:0},timestamp:{getter:"_getTimestamp",setter:"_setTimestamp",value:0},warningLength:{getter:"_getLengthInMillis",setter:"_setWarningLength",value:0},warningTime:{getter:"_getWarningTime",value:0}},EXTENDS:e.Base,NAME:"liferaysession",prototype:{_afterSessionStateChange(e){const t=e.details,i=e.newVal;let n=null;"src"in e&&t.length&&(n=t[0]),this.fire(r[i]||i,n)},_defActivatedFn(e){const t=this;t.set("timestamp"),e.src===a&&Liferay.Util.fetch(l+"extend_session").then((e=>{500===e.status&&t.expire()}))},_defExpiredFn(t){const i=this;e.clearInterval(i._intervalId),t.src===a&&i._expireSession()},_expireSession(){const t=this;Liferay.Util.fetch(l+"expire_session").then((i=>{i.ok?(Liferay.fire("sessionExpired"),t.get("redirectOnExpire")&&(location.href=t.get("redirectUrl"))):e.setTimeout((()=>{t._expireSession()}),1e3)}))},_getLengthInMillis:e=>1e3*e,_getTimestamp(){return Liferay.Util.Cookie.get(this._cookieKey,Liferay.Util.Cookie.TYPES.NECESSARY)||this._initTimestamp},_getWarningTime(){return this.get("sessionLength")-this.get("warningLength")},_initEvents(){const i=this;i.publish("activated",{defaultFn:e.bind("_defActivatedFn",i)}),i.publish("expired",{defaultFn:e.bind("_defExpiredFn",i)}),i.publish("warned"),i._eventHandlers=[i.on("sessionStateChange",i._onSessionStateChange),i.after("sessionStateChange",i._afterSessionStateChange),e.on("io:complete",((e,n,s)=>{(!s||s&&s.sessionExtend||!t.isBoolean(s.sessionExtend))&&i.resetInterval()})),Liferay.once("screenLoad",(()=>{i.destroy()}))]},_onSessionStateChange(e){const t=this,i=e.newVal,n=e.prevVal;"expired"===n&&n!==i?e.preventDefault():"active"===n&&n===i&&t._afterSessionStateChange(e)},_setTimestamp(e){const t=this;e=String(e||Date.now()),t._initTimestamp=e,navigator.cookieEnabled&&Liferay.Util.Cookie.set(t._cookieKey,e,Liferay.Util.Cookie.TYPES.NECESSARY,t._cookieOptions)},_setWarningLength(e){return Math.min(this.get("sessionLength"),e)},_startTimer(){const t=this,i=t.get("sessionLength"),n=t.get("sessionTimeoutOffset"),s=t.get("warningTime");t._intervalId=e.setInterval((()=>{const e=t.get("sessionState"),r=t.get("timestamp");t._initTimestamp!==r&&(t.set("timestamp",r),"active"!==e&&t.set("sessionState","active",o));const a=1e3*Math.floor((Date.now()-r)/1e3),g=t.get("autoExtend"),l=a>=i,c=a>=i-n,d=a>=s;l&&"expired"!==e?t.expire():g&&c?t.extend():!g&&d&&"warned"!==e&&t.warn();const p=t._registered;for(const e in p)p[e](a,d,l)}),1e3)},_stopTimer(){e.clearInterval(this._intervalId)},destructor(){new e.EventHandle(this._eventHandlers).detach(),this._stopTimer()},expire(){this.set("sessionState","expired",o)},extend(){this.set("sessionState","active",o)},initializer(){const t=this;t._cookieKey="LFR_SESSION_STATE_"+themeDisplay.getRealUserId(),t._cookieOptions={path:"/",secure:e.UA.secure},t._registered={},t.set("timestamp"),t._initEvents(),t._startTimer(),Liferay.fire("sessionInitialized",{session:t})},registerInterval(i){let n;const s=this._registered;return t.isFunction(i)&&(n=e.stamp(i),s[n]=i),n},resetInterval(){this._stopTimer(),this._startTimer()},unregisterInterval(e){const t=this._registered;return Object.prototype.hasOwnProperty.call(t,e)&&delete t[e],e},warn(){this.set("sessionState","warned",o)}}});c.SRC=a;const d=e.Component.create({ATTRS:{openToast:{validator:t.isFunction},pageTitle:{value:s.title}},EXTENDS:e.Plugin.Base,NAME:"liferaysessiondisplay",NS:"display",prototype:{_afterDefActivatedFn(){this._uiSetActivated()},_afterDefExpiredFn(){const e=this;e._host.unregisterInterval(e._intervalId),e._uiSetExpired()},_beforeHostWarned(){const e=this,i=e._host,n=i.get("sessionLength"),s=i.get("timestamp"),r=i.get("warningLength");let a=n;t.toInt(s)&&(a=1e3*Math.floor((Date.now()-s)/1e3));let o=n-a;o>r&&(o=r),e._getBanner();const l=document.querySelector("#".concat(g," .countdown-timer"));e._uiSetRemainingTime(o,l),e._intervalId=i.registerInterval(((t,i,s)=>{i?s||e._uiSetRemainingTime(n-t,l):e._uiSetActivated()}))},_destroyBanner(){const e=document.getElementById(g),t=null==e?void 0:e.parentElement;Liferay.destroyComponent(g),t&&t.remove(),this._banner=!1},_formatNumber:e=>t.String.padNumber(Math.floor(e),2),_formatTime(e){const n=this;return e=Number(e),t.isNumber(e)&&e>0?(e/=1e3,i[0]=n._formatNumber(e/3600),e%=3600,i[1]=n._formatNumber(e/60),e%=60,i[2]=n._formatNumber(e),e=i.join(":")):e=0,e},_getBanner(){const e=this;let t=e._banner;if(!t){const i=e.get("openToast"),n={onClick({event:t}){t.target.classList.contains("alert-link")&&e._host.extend()},renderData:{componentId:g},toastProps:{autoClose:!1,id:g,role:"alert"}};i(_objectSpread({message:e._warningText,type:"warning"},n));t=_objectSpread({open(t){e._destroyBanner(),i(_objectSpread(_objectSpread({},t),n))}},Liferay.component(g)),e._banner=t}return t},_onHostSessionStateChange(e){const t=this;"warned"===e.newVal&&t._beforeHostWarned(e)},_uiSetActivated(){const e=this;s.title=e.reset("pageTitle").get("pageTitle"),e._host.unregisterInterval(e._intervalId),e._banner&&e._destroyBanner()},_uiSetExpired(){const e=this;e._getBanner().open({message:e._expiredText,title:'Danger',type:"danger"}),s.title=e.get("pageTitle")},_uiSetRemainingTime(e,i){const n=this;if(e=n._formatTime(e),!n._alertClosed){const t=i.closest('div[role="alert"]');t&&(t.removeAttribute("role"),n._alert=t),i.innerHTML=e}s.title=t.sub('Session\x20expires\x20in\x20\x7b0\x7d\x2e',[e])+" | "+n.get("pageTitle")},destructor(){const e=this;e._banner&&e._destroyBanner()},initializer(){const e=this,i=e.get("host");Liferay.Util.getTop()===n.win?(e._host=i,e._toggleText={hide:'Hide',show:'Show'},e._expiredText='Due\x20to\x20inactivity\x2c\x20your\x20session\x20has\x20expired\x2e\x20Before\x20you\x20continue\x2c\x20make\x20sure\x20your\x20entered\x20data\x20is\x20saved\x20locally\x2e',e._warningText='Due\x20to\x20inactivity\x2c\x20your\x20session\x20will\x20expire\x20in\x20\x7b0\x7d\x2e\x20To\x20extend\x20your\x20session\x20another\x20\x7b1\x7d\x20minute\x28s\x29\x2c\x20please\x20press\x20the\x20\x3cem\x3eExtend\x3c\x2fem\x3e\x20button\x2e\x20\x7b2\x7d',e._warningText=t.sub(e._warningText,['<span class="countdown-timer">{0}</span>',i.get("sessionLength")/6e4,'<a class="alert-link" href="javascript:void(0);">'+'Extend'+"</a>"]),i.on("sessionStateChange",e._onHostSessionStateChange,e),e.afterHostMethod("_defActivatedFn",e._afterDefActivatedFn),e.afterHostMethod("_defExpiredFn",e._afterDefExpiredFn)):i.unplug(e)}}});Liferay.SessionBase=c,Liferay.SessionDisplay=d}),"",{requires:["aui-base","aui-component","aui-timer","cookie","plugin"]});
Function Calls
None |
Stats
MD5 | 717ac9caff2859e813d4c10ac5a12535 |
Eval Count | 0 |
Decode Time | 42 ms |