function CheckUserExpiration()
 {
     $this->showClass = "";
     $this->trialTimeClass = "none";
     $this->showData = true;
     $paymentDates = payment_info::getPaymentDates($this->userId);
     $this->trialMessage = "";
     $lastPaymentDate = "";
     $nextPaymentDate = "";
     $useSubscriptionText = true;
     $expirationInfo = user::getUserExpirationDate($this->userId);
     $expDate = new DateTime($expirationInfo['date']);
     $now = new DateTime(date("Y-m-d"));
     $diff = intval($now->diff($expDate)->format("%r%a"));
     $nextPaymentDate = $expDate->format("F dS, Y");
     $isTrial = $expirationInfo['type'] == user::EXP_TYPE_TRIAL;
     if ($isTrial) {
         $useTrialEnd = true;
         if ($diff < 0) {
             $this->trialTimeClass = "";
             $this->trialMessage = "**** YOUR TRIAL MEMBERSHIP HAS EXPIRED! ****";
             $this->showData = false;
             $this->showClass = "none";
         } else {
             if ($diff <= 15) {
                 $this->trialTimeClass = "";
                 if ($diff == 0) {
                     $this->trialMessage = "**** TRIAL MEMBERSHIP EXPIRES TODAY! ****";
                 } else {
                     $this->trialMessage = "**** TRIAL MEMBERSHIP EXPIRES IN " . $diff . " DAYS! ****";
                 }
             }
         }
     } else {
         if ($diff >= -3) {
             $useSubscriptionText = false;
         } else {
             $this->trialTimeClass = "";
             $this->trialMessage = "**** YOUR SUBSCRIPTION HAS EXPIRED! ****";
             $this->showData = false;
             $this->showClass = "none";
         }
     }
     $this->useSubscriptionText = $useSubscriptionText;
     $this->nextPaymentDate = $nextPaymentDate;
 }
$admin = new admins();
$admin->set_variable('admin_user_id', $uid);
$isAdmin = false;
$showToAdminClass = '';
if ($admin->load()) {
    $isAdmin = true;
    $showToAdminClass = '';
}
if (isset($_GET['lo'])) {
    session_destroy();
    header('Location: /');
}
$showClass = "";
$trialTimeClass = "none";
$showData = true;
$paymentDates = payment_info::getPaymentDates($uid);
$trialMessage = "";
$lastPaymentDate = "";
$nextPaymentDate = "";
$useSubscriptionText = true;
$expirationInfo = user::getUserExpirationDate($uid);
$expDate = new DateTime($expirationInfo['date']);
$now = new DateTime(date("Y-m-d"));
$diff = intval($now->diff($expDate)->format("%r%a"));
$nextPaymentDate = $expDate->format("F dS, Y");
$isTrial = $expirationInfo['type'] == user::EXP_TYPE_TRIAL;
if ($isTrial) {
    $useTrialEnd = true;
    if ($diff < 0) {
        $trialTimeClass = "";
        $trialMessage = "**** YOUR TRIAL MEMBERSHIP HAS EXPIRED! ****";
Exemple #3
0
 public static function getUserExpirationDateTEST($uid)
 {
     $paymentDates = payment_info::getPaymentDates($uid);
     $paymentDate = date('0-0-00');
     $expiration = array();
     if (!empty($paymentDates)) {
         $paymentDate = $paymentDates['next']->format("Y-m-d");
     }
     $trialDate = date('0-0-00');
     $manualExpDate = date('0-0-00');
     $user = new user();
     $user->set_variable('users_id', $uid);
     if ($user->load()) {
         $created = new DateTime($user->get_variable('users_creationdate'));
         $created->add(new DateInterval('P' . user::TRIAL_PERIOD . 'D'));
         $trialDate = $created->format('F j, Y');
         $manualExpDate = $user->get_variable('users_manualexpdate');
     }
     if (!empty($paymentDates)) {
         $datetime = strtotime($paymentDate);
         $expiration['date'] = date("F j, Y", $datetime);
         $expiration['type'] = user::EXP_TYPE_PAID;
     }
     return $expiration;
 }