Esempio n. 1
0
 /**
  * @todo check/fix! // 30-07-2015
  * move to model/controller
  */
 public function canDelete($id)
 {
     // cannot be deleted if assigned to games
     $query = ' SELECT COUNT(id) FROM #__joomleague_match_player ' . ' WHERE teamplayer_id = ' . $this->getDbo()->Quote($id) . ' GROUP BY teamplayer_id ';
     $this->getDbo()->setQuery($query, 0, 1);
     $res = $this->getDbo()->loadResult();
     if ($res) {
         $this->setError(Jtext::sprintf('PLAYER ASSIGNED TO %d GAMES', $res));
         return false;
     }
     // cannot be deleted if has events
     $query = ' SELECT COUNT(id) FROM #__joomleague_match_event ' . ' WHERE teamplayer_id = ' . $this->getDbo()->Quote($id) . ' GROUP BY teamplayer_id ';
     $this->getDbo()->setQuery($query, 0, 1);
     $res = $this->getDbo()->loadResult();
     if ($res) {
         $this->setError(JText::sprintf('%d EVENTS ASSIGNED TO PLAYER', $res));
         return false;
     }
     // cannot be deleted if has stats
     $query = ' SELECT COUNT(id) FROM #__joomleague_match_statistic ' . ' WHERE teamplayer_id = ' . $this->getDbo()->Quote($id) . ' GROUP BY teamplayer_id ';
     $this->getDbo()->setQuery($query, 0, 1);
     $res = $this->getDbo()->loadResult();
     if ($res) {
         $this->setError(JText::sprintf('%d STATS ASSIGNED TO PLAYER', $res));
         return false;
     }
     return true;
 }
 function canDelete($id)
 {
     // the staff cannot be deleted if assigned to games
     $query = ' SELECT COUNT(id) FROM #__joomleague_match_staff ' . ' WHERE team_staff_id = ' . $this->getDbo()->Quote($id) . ' GROUP BY team_staff_id ';
     $this->getDbo()->setQuery($query, 0, 1);
     $res = $this->getDbo()->loadResult();
     if ($res) {
         $this->setError(Jtext::sprintf('STAFF ASSIGNED TO %d GAMES', $res));
         return false;
     }
     // the staff cannot be deleted if has stats
     $query = ' SELECT COUNT(id) FROM #__joomleague_match_staff_statistic ' . ' WHERE team_staff_id = ' . $this->getDbo()->Quote($id) . ' GROUP BY team_staff_id ';
     $this->getDbo()->setQuery($query, 0, 1);
     $res = $this->getDbo()->loadResult();
     if ($res) {
         $this->setError(JText::sprintf('%d STATS ASSIGNED TO STAFF', $res));
         return false;
     }
     return true;
 }
Esempio n. 3
0
 /**
  * save assigned individuals
  *
  * @return bool
  *
  * @throws Exception
  */
 public function saveassign()
 {
     $project_id = $this->input->getInt('project_id', 0);
     $cid = $this->input->get('cid', '', 'array');
     $numbers = $this->input->get('number', '', 'array');
     $team_id = $this->input->get('team_id', '', 'array');
     JArrayHelper::toInteger($cid);
     JArrayHelper::toInteger($team_id);
     if (count($cid) < 1) {
         throw new Exception(JText::_('COM_TRACKS_Select_an_individual_to_assign'), 500);
     }
     $rows = array();
     foreach ($cid as $k => $id) {
         $row = new stdclass();
         $row->individual_id = $cid[$k];
         $row->team_id = $team_id[$k];
         $row->number = $numbers[$k];
         $row->project_id = $project_id;
         $rows[] = $row;
     }
     $msg = '';
     $model = $this->getModel('projectindividuals');
     $model->setState('project_id', $project_id);
     $assigned = $model->assign($rows);
     if ($assigned === false) {
         $msg = $model->getError(true);
         $link = 'index.php?option=com_tracks&view=individuals';
         $this->setRedirect($link, $msg);
     } else {
         $msg = Jtext::sprintf('COM_TRACKS_D_INDIVIDUALS_ADDED_TO_PROJECT', $assigned);
         $app = JFactory::getApplication();
         $option = $app->input->getCmd('option', 'com_tracks');
         $app->setUserState($option . 'project', $project_id);
         $link = 'index.php?option=com_tracks&view=projectindividuals';
         $this->setRedirect($link, $msg);
     }
     return true;
 }
