/**
     I use the token to find the contact and then, I will update some specific
     Fields to activate his account.
     I will throw an exception if something goes wrong
     I return the JsonModel Contact information just in case 
 */
 private function updateContactInfo()
 {
     // If reponse OK, then I activate the record
     $contact = $this->getTokenContact();
     $contactId = $contact->getVariable($this->getTable()->getPk());
     $result = $this->update($contactId, array('login_validated' => true, 'last_activation_date' => Utils::dateTimeNow()));
     if ($result->getVariable('status') == STATUS_FAILED) {
         throw new CommonException(array('messageId' => $result->getVariable('msg'), 'parms' => array(), EXCEPTION_ERRORKEY => 406, 'code' => 406));
     }
     return $contact;
 }
     return $this->htmlMarkup;
 }
 public function getModel()
 {
     // TODO - Dynamically get the Model reading the Template
     try {
         Utils::arrayKeyExists($this->getParmKeys(), $this->getBodyParms());
         // fname, title, actionText
         $model = $this->getBodyParms();
         $config = $this->getConfig();
         $actionLink = $config['allowedOrigins']['ckpt'] . '/activate/' . $model['access_token'];
         $model = array_merge($model, array('title' => $this->translate('globals.messages.member_signup_confirmation_title'), 'actionText' => $this->translate('globals.messages.member_signup_confirmation_button_text_activate'), 'actionLink' => $actionLink));
         return $model;
     } catch (Exception $e) {
         throw new Exception(get_class() . ' - ' . __FUNCTION__ . ': ' . $e->getMessage(), 500);
         // the POST was successful
         $response = json_decode($response->getBody(), true);
     } elseif ($throwEx) {
         throw new Exception('I could not do the Request: ' . $arrayParms);
     }
     return $response;
 }
 /**
  * Retrieves the best guess of the client's actual IP address.
  * Takes into account numerous HTTP proxy headers due to variations
  * in how different ISPs handle IP addresses in headers between hops.
  */
 public static function getRemoteIpAddress()
 {
     // Check for shared internet/ISP IP
     if (!empty($_SERVER['HTTP_CLIENT_IP']) && Utils::validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
         return $_SERVER['HTTP_CLIENT_IP'];
     }
     // Check for IPs passing through proxies
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         // Check if multiple IP addresses exist in var
         $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
         foreach ($iplist as $ip) {
             if (Utils::validate_ip($ip)) {
                 return $ip;
             }
         }
     }
     if (!empty($_SERVER['HTTP_X_FORWARDED']) && Utils::validate_ip($_SERVER['HTTP_X_FORWARDED'])) {
         return $_SERVER['HTTP_X_FORWARDED'];
     }
     if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && Utils::validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {