let userInfo = {"user_id":0}; let thirdCHECK = false; let GETparams = window .location .search .replace('?', '') .split('&') .reduce( function (p, e) { let a = e.split('='); p[a[0]] = a[1]; return p; }, {} ); if (typeof GETparams['response'] !== "undefined") { thirdCHECK = true; let hostName = window.location.href.split('?')[0]; let hasheURL = ''; for (let key in GETparams) { if (key != 'response') { if (hasheURL == '') { hasheURL += '?' + key + '=' + GETparams[key]; } else { hasheURL += '&' + key + '=' + GETparams[key]; } } } redirectURL = hostName + hasheURL; authPatatay(GETparams['response'], 1); } function getCookie(name) { let matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } if (getCookie('third_party') != undefined) { thirdCHECK = true; } let pubNameBlock = '
'; let dashboard = '
Dashboard
'; let frameBlock = '
Order Printed Display Ads
'; let BannerBlock = '
Order Banner Campaigns
'; let countrBlock = '
\n' + '\n' + '
'; function locationLineShow(locationArr) { let res = ''; for (let i in locationArr) { res += '
  • ' + locationArr[i]['category'] + '
  • ' } return res; } let locationBlock = '
    \n' + '\n' + '\n' + '
    '; let authForm = '
    '; let authorizationLineHtml = '
    ' + '
    ' + '
    ' + '
    ' + pubNameBlock + dashboard + frameBlock + BannerBlock + '
    ' + '
    ' + '
    ' + countrBlock + locationBlock + authForm + '
    ' + '
    '; if (redoPage) { redoPageFunc(redoUrl); } function authPatatay(response, third_party) { let url = (!third_party) ? '/index.php/patatay_authorization' : '/index.php/patatay_authorization/index/1/'; let auth = new XMLHttpRequest(); auth.open("POST", url, true); auth.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); auth.onreadystatechange = function () { if (auth.status == 200) { if (redoPage) { redoPageFunc(redoUrl); } else { if (!third_party) { window.onload = function () { document.getElementById("authorisation-line").innerHTML = authorizationLineHtml; }; } else { redoPageFunc(redirectURL); } } } else { if (redoPage) { redoPageFunc(redoUrl); } } }; auth.send('response=' + response); } function redoPageFunc(url) { location.href = url; }