Esempio n. 4
0
 /**
  * Proceeds the simple payment
  *
  * @param string $resp
  * @param array  $submitted_values
  * @return object Message object
  *
  */
 function _handleResponse($response, $submitted_values, $order, $payment_name)
 {
     $delimiter = $this->_authorizenet_params['delim_char'];
     $encap_char = $this->_authorizenet_params['encap_char'];
     if ($response) {
         // Split Array
         if ($encap_char) {
             //$response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
             $response_array = explode($encap_char, $response);
         } else {
             $response_array = explode($delimiter, $response);
         }
         /**
          * If AuthorizeNet doesn't return a delimited response.
          */
         if (count($response_array) < 10) {
             $this->approved = FALSE;
             $this->error = TRUE;
             $error_message = JText::_('VMPAYMENT_AUTHORIZENET_UNKNOWN') . $response;
             // send email to vendor
             $this->sendEmailToVendorAndAdmins(JText::_('VMPAYMENT_AUTHORIZENET_ERROR_EMAIL_SUBJECT'), $error_message);
             return $error_message;
         }
         $authorizeNetResponse['response_code'] = $response_array[0];
         $this->approved = $authorizeNetResponse['response_code'] == self::APPROVED;
         $this->declined = $authorizeNetResponse['response_code'] == self::DECLINED;
         $this->error = $authorizeNetResponse['response_code'] == self::ERROR;
         $this->held = $authorizeNetResponse['response_code'] == self::HELD;
         $authorizeNetResponse['response_subcode'] = $response_array[1];
         $authorizeNetResponse['response_reason_code'] = $response_array[2];
         $authorizeNetResponse['response_reason_text'] = $response_array[3];
         $authorizeNetResponse['authorization_code'] = $response_array[4];
         $authorizeNetResponse['avs_response'] = $response_array[5];
         //Address Verification Service
         $authorizeNetResponse['transaction_id'] = $response_array[6];
         $authorizeNetResponse['invoice_number'] = $response_array[7];
         $authorizeNetResponse['description'] = $response_array[8];
         if ($this->approved) {
             $authorizeNetResponse['amount'] = $response_array[9];
             $authorizeNetResponse['method'] = $response_array[10];
             $authorizeNetResponse['transaction_type'] = $response_array[11];
             $authorizeNetResponse['customer_id'] = $response_array[12];
             $authorizeNetResponse['first_name'] = $response_array[13];
             $authorizeNetResponse['last_name'] = $response_array[14];
             $authorizeNetResponse['company'] = $response_array[15];
             $authorizeNetResponse['address'] = $response_array[16];
             $authorizeNetResponse['city'] = $response_array[17];
             $authorizeNetResponse['state'] = $response_array[18];
             $authorizeNetResponse['zip_code'] = $response_array[19];
             $authorizeNetResponse['country'] = $response_array[20];
             $authorizeNetResponse['phone'] = $response_array[21];
             $authorizeNetResponse['fax'] = $response_array[22];
             $authorizeNetResponse['email_address'] = $response_array[23];
             $authorizeNetResponse['ship_to_first_name'] = $response_array[24];
             $authorizeNetResponse['ship_to_last_name'] = $response_array[25];
             $authorizeNetResponse['ship_to_company'] = $response_array[26];
             $authorizeNetResponse['ship_to_address'] = $response_array[27];
             $authorizeNetResponse['ship_to_city'] = $response_array[28];
             $authorizeNetResponse['ship_to_state'] = $response_array[29];
             $authorizeNetResponse['ship_to_zip_code'] = $response_array[30];
             $authorizeNetResponse['ship_to_country'] = $response_array[31];
             $authorizeNetResponse['tax'] = $response_array[32];
             $authorizeNetResponse['duty'] = $response_array[33];
             $authorizeNetResponse['freight'] = $response_array[34];
             $authorizeNetResponse['tax_exempt'] = $response_array[35];
             $authorizeNetResponse['purchase_order_number'] = $response_array[36];
             $authorizeNetResponse['md5_hash'] = $response_array[37];
             $authorizeNetResponse['card_code_response'] = $response_array[38];
             $authorizeNetResponse['cavv_response'] = $response_array[39];
             //// cardholder_authentication_verification_response
             $authorizeNetResponse['account_number'] = $response_array[50];
             $authorizeNetResponse['card_type'] = $response_array[51];
             $authorizeNetResponse['split_tender_id'] = $response_array[52];
             $authorizeNetResponse['requested_amount'] = $response_array[53];
             $authorizeNetResponse['balance_on_card'] = $response_array[54];
         }
         /*
          * check the amount is the same as the amount sent
          */
         /* SUBCODE?? */
         $this->approved = $authorizeNetResponse['response_code'] == self::APPROVED;
         $this->declined = $authorizeNetResponse['response_code'] == self::DECLINED;
         $this->error = $authorizeNetResponse['response_code'] == self::ERROR;
         $this->held = $authorizeNetResponse['response_code'] == self::HELD;
         // Set custom fields: not used yet: could put the return context
         /*
          if ($count = count($custom_fields)) {
          $custom_fields_response = array_slice($response_array, -$count, $count);
          $i = 0;
          foreach ($custom_fields as $key => $value) {
          $this->$key = $custom_fields_response[$i];
          $i++;
          }
          }
         */
         $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($authorizeNetResponse['invoice_number']);
         if (!$virtuemart_order_id) {
             $this->approved = FALSE;
             $this->error = TRUE;
             $this->logInfo(JText::sprintf('VMPAYMENT_AUTHORIZENET_NO_ORDER_NUMBER', $authorizeNetResponse['invoice_number']), 'ERROR');
             //$this->sendEmailToVendorAndAdmins(JText::sprintf('VMPAYMENT_AUTHORIZENET_NO_ORDER_NUMBER', $authorizeNetResponse['invoice_number']), JText::sprintf('VMPAYMENT_AUTHORIZENET_ERROR_WHILE_PROCESSING_PAYMENT', $authorizeNetResponse['invoice_number']));
             $html = Jtext::sprintf('VMPAYMENT_AUTHORIZENET_ERROR', $authorizeNetResponse['response_reason_text'], $authorizeNetResponse['response_code']) . "<br />";
             $this->logInfo($html, 'PAYMENT DECLINED');
             return $html;
         }
         if ($this->error or $this->declined) {
             // Prepare data that should be stored in the database
             $dbValues['authorizenet_response_response_code'] = $authorizeNetResponse['response_code'];
             $dbValues['authorizenet_response_response_subcode'] = $authorizeNetResponse['response_subcode'];
             $dbValues['authorizenet_response_response_reason_code'] = $authorizeNetResponse['response_reason_code'];
             $dbValues['authorizenet_response_response_reason_text'] = $authorizeNetResponse['response_reason_text'];
             //$this->storePSPluginInternalData($dbValues, 'id', true);
             $html = Jtext::sprintf('VMPAYMENT_AUTHORIZENET_ERROR', $authorizeNetResponse['response_reason_text'], $authorizeNetResponse['response_code']) . "<br />";
             $this->logInfo($html, 'PAYMENT DECLINED');
             return $html;
         }
     } else {
         $this->approved = FALSE;
         $this->error = TRUE;
         $this->logInfo(JText::_('VMPAYMENT_AUTHORIZENET_CONNECTING_ERROR'), 'ERROR');
         $this->sendEmailToVendorAndAdmins(JText::_('VMPAYMENT_AUTHORIZENET_ERROR_EMAIL_SUBJECT'), JText::_('VMPAYMENT_AUTHORIZENET_CONNECTING_ERROR'));
         return JText::_('VMPAYMENT_AUTHORIZENET_CONNECTING_ERROR');
     }
     // Prep
     // get all know columns of the table
     $db = JFactory::getDBO();
     $query = 'SHOW COLUMNS FROM `' . $this->_tablename . '` ';
     $db->setQuery($query);
     $columns = $db->loadResultArray(0);
     foreach ($authorizeNetResponse as $key => $value) {
         $table_key = 'authorizenet_response_' . $key;
         if (in_array($table_key, $columns)) {
             $response_fields[$table_key] = $value;
         }
     }
     $response_fields['virtuemart_order_id'] = $virtuemart_order_id;
     $response_fields['invoice_number'] = $authorizeNetResponse['invoice_number'];
     $response_fields['authorizeresponse_raw'] = $response;
     $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', TRUE);
     $currencyModel = VmModel::getModel('Currency');
     $currency = $currencyModel->getCurrency($order['details']['BT']->user_currency_id);
     $html = '<table class="adminlist">' . "\n";
     $html .= $this->getHtmlRow('AUTHORIZENET_PAYMENT_NAME', $payment_name);
     $html .= $this->getHtmlRow('AUTHORIZENET_ORDER_NUMBER', $authorizeNetResponse['invoice_number']);
     $html .= $this->getHtmlRow('AUTHORIZENET_AMOUNT', $authorizeNetResponse['amount'] . ' ' . $currency->currency_name);
     //$html .= $this->getHtmlRow('AUTHORIZENET_RESPONSE_AUTHORIZATION_CODE', $authorizeNetResponse['authorization_code']);
     $html .= $this->getHtmlRow('AUTHORIZENET_RESPONSE_TRANSACTION_ID', $authorizeNetResponse['transaction_id']);
     $html .= '</table>' . "\n";
     $this->logInfo(JText::_('VMPAYMENT_AUTHORIZENET_ORDER_NUMBER') . " " . $authorizeNetResponse['invoice_number'] . ' payment approved', 'message');
     return $html;
 }
