Created
July 8, 2016 12:51
-
-
Save kpodemski/703c9fe2b508fecdd709bf79439e2569 to your computer and use it in GitHub Desktop.
Handling guests user in Token::getToken() in PrestaShop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public static function getToken($page = true, Context $context = null) | |
{ | |
if (!$context) { | |
$context = Context::getContext(); | |
} | |
if (!Validate::isLoadedObject($context->customer)) { | |
$unique = $context->cookie->id_guest; | |
} else { | |
$unique = $context->customer->id.$context->customer->passwd; | |
} | |
$unique .= Tools::getRemoteAddr(); | |
if ($page === true) { | |
return (Tools::encrypt($unique.$_SERVER['SCRIPT_NAME'])); | |
} else { | |
return (Tools::encrypt($unique.$page)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment