Exemplo n.º 1
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     $pathway =& $mainframe->getPathway();
     $pathway->addItem(JText::_('RSM_RENEW'), '');
     // 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 membership
         $membership = $this->get('membership');
         $this->assignRef('membership', $membership);
         $this->assignRef('fields', RSMembershipHelper::getFields(false));
     } elseif ($layout == 'payment') {
         $this->assignRef('html', $this->get('html'));
     }
     // get the extra
     $this->assignRef('extra', $this->get('extra'));
     $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();
 }
Exemplo n.º 2
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_RENEW'), '');
     // get the logged user
     $this->user = JFactory::getUser();
     // 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 membership
         $this->membership = $this->get('membership');
         $this->membershipterms = $this->get('membershipterms');
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, true, $this->user->id, true, $this->membership->last_transaction_id);
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     // get the extras
     $this->extras = $this->get('extras');
     $this->cid = $this->get('cid');
     $this->config = $this->get('config');
     $this->params = $params;
     $this->token = JHTML::_('form.token');
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
Exemplo n.º 3
0
 function getLimitations()
 {
     $plugins = RSMembership::getPlugins();
     $return = array();
     foreach ($plugins as $paymentplugin => $plugin) {
         $return[$paymentplugin] = '';
     }
     return $return;
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     // get the membership
     $membership = $this->get('membership');
     // check if the membership exists
     if (empty($membership->id)) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_EXIST'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     if (!$membership->published || $membership->stock == -1) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_PUBLISHED'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($membership->name, JRoute::_('index.php?option=com_rsmembership&view=membership&cid=' . $membership->id . ':' . JFilterOutput::stringURLSafe($membership->name)));
     $pathway->addItem(JText::_('RSM_SUBSCRIBE'), '');
     // get the extras
     $extras = $this->get('extras');
     // check if the user is logged in
     $user =& JFactory::getUser();
     $logged = $user->get('guest') ? false : true;
     $show_login = RSMembershipHelper::getConfig('show_login');
     // token
     $token = JHTML::_('form.token');
     // get the current task
     $task = JRequest::getVar('task', '');
     $choose_username = RSMembershipHelper::getConfig('choose_username');
     $choose_password = RSMembershipHelper::getConfig('choose_password');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         // get the encoded return url
         $return = base64_encode(JRequest::getURI());
         $this->assignRef('return', $return);
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $muser = $this->get('user');
         $data = $this->get('data');
         if ($task == 'back' || $task == 'validatesubscribe') {
             $this->assignRef('data', $data);
         }
         $this->assignRef('fields_validation', RSMembershipHelper::getFieldsValidation());
         $this->assignRef('fields', RSMembershipHelper::getFields());
         $this->assign('use_captcha', $this->get('usecaptcha'));
         $this->assign('use_builtin', $this->get('usebuiltin'));
         $this->assign('use_recaptcha', $this->get('userecaptcha'));
         if ($this->get('userecaptcha')) {
             if (!class_exists('JReCAPTCHA')) {
                 require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'recaptcha' . DS . 'recaptchalib.php';
             }
             $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror')));
         }
         $this->assign('has_coupons', $this->get('hasCoupons'));
     } elseif ($layout == 'preview') {
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $this->assignRef('fields', RSMembershipHelper::getFields(false));
         $this->assign('payments', RSMembership::getPlugins());
         $data = $this->get('data');
         $this->assignRef('data', $data);
     } elseif ($layout == 'payment') {
         $this->assignRef('html', $this->get('html'));
     }
     $this->assignRef('config', $this->get('config'));
     $this->assignRef('params', $params);
     $this->assignRef('membership', $membership);
     $this->assignRef('membershipterms', $this->get('membershipterms'));
     $this->assignRef('extras', $extras);
     $this->assignRef('logged', $logged);
     $this->assignRef('show_login', $show_login);
     $this->assignRef('user', $user);
     $this->assignRef('muser', $muser);
     $this->assignRef('token', $token);
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     $this->assign('one_page_checkout', RSMembershipHelper::getConfig('one_page_checkout'));
     if ($this->one_page_checkout) {
         $this->assign('payments', RSMembership::getPlugins());
     }
     $total = 0;
     $total += $membership->price;
     if ($extras) {
         foreach ($extras as $extra) {
             $total += $extra->price;
         }
     }
     $this->assign('total', $total);
     parent::display();
 }
Exemplo n.º 6
0
 public function getSideBar()
 {
     require_once JPATH_COMPONENT . '/helpers/toolbar.php';
     // Transaction Types filter
     $options['filter_type'] = $this->getState($this->context . '.filter.filter_type');
     $options['transaction_types'] = array(JHtml::_('select.option', '', JText::_('COM_RSMEMBERSHIP_TRANSACTION_ALL_TYPES')), JHtml::_('select.option', 'new', JText::_('COM_RSMEMBERSHIP_TRANSACTION_NEW')), JHtml::_('select.option', 'renew', JText::_('COM_RSMEMBERSHIP_TRANSACTION_RENEW')), JHtml::_('select.option', 'upgrade', JText::_('COM_RSMEMBERSHIP_TRANSACTION_UPGRADE')), JHtml::_('select.option', 'addextra', JText::_('COM_RSMEMBERSHIP_TRANSACTION_ADDEXTRA')));
     // Gateway filter
     $options['filter_gateway'] = $this->getState($this->context . '.filter.filter_gateway');
     $options['gateways'] = array(JHtml::_('select.option', '', JText::_('COM_RSMEMBERSHIP_TRANSACTION_ALL_GATEWAYS')), JHtml::_('select.option', 'No Gateway', JText::_('COM_RSMEMBERSHIP_NO_GATEWAY')));
     $gateways = RSMembership::getPlugins();
     foreach ($gateways as $plugin => $name) {
         if ($name == 'Credit Card') {
             $name = 'Authorize.Net';
         }
         $options['gateways'][] = JHtml::_('select.option', $name, $name);
     }
     // Status filter
     $options['filter_status'] = $this->getState($this->context . '.filter.filter_status');
     $statuses = array('pending', 'completed', 'denied');
     $options['statuses'] = array(JHtml::_('select.option', '', JText::_('COM_RSMEMBERSHIP_TRANSACTION_ALL_STATUSES')));
     foreach ($statuses as $status) {
         $options['statuses'][] = JHtml::_('select.option', $status, JText::_('COM_RSMEMBERSHIP_TRANSACTION_STATUS_' . $status));
     }
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_SELECT_STATUS'), 'filter_status', JHtml::_('select.options', $options['statuses'], 'value', 'text', $options['filter_status'], true));
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_SELECT_GATEWAY'), 'filter_gateway', JHtml::_('select.options', $options['gateways'], 'value', 'text', $options['filter_gateway'], false));
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_SELECT_TYPE'), 'filter_type', JHtml::_('select.options', $options['transaction_types'], 'value', 'text', $options['filter_type'], false));
     // Custom filters
     // Date from
     $options['date_from'] = $this->getState($this->context . '.filter.date_from');
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_FROM'), 'date_from', $options['date_from'], 'calendar');
     // Date to
     $options['date_to'] = $this->getState($this->context . '.filter.date_to');
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_TO'), 'date_to', $options['date_to'], 'calendar');
     // Calendar buttons
     $options['calendar_btn'] = array('from_btn' => 'date_from', 'to_btn' => 'date_to', 'filter_desc' => JText::_('COM_RSMEMBERSHIP_FILTER_DESC'));
     RSMembershipToolbarHelper::addFilter(JText::_('COM_RSMEMBERSHIP_FILTER'), JText::_('COM_RSMEMBERSHIP_FILTER_DESC'), $options['calendar_btn'], 'calendar_btn');
     return RSMembershipToolbarHelper::render();
 }
Exemplo n.º 7
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     // Assign variables
     $this->membership = $this->get('Membership');
     $this->extras = $this->get('Extras');
     $this->params = clone $app->getParams('com_rsmembership');
     $this->user = JFactory::getUser();
     $this->logged = (bool) (!$this->user->guest);
     $this->token = JHtml::_('form.token');
     // Assign config variables
     $this->config = RSMembershipHelper::getConfig();
     $this->show_login = $this->config->show_login;
     $this->choose_username = $this->config->choose_username;
     $this->choose_password = $this->config->choose_password;
     $this->currency = $this->config->currency;
     $this->one_page_checkout = $this->config->one_page_checkout;
     $this->captcha_case_sensitive = $this->config->captcha_case_sensitive;
     $this->payments = RSMembership::getPlugins();
     // Set pathway
     $pathway->addItem($this->membership->name, JRoute::_(RSMembershipRoute::Membership($this->membership->id, $app->input->getInt('Itemid'))));
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'), '');
     switch ($this->getLayout()) {
         default:
             // Get the encoded return url
             $this->return = base64_encode(JURI::getInstance());
             $this->data = (object) $this->get('Data');
             $this->membershipterms = $this->get('MembershipTerms');
             $this->has_coupons = $this->get('HasCoupons');
             $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
             $this->fields = RSMembershipHelper::getFields(true);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id);
             // Handle CAPTCHA
             $this->use_captcha = $this->get('UseCaptcha');
             $this->use_builtin = $this->get('UseBuiltin');
             $this->use_recaptcha = $this->get('UseReCaptcha');
             $this->use_recaptcha_new = $this->get('UseReCaptchaNew');
             if ($this->use_recaptcha) {
                 if (!class_exists('JReCAPTCHA')) {
                     require_once JPATH_ADMINISTRATOR . '/components/com_rsmembership/helpers/recaptcha/recaptchalib.php';
                 }
                 $this->show_recaptcha = JReCAPTCHA::getHTML($this->get('ReCaptchaError'));
             }
             if ($this->use_recaptcha_new) {
                 $doc = JFactory::getDocument();
                 if ($doc->getType() == 'html') {
                     $doc->addScript('https://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage()->getTag());
                 }
             }
             $this->assignExtrasView();
             break;
         case 'preview':
             $this->fields = RSMembershipHelper::getFields(false);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, false);
             $this->data = (object) $this->get('Data');
             break;
         case 'payment':
             $this->html = $this->get('Html');
             break;
     }
     // Calculate the Total
     $this->total = $this->get('Total');
     // Do we need to display the payment options?
     $model = $this->getModel();
     $this->showPayments = $model->showPaymentOptions();
     parent::display();
 }
Exemplo n.º 8
0
 function getGateways()
 {
     $return = array();
     $plugins = RSMembership::getPlugins();
     array_unshift($plugins, 'No Gateway');
     foreach ($plugins as $plugin => $name) {
         $tmp = new stdClass();
         $tmp->key = $name;
         $tmp->value = $name;
         $return[] = $tmp;
     }
     return $return;
 }
Exemplo n.º 9
0
 public function cancel()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $id = $this->user->id;
     $cid = $this->getCid();
     $transaction = JTable::getInstance('Transaction', 'RSMembershiptable');
     $transaction->load($this->_data->from_transaction_id);
     $membership = JTable::getInstance('Membership', 'RSMembershiptable');
     $membership->load($this->_data->membership_id);
     $plugins = RSMembership::getPlugins();
     // Keep a legacy mode for Authorize.net
     if (in_array($transaction->gateway, $plugins) || $transaction->gateway == 'Authorize.Net') {
         $plugin = array_search($transaction->gateway, $plugins);
         if ($plugin === false) {
             $plugin = 'rsmembershipauthorize';
         }
         $args = array('plugin' => $plugin, 'data' => &$this->_data, 'membership' => $membership, 'transaction' => &$transaction);
         JFactory::getApplication()->triggerEvent('onMembershipCancelPayment', $args);
     }
     $query->clear();
     $query->update($db->qn('#__rsmembership_membership_subscribers'))->set($db->qn('status') . ' = ' . $db->q('3'))->where($db->qn('id') . ' = ' . $db->q($cid));
     $db->setQuery($query);
     $db->execute();
     if (!is_array($membership->gid_expire)) {
         $membership->gid_expire = explode(',', $membership->gid_expire);
     }
     if ($membership->gid_enable) {
         RSMembership::updateGid($id, $membership->gid_expire, false, 'remove');
     }
     if ($membership->disable_expired_account) {
         list($memberships, $extras) = RSMembershipHelper::getUserSubscriptions($id);
         if (!$memberships) {
             RSMembership::disableUser($id);
             $app = JFactory::getApplication();
             $app->logout();
         }
     }
 }