Esempio n. 5
0
 function plgVmConfirmedOrder($cart, $order)
 {
     if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
         return NULL;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $sessionKlarnaData = $this->getKlarnaSessionData();
     try {
         $result = KlarnaHandler::addTransaction($method, $order, $sessionKlarnaData->KLARNA_DATA['pclass']);
     } catch (Exception $e) {
         $log = $e->getMessage();
         vmError($e->getMessage() . ' #' . $e->getCode());
         //KlarnaHandler::redirectPaymentMethod('error', $e->getMessage() . ' #' . $e->getCode());
     }
     //vmdebug('addTransaction result', $result);
     // Delete all Klarna data
     //unset($sessionKlarnaData->KLARNA_DATA, $_SESSION['SSN_ADDR']);
     $shipTo = KlarnaHandler::getShipToAddress($cart);
     $modelOrder = VmModel::getModel('orders');
     if ($result['status_code'] == KlarnaFlags::DENIED) {
         $order['customer_notified'] = 0;
         $order['order_status'] = $method->status_denied;
         $order['comments'] = JText::sprintf('VMPAYMENT_KLARNA_PAYMENT_KLARNA_STATUS_DENIED');
         if ($method->delete_order) {
             $order['comments'] .= "<br />" . $result['status_text'];
         }
         $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, true);
         vmdebug('addTransaction remove order?', $method->delete_order);
         if ($method->delete_order) {
             $modelOrder->remove(array('virtuemart_order_id' => $order['details']['BT']->virtuemart_order_id));
         } else {
             $dbValues['order_number'] = $order['details']['BT']->order_number;
             $dbValues['payment_name'] = $this->renderKlarnaPluginName($method, $order['details']['BT']->virtuemart_country_id, $shipTo, $order['details']['BT']->order_total);
             $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
             $dbValues['order_payment'] = $order['details']['BT']->order_payment;
             $dbValues['klarna_pclass'] = $sessionKlarnaData->KLARNA_DATA['PCLASS'];
             $dbValues['klarna_log'] = $log;
             $dbValues['klarna_status_code'] = $result['status_code'];
             $dbValues['klarna_status_text'] = $result['status_text'];
             $this->storePSPluginInternalData($dbValues);
         }
         $app = JFactory::getApplication();
         $app->enqueueMessage($result['status_text']);
         $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=editpayment'), JText::_('COM_VIRTUEMART_CART_ORDERDONE_DATA_NOT_VALID'));
     } else {
         $invoiceno = $result[1];
         if ($invoiceno && is_numeric($invoiceno)) {
             //Get address id used for this order.
             $country = $sessionKlarnaData->KLARNA_DATA['country'];
             // $lang = KlarnaHandler::getLanguageForCountry($method, KlarnaHandler::convertToThreeLetterCode($country));
             // $d['order_payment_name'] = $kLang->fetch('MODULE_INVOICE_TEXT_TITLE', $lang);
             // Add a note in the log
             $log = Jtext::sprintf('VMPAYMENT_KLARNA_INVOICE_CREATED_SUCCESSFULLY', $invoiceno);
             // Prepare data that should be stored in the database
             $dbValues['order_number'] = $order['details']['BT']->order_number;
             $dbValues['payment_name'] = $this->renderKlarnaPluginName($method, $order['details']['BT']->virtuemart_country_id, $shipTo, $order['details']['BT']->order_total);
             $dbValues['virtuemart_paymentmethod_id'] = $order['details']['BT']->virtuemart_paymentmethod_id;
             $dbValues['order_payment'] = $order['details']['BT']->order_payment;
             $dbValues['order_payment_tax'] = $order['details']['BT']->order_payment_tax;
             $dbValues['klarna_pclass'] = $sessionKlarnaData->KLARNA_DATA['pclass'];
             $dbValues['klarna_invoice_no'] = $invoiceno;
             $dbValues['klarna_log'] = $log;
             $dbValues['klarna_eid'] = $result['eid'];
             $dbValues['klarna_status_code'] = $result['status_code'];
             $dbValues['klarna_status_text'] = $result['status_text'];
             $this->storePSPluginInternalData($dbValues);
             /*
              * Klarna's order status
              *  Integer - 1,2 or 3.
              *  1 = OK: KlarnaFlags::ACCEPTED
              *  2 = Pending: KlarnaFlags::PENDING
              *  3 = Denied: KlarnaFlags::DENIED
              */
             if ($result['status_code'] == KlarnaFlags::PENDING) {
                 /* if Klarna's order status is pending: add it in the history */
                 /* The order is under manual review and will be accepted or denied at a later stage.
                    Use cronjob with checkOrderStatus() or visit Klarna Online to check to see if the status has changed.
                    You should still show it to the customer as it was accepted, to avoid further attempts to fraud. */
                 $order['order_status'] = $method->status_pending;
             } else {
                 $order['order_status'] = $method->status_success;
             }
             $order['customer_notified'] = 1;
             $order['comments'] = $log;
             $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, true);
             $html = $this->renderByLayout('orderdone', array('payment_name' => $dbValues['payment_name'], 'klarna_invoiceno' => $invoiceno));
             $session = JFactory::getSession();
             $session->clear('Klarna', 'vm');
             //We delete the old stuff
             $cart->emptyCart();
             JRequest::setVar('html', $html);
             return true;
         } else {
             vmError('Error with invoice number');
         }
     }
 }
