Пример #1
0
 /**
  * Render the feed
  *
  * @access public
  * @return string
  */
 function render()
 {
     $now = new JDate();
     $data =& $this->_doc;
     $feed = "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"" . $data->getBase() . "\"";
     if ($data->language != "") {
         $feed .= " xml:lang=\"" . $data->language . "\"";
     }
     $feed .= ">\n";
     $feed .= "\t<title type=\"text\">" . htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8') . "</title>\n";
     $feed .= "\t<subtitle type=\"text\">" . htmlspecialchars($data->description, ENT_COMPAT, 'UTF-8') . "</subtitle>\n";
     $feed .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"" . $data->link . "\"/>\n";
     $feed .= "\t<id>" . $data->link . "</id>\n";
     $feed .= "\t<updated>" . htmlspecialchars($now->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
     if ($data->editor != "") {
         $feed .= "\t<author>\n";
         $feed .= "\t\t<name>" . $data->editor . "</name>\n";
         if ($data->editorEmail != "") {
             $feed .= "\t\t<email>" . $data->editorEmail . "</email>\n";
         }
         $feed .= "\t</author>\n";
     }
     $feed .= "\t<generator uri=\"http://joomla.org\" version=\"1.5\">" . $data->getGenerator() . "</generator>\n";
     $feed .= "<link rel=\"self\" type=\"application/atom+xml\" href=\"" . $data->syndicationURL . "\" />\n";
     for ($i = 0; $i < count($data->items); $i++) {
         $feed .= "\t<entry>\n";
         $feed .= "\t\t<title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n";
         $feed .= '		<link rel="alternate" type="text/html" href="' . $data->items[$i]->link . "\"/>\n";
         if ($data->items[$i]->date == "") {
             $data->items[$i]->date = time();
         }
         $itemDate = new JDate($data->items[$i]->date);
         $feed .= "\t\t<published>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</published>\n";
         $feed .= "\t\t<updated>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
         $feed .= "\t\t<id>" . htmlspecialchars($data->items[$i]->link, ENT_COMPAT, 'UTF-8') . "</id>\n";
         if ($data->items[$i]->author != "") {
             $feed .= "\t\t<author>\n";
             $feed .= "\t\t\t<name>" . htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8') . "</name>\n";
             $feed .= "\t\t</author>\n";
         }
         if ($data->items[$i]->description != "") {
             $feed .= "\t\t<summary type=\"html\">" . htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8') . "</summary>\n";
             $feed .= "\t\t<content type=\"html\">" . htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8') . "</content>\n";
         }
         if ($data->items[$i]->enclosure != NULL) {
             $feed .= "\t\t<link rel=\"enclosure\" href=\"" . $data->items[$i]->enclosure->url . "\" type=\"" . $data->items[$i]->enclosure->type . "\"  length=\"" . $data->items[$i]->enclosure->length . "\" />\n";
         }
         $feed .= "\t</entry>\n";
     }
     $feed .= "</feed>\n";
     return $feed;
 }
Пример #2
0
    public function add($name, $email, $comment, $ip, JDate $date)
    {
        $db = JFactory::getDbo();
        $query = 'INSERT INTO Comments (Name, Email, Comment, Ip, date)
					VALUES (' . $db->quote($name) . ', ' . $db->quote($email) . ', ' . $db->quote($comment) . ', ' . $db->quote(ip2long($ip)) . ', ' . $db->quote($date->toISO8601()) . ');';
        $db->setQuery($query);
        return $db->execute();
    }
Пример #3
0
 /**
  * Method to transform an internal representation to an external one.
  *
  * @param   string  $definition  Field definition.
  *
  * @return string The date string in ISO 8601 format.
  */
 public static function toExternal($definition)
 {
     if (empty($definition) || $definition == '0000-00-00 00:00:00') {
         return '';
     }
     $date = new JDate($definition);
     return $date->toISO8601();
 }
Пример #4
0
    private function add()
    {
        $name = $this->input->post->getString('name');
        $email = $this->input->post->getString('email');
        $comment = $this->input->post->getString('comment');
        if (!empty($name) && !empty($email) && !empty($comment)) {
            $ip = $this->input->server->getString('REMOTE_ADDR');
            $date = new JDate();
            $db = JFactory::getDbo();
            $query = 'INSERT INTO Comments (Name, Email, Comment, Ip, date)
						VALUES (' . $db->quote($name) . ', ' . $db->quote($email) . ', ' . $db->quote($comment) . ', ' . $db->quote(ip2long($ip)) . ', ' . $db->quote($date->toISO8601()) . ');';
            $db->setQuery($query);
            $db->execute();
        }
        $this->redirect('index.php');
    }
Пример #5
0
 /**
  * Method to get the list of comments in a repository.
  *
  * @param   string  $owner      The name of the owner of the GitHub repository.
  * @param   string  $repo       The name of the GitHub repository.
  * @param   string  $sort       The sort field - created or updated.
  * @param   string  $direction  The sort order- asc or desc. Ignored without sort parameter.
  * @param   JDate   $since      A timestamp in ISO 8601 format.
  *
  * @throws UnexpectedValueException
  * @throws DomainException
  * @since   11.3
  *
  * @return  array
  */
 public function getRepositoryList($owner, $repo, $sort = 'created', $direction = 'asc', JDate $since = null)
 {
     // Build the request path.
     $path = '/repos/' . $owner . '/' . $repo . '/issues/comments';
     if (false == in_array($sort, array('created', 'updated'))) {
         throw new UnexpectedValueException(sprintf('%1$s - sort field must be "created" or "updated"', __METHOD__));
     }
     if (false == in_array($direction, array('asc', 'desc'))) {
         throw new UnexpectedValueException(sprintf('%1$s - direction field must be "asc" or "desc"', __METHOD__));
     }
     $path .= '?sort=' . $sort;
     $path .= '&direction=' . $direction;
     if ($since) {
         $path .= '&since=' . $since->toISO8601();
     }
     // Send the request.
     return $this->processResponse($this->client->get($this->fetchUrl($path)));
 }
Пример #6
0
 /**
  * Method to list commits for a repository.
  *
  * A special note on pagination: Due to the way Git works, commits are paginated based on SHA
  * instead of page number.
  * Please follow the link headers as outlined in the pagination overview instead of constructing
  * page links yourself.
  *
  * @param   string  $user    The name of the owner of the GitHub repository.
  * @param   string  $repo    The name of the GitHub repository.
  * @param   string  $sha     Sha or branch to start listing commits from.
  * @param   string  $path    Only commits containing this file path will be returned.
  * @param   string  $author  GitHub login, name, or email by which to filter by commit author.
  * @param   JDate   $since   ISO 8601 Date - Only commits after this date will be returned.
  * @param   JDate   $until   ISO 8601 Date - Only commits before this date will be returned.
  *
  * @throws DomainException
  * @since    12.1
  *
  * @return  array
  */
 public function getList($user, $repo, $sha = '', $path = '', $author = '', JDate $since = null, JDate $until = null)
 {
     // Build the request path.
     $rPath = '/repos/' . $user . '/' . $repo . '/commits?';
     $rPath .= $sha ? '&sha=' . $sha : '';
     $rPath .= $path ? '&path=' . $path : '';
     $rPath .= $author ? '&author=' . $author : '';
     $rPath .= $since ? '&since=' . $since->toISO8601() : '';
     $rPath .= $until ? '&until=' . $until->toISO8601() : '';
     // Send the request.
     $response = $this->client->get($this->fetchUrl($rPath));
     // Validate the response code.
     if ($response->code != 200) {
         // Decode the error response and throw an exception.
         $error = json_decode($response->body);
         throw new DomainException($error->message, $response->code);
     }
     return json_decode($response->body);
 }
</video:title>
<video:description><![CDATA[<?php 
    echo substr($this->apiJsonResponse[0]->description, 0, 2048);
    ?>
]]></video:description>
<video:player_loc allow_embed="yes" autoplay="ap=1"><?php 
    echo "http://player.vimeo.com/video/" . $this->videoID;
    ?>
</video:player_loc>
<video:duration><?php 
    echo $this->apiJsonResponse[0]->duration;
    ?>
</video:duration>
<video:view_count><?php 
    echo $this->apiJsonResponse[0]->stats_number_of_plays;
    ?>
</video:view_count>
<video:publication_date><?php 
    $dateObj = new JDate($this->apiJsonResponse[0]->upload_date);
    $dateObj->setTimezone(new DateTimeZone('UTC'));
    echo $dateObj->toISO8601(true);
    ?>
</video:publication_date>
<video:uploader><?php 
    echo htmlspecialchars($this->apiJsonResponse[0]->user_name, ENT_COMPAT, 'UTF-8');
    ?>
</video:uploader>
<video:live>no</video:live>
</video:video> 
<?php 
}
Пример #8
0
 private function formCallback($data)
 {
     JLoader::import('joomla.utilities.date');
     $isValid = true;
     // Load the relevant subscription row
     if ($isValid) {
         $id = $data['sid'];
         $subscription = null;
         if ($id > 0) {
             $subscription = F0FModel::getTmpInstance('Subscriptions', 'AkeebasubsModel')->setId($id)->getItem();
             if ($subscription->akeebasubs_subscription_id <= 0 || $subscription->akeebasubs_subscription_id != $id) {
                 $subscription = null;
                 $isValid = false;
             }
         } else {
             $isValid = false;
         }
         if (!$isValid) {
             $responseData['akeebasubs_failure_reason'] = 'The subscription ID is invalid';
         }
     }
     if ($isValid && isset($data['token']) && isset($data['PayerID'])) {
         $level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
         $requestData = (object) array('METHOD' => 'DoExpressCheckoutPayment', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'TOKEN' => $data['token'], 'PAYERID' => $data['PayerID'], 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => sprintf('%.2f', $subscription->gross_amount), 'PAYMENTREQUEST_0_CURRENCYCODE' => strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')), 'PAYMENTREQUEST_0_INVNUM' => $subscription->akeebasubs_subscription_id, 'PAYMENTREQUEST_0_DESC' => '[' . $subscription->akeebasubs_subscription_id . '] ' . $level->title, 'IPADDRESS' => $_SERVER['REMOTE_ADDR']);
         $requestQuery = http_build_query($requestData);
         $requestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($requestQuery) . "\r\n", 'content' => $requestQuery)));
         $responseQuery = file_get_contents($this->getPaymentURL(), false, $requestContext);
         // Payment Response
         $responseData = array();
         parse_str($responseQuery, $responseData);
         if (!preg_match('/^SUCCESS/', strtoupper($responseData['ACK']))) {
             $isValid = false;
             $level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
             $error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
             $error_url = JRoute::_($error_url, false);
             JFactory::getApplication()->redirect($error_url, $responseData['L_LONGMESSAGE0'], 'error');
         } else {
             if (!preg_match('/^SUCCESS/', strtoupper($responseData['PAYMENTINFO_0_ACK']))) {
                 $isValid = false;
                 $responseData['akeebasubs_failure_reason'] = "PayPal error code: " . $responseData['PAYMENTINFO_0_ERRORCODE'];
             }
         }
         if ($level->recurring) {
             // Create recurring payment profile
             $nextPayment = new JDate("+{$level->duration} day");
             $callbackUrl = JURI::base() . 'index.php?option=com_akeebasubs&view=callback&paymentmethod=paypalproexpress&sid=' . $subscription->akeebasubs_subscription_id;
             $recurringRequestData = (object) array('METHOD' => 'CreateRecurringPaymentsProfile', 'NOTIFYURL' => $callbackUrl, 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PAYMENTACTION' => 'Sale', 'TOKEN' => $data['token'], 'PAYERID' => $data['PayerID'], 'IPADDRESS' => $_SERVER['REMOTE_ADDR'], 'AMT' => sprintf('%.2f', $subscription->gross_amount), 'TAXAMT' => sprintf('%.2f', $subscription->tax_amount), 'CURRENCYCODE' => strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')), 'DESC' => $level->title, 'PROFILEREFERENCE' => $subscription->akeebasubs_subscription_id, 'PROFILESTARTDATE' => $nextPayment->toISO8601(), 'BILLINGPERIOD' => 'Day', 'BILLINGFREQUENCY' => $level->duration);
             $recurringRequestQuery = http_build_query($recurringRequestData);
             $recurringRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recurringRequestQuery) . "\r\n", 'content' => $recurringRequestQuery)));
             $recurringResponseQuery = file_get_contents($this->getPaymentURL(), false, $recurringRequestContext);
             // Response of payment profile
             $recurringResponseData = array();
             parse_str($recurringResponseQuery, $recurringResponseData);
             if (!preg_match('/^SUCCESS/', strtoupper($recurringResponseData['ACK']))) {
                 $isValid = false;
                 $error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
                 $error_url = JRoute::_($error_url, false);
                 JFactory::getApplication()->redirect($error_url, $recurringResponseData['L_LONGMESSAGE0'], 'error');
             } else {
                 $recurringCheckData = (object) array('METHOD' => 'GetRecurringPaymentsProfileDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PROFILEID' => $recurringResponseData['PROFILEID']);
                 $recurringCheckQuery = http_build_query($recurringCheckData);
                 $recurringCheckContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recurringCheckQuery) . "\r\n", 'content' => $recurringCheckQuery)));
                 $recurringCheckQuery = file_get_contents($this->getPaymentURL(), false, $recurringCheckContext);
                 // Response of payment profile
                 $recurringCheckData = array();
                 parse_str($recurringCheckQuery, $recurringCheckData);
                 if (!preg_match('/^SUCCESS/', strtoupper($recurringCheckData['ACK']))) {
                     $isValid = false;
                     $error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
                     $error_url = JRoute::_($error_url, false);
                     JFactory::getApplication()->redirect($error_url, $recurringCheckData['L_LONGMESSAGE0'], 'error');
                 }
                 if (strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE']) !== strtoupper($recurringCheckData['CURRENCYCODE'])) {
                     $isValid = false;
                     $responseData['akeebasubs_failure_reason'] = "Currency code doesn't match.";
                 }
                 if (strtoupper($responseData['PAYMENTINFO_0_AMT']) !== strtoupper($recurringCheckData['AMT'])) {
                     $isValid = false;
                     $responseData['akeebasubs_failure_reason'] = "Amount doesn't match.";
                 }
                 if (strtoupper($recurringCheckData['BILLINGPERIOD']) !== "DAY") {
                     $isValid = false;
                     $responseData['akeebasubs_failure_reason'] = "Recurring period doesn't match.";
                 }
                 if ($recurringCheckData['BILLINGFREQUENCY'] != $level->duration) {
                     $isValid = false;
                     $responseData['akeebasubs_failure_reason'] = "Recurring duration doesn't match";
                 }
             }
         }
     }
     if ($isValid && !is_null($subscription)) {
         if ($subscription->processor_key == $responseData['PAYMENTINFO_0_TRANSACTIONID']) {
             $isValid = false;
             $responseData['akeebasubs_failure_reason'] = "I will not process the same TRANSACTIONID " . $responseData['PAYMENTINFO_0_TRANSACTIONID'] . " twice";
         }
     }
     if ($isValid) {
         if (strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR')) != strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE'])) {
             $isValid = false;
             $responseData['akeebasubs_failure_reason'] = "Currency code doesn't match.";
         }
     }
     // Check that amount is correct
     $isPartialRefund = false;
     if ($isValid && !is_null($subscription)) {
         $mc_gross = floatval($responseData['PAYMENTINFO_0_AMT']);
         $gross = $subscription->gross_amount;
         if ($mc_gross > 0) {
             // A positive value means "payment". The prices MUST match!
             // Important: NEVER, EVER compare two floating point values for equality.
             $isValid = $gross - $mc_gross < 0.01;
         } else {
             $isPartialRefund = false;
             $temp_mc_gross = -1 * $mc_gross;
             $isPartialRefund = $gross - $temp_mc_gross > 0.01;
         }
         if (!$isValid) {
             $responseData['akeebasubs_failure_reason'] = 'Paid amount does not match the subscription amount';
         }
     }
     // Log the IPN data
     $this->logIPN($responseData, $isValid);
     // Fraud attempt? Do nothing more!
     if (!$isValid) {
         $error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
         $error_url = JRoute::_($error_url, false);
         JFactory::getApplication()->redirect($error_url, $responseData['akeebasubs_failure_reason'], 'error');
         return false;
     }
     // Check the payment_status
     switch ($responseData['PAYMENTINFO_0_PAYMENTSTATUS']) {
         case 'Canceled_Reversal':
         case 'Completed':
             $newStatus = 'C';
             break;
         case 'Created':
         case 'Pending':
         case 'Processed':
             $newStatus = 'P';
             break;
         case 'Denied':
         case 'Expired':
         case 'Failed':
         case 'Refunded':
         case 'Reversed':
         case 'Voided':
         default:
             // Partial refunds can only by issued by the merchant. In that case,
             // we don't want the subscription to be cancelled. We have to let the
             // merchant adjust its parameters if needed.
             if ($isPartialRefund) {
                 $newStatus = 'C';
             } else {
                 $newStatus = 'X';
             }
             break;
     }
     // Update subscription status (this also automatically calls the plugins)
     $updates = array('akeebasubs_subscription_id' => $id, 'processor_key' => $responseData['PAYMENTINFO_0_TRANSACTIONID'], 'state' => $newStatus, 'enabled' => 0);
     JLoader::import('joomla.utilities.date');
     if ($newStatus == 'C') {
         $this->fixDates($subscription, $updates);
     }
     $subscription->save($updates);
     // Run the onAKAfterPaymentCallback events
     JLoader::import('joomla.plugin.helper');
     JPluginHelper::importPlugin('akeebasubs');
     $app = JFactory::getApplication();
     $jResponse = $app->triggerEvent('onAKAfterPaymentCallback', array($subscription));
     // Redirect the user to the "thank you" page
     $thankyouUrl = JRoute::_('index.php?option=com_akeebasubs&view=message&slug=' . $level->slug . '&layout=order&subid=' . $subscription->akeebasubs_subscription_id, false);
     JFactory::getApplication()->redirect($thankyouUrl);
     return true;
 }
