Back to PhocacartDownload class

Method isActive

public static
isActive
(mixed $date, mixed $days)

Method isActive - Source code

public static function isActive($date, $days)
{
    $o = '';
    $db = Factory::getDBO();
    $nullDate = $db->getNullDate();
    $now = Factory::getDate();
    $config = Factory::getConfig();
    $orderDate = Factory::getDate($date);
    $tz = new DateTimeZone($config->get('offset'));
    $orderDate->setTimezone($tz);
    $daysTime = $days * 24 * 60 * 60;
    $expireDate = $orderDate->toUnix() + $daysTime;
    if ($now->toUnix() <= $expireDate) {
        return true;
    } else {
        return false;
    }
    return false;
}