Esempio n. 6
0
fieldset select,
fieldset img,
fieldset button {
    float: none;
    margin: 5px 5px 5px 0;
    width: auto;
}
</style>
<div id="editcell">
	<fieldset class="adminform">
		<legend><?php 
echo JText::sprintf('COM_JOOMLEAGUE_ADMIN_MATCHES_TITLE2', '<i>' . $this->roundws->name . '</i>', '<i>' . $this->projectws->name . '</i>');
?>
</legend>
		<p class="note"><?php 
echo Jtext::sprintf('COM_JOOMLEAGUE_ADMIN_MATCHES_ALL_TIMES_IN_S_TZ', $this->projectws->timezone);
?>
</p>
		<?php 
echo $this->loadTemplate('roundselect');
?>
		<!-- Start games list -->
		<form action="<?php 
echo $this->request_url;
?>
" method="post" id='adminForm'>
			<?php 
$colspan = $this->projectws->allow_add_time ? 16 : 15;
?>
			<table class="adminlist table table-striped">
				<thead>
Esempio n. 7
0
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.5
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<div id="hikashop_product_waitlist_<?php 
echo JRequest::getInt('cid');
?>
_page" class="hikashop_product_waitlist_page">
	<div class="hikashop_product_waitlist_title"><?php 
$url = '<a href="' . $this->product_url . '">' . $this->product->product_name . '</a>';
echo Jtext::sprintf('WAITLIST_FOR_PRODUCT', $url);
?>
</div>
	<fieldset>
		<div class="toolbar" id="toolbar" style="float: right;">
			<button class="btn" type="button" onclick="submitform('add_waitlist');"><img src="<?php 
echo HIKASHOP_IMAGES;
?>
ok.png"/><?php 
echo JText::_('OK');
?>
</button>
			<button class="btn" type="button" onclick="history.back();"><img src="<?php 