Пример #9
0
 /**
  * Mark notifications as read in a repository.
  *
  * Marking all notifications in a repository as “read” removes them from the default view on GitHub.com.
  *
  * @param   string   $owner         Repository owner.
  * @param   string   $repo          Repository name.
  * @param   boolean  $unread        Changes the unread status of the threads.
  * @param   boolean  $read          Inverse of “unread”.
  * @param   JDate    $last_read_at  Describes the last point that notifications were checked.
  *                                  Anything updated since this time will not be updated. Default: Now. Expected in ISO 8601 format.
  *
  * @since 3.3 (CMS)
  *
  * @return object
  */
 public function markReadRepository($owner, $repo, $unread, $read, JDate $last_read_at = null)
 {
     // Build the request path.
     $path = '/repos/' . $owner . '/' . $repo . '/notifications';
     $data = array('unread' => $unread, 'read' => $read);
     if ($last_read_at) {
         $data['last_read_at'] = $last_read_at->toISO8601();
     }
     return $this->processResponse($this->client->put($this->fetchUrl($path), json_encode($data)), 205);
 }
Пример #10
0
 /**
  * Testing toISO8601
  *
  * @param mixed  $tz		Which time zone? (can be string or numeric
  * @param string $setTime  What time should be set?
  * @param bool   $local	Local (true) or GMT?
  * @param string $expected What should the resulting time string look like?
  *
  * @return void
  * @dataProvider casesToISO8601
  **/
 public function testToISO8601($tz, $setTime, $local, $expected)
 {
     if (is_null($tz)) {
         $testJDate = new JDate($setTime);
     } else {
         $testJDate = new JDate($setTime, $tz);
     }
     $this->assertThat($testJDate->toISO8601($local), $this->equalTo($expected));
 }
