function display($tpl = null) { $app = JFactory::getApplication(); $params = clone $app->getParams('com_rsmembership'); $this->params = $params; $this->item = $this->get('Item'); if (empty($this->item->id) || !$this->item->published) { JError::raiseWarning(500, JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_NOT_EXIST')); $app->redirect(JRoute::_(RSMembershipRoute::Memberships())); } $currency = RSMembershipHelper::getConfig('currency'); // {price} placeholder $price = RSMembershipHelper::getPriceFormat($this->item->price); // {extras} placeholder $viewclass = RSMembershipHelper::isJ3() ? 'JViewLegacy' : 'JView'; if ($viewclass == 'JView') { jimport('joomla.application.component.view'); } $view = new $viewclass(array('name' => 'extras', 'base_path' => JPATH_SITE . '/components/com_rsmembership')); $view->model = JModelLegacy::getInstance('Extras', 'RSMembershipModel'); $view->extras = $view->model->getItems(); $view->item = $this->item; $view->show_subscribe_btn = $this->item->stock == -1 ? false : true; $this->extras = $view->loadTemplate(); $placeholders = array('{price}' => $price, '{buy}' => '', '{extras}' => '', '{stock}' => $this->item->stock > -1 ? $this->item->stock == 0 ? JText::_('COM_RSMEMBERSHIP_UNLIMITED') : $this->item->stock : JText::_('COM_RSMEMBERSHIP_OUT_OF_STOCK_PLACEHOLDER'), '<hr id="system-readmore" />' => ''); $replace = array_keys($placeholders); $with = array_values($placeholders); $this->item->description = str_replace($replace, $with, $this->item->description); // prepare the Pathway $pathway = $app->getPathway(); $this->Itemid = JFactory::getApplication()->input->get('Itemid', 0, 'int'); $layout = JFactory::getApplication()->input->get('layout', '', 'cmd'); if ($this->item->category_id) { $pathway->addItem($this->item->category_name, JRoute::_(RSMembershipRoute::Memberships($this->item->category_id, $this->Itemid, $layout))); } $pathway->addItem($this->item->name, ''); // Title if (!$params->get('page_title')) { $this->document->setTitle($this->item->name); } else { $this->document->setTitle($params->get('page_title') . ' - ' . $this->item->name); } // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } parent::display(); }
public function display($tpl = null) { $app = JFactory::getApplication(); $pathway = $app->getPathway(); // Set pathway $pathway->addItem(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP'), ''); // Set params $this->params = clone $app->getParams('com_rsmembership'); if ($terms = $this->get('terms')) { $this->terms = $terms; $this->action = $this->escape(JRoute::_(JURI::getInstance(), false)); parent::display('terms'); } else { $this->cid = $this->get('cid'); $this->membership = $this->get('membership'); $this->membershipterms = $this->get('membershipterms'); $this->boughtextras = $this->get('boughtextras'); $this->extras = $this->get('extras'); $upgrades_array = $this->get('upgrades'); $upgrades = array(); foreach ($upgrades_array as $upgrade) { $upgrades[] = JHTML::_('select.option', $upgrade->membership_to_id, $upgrade->name . ' - ' . RSMembershipHelper::getPriceFormat($upgrade->price)); } $has_upgrades = !empty($upgrades); $this->has_upgrades = $has_upgrades; $lists['upgrades'] = JHTML::_('select.genericlist', $upgrades, 'to_id', 'class="inputbox input-medium"'); $this->folders = $this->get('folders'); $this->files = $this->get('files'); $this->previous = $this->get('previous'); $this->from = $this->get('from'); $this->lists = $lists; $Itemid = $app->input->get('Itemid', 0, 'int'); $this->Itemid = ''; if ($Itemid > 0) { $this->Itemid = '&Itemid=' . $Itemid; } $this->currency = RSMembershipHelper::getConfig('currency'); // get the logged user $this->user = JFactory::getUser(); $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->membership_id, false, $this->user->id, true, $this->membership->last_transaction_id); parent::display(); } }
function onMembershipPayment($plugin, $data, $extra, $membership, &$transaction) { $this->loadLanguage('plg_system_rsmembership', JPATH_ADMINISTRATOR); $this->loadLanguage('plg_system_rsmembershipwire', JPATH_ADMINISTRATOR); if (!$this->canRun()) { return; } if (!preg_match('#rsmembershipwire([0-9]+)#', $plugin, $match)) { return false; } $id = (int) $match[1]; $db =& JFactory::getDBO(); $db->setQuery("SELECT * FROM #__rsmembership_payments WHERE `id`='" . $id . "'"); $payment = $db->loadObject(); $tax_value = $payment->tax_value; if (!empty($tax_value)) { $tax_type = $payment->tax_type; // percent ? if ($tax_type == 0) { $tax_value = $transaction->price * ($tax_value / 100); } $transaction->price = $transaction->price + $tax_value; } $html = ''; $html .= $payment->details; $replace = array('{price}', '{membership}'); $with = array(RSMembershipHelper::getPriceFormat($transaction->price), $membership->name); $html = str_replace($replace, $with, $html); $html .= '<form method="post" action="' . JRoute::_('index.php?option=com_rsmembership&task=thankyou') . '">'; $html .= '<input class="button" type="submit" value="' . JText::_('RSM_CONTINUE') . '" />'; $html .= '<input type="hidden" name="option" value="com_rsmembership" />'; $html .= '<input type="hidden" name="task" value="thankyou" />'; $html .= '</form>'; // No hash for this $transaction->hash = ''; $transaction->gateway = $payment->name; if ($membership->activation == 2) { $transaction->status = 'completed'; } return $html; }
function display($tpl = null) { $app = JFactory::getApplication(); // get parameters $params = clone $app->getParams('com_rsmembership'); $pathway = $app->getPathway(); $pathway->addItem(JText::_('COM_RSMEMBERSHIP_UPGRADE'), ''); // token $token = JHTML::_('form.token'); // get the logged user $this->user = JFactory::getUser(); // the new membership id $this->cid = $this->get('cid'); // get the current layout $layout = $this->getLayout(); if ($layout == 'default') { $this->payments = RSMembership::getPlugins(); // get the encoded return url $this->return = base64_encode(JURI::getInstance()); $this->data = $this->get('data'); // get the upgrade $this->upgrade = $this->get('upgrade'); // price $this->total = RSMembershipHelper::getPriceFormat($this->upgrade->price); $this->fields = RSMembershipHelper::getFields(true); $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->upgrade->membership_to_id); $this->membership_fields = RSMembershipHelper::getMembershipFields($this->upgrade->membership_to_id, true, $this->user->id, true); $this->membershipterms = $this->get('membershipterms'); } elseif ($layout == 'payment') { $this->html = $this->get('html'); } $this->config = RSMembershipHelper::getConfig(); $this->params = $params; $this->token = $token; $this->currency = RSMembershipHelper::getConfig('currency'); parent::display(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); // get parameters $params = clone $mainframe->getParams('com_rsmembership'); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('RSM_UPGRADE'), ''); // token $token = JHTML::_('form.token'); // get the current layout $layout = $this->getLayout(); if ($layout == 'default') { $this->assign('payments', RSMembership::getPlugins()); // get the encoded return url $return = base64_encode(JRequest::getURI()); $this->assignRef('return', $return); $data = $this->get('data'); $this->assignRef('data', $data); // get the upgrade $upgrade = $this->get('upgrade'); $this->assignRef('upgrade', $upgrade); // price $this->assign('total', RSMembershipHelper::getPriceFormat($upgrade->price)); $this->assignRef('fields', RSMembershipHelper::getFields(false)); $this->assignRef('membershipterms', $this->get('membershipterms')); } elseif ($layout == 'payment') { $this->assignRef('html', $this->get('html')); } $this->assignRef('cid', $this->get('cid')); $this->assignRef('config', $this->get('config')); $this->assignRef('params', $params); $this->assignRef('user', $this->get('user')); $this->assignRef('token', $token); $this->assign('currency', RSMembershipHelper::getConfig('currency')); parent::display(); }
echo $this->cache->memberships[$params['membership_id']]; } break; } ?> </td> <td><?php echo RSMembershipHelper::showDate($row->date); ?> </td> <td><?php echo $this->escape($row->ip); ?> </td> <td><?php echo RSMembershipHelper::getPriceFormat($row->price); ?> </td> <td><?php echo JText::_('COM_RSMEMBERSHIP_TRANSACTION_STATUS_' . strtoupper($row->status)); ?> </td> <td><?php echo $this->escape($row->gateway); ?> </td> <td><?php echo empty($row->hash) ? '<em>' . JText::_('COM_RSMEMBERSHIP_NO_HASH') . '</em>' : $this->escape($row->hash); ?> </td> </tr>
:</td> <td><?php echo $this->extra->name; ?> - <?php echo RSMembershipHelper::getPriceFormat($this->extra->price); ?> </td> </tr> <tr> <td width="30%" height="40"><?php echo JText::_('COM_RSMEMBERSHIP_TOTAL_COST'); ?> :</td> <td><?php echo RSMembershipHelper::getPriceFormat($this->extra->price); ?> </td> </tr> </table> </div><!-- .item-page --> <div class="item-page"> <h3 class="page-header"><?php echo JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION'); ?> </h3> <table cellpadding="0" cellspacing="0" border="0" width="100%" class="rsmembership_form_table"> <tr> <td width="30%" height="40"><?php echo JText::_('COM_RSMEMBERSHIP_NAME');
echo JRoute::_('index.php?option=com_rsmembership&controller=coupons&task=edit&cid=' . $row->id); ?> "><?php echo $row->name != '' ? $row->name : JText::_('RSM_NO_TITLE'); ?> </a></td> <td nowrap="nowrap"><?php echo $row->date_start ? date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($row->date_start)) : '-'; ?> </td> <td nowrap="nowrap"><?php echo $row->date_end ? date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($row->date_end)) : '-'; ?> </td> <td><?php echo $row->discount_type ? RSMembershipHelper::getPriceFormat($row->discount_price) : $row->discount_price . '%'; ?> </td> <td align="center"><?php echo JHTML::_('grid.published', $row, $i); ?> </td> </tr> <?php $i++; $k = 1 - $k; } ?> <tfoot> <tr> <td colspan="9"><?php
function onMembershipPayment($plugin, $data, $extra, $membership, &$transaction) { if (!$this->canRun()) { return; } if ($plugin != $this->_plugin->name) { return false; } $this->loadLanguage('plg_system_rsmembership'); $this->loadLanguage('plg_system_rsmembershipauthorize'); $document =& JFactory::getDocument(); $document->addScript(JURI::root() . 'plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/script.js'); $document->addStyleSheet(JURI::root() . 'plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/style.css'); JHTML::_('behavior.tooltip'); $fields = $this->_getFields(); $transaction->gateway = 'Authorize.Net'; $html = ''; $html .= '<form method="post" class="rsmembership_form" action="' . JRoute::_('index.php?option=com_rsmembership&task=thankyou') . '" onsubmit="return rsm_check_authorize(\'' . JRoute::_('index.php?option=com_rsmembership&plugin_task=authorize') . '\');">'; $html .= '<fieldset>'; $html .= '<legend>' . JText::_('RSM_AUTHORIZE_CARD_INFO') . '</legend>'; $html .= '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="rsmembership_form_table">'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_image'][0] . '</td>'; $html .= '<td>' . $fields['cc_image'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_number'][0] . '</td>'; $html .= '<td>' . $fields['cc_number'][1] . ' ' . $fields['csc_number'][0] . ' ' . $fields['csc_number'][1] . ' <span id="rsm_whats_csc" onmouseover="rsm_tooltip.show(\'rsm_tooltip\');" onmouseout="rsm_tooltip.hide();">' . JText::_('RSM_AUTHORIZE_WHATS_CSC') . '</span></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . JText::_('RSM_AUTHORIZE_EXP_DATE') . '</td>'; $html .= '<td>' . $fields['cc_exp_mm'][0] . ' ' . $fields['cc_exp_mm'][1] . ' ' . $fields['cc_exp_yy'][0] . ' ' . $fields['cc_exp_yy'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_fname'][0] . '</td>'; $html .= '<td>' . $fields['cc_fname'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_lname'][0] . '</td>'; $html .= '<td>' . $fields['cc_lname'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40" colspan="2">' . JText::sprintf('RSM_AUTHORIZE_PRICE_DESC', RSMembershipHelper::getPriceFormat($transaction->price)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</fieldset>'; $html .= '<input class="button" type="submit" id="rsm_pay_button" value="' . JText::_('RSM_AUTHORIZE_PAY_NOW') . '" />'; $html .= JHTML::image('components/com_rsmembership/assets/images/load.gif', 'Loading', 'id="rsm_loading" style="display: none;"'); $html .= '<input type="hidden" name="membership_id" id="membership_id" value="' . $membership->id . '" />'; $html .= '<input type="hidden" name="option" value="com_rsmembership" />'; $html .= '<input type="hidden" name="task" value="thankyou" />'; $html .= '</form>'; $html .= '<div id="rsm_response" class="rsm_response_error">'; $html .= '</div>'; $html .= '<div id="rsm_tooltip" style="display: none;">'; if (RSMembershipHelper::isJ16()) { $html .= '<div>' . JText::_('RSM_AUTHORIZE_WHATS_CSC_DESC', true) . '</div><div align="center">' . JHTML::image('plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/images/cc_csc.gif', 'CSC') . '</div>'; } $html .= '</div>'; $warning = JHTML::image('plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/images/warning.png', 'Warning', array('id' => 'rsm_warning')); $html .= '<script type="text/javascript">'; $html .= 'function rsm_get_error_message(code) {'; $html .= 'if (code == 0) return \'' . $warning . ' ' . JText::_('RSM_AUTHORIZE_ERRORS', true) . '\';'; $html .= '}'; $html .= '</script>'; return $html; }
echo $this->cache->memberships[$params['membership_id']]; } break; } ?> </td> <td width="1%" nowrap="nowrap"><?php echo date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($row->date)); ?> </td> <td width="1%" nowrap="nowrap"><?php echo $this->escape($row->ip); ?> </td> <td><?php echo RSMembershipHelper::getPriceFormat($row->price, $row->currency); ?> </td> <td><?php echo strlen($row->coupon) == 0 ? '<em>' . JText::_('RSM_NO_COUPON') . '</em>' : $this->escape($row->coupon); ?> </td> <td><?php echo JText::_('RSM_TRANSACTION_STATUS_' . strtoupper($row->status)); ?> <a href="<?php echo JRoute::_('index.php?option=com_rsmembership&view=transactions&layout=log&cid=' . $row->id . '&tmpl=component'); ?> " class="modal" rel="{handler: 'iframe', size: {x: 660, y: 475}}"><?php echo JText::_('RSM_TRANSACTION_VIEW_LOG'); ?>
?> " > <td align="right"><?php echo $this->pagination->getRowOffset($i); ?> </td> <td><?php echo JText::_('RSM_TRANSACTION_' . strtoupper($item->type)); ?> </td> <td><?php echo date($this->date_format, RSMembershipHelper::getCurrentDate($item->date)); ?> </td> <td><?php echo RSMembershipHelper::getPriceFormat($item->price); ?> </td> <td><?php echo $item->gateway; ?> </td> <td><?php echo JText::_('RSM_TRANSACTION_STATUS_' . strtoupper($item->status)); ?> </td> </tr> <?php $k = $k == 1 ? 2 : 1; $i++; }
if (!empty($params['extras'])) { foreach ($params['extras'] as $extra) { echo $this->cache->extra_values[$extra] . '<br />'; } } break; case 'renew': if (!empty($params['membership_id'])) { echo $this->cache->memberships[$params['membership_id']]; } break; } ?> </td> <td class="text-right"><?php echo $this->escape(RSMembershipHelper::getPriceFormat($row->price, $row->currency)); ?> </td> <td><?php echo strlen($row->coupon) == 0 ? '<em>' . JText::_('COM_RSMEMBERSHIP_NO_COUPON') . '</em>' : $this->escape($row->coupon); ?> </td> <td><?php echo JText::_('COM_RSMEMBERSHIP_TRANSACTION_STATUS_' . strtoupper($row->status)); ?> <a href="<?php echo JRoute::_('index.php?option=com_rsmembership&view=transactions&layout=log&cid=' . $row->id . '&tmpl=component'); ?> " class="modal" rel="{handler: 'iframe', size: {x: 660, y: 475}}"><?php echo JText::_('COM_RSMEMBERSHIP_TRANSACTION_VIEW_LOG'); ?>
case 'renew': if (!empty($params['membership_id'])) { echo $this->cache->memberships[$params['membership_id']]; } break; } ?> </td> </tr> <tr> <td width="200"><?php echo JText::_('COM_RSMEMBERSHIP_PRICE'); ?> </td> <td><?php echo $this->escape(RSMembershipHelper::getPriceFormat($this->item->transaction_data->price, $this->item->transaction_data->currency)); ?> </td> </tr> <tr> <td width="200"><?php echo JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_COUPON'); ?> </td> <td><?php echo strlen($this->item->transaction_data->coupon) == 0 ? '<em>' . JText::_('COM_RSMEMBERSHIP_NO_COUPON') . '</em>' : $this->escape($this->item->transaction_data->coupon); ?> </td> </tr> <tr> <td width="200"><?php
public static function deny($transaction_id, $force = false) { JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_rsmembership/tables'); $db = JFactory::getDBO(); $query = $db->getQuery(true); // Load the transaction $query->select($db->qn('id'))->from($db->qn('#__rsmembership_transactions'))->where($db->qn('id') . '=' . $db->q($transaction_id)); if (!$force) { $query->where($db->qn('status') . ' != ' . $db->q('denied')); } $db->setQuery($query); if ($id = $db->loadResult()) { $transaction = JTable::getInstance('Transaction', 'RSMembershipTable'); $transaction->load($id); } else { return false; } // Set the transaction to 'denied' $updateTransaction = JTable::getInstance('Transaction', 'RSMembershipTable'); $updateTransaction->save(array('id' => $transaction->id, 'status' => 'denied')); $params = RSMembershipHelper::parseParams($transaction->params); $membership_id = false; switch ($transaction->type) { case 'renew': case 'new': if (!empty($params['membership_id'])) { $membership_id = $params['membership_id']; } break; case 'upgrade': if (!empty($params['to_id'])) { $membership_id = $params['to_id']; } break; case 'addextra': if (!empty($params['id'])) { $query->clear(); $query->select($db->qn('membership_id'))->from($db->qn('#__rsmembership_membership_subscribers'))->where($db->qn('id') . ' = ' . $db->q((int) $params['id'])); $db->setQuery($query); $membership_id = $db->loadResult(); } break; } // start sending emails if ($membership_id) { $query->clear(); $query->select('*')->from($db->qn('#__rsmembership_memberships'))->where($db->qn('id') . ' = ' . $db->q((int) $membership_id) . ' AND ( ' . $db->qn('user_email_denied_subject') . ' != ' . $db->q('') . ' OR ' . $db->qn('admin_email_denied_subject') . ' != ' . $db->q('') . ' )'); $db->setQuery($query); if ($membership = $db->loadObject()) { $jconfig = JFactory::getConfig(); $membership->user_email_from_addr = $membership->user_email_use_global ? $jconfig->get('mailfrom') : $membership->user_email_from_addr; $membership->user_email_from = $membership->user_email_use_global ? $jconfig->get('fromname') : $membership->user_email_from; $userEmail = array('from' => '', 'fromName' => '', 'recipient' => '', 'subject' => '', 'body' => '', 'mode' => '', 'cc' => '', 'bcc' => '', 'attachments' => '', 'replyto' => '', 'replytoname' => ''); $adminEmail = array('from' => '', 'fromName' => '', 'recipient' => '', 'subject' => '', 'body' => '', 'mode' => '', 'cc' => '', 'bcc' => '', 'attachments' => '', 'replyto' => '', 'replytoname' => ''); // placeholders $user_data = unserialize($transaction->user_data); $user_email = $transaction->user_email; $replacements = array('{membership}' => $membership->name, '{email}' => $user_email, '{name}' => $user_data->name, '{username}' => isset($user_data->username) ? $user_data->username : '', '{price}' => RSMembershipHelper::getPriceFormat($transaction->price), '{coupon}' => $transaction->coupon, '{payment}' => $transaction->gateway, '{transaction_id}' => $transaction->id); $replace = array_keys($replacements); $with = array_values($replacements); $fields = RSMembership::getCustomFields(); $membership_fields = RSMembership::getCustomMembershipFields($membership_id); $all_fields = array_merge($fields, $membership_fields); foreach ($all_fields as $field) { $name = $field->name; $replace[] = '{' . $name . '}'; $object = isset($user_data->fields[$name]) ? 'fields' : 'membership_fields'; if (isset($user_data->fields[$name]) || isset($user_data->membership_fields[$name])) { $with[] = is_array($user_data->{$object}[$name]) ? implode("\n", $user_data->{$object}[$name]) : $user_data->{$object}[$name]; } else { $with[] = ''; } } // user emails if (!empty($membership->user_email_from_addr) && $membership->user_email_denied_subject != '') { // start sending emails // from address $userEmail['from'] = $membership->user_email_from_addr; // from name $userEmail['fromName'] = $membership->user_email_from; // recipient $userEmail['recipient'] = $user_email; // user email // subject $userEmail['subject'] = str_replace($replace, $with, $membership->user_email_denied_subject); // body $userEmail['body'] = str_replace($replace, $with, $membership->user_email_denied_text); // mode $userEmail['mode'] = $membership->user_email_mode; // cc $userEmail['cc'] = null; // bcc $userEmail['bcc'] = null; // attachments $userEmail['attachments'] = null; // reply to $userEmail['replyto'] = $userEmail['from']; // reply to name $userEmail['replytoname'] = $userEmail['fromName']; } // admin emails if (!empty($membership->admin_email_to_addr) && $membership->admin_email_denied_subject != '') { // from address $adminEmail['from'] = trim($membership->admin_email_from_addr) != '' ? $membership->admin_email_from_addr : $user_email; // from name $adminEmail['fromName'] = $user_data->name; // recipient $adminEmail['recipient'] = $membership->admin_email_to_addr; // subject $adminEmail['subject'] = str_replace($replace, $with, $membership->admin_email_denied_subject); // body $adminEmail['body'] = str_replace($replace, $with, $membership->admin_email_denied_text); // mode $adminEmail['mode'] = $membership->admin_email_mode; // cc $adminEmail['cc'] = null; // bcc $adminEmail['bcc'] = null; // attachments $adminEmail['attachments'] = null; // reply to $adminEmail['replyto'] = $adminEmail['from']; // reply to name $adminEmail['replytoname'] = $adminEmail['fromName']; } // send to user if (!empty($membership->user_email_from_addr) && $membership->user_email_denied_subject != '') { RSMembershipHelper::sendMail($userEmail['from'], $userEmail['fromName'], $userEmail['recipient'], $userEmail['subject'], $userEmail['body'], $userEmail['mode'], $userEmail['cc'], $userEmail['bcc'], $userEmail['attachments'], $userEmail['replyto'], $userEmail['replytoname']); } // send to admin if (!empty($membership->admin_email_to_addr) && !empty($membership->admin_email_denied_subject)) { RSMembershipHelper::sendMail($adminEmail['from'], $adminEmail['fromName'], $adminEmail['recipient'], $adminEmail['subject'], $adminEmail['body'], $adminEmail['mode'], $adminEmail['cc'], $adminEmail['bcc'], $adminEmail['attachments'], $adminEmail['replyto'], $adminEmail['replytoname']); } } } return true; }
function getMembership() { $cid = JRequest::getInt('cid'); $row =& JTable::getInstance('RSMembership_Memberships', 'Table'); $row->load($cid); if ($row->stock == -1) { $buy = ''; JError::raiseWarning(500, JText::_('RSM_OUT_OF_STOCK')); } $row->extras = array(); if (!empty($row->id)) { $row->extras = $this->_getList("SELECT * FROM `#__rsmembership_membership_extras` `me` LEFT JOIN `#__rsmembership_extras` `e` ON (`me`.`extra_id` = `e`.`id`) WHERE `me`.`membership_id`='" . (int) $row->id . "' AND `e`.`published`='1' ORDER BY `e`.`ordering`"); } if ($row->use_trial_period) { $row->price = $row->trial_price; } $currency = RSMembershipHelper::getConfig('currency'); // {price} placeholder $price = RSMembershipHelper::getPriceFormat($row->price); // {buy} placeholder $buy = '<input type="submit" class="button" value="' . JText::_('RSM_SUBSCRIBE') . '" name="Submit" />'; // {extras} placeholder $extras = ''; foreach ($row->extras as $extra) { $extras .= '<h3 class="rsm_extra_title">' . $extra->name . '</h3>'; $extras .= $extra->description; $extras .= '<span class="rsm_clear"></span>'; $extra_values = $this->_getExtraValues($extra->id); switch ($extra->type) { case 'dropdown': $values = array(); $extras .= '<select name="rsmembership_extra[' . $extra->id . ']" class="rsm_extra">'; $extras .= '<option value="0">' . JText::_('RSM_PLEASE_SELECT_EXTRA') . '</option>'; foreach ($extra_values as $value) { $value_price = RSMembershipHelper::getPriceFormat($value->price); $extras .= '<option ' . ($value->checked ? 'selected="selected"' : '') . ' value="' . $value->id . '">' . $value->name . ' - ' . $value_price . '</option>'; } $extras .= '</select>'; break; case 'radio': $values = array(); foreach ($extra_values as $i => $value) { $i++; $value_price = RSMembershipHelper::getPriceFormat($value->price); $extras .= '<input type="radio" ' . ($value->checked ? 'checked="checked"' : '') . ' value="' . $value->id . '" id="extras' . $value->id . '" name="rsmembership_extra[' . $extra->id . ']" class="rsm_extra" />'; $extras .= '<label for="extras' . $value->id . '" class="rsm_extra">' . $value->name . ' - ' . $value_price . '</label>'; } break; case 'checkbox': foreach ($extra_values as $i => $value) { $i++; $value_price = RSMembershipHelper::getPriceFormat($value->price); $extras .= '<input type="checkbox" ' . ($value->checked ? 'checked="checked"' : '') . ' value="' . $value->id . '" id="extras' . $value->id . '" name="rsmembership_extra[' . $extra->id . '][]" class="rsm_extra" />'; $extras .= '<label for="extras' . $value->id . '" class="rsm_extra">' . $value->name . ' - ' . $value_price . '</label>'; } break; } $extras .= '<span class="rsm_clear"></span>'; } $replace = array('{price}', '{buy}', '{extras}', '{stock}'); $with = array($price, $buy, $extras, $row->stock > -1 ? $row->stock : 0); $row->description = str_replace($replace, $with, $row->description); return $row; }
$this->ordering->showRow($saveOrder, $row->ordering, array('context' => 'extravalues', 'pagination' => $this->pagination, 'listDirn' => $listDirn, 'i' => $i)); ?> <td><?php echo JHTML::_('grid.id', $i, $row->id); ?> </td> <td><a href="<?php echo JRoute::_('index.php?option=com_rsmembership&task=extravalue.edit&extra_id=' . $row->extra_id . '&id=' . $row->id); ?> "><?php echo $row->name != '' ? $this->escape($row->name) : JText::_('COM_RSMEMBERSHIP_NO_TITLE'); ?> </a></td> <td> <?php echo RSMembershipHelper::getPriceFormat($this->escape($row->price)); ?> </td> <td width="1%" nowrap="nowrap" align="center"><?php echo JHtml::_('jgrid.published', $row->published, $i, 'extravalues.'); ?> </td> </tr> <?php $k = 1 - $k; } ?> <tfoot> <tr> <td colspan="6"><?php echo $this->pagination->getListFooter();
function finalize($transaction_id) { $mainframe =& JFactory::getApplication(); $option = 'com_rsmembership'; $db = JFactory::getDBO(); JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'tables'); // get transaction details $transaction =& JTable::getInstance('RSMembership_Transactions', 'Table'); $transaction->load($transaction_id); if (!$transaction->params) { return false; } // get user details $user_data = unserialize($transaction->user_data); $user_email = $transaction->user_email; // get membership details $params = RSMembershipHelper::parseParams($transaction->params); $membership =& JTable::getInstance('RSMembership_Memberships', 'Table'); $extras = ''; switch ($transaction->type) { case 'new': $transaction->membership_id = $params['membership_id']; $membership->load($transaction->membership_id); $message = $membership->user_email_new_text; $subject = $membership->user_email_new_subject; $admin_message = $membership->admin_email_new_text; $admin_subject = $membership->admin_email_new_subject; $email_type = 'user_email_new'; break; case 'upgrade': $transaction->membership_id = $params['to_id']; $membership->load($transaction->membership_id); $message = $membership->user_email_upgrade_text; $subject = $membership->user_email_upgrade_subject; $admin_message = $membership->admin_email_upgrade_text; $admin_subject = $membership->admin_email_upgrade_subject; $email_type = 'user_email_upgrade'; break; case 'addextra': $transaction->membership_id = $params['membership_id']; $membership->load($transaction->membership_id); $message = $membership->user_email_addextra_text; $subject = $membership->user_email_addextra_subject; $admin_message = $membership->admin_email_addextra_text; $admin_subject = $membership->admin_email_addextra_subject; $email_type = 'user_email_addextra'; break; case 'renew': $transaction->membership_id = $params['membership_id']; $membership->load($transaction->membership_id); $message = $membership->user_email_renew_text; $subject = $membership->user_email_renew_subject; $admin_message = $membership->admin_email_renew_text; $admin_subject = $membership->admin_email_renew_subject; $email_type = 'user_email_renew'; break; } if (!empty($params['extras'])) { $db->setQuery("SELECT `name` FROM #__rsmembership_extra_values WHERE `id` IN (" . implode(',', $params['extras']) . ")"); $extras = implode(', ', $db->loadResultArray()); } $replace = array('{membership}', '{extras}', '{email}', '{name}', '{username}', '{continue}', '{price}'); $with = array($membership->name, $extras, $user_email, $user_data->name, isset($user_data->username) ? $user_data->username : '', '<input class="button" type="button" onclick="location.href=\'' . (!empty($membership->redirect) ? $membership->redirect : JRoute::_('index.php?option=com_rsmembership')) . '\'" value="' . JText::_('RSM_CONTINUE') . '" />', RSMembershipHelper::getPriceFormat($transaction->price)); $db->setQuery("SELECT * FROM #__rsmembership_fields WHERE published='1'"); $fields = $db->loadObjectList(); foreach ($fields as $field) { $name = $field->name; $replace[] = '{' . $name . '}'; if (isset($user_data->fields[$name])) { $with[] = is_array($user_data->fields[$name]) ? implode("\n", $user_data->fields[$name]) : $user_data->fields[$name]; } else { $with[] = ''; } } $jconfig = JFactory::getConfig(); $membership->user_email_from_addr = $membership->user_email_use_global ? $jconfig->getValue('config.mailfrom') : $membership->user_email_from_addr; $membership->user_email_from = $membership->user_email_use_global ? $jconfig->getValue('config.fromname') : $membership->user_email_from; // start sending emails // user emails if (!empty($membership->user_email_from_addr)) { $message = str_replace($replace, $with, $message); // from address $from = $membership->user_email_from_addr; // from name $fromName = $membership->user_email_from; // recipient $recipient = $user_email; // user email // subject $subject = str_replace($replace, $with, $subject); // body $body = $message; // mode $mode = $membership->user_email_mode; // cc $cc = null; // bcc $bcc = null; // attachments $db->setQuery("SELECT `path` FROM #__rsmembership_membership_attachments WHERE `membership_id`='" . $transaction->membership_id . "' AND `email_type`='" . $email_type . "' AND `published`='1' ORDER BY `ordering`"); $attachment = $db->loadResultArray(); // reply to $replyto = $from; // reply to name $replytoname = $fromName; // send to user if ($subject != '') { RSMembershipHelper::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname); } } // admin emails if (!empty($membership->admin_email_to_addr) && !empty($admin_subject)) { $message =& $admin_message; $message = str_replace($replace, $with, $message); // from address $from = $user_email; // from name $fromName = $user_data->name; // recipient $recipient = $membership->admin_email_to_addr; // subject $subject = str_replace($replace, $with, $admin_subject); // body $body = $message; // mode $mode = $membership->admin_email_mode; // cc $cc = null; // bcc $bcc = null; // attachments $attachment = null; // reply to $replyto = $from; // reply to name $replytoname = $fromName; // send to admin if ($subject != '') { RSMembershipHelper::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname); } } // run php code eval($membership->custom_code); $session =& JFactory::getSession(); // set the action $session->set($option . '.subscribe.action', $membership->action); // show thank you message $thankyou = str_replace($replace, $with, $membership->thankyou); $session->set($option . '.subscribe.thankyou', $thankyou); // show url $redirect = str_replace($replace, $with, $membership->redirect); $session->set($option . '.subscribe.redirect', $redirect); }
?> " id="extras<?php echo $value->id; ?> " name="rsmembership_extra[<?php echo $extra->id; ?> ][]" class="rsm_extra pull-left" /> <label for="extras<?php echo $value->id; ?> " class="rsm_extra"><?php echo $value->name; ?> - <?php echo RSMembershipHelper::getPriceFormat($value->price); ?> </label> <?php } ?> <?php break; ?> <?php } ?> <div class="rsm_clear"></div> </div> <!-- end .item-page --> <?php }
echo JRoute::_('index.php?option=com_rsmembership&task=coupon.edit&id=' . $row->id); ?> "><?php echo $row->name != '' ? $this->escape($row->name) : JText::_('COM_RSMEMBERSHIP_NO_TITLE'); ?> </a></td> <td nowrap="nowrap"><?php echo $row->date_start != '0000-00-00 00:00:00' ? RSMembershipHelper::showDate($row->date_start) : '-'; ?> </td> <td nowrap="nowrap"><?php echo $row->date_end != '0000-00-00 00:00:00' ? RSMembershipHelper::showDate($row->date_end) : '-'; ?> </td> <td><?php echo $row->discount_type ? RSMembershipHelper::getPriceFormat($this->escape($row->discount_price)) : $this->escape($row->discount_price) . '%'; ?> </td> <td width="1%" nowrap="nowrap" align="center"><?php echo JHtml::_('jgrid.published', $row->published, $i, 'coupons.'); ?> </td> </tr> <?php $k = 1 - $k; } ?> <tfoot> <tr> <td colspan="9"><?php echo $this->pagination->getListFooter();
public function onMembershipPayment($plugin, $data, $extra, $membership, &$transaction, $html) { $this->loadLanguage('plg_system_rsmembership', JPATH_ADMINISTRATOR); $this->loadLanguage('plg_system_rsmembershipwire', JPATH_ADMINISTRATOR); if (preg_match('#rsmembershipwire([0-9]+)#', $plugin, $match)) { $id = $match[1]; $payment = JTable::getInstance('Payment', 'RSMembershipTable'); $payment->load($id); $tax_value = $payment->tax_value; if (!empty($tax_value)) { $tax_type = $payment->tax_type; // percent ? if ($tax_type == 0) { $tax_value = $transaction->price * ($tax_value / 100); } $transaction->price = $transaction->price + $tax_value; } if (RSMembershipHelper::getConfig('trigger_content_plugins')) { $payment->details = JHtml::_('content.prepare', $payment->details); } $html = $payment->details; // Store the transaction so we can get an ID $transaction->store(); $replacements = array('{price}' => RSMembershipHelper::getPriceFormat($transaction->price), '{transaction_id}' => $transaction->id, '{tax}' => RSMembershipHelper::getPriceFormat($tax_value), '{membership}' => $membership->name); if (!empty($data) && is_object($data)) { if (isset($data->username)) { $replacements['{username}'] = $data->username; } if (isset($data->name)) { $replacements['{name}'] = $data->name; } if (isset($data->email)) { $replacements['{email}'] = $data->email; } if (isset($data->coupon)) { $replacements['{coupon}'] = $data->coupon; } if (isset($data->fields) && is_array($data->fields)) { foreach ($data->fields as $field => $value) { if (is_array($value)) { $value = implode("\n", $value); } $replacements['{' . $field . '}'] = $value; } } } $replace = array_keys($replacements); $with = array_values($replacements); $html = str_replace($replace, $with, $html); $html .= '<form method="post" action="' . JRoute::_('index.php?option=com_rsmembership&task=thankyou') . '">'; $html .= '<div class="form-actions"><input class="button btn btn-success pull-right" type="submit" value="' . JText::_('COM_RSMEMBERSHIP_CONTINUE') . '" /></div>'; $html .= '<input type="hidden" name="option" value="com_rsmembership" />'; $html .= '<input type="hidden" name="task" value="thankyou" />'; $html .= '</form>'; // No hash for this $transaction->hash = ''; $transaction->gateway = $payment->name; if ($membership->activation == 2) { $transaction->status = 'completed'; } return $html; } }
:</td> <td><?php echo RSMembershipHelper::getPriceFormat($total - $this->membership->price + $this->membership->renewal_price); ?> </td> </tr> <?php } ?> <tr> <td width="30%" height="40"><?php echo JText::_('RSM_TOTAL_COST'); ?> :</td> <td><?php echo RSMembershipHelper::getPriceFormat($total); ?> </td> </tr> </table> </fieldset> <fieldset> <legend><?php echo JText::_('RSM_ACCOUNT_INFORMATION'); ?> </legend> <table cellpadding="0" cellspacing="0" border="0" width="100%" class="rsmembership_form_table"> <?php if ($this->choose_username) { ?>