echo HIKASHOP_IMAGES;
?>
cancel.png"/><?php 
Esempio n. 8
0
	/**
	 * Save updated order data to the method specific table
	 *
	 * @param array $order Form data
	 * @return mixed, True on success, false on failures (the rest of the save-process will be
	 * skipped!), or null when this method is not actived.

	 */
	public function plgVmOnUpdateOrderPayment (&$order, $old_order_status) {

		if (!$this->selectedThisByMethodId ($order->virtuemart_paymentmethod_id)) {
			return NULL; // Another method was selected, do nothing
		}

		if (!($method = $this->getVmPluginMethod ($order->virtuemart_paymentmethod_id))) {
			return NULL; // Another method was selected, do nothing
		}
		if (!($payments = $this->_getKlarnaInternalData ($order->virtuemart_order_id))) {
			vmError (JText::sprintf ('VMPAYMENT_KLARNA_ERROR_NO_DATA', $order->virtuemart_order_id));
			return NULL;
		}

		if (!($invNo = $this->_getKlarnaInvoiceNo ($payments))) {
			return NULL;
		}
		// to activate the order
		if ($order->order_status == $method->status_shipped) {
			$country = $this->getCountryCodeByOrderId ($order->virtuemart_order_id);
			$klarna_vm = new Klarna_virtuemart();
			$cData = KlarnaHandler::countryData ($method, $country);
			/*
		   * The activateInvoice function is used to activate a passive invoice.
		   * Please note that this function call cannot activate an invoice created in test mode.
		   * It is however possible to manually activate that type of invoices.
		   */
			$force_emailInvoice = FALSE;
			$klarna_vm->config ($cData['eid'], $cData['secret'], $cData['country_code'], NULL, $cData['currency_code'], KlarnaHandler::getKlarnaMode ($method, $cData['country_code_3']));

			try {
				//You can specify a new pclass ID if the customer wanted to change it before you activate.

				 $klarna_vm->activateInvoice ($invNo);
				$invoice_url=$this->getInvoice($invNo, $invoice_url);

				//The url points to a PDF file for the invoice.
				//Invoice activated, proceed accordingly.
			}
			catch (Exception $e) {
				$log = $e->getMessage () . " (#" . $e->getCode () . ")";
				if ($e->getCode () != 8111) { // (invoice_not_passive_or_frozen)
					$this->_updateKlarnaInternalData ($order, $log);
					VmError ($e->getMessage () . " (#" . $e->getCode () . ")");
					return FALSE;
				} else {
					$force_emailInvoice = TRUE;
				}
			}

			$emailInvoice = $this->emailInvoice ($method, $klarna_vm, $invNo, $force_emailInvoice);
			$dbValues['order_number'] = $order->order_number;
			$dbValues['virtuemart_order_id'] = $order->virtuemart_order_id;
			$dbValues['virtuemart_paymentmethod_id'] = $order->virtuemart_paymentmethod_id;
			$dbValues['klarna_invoice_no'] = $invNo;
			$dbValues['klarna_log'] = Jtext::sprintf ('VMPAYMENT_KLARNA_ACTIVATE_INVOICE', $invNo);
			if ($emailInvoice) {
				$dbValues['klarna_log'] .= "<br />" . Jtext::sprintf ('VMPAYMENT_KLARNA_EMAIL_INVOICE', $invNo);
			} else {
				$dbValues['klarna_log'] .= "<br />" . Jtext::_ ('VMPAYMENT_KLARNA_EMAIL_INVOICE_NOT_SENT');
			}
			$dbValues['klarna_eid'] = $cData['eid'];
			//$dbValues['klarna_status_code'] = KLARNA_INVOICE_ACTIVE; // Invoice is active
			//$dbValues['klarna_status_text'] = '';
			$dbValues['klarna_pdf_invoice'] = $invoice_url;

			$this->storePSPluginInternalData ($dbValues);
			return TRUE;
		}
		return NULL;
	}
Esempio n. 9
0
    $ownerUrl = CUrlHelper::userLink($act->actor);
    $target = CFactory::getUser($video->creator);
    $targetName = $user->getDisplayName();
    $targetUrl = CUrlHelper::userLink($video->creator);
    if (count($users) > 1) {
        if (count($users) == 2) {
            $activityString = JText::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OTHERS_VIDEO_TWO', CUrlHelper::userLink($user->id), $user->getDisplayName(), CUrlHelper::userLink($users[count($users) - 1]), CFactory::getUser($users[count($users) - 1])->getDisplayName(), $targetUrl, $target->getDisplayName(), $url);
        } else {
            $activityString = JText::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OTHERS_VIDEO_MORE', CUrlHelper::userLink($user->id), $user->getDisplayName(), 'onclick="joms.api.streamShowOthers(' . $act->id . ');return false;"', count($users) - 1, $targetUrl, $target->getDisplayName(), $url);
        }
    } else {
        $activityString = Jtext::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OTHERS_VIDEO', $ownerUrl, $targetName, $targetUrl, $target->getDisplayName(), $url);
    }
} else {
    //user comment on his own photo
    $activityString = Jtext::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OWN_VIDEO', CUrlHelper::userLink($user->id), $user->getDisplayName(), $url);
}
$isVideoModal = $config->get('video_mode') == 1;
if ($video->type === 'file') {
    $storage = CStorage::getStorage($video->storage);
    $path = $storage->getURI($video->path);
} else {
    $path = $video->path;
}
?>

<div class="joms-stream__header">
    <div class= "joms-avatar--stream">
        <a href="<?php 
echo CUrlHelper::userLink($user->id);
?>
} else {
    $createdTime = $date->format($config->get('profileDateFormat'));
}
$photo_info = $photo->getInfo();
$photo_size = $photo_info['size'];
//generate activity based on the photo owner
if ($photo->creator != $act->actor) {
    //if user a commented on user b photo, we need to pass in the user info
    $ownerUrl = CUrlHelper::userLink($act->actor);
    $target = CFactory::getUser($photo->creator);
    $targetName = $user->getDisplayName();
    $targetUrl = CUrlHelper::userLink($photo->creator);
    $activityString = Jtext::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OTHERS_PHOTO', $ownerUrl, $targetName, $targetUrl, $target->getDisplayName(), $url);
} else {
    //user comment on his own photo
    $activityString = Jtext::sprintf('COM_COMMUNITY_ACTIVITIES_COMMENT_OWN_PHOTO', $url, $user->getDisplayName(), $url);
}
?>
<div class="joms-stream-avatar">
	<a href="<?php 
echo CUrlHelper::userLink($user->id);
?>
">
		<img class="img-responsive joms-radius-rounded" data-author="<?php 
echo $user->id;
?>
" src="<?php 
echo $user->getThumbAvatar();
?>
">
	</a>