Пример #11
0
 /**
  * Method to list issues.
  *
  * @param   string   $user       The name of the owner of the GitHub repository.
  * @param   string   $repo       The name of the GitHub repository.
  * @param   string   $milestone  The milestone number, 'none', or *.
  * @param   string   $state      The optional state to filter requests by. [open, closed]
  * @param   string   $assignee   The assignee name, 'none', or *.
  * @param   string   $mentioned  The GitHub user name.
  * @param   string   $labels     The list of comma separated Label names. Example: bug,ui,@high.
  * @param   string   $sort       The sort order: created, updated, comments, default: created.
  * @param   string   $direction  The list direction: asc or desc, default: desc.
  * @param   JDate    $since      The date/time since when issues should be returned.
  * @param   integer  $page       The page number from which to get items.
  * @param   integer  $limit      The number of items on a page.
  *
  * @throws DomainException
  * @since   11.3
  *
  * @return  array
  */
 public function getListByRepository($user, $repo, $milestone = null, $state = null, $assignee = null, $mentioned = null, $labels = null, $sort = null, $direction = null, JDate $since = null, $page = 0, $limit = 0)
 {
     // Build the request path.
     $path = '/repos/' . $user . '/' . $repo . '/issues';
     $uri = new JUri($this->fetchUrl($path, $page, $limit));
     if ($milestone) {
         $uri->setVar('milestone', $milestone);
     }
     if ($state) {
         $uri->setVar('state', $state);
     }
     if ($assignee) {
         $uri->setVar('assignee', $assignee);
     }
     if ($mentioned) {
         $uri->setVar('mentioned', $mentioned);
     }
     if ($labels) {
         $uri->setVar('labels', $labels);
     }
     if ($sort) {
         $uri->setVar('sort', $sort);
     }
     if ($direction) {
         $uri->setVar('direction', $direction);
     }
     if ($since) {
         $uri->setVar('since', $since->toISO8601());
     }
     // Send the request.
     $response = $this->client->get((string) $uri);
     // Validate the response code.
     if ($response->code != 200) {
         // Decode the error response and throw an exception.
         $error = json_decode($response->body);
         throw new DomainException($error->message, $response->code);
     }
     return json_decode($response->body);
 }
Пример #12
0
 /**
  * Class constructor
  * 
  * @access public
  * @param string $format
  * @param string $language
  * @return Object&
  */
 public function __construct($format, $language)
 {
     // Init properties
     $this->format = $format;
     $this->language = $language;
     // Date format for index XML file
     $dateObj = new JDate();
     $globalConfig = JFactory::getConfig();
     $dateObj->setTimezone(new DateTimeZone($globalConfig->get('offset')));
     $this->ISO8601Date = $dateObj->toISO8601(true);
     // Live site for index XML file
     $uriInstance = JURI::getInstance();
     $this->liveSite = $uriInstance->getScheme() . '://' . $uriInstance->getHost() . '/';
     // Create DOM model
     $this->doc = new DOMDocument();
     $this->chunkFiles = array();
     $this->targetTag = null;
     $this->chunksCounter = 0;
     $this->itemLimit = 5;
 }
Пример #13
0
 function getFormattedDate($strdate, $format = 'd m Y')
 {
     jimport('joomla.utilities.date');
     $user =& JFactory::getUser();
     if ($user->get('id')) {
         $tz = $user->getParam('timezone');
     } else {
         $conf =& JFactory::getConfig();
         $tz = $conf->getValue('config.offset');
     }
     // Given time
     $jdate = new JDate($strdate);
     $jdate->setOffset($tz);
     $date = $jdate->toISO8601();
     return Date_Difference::getStringResolved($date);
 }
Пример #14
0
 /**
  * Class constructor
  * 
  * @access public
  * @param string $format
  * @param string $language
  * @param int $dataset
  * @return Object&
  */
 public function __construct($format, $language, $dataset)
 {
     // Init properties
     $this->format = $format;
     $this->language = $language;
     $this->dataset = $dataset;
     $this->cParams = JComponentHelper::getParams('com_jmap');
     // Default root nodes
     $this->defaultRootNodes = array('xml' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'images' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'gnews' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'mobile' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'), 'videos' => array('rootNodeName' => 'urlset', 'rootNodeAttributes' => 'xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"'));
     // Date format for index XML file
     $dateObj = new JDate();
     $globalConfig = JFactory::getConfig();
     $dateObj->setTimezone(new DateTimeZone($globalConfig->get('offset')));
     $this->ISO8601Date = $dateObj->toISO8601(true);
     // Live site for index XML file
     $uriInstance = JURI::getInstance();
     $this->liveSite = $uriInstance->getScheme() . '://' . $uriInstance->getHost() . '/';
     // Create DOM model
     $this->doc = new DOMDocument();
     $this->chunkFiles = array();
     $this->targetTag = null;
     $this->chunksCounter = 0;
     $this->itemLimit = 5;
 }
Пример #15
0
 private function formCallback($data)
 {
     JLoader::import('joomla.utilities.date');
     $isRecurring = $data['METHOD'] == 'CreateRecurringPaymentsProfile';
     $jNow = new JDate();
     $responseData = array();
     // Load the relevant subscription row
     $isValid = true;
     if ($isValid) {
         $id = $isRecurring ? (int) $data['PROFILEREFERENCE'] : (int) $data['INVNUM'];
         $subscription = null;
         if ($id > 0) {
             $subscription = F0FModel::getTmpInstance('Subscriptions', 'AkeebasubsModel')->setId($id)->getItem();
             if ($subscription->akeebasubs_subscription_id <= 0 || $subscription->akeebasubs_subscription_id != $id) {
                 $subscription = null;
                 $isValid = false;
             }
         } else {
             $isValid = false;
         }
         if (!$isValid) {
             $responseData['akeebasubs_failure_reason'] = 'The referenced subscription ID is invalid';
         }
     }
     // Call paypal to check the payment
     if ($isValid) {
         // Build the payment request
         $requestData = array();
         foreach ($data as $key => $val) {
             if ($key == 'option' || $key == 'view' || $key == 'paymentmethod') {
                 continue;
             }
             $requestData[$key] = trim($val);
             if ($key == 'CVV2') {
                 break;
             }
         }
         if ($isRecurring) {
             $requestData['PROFILESTARTDATE'] = $jNow->toISO8601();
         }
         $requestQuery = http_build_query($requestData);
         if ($this->getApiMethod() == 'file_get_contents') {
             $requestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($requestQuery) . "\r\n", 'content' => $requestQuery)));
             $responseQuery = file_get_contents($this->getPaymentURL(), false, $requestContext);
         } else {
             $http_header = array('X-PAYPAL-SECURITY-USERID' => $this->getMerchantUsername(), 'X-PAYPAL-SECURITY-PASSWORD' => $this->getMerchantPassword(), 'X-PAYPAL-SECURITY-SIGNATURE' => $this->getMerchantSignature());
             $curlOptions = array(CURLOPT_HTTPHEADER => $http_header, CURLOPT_URL => $this->getPaymentURL(), CURLOPT_VERBOSE => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => 1, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $requestQuery);
             $ch = curl_init();
             curl_setopt_array($ch, $curlOptions);
             $responseQuery = curl_exec($ch);
             //make the request
             if (curl_errno($ch)) {
                 $this->_errors = curl_error($ch);
                 curl_close($ch);
                 return false;
             } else {
                 curl_close($ch);
             }
         }
         // Payment Response
         parse_str($responseQuery, $responseData);
         if (!preg_match('/^Success/', $responseData['ACK'])) {
             $responseData['akeebasubs_failure_reason'] = $responseData['L_LONGMESSAGE0'];
             $isValid = false;
         } else {
             if ($isRecurring) {
                 // If recurring payment do another request to paypal, to receive
                 // the details (the amount and transaction id) of the payment.
                 $recDetailsRequestData = array('METHOD' => 'GetRecurringPaymentsProfileDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => '85.0', 'PROFILEID' => $responseData['PROFILEID']);
                 $recDetailsRequestQuery = http_build_query($recDetailsRequestData);
                 $recDetailsRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Connection: close\r\n" . "Content-Length: " . strlen($recDetailsRequestQuery) . "\r\n", 'content' => $recDetailsRequestQuery)));
                 $recDetailsResponseQuery = file_get_contents($this->getPaymentURL(), false, $recDetailsRequestContext);
                 $recDetailsResponseData = array();
                 parse_str($recDetailsResponseQuery, $recDetailsResponseData);
                 $responseData = $recDetailsResponseData;
                 if (!preg_match('/^Success/', $responseData['ACK'])) {
                     $responseData['akeebasubs_failure_reason'] = $responseData['L_LONGMESSAGE0'];
                     $isValid = false;
                 }
             }
         }
     }
     // Check that TRANSACTIONID has not been previously processed
     $transactionId = $isRecurring ? $responseData['CORRELATIONID'] : $responseData['TRANSACTIONID'];
     if ($isValid && !is_null($subscription)) {
         if ($subscription->processor_key == $transactionId) {
             $isValid = false;
             $responseData['akeebasubs_failure_reason'] = "I will not process the same TRANSACTIONID/CORRELATIONID " . $responseData['TRANSACTIONID'] . " twice";
         }
     }
     // Check that CURRENCYCODE is correct
     if ($isValid && !is_null($subscription)) {
         $currency = strtoupper(AkeebasubsHelperCparams::getParam('currency', 'EUR'));
         if ($currency != $responseData['CURRENCYCODE']) {
             $isValid = false;
             $responseData['akeebasubs_failure_reason'] = "The currency code doesn't match (expected: " . $currency . ", received: " . $responseData['CURRENCYCODE'] . ")";
         }
     }
     // Check that amount is correct
     $isPartialRefund = false;
     if ($isValid && !is_null($subscription)) {
         $mc_gross = floatval($responseData['AMT']);
         $gross = $subscription->gross_amount;
         if ($mc_gross > 0) {
             // A positive value means "payment". The prices MUST match!
             // Important: NEVER, EVER compare two floating point values for equality.
             $isValid = $gross - $mc_gross < 0.01;
         } else {
             $isPartialRefund = false;
             $temp_mc_gross = -1 * $mc_gross;
             $isPartialRefund = $gross - $temp_mc_gross > 0.01;
         }
         if (!$isValid) {
             $responseData['akeebasubs_failure_reason'] = 'Paid amount does not match the subscription amount';
         }
     }
     if (!$isValid) {
         // Mark the payment as failed
         $updates = array('akeebasubs_subscription_id' => $id, 'processor_key' => $transactionId, 'state' => 'X', 'enabled' => 0);
         $subscription->save($updates);
         // Redirect to the subscription form and show the error message
         $level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
         $error_url = 'index.php?option=' . JRequest::getCmd('option') . '&view=level&slug=' . $level->slug . '&layout=' . JRequest::getCmd('layout', 'default');
         $error_url = JRoute::_($error_url, false);
         JFactory::getApplication()->redirect($error_url, $responseData['akeebasubs_failure_reason'], 'error');
         return false;
     }
     // Redirect the user to the "thank you" page
     $level = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($subscription->akeebasubs_level_id)->getItem();
     $thankyouUrl = JRoute::_('index.php?option=com_akeebasubs&view=message&slug=' . $level->slug . '&layout=order&subid=' . $subscription->akeebasubs_subscription_id, false);
     JFactory::getApplication()->redirect($thankyouUrl);
     return true;
 }
Пример #16
0
 /**
  * Handle callback from form submission.
  *
  * @return  void   Redirect to different page.
  *
  * @since   1.0.0
  */
 private function formCallback()
 {
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $donationId = $jinput->get('donation_id', 0, 'uint');
     $token = $jinput->get('token', '');
     $payerId = $jinput->get('PayerID', '');
     $return = $jinput->get('return', '');
     if (empty($return)) {
         $errorUrl = JRoute::_('index.php', false);
     } else {
         $errorUrl = JRoute::_(base64_decode($return), false);
     }
     JLoader::import('joomla.utilities.date');
     $isValid = true;
     if ($isValid) {
         $donation = null;
         if ($donationId > 0) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true)->select('d.*')->from($db->quoteName('#__cmdonation_donations') . ' AS d')->where($db->quoteName('d.id') . ' = ' . $db->quote($donationId))->where($db->quoteName('d.transaction_token') . ' = ' . $db->quote($token));
             // Join with campaign table to get campaign's name.
             $query->join('LEFT', $db->quoteName('#__cmdonation_campaigns') . ' AS c ON c.id = d.campaign_id')->select($db->quoteName('c.name') . ' AS campaign_name');
             $donation = $db->setQuery($query)->loadObject();
             if (!isset($donation->id) || $donation->id != $donationId) {
                 $donation = null;
                 $isValid = false;
             }
         } else {
             $isValid = false;
         }
         if (!$isValid) {
             $responseData['cmdonation_failure_reason'] = 'The donation ID is invalid';
         }
     }
     if ($isValid && isset($token) && isset($payerId)) {
         $requestData = (object) array('METHOD' => 'DoExpressCheckoutPayment', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => $this->getAPIVersion(), 'TOKEN' => $token, 'PAYERID' => $payerId, 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', 'PAYMENTREQUEST_0_AMT' => sprintf('%.2f', $donation->amount), 'PAYMENTREQUEST_0_CURRENCYCODE' => $this->getCurrency(), 'PAYMENTREQUEST_0_INVNUM' => $donation->id, 'PAYMENTREQUEST_0_DESC' => $this->getDescription($donation->campaign_name), 'IPADDRESS' => $_SERVER['REMOTE_ADDR']);
         $requestQuery = http_build_query($requestData);
         $requestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . "Connection: close\r\n" . "Content-Length: " . strlen($requestQuery) . "\r\n", 'content' => $requestQuery)));
         $responseQuery = file_get_contents($this->getPaymentUrl(), false, $requestContext);
         // Payment Response.
         $responseData = array();
         parse_str($responseQuery, $responseData);
         if (!preg_match('/^SUCCESS/', strtoupper($responseData['ACK']))) {
             $isValid = false;
             $app->redirect($errorUrl, $responseData['L_LONGMESSAGE0'], 'error');
         } elseif (!preg_match('/^SUCCESS/', strtoupper($responseData['PAYMENTINFO_0_ACK']))) {
             $isValid = false;
             $responseData['cmdonation_failure_reason'] = "PayPal error code: " . $responseData['PAYMENTINFO_0_ERRORCODE'];
         }
         $supportedPeriods = array('D', 'W', 'M', 'S', 'Y');
         if ($donation->recurring && in_array($donation->recurring_cycle, $supportedPeriods)) {
             $period = $this->convertPeriod($donation->recurring_cycle);
             // Create recurring payment profile.
             $startDate = new JDate();
             $callbackUrl = JURI::base() . 'index.php?option=com_cmdonation&task=donation.notify&gateway=' . $this->name . '&ipn=true&donation_id=' . $donationId;
             $recurringRequestData = (object) array('METHOD' => 'CreateRecurringPaymentsProfile', 'NOTIFYURL' => $callbackUrl, 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => $this->getAPIVersion(), 'PAYMENTACTION' => 'Sale', 'TOKEN' => $token, 'PAYERID' => $payerId, 'IPADDRESS' => $_SERVER['REMOTE_ADDR'], 'AMT' => sprintf('%.2f', $donation->amount), 'CURRENCYCODE' => $this->getCurrency(), 'DESC' => $this->getDescription($donation->campaign_name), 'PROFILEREFERENCE' => $donation->id, 'PROFILESTARTDATE' => $startDate->toISO8601(), 'BILLINGPERIOD' => $period, 'BILLINGFREQUENCY' => 1);
             $recurringRequestQuery = http_build_query($recurringRequestData);
             $recurringRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . "Connection: close\r\n" . "Content-Length: " . strlen($recurringRequestQuery) . "\r\n", 'content' => $recurringRequestQuery)));
             $recurringResponseQuery = file_get_contents($this->getPaymentUrl(), false, $recurringRequestContext);
             // Response of payment profile.
             $recurringResponseData = array();
             parse_str($recurringResponseQuery, $recurringResponseData);
             if (!preg_match('/^SUCCESS/', strtoupper($recurringResponseData['ACK']))) {
                 $isValid = false;
                 $app->redirect($errorUrl, $recurringResponseData['L_LONGMESSAGE0'], 'error');
             } else {
                 $recurringCheckData = (object) array('METHOD' => 'GetRecurringPaymentsProfileDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => $this->getAPIVersion(), 'PROFILEID' => $recurringResponseData['PROFILEID']);
                 $recurringCheckQuery = http_build_query($recurringCheckData);
                 $recurringCheckContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . "Connection: close\r\n" . "Content-Length: " . strlen($recurringCheckQuery) . "\r\n", 'content' => $recurringCheckQuery)));
                 $recurringCheckQuery = file_get_contents($this->getPaymentUrl(), false, $recurringCheckContext);
                 // Response of payment profile
                 $recurringCheckData = array();
                 parse_str($recurringCheckQuery, $recurringCheckData);
                 if (!preg_match('/^SUCCESS/', strtoupper($recurringCheckData['ACK']))) {
                     $isValid = false;
                     $app->redirect($errorUrl, $recurringCheckData['L_LONGMESSAGE0'], 'error');
                 }
                 if (strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE']) !== strtoupper($recurringCheckData['CURRENCYCODE'])) {
                     $isValid = false;
                     $responseData['cmdonation_failure_reason'] = "Currency code doesn't match.";
                 }
                 if (strtoupper($responseData['PAYMENTINFO_0_AMT']) !== strtoupper($recurringCheckData['AMT'])) {
                     $isValid = false;
                     $responseData['cmdonation_failure_reason'] = "Amount doesn't match.";
                 }
                 $period = $this->convertPeriod($donation->recurring_cycle);
                 if (strtoupper($recurringCheckData['BILLINGPERIOD']) !== strtoupper($period)) {
                     $isValid = false;
                     $responseData['cmdonation_failure_reason'] = "Recurring period doesn't match.";
                 }
                 if ($recurringCheckData['BILLINGFREQUENCY'] != 1) {
                     $isValid = false;
                     $responseData['cmdonation_failure_reason'] = "Recurring duration doesn't match";
                 }
             }
         }
     }
     if ($isValid) {
         if ($donation->transaction_id == $responseData['PAYMENTINFO_0_TRANSACTIONID']) {
             $isValid = false;
             $responseData['cmdonation_failure_reason'] = "I will not process the same TRANSACTIONID " . $responseData['PAYMENTINFO_0_TRANSACTIONID'] . " twice";
         }
     }
     // Check that currency is correct.
     if ($isValid) {
         if (strtoupper($this->getCurrency()) != strtoupper($responseData['PAYMENTINFO_0_CURRENCYCODE'])) {
             $isValid = false;
             $responseData['cmdonation_failure_reason'] = "Currency code doesn't match.";
         }
     }
     // Check that amount is correct.
     if ($isValid) {
         $mc_gross = floatval($responseData['PAYMENTINFO_0_AMT']);
         $gross = $donation->amount;
         $isValid = $gross - $mc_gross < 0.01;
         if (!$isValid) {
             $responseData['cmdonation_failure_reason'] = 'Paid amount does not match the subscription amount';
         }
     }
     // Log the IPN data.
     $this->logIPN($responseData, $isValid);
     // Fraud attempt? Do nothing more!
     if (!$isValid) {
         $app->redirect($errorUrl, $responseData['cmdonation_failure_reason'], 'error');
     }
     // Check payment status.
     switch ($responseData['PAYMENTINFO_0_PAYMENTSTATUS']) {
         case 'Canceled_Reversal':
         case 'Completed':
             $newStatus = 'COMPLETED';
             break;
         case 'Refunded':
             $newStatus = 'REFUNDED';
             break;
         default:
             $newStatus = 'INCOMPLETE';
             break;
     }
     // Only get payer's info when payment is completed.
     if ($newStatus == 'COMPLETED') {
         $detailRequestData = (object) array('METHOD' => 'GetExpressCheckoutDetails', 'USER' => $this->getMerchantUsername(), 'PWD' => $this->getMerchantPassword(), 'SIGNATURE' => $this->getMerchantSignature(), 'VERSION' => $this->getAPIVersion(), 'TOKEN' => $token);
         $detailRequestQuery = http_build_query($detailRequestData);
         $detailRequestContext = stream_context_create(array('http' => array('method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" . "Connection: close\r\n" . "Content-Length: " . strlen($detailRequestQuery) . "\r\n", 'content' => $detailRequestQuery)));
         $detailRequestQuery = file_get_contents($this->getPaymentUrl(), false, $detailRequestContext);
         $detailResponseData = array();
         parse_str($detailRequestQuery, $detailResponseData);
         // If it is failed to get transaction detail, we ignore and leave payer's info empty in our database.
         if (preg_match('/^SUCCESS/', strtoupper($detailResponseData['ACK']))) {
             $firstName = isset($detailResponseData['FIRSTNAME']) ? $detailResponseData['FIRSTNAME'] : '';
             $lastName = isset($detailResponseData['LASTNAME']) ? $detailResponseData['LASTNAME'] : '';
             $email = isset($detailResponseData['EMAIL']) ? $detailResponseData['EMAIL'] : '';
             $countryCode = isset($detailResponseData['COUNTRYCODE']) ? $detailResponseData['COUNTRYCODE'] : '';
         } else {
             $firstName = $lastName = $email = $countryCode = '';
         }
     }
     // Update donation.
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->update($db->quoteName('#__cmdonation_donations'))->set($db->quoteName('transaction_id') . ' = ' . $db->quote($responseData['PAYMENTINFO_0_TRANSACTIONID']))->set($db->quoteName('transaction_token') . ' = ' . $db->quote(''))->set($db->quoteName('transaction_params') . ' = ' . $db->quote(json_encode($responseData)))->set($db->quoteName('status') . ' = ' . $db->quote($newStatus))->where($db->quoteName('id') . ' = ' . $db->quote($donation->id));
     if ($newStatus == 'COMPLETED') {
         $now = new JDate();
         $query->set($db->quoteName('first_name') . ' = ' . $db->quote($firstName));
         $query->set($db->quoteName('last_name') . ' = ' . $db->quote($lastName));
         $query->set($db->quoteName('email') . ' = ' . $db->quote($email));
         $query->set($db->quoteName('country_code') . ' = ' . $db->quote($countryCode));
         $query->set($db->quoteName('completed') . ' = ' . $db->quote($now->toSql()));
     } else {
         $query->set($db->quoteName('completed') . ' = ' . $db->quote($db->getNullDate()));
     }
     $db->setQuery($query)->execute();
     // Redirect the user to the "thank you" page
     $thankYouUrl = $this->prepareRoute('index.php?option=com_cmdonation&view=thankyou&layout=complete&donation=' . $donationId);
     JFactory::getApplication()->redirect($thankYouUrl);
 }
 /**
  * Testing toISO8601
  *
  * @param   mixed    $tz        Which time zone? (can be string or numeric
  * @param   string   $setTime   What time should be set?
  * @param   boolean  $local     Local (true) or GMT?
  * @param   string   $expected  What should the resulting time string look like?
  *
  * @return  void
  *
  * @dataProvider casesToISO8601
  * @since   11.3
  * @covers  JDate::toISO8601
  */
 public function testToISO8601($tz, $setTime, $local, $expected)
 {
     $testJDate = new JDate($setTime, $tz);
     $this->assertEquals($expected, $testJDate->toISO8601($local));
 }