Esempio n. 11
0
 function install()
 {
     $extDir = JPATH_ROOT . '/components/com_sef/sef_ext';
     $db = $this->parent->getDBO();
     $this->manifest =& $this->parent->getManifest();
     $xml = $this->manifest;
     $name = (string) $xml->name;
     $name = JFilterInput::getInstance()->clean($name, 'string');
     $this->set('name', $name);
     $description = (string) $xml->description;
     if (is_a($description, 'JSimpleXMLElement')) {
         $this->parent->set('message', JText::_($description));
     } else {
         $this->parent->set('message', '');
     }
     if (count($xml->files->children())) {
         foreach ($xml->files->children() as $file) {
             if ((string) $file->attributes()->sef_ext) {
                 $element = (string) $file->attributes()->sef_ext;
                 if (substr($element, 0, 13) != 'ext_joomsef4_') {
                     $element = 'ext_joomsef4_' . $element;
                 }
                 $this->set('element', $element);
                 break;
             }
         }
     }
     if (!empty($element)) {
         $this->parent->setPath('extension_root', $extDir);
     } else {
         $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEFEXT_INSTALL_NO_FILE', JText::_('JLIB_INSTALLER_' . $this->route)));
         return false;
     }
     $this->route = 'install';
     $query = "SELECT extension_id, state, params \n";
     $query .= "FROM #__extensions \n";
     $query .= "WHERE type=" . $db->quote('sef_ext') . " \n";
     $query .= "AND element=" . $db->quote($element);
     $db->setQuery($query);
     $ext_o = $db->loadObject();
     if (!is_null($ext_o)) {
         $id = $ext_o->extension_id;
     } else {
         $id = null;
     }
     if (file_exists($this->parent->getPath('extension_root')) && (!$this->parent->isOverwrite() || $this->parent->isUpgrade())) {
         if ($this->parent->isUpgrade() || ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'update') || is_a($xml->update, 'SimpleXMLElement'))) {
             $this->parent->setOverwrite(true);
             $this->parent->setUpgrade(true);
             if ($id && $ext_o->state != -2) {
                 $this->route = 'update';
             }
         } else {
             if (!$this->parent->isOverwrite()) {
                 $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEFEXT_INSTALL_DIRECTORY', JText::_('JLIB_INSTALLER_' . $this->route), $this->parent->getPath('extension_root')));
             }
         }
     }
     if ((string) $xml->scriptfile) {
         $script = (string) $xml->scriptfile;
         $script_file = $this->parent->getPath('source') . '/' . $script;
         if (is_file($script_file)) {
             include_once $script_file;
             $class = $element . 'InstallerScript';
             if (class_exists($class)) {
                 $this->parent->manifestClass = new $class($this);
                 $this->set('manifest_script', $script);
             }
         }
     }
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'preflight')) {
         if ($this->parent->manifestClass->preflight($this->route, $this) === false) {
             $this->parent->abort(JText::_('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_CUSTOM_INSTALL_FAILURE'));
             return false;
         }
     }
     $msg = ob_get_contents();
     ob_end_clean();
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (JFolder::create($this->parent->getPath('extension_root'))) {
             $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_CREATE_DIRECTORY', $this->parent->getPath('extension_root')));
             return false;
         }
     }
     $this->old_files = null;
     if ($this->route == 'update') {
         $old = null;
         $tmp = new JInstaller();
         $option = str_replace('ext_joomsef4_', 'com_', $this->get('element'));
         $tmp_manifest = $tmp->isManifest($this->parent->getPath('extension_root') . '/' . $option . '.xml');
         if ($tmp_manifest) {
             $this->old_files = $tmp_manifest->files;
         }
     }
     if (!$this->parent->parseFiles($xml->files, -1, $this->old_files)) {
         $this->parent->abort();
         return false;
     }
     if ($this->get('manifest_script')) {
         $path['src'] = $this->parent->getPath('source') . '/' . $this->get('manifest_script');
         $path['dest'] = $this->parent->getPath('extension_root') . '/' . $this->get('manifest_script');
         if (!file_exists($path['desc'])) {
             if (!$this->parent->copyFiles(array($path))) {
                 $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_MANIFEST', JText::_('JLIB_INSTALLER_' . $this->route)));
                 return false;
             }
         }
     }
     JTable::addIncludePath(JPATH_LIBRARIES . '/joomla/database/table');
     $row = JTable::getInstance('extension');
     if ($id && $ext_o->state != -2) {
         $row->load($id);
         $row->name = $this->get('name');
         $row->manifest_cache = $this->parent->generateManifestCache();
         $row->store();
     } else {
         if (is_object($ext_o) && $ext_o->state == -2) {
             $row->extension_id = $id;
         }
         $row->name = $this->get('name');
         $row->type = 'sef_ext';
         $row->element = $element;
         $row->enabled = 1;
         $row->protected = 0;
         $row->access = 1;
         $row->client_id = 0;
         $row->state = 0;
         if (!is_object($ext_o) || $ext_o->state != -2) {
             if (isset($this->manifest->install->defaultParams)) {
                 $row->params = SEFTools::getDefaultParams($this->manifest->install->defaultParams);
             }
             if (isset($this->manifest->install->defaultFilters)) {
                 $row->custom_data = SEFTools::getDefaultFilters($this->manifest->install->defaultFilters);
             }
         }
         $row->system_data = '';
         $row->manifest_cache = $this->parent->generateManifestCache();
         if (!$row->store()) {
             $this->parent->abort(Jtext::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_ROLLBACK', JText::_('JLIB_INSTALLER_' . $this->route), $db->stderr(true)));
             return false;
         }
         $this->parent->pushStep(array('type' => 'extension', 'id' => $row->extension_id));
         $id = $row->extension_id;
     }
     if ($this->route == 'install') {
         $utfresult = $this->parent->parseSQLFiles($this->manifest->install->sql);
         if ($utfresult === false) {
             // Install failed, rollback changes
             $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_SQL_ERROR', JText::_('JLIB_INSTALLER_' . $this->route), $db->stderr(true)));
             return false;
         }
         if ($this->manifest->update) {
             $this->parent->setSchemaVersion($this->manifest->update->schemas, $row->extension_id);
         } else {
             $query = "SELECT COUNT(*) FROM #__schemas \n";
             $query .= "WHERE extension_id=" . $row->extension_id;
             $db->setQuery($query);
             $cnt = $db->loadResult();
             if ($cnt == 0) {
                 $query = "INSERT INTO #__schemas \n";
                 $query .= "SET extension_id=" . $row->extension_id . ", version_id=" . $db->quote((string) $xml->version);
             } else {
                 $query = "UPDATE #__schemas \n";
                 $query .= "SET version_id=" . $db->quote((string) $xml->version) . " \n";
                 $query .= "WHERE extension_id=" . $row->extension_id . " \n";
             }
             $db->setQuery($query);
             $db->query();
         }
     } else {
         if ($this->manifest->update) {
             if (isset($this->manifest->update->schemas)) {
                 $result = $this->parent->parseSchemaUpdates($this->manifest->update->schemas, $row->extension_id);
                 if ($result === false) {
                     $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_UPDATE_SQL_ERROR', JText::_('JLIB_INSTALLER_' . $this->route), $db->stderr(true)));
                     return false;
                 }
             }
         } else {
             $query = "SELECT COUNT(*) FROM #__schemas \n";
             $query .= "WHERE extension_id=" . $row->extension_id;
             $db->setQuery($query);
             $cnt = $db->loadResult();
             if ($cnt == 0) {
                 $query = "INSERT INTO #__schemas \n";
                 $query .= "SET extension_id=" . $row->extension_id . ", version_id=" . $db->quote((string) $xml->version);
             } else {
                 $query = "UPDATE #__schemas \n";
                 $query .= "SET version_id=" . $db->quote((string) $xml->version) . " \n";
                 $query .= "WHERE extension_id=" . $row->extension_id . " \n";
             }
             $db->setQuery($query);
             $db->query();
         }
     }
     // Remove any pending updates in Joomla update cache
     $update = JTable::getInstance('update');
     $uid = $update->find(array('element' => $element, 'type' => 'sef_ext', 'client_id' => '', 'folder' => ''));
     if ($uid) {
         $update->delete($uid);
     }
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, $this->route)) {
         if ($this->parent->manifestClass->{$this->route}($this) === false) {
             $this->parent->abort(JText::_('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_CUSTOM_INSTALL_FAILURE'));
             return false;
         }
     }
     $msg .= ob_get_contents();
     ob_end_clean();
     if (!$this->parent->copyManifest(-1)) {
         $this->parent->abort(JText::sprintf('COM_SEF_INSTALLER_ABORT_SEF_INSTALL_COPY_SETUP', JText::_('JLIB_INSTALLER_' . $this->route)));
         return false;
     }
     ob_start();
     ob_implicit_flush(false);
     if ($this->parent->manifestClass && method_exists($this->parent->manifestClass, 'postflight')) {
         $this->parent->manifestClass->postflight($this->route, $this);
     }
     $msg .= ob_get_contents();
     ob_end_clean();
     if ($msg != '') {
         $this->parent->set('extension_message', $msg);
     }
     // Remove already created URLs for this extension from database
     // 25.4.2012: Only remove automatic URLs that are not locked!
     $component = str_replace('ext_joomsef4_', 'com_', $element);
     $query = "DELETE FROM `#__sefurls` WHERE (`origurl` LIKE '%option={$component}&%' OR `origurl` LIKE '%option={$component}') AND `dateadd` = '0000-00-00' AND `locked` = 0";
     $db->setQuery($query);
     if (!$db->query()) {
         $this->parent->abort(JText::_('COM_SEF_SEF_EXTENSION') . ' ' . JText::_('COM_SEF_INSTALL') . ': ' . JText::_('COM_SEF_ERROR_SQL') . " " . $db->stderr(true));
         return false;
     }
     return $id;
 }
Esempio n. 12
0
 /**
  * batch convert project dates to utc
  * 
  * this is for converting former projects
  */
 public function fixdates()
 {
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     JArrayHelper::toInteger($cid);
     $msg = array();
     $type = 'message';
     if (!$cid) {
         $this->setRedirect('index.php?option=com_joomleague&view=projects&task=project.display', '', $type);
         return;
     }
     foreach ($cid as $project_id) {
         $model = $this->getModel("project");
         if (!($res = $model->utc_fix_dates($project_id))) {
             $msg[] = $model->getError();
             $type = 'error';
         } else {
             $msg[] = Jtext::sprintf('COM_JOOMLEAGUE_ADMIN_PROJECTS_SUCCESSULLY_CONVERTED_PROJECT_D', $project_id);
         }
     }
     $this->setRedirect('index.php?option=com_joomleague&view=projects&task=project.display', implode($msg, "<br/>"), $type);
 }
Esempio n. 13
0
            echo JText::sprintf('MOD_VMCOUPONSREPORT_INVALID_TEXT');
        }
        $expiration_date = null;
    } elseif ($item->amounttype == 1) {
        echo JText::sprintf('MOD_VMCOUPONSREPORT_USER_LABEL_AMOUNT', $item->awd_amount);
        $todays_date = date("Y-m-d H:i:s");
        $today = strtotime($todays_date);
        $expiration_date = $item->validity;
        $couponname = $item->name;
        echo Jtext::sprintf('mod_VMCouponsReport_COUPON_CODE');
        echo $couponname;
        if ($expiration_date > $today && $item->remain_use > 0) {
            ?>
 <strong> <?php 
            echo "<br>";
            echo Jtext::sprintf('MOD_VMCOUPONSREPORT_VALIDITY_TEXT');
            echo date('d-m-Y H:i:s', $item->validity);
            ?>
 </strong> <?php 
        } else {
            echo JText::sprintf('MOD_VMCOUPONSREPORT_INVALID_TEXT');
        }
        $expiration_date = null;
    }
    ?>
    </li>
    <?php 
}
?>
</ul>
Esempio n. 14
0
 /**
  * method to update the database structure from a 2.0 version
  * 
  */
 public function updateFrom20()
 {
     $db =& JFactory::getDbo();
     $dbDriver = strtolower($db->name);
     if ($dbDriver == 'mysqli') {
         $dbDriver = 'mysql';
     } elseif ($dbDriver == 'sqlsrv') {
         $dbDriver = 'sqlazure';
     }
     $basepath = JPATH_ADMINISTRATOR . '/components/com_redevent/sql/updates/' . $dbDriver;
     $files = str_replace('.sql', '', JFolder::files($basepath, '\\.sql$'));
     usort($files, 'version_compare');
     if (!count($files)) {
         return false;
     }
     // equivalent version
     $version = '2.5.b.3.0';
     // We have a version!
     foreach ($files as $file) {
         if (version_compare($file, $version) > 0) {
             $buffer = file_get_contents($basepath . '/' . $file . '.sql');
             // Graceful exit and rollback if read not successful
             if ($buffer === false) {
                 JError::raiseWarning(1, JText::_('JLIB_INSTALLER_ERROR_SQL_READBUFFER'));
                 return false;
             }
             // Create an array of queries from the sql file
             $queries = JInstallerHelper::splitSql($buffer);
             if (count($queries) == 0) {
                 // No queries to process
                 continue;
             }
             // Process each query in the $queries array (split out of sql file).
             foreach ($queries as $query) {
                 $query = trim($query);
                 if ($query != '' && $query[0] != '#') {
                     $db->setQuery($query);
                     if (!$db->query()) {
                         JError::raiseWarning(1, JText::sprintf('JLIB_INSTALLER_ERROR_SQL_ERROR', $db->stderr(true)));
                         return false;
                     }
                 }
             }
             echo Jtext::sprintf('COM_REDEVENT_UPDATED_DB_TO', $file) . '<br/>';
         }
     }
 }
Esempio n. 15
0
    ?>
</td>
				<td><?php 
    echo $row->course_code . '-' . $row->xref . '-' . $row->attendee_id;
    ?>
</td>
				<td><?php 
    echo $row->name;
    ?>
</td>
				<td>
				  <?php 
    if (!$row->confirmed) {
        echo JHTML::link('javascript: void(0);', JHTML::_('image', 'admin/publish_x.png', JText::_('JNO'), null, true), array('onclick' => 'return listItemTask(\'cb' . $i . '\', \'confirmattendees\');', 'class' => 'hasTip', 'title' => Jtext::_('COM_REDEVENT_REGISTRATION_NOT_ACTIVATED') . '::' . Jtext::_('COM_REDEVENT_CLICK_TO_ACTIVATE')));
    } else {
        $tip = Jtext::_('COM_REDEVENT_REGISTRATION_ACTIVATED') . '::' . Jtext::sprintf('COM_REDEVENT_REGISTRATION_ACTIVATED_ON_S', JHTML::Date($row->confirmdate, JText::_('DATE_FORMAT_LC2')));
        echo JHTML::link('javascript: void(0);', JHTML::_('image', 'admin/tick.png', JText::_('JYES'), null, true), array('onclick' => 'return listItemTask(\'cb' . $i . '\', \'unconfirmattendees\');', 'class' => 'hasTip', 'title' => $tip));
    }
    ?>
				</td>
				<td>
					<?php 
    if (!$row->maxattendees) {
        // no waiting list
        ?>
					<?php 
        echo '-';
        ?>
					
          <?php 
    } else {
Esempio n. 16
0
            }
        }
        ?>
				</td>
				<td>
					<?php 
        if (isset($this->eventvenues[$row->id])) {
            ?>
						<?php 
            echo JHTML::link('index.php?option=com_redevent&view=sessions&eventid=' . $row->id, Jtext::sprintf('COM_REDEVENT_SESSIONS_LINK', $this->eventvenues[$row->id]->total, $this->eventvenues[$row->id]->unpublished, $this->eventvenues[$row->id]->published, $this->eventvenues[$row->id]->archived, $this->eventvenues[$row->id]->featured), array('class' => 'hasTip', 'title' => Jtext::_('COM_REDEVENT_SESSIONS_LINK_TIP_TITLE') . '::' . Jtext::sprintf('COM_REDEVENT_SESSIONS_LINK_TIP', $this->eventvenues[$row->id]->unpublished, $this->eventvenues[$row->id]->published, $this->eventvenues[$row->id]->archived, $this->eventvenues[$row->id]->featured)));
            ?>
					<?php 
        } else {
            ?>
						<?php 
            echo JHTML::link('index.php?option=com_redevent&view=sessions&eventid=' . $row->id, Jtext::sprintf('COM_REDEVENT_0_SESSION_LINK'));
            ?>
					<?php 
        }
        ?>
				</td>
				<td align="center"><?php 
        echo $published;
        ?>
</td>
				<td>
					<?php 
        echo JText::_('COM_REDEVENT_AUTHOR') . ': ';
        ?>
<a href="<?php 
        echo 'index.php?option=com_users&amp;task=edit&amp;hidemainmenu=1&amp;cid[]=' . $row->created_by;