Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/com_rsmembership.tar

assets/index.html000064400000000054151166265600010052
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>assets/thumbs/files/index.html000064400000000054151166265600012456
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>assets/thumbs/index.html000064400000000054151166265600011354
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>controller.php000064400000033573151166265600007463
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');

class RSMembershipController extends JControllerLegacy
{
	public function __construct() {
		parent::__construct();

		JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_rsmembership/tables');

		$config   = RSMembershipConfig::getInstance();

		// Load Bootstrap on 3.x
		if ($config->get('load_bootstrap')) {
			JHtml::_('bootstrap.framework');
			JHtml::_('bootstrap.loadCss', true);
		}

		// Load our CSS
		JHtml::_('stylesheet',
'com_rsmembership/rsmembership.css', array('relative'
=> true, 'version' => 'auto'));
		// Load our JS
		JHtml::_('script',
'com_rsmembership/rsmembership.js', array('relative'
=> true, 'version' => 'auto'));

		// Load the CSS specific framework
		JHtml::_('stylesheet',
'com_rsmembership/rsmemgrid.css', array('relative'
=> true, 'version' => 'auto'));
		JHtml::_('stylesheet',
'com_rsmembership/rsmemgridicons.css', array('relative'
=> true, 'version' => 'auto'));
	}
	
	// @desc Entry point for the subscription process.
	public function subscribe($new=true) {
		$app 			= JFactory::getApplication();
		$membership_id 	= $app->input->get('cid', 0,
'int');
		$extras			= $app->input->get('rsmembership_extra',
array(), 'array');
		$model 			= $this->getModel('subscribe');
		
		// Empty the session everytime this page is accessed directly and not
from within the controller
		if ($new) {
			// check to see that is not redirected from the module
			$session = JFactory::getSession();
			if(
is_null($session->get('com_rsmembership.subscribe.'.$membership_id.'.frommodule',
null)) ) {
				$model->clearData();
			} else {
				$session->clear('com_rsmembership.subscribe.'.$membership_id.'.frommodule');
			}
		}
		
		// Try to bind the membership
		if (!$model->bindMembership($membership_id)) {
			$app->enqueueMessage($model->getError(), 'error');
			return
$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Check if the user can subscribe to this membership
		if (!$model->canSubscribe()) {
			$app->enqueueMessage($model->getError(), 'error');
			return
$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Check if it's out of stock.
		$membership = $model->getMembership();
		if ($membership->stock < 0) {
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_OUT_OF_STOCK'),
'error');
			return
$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Try to bind extras
		if ($extras) {
			$model->bindExtras($extras);
		}

		$view = $this->getView('subscribe', 'html');
		$view->setModel($model, true);
		$view->display();
	}

	public function setcoupon() {
		$app 	= JFactory::getApplication();
		$model 	= $this->getModel('subscribe');
		$membership_id 	= $app->input->get('membership_id', 0,
'int');
		$coupon 		= $app->input->get('coupon', '',
'string');

		$response = new stdClass();
		$response->status = true;
		$response->discount = 0;
		if (!$model->bindMembership($membership_id)) {
			$this->showResponse($response);
		}


		$coupon = $model->bindCoupon($coupon, true);
		if (is_bool($coupon)) {
			$this->showResponse($response);
		} else {
			$response->discount = $coupon->discount_price;
		}

		$this->showResponse($response);
	}

	protected function showResponse($data) {
		// Set proper document encoding
		JFactory::getDocument()->setMimeEncoding('application/json');

		// Echo the JSON encoded data.
		echo json_encode($data);

		// Close the application.
		JFactory::getApplication()->close();
	}
	
	// @desc Validation during subscription.
	public function validateSubscribe() {
		$app 	= JFactory::getApplication();
		$model 	= $this->getModel('subscribe');
		
		// Get needed data.
		$membership_id 	= $app->input->get('cid', 0,
'int');
		$extras			= $app->input->get('rsmembership_extra',
array(), 'array');
		$coupon 		= $app->input->get('coupon', '',
'string');
		$data			= array(
			'username' 			=>
$app->input->get('username', '',
'string'),
			'email' 			=> $app->input->get('email',
'', 'string'),
			'name' 				=> $app->input->get('name',
'', 'string'),
			'password'			=>
$app->input->get('password',  '',
'raw'),
			'password2'			=>
$app->input->get('password2', '',
'raw'),
			'fields'			=>
$app->input->get('rsm_fields', array(),
'array'),
			'membership_fields'	=>
$app->input->get('rsm_membership_fields', array(),
'array')
		);
		
		// Try to bind the membership
		if (!$model->bindMembership($membership_id)) {
			$app->enqueueMessage($model->getError(), 'error');
			return
$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Try to bind extras
		if ($extras) {
			$model->bindExtras($extras);
		}

		// Store data in the session here, we're going to need it later on.
		$model->storeData(array(
			'id' 		=> $membership_id,
			'extras' 	=> $extras,
			'data'		=> $data,
			'coupon'	=> $coupon
		));
		
		// Check if the user can subscribe to this membership
		if ($data['email'] && ($userId =
RSMembership::checkUser($data['email']))) {
			$user = JFactory::getUser($userId);

			if (!RSMembershipHelper::getConfig('allow_resubscribe')) {
				// Show some errors.
				$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_EMAIL_NOT_OK'),
'error');

				// Redirect back.
				$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=back&cid='.$membership_id,
false));
			}

			if (!$model->canSubscribe($user)) {
				$app->enqueueMessage($model->getError(), 'error');

				// Redirect back.
				$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=back&cid='.$membership_id,
false));
			}
		}
		
		// Validate Captcha, bind data and check coupon code.
		if (!$model->validateCaptcha() || !$model->bindData($data) ||
!$model->bindCoupon($coupon)) {			
			// Show some errors.
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_FIELDS'),
'error');
			$app->enqueueMessage($model->getError(), 'error');
			
			// Redirect back.
			$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=back&cid='.$membership_id,
false));
		}

        // Check if terms and conditions have been accepted
        if ($model->getMembershipTerms() &&
!$app->input->getInt('i_agree_to_terms')) {
            // Show some errors.
           
$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP'),
'error');

            // Redirect back.
           
$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=back&cid='.$membership_id,
false));
        }
		
		// Mark data as correct (to prevent people from accessing the next pages
with invalid data).
		$model->markCorrectData($membership_id);
		
		// If one page checkout is enabled, just redirect to the payment
gateway.
		if (RSMembershipHelper::getConfig('one_page_checkout')) {
			$app->input->set('payment',
$app->input->get('payment', 'none',
'cmd'));
			return $this->paymentRedirect();
		} else {
			// Show the preview page.
			$view = $this->getView('subscribe', 'html');
			$view->setLayout('preview');
			$view->setModel($model, true);
			$view->display();
		}
	}
	
	public function paymentRedirect() {
		$payment =
JFactory::getApplication()->input->get('payment',
'none', 'cmd');
		$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&task=payment&payment='.$payment,
false));
	}
	
	public function payment() {
		$model 	= $this->getModel('subscribe');
		$app 	= JFactory::getApplication();
		
		// Set data from the session...
		if ($data = $model->getData()) {
			foreach ($data as $key => $value) {
				$app->input->set($key, $value);
			}
		}
		
		// Get needed data.
		$membership_id 	= $app->input->get('cid', 0,
'int');
		$extras			= $app->input->get('rsmembership_extra',
array(), 'array');
		$coupon 		= $app->input->get('coupon', '',
'string');
		
		$username 	= $app->input->get('username', '',
'string');
		$username   =
preg_replace('#[<>"\'%;()&\\\\]|\\.\\./#',
'', $username);
		$data			= array(
			'username' 			=> $username,
			'email' 			=> $app->input->get('email',
'', 'string'),
			'name' 				=> $app->input->get('name',
'', 'string'),
			'password'			=>
$app->input->get('password',  '',
'raw'),
			'password2'			=>
$app->input->get('password2', '',
'raw'),
			'fields'			=>
$app->input->get('rsm_fields', array(),
'array'),
			'membership_fields'	=>
$app->input->get('rsm_membership_fields', array(),
'array')
		);
		$paymentPlugin 	= $app->input->get('payment',
'none', 'cmd');
		
		// Try to bind the membership
		if (!$model->bindMembership($membership_id)) {
			$app->enqueueMessage($model->getError(), 'error');
			return
$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Try to bind extras
		if ($extras) {
			$model->bindExtras($extras);
		}
		
		if (!$model->bindData($data) || !$model->bindCoupon($coupon) ||
!$model->isCorrectData()) {
			// Show some errors.
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_FIELDS'),
'error');
			$app->enqueueMessage($model->getError(), 'error');
			
			// Redirect back.
			$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=back&cid='.$membership_id,
false));
		}
		
		$membership	 	= $model->getMembership();
		$transaction 	= $model->saveTransaction($paymentPlugin);
		$showPayments 	= $model->showPaymentOptions();
		if (!$showPayments) {
			$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=thankyou',
false));
		}
		
		// Show the payment page.
		$view = $this->getView('subscribe', 'html');
		$view->setLayout('payment');
		$view->setModel($model, true);
		$view->display();
	}
	
	public function back() {
		$input 			= JFactory::getApplication()->input;
		$model 			= $this->getModel('subscribe');
		$membership_id 	= $input->get('cid', 0, 'int');
		
		// Set data back into the request
		if ($data = $model->getData()) {
			foreach ($data as $key => $value) {
				$input->set($key, $value);
			}
		}
		
		// Fallback for expired sessions
		if (empty($data) || empty($data['cid'])) {
			$input->set('cid', $membership_id);
		}
		
		$this->subscribe(false);
	}

	public function from() {
		$input 			= JFactory::getApplication()->input;
		$itemId 	= $input->get('Itemid', 0, 'int');

		$form_values = $input->getArray(array(
			'rsmemSub' 	=> array(
				'membership_id' => 'int',
				'name' 			=> 'text',
				'email' 		=> 'text',
				'username'  	=> 'text'
			)
		));

		$form_values = $form_values['rsmemSub'];

		// get the selected membership
		$membership_id 	= (int)$form_values['membership_id'];

		// we do not need anymore the id in form_values
		unset($form_values['membership_id']);

		$redirect_link =
"index.php?option=com_rsmembership&task=subscribe";

		if (!empty($membership_id)) {
			$session = JFactory::getSession();
			$context = 'com_rsmembership.subscribe.';
			$session->set($context . 'id', $membership_id);
			$session->set($context . $membership_id . '.data',
$form_values);
			$session->set($context . $membership_id . '.frommodule',
1);

			// get the selected membership data
			$membership = RSMembership::getMembershipData($membership_id);
			$cat_id = $membership->get('category_id');
			$category_name = RSMembershipHelper::getCategoryName($cat_id);

			// redirect to subscribe url
			$redirect_link .= "&catid=$cat_id:$category_name&cid="
. $membership_id . ":" . $membership->get('name');
			if (!empty($itemId)) {
				$redirect_link .= '&Itemid=' .
RSMembershipHelper::htmlEscape($itemId);
			}
		}

		JFactory::getApplication()->redirect(JRoute::_($redirect_link));
	}
	
	public function captcha() {
		$app   = JFactory::getApplication();
		$model = $this->getModel('subscribe');
		if ($model->getUseBuiltin()) {
			// Load Captcha
			if (!class_exists('JSecurImage')) {
				require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/securimage/securimage.php';
			}
			
			ob_end_clean();
			
			$captcha 				= new JSecurImage();
			$captcha->num_lines 	=
RSMembershipHelper::getConfig('captcha_lines') ? 8 : 0;
			$captcha->code_length 	=
RSMembershipHelper::getConfig('captcha_characters');
			$captcha->image_width 	= 30 * $captcha->code_length + 50;
			$captcha->show();
		}
		
		$app->close();
	}
	
	public function checkUsername() {
		$app			= JFactory::getApplication();
		$model 			= $this->getModel('subscribe');
		$suggestions 	= $model->checkUsername();
		
		echo implode('|', $suggestions);
		$app->close();
	}
	
	public function download() 
	{
		JFactory::getApplication()->input->set('view',
'mymembership');
		JFactory::getApplication()->input->set('layout',
'default');

		parent::display();
	}

	public function thankyou()
	{
		JFactory::getApplication()->input->set('view',
'thankyou');
		JFactory::getApplication()->input->set('layout',
'default');

		parent::display();
	}
	
	public function validateuser() 
	{
		// Check for request forgeries
		JSession::checkToken() or jexit('Invalid Token');
		
		$model = $this->getModel('user');
		if (!$model->_bindData())
		{
			JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_FIELDS'),
'warning');
			JFactory::getApplication()->input->set('view',
'user');
			JFactory::getApplication()->input->set('layout',
'default');

			parent::display();
		}
		else
		{
			$model->save();
			// Redirect
			$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=user',
false), JText::_('COM_RSMEMBERSHIP_USER_SAVED'));
		}
	}

	public function cancel()
	{
		$model = $this->getModel('mymembership');
		$model->cancel();
		
		$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$model->getCid(),
false), JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_CANCELLED'));
	}
}controllers/index.html000064400000000054151166265600011116
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>controllers/mymembership.php000064400000020233151166265610012335
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RsmembershipControllerMymembership extends JControllerForm
{
    public function __construct($config = array())
    {
        parent::__construct($config);
        $this->input = JFactory::getApplication()->input;
    }

    public function getModel($name = 'Mymembership', $prefix =
'RsmembershipModel', $config = array('ignore_request'
=> true)) {
        return parent::getModel($name, $prefix, $config);
    }

    public function addExtraPaymentRedirect() {
        $payment 	= $this->input->get('payment',
'none', 'string');
        $cid        = $this->input->getInt('cid');
        $extra_id   = $this->input->getInt('extra_id');
        $model      = $this->getModel();
        $app        = JFactory::getApplication();

        // Check if terms and conditions have been accepted
        if ($model->getMembershipTerms() &&
!$this->input->getInt('i_agree_to_terms')) {
            // Show some errors.
           
$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP'),
'error');

            // Redirect back.
            return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=addextra&cid='.$cid.'&extra_id='.$extra_id,
false));
        }

       
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=payment&payment='.$payment.'&action_type=addextra',
false));
    }

    public function renewPaymentRedirect(){
        $app        = JFactory::getApplication();
        $jinput  	= $app->input;
        $payment 	= $jinput->get('payment', 'none',
'string');
        $cid 	 	= $jinput->get('cid', 0, 'int');
        $model 	 	= $this->getModel();

        $membership =
$model->getMembershipSubscriber('renew');

        $all_fields 			= RSMembership::getCustomFields();
        $membership_fields 		=
RSMembership::getCustomMembershipFields($membership->id);
        $all_fields 			= array_merge($all_fields, $membership_fields);
        // Check if terms and conditions have been accepted
        if ($model->getMembershipTerms() &&
!$jinput->getInt('i_agree_to_terms')) {
            // Show some errors.
           
$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP'),
'error');

            // Redirect back.
            return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=renew&cid='.$cid,
false));
        }

        if (count($all_fields)) {
            $verifyFieldsMembership =
$jinput->get('rsm_membership_fields', array(),
'array');
            $verifyFieldsUser 	 	= $jinput->get('rsm_fields',
array(), 'array');
            $verifyFields			= array_merge($verifyFieldsUser,
$verifyFieldsMembership);
            $fields  		 	    = $all_fields;
            foreach ($fields as $field) {
                if (($field->required &&
empty($verifyFields[$field->name])) ||
                    ($field->rule &&
!empty($verifyFields[$field->name]) &&
is_callable('RSMembershipValidation', $field->rule) &&
!call_user_func(array('RSMembershipValidation', $field->rule),
$verifyFields[$field->name]))) {
                    $message = JText::_($field->validation);
                    if (empty($message)) {
                        $message =
JText::sprintf('COM_RSMEMBERSHIP_VALIDATION_DEFAULT_ERROR',
JText::_($field->label));
                    }

                    JFactory::getApplication()->enqueueMessage($message,
'warning');
                    return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=renew&cid='.$cid,
false));
                }
            }

            $model->storeData(array(
                'membership_fields'	=>
$verifyFieldsMembership,
                'custom_fields'		=> $verifyFieldsUser
            ));
        }

       
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=payment&payment='.$payment.'&action_type=renew',
false));
    }

    public function upgrade()
    {
        $user 	= JFactory::getUser();
        $db 	= JFactory::getDBO();
        $query	= $db->getQuery(true);
        $jinput = JFactory::getApplication()->input;
        $to_id	= $jinput->get('to_id', 0, 'int');
        $cid	= $jinput->get('cid', 0, 'int');

       
$query->select($db->qn('unique'))->from($db->qn('#__rsmembership_memberships'))->where($db->qn('id').'
= '.$db->q($to_id));
        $db->setQuery($query);

        if ( $db->loadResult() > 0 )
        {
            $query->clear();
           
$query->select($db->qn('id'))->from($db->qn('#__rsmembership_membership_subscribers'))->where($db->qn('user_id').'
= '.$db->q($user->get('id')))->where(
$db->qn('membership_id').' = '.$db->q($to_id) );
            $db->setQuery($query);

            if ( $db->loadResult() )
            {
               
JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_ALREADY_SUBSCRIBED'),
'warning');
                return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership',
false));
            }
        }

        return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=upgrade&cid='.$cid.'&to_id='.$to_id,
false));
    }

    public function upgradePaymentRedirect()
    {
        $app     = JFactory::getApplication();
        $jinput  = $app->input;
        $payment = $jinput->get('payment', 'none',
'string');
        $cid 	 = $jinput->get('cid', 0, 'int');
        $to_id 	 = $jinput->get('to_id', 0, 'int');
        $model 	 = $this->getModel();
        $upgrade =
$model->getMembershipSubscriber('upgrade');

        $all_fields 			= RSMembership::getCustomFields();
        $membership_fields 		=
RSMembership::getCustomMembershipFields($upgrade->membership_to_id);
        $all_fields 			= array_merge($all_fields, $membership_fields);

        // Check if terms and conditions have been accepted
        if ($model->getMembershipTerms() &&
!$jinput->getInt('i_agree_to_terms')) {
            // Show some errors.
           
$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP'),
'error');

            // Redirect back.
            return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=upgrade&cid='.$cid.'&to_id='.$to_id,
false));
        }

        if (count($all_fields)) {
            $to_id 	 		 		= $jinput->get('to_id', 0,
'int');
            $verifyFieldsMembership =
$jinput->get('rsm_membership_fields', array(),
'array');
            $verifyFieldsUser 	 	= $jinput->get('rsm_fields',
array(), 'array');
            $verifyFields			= array_merge($verifyFieldsUser,
$verifyFieldsMembership);

            $fields  = $all_fields;
            foreach ($fields as $field) {
                if (($field->required &&
empty($verifyFields[$field->name])) ||
                    ($field->rule &&
!empty($verifyFields[$field->name]) &&
is_callable('RSMembershipValidation', $field->rule) &&
!call_user_func(array('RSMembershipValidation', $field->rule),
$verifyFields[$field->name]))) {
                    $message = JText::_($field->validation);
                    if (empty($message)) {
                        $message =
JText::sprintf('COM_RSMEMBERSHIP_VALIDATION_DEFAULT_ERROR',
JText::_($field->label));
                    }

                    JFactory::getApplication()->enqueueMessage($message,
'warning');
                    return
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=upgrade&cid='.$cid.'&to_id='.$to_id,
false));
                }
            }

            $model->storeData(array(
                'id' 		        => $to_id,
                'membership_fields'	=>
$verifyFieldsMembership,
                'custom_fields'		=> $verifyFieldsUser
            ));
        }

       
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=payment&payment='.$payment.'&action_type=upgrade',
false));
    }
}controllers/mytransaction.php000064400000002611151166265610012527
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2020 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RsmembershipControllerMytransaction extends JControllerForm
{
    public function __construct($config = array())
    {
        parent::__construct($config);

        $user = JFactory::getUser();
        if ( $user->get('guest') )
        {
            $link 		 = JUri::getInstance();
            $link 		 = base64_encode($link);
            $user_option = 'com_users';

           
JFactory::getApplication()->redirect('index.php?option='.$user_option.'&view=login&return='.$link);
        }
    }

    public function outputinvoice() {
        $app = JFactory::getApplication();

        $transaction_id = $app->input->get('id', 0);

        require_once JPATH_ADMINISTRATOR .
'/components/com_rsmembership/helpers/invoice.php';

        try {
            // get the invoice
            $invoice = RSMembershipInvoice::getInstance($transaction_id);

            $invoice->outputInvoicePdf('download');
        } catch (Exception $e) {
           
$app->enqueueMessage($e->getMessage(),'error');
           
$this->setRedirect(JRoute::_('index.php?option=com_rsmembership&view=mytransactions',
false));
        }
    }
}controllers/removedata.php000064400000012313151166265610011763
0ustar00<?php
/**
 * @package    RSMembership!
 * @copyright  (c) 2009 - 2018 RSJoomla!
 * @link       https://www.rsjoomla.com
 * @license    GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die;

class RsmembershipControllerRemovedata extends JControllerForm
{
    public function request()
    {
        JSession::checkToken() or jexit('Invalid Token');

        try
        {
            $user = JFactory::getUser();
            if ($user->guest)
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_MUST_BE_LOGGED_IN'));
            }

            if
(!RSMembershipHelper::getConfig('allow_self_anonymisation', 0))
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_THIS_FEATURE_MUST_BE_ENABLED'));
            }

            if ($user->authorise('core.admin'))
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_THIS_FEATURE_IS_NOT_AVAILABLE_FOR_SUPER_USERS'));
            }

            // Get JConfig
            $config = JFactory::getConfig();

            // Create a token
            $token =
JApplicationHelper::getHash(JUserHelper::genRandomPassword(10));
            $hashedToken = JUserHelper::hashPassword($token);

            // Save the token
            $db = JFactory::getDbo();
            $query = $db->getQuery(true)
                ->select('*')
                ->from($db->qn('#__rsmembership_tokens'))
                ->where($db->qn('user_id') . ' =
' . $db->q($user->id));
            if ($db->setQuery($query)->loadObject())
            {
                $query->clear()
                   
->update($db->qn('#__rsmembership_tokens'))
                    ->set($db->qn('token') . ' =
' . $db->q($hashedToken))
                    ->where($db->qn('user_id') . ' =
' . $db->q($user->id));
            }
            else
            {
                $query->clear()
                   
->insert($db->qn('#__rsmembership_tokens'))
                    ->columns(array($db->qn('user_id'),
$db->qn('token')))
                    ->values(implode(', ',
array($db->q($user->id), $db->q($hashedToken))));
            }

            $db->setQuery($query)->execute();

            // Create the URL
            $uri 	= JUri::getInstance();
            $base	= $uri->toString(array('scheme',
'user', 'pass', 'host', 'port'));
            $url    = $base .
JRoute::_('index.php?option=com_rsmembership&task=removedata.process&token='
. $token, false);

           
JFactory::getMailer()->sendMail($config->get('mailfrom'),
$config->get('fromname'), $user->email,
JText::sprintf('COM_RSMEMBERSHIP_REMOVE_REQUEST_EMAIL_SUBJECT',
$user->username, $config->get('sitename')),
JText::sprintf('COM_RSMEMBERSHIP_REMOVE_REQUEST_EMAIL_BODY',
$user->name, $url), true);
        }
        catch (Exception $e)
        {
            jexit($e->getMessage());
        }

        jexit(JText::_('COM_RSMEMBERSHIP_LINK_HAS_BEEN_SENT'));
    }

    public function process()
    {
        $app    = JFactory::getApplication();
        $user   = JFactory::getUser();

        try
        {
            if ($user->guest)
            {
                $link = base64_encode((string) JUri::getInstance());
               
$app->redirect(JRoute::_('index.php?option=com_users&view=login&return='
. $link, false),
JText::_('COM_RSMEMBERSHIP_MUST_BE_LOGGED_IN'));
            }

            if
(!RSMembershipHelper::getConfig('allow_self_anonymisation', 0))
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_THIS_FEATURE_MUST_BE_ENABLED'));
            }

            if ($user->authorise('core.admin'))
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_THIS_FEATURE_IS_NOT_AVAILABLE_FOR_SUPER_USERS'));
            }

            $token = $app->input->getCmd('token');
            if (!$token || strlen($token) != 32)
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_TOKEN_IS_INCORRECT'));
            }

            // Let's see if the token matches
            $db = JFactory::getDbo();
            $query = $db->getQuery(true)
                ->select($db->qn('token'))
                ->from($db->qn('#__rsmembership_tokens'))
                ->where($db->qn('user_id') . ' =
' . $db->q($user->id));
            $dbToken = $db->setQuery($query)->loadResult();

            if (!$dbToken || !JUserHelper::verifyPassword($token,
$dbToken))
            {
                throw new
Exception(JText::_('COM_RSMEMBERSHIP_TOKEN_IS_INCORRECT'));
            }

            // Delete the token
            $query->clear()
               
->delete($db->qn('#__rsmembership_tokens'))
                ->where($db->qn('user_id') . ' =
' . $db->q($user->id));
            $db->setQuery($query)->execute();

            // Anonymise data
            RSMembershipHelper::anonymise($user->id);

            $app->logout();
           
$app->redirect(JRoute::_('index.php?option=com_rsmembership&view=removedata',
false));
        }
        catch (Exception $e)
        {
            $app->enqueueMessage($e->getMessage(),
'error');
			$this->setRedirect(JRoute::_('index.php', false));
        }
    }
}helpers/adapters/fieldset.php000064400000002014151166265610012327
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

class RSFieldset {

    public function startFieldset( $legend='',
$class='rsmembership_form_table input') {
        $return = '<fieldset class="' . $class .
'">';
        if ($legend) {
            $return .= '<p class="rule-desc">' .
$legend . '</p>';
        }

        echo $return;
    }

    public function showField( $label, $input) {
        $return = '<div class="rsmemgrid-form-group
rsmemgrid-row">';
        if ($label) {
            $return .= '<div class="rsmemgrid-col-sm-2
rsmemgrid-col-form-label">'. $label
.'</div>';
        }
        $return .= '<div' . ( $label ? '
class="rsmemgrid-col-sm-10"' : '
class="rsmemgrid-col-sm-12"') .'>'. $input
.'</div>';
        $return .= '</div>';

        echo $return;
    }

    public function endFieldset() {
       echo '</fieldset>';
    }
}helpers/index.html000064400000000054151166265610010213
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>helpers/route.php000064400000006037151166265610010074
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined( '_JEXEC' ) or die( 'Restricted access' );

class RSMembershipRoute
{

	public static function Categories( $layout="default" ) 
	{
		$layouturl = '&layout='.$layout;

		return
'index.php?option=com_rsmemberships&view=categories'.$layouturl;
	}

	public static function Subscribe( $catid,  $category_name, $membership_id,
$membership_name, $Itemid ) 
	{
		$catidurl = '';
		if ( $catid ) 
		{
			$catidurl = '&catid='.(int)
$catid.':'.JFilterOutput::stringURLSafe($category_name);
		}

		$membershipurl = '';
		if ( $membership_id ) 
		{
			$membershipurl =
'&cid='.$membership_id.':'.JFilterOutput::stringURLSafe($membership_name);
		}

		$Itemidurl = '';
		if ( $Itemid ) 
		{
			$Itemidurl = '&Itemid='.$Itemid;
		}

		return
'index.php?option=com_rsmembership&task=subscribe'.$catidurl.$membershipurl.$Itemidurl;
	}

	public static function Memberships( $catid=0, $Itemid=null,
$layout="default" ) 
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$catid 	= (int) $catid;

		$layouturl = '&layout='.$layout;

		$catidurl = '';
		if ( $catid ) 
		{
			$query->select($db->qn('name'))->from($db->qn('#__rsmembership_categories'))->where($db->qn('id').'
= '.$db->q($catid));
			$db->setQuery($query);
			$category = $db->loadObject();

			$catidurl =
'&catid='.$catid.':'.JFilterOutput::stringURLSafe($category->name);
		}

		$ItemidUrl = '';
		if ( $Itemid ) 
			$ItemidUrl = '&Itemid='.(int) $Itemid;

		return
'index.php?option=com_rsmembership&view=rsmembership'.$layouturl.$catidurl.$ItemidUrl;
	}

	public static function Membership( $id, $Itemid=null ) 
	{
		$db 		= JFactory::getDBO();
		$query		= $db->getQuery(true);
		$id 		= (int) $id;

		$query->select($db->qn('name'))->from($db->qn('#__rsmembership_memberships'))->where($db->qn('id').'
= '.$db->q($id));
		$db->setQuery($query);
		$item_name = $db->loadResult();

		$ItemidUrl = '';
		if ( $Itemid ) 
			$ItemidUrl = '&Itemid='.(int) $Itemid;

		return
'index.php?option=com_rsmembership&view=membership&cid='.$id.':'.JFilterOutput::stringURLSafe($item_name).$ItemidUrl;
	}
	
	
	public static function Term( $id, $name, $tmpl=false ) 
	{
		$tmplurl = '';
		if ( $tmpl ) 
			$tmplurl = '&tmpl=component';

		return
'index.php?option=com_rsmembership&view=terms&cid='.$id.':'.JFilterOutput::stringURLSafe($name).$tmplurl;
	}
	
	public static function MyMemberships() 
	{
		return
'index.php?option=com_rsmembership&view=mymemberships';
	}

	public static function MyTransactions()
	{
		return
'index.php?option=com_rsmembership&view=mytransactions';
	}
	
	public static function MyMembership($membership_id) 
	{
		return
'index.php?option=com_rsmembership&view=mymembership&cid='.$membership_id;
	}

	public static function ThankYou() 
	{
		return 'index.php?option=com_rsmembership&task=thankyou';
	}
}index.html000064400000000054151166265610006551
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/categories.php000064400000003515151166265610010702
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelCategories extends JModelList
{
	public $_context = 'com_rsmembership.categories';

	public function getTable($type = 'Category', $prefix =
'RSMembershipTable', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	protected function getListQuery()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$params = $this->getState($this->context.'.params');

		$query
			->select('c.*')
			->select('COUNT('.$db->qn('m.category_id').')
AS '.$db->qn('memberships'))
			->from($db->qn('#__rsmembership_categories','c'))
			->join('left',
$db->qn('#__rsmembership_memberships', 'm').'
ON '.$db->qn('m.category_id').' =
'.$db->qn('c.id'))
			->where($db->qn('c.published').' =
'.$db->q('1'))
			->where($db->qn('m.published').' =
'.$db->q('1'))
			->group($db->qn('c.id'));

		$listOrdering  	= ( $params->get('orderby') ?
$params->get('orderby', 'ordering') :
$this->getState('list.ordering', 'ordering') );
		$listDirection 	= ( $params->get('orderdir') ?
$params->get('orderdir', 'ASC') :
$this->getState('list.direction', 'ASC') );

		$query->order($db->qn($listOrdering).'
'.$listDirection);

		return $query;
	}

	protected function populateState($ordering = null, $direction = null) 
	{
		$app 	= JFactory::getApplication();
		$active = $app->getMenu()->getActive();
		$params = new JRegistry;

		if ($active)
			$params->loadString($active->params);

		$this->setState($this->context.'.params', $params);

		parent::populateState('ordering', 'ASC');
	}
}models/extras.php000064400000003066151166265620010065 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelExtras extends JModelList
{
	public $_context = 'extras';

	public function getTable($type = 'Extra', $prefix =
'RSMembershipTable', $config = array()) 
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	protected function getListQuery() 
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		
		$membership_id =
JFactory::getApplication()->input->get('cid', 0,
'int');

		if ( $membership_id ) 
		{
			$query
				->select('*')
				->from($db->qn('#__rsmembership_membership_extras',
'me'))
				->join('left',
$db->qn('#__rsmembership_extras', 'e').' ON
'.$db->qn('me.extra_id').' =
'.$db->qn('e.id'))
				->where($db->qn('me.membership_id').' =
'.$db->q($membership_id))
				->where($db->qn('e.published').' =
'.$db->q('1'))
				->order($db->qn('e.ordering').' ASC');
		}

		return $query;
	}

	public function getExtraValues($extra_id)
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$query
			->select('*')
			->from($db->qn('#__rsmembership_extra_values'))
			->where($db->qn('published').' =
'.$db->q('1'))
			->where($db->qn('extra_id').' =
'.$db->q($extra_id))
			->order($db->qn('ordering').' ASC');
		$db->setQuery($query);

		return $this->_getList($query);
	}
}models/index.html000064400000000054151166265620010035
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>models/membership.php000064400000002251151166265620010705
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelMembership extends JModelItem
{
	public function __construct()
	{
		parent::__construct();
	}

	public function getItem($pk = null)
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$cid	= JFactory::getApplication()->input->get('cid', 0,
'int');

		$item 	= $this->getTable('Membership',
'RSMembershipTable');
		$item->load($cid);

		$query->select($db->qn('name'))->from($db->qn('#__rsmembership_categories'))->where($db->qn('id').'
= '.$db->q($item->category_id));
		$db->setQuery($query);
		$item->category_name = $db->loadResult();

		if ( $item->use_trial_period ) 
			$item->price = $item->trial_price;

		// disable buy button and out of stock warning
		if ($item->stock == -1) 
		{
			JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_OUT_OF_STOCK'),
'warning');
		}

		return $item;
	}
}models/mymembership.php000064400000112545151166265620011263
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipModelMymembership extends JModelItem
{
	public 		$_html = '';
	protected 	$_data = null;
	protected 	$_folder = null;
	protected 	$_parents = array();
	protected 	$_extra_parents = array();
	protected 	$_parent = 0;
	protected 	$transaction_id = 0;

	protected 	$context = 'com_rsmembership.mymembership';

	public		$terms;
	
	protected 	$user;
	protected 	$isWindows;
	
	public function __construct()
	{
		parent::__construct();
		jimport('joomla.filesystem.folder');

		// Some workarounds are needed for Windows
		$this->isWindows = DIRECTORY_SEPARATOR == '\\';
		
		// Get logged in user
		$this->user = JFactory::getUser();
		
		$app 	= JFactory::getApplication();
		$jinput = $app->input;
		
		$db 	= JFactory::getDbo();
		$query	= $db->getQuery(true);

		// Not logged in - must redirect to login.
		if ($this->user->guest) {
			$link = base64_encode((string) JUri::getInstance());
			$app->redirect(JRoute::_('index.php?option=com_users&view=login&return='.$link,
false));
		}
		
		// Membership doesn't match - redirect back to My Memberships page.
		if (!$this->_getMembership()) {
			$app = JFactory::getApplication();
			$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
		}

		
		$this->getParentFolders();
		$this->getExtraParentFolders();
		
		// Let's see if the membership is active
		if ($this->_data->status > 0) {
			return;
		}
		
		// let's get the path
		$path = $jinput->get('path', '',
'string');
		if (!empty($path)) 
		{
			$path = explode("|", $path);
			// extract the parent folder's id
			$parent_id = (int) $path[0];

			if (empty($parent_id)) 
				$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));

			// extract the path within the parent
			$path = !empty($path[1]) ? $path[1] : '';

			// check where are we looking
			$from = $this->getFrom();
			if ( $from == 'membership' ) 
				$parent = $this->_parents[$parent_id];
			elseif ( $from == 'extra' ) 
				$parent = $this->_extra_parents[$parent_id];

			// check if the parent is within the allowed parents list
			if (empty($parent)) 
				$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));

			$this->_parent = $parent_id;

			// compute the full path: parent + path
			$path 	= realpath($parent.'/'.$path);
			$parent = realpath($parent);

			// check if we are trying to access a path that's not within the
parent
			if (strpos($path, $parent) !== 0)
				$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
			
			// let's see if we've requested a download
			$task = $jinput->get('task', '',
'cmd');

			if ($task == 'download')
			{
				// check if path exists and is a file
				if ( is_file($path) ) 
				{
					// check if we need to agree to terms first
					$query
						->select($db->qn('term_id'))
						->from($db->qn('#__rsmembership_files'))
						->where($db->qn('path').' =
'.$db->q($path));
					$db->setQuery($query);
					$term_id = $db->loadResult();

					if ( !empty($term_id) ) 
					{
						$row =
JTable::getInstance('Term','RSMembershipTable');
						$row->load($term_id);
						if (!$row->published)
							$term_id = 0;
					}

					$agree = $jinput->get('agree', '',
'string');
					if (!empty($term_id) && empty($agree))
					{
						$this->terms = $row->description;
					}
					else
					{
						@ob_end_clean();
						$filename = basename($path);
						header("Cache-Control: public, must-revalidate");
						header('Cache-Control: pre-check=0, post-check=0,
max-age=0');
						header("Pragma: no-cache");
						header("Expires: 0"); 
						header("Content-Description: File Transfer");
						header("Expires: Sat, 01 Jan 2000 01:00:00 GMT");
						if (preg_match('#Opera#',
$_SERVER['HTTP_USER_AGENT']))
							header("Content-Type: application/octetstream");
						else
							header("Content-Type: application/octet-stream");

						header("Content-Length: ".(string) filesize($path));
						header('Content-Disposition: attachment;
filename="'.$filename.'"');
						header("Content-Transfer-Encoding: binary\n");
						@readfile($path);
						$row 			=
JTable::getInstance('Log','RSMembershipTable');
						$row->date 		= JFactory::getDate()->toSql();
						$row->user_id 	= $this->user->id;
						$row->path 		= '[DWN] '.$path;
						$row->ip 		= RSMembershipHelper::getIP();
						$row->store();
						exit();
					}
				}
				else
					$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
			}
			else 
			{
				// check if the path exists and is a folder
				if ( is_dir($path) ) 
				{
					$this->_folder = $path;
					if ( substr($this->_folder, -1) == '/' ) 
						$this->_folder = substr($this->_folder, 0, -1);
				}
				else 
					$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
			}
		}
	}

	protected function setNiceName($path, &$element) {
		static $cache;
		if (!is_array($cache)) {
			$db 	= JFactory::getDbo();
			$query 	= $db->getQuery(true);
			
			$query->select('*')
			  ->from($db->qn('#__rsmembership_files'));
			$db->setQuery($query);
			$cache = $db->loadObjectList('path');
		}
		
		if (!empty($cache[$path])) {
			$found					= &$cache[$path];
			$element->name 			= $found->name;
			$element->description 	= $found->description;
			$element->thumb 		= $found->thumb;
			$element->thumb_w 		= $found->thumb_w;
		}
	}

	protected function _getMembership() {
		$id 	= $this->user->id;
		$cid 	= $this->getCid();
		$db 	= JFactory::getDbo();
		$query	= $db->getQuery(true);
		
		$query
			->select('ms.*')
			->select($db->qn('m.name'))
			->select($db->qn('m.term_id'))
			->select($db->qn('m.no_renew'))
			->select($db->qn('m.use_renewal_price'))
			->select($db->qn('m.renewal_price'))
			->select($db->qn('m.price'))
			->from($db->qn('#__rsmembership_membership_subscribers',
'ms'))
			->join('left',
$db->qn('#__rsmembership_memberships', 'm').'
ON '.$db->qn('ms.membership_id').' =
'.$db->qn('m.id'))
			->where($db->qn('ms.id').' =
'.$db->q($cid))
			->where($db->qn('ms.user_id').' =
'.$db->q($id))
			->where($db->qn('m.published').' =
'.$db->q(1));
		$db->setQuery($query);
		$this->_data = $db->loadObject();
		
		if (!$this->_data) {
			return false;
		}
		
		// Filter values
		$this->_data->extras = explode(',',
$this->_data->extras);
		$this->_data->extras = array_filter($this->_data->extras);
		$this->_data->extras = implode(',',
$this->_data->extras);
		
		return true;
	}


	public function getMembershipSubscriber($action_type =
'addextra')
	{
		$app = JFactory::getApplication();
		$user = JFactory::getUser();
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);

		$ids = $this->_getIds($action_type);

		$query
			->select($db->qn('membership_id'))
			->select($db->qn('status'))
			->select($db->qn('extras'))
			->select($db->qn('last_transaction_id'))
			->from($db->qn('#__rsmembership_membership_subscribers'))
			->where($db->qn('user_id') . ' = ' .
$db->q($user->get('id')))
			->where($db->qn('id') . ' = ' .
$db->q($ids->cid));
		$db->setQuery($query);
		$membership = $db->loadObject();

		if (empty($membership)) {
			$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
		}

		if ($check_addextra_upgrade = ($membership->status > 0 &&
($action_type == 'addextra' || $action_type ==
'upgrade')) || $check_renew = ($membership->status == 1
&& $action_type == 'renew'))
		{
			JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_NOT_'.(isset($check_renew)
? 'EXPIRED' : 'ACTIVE')), 'warning');
			$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
		}

		if ($action_type == 'upgrade') {
			$query->clear();
			$query
				->select('u.*')
				->select($db->qn('mfrom.name', 'fromname'))
				->select($db->qn('mto.name', 'toname'))
				->select($db->qn('mto.term_id'))
				->from($db->qn('#__rsmembership_membership_upgrades',
'u'))
				->join('left',
$db->qn('#__rsmembership_memberships',
'mfrom').' ON '.$db->qn('mfrom.id').'
= '.$db->qn('u.membership_from_id'))
				->join('left',
$db->qn('#__rsmembership_memberships', 'mto').'
ON '.$db->qn('mto.id').' =
'.$db->qn('u.membership_to_id'))
				->where($db->qn('u.membership_from_id').' =
'.$db->q($membership->membership_id))
				->where($db->qn('u.membership_to_id').' =
'.$db->q($ids->to_id))
				->where($db->qn('u.published').' =
'.$db->q(1));
			$db->setQuery($query);
			$return = $db->loadObject();

			if ( empty($return) )
			{
				$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
			} else {
				$this->_data->term_id = $return->term_id;
			}

			return $return;
		}

		$last_transaction_id = $membership->last_transaction_id;

		$query->clear();
		$query
			->select('*')
			->from($db->qn('#__rsmembership_memberships'))
			->where($db->qn('id').' =
'.$db->q($membership->membership_id));

		if ($action_type == 'addextra') {
			$query->where($db->qn('published').' =
'.$db->q(1));
		}

		$db->setQuery($query);
		$membership = $db->loadObject();

		if ($action_type == 'renew') {
			if ( $membership->use_renewal_price )
				$membership->price = $membership->renewal_price;

			if ( $membership->no_renew )
			{
				JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_CANNOT_RENEW'),
'warning');

				$app->redirect(JRoute::_(RSMembershipRoute::MyMemberships(),
false));
			}
		}

		$membership->last_transaction_id = $last_transaction_id ;
		return $membership;
	}

	public function getSubscriberData()
	{
		$user 	= JFactory::getUser();
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$query
			->select('*')
			->from($db->qn('#__rsmembership_subscribers'))
			->where($db->qn('user_id').' =
'.$db->q($user->get('id')));
		$db->setQuery($query);

		return $db->loadObject();
	}


	public function getBoughtExtras()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$return = array();

		if (!empty($this->_data->extras))
		{
			$query
				->select($db->qn('id'))
				->select($db->qn('extra_id'))
				->select($db->qn('name'))
				->from($db->qn('#__rsmembership_extra_values'))
				->where($db->qn('id').' IN
('.RSMembershipHelper::quoteImplode($this->_data->extras).')')
				->where($db->qn('published') .' = '.
$db->q('1'))
				->order($db->qn('extra_id').' ASC,
'.$db->qn('ordering').' ASC');
			$db->setQuery($query);
			$extravalues = $db->loadObjectList();

			foreach ( $extravalues as $extravalue ) 
				$return[$extravalue->extra_id][$extravalue->id] =
$extravalue->name;
		}

		return $return;
	}

	public function getExtras($extras_values = false)
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$return = array();

		$query
			->select('e.*')
			->from($db->qn('#__rsmembership_membership_extras',
'me'))
			->join('left',
$db->qn('#__rsmembership_extras', 'e').' ON
'.$db->qn('me.extra_id') .' =
'.$db->qn('e.id'))
			->where($db->qn('me.membership_id').' =
'.$db->q($this->_data->membership_id))
			->where($db->qn('e.published').' =
'.$db->q('1'));

		$db->setQuery($query);
		$extras = $db->loadObjectList();

		foreach ( $extras as $extra )
		{
			$query->clear();
			$query
				->select('*')
				->from($db->qn('#__rsmembership_extra_values'))
				->where($db->qn('extra_id').' =
'.$db->q($extra->id))
				->where($db->qn('published').' =
'.$db->q('1'))
				->order($db->qn('ordering').' ASC');

			if ( !$extras_values  && !empty($this->_data->extras) ) {
				$query->where($db->qn('id') . ' NOT IN (' .
RSMembershipHelper::quoteImplode($this->_data->extras) .
')');
			} else if ($extras_values && !empty($extras_values)) {
				// condition used for the renew process
				$query->where($db->qn('id') . ' IN (' .
RSMembershipHelper::quoteImplode($extras_values) . ')');
			}

			$db->setQuery($query);
			$values = $db->loadObjectList();

			if ( !empty($values) ) {
				foreach ($values as $value) {
					$value->type = $extra->type;
				}
			}
			$return = array_merge($return, $values);
		}

		return $return;
	}

	public function getBoughtExtrasRenew() {
		$extras_purchased = $this->getBoughtExtras();

		if (!empty($extras_purchased)) {
			$extras_values = array();
			foreach ($extras_purchased as $extras_p) {
				$extras_p = array_keys($extras_p);
				foreach ($extras_p as $extra_value_id) {

					$extras_values[] = $extra_value_id;
				}
			}

			return $this->getExtras($extras_values);
		}

		return array();
	}

	public function getSelectedExtra($extra_id)
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$extra_value_id = (int) $extra_id;
		$extra_value 	=
JTable::getInstance('ExtraValue','RSMembershipTable');
		$extra_value->load($extra_value_id);

		$query
			->select('type')
			->from($db->qn('#__rsmembership_extras'))
			->where($db->qn('published').' =
'.$db->q(1))
			->where($db->qn('id').' =
'.$db->q($extra_value->extra_id));
		$db->setQuery($query);
		$extra_value->type = $db->loadResult();

		return $extra_value;
	}

	public function getUpgrades()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$query
			->select('u.*')
			->select($db->qn('m.name'))
			->from($db->qn('#__rsmembership_membership_upgrades',
'u'))
			->join('left',
$db->qn('#__rsmembership_memberships', 'm').'
ON '.$db->qn('u.membership_to_id').' =
'.$db->qn('m.id'))
			->where($db->qn('u.membership_from_id').' =
'.$db->q($this->_data->membership_id))
			->where($db->qn('m.published').' =
'.$db->q('1'))
			->where($db->qn('u.published').' =
'.$db->q('1'));
		$db->setQuery($query);

		return $db->loadObjectList();
	}

	public function getTerms()
	{
		return $this->terms;
	}

	public function getMembership()
	{
		return $this->_data;
	}

	public function getMembershipTerms()
	{
		if (!empty($this->_data->term_id))
		{
			$row =
JTable::getInstance('Term','RSMembershipTable');
			$row->load($this->_data->term_id);
			if (!$row->published)
				return false;

			return $row;
		}

		return false;
	}

	public function getCid()
	{
		$input = JFactory::getApplication()->input;
		$payment = $input->getCmd('payment', '');
		if (!empty($payment) && $input->getCmd('layout',
'') == 'payment') {
			$action_type = $input->getCmd('action_type',
'');
			$ids = $this->_getIds($action_type);
			$cid = $ids->cid;
		} else {
			$cid = JFactory::getApplication()->input->get('cid', 0,
'int');
		}

		return $cid;
	}

	public function getExtraId(){
		return JFactory::getApplication()->input->get('extra_id',
0, 'int');
	}

	public function getToId()
	{
		return JFactory::getApplication()->input->get('to_id', 0,
'int');
	}

	public function getFrom()
	{
		return JFactory::getApplication()->input->get('from',
'membership', 'word');
	}

	public function getParentFolders()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		// let's see if the membership is active
		if ($this->_data->status > 0)
			return $this->_parents;

		$query
			->select($db->qn('id'))
			->select($db->qn('params', 'path'))
			->from($db->qn('#__rsmembership_membership_shared'))
			->where($db->qn('membership_id').' =
'.$db->q($this->_data->membership_id))
			->where($db->qn('type').' =
'.$db->q('folder'))
			->where($db->qn('published').' =
'.$db->q('1'))
			->order($db->qn('ordering').' ASC');
		$db->setQuery($query);

		$parents = $db->loadObjectList();
		foreach ($parents as $parent) {
			$this->_parents[$parent->id] =
$this->cleanPath($parent->path);
		}
		
		return $this->_parents;
	}

	public function getExtraParentFolders()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		// let's see if the membership is active
		if ($this->_data->status > 0)
			return $this->_extra_parents;

		if (empty($this->_data->extras)) 
			return $this->_extra_parents;

		$query
			->select($db->qn('id'))
			->select($db->qn('params'))
			->from($db->qn('#__rsmembership_extra_value_shared'))
			->where($db->qn('extra_value_id').' IN
('.RSMembershipHelper::quoteImplode($this->_data->extras).')')
			->where($db->qn('type').' =
'.$db->q('folder'))
			->where($db->qn('published').' =
'.$db->q('1'))
			->order($db->qn('ordering').' ASC');
		$db->setQuery($query);

		$parents = $db->loadObjectList();

		foreach ( $parents as $parent ) 
			$this->_extra_parents[$parent->id] =
$this->cleanPath($parent->params);

		return $this->_extra_parents;
	}

	protected function cleanPath($path) {
		$path = realpath($path);
		$path = rtrim($path, '\\/');
		
		if ($this->isWindows) {
			$path = str_replace('\\', '/', $path);
		}
		
		return $path;
	}
	
	public function getFolders()
	{
		$folders 		= array();
		$all_folders 	= array();
		
		// let's see if the membership is active
		if ($this->_data->status > 0)
			return $folders;
		
		// Check if we are not browsing a folder
		if (is_null($this->_folder)) {
			// Show all the folders associated with this membership
			foreach ($this->_parents as $folder) {
				$all_folders[] = (object) array(
					'name' => $folder,
					'from' => 'membership'
				);
			}
			
			// Show all the folders associated with the extra values of this
membership
			foreach ($this->_extra_parents as $folder) {
				$all_folders[] = (object) array(
					'name' => $folder,
					'from' => 'extra'
				);
			}
				
			// We don't need a parent since we have the full path in the
database
			$parent = '';
		} else {
			// Show the folders in the current folder
			$subfolders = JFolder::folders($this->_folder);
			$from		= $this->getFrom();
			foreach ($subfolders as $folder) {
				$all_folders[] = (object) array(
					'name' => $folder,
					'from' => $from
				);
			}
			
			// We need the parent to be set as the current folder
			$parent = $this->_folder.'/';
		}
		
		// prepare our folders
		foreach ($all_folders as $folder) {
			// Membership or extra ?
			$from 	= $folder->from;
			// Get the folder's name
			$folder = $parent.$folder->name;
			// Clean it
			$folder = $this->cleanPath($folder);
			// Set folder name as default
			$name = strrchr($folder, '/');
			if ($name) {
				$name = ltrim($name, '/');
			} else {
				$name = $folder;
			}
			
			$element = (object) array(
				'from' => $from,
				'name' => $name,
				'description',
				'thumb',
				'thumb_w',
				'fullpath'
			);
			
			// Try to find the element name from the db
			// It's a folder so we need to append a slash
			$this->setNiceName($folder.'/', $element);
			
			// Select the array, defaults to memberships.
			$parents = $from == 'extra' ? $this->_extra_parents :
$this->_parents;

			// Let's see if we are browsing the parent
			$pos = array_search($folder, $parents);
			if ($pos !== false) {
				// We are listing the available shared folders so we need the id of the
parent as the path
				$element->fullpath = $pos;
			} else {
				// We are browsing through the parent so we need the subpath along with
the id of the parent
				$element->fullpath =
$this->_parent.'|'.substr_replace($folder, '', 0,
strlen($parents[$this->_parent]) + 1);
			}
			
			$folders[] = $element;
		}
		
		return $folders;
	}
	
	public function getFiles()
	{
		$files = array();
		
		// let's see if the membership is active
		if ($this->_data->status > 0) 
			return $files;

		if (!is_null($this->_folder)) {
			$all_files = JFolder::files($this->_folder);
			$folder	   = $this->cleanPath($this->_folder);
			$from	   = $this->getFrom();
			
			foreach ($all_files as $file) {
				$element = (object) array(
					'from' => $from,
					'name' => $file,
					'description',
					'thumb',
					'thumb_w',
					'fullpath',
					'published' => 1
				);
				
				// Try to find the element name from the db
				$this->setNiceName($folder.'/'.$file, $element);
				
				// Select the array, defaults to memberships.
				$parents = $from == 'extra' ? $this->_extra_parents :
$this->_parents;

				$element->fullpath =
$this->_parent.'|'.substr_replace($folder.'/'.$file,
'', 0, strlen($parents[$this->_parent]) + 1);
				
				$files[] = $element;
			}
		}
		
		return $files;
	}
	
	public function getCurrent() {
		return $this->_folder;
	}

	public function getPrevious() 
	{
		$from 		= $this->getFrom();
		$parents 	= $from == 'extra' ? $this->_extra_parents :
$this->_parents;
		
		if (in_array($this->cleanPath($this->_folder), $parents)) { 
			return '';
		}

		if (!empty($this->_parent)) {
			$parts = explode('/',
$this->cleanPath($this->_folder));
			if (count($parts) > 1) {
				array_pop($parts);
			}
			
			$folder = implode('/', $parts);
			$folder = substr_replace($folder, '', 0,
strlen($parents[$this->_parent]) + 1);

			return $this->_parent.'|'.$folder;
		}

		return false;
	}

	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();
				}
		}
	}

	public function getExtra()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$ids = $this->_getIds();

		$extra_value 	=
JTable::getInstance('ExtraValue','RSMembershipTable');
		$extra_value->load($ids->extra_id);

		$query
			->select('type')
			->from($db->qn('#__rsmembership_extras'))
			->where($db->qn('published').' =
'.$db->q(1))
			->where($db->qn('id').' =
'.$db->q($extra_value->extra_id));
		$db->setQuery($query);
		$extra_value->type = $db->loadResult();

		return $extra_value;
	}

	public function checkBoughtExtra() {
		$ids = $this->_getIds();

		$membership_id 	= $ids->cid;
		$bought_extras 	= $this->getBoughtExtras();
		$current_extra 	= $this->getSelectedExtra($ids->extra_id);

		$app = JFactory::getApplication();

		// check if extra is already purchased
		if (empty($current_extra) || ( $current_extra->type !=
'checkbox' &&
isset($bought_extras[$current_extra->extra_id]) ) ) {
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_ALREADY_BOUGHT_EXTRA'),
'warning');
			// if the error is displayed we need to empty the session
			$this->_emptySession();

			$app->redirect(JRoute::_(RSMembershipRoute::MyMembership($membership_id),
false));
		}
	}

	public function getHtml()
	{
		return $this->_html;
	}

	public function bindId($cid, $extra_id = null, $type =
'addextra')
	{
		$session = JFactory::getSession();
		$session->set($this->context.'.'.$type.'.cid',
$cid);
		if ($extra_id != null && $type == 'addextra') {
			$session->set($this->context . '.' . $type .
'.extra_id', $extra_id);
		} else if ($extra_id != null && $type == 'upgrade') {
			$session->set($this->context . '.' . $type .
'.to_id', $extra_id);
		}
	}

	protected function _getIds($type = 'addextra')
	{
		static $ids;
		if (is_null($ids))
		{
			$session = JFactory::getSession();
			$ids = array();
			$ids['cid'] = (int)$session->get($this->context .
'.'.$type.'.cid', 0);

			if ($type == 'addextra') {
				$ids['extra_id'] = (int)$session->get($this->context .
'.'.$type.'.extra_id', 0);
			}

			if ($type == 'upgrade') {
				$ids['to_id'] = (int)$session->get($this->context .
'.'.$type.'.to_id', 0);
			}

			$ids = (object) $ids;
		}

		return $ids;
	}

	protected function _emptySession($type = 'addextra')
	{
		$session = JFactory::getSession();
		if ($type == 'addextra') {
			$session->set($this->context . '.addextra.extra_id',
null);
		}
		if ($type == 'upgrade') {
			$session->set($this->context . '.upgrade.to_id', null);
		}

		$session->set($this->context .
'.'.$type.'.cid', null);
	}

	// renew/upgrade Specific
	public function storeData($params) {
		$session = JFactory::getSession();
		if (isset($params['id'])) {
			$context = $this->context.'.upgrade.';
			$session->set($context.'id', $params['id']);

			$newcontext = $context.$params['id'].'.';
			$session->set($newcontext.'membership_fields',
$params['membership_fields']);
			$session->set($context.'custom_fields',
$params['custom_fields']);
		} else {
			$session->set($this->context .
'.renew.membership_fields',
$params['membership_fields']);
			$session->set($this->context . '.renew.custom_fields',
$params['custom_fields']);
		}
	}

	public function getSentData($action_type = 'renew') {
		$session = JFactory::getSession();
		$params	 = array();

		if ($action_type == 'upgrade') {
			$params['to_id'] = 0;

			$context = $this->context.'.upgrade.';
			if ($id = $session->get($context.'id')) {
				$params['to_id'] = $id;
			}
			if ($params['to_id']) {
				$newcontext = $context.$params['to_id'].'.';

				if ($membership_fields =
$session->get($newcontext.'membership_fields')) {
					$params['membership_fields'] = $membership_fields;
				}
			}
			if ($custom_fields =
$session->get($context.'custom_fields')) {
				$params['custom_fields'] = $custom_fields;
			}

		} else {
			if ($membership_fields = $session->get($this->context .
'.renew.membership_fields')) {
				$params['membership_fields'] = $membership_fields;
			}
			if ($custom_fields = $session->get($this->context .
'.renew.custom_fields')) {
				$params['custom_fields'] = $custom_fields;
			}
		}
		return $params;
	}

	public function addExtraPayment() {
		$ids = $this->_getIds();

		$this->_emptySession();

		$membership 	= $this->getMembershipSubscriber();
		$extra 			= $this->getExtra();
		$app = JFactory::getApplication();
		$paymentplugin 	= $app->input->get('payment',
'none', 'cmd');

		// check if extra is already purchased (redirects if it is) - we need to
check it here two because it can be accessed by link directly
		$this->checkBoughtExtra();

		// calculate the total price
		$total = $extra->price;

		$user 		= JFactory::getUser();
		$user_id 	= $user->get('id');

		$row 			 =
JTable::getInstance('Transaction','RSMembershipTable');
		$row->user_id 	 = $user_id;
		$row->user_email = $user->get('email');

		$this->_data = new stdClass();
		$this->_data->username 	= $user->get('username');
		$this->_data->name 		= $user->get('name');
		$this->_data->email 	= $user->get('email');
		$this->_data->fields 	=
RSMembershipHelper::getUserFields($user->get('id'));
		$membership_fields 				=
RSMembershipHelper::getTransactionMembershipFields($user->get('id'),
$membership->last_transaction_id);
		if (count($membership_fields)) {
			$this->_data->membership_fields = $membership_fields;
		}

		$row->user_data = serialize($this->_data);

		$row->type = 'addextra';
		$params = array();
		$params[] = 'id='.$ids->cid;
		$params[] = 'membership_id='.$membership->id;
		$params[] = 'extras='.$extra->id;


		$transaction_data = array(
			'extras' => array()
		);

		$transaction_data['extras'][] = (object) array('name'
=> $extra->name, 'price' => $extra->price);
		$transaction_data = json_encode($transaction_data);


		$row->params 			= implode(';', $params); // params,
membership, extras etc
		$row->date 				= JFactory::getDate()->toSql();
		$row->ip 				= RSMembershipHelper::getIP();
		$row->price 			= $total;
		$row->currency 			=
RSMembershipHelper::getConfig('currency');
		$row->hash 				= '';
		$row->gateway 			= $paymentplugin == 'none' ? 'No
Gateway' : RSMembership::getPlugin($paymentplugin);
		$row->status 			= 'pending';
		$row->transaction_data 	= $transaction_data;

		$this->_html = '';

		// trigger the payment plugin
		$delay = false;
		$args  = array(
			'plugin' => $paymentplugin,
			'data' => &$this->_data,
			'extras' => array(),
			'membership' => $membership,
			'transaction' => &$row,
			'html' => &$this->_html
		);

		$returns = $app->triggerEvent('onMembershipPayment',
$args);

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$this->_html = $value;
				}
			}
		}

		$properties = $row->getProperties();
		$returns = $app->triggerEvent('delayTransactionStoring',
array(array('plugin' => $paymentplugin, 'properties'
=> &$properties, 'delay' => &$delay)));

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$delay = true;
				}
			}
		}

		// plugin can delay the transaction storing
		if ( !$delay )
		{
			// store the transaction
			$row->store();

			// store the transaction id
			$this->transaction_id = $row->id;

			// finalize the transaction (send emails)
			RSMembership::finalize($this->transaction_id);

			// approve the transaction
			if ( $row->status == 'completed' || ($row->price == 0
&& $membership->activation != 0) )
				RSMembership::approve($this->transaction_id, true);

			if ( $row->price == 0 )
				$app->redirect(JRoute::_(RSMembershipRoute::ThankYou(), false));
		}
	}

	public function renewPayment() {
		$ids = $this->_getIds('renew');

		$this->_emptySession('renew');

		$membership 	= $this->getMembershipSubscriber('renew');
		$extras 		= $this->getBoughtExtrasRenew();
		$app = JFactory::getApplication();
		$paymentplugin 	= $app->input->get('payment',
'none', 'cmd');

		// calculate the total price
		$total 		= 0;
		$total 	   += $membership->price;
		$extras_ids = array();
		foreach ( $extras as $extra ) {
			$total 		 += $extra->price;
			$extras_ids[] = $extra->id;
		}

		$user 		= JFactory::getUser();
		$user_id 	= $user->get('id');

		$row 			 =
JTable::getInstance('Transaction','RSMembershipTable');
		$row->user_id 	 = $user_id;
		$row->user_email = $user->get('email');

		$this->_data = new stdClass();
		$this->_data->username 			= $user->get('username');
		$this->_data->name 				= $user->get('name');
		$this->_data->email 			= $user->get('email');

		$membership_data =  $this->getSentData();

		if (isset($membership_data['custom_fields'])) {
			$this->_data->fields =
$membership_data['custom_fields'];
		}

		if (isset($membership_data['membership_fields'])) {
			$this->_data->membership_fields =
$membership_data['membership_fields'];
		}
		$row->user_data = serialize($this->_data);

		$row->type 	= 'renew';
		$params 	= array();
		$params[] 	= 'id='.$ids->cid;
		$params[] 	= 'membership_id='.$membership->id;
		if ( !empty($extras_ids) ) {
			$params[] = 'extras=' . implode(',', $extras_ids);
		}

		$row->params 	= implode(';', $params); // params,
membership, extras etc
		$row->date 		= JFactory::getDate()->toSql();
		$row->ip 		= RSMembershipHelper::getIP();
		$row->price 	= $total;
		$row->currency 	=
RSMembershipHelper::getConfig('currency');
		$row->hash 		= '';
		$row->gateway 	= $paymentplugin == 'none' ? 'No
Gateway' : RSMembership::getPlugin($paymentplugin);
		$row->status 	= 'pending';

		$this->_html = '';

		// trigger the payment plugin
		$delay = false;
		$args  = array(
			'plugin' => $paymentplugin,
			'data' => &$this->_data,
			'extras' => $extras,
			'membership' => $membership,
			'transaction' => &$row,
			'html' => &$this->_html
		);

		// trigger the payment plugin
		$returns = $app->triggerEvent('onMembershipPayment',
$args);

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$this->_html = $value;
				}
			}
		}

		$properties = $row->getProperties();
		$returns = $app->triggerEvent('delayTransactionStoring',
array(array('plugin' => $paymentplugin, 'properties'
=> &$properties, 'delay' => &$delay)));

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$delay = true;
				}
			}
		}

		// plugin can delay the transaction storing
		if ( !$delay )
		{
			// store the transaction
			$row->store();

			// store the transaction id
			$this->transaction_id = $row->id;

			// finalize the transaction (send emails)
			RSMembership::finalize($this->transaction_id);

			// approve the transaction
			if ( $row->status == 'completed' || ($row->price == 0
&& $membership->activation != 0) )
				RSMembership::approve($this->transaction_id, true);

			if ( $row->price == 0 )
				$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=thankyou',
false));
		}
	}

	public function upgradePayment() {
		$ids = $this->_getIds('upgrade');

		$this->_emptySession('upgrade');

		$extras 		= array();
		$upgrade 		= $this->getMembershipSubscriber('upgrade');
		$membership 	=
$this->getMembershipUpgrade($upgrade->membership_to_id);

		$app = JFactory::getApplication();
		$paymentplugin 	= $app->input->get('payment',
'none', 'cmd');

		// calculate the total price
		$total = $upgrade->price;

		$user 	 = JFactory::getUser();
		$user_id = $user->get('id');

		$row =
JTable::getInstance('Transaction','RSMembershipTable');
		$row->user_id = $user_id;
		$row->user_email = $user->get('email');

		$this->_data = new stdClass();
		$this->_data->username 	= $user->get('username');
		$this->_data->name 		= $user->get('name');
		$this->_data->email 	= $user->get('email');

		$membership_data=  $this->getSentData('upgrade');
		if (isset($membership_data['custom_fields'])) {
			$this->_data->fields =
$membership_data['custom_fields'];
		}
		if ($membership_data['to_id'] == $upgrade->membership_to_id
) {
			if (isset($membership_data['membership_fields'])) {
				$this->_data->membership_fields =
$membership_data['membership_fields'];
			}
		}
		$row->user_data 		= serialize($this->_data);

		$row->type = 'upgrade';
		$params = array();
		$params[] = 'id='.$ids->cid;
		$params[] = 'from_id='.$upgrade->membership_from_id;
		$params[] = 'to_id='.$upgrade->membership_to_id;

		$row->params 	= implode(';', $params); // params,
membership, extras etc
		$row->date 		= JFactory::getDate()->toSql();
		$row->ip 		= RSMembershipHelper::getIP();
		$row->price 	= $total;
		$row->currency 	=
RSMembershipHelper::getConfig('currency');
		$row->hash 		= '';
		$row->gateway 	= $paymentplugin == 'none' ? 'No
Gateway' : RSMembership::getPlugin($paymentplugin);
		$row->status 	= 'pending';

		$this->_html = '';

		// trigger the payment plugin
		$delay = false;
		$args  = array(
			'plugin' => $paymentplugin,
			'data' => &$this->_data,
			'extras' => $extras,
			'membership' => $membership,
			'transaction' => &$row,
			'html' => &$this->_html
		);

		$returns = $app->triggerEvent('onMembershipPayment',
$args);

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$this->_html = $value;
				}
			}
		}

		$properties = $row->getProperties();
		$returns = $app->triggerEvent('delayTransactionStoring',
array(array('plugin' => $paymentplugin, 'properties'
=> &$properties, 'delay' => &$delay)));

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$delay = true;
				}
			}
		}

		// trigger the payment plugin
		// plugin can delay the transaction storing
		if (!$delay)
		{
			// store the transaction
			$row->store();

			// store the transaction id
			$this->transaction_id = $row->id;

			// finalize the transaction (send emails)
			RSMembership::finalize($this->transaction_id);

			// approve the transaction
			if ( $row->status == 'completed' || ($row->price == 0
&& $membership->activation != 0) )
				RSMembership::approve($this->transaction_id, true);

			if ( $row->price == 0 )
				$app->redirect(JRoute::_('index.php?option=com_rsmembership&task=thankyou',
false));
		}
	}

	public function getMembershipUpgrade ($cid)
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$cid	= (int) $cid;

		$query
			->select('*')
			->from($db->qn('#__rsmembership_memberships'))
			->where($db->qn('published').' =
'.$db->q(1))
			->where($db->qn('id').' = '.$db->q($cid));
		$db->setQuery($query);

		return $db->loadObject();
	}
}models/mymemberships.php000064400000003665151166265620011450
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelMymemberships extends JModelList
{
	public $_context = 'com_rsmembership.mymemberships';

	public function __construct($config = array())
	{
		parent::__construct($config);

		$user = JFactory::getUser();
		if ( $user->get('guest') ) 
		{
			$link 		 = JUri::getInstance();
			$link 		 = base64_encode($link);
			$user_option = 'com_users';

			JFactory::getApplication()->redirect('index.php?option='.$user_option.'&view=login&return='.$link);
		}
	}

	public function getTable($type = 'Membership', $prefix =
'RSMembershipTable', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	protected function getListQuery()
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$user 	= JFactory::getUser();
		$cid 	= $user->get('id');

		$query
			->select('u.*, '.$db->qn('m.name'))
			->from($db->qn('#__rsmembership_membership_subscribers',
'u'))
			->join('left',
$db->qn('#__rsmembership_memberships', 'm').'
ON '.$db->qn('u.membership_id').' =
'.$db->qn('m.id'))
			->where($db->qn('user_id').' =
'.$db->q($cid))
			->where($db->qn('m.published').' =
'.$db->q('1'))
			->where($db->qn('u.published').' =
'.$db->q('1'));

		return $query;
	}

	public function getTransactions()
	{
		$user 	= JFactory::getUser();
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$query
			->select('*')
			->from($db->qn('#__rsmembership_transactions'))
			->where($db->qn('user_id').' =
'.$db->q($user->get('id')))
			->where($db->qn('status').' =
'.$db->q('pending'))
			->order($db->qn('date').' DESC');

		return $this->_getList($query);
	}
}models/mytransactions.php000064400000005323151166265620011633
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelMytransactions extends JModelList
{
    public $_context = 'com_rsmembership.mytransactions';

    public function __construct($config = array())
    {
        parent::__construct($config);

        $user = JFactory::getUser();
        if ( $user->get('guest') )
        {
            $link 		 = JUri::getInstance();
            $link 		 = base64_encode($link);
            $user_option = 'com_users';

           
JFactory::getApplication()->redirect('index.php?option='.$user_option.'&view=login&return='.$link);
        }
    }

    public function getTable($type = 'Transaction', $prefix =
'RSMembershipTable', $config = array())
    {
        return JTable::getInstance($type, $prefix, $config);
    }

    protected function getListQuery()
    {
        $user 	= JFactory::getUser();
        $db 	= JFactory::getDBO();
        $query	= $db->getQuery(true);

        $query
            ->select('*')
           
->from($db->qn('#__rsmembership_transactions'))
            ->where($db->qn('user_id').' =
'.$db->q($user->get('id')))
            ->order($db->qn('date').' DESC');

        return $query;
    }

    public function getItems(){
        $items = parent::getItems();

        $cache_membership_data = array();

        foreach ($items as $item)
        {
            $membership_id_model = 0;

            $params = RSMembershipHelper::parseParams($item->params);
            switch($item->type)
            {
                case 'new':
                case 'renew':
                case 'addextra':
                    $membership_id_model =
!empty($params['membership_id']) ?
$params['membership_id'] : 0;
                    break;

                case 'upgrade':
                    $membership_id_model =
!empty($params['to_id']) ? $params['to_id'] : 0;
                    break;
            }

            if (!empty($membership_id_model) &&
!isset($cache_membership_data[$membership_id_model]))
            {
                $cache_membership_data[$membership_id_model] =
RSMembership::getMembershipData($membership_id_model);
            }

            if (!empty($membership_id_model))
            {
                $item->membership_data =
$cache_membership_data[$membership_id_model];
            }
            else
            {
                $item->membership_data = false;
            }
        }

        return $items;
    }
}models/rsmembership.php000064400000006441151166265620011257
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelRSMembership extends JModelList
{
	public $_context = 'rsmembership';

    public function __construct($config = array()) {
        if (empty($config['filter_fields'])) {
            $config['filter_fields'] = array(
                'm.id', 'm.name', 'c.name',
'price'
            );
        }

        parent::__construct($config);
    }

	public function getTable($type = 'Membership', $prefix =
'RSMembershipTable', $config = array()) 
	{
		return JTable::getInstance($type, $prefix, $config);
	}

	protected function getListQuery() 
	{
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);
		$params = $this->getState($this->context.'.params');

		$query
			->select('COALESCE(`c`.`name`,
'.$db->q('').') AS
'.$db->qn('category_name').', m.*')
			->from($db->qn('#__rsmembership_memberships',
'm'))
			->join('left',
$db->qn('#__rsmembership_categories', 'c').' ON
'.$db->qn('c.id').' =
'.$db->qn('m.category_id'))
			->where($db->qn('m.published').' =
'.$db->q('1'));

		if ( $category = $this->getCategory() )
		{
			$query->where( $db->qn('m.category_id')." =
".$db->q($category->id) );
		}
		else 
		{
			$categories = $params->get('categories', array());
			if ( !is_array($categories) )
				$categories = (array) $categories;

			if ( !empty($categories) ) 
				$query->where($db->qn('m.category_id').'  IN
('.RSMembershipHelper::quoteImplode($categories).')');
		}

        $listOrdering = $this->getState('list.ordering',
'ordering');
		$listDirection 	= $this->getState('list.direction',
'ASC');

		$query->order($db->qn($listOrdering).'
'.$listDirection);

		return $query;
	}

	protected function populateState($ordering = null, $direction = null) 
	{
		if ($active = JFactory::getApplication()->getMenu()->getActive())
        {
            $params = $active->params;
        }
        else
        {
            $params = new JRegistry;
            $params->set('orderby', 'ordering');
            $params->set('orderdir', 'ASC');
        }

        $this->setState($this->context.'.params',
$params);

		parent::populateState($params->get('orderby',
'ordering'), $params->get('orderdir',
'ASC'));
	}

	public function getItems()
	{
		$items = parent::getItems();

		if (!empty($items))
		{
			$pattern =
'#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';

			if (is_array($items))
			{
				foreach ( $items as $i => $row )
				{
					if ( $row->use_trial_period ) 
						$items[$i]->price = $row->trial_price;

					if ( preg_match($pattern, $row->description) )
						list($row->description, $fulldescription) = preg_split($pattern,
$row->description, 2);
				}
			}
		}

		return $items;
	}

	public function getCategory()
    {
        $id =
JFactory::getApplication()->input->get('catid', 0,
'int');
        $table = JTable::getInstance('Category',
'RSMembershipTable');
        if ($id)
        {
            $table->load($id);
            return $table;
        }

        return false;
    }
}models/subscribe.php000064400000064306151166265620010544 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipModelSubscribe extends JModelItem
{	
	protected $db;
	protected $recaptcha_error;
	protected $membership;
	protected $extras = array();
	protected $coupon;
	protected $data;
	
	protected $html;
	
	public function __construct() {
		parent::__construct();
		$this->db = JFactory::getDbo();
	}
	
	public function canSubscribe($user = null) {
		if (!$user) {
			$user = JFactory::getUser();
		}
		
		// If the membership is unique we must ensure that a new subscription is
not allowed
		if ($user->id && $this->membership->unique) {
			$db 			= &$this->db;
			$query			= $db->getQuery(true);
			$subscription 	= JTable::getInstance('Membership_Subscriber',
'RSMembershipTable');
			$keys			= array(
								'user_id' 		=> $user->id,
								'membership_id' => $this->membership->id
							);
			
			if ($subscription->load($keys)) {
				$this->setError(JText::_('COM_RSMEMBERSHIP_ALREADY_SUBSCRIBED'));
				return false;
			}
		}
		
		return true;
	}
	
	public function bindMembership($id) {
		// Can we get the JTable Object?
		$membership = JTable::getInstance('Membership',
'RSMembershipTable');
		$error		= '';
		
		// Does a membership with this ID exist?
		if ($membership && $id && $membership->load($id)) {
			// Is the membership published?
			if ($membership->published) {
				$membership->regular_price  		= $membership->price;
				$membership->regular_period 		= $membership->period;
				$membership->regular_period_type 	= $membership->period_type;
				
				// Adjust the period & price if it's a trial
				if ($membership->use_trial_period) {
					$membership->price 			= $membership->trial_price;
					$membership->period 		= $membership->trial_period;
					$membership->period_type 	= $membership->trial_period_type;
				}

				$membership->initial_price = $membership->price;
				
				$this->membership = $membership;
				// Load a list of extra IDs attached to this membership ID
				$db = JFactory::getDbo();
				$query = $db->getQuery(true);
				$query->select($db->qn('me.extra_id'))
					->from($db->qn('#__rsmembership_membership_extras',
'me'))
					->join('left',
$db->qn('#__rsmembership_extras', 'e').' ON
('.$db->qn('me.extra_id').'='.$db->qn('e.id').')')
					->where($db->qn('me.membership_id').' =
'.$db->q($this->membership->id))
					->where($db->qn('e.published').' =
'.$db->q(1));
				$this->membership->extras =
$db->setQuery($query)->loadColumn();

				
				return true;
			} else {
				$error = 'COM_RSMEMBERSHIP_MEMBERSHIP_NOT_PUBLISHED';
			}
		} elseif (!$id) {
			$error = 'COM_RSMEMBERSHIP_SESSION_EXPIRED';
		} else {
			$error = 'COM_RSMEMBERSHIP_MEMBERSHIP_NOT_EXIST';
		}
		
		$this->setError(JText::_($error));
		return false;
	}
	
	public function bindExtras($extras) {
		// Do we have extras attached to this membership?
		$db 	= &$this->db;
		$query 	= $db->getQuery(true);
		
		// Load a list of extra IDs attached to this membership ID
		if ($membershipExtras = $this->membership->extras) {
			// Load a list of extra value IDs attached to this membership's
extras.
			$query->clear();
			$query->select($db->qn('id'))
				  ->from($db->qn('#__rsmembership_extra_values'))
				  ->where($db->qn('extra_id').' IN
('.RSMembershipHelper::quoteImplode($membershipExtras).')')
				 
->where($db->qn('published').'='.$db->q(1));
			$db->setQuery($query);
			$membershipExtraValues = $db->loadColumn();
			
			foreach ($extras as $extra_id => $values) {
				// Does this extra_id exist in our database
				// and is it attached to this membership ID?
				if (in_array($extra_id, $membershipExtras)) {
					// Convert all values to an array for commodity
					if (!is_array($values)) {
						$values = (array) $values;
					}
					
					foreach ($values as $value) {
						// Does this value exist?
						if (in_array($value, $membershipExtraValues)) {
							$this->extras[] = $value;
						}
					}
				}
			}
		}
	}
	
	// @desc qi = quote & implode
	protected function qi($array) {
		$db = &$this->db;
		foreach ($array as $k => $v) {
			$array[$k] = $db->q($v);
		}
		return implode(',', $array);
	}
	
	public function getMembership() {
		return $this->membership;
	}
	
	public function getExtras() {
		static $list = array();
		if (empty($list) && is_array($this->extras)) {
			foreach ($this->extras as $id) {
				$table = JTable::getInstance('ExtraValue',
'RSMembershipTable');
				$table->load($id);
				
				$list[] = $table;
			}
		}

		return $list;
	}
	
	public function getMembershipTerms() {
		if ($this->membership->term_id) {
			$item = JTable::getInstance('Term',
'RSMembershipTable');
			if ($item && $item->load($this->membership->term_id)
&& $item->published) {
				return $item;
			}
		}
		
		return false;
	}
	
	public function getUseCaptcha() {
		if (!RSMembershipHelper::getConfig('captcha_enabled')) {
			return false;
		}

		$is_logged 			 = !JFactory::getUser()->get('guest');
		$captcha_enabled_for =
RSMembershipHelper::getConfig('captcha_enabled_for');
		
		// If Captcha is enabled for unregistered users
		// or Captcha is enabled for registered users
		if ((!$is_logged && in_array(0, $captcha_enabled_for)) ||
($is_logged && in_array(1, $captcha_enabled_for))) {
			return true;
		}
		
		return false;
	}
	
	public function getUseBuiltin() {
		return (int) RSMembershipHelper::getConfig('captcha_enabled')
=== 1;
	}
	
	public function getUseReCaptcha() {
		return (int) RSMembershipHelper::getConfig('captcha_enabled')
=== 2;
	}
	
	public function getUseReCaptchaNew() {
		return (int) RSMembershipHelper::getConfig('captcha_enabled')
=== 3;
	}
	
	public function getReCaptchaError() {
		return $this->recaptcha_error;
	}
	
	public function validateCaptcha() {
		$builtin 		= $this->getUseBuiltin();
		$recaptcha 		= $this->getUseReCaptcha();
		$recaptcha_new 	= $this->getUseReCaptchaNew();
		$input			= JFactory::getApplication()->input;
		
		if ($this->getUseCaptcha()) {
			if ($builtin) {
				// Load Captcha
				if (!class_exists('JSecurImage')) {
					require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/securimage/securimage.php';
				}
				
				$image = new JSecurImage();
				$code  = $input->get('captcha', '',
'string');
				
				if (!$image->check($code)) {
					$this->setError(JText::_('COM_RSMEMBERSHIP_CAPTCHA_ERROR'));
					return false;
				}
			} elseif ($recaptcha) {
				// Load ReCaptcha
				if (!class_exists('JReCAPTCHA')) {
					require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/recaptcha/recaptchalib.php';
				}
				
				$privatekey =
RSMembershipHelper::getConfig('recaptcha_private_key');
				$challenge	= $input->get('recaptcha_challenge_field',
'', 'string');
				$response	= $input->get('recaptcha_response_field',
'', 'string');
				
				$result = JReCAPTCHA::checkAnswer($privatekey,
JFactory::getApplication()->input->server->getString('REMOTE_ADDR'),
$challenge, $response);
				if (!$result || !$result->is_valid) {
					if ($result) {
						$this->recaptcha_error = $result->error;
					}
					$this->setError(JText::_('COM_RSMEMBERSHIP_CAPTCHA_ERROR'));
					return false;
				}
			} elseif ($recaptcha_new) {
				$response = $input->get('g-recaptcha-response',
'', 'raw');
				$ip		  = $input->server->getString('REMOTE_ADDR');
				$secret	  =
RSMembershipHelper::getConfig('recaptcha_new_secret_key');
				
				try {
					jimport('joomla.http.factory');
					$http = JHttpFactory::getHttp();
					if ($request =
$http->get('https://www.google.com/recaptcha/api/siteverify?secret='.urlencode($secret).'&response='.urlencode($response).'&remoteip='.urlencode($ip)))
{
						$json = json_decode($request->body);
					}
				} catch (Exception $e) {
					$this->setError($e->getMessage());
					return false;
				}
				
				if (empty($json->success) || !$json->success) {					
					if (!empty($json) &&
isset($json->{'error-codes'}) &&
is_array($json->{'error-codes'})) {
						foreach ($json->{'error-codes'} as $code) {
							$this->setError(JText::_('COM_RSMEMBERSHIP_RECAPTCHA_NEW_ERR_'.str_replace('-',
'_', $code)));
							return false;
						}
					}
				}
			}
		}
		
		return true;
	}
	
	public function getHasCoupons() {
		$db 		= &$this->db;
		$query		= $db->getQuery(true);
		$now		= JFactory::getDate()->toSql();
		$membership = $this->getMembership();

		$query->select($db->qn('c.name'))
			 
->select('COUNT('.$db->qn('t.coupon').') AS
'.$db->qn('uses'))
			  ->select($db->qn('c.max_uses'))
			 ->from($db->qn('#__rsmembership_coupons',
'c'))
			 ->join('left',
$db->qn('#__rsmembership_coupon_items', 'ci').'
ON
('.$db->qn('c.id').'='.$db->qn('ci.coupon_id').')')
			 ->join('left',
$db->qn('#__rsmembership_transactions', 't').'
ON
('.$db->qn('c.name').'='.$db->qn('t.coupon').'
AND '.$db->qn('t.coupon').' !=
'.$db->q('').' AND
'.$db->qn('c.max_uses').' >
'.$db->q(0).')')
			
->where('('.$db->qn('ci.membership_id').' =
'.$db->q($membership->id).' OR
'.$db->qn('ci.membership_id').' IS NULL)')
			 ->where('('.$db->qn('c.date_start').' =
'.$db->q($db->getNullDate()).' OR
'.$db->qn('c.date_start').' <
'.$db->q($now).')')
			 ->where('('.$db->qn('c.date_end').' =
'.$db->q($db->getNullDate()).' OR
'.$db->qn('c.date_end').' >
'.$db->q($now).')')
			 ->where($db->qn('c.published').' =
'.$db->q(1))
			 ->group($db->qn('c.name'))
			 ->having('('.$db->qn('max_uses').' >
'.$db->qn('uses'). ' OR
'.$db->qn('max_uses').' =
'.$db->q(0).')');
		$db->setQuery($query);
		
		return $db->loadObject() ? true : false;
	}
	
	public function bindData($data) {
		$membership = $this->getMembership();
		$db		= &$this->db;
		$user 	= JFactory::getUser();
		$guest	= $user->guest;
		
		// Create the empty data
		$this->data = new stdClass();
		
		// Bind username
		if (RSMembershipHelper::getConfig('choose_username')) {
			$username = isset($data['username']) ?
$data['username'] : '';
			
			if ($guest) {
				if (empty($username) || strlen(utf8_decode($username)) < 2) {
					$this->setError(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_USERNAME'));
					return false;
				}

				$query = $db->getQuery(true);
				$query->select($db->qn('id'))
					  ->from($db->qn('#__users'))
					  ->where($db->qn('username').' =
'.$db->q($username));
				$db->setQuery($query);
				if ($db->loadResult()) {
					$this->setError(JText::_('COM_RSMEMBERSHIP_USERNAME_NOT_OK'));
					return false;
				}
			}
			
			$this->data->username = $guest ? $username : $user->username;
		}
		
		// Bind password
		if (RSMembershipHelper::getConfig('choose_password')) {
			$password  = isset($data['password']) ?
$data['password'] : '';
			$password2 = isset($data['password2']) ?
$data['password2'] : '';
			
			if ($guest) {
				JFactory::getLanguage()->load('com_users', JPATH_SITE);
				$rule = JFormHelper::loadRuleType('password');
				$field = new
SimpleXMLElement('<field></field>');
				if (!$rule->test($field, $password)) {
					return false;
				}
				
				
				if ($password != $password2) {
					$this->setError(JText::_('COM_RSMEMBERSHIP_PLEASE_CONFIRM_PASSWORD'));
					return false;
				}
			}
			$this->data->password = $guest ? md5($password) : '';
		}
		
		// Bind email
		$email = isset($data['email']) ? $data['email'] :
'';
		if ($guest) {
			jimport('joomla.mail.helper');
			if (empty($email) || !JMailHelper::isEmailAddress($email)) {
				$this->setError(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_EMAIL'));
				return false;
			}
		}
		$this->data->email = $guest ? $email : $user->email;
		
		// Bind name
		$name = isset($data['name']) ? $data['name'] :
'';
		if ($guest && empty($name)) {
			$this->setError(JText::_('COM_RSMEMBERSHIP_PLEASE_TYPE_NAME'));
			return false;
		}
		$this->data->name = $guest ? $name : $user->name;
		
		$sentFields 			= isset($data['fields']) ?
$data['fields'] : array();
		$sentMembershipFields 	= isset($data['membership_fields']) ?
$data['membership_fields'] : array();
		
		if (isset($data['membership_fields'])) {
			$verifyFields = array_merge($sentFields, $sentMembershipFields);
		}

		$fields 			= RSMembership::getCustomFields();
		$membership_fields 	=
RSMembership::getCustomMembershipFields($membership->id);
		$fields 			= array_merge($fields, $membership_fields);
		
		
		foreach ($fields as $field) {
			if (($field->required &&
empty($verifyFields[$field->name])) ||
				($field->rule && !empty($verifyFields[$field->name])
&& is_callable('RSMembershipValidation', $field->rule)
&& !call_user_func(array('RSMembershipValidation',
$field->rule), $verifyFields[$field->name]))) {
				$message = JText::_($field->validation);
				if (empty($message)) {
					$message =
JText::sprintf('COM_RSMEMBERSHIP_VALIDATION_DEFAULT_ERROR',
JText::_($field->label));
				}
				
				$this->setError($message);
				return false;
				
			}
		}
		$this->data->fields = $sentFields;
		$this->data->membership_fields = $sentMembershipFields;
		
		// Bind an empty coupon for legacy reasons
		$this->data->coupon = '';
		
		return true;
	}
	
	public function bindCoupon($coupon, $skip_errors = false) {
		// Did the customer enter a coupon?
		if ($coupon) {
			$db 	= &$this->db;
			$query	= $db->getQuery(true);
			
			$query->select('*')
				  ->from($db->qn('#__rsmembership_coupons'))
				  ->where($db->qn('name').' =
'.$db->q($coupon))
				  ->where($db->qn('published').' =
'.$db->q(1));
			$db->setQuery($query);
			if ($coupon = $db->loadObject()) {
				$now 		= JFactory::getDate()->toUnix();
				$nullDate 	= $db->getNullDate();
				
				// Check if promotion hasn't started yet
				if ($coupon->date_start != $nullDate) {
					$start = JFactory::getDate($coupon->date_start)->toUnix();
					if ($start > $now) {
						if (!$skip_errors) {
							$this->setError(JText::_('COM_RSMEMBERSHIP_COUPON_CODE_NOT_STARTED'));
						}
						return false;
					}
				}
				
				// Check if promotion expired
				if ($coupon->date_end != $nullDate) {
					$end = JFactory::getDate($coupon->date_end)->toUnix();
					if ($end < $now) {
						if (!$skip_errors) {
							$this->setError(JText::_('COM_RSMEMBERSHIP_COUPON_CODE_EXPIRED'));
						}
						return false;
					}
				}
				
				// Check if valid for this membership
				$query->clear();
				$query->select($db->qn('membership_id'))
					  ->from($db->qn('#__rsmembership_coupon_items'))
					  ->where($db->qn('coupon_id').' =
'.$db->q($coupon->id));
				$db->setQuery($query);
				$memberships = $db->loadColumn();
				if ($memberships && !in_array($this->membership->id,
$memberships)) {
					if (!$skip_errors) {
						$this->setError(JText::_('COM_RSMEMBERSHIP_COUPON_CODE_NOT_VALID_FOR_MEMBERSHIP'));
					}
					return false;
				}

				// Check max uses
				if ($coupon->max_uses > 0) {
					$query->clear();
					$query->select('COUNT('.$db->qn('id').')')
						  ->from($db->qn('#__rsmembership_transactions'))
						  ->where($db->qn('status').' =
'.$db->q('completed'))
						  ->where($db->qn('coupon') .' =
'.$db->q($coupon->name));
					$db->setQuery($query);
					$used = $db->loadResult();
					if ($used >= $coupon->max_uses) {
						if (!$skip_errors) {
							$this->setError(JText::_('COM_RSMEMBERSHIP_COUPON_MAX_USAGE'));
						}
						return false;
					}
				}
				
				// Calculate percentage discount
				$coupon->discount_set_price = $coupon->discount_price;
				if ($coupon->discount_type == 0) {
					$coupon->discount_price = $this->membership->price *
($coupon->discount_price / 100);
				}

				// Adjust membership price.
				$this->membership->price -= $coupon->discount_price;
				if ($this->membership->price < 0) {
					$this->membership->price = 0;
				}

				if ($skip_errors) {
					return $coupon;
				}
				// Bind coupon
				$this->coupon = $coupon;
				$this->data->coupon = $coupon->name;
			} else {
				if (!$skip_errors) {
					$this->setError(JText::_('COM_RSMEMBERSHIP_COUPON_INVALID'));
				}
				return false;
			}
		}
		
		return true;
	}
	
	public function getTotal($only_extras = false) {
		$total = $this->membership->price;
		
		if ($extras = $this->getExtras()) {
			if ($only_extras) {
				$total = 0;
			}
			foreach ($extras as $extra) {
				$total += $extra->price;
			}
		}
		
		return $total;
	}
	
	public function saveTransaction($paymentPlugin) {
		// Empty the session, no point in keeping it.
		$this->clearData();
		
		// Empty the HTML variable.
		$this->html = '';

		// Get some data.
		$extras 	= $this->getExtras();
		$membership = $this->getMembership();
		$total 		= $this->getTotal();
		$user 		= JFactory::getUser();
		$app		= JFactory::getApplication();

		// Asign the user.
		$userId = 0;
		if ($user->guest) {
			// Create the user instantly if this option is enabled.
			if (RSMembershipHelper::getConfig('create_user_instantly')) {
				$userId = RSMembership::createUser($this->data->email,
$this->data);
			}
		} else {
			// Grab logged in user's ID.
			$userId = $user->id;
			
			// Update user's custom fields.
			RSMembership::createUserData($userId, $this->data->fields);
		}
		// Create user data object.
		$newData = (object) array(
			'name' 				=> $this->data->name,
			'username' 			=> isset($this->data->username) ?
$this->data->username : '',
			'fields' 			=> $this->data->fields,
			'membership_fields' =>
$this->data->membership_fields,
		);

		if (!empty($this->data->password)) {
			$newData->password = $this->data->password;
		}
		
		// Create transaction params array.
		$params = array('membership_id='.$membership->id);
		if ($this->extras) {
			$params[] = 'extras='.implode(',',
$this->extras);
		}
		$params	= implode(';', $params);
		
		// if the total is 0 than in case coupons are used and discounts are 100%
sot to none the  paymentPlugin
		$ignore_payment_taxes = empty($total) &&
!empty($this->data->coupon);

		$transaction_data = array(
			'membership' => (object) array('price' =>
$membership->initial_price)
		);

		if (!empty($extras)) {
			$transaction_data['extras'] = array();
			foreach ($extras as $extra) {
				$transaction_data['extras'][] = (object)
array('name' => $extra->name, 'price' =>
$extra->price);
			}

		}

		if (isset($this->coupon)) {
			$transaction_data['discount'] = (object)
array('type' => $this->coupon->discount_type,
'price' => $this->coupon->discount_set_price);
		}

		$transaction_data = json_encode($transaction_data);

		// Create the JTable object.
		$row = JTable::getInstance('Transaction',
'RSMembershipTable');
		$row->bind(array(
			'user_id' 		 	=> $userId,
			'user_email' 	 	=> $this->data->email,
			'user_data'		 	=> serialize($newData),
			'type'			 	=> 'new',
			'params'		 	=> $params,
			'date'			 	=> JFactory::getDate()->toSql(),
			'ip'			 	=> RSMembershipHelper::getIP(),
			'price'			 	=> $total,
			'coupon'		 	=> $this->data->coupon,
			'transaction_data'	=> $transaction_data,
			'currency'		 	=>
RSMembershipHelper::getConfig('currency'),
			'gateway'			=> $paymentPlugin == 'none' ?
'No Gateway' : RSMembership::getPlugin($paymentPlugin),
			'status'		 	=> 'pending'
		));

		// Trigger the payment plugin
		$delay = false;
		$args  = array(
			'plugin' 		=> $paymentPlugin,
			'data' 			=> &$this->data,
			'extras'		=> $extras,
			'membership' 	=> $membership,
			'transaction' 	=> &$row,
			'html' 			=> &$this->html
		);

		$returns = $app->triggerEvent('onMembershipPayment',
$args);
		
		if ($ignore_payment_taxes) {
			$row->tax_value = 0;
			$row->price = 0;
		}
		
		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$this->html = $value;
				}
			}
		}
		
		$properties = $row->getProperties();
		$returns = $app->triggerEvent('delayTransactionStoring',
array(array('plugin' => $paymentPlugin, 'properties'
=> &$properties, 'delay' => &$delay)));

		// PHP 5.4 fix...
		if (version_compare(PHP_VERSION, '5.4.0', '>='))
{
			foreach ($returns as $value) {
				if ($value) {
					$delay = true;
				}
			}
		}
		
		// Plugin can delay the transaction storing
		if (!$delay) {
			// Store the transaction
			$row->store();

			// Finalize the transaction (send emails)
			RSMembership::finalize($row->id);
			
			// Approve the transaction
			if ($row->status == 'completed' ||
(!$this->showPaymentOptions() && $membership->activation !=
MEMBERSHIP_ACTIVATION_MANUAL) || $membership->activation ==
MEMBERSHIP_ACTIVATION_INSTANT) {
				RSMembership::approve($row->id, true);
			}
		}
		
		return $row;
	}
	
	public function showPaymentOptions() {
		$total 			= $this->getTotal();
		$membership 	= $this->getMembership();
		$showPayments 	= false;
		
		// Do we have an amount to pay? If we do, show the payment options.
		if ((float) $total) {
			$showPayments = true;
		} else {
			// Trials can be sent to the payment gateway as well
			// Only if we have something to pay afterwards (regular price or renewal
price)
			if ($membership->recurring &&
$membership->use_trial_period && ((float)
$membership->regular_price || ($membership->use_renewal_price
&& (float) $membership->renewal_price))) {
				$showPayments = true;
			}
		}
		
		return $showPayments;
	}
	
	public function storeData($params) {
		$session = JFactory::getSession();
	
		$context = 'com_rsmembership.subscribe.';
		$session->set($context.'id', $params['id']);
		
		$newcontext = $context.$params['id'].'.';
		$session->set($newcontext.'extras',
$params['extras']);
		$session->set($newcontext.'data',
	$params['data']);
		$session->set($newcontext.'coupon',
$params['coupon']);
	}
	
	public function markCorrectData($id) {
		$session = JFactory::getSession();
		
		$context = 'com_rsmembership.subscribe.';
		$session->set($context.$id.'.correct', 1);
	}
	
	public function isCorrectData() {
		$session = JFactory::getSession();
		$id		 = $this->membership->id;
		$context = 'com_rsmembership.subscribe.'.$id.'.';
		
		if ($session->get($context.'correct', 0)) {
			return true;
		} else {
			$this->setError(JText::_('COM_RSMEMBERSHIP_THERE_WAS_AN_ERROR'));
			return false;
		}
	}
	
	// @desc Returns an array with data from the session.
	public function getData() {
		$session = JFactory::getSession();
		$params	 = array(
			'cid' => 0
		);
		
		$context = 'com_rsmembership.subscribe.';
		if ($id = $session->get($context.'id')) {
			$params['cid'] = $id;
		}
		
		if ($params['cid']) {
			$newcontext = $context.$params['cid'].'.';
			
			// Retrieve selected extras
			if ($extras = $session->get($newcontext.'extras')) {
				$params['rsmembership_extra'] = $extras;
			}
			
			// Retrieve coupon
			if ($coupon = $session->get($newcontext.'coupon')) {
				$params['coupon'] = $coupon;
			}
			
			// Retrieve data
			if ($data = $session->get($newcontext.'data')) {
				if (isset($data['username'])) {
					$params['username'] = $data['username'];
				}
				if (isset($data['email'])) {
					$params['email'] = $data['email'];
				}
				if (isset($data['name'])) {
					$params['name'] = $data['name'];
				}
				if (isset($data['password'])) {
					$params['password'] = $data['password'];
				}
				if (isset($data['password2'])) {
					$params['password2'] = $data['password2'];
				}
				if (isset($data['fields'])) {
					$params['rsm_fields'] = $data['fields'];
				}
				if (isset($data['membership_fields'])) {
					$params['rsm_membership_fields'] =
$data['membership_fields'];
				}
			}
		}
		
		return $params;
	}
	
	public function clearData() {
		$session = JFactory::getSession();
		$context = 'com_rsmembership.subscribe.';
		if ($id = $session->get($context.'id')) {
			$session->clear($context.'id');
			
			$newcontext = $context.$id.'.';
			$session->clear($newcontext.'correct');
			$session->clear($newcontext.'extras');
			$session->clear($newcontext.'data');
			$session->clear($newcontext.'coupon');
		}
	}
	
	public function checkUsername() {
		// Get vars
		$jinput		= JFactory::getApplication()->input;
		$db 		= JFactory::getDBO();
		$query		= $db->getQuery(true);

		$username 	= $jinput->get('username', '',
'string');
		
		$username   =
preg_replace('#[<>"\'%;()&\\\\]|\\.\\./#',
'', $username);
		$username   = trim($username);
		$name		= strtolower($jinput->get('name', '',
'string'));

		if ( strlen($name) < 2 ) 
			$name = '';
		$email		  = strtolower($jinput->get('email', '',
'string'));
		if ( strlen($email) < 2 ) 
			$email = '';

		// Keep the username intact
		$new_username = $username;

		// Local flags
		$used_name	  = false;
		$used_email	  = false;
		$reverted	  = false;

		// Return
		$suggestions  = array();

		// Check if username is available
		$query->select('Count('.$db->qn('id').')')
			  ->from($db->qn('#__users'))
			  ->where($db->qn('username').' =
'.$db->q($new_username));
		$db->setQuery($query);
		
		while ( ( $num_rows = $db->loadResult() ) || count($suggestions) <
3)
		{
			// Add only if no rows are found
			if (!$num_rows && !in_array($new_username, $suggestions))
				$suggestions[] = $new_username;
			
			// Use a variation of the name, if available
			if ($name && !$used_name)
			{
				$used_name = true;
				$reverted = false;
				$new_username = str_replace('-', '_',
JFilterOutput::stringURLSafe($name));
			}
			// Use a variation of the email, if available
			elseif ($email && !$used_email)
			{
				$used_email = true;
				$reverted = false;
				$new_username = str_replace('-', '_',
JFilterOutput::stringURLSafe($email));
			}
			// Add random numbers to the username
			else
			{
				if (($used_name || $used_email) && !$reverted)
				{
					$reverted = true;
					$new_username = $username;
				}
				$new_username .= mt_rand(0,9);
			}
			
			if (strlen($new_username) < 2)
				$new_username = str_pad($new_username, 2, '_',
STR_PAD_RIGHT);
			
			$query->clear();
			$query->select($db->qn('id'))
				  ->from($db->qn('#__users'))
				  ->where($db->qn('username').' =
'.$db->q($new_username));
			$db->setQuery($query);
		}
		
		return $suggestions;
	}
	
	public function getHTML() {
		return $this->html;
	}
}models/terms.php000064400000001555151166265620007712 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelTerms extends JModelList
{
	public $message;
	
	public function __construct()
	{
		parent::__construct();
	}

	public function getTerms()
	{
		$app = JFactory::getApplication();
		$cid = $app->input->get('cid', 0, 'int');
		$row =
JTable::getInstance('Term','RSMembershipTable');

		$row->load($cid);

		if ( !$row->published ) 
		{
			JFactory::getApplication()->enqueueMessage(JText::_('COM_RSMEMBERSHIP_NO_TERM'),
'warning');
			$app->redirect(JRoute::_(RSMembershipRoute::Memberships(), false));
		}
		return $row;
	}
}models/thankyou.php000064400000002411151166265620010412 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelThankYou extends JModelLegacy
{
	public $message;
	
	public function __construct()
	{
		parent::__construct();

		$app 	 = JFactory::getApplication();
		$option  = 'com_rsmembership';

		$session  = JFactory::getSession();
		$action   = $session->get($option.'.subscribe.action',
null);		
		$message  = $session->get($option.'.subscribe.thankyou',
null);
		$redirect = $session->get($option.'.subscribe.redirect',
null);

		$session->set($option.'.subscribe.action', null);
		$session->set($option.'.subscribe.thankyou', null);
		$session->set($option.'.subscribe.redirect', null);
		
		// No session data
		if (is_null($action)) {
			$app->redirect(JRoute::_('index.php?option=com_rsmembership',
false));
		}
		
		// Redirect?
		if ($action == 1 && $redirect) {
			$app->redirect($redirect);
		}
		
		// Store the message
		$this->message = $message;
	}
	
	public function getMessage()
	{		
		return $this->message;
	}
}models/user.php000064400000004547151166265620007542 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.model');

class RSMembershipModelUser extends JModelItem 
{

	public function __construct()
	{
		parent::__construct();
		
		$app = JFactory::getApplication();
		$option = 'com_rsmembership';
		
		$user = JFactory::getUser();
		if ($user->get('guest'))
		{
			$link = base64_encode(JUri::getInstance());
			$app->redirect('index.php?option=com_users&view=login&return='.$link);
		}
	}

	public function getUser()
	{
		$user 	= JFactory::getUser();
		$db 	= JFactory::getDBO();
		$query	= $db->getQuery(true);

		$query->select('*')->from($db->qn('#__rsmembership_subscribers'))->where($db->qn('user_id').'
= '.$db->q($user->get('id')));
		$db->setQuery($query);

		return $db->loadObject();
	}

	public function save()
	{
		$user 	= JFactory::getUser();
		$fields =
JFactory::getApplication()->input->get('rsm_fields',
array(), 'array');
		RSMembership::createUserData($user->get('id'), $fields);
	}
	
	public function _bindData($verbose=true)
	{
		$return = true;
		$rsm_fields =
JFactory::getApplication()->input->get('rsm_fields',
array(), 'array');

		if (empty($rsm_fields))
			return false;
		
		$fields =
RSMembership::getCustomFields(array('published'=>1,
'required'=>1));

		foreach ( $fields as $field ) 
			if ( ($field->required &&
empty($rsm_fields[$field->name])) ||
(!empty($rsm_fields[$field->name]) && $field->rule &&
is_callable('RSMembershipValidation', $field->rule) &&
!call_user_func(array('RSMembershipValidation', $field->rule),
$rsm_fields[$field->name])) ) 
			{
				$validation_message = JText::_($field->validation);
				if ( empty($validation_message) ) 
					$validation_message =
JText::sprintf('COM_RSMEMBERSHIP_VALIDATION_DEFAULT_ERROR',
JText::_($field->label));

				if ( $verbose ) {
					JFactory::getApplication()->enqueueMessage($validation_message,
'warning');
				}

				$return = false;
			}

		return $return;
	}

	public function getRSFieldset() 
	{
		require_once
JPATH_SITE.'/components/com_rsmembership/helpers/adapters/fieldset.php';

		$fieldset = new RSFieldset();
		return $fieldset;
	}
}router.php000064400000023201151166265620006605 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined( '_JEXEC' ) or die( 'Restricted access' );

function RSMembershipBuildRoute(&$query)
{
	$segments = array();
	
	if (!empty($query['task']))
		switch ($query['task'])
		{
			case 'back':
				$segments[] = 'back';
				$segments[] = $query['cid'];
			break;
			case 'from':
				$segments[] = 'from';
				if (isset($query['cid'])) {
					$segments[] = $query['cid'];
				}
			break;
			
			case 'subscribe':
				$segments[] = 'subscribe-to';
				$segments[] = $query['cid'];
			break;
			
			case 'validatesubscribe':
				$segments[] = 'subscribe-finish';
			break;
			
			case 'paymentredirect':
				$segments[] = 'payment-redirect';
			break;
			
			case 'payment':
				$segments[] = 'payment';
			break;
			
			case 'download':
				$segments[] = 'download';
				if ($query['from'] == 'membership')
					$segments[] = 'from-membership';
				elseif ($query['from'] == 'extra')
					$segments[] = 'from-membership-extra';
				$segments[] = $query['cid'];
			break;
			
			case 'thankyou':
				$segments[] = 'show-thank-you';
			break;

			case 'mymembership.addextrapaymentredirect':
			case 'mymembership.renewpaymentredirect':
			case 'mymembership.upgradepaymentredirect':
			case 'mymembership.upgrade':
				list($controller, $task) = explode('.',
$query['task'], 2);

				$nice_routes = array(
					'upgrade' 					=> 'upgrade-to',
					'addextrapaymentredirect' 	=>
'add-extra-payment-redirect',
					'renewpaymentredirect' 		=>
'renew-payment-redirect',
					'upgradepaymentredirect' 	=>
'upgrade-payment-redirect',
				);

				$segments[] = $nice_routes[$task];
				if ($task == 'upgrade') {
					$segments[] = $query['cid'];
				}
			break;

			case 'mytransaction.outputinvoice':
				$segments[] = 'download-invoice';
				$segments[] = $query['id'];
				unset($query['id']);
			break;
			
			case 'validateuser':
				$segments[] = 'save-my-account';
			break;
			
			case 'captcha':
				$segments[] = 'captcha';
			break;
			
			case 'cancel':
				$segments[] = 'cancel-subscription';
				$segments[] = $query['cid'];
			break;

            case 'removedata.request':
                $segments[] = 'remove-data-request';
                break;

            case 'removedata.process':
                $segments[] = 'remove-data-process';
                break;
		}
	
	if (!empty($query['view']))
		switch ($query['view'])
		{
			case 'membership':
				$segments[] = 'view-membership-details';

				if (isset($query['catid'])) {
					$segments[] = $query['catid'];
				}

				$segments[] = $query['cid'];
			break;

			case 'mymembership':
				$processed_cid = false;
				if (!empty($query['path']))
				{
					$segments[] = 'browse-folders';
					if ($query['from'] == 'membership')
						$segments[] = 'from-membership';
					elseif ($query['from'] == 'extra')
						$segments[] = 'from-membership-extra';
				}
				else
				{
					if (isset($query['layout'])) {
						switch($query['layout']) {
							case 'payment':
								$build_segment = 'payment-';
								if (isset($query['action_type'])) {
									$build_segment .= $query['action_type'];
								}
								$segments[] = $build_segment;
								$segments[] = $query['payment'];

								// unset unnecessary
								unset($query['payment']);
								unset($query['action_type']);
							break;

							case 'upgrade':
								$segments[] = 'upgrade';
								if (isset($query['cid'])) {
									$segments[] = $query['cid'];
									$processed_cid = true;
								}
								if (isset($query['to_id'])) {
									$segments[] = $query['to_id'];
									unset($query['to_id']);
								}
							break;

							case 'addextra':
								$segments[] = 'add-extra-to-membership';
								if (isset($query['cid'])) {
									$segments[] = $query['cid'];
									$processed_cid = true;
								}
								if (isset($query['extra_id'])) {
									$segments[] = $query['extra_id'];
								}
							break;

							default:
								$segments[] = $query['layout'];
							break;
						}
					} else {
						$segments[] = 'view-my-membership-details';
					}
				}
				if (!$processed_cid && isset($query['cid'])) {
					$segments[] = $query['cid'];
				}
			break;
			
			case 'mymemberships':
				$segments[] = 'view-my-memberships';
			break;

			case 'mytransactions':
				$segments[] = 'view-my-transactions';
			break;
			
			case 'rsmembership':
				$segments[] = 'view-available-memberships';
				
				if (isset($query['catid']))
					$segments[] = $query['catid'];

				if (isset($query['layout']))
					$segments[] = $query['layout'];
			break;
			
			case 'terms':
				$segments[] = 'view-terms';
				if (!empty($query['cid']))
                {
                    $segments[] = $query['cid'];
                }
			break;
			
			case 'user':
				$segments[] = 'view-my-account';
			break;
			
			case 'removedata':
				$segments[] = 'remove-data-success';
			break;
		}
	
	unset($query['task'], $query['cid'],
$query['catid'], $query['view'],
$query['from'], $query['extra_id'],
$query['layout']);
	
	return $segments;
}

function RSMembershipParseRoute($segments)
{
	$query = array();
	
	$segments[0] = str_replace(':', '-', $segments[0]);
	
	switch ($segments[0])
	{
		case 'back':
			$query['task'] = 'back';
			$query['view'] = 'subscribe';
			$query['cid'] = @$segments[1];
		break;

		case 'from':
			$query['task'] = 'from';
			$query['view'] = 'subscribe';
			$query['cid'] = @$segments[1];
		break;
		
		case 'subscribe-to':
			$query['task'] = 'subscribe';
			$query['cid'] = @$segments[1];
		break;
		
		case 'subscribe-finish':
			$query['task'] = 'validatesubscribe';
		break;
		
		case 'payment-redirect':
			$query['task'] = 'paymentredirect';
		break;
		
		case 'payment':
			$query['task'] = 'payment';
		break;
		
		case 'download':
			$query['task'] = 'download';
			$segments[1] = str_replace(':', '-', $segments[1]);
			if ($segments[1] == 'from-membership')
				$query['from'] = 'membership';
			elseif ($segments[1] == 'from-membership-extra')
				$query['from'] = 'extra';
			
			$query['cid'] = end($segments);
		break;
		
		case 'show-thank-you':
			$query['task'] = 'thankyou';
		break;
		
		case 'upgrade-to':
			$query['task'] = 'mymembership.upgrade';
			$query['cid'] = $segments[1];
		break;

		case 'download-invoice':
			$query['task'] = 'mytransaction.outputinvoice';
			$query['id'] = $segments[1];
		break;
		
		case 'upgrade-payment-redirect':
			$query['task'] =
'mymembership.upgradepaymentredirect';
		break;
		
		case 'renew':
			$query['view'] = 'mymembership';
			$query['layout'] = 'renew';
			$query['cid'] = $segments[1];
		break;

		case 'upgrade':
			$query['view'] = 'mymembership';
			$query['layout'] = 'upgrade';
			$query['cid'] = $segments[1];
			$query['to_id'] = $segments[2];
		break;

		case 'renew-payment-redirect':
			$query['task'] =
'mymembership.renewpaymentredirect';
		break;
		
		case 'add-extra-to-membership':
			$query['view'] = 'mymembership';
			$query['layout'] = 'addextra';
			$query['cid'] = $segments[1];
			$query['extra_id'] = @$segments[2];
		break;
		
		case 'add-extra-payment-redirect':
			$query['task'] =
'mymembership.addextrapaymentredirect';
		break;

		case 'payment-addextra':
		case 'payment-renew':
		case 'payment-upgrade':
			list($layout, $action_type) = explode('-', $segments[0], 2);
			$query['view'] = 'mymembership';
			$query['layout'] = $layout;
			$query['payment'] = $segments[1];
			$query['action_type'] = $action_type;
		break;
		
		case 'view-membership-details':
			$query['view'] = 'membership';
			
			if (isset($segments[2]))
			{
				$query['catid'] = $segments[1];
				$query['cid'] = $segments[2];
			}
			else
			{
				$query['cid'] = $segments[1];
			}
		break;
		
		case 'view-my-membership-details':
			$query['view'] = 'mymembership';
			$query['cid'] = $segments[1];
		break;
		
		case 'browse-folders':
			$query['view'] = 'mymembership';
			$segments[1] = str_replace(':', '-', $segments[1]);
			if ($segments[1] == 'from-membership')
				$query['from'] = 'membership';
			elseif ($segments[1] == 'from-membership-extra')
				$query['from'] = 'extra';
			$query['cid'] = @$segments[2];
		break;
		
		case 'view-my-memberships':
			$query['view'] = 'mymemberships';
		break;

		case 'view-my-transactions':
			$query['view'] = 'mytransactions';
		break;
		
		case 'view-available-memberships':
			if (isset($segments[1]))
				$query['catid'] = $segments[1];
			if (isset($segments[2]))
				$query['layout'] = $segments[2];
				
			$query['view'] = 'rsmembership';
		break;
		
		case 'view-terms':
			$query['view'] = 'terms';
			$query['cid'] = @$segments[1];
		break;
		
		case 'view-my-account':
			$query['view'] = 'user';
		break;
		
		case 'save-my-account':
			$query['task'] = 'validateuser';
		break;
		
		case 'captcha':
			$query['task'] = 'captcha';
		break;
		
		case 'cancel-subscription':
			$query['task'] = 'cancel';
			$query['cid'] = @$segments[1];
		break;

        case 'remove-data-request':
            $query['task'] = 'removedata.request';
            break;

        case 'remove-data-process':
            $query['task'] = 'removedata.process';
            break;
			
		case 'remove-data-success':
            $query['view'] = 'removedata';
            $query['layout'] = 'default';
            break;
	}
	
	return $query;
}rsmembership.php000064400000001510151166265650007767 0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/adapter.php';
require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/rsmembership.php';
require_once
JPATH_ADMINISTRATOR.'/components/com_rsmembership/helpers/version.php';
require_once
JPATH_SITE.'/components/com_rsmembership/helpers/route.php';
require_once JPATH_COMPONENT.'/controller.php';

$controller	= JControllerLegacy::getInstance('RSMembership');
$app 		= JFactory::getApplication();
$task 		= $app->input->get('task');

$controller->execute($task);
$controller->redirect();views/categories/index.html000064400000000054151166265650012037
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/categories/metadata.xml000064400000000307151166265650012345
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_CATEGORIES">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_CATEGORIES_MENU_DESC]]>
		</message>
	</view>
</metadata>views/categories/tmpl/default.php000064400000004122151166265650013153
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_categories_membership">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

	<form action="<?php echo JRoute::_(
RSMembershipRoute::Categories() ); ?>" method="post"
name="adminForm" id="rsm_categories_form">
		<?php $k = 1; ?>
		<?php $i = 0; ?>
		<?php foreach ($this->items as $item) { ?>
		<div class="item-page">
			<div class="page-header">
				<h2 class="sectiontableentry<?php echo $k .
$this->escape($this->params->get('pageclass_sfx'));
?>" >
					<a href="<?php echo
JRoute::_(RSMembershipRoute::Memberships($item->id, $this->Itemid));
?>"><?php echo $this->escape($item->name);
?></a>
					<?php if ($this->params->get('show_memberships',
0)) { ?> 
						<span class="badge badge-info
rsmemgrid-badge"><?php echo $item->memberships;
?></span>
					<?php } ?>
				</h2>
			</div>
			<?php if
($this->params->get('show_category_description', 0)) {
?>
					<div class="rsm_description">
						<?php
						if
(RSMembershipHelper::getConfig('trigger_content_plugins')) {
							$item->description = JHtml::_('content.prepare',
$item->description);
						}
						echo $item->description;
						?>
					</div>
			<?php } ?>

			<?php $k = $k == 1 ? 2 : 1; ?>
			<?php $i++; ?>
		</div>
		<?php } ?>

		<?php if ($this->params->get('show_pagination', 1)) {
?>
		<div class="sectiontablefooter<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="center">
			<div class="pagination">
				<?php echo $this->pagination->getPagesLinks(); ?>
			</div>
			<?php echo $this->pagination->getPagesCounter(); ?>
		</div>
		<?php } ?>

		<input type="hidden" name="filter_order"
value="" />
		<input type="hidden" name="filter_order_Dir"
value="" />
	</form>
</div>views/categories/tmpl/default.xml000064400000003502151166265650013165
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout
title="COM_RSMEMBERSHIP_CATEGORIES_DEFAULT_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_CATEGORIES_DEFAULT_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field name="show_category_description"
type="radio" class="btn-group" default="0"
label="COM_RSMEMBERSHIP_SHOW_CATEGORY_DESCRIPTION"
description="COM_RSMEMBERSHIP_SHOW_CATEGORY_DESCRIPTION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_memberships" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS"
description="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_pagination" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="orderby" type="list"
default="" label="COM_RSMEMBERSHIP_ORDERING"
description="COM_RSMEMBERSHIP_ORDER_DESC">
					<option
value="">COM_RSMEMBERSHIP_DEFAULT</option>
					<option
value="name">COM_RSMEMBERSHIP_TITLE</option>
					<option
value="ordering">COM_RSMEMBERSHIP_ORDERING</option>
				</field>
				<field name="orderdir" type="radio"
class="btn-group" default="ASC"
label="COM_RSMEMBERSHIP_DIRECTION"
description="COM_RSMEMBERSHIP_DIRECTION_DESC">
					<option
value="ASC">COM_RSMEMBERSHIP_ASCENDENT</option>
					<option
value="DESC">COM_RSMEMBERSHIP_DESCENDENT</option>
				</field>
			</fieldset>
		</fields>
	</config>
</metadata>views/categories/tmpl/index.html000064400000000054151166265650013013
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/categories/tmpl/list.php000064400000005540151166265650012507
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');

$listOrder	=
$this->escape($this->state->get('list.ordering'));
$listDirn	=
$this->escape($this->state->get('list.direction'));
?>
<script language="javascript"
type="text/javascript">
function tableOrdering(order, dir, task)
{
	var form = document.adminForm;

	form.filter_order.value	= order;
	form.filter_order_Dir.value	= dir;
	document.adminForm.submit(task);
}
</script>
<div id="rsm_categories_membership_list"
class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

	<form action="<?php echo JRoute::_(
RSMembershipRoute::Categories('list') ); ?>"
method="post" name="adminForm"
id="adminForm">
		<div class="table-responsive
rsmemgrid-table-responsive">
			<table id="sortTable" width="99%"
class="<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?> table table-stripped table-hover table-bordered rsmemgrid-table
rsmemgrid-table-stripped rsmemgrid-table-hover
rsmemgrid-table-bordered">
			<?php if ($this->params->get('show_headings', 1)) {
?>
				<thead>
					<tr>
						<th class="<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="right" width="5%"><?php echo
JText::_('#'); ?></th>
						<th class="<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>">
						<?php echo JText::_('COM_RSMEMBERSHIP_TITLE'); ?>
						</th>
					</tr>
				</thead>
			<?php } ?>
				<?php $k = 1; ?>
				<?php foreach ( $this->items as $i => $item ) { ?>
				<tr class="sectiontableentry<?php echo $k .
$this->escape($this->params->get('pageclass_sfx'));
?>" >
					<td align="right"><?php echo
$this->pagination->getRowOffset($i); ?></td>
					<td><a href="<?php echo
JRoute::_(RSMembershipRoute::Memberships($item->id, $this->Itemid,
'list')); ?>"><?php echo
$this->escape($item->name); ?></a><?php if
($this->params->get('show_memberships', 0)) { ?>
(<?php echo $item->memberships; ?>)<?php } ?></td>
				</tr>
				<?php $k = $k == 1 ? 2 : 1; ?>
				<?php } ?>
			</table>
		</div>
		<?php if ($this->params->get('show_pagination', 1)) {
?>
		<div class="sectiontablefooter<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="center">
			<div class="pagination">
				<?php echo $this->pagination->getPagesLinks(); ?>
			</div>
			<?php echo $this->pagination->getPagesCounter(); ?>
		</div>
		<?php } ?>

		<input type="hidden" name="filter_order"
value="" />
		<input type="hidden" name="filter_order_Dir"
value="" />
		<input type="hidden" name="task"
value="" />
	
	</form>
</div>views/categories/tmpl/list.xml000064400000003334151166265650012517
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_RSMEMBERSHIP_CATEGORIES_LIST_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_CATEGORIES_LIST_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field name="show_memberships" type="radio"
default="1" class="btn-group"
label="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS"
description="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_headings" type="radio"
default="1" class="btn-group"
label="COM_RSMEMBERSHIP_SHOW_HEADINGS"
description="COM_RSMEMBERSHIP_SHOW_HEADINGS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_pagination" type="radio"
default="1" class="btn-group"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="orderby" type="list"
default="" label="COM_RSMEMBERSHIP_ORDER"
description="COM_RSMEMBERSHIP_ORDER_DESC">
					<option
value="name">COM_RSMEMBERSHIP_TITLE</option>
					<option
value="ordering">COM_RSMEMBERSHIP_ORDERING</option>
				</field>
				<field name="orderdir" type="radio"
class="btn-group" default="ASC"
label="COM_RSMEMBERSHIP_DIRECTION"
description="COM_RSMEMBERSHIP_DIRECTION_DESC">
					<option
value="ASC">COM_RSMEMBERSHIP_ASCENDENT</option>
					<option
value="DESC">COM_RSMEMBERSHIP_DESCENDENT</option>
				</field>
			</fieldset>
		</fields>
	</config>
</metadata>views/categories/view.html.php000064400000003157151166265650012477
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewCategories extends JViewLegacy
{
	public function display($tpl = null) 
	{
		$app = JFactory::getApplication();

		$this->params 		=
clone($app->getParams('com_rsmembership'));
		$this->items 		= $this->get('Items');
		$this->pagination 	= $this->get('Pagination');
		$this->Itemid 		= $app->input->get('Itemid',0,
'int');
		$this->state 		= $this->get('State');

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'])
            && $active->query['view'] ==
'categories')
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }
	
		// Description
		if ( $this->params->get('menu-meta_description') ) 
			$this->document->setDescription($this->params->get('menu-meta_description'));
		// Keywords
		if ( $this->params->get('menu-meta_keywords') ) 
			$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
		// Robots
		if ( $this->params->get('robots') ) 
			$this->document->setMetadata('robots',
$this->params->get('robots'));

		parent::display($tpl);
	}
}views/extras/index.html000064400000000054151166265650011220
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/extras/metadata.xml000064400000000130151166265660011521
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view hidden="true" />
</metadata>views/extras/tmpl/default.php000064400000007660151166265660012347
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');

$post_extra =
JFactory::getApplication()->input->get('rsmembership_extra',
array(), 'array');
$isset_post = JFactory::getApplication()->input->getMethod() ===
'POST';
?>
<?php if ( $this->extras ) { ?>
	<?php foreach ( $this->extras as $extra ) { ?>
			<?php $isset_extra = isset($post_extra[$extra->id]); ?>
			<div class="item-page rsm_extra_container">
				<div class="page-header"><h3
class="rsm_extra_title"><?php echo $extra->name;
?></h3></div>
				<?php
				if (RSMembershipHelper::getConfig('trigger_content_plugins'))
{
					$extra->description = JHtml::_('content.prepare',
$extra->description);
				}
				echo $extra->description;
				?>
				<?php $extra_values =
$this->model->getExtraValues($extra->id); ?>
				<?php switch ( $extra->type ) { 
						case 'dropdown': ?>
						<?php $values = array(); ?>
							<select name="rsmembership_extra[<?php echo
$extra->id; ?>]" class="rsm_extra rsmemgrid-form-control
rsmemgrid-col-sm-6 rsmemgrid-form-control-sm"
onchange="RSMembership.buildTotal.remake_total()">
								<option value="0"><?php echo
JText::_('COM_RSMEMBERSHIP_PLEASE_SELECT_EXTRA');
?></option>
							<?php foreach ($extra_values as $value) { ?>
								<option <?php echo ( ( !$isset_post &&
$value->checked ) || ( $isset_extra && $value->id ==
$post_extra[$extra->id] ) ? 'selected="selected"' :
'' ); ?> value="<?php echo $value->id; ?>"
data-pricevalue="<?php echo
$value->price;?>"><?php echo $value->name; ?> -
<?php echo RSMembershipHelper::getPriceFormat($value->price);
?></option>
							<?php } ?>
							</select>
						<?php break; ?>

					<?php case 'radio': ?>
						<?php $values = array(); ?>

						<?php foreach ($extra_values as $i => $value) { ?>
							<div class="rsmemgrid-form-check">
							<input type="radio" <?php echo ( ( !$isset_post
&& $value->checked ) || ( $isset_extra && $value->id
== $post_extra[$extra->id] ) ? 'checked="checked"' :
'' ); ?> value="<?php echo $value->id; ?>"
id="extras<?php echo $value->id; ?>"
name="rsmembership_extra[<?php echo $extra->id; ?>]"
onclick="RSMembership.buildTotal.remake_total()"
class="rsm_extra rsmemgrid-form-check-input"
data-pricevalue="<?php echo $value->price;?>"/>
							<label for="extras<?php echo $value->id; ?>"
class="rsm_extra rsmemgrid-form-check-label"><?php echo
$value->name; ?> - <?php echo
RSMembershipHelper::getPriceFormat($value->price); ?></label>
							</div>
						<?php } ?>

					<?php break; ?>

					<?php case 'checkbox': ?>
						<?php foreach ($extra_values as $i => $value) {?>
							<div class="rsmemgrid-form-check">
							<input type="checkbox" <?php echo ( ( !$isset_post
&& $value->checked ) || ( $isset_extra &&
in_array($value->id, $post_extra[$extra->id]) ) ?
'checked="checked"' : '' ); ?>
value="<?php echo $value->id; ?>"
id="extras<?php echo $value->id; ?>"
name="rsmembership_extra[<?php echo $extra->id; ?>][]"
class="rsm_extra rsmemgrid-form-check-input"
onclick="RSMembership.buildTotal.remake_total()"
data-pricevalue="<?php echo $value->price;?>"/>
							<label for="extras<?php echo $value->id; ?>"
class="rsm_extra rsmemgrid-form-check-label"><?php echo
$value->name; ?> - <?php echo
RSMembershipHelper::getPriceFormat($value->price); ?></label>
							</div>
						<?php } ?>
						<?php break; ?>
				<?php } ?>
				<div class="clearfix"></div>
			</div> <!-- end .item-page -->
	<?php } ?>
<?php } ?>

<?php if ( $this->show_subscribe_btn ) { ?>
		<div class="rsmemgrid-row rsmemgrid-no-gutters">
			<div class="form-actions rsmemgrid-col-12">
				<button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right rsmemgrid-mr-3"><?php echo
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'); ?></button>
			</div>
		</div>
<?php } ?>
views/extras/tmpl/index.html000064400000000054151166265660012175
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/extras/view.html.php000064400000000656151166265660011662
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewExtras extends JViewLegacy
{
	public function display($tpl = null)
	{
		parent::display();
	}
}views/index.html000064400000000054151166265660007713
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/membership/index.html000064400000000054151166265660012046
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/membership/metadata.xml000064400000000307151166265660012354
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_MEMBERSHIP">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_MEMBERSHIP_MENU_DESC]]>
		</message>
	</view>
</metadata>views/membership/tmpl/default.php000064400000003135151166265660013165
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_membership_detail"
class="row-fluid">
	<div class="item-page">
		<?php if ($this->params->get('show_page_heading', 1))
{ ?>
		<div class="page-header">
			<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
		</div>
		<?php } ?>

		<form method="post" action="<?php echo
JRoute::_(RSMembershipRoute::Subscribe( $this->item->category_id, 
$this->item->category_name, $this->item->id,
$this->item->name, $this->Itemid ) ); ?>"
id="rsm_membership_form">
			<?php if (!empty($this->item->thumb)) { ?>
					<?php echo
JHtml::image('components/com_rsmembership/assets/thumbs/'.$this->item->thumb,
$this->item->name, 'class="rsm_thumb"'); ?>
			<?php } ?>
			<?php
			// Trigger content plugins if enabled
			if (RSMembershipHelper::getConfig('trigger_content_plugins'))
{
				$this->item->description = JHtml::_('content.prepare',
$this->item->description);
			}
			echo $this->item->description;
			
			if ($this->extras) { ?>
			<div id="rsm_extras_container<?php echo
$this->item->id; ?>">
				<?php echo $this->extras; ?>
			</div>
			<?php } ?>

			<?php echo JHtml::_( 'form.token' ); ?>

			<input type="hidden" name="cid"
value="<?php echo $this->item->id; ?>" />
			<input type="hidden" name="task"
value="subscribe" />
		</form> <!-- rsm_membership_form -->
	</div>
</div>
<div
class="clearfix"></div>views/membership/tmpl/default.xml000064400000001116151166265660013173
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout
title="COM_RSMEMBERSHIP_SINGLE_MEMBERSHIP_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_SINGLE_MEMBERSHIP_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="request">
			<fieldset name="request"
addfieldpath="/administrator/components/com_rsmembership/models/fields">
				<field name="cid" type="memberships"
class="input-large"
label="COM_RSMEMBERSHIP_VIEW_SELECT_MEMBERSHIP"
description="COM_RSMEMBERSHIP_VIEW_SELECT_MEMBERSHIP_DESC"
required="true" />
			</fieldset>
		</fields>
	</config>
</metadata>views/membership/tmpl/index.html000064400000000054151166265660013022
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/membership/view.html.php000064400000007040151166265660012501
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipViewMembership extends JViewLegacy
{
	public 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 ) 
		{
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_NOT_EXIST'),
'warning');
			$app->redirect(JRoute::_(RSMembershipRoute::Memberships()));
		}

		$currency = RSMembershipHelper::getConfig('currency');
		// {price} placeholder
		$price 	  =
RSMembershipHelper::getPriceFormat($this->item->price);
		
		// {extras} placeholder
		$viewclass = 'JViewLegacy';

		$view = new $viewclass(array(
			'name' 		=> 'extras',
			'base_path' =>
JPATH_SITE.'/components/com_rsmembership'
		));

		$view->model 			  = JModelLegacy::getInstance('Extras',
'RSMembershipModel', array('ignore_request' =>
true));
		$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   = $app->input->get('Itemid', 0,
'int');
		$layout  		= $app->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);

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'],
$active->query['cid'])
            && $active->query['view'] ==
'membership'
            && $active->query['cid'] ==
$this->item->id)
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }
        else
        {
            $this->params->set('page_heading',
$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();
	}
}views/mymembership/index.html000064400000000054151166265670012415
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mymembership/metadata.xml000064400000000130151166265670012715
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view hidden="true" />
</metadata>views/mymembership/tmpl/addextra.php000064400000023255151166265670013711
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

$total = $this->extra->price;
?>
<div id="rsm_mymembership_extra"
class="item-page">
    <?php if ($this->params->get('show_page_heading',
1)) { ?>
        <div class="page-header">
            <h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
        </div>
    <?php } ?>

    <form method="post" class="rsmembership_form"
action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=mymembership.addextrapaymentredirect');
?>" name="membershipForm"
id="rsm_addextra_default_form">

        <div class="item-page rsmemgrid-mb-4">
            <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_PURCHASE_INFORMATION');
?></h3>
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_EXTRA');
?>:</label></div>
                <div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
RSMembershipHelper::getPriceFormat($this->extra->price);
?></div></div>
            </div>
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_TOTAL_COST');
?>:</label></div>
                <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->extra->name; ?> - <?php echo
RSMembershipHelper::getPriceFormat($this->extra->price);
?></div></div>
            </div>
        </div><!-- .item-page -->

        <div class="item-page rsmemgrid-mb-4">
            <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION');
?></h3>

            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_NAME');
?>:</label></div>
                <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('name'));
?></div></div>
            </div>
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo JText::_(
'COM_RSMEMBERSHIP_EMAIL' ); ?>:</label></div>
                <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('email'));
?></div></div>
            </div>

            <?php foreach ($this->fields as $field) { ?>
                <div class="rsmemgrid-form-group
rsmemgrid-row">
                    <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
                    <div
class="rsmemgrid-col-sm-8"><?php echo $field[1];
?></div>
                </div>
            <?php } ?>
        </div><!-- .item-page -->

        <?php if (count($this->membership_fields)) { ?>
            <div class="item-page">
                <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>
                <?php foreach ($this->membership_fields as $field) {
?>
                    <div class="rsmemgrid-form-group
rsmemgrid-row">
                        <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
                        <div
class="rsmemgrid-col-sm-8"><?php echo $field[1];
?></div>
                    </div>
                <?php } ?>
            </div>
        <?php } ?>


        <?php if ($this->extra->price > 0) { ?>
            <div class="item-page">
                <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_PAYMENT_INFORMATION');
?></h3>
                <div class="rsmemgrid-form-group
rsmemgrid-row">
                    <div class="rsmemgrid-col-sm-4 rsmemgrid-d-flex
rsmemgrid-align-items-center
rsmemgrid-col-form-label"><label><?php echo 
JText::_('COM_RSMEMBERSHIP_PAY_WITH');
?>:</label></div>
                    <div class="rsmemgrid-col-sm-8">
                            <?php
                            $i = 0;
                            if ( !empty($this->payments) )
                            {
                                foreach ($this->payments as $plugin
=> $paymentdetails) {
                                    $i++;
                                    $tax_value = '';
                                    $paymentname = '';
                                    if (is_array($paymentdetails))
                                    {
                                        if
($paymentdetails['tax_details'])
                                        {
                                            if
($paymentdetails['tax_details']['tax_type'] == 0)
                                            {
                                                $tax_value =
$this->extra->price *
($paymentdetails['tax_details']['tax_value'] / 100);
                                                $tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_PERCENT',
$tax_value, RSMembershipHelper::getPriceFormat($tax_value),
$paymentdetails['tax_details']['tax_value']);
                                            }
                                            else
                                            {
                                                $tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_FIXED',
$paymentdetails['tax_details']['tax_value'],
RSMembershipHelper::getPriceFormat($paymentdetails['tax_details']['tax_value']));
                                            }
                                        }
                                        $paymentname =
$paymentdetails['name'];
                                    }
                                    else
                                    {
                                        $paymentname = $paymentdetails;
                                    }
                                    ?>
                                    <div
class="rsmemgrid-form-group rsmemgrid-form-check"><input
<?php echo $i == 1 ? 'checked="checked"' :
''; ?> type="radio" name="payment"
value="<?php echo $this->escape($plugin); ?>"
id="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-input" /> <label
for="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-label"><?php echo
$this->escape($paymentname).$tax_value; ?></label></div>
                                <?php } ?>
                            <?php } ?>
                    </div>
                </div>
            </div><!-- .item-page -->

            <div class="item-page">
                <div class="rsmemgrid-form-group
rsmemgrid-row">
                    <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_GRAND_TOTAL');
?></strong>:</label></div>
                    <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_grand_total" data-fixedvalue="<?php echo
$this->extra->price;?>"><?php echo
RSMembershipHelper::getPriceFormat($this->extra->price);
?></span></div></div>
                </div>
            </div>

        <?php if (!empty($this->membershipterms)) { ?>
            <div class="item-page">
                <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_TERM'); ?></h3>
                <div id="rsm_terms_frame">
                    <div class="item-page">
                        <div id="rsm_terms_container">
                            <h1><?php echo
$this->escape($this->membershipterms->name); ?></h1>
                            <?php
                            if
(RSMembershipHelper::getConfig('trigger_content_plugins')) {
                                $this->membershipterms->description =
JHtml::_('content.prepare',
$this->membershipterms->description);
                            }
                            echo
$this->membershipterms->description;
                            ?>
                        </div> <!-- rsm_terms_container -->
                    </div>
                </div>
                <div class="rsmemgrid-form-group
rsmemgrid-form-check rsmemgrid-mt-2">
                    <input type="checkbox"
id="rsm_checkbox_agree"
class="rsmemgrid-form-check-input"
name="i_agree_to_terms" value="1" />
                    <label for="rsm_checkbox_agree"
class="rsmemgrid-form-check-label"><?php echo
JText::_('COM_RSMEMBERSHIP_I_AGREE'); ?> (<?php echo
$this->escape($this->membershipterms->name); ?>)</label>
                </div>
            </div>
        <?php } ?>

        <?php } ?>
        <div class="form-actions">
            <button type="button" class="btn
rsmemgrid-btn" onclick="document.location='<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$this->cid);
?>'" name="Cancel"><?php echo
JText::_('COM_RSMEMBERSHIP_BACK'); ?></button>
            <button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
JText::_('COM_RSMEMBERSHIP_PURCHASE'); ?></button>
        </div>

        <?php echo $this->token; ?>
        <input type="hidden" name="option"
value="com_rsmembership" />
        <input type="hidden" name="view"
value="mymembership" />
        <input type="hidden" name="task"
value="mymembership.addextrapaymentredirect" />
        <input type="hidden" name="cid"
value="<?php echo $this->cid; ?>" />
        <input type="hidden" name="extra_id"
value="<?php echo $this->extra_id ; ?>" />
    </form>
</div>views/mymembership/tmpl/default.php000064400000026624151166265670013544
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

$css_status = ( $this->membership->status == 0 ? 'success'
: ( $this->membership->status == 1 ? 'warning' :
'important' ) );
?>
<div class="item-page"
id="rsm_mymembership_container">
	<div class="page-header">
		<h1>
			<span class="rsme_faded"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP'); ?>:</span>
<?php echo $this->escape($this->membership->name); ?>
			<?php if ($this->params->get('show_status', 1)) {
?>
				<sup class="label label-<?php echo $css_status; ?>
rsmemgrid-badge"><?php echo
JText::_('COM_RSMEMBERSHIP_STATUS_'.$this->membership->status);
?></sup>
			<?php } ?>
		</h1>
	</div>

	<form method="post" action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=mymembership.upgrade&cid='.$this->membership->id);
?>" name="membershipForm"
id="rsm_membership_form">
		<!-- Membership Info -->
		<div id="rsme_membership_info">
			<!-- Membership Start - End -->
			<?php if ($this->params->get('show_expire', 1)) {
?>
			<div class="rsmemgrid-row rsmemgrid-no-gutters">
				<div class="rsmemgrid-col-md-6 rsmemgrid-float-left">
					<span class="rsmemgrid-float-left rsme_faded"><?php
echo JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_START'); ?>:
</span>
					<strong><?php echo
RSMembershipHelper::showDate($this->membership->membership_start);
?></strong>
				</div>
				<div class="rsmemgrid-col-md-6 rsmemgrid-float-left">
					<span class="rsmemgrid-float-left rsme_faded"><?php
echo JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_END'); ?>:
</span>
					<strong><?php echo $this->membership->membership_end !=
'0000-00-00 00:00:00' ?
RSMembershipHelper::showDate($this->membership->membership_end) :
JText::_('COM_RSMEMBERSHIP_UNLIMITED'); ?></strong>
				</div>
			</div>
			<?php } ?>
			<!-- Membership Renew -->
			<div class="rsmemgrid-row rsmemgrid-no-gutters
rsmemgrid-mt-3">
			<?php
				$unlimited = (bool) ($this->membership->status == 0 &&
$this->membership->membership_end == '0000-00-00
00:00:00');
				if (!$this->membership->no_renew && !$unlimited) {
			?>

				<div class="rsmemgrid-float-left rsmemgrid-col-md-6">
					<span class="rsme_faded rsme_vcenter"><?php echo
JText::_('COM_RSMEMBERSHIP_RENEW'); ?>: </span>

					<?php if ($this->params->get('show_price', 1)) {
?>
						<div id="rsme_renewal_price"
class="rsme_vcenter">
						<?php if ( $this->membership->use_renewal_price ) { ?>
							<?php echo 
RSMembershipHelper::getPriceFormat($this->membership->renewal_price);
?>
						<?php } else { ?>
							<?php echo 
RSMembershipHelper::getPriceFormat($this->membership->price); ?>
						<?php } ?>
						</div>
					<?php } ?>

					<?php $renew_link =
JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=renew&cid='.$this->membership->id.':'.JFilterOutput::stringURLSafe($this->membership->name));
?>
					<?php if ($this->membership->status == 2 ||
$this->membership->status == 3) { ?>
							<a class="btn btn-success btn-small rsmemgrid-btn
rsmemgrid-btn-sm rsme_vcenter" href="<?php echo $renew_link;
?>"><i class="icon-white
icon-refresh"></i> <?php echo
JText::_('COM_RSMEMBERSHIP_RENEW'); ?></a>
					<?php } elseif ($this->membership->status == 0 &&
RSMembershipHelper::getConfig('allow_renew_in_advance', 1)) {
?>
							<a class="btn btn-success btn-small rsmemgrid-btn
rsmemgrid-btn-sm rsme_vcenter" href="<?php echo $renew_link;
?>"><i class="icon-white
icon-refresh"></i> <?php echo
JText::_('COM_RSMEMBERSHIP_RENEW_IN_ADVANCE'); ?></a>
					<?php } ?>
				</div>

			<?php } ?>

			<!-- Membership Cancel Subscriptions -->
			<?php if
($this->params->get('show_cancel_subscription', 1)) {
?>
				<?php if ($this->membership->status == 0) { ?>
					<div class="rsmemgrid-float-right
rsmemgrid-col-md-6">
						<a class="btn btn-danger btn-small rsmemgrid-btn
rsmemgrid-btn-sm rsmemgrid-float-left rsme_vcenter"
onclick="return confirm('<?php echo
JText::_('COM_RSMEMBERSHIP_CONFIRM_CANCEL'); ?>')"
href="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=cancel&cid='.$this->membership->id);
?>"><i class="icon-white icon-trash"></i>
<?php echo JText::_('COM_RSMEMBERSHIP_CANCEL');
?></a>
					</div>
				<?php } ?>
			<?php } ?>
			</div>
			
			<!-- Membership Fields -->
			<?php if (count($this->membership_fields)) { ?>
				<h3 class="page-header rsmemgrid-mt-5"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>

				<?php foreach ($this->membership_fields as $field) {
					$hidden = (isset($field[2]) && $field[2] ==
'hidden') ? true : false;
				?>
					<div class="rsmemgrid-form-group rsmemgrid-row
rsmemgrid-no-gutters rsmemgrid-mb-0 rsmemgrid-pt-1"<?php echo
($hidden ? '
style="display:none"':'')?>>
						<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
						<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
trim($field[1]) == '' ? '--' : $field[1];
?></div></div>
					</div>
				<?php } ?>

			<?php } ?>
			<!-- Membership Upgrade -->
			<?php if ($this->has_upgrades &&
$this->membership->status == MEMBERSHIP_STATUS_ACTIVE) { ?>
			<div class="rsmemgrid-row rsmemgrid-no-gutters
rsmemgrid-mt-3">
				<div class="rsmemgrid-float-left rsmemgrid-col-md-12"
id="rsme_upgrade_box">
					<span class="rsme_vcenter rsme_faded"><label
for="to_id"><?php echo
JText::_('COM_RSMEMBRSHIP_UPGRADE_TO');
?></label></span>
					<span class="rsme_vcenter"><?php echo
$this->lists['upgrades']; ?> </span>
					<span class="rsme_vcenter"><button
type="submit" class="btn btn-small btn-success rsmemgrid-btn
rsmemgrid-btn-sm"><?php echo
JText::_('COM_RSMEMBERSHIP_UPGRADE');
?></button></span>
				</div>
			</div>
			<?php } ?>

		<!-- Bought Extras -->
		<?php if (!empty($this->boughtextras)) { ?>
			<div class="rsmemgrid-row rsmemgrid-no-gutters
rsme_extrab_container">
				<div class="rsmemgrid-col-md-12">
					<p class="lead"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_EXTRA_BOUGHT');
?></p>
					<div class="rsmemgrid-float-left">
						<?php foreach ($this->boughtextras as $bought_extra) { ?>
							<?php foreach ($bought_extra as $id => $extraname) { ?>
								<span class="label label-success
rsmemgrid-badge"><i class="rsmemgrid-icon
rsmemgrid-icon-checkmark"></i> <?php echo $extraname;
?></span>
							<?php } ?>
						<?php } ?>
					</div>
				</div>
			</div>
		<?php } ?>
		<!-- Available Extras -->
		<?php if (!empty($this->extras)) { ?>
			<div class="rsmemgrid-row rsmemgrid-no-gutters
rsme_extra_container">
				<div class="rsmemgrid-col-md-12">
					<p class="lead"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_EXTRA'); ?>:</p>
					<div>
					<?php foreach ( $this->extras as $extra ) { ?>
						<?php if ( $extra->type != 'checkbox' &&
isset($this->boughtextras[$extra->extra_id]) ) continue; ?>
							 <a class="btn btn-small rsmemgrid-btn rsmemgrid-btn-sm
rsme_extra_btn" href="<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&layout=addextra&cid='.$this->membership->id.':'.JFilterOutput::stringURLSafe($this->membership->name).'&extra_id='.$extra->id);
?>"><span class="rsmemgrid-icon
rsmemgrid-icon-plus"></span> <?php echo
JText::sprintf('COM_RSMEMBERSHIP_PURCHASE_EXTRA',
$extra->name); ?></a>
					<?php } ?>
					</div>
				</div>
			</div>
		<?php } ?>
		
		<!-- Terms & Conditions -->
		<?php if (!empty($this->membershipterms->id)) { ?>
			<p class="lead"><?php echo
JText::_('COM_RSMEMBERSHIP_TERM'); ?></p>
			<a class="btn btn-info rsmemgrid-btn" href="<?php
echo
JRoute::_('index.php?option=com_rsmembership&view=terms&cid='.$this->membershipterms->id.':'.JFilterOutput::stringURLSafe($this->membershipterms->name));
?>"><i class="rsmemgrid-icon
rsmemgrid-icon-eye"></i> <?php echo
$this->membershipterms->name; ?></a>
		<?php } ?>
		<!-- Not active reason -->
		<?php if ($this->membership->status > 0) { ?>
		<p><?php echo
JText::sprintf('COM_RSMEMBERSHIP_NOT_ACTIVE',
JText::_('COM_RSMEMBERSHIP_STATUS_'.$this->membership->status));
?></p>
		<?php } ?>
		<div class="clearfix"></div>

		<?php if ($this->previous !== false || !empty($this->folders) ||
!empty($this->files)) { ?>
		<p class="lead"><?php echo
JText::_('COM_RSMEMBERSHIP_FILES_AVAILABLE'); ?></p>
		<table class="table table-striped">
		<?php if ($this->params->get('show_headings', 1)) {
?>
			<tr>
				<th width="1%" class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>">&nbsp;</th>
				<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_NAME');
?></th>
			</tr>
		<?php } ?>
		<?php if ($this->previous !== false) { ?>
			<tr class="sectiontableentry1<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" >
				<td align="center" valign="top"><?php echo
'<i class="icon-folder-open"></i>';
?></td>
				<td><a href="<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$this->cid.($this->previous
!= '' ?
'&path='.$this->previous.'&from='.$this->from
: '')); ?>">..</a></td>
			</tr>
		<?php } ?>
		<?php foreach ($this->folders as $folder) {
			if (RSMembershipHelper::getConfig('trigger_content_plugins')
&& isset($folder->description)) {
				$folder->description = JHtml::_('content.prepare',
$folder->description);
			}
			$image = !empty($folder->thumb) ?
JHtml::image('components/com_rsmembership/assets/thumbs/files/'.$folder->thumb,
'',
'width="'.$folder->thumb_w.'"') :
'<i class="icon-folder-close"></i>';
			?>
			<tr class="sectiontableentry1<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" >
				<td align="center" valign="top"><?php echo
$image; ?></td>
				<td><a href="<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$this->cid.'&path='.$folder->fullpath.'&from='.$folder->from);
?>"><?php echo !empty($folder->name) ? $folder->name :
$folder->fullpath; ?></a><?php if
(!empty($folder->description)) { ?><p><?php echo
$folder->description; ?></p><?php } ?></td>
			</tr>
		<?php } ?>
		<?php foreach ($this->files as $file) {
			if (RSMembershipHelper::getConfig('trigger_content_plugins')
&& isset($file->description)) {
				$file->description = JHtml::_('content.prepare',
$file->description);
			}
			$image = !empty($file->thumb) ?
JHtml::image('components/com_rsmembership/assets/thumbs/files/'.$file->thumb,
'',
'width="'.$file->thumb_w.'"') :
'<i class="icon-file"></i>'; ?>
			<tr class="sectiontableentry1<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" >
				<td align="center" valign="top"><?php echo
$image; ?></td>
				<td><a href="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=download&cid='.$this->cid.'&path='.$file->fullpath.'&from='.$file->from);
?>"><?php echo !empty($file->name) ? $file->name :
$file->fullpath; ?></a><?php if
(!empty($file->description)) { ?><p><?php echo
$file->description; ?></p><?php } ?></td>
			</tr>
		<?php } ?>
		</table>
		<?php } ?>

		</div>
		<?php echo JHtml::_('form.token'); ?>
		<input type="hidden" name="option"
value="com_rsmembership" />
		<input type="hidden" name="view"
value="mymembership" />
		<input type="hidden" name="task"
value="mymembership.upgrade" />
		<input type="hidden" name="cid"
value="<?php echo $this->membership->id; ?>" />
	</form>
</div>views/mymembership/tmpl/default_terms.php000064400000001417151166265670014747
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_mymembership_terms">
	<p><?php echo
JText::_('COM_RSMEMBERSHIP_PLEASE_AGREE'); ?></p>
	<p><?php echo
JText::_('COM_RSMEMBERSHIP_PLEASE_SCROLL'); ?></p>
	<div id="rsm_mymembership_container">
		<?php echo $this->terms; ?>
	</div> <!-- rsm_mymembership_container -->
	<form method="post" action="<?php echo
$this->action; ?>" id="rsm_mymembership_form">
		<input type="hidden" name="agree"
value="1" />
		<button type="submit"><?php echo
JText::_('COM_RSMEMBERSHIP_I_AGREE'); ?></button>
	</form>
</div>views/mymembership/tmpl/index.html000064400000000054151166265670013371
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mymembership/tmpl/payment.php000064400000001204151166265670013560
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>

<div id="rsm_mymembership_payment"
class="item-page">
    <?php if ($this->params->get('show_page_heading',
1)) { ?>
        <div class="page-header">
            <h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
        </div>
    <?php } ?>
    <div id="<?php echo $this->html_container_id;
?>">
        <?php echo $this->html; ?>
    </div>
</div>views/mymembership/tmpl/renew.php000064400000024301151166265670013226
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

JText::script('COM_RSMEMBERSHIP_THERE_WAS_AN_ERROR');
if (!empty($this->membershipterms)) {
    JText::script('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP');
}

$total = $this->membership->price;
?>
<div id="rsm_mymembership_renew">
	<div class="item-page">
		<?php if ($this->params->get('show_page_heading', 1))
{ ?>
			<div class="page-header">
				<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
			</div>
		<?php } ?>
	</div>

	<form method="post" class="rsmembership_form"
action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=mymembership.renewpaymentredirect');
?>" name="membershipForm" onsubmit="return
RSMembership.subscribe.validate_subscribe(this);"
id="rsm_renew_form">
    <div class="item-page">
        <div class="page-header"><h3><?php echo
JText::_('COM_RSMEMBERSHIP_PURCHASE_INFORMATION');
?></h3></div>
        <div class="rsmemgrid-form-group rsmemgrid-row">
            <div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP');
?>:</label></div>
            <div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->membership->name; ?> - <?php echo
RSMembershipHelper::getPriceFormat($this->membership->price);
?></div></div>
        </div>
        <?php if (!empty($this->extras)) foreach ($this->extras as
$extra) {
            $total += $extra->price; ?>
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_EXTRA');
?>:</label></div>
                <div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$extra->name; ?> - <?php echo
RSMembershipHelper::getPriceFormat($extra->price);
?></div></div>
            </div>
        <?php } ?>

        <div class="rsmemgrid-form-group rsmemgrid-row">
            <div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_TOTAL_COST');
?>:</label></div>
            <div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
RSMembershipHelper::getPriceFormat($total); ?></div></div>
        </div>
    </div>

    <div class="item-page">
        <div class="page-header"><h3><?php echo
JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION');
?></h3></div>
        <div class="rsmemgrid-form-group rsmemgrid-row">
            <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_NAME');
?>:</label></div>
            <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('name'));
?></div></div>
        </div>
        <div class="rsmemgrid-form-group rsmemgrid-row">
            <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo JText::_(
'COM_RSMEMBERSHIP_EMAIL' ); ?>:</label></div>
            <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('email'));
?></div></div>
        </div>
        <?php foreach ($this->fields as $field) {
            $hidden = (isset($field[2]) && $field[2] ==
'hidden') ? true : false;
        ?>
            <div class="rsmemgrid-form-group
rsmemgrid-row"<?php echo ($hidden ? '
style="display:none"':'')?>>
                <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
                <div class="rsmemgrid-col-sm-8"><?php
echo $field[1]; ?></div>
            </div>
        <?php } ?>
    </div>

    <?php if (count($this->membership_fields)) { ?>
        <div class="item-page">
            <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>
            <?php foreach ($this->membership_fields as $field) {
                $hidden = (isset($field[2]) && $field[2] ==
'hidden') ? true : false;
                ?>
                <div class="rsmemgrid-form-group
rsmemgrid-row"<?php echo ($hidden ? '
style="display:none"':'')?>>
                    <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
                    <div
class="rsmemgrid-col-sm-8"><?php echo $field[1];
?></div>
                </div>
            <?php } ?>
        </div>
    <?php } ?>

    <?php if ($total > 0) { ?>
        <div class="item-page">
            <div class="page-header"><h3><?php
echo JText::_('COM_RSMEMBERSHIP_PAYMENT_INFORMATION');
?></h3></div>
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-sm-4 rsmemgrid-d-flex
rsmemgrid-align-items-center
rsmemgrid-col-form-label"><label><?php echo 
JText::_('COM_RSMEMBERSHIP_PAY_WITH');
?>:</label></div>
                <div class="rsmemgrid-col-sm-8">
                        <?php
                        $i = 0;
                        if (!empty($this->payments))
                        {
                            foreach ($this->payments as $plugin =>
$paymentdetails) {
                                $i++;
                                $tax_value = '';
                                $paymentname = '';
                                if (is_array($paymentdetails))
                                {
                                    if
($paymentdetails['tax_details'])
                                    {
                                        if
($paymentdetails['tax_details']['tax_type'] == 0)
                                        {
                                            $tax_value = $total *
($paymentdetails['tax_details']['tax_value'] / 100);
                                            $tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_PERCENT',
$tax_value, RSMembershipHelper::getPriceFormat($tax_value),
$paymentdetails['tax_details']['tax_value']);
                                        }
                                        else
                                        {
                                            $tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_FIXED',
$paymentdetails['tax_details']['tax_value'],
RSMembershipHelper::getPriceFormat($paymentdetails['tax_details']['tax_value']));
                                        }
                                    }
                                    $paymentname =
$paymentdetails['name'];
                                }
                                else
                                {
                                    $paymentname = $paymentdetails;
                                }
                                ?>
                                <div class="rsmemgrid-form-group
rsmemgrid-form-check"><input <?php echo $i == 1 ?
'checked="checked"' : ''; ?>
type="radio" name="payment" value="<?php echo
$this->escape($plugin); ?>" id="payment<?php echo $i;
?>" class="rsmemgrid-form-check-input" /> <label
for="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-label"><?php echo
$this->escape($paymentname).$tax_value; ?></label></div>
                            <?php } ?>
                        <?php } ?>
                    </div>
               </div>
        </div>
        <div class="item-page">
            <div class="rsmemgrid-form-group
rsmemgrid-row">
                <div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_GRAND_TOTAL');
?></strong>:</label></div>
                <div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_grand_total" data-fixedvalue="<?php echo
$total;?>"><?php echo
RSMembershipHelper::getPriceFormat($total);
?></span></div></div>
            </div>
        </div>
    <?php } ?>

    <?php if (!empty($this->membershipterms)) { ?>
        <div class="item-page">
            <h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_TERM'); ?></h3>
            <div id="rsm_terms_frame">
                <div class="item-page">
                    <div id="rsm_terms_container">
                        <h1><?php echo
$this->escape($this->membershipterms->name); ?></h1>
                        <?php
                        if
(RSMembershipHelper::getConfig('trigger_content_plugins')) {
                            $this->membershipterms->description =
JHtml::_('content.prepare',
$this->membershipterms->description);
                        }
                        echo $this->membershipterms->description;
                        ?>
                    </div> <!-- rsm_terms_container -->
                </div>
            </div>
            <div class="rsmemgrid-form-group rsmemgrid-form-check
rsmemgrid-mt-2">
                <input type="checkbox"
id="rsm_checkbox_agree"
class="rsmemgrid-form-check-input"
name="i_agree_to_terms" value="1" />
                <label for="rsm_checkbox_agree"
class="rsmemgrid-form-check-label"><?php echo
JText::_('COM_RSMEMBERSHIP_I_AGREE'); ?> (<?php echo
$this->escape($this->membershipterms->name); ?>)</label>
            </div>
        </div>
    <?php } ?>

    <div class="form-actions">
        <button type="button" class="btn
rsmemgrid-btn" onclick="document.location='<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$this->cid);
?>'" name="Cancel"><?php echo
JText::_('COM_RSMEMBERSHIP_BACK'); ?></button>
        <button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
JText::_('COM_RSMEMBERSHIP_RENEW'); ?></button>
    </div>

    <?php echo $this->token; ?>
    <input type="hidden" name="option"
value="com_rsmembership" />
    <input type="hidden" name="view"
value="mymembership" />
    <input type="hidden" name="task"
value="mymembership.renewpaymentredirect" />
    <input type="hidden" name="cid"
value="<?php echo $this->cid; ?>" />
</form>

<?php
echo RSMembershipHelper::renderMagnificPopup('rsmembershipModal',
array(
    'url' 	   => false,
    'height'   => 400
));
?>
</div>
views/mymembership/tmpl/upgrade.php000064400000020404151166265720013531
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

JText::script('COM_RSMEMBERSHIP_THERE_WAS_AN_ERROR');
if (!empty($this->membershipterms)) {
    JText::script('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP');
}
?>
<div id="rsm_mymembership_upgrade">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
		<div class="page-header">
			<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
		</div>
	<?php } ?>
	<form method="post" class="rsmembership_form"
action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=mymembership.upgradepaymentredirect');
?>" name="membershipForm" onsubmit="return
RSMembership.subscribe.validate_subscribe(this);"
id="rsm_upgrade_form">
		<div class="item-page">
			<div class="page-header"><h3><?php echo
JText::_('COM_RSMEMBERSHIP_PURCHASE_INFORMATION');
?></h3></div>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_UPGRADE');
?>:</label></div>
				<div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->upgrade->fromname; ?> <?php echo
JText::_('to'); ?> <?php echo $this->upgrade->toname;
?></div></div>
			</div>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_TOTAL_COST');
?>:</label></div>
				<div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->total; ?></div></div>
			</div>
		</div>

		<div class="item-page">
			<div class="page-header"><h3><?php echo
JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION');
?></h3></div>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_NAME');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('name'));
?></div></div>
			</div>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo JText::_(
'COM_RSMEMBERSHIP_EMAIL' ); ?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('email'));
?></div></div>
			</div>
			<?php foreach ($this->fields as $field) {
				$hidden = (isset($field[2]) && $field[2] == 'hidden')
? true : false;
				?>
				<div class="rsmemgrid-form-group rsmemgrid-row"<?php
echo ($hidden ? '
style="display:none"':'')?>>
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
					<div class="rsmemgrid-col-sm-8"><?php echo
$field[1]; ?></div>
				</div>
			<?php } ?>
		</div>

		<?php if (count($this->membership_fields)) { ?>
			<div class="item-page">
				<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>
				<?php foreach ($this->membership_fields as $field) {
					$hidden = (isset($field[2]) && $field[2] ==
'hidden') ? true : false;
					?>
					<div class="rsmemgrid-form-group rsmemgrid-row"<?php
echo ($hidden ? '
style="display:none"':'')?>>
						<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
						<div class="rsmemgrid-col-sm-8"><?php echo
$field[1]; ?></div>
					</div>
				<?php } ?>
			</div>
		<?php } ?>

		<?php if ($this->upgrade->price > 0) { ?>
			<div class="item-page">
				<div class="page-header"><h3><?php echo
JText::_('COM_RSMEMBERSHIP_PAYMENT_INFORMATION');
?></h3></div>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4 rsmemgrid-d-flex
rsmemgrid-align-items-center
rsmemgrid-col-form-label"><label><?php echo 
JText::_('COM_RSMEMBERSHIP_PAY_WITH');
?>:</label></div>
					<div class="rsmemgrid-col-sm-8">
							<?php
							$i = 0;
							if (!empty($this->payments))
							{
								foreach ($this->payments as $plugin => $paymentdetails) {
									$i++;
									$tax_value = '';
									$paymentname = '';
									if (is_array($paymentdetails))
									{
										if ($paymentdetails['tax_details'])
										{
											if
($paymentdetails['tax_details']['tax_type'] == 0)
											{
												$tax_value = $this->upgrade->price *
($paymentdetails['tax_details']['tax_value'] / 100);
												$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_PERCENT',
$tax_value, RSMembershipHelper::getPriceFormat($tax_value),
$paymentdetails['tax_details']['tax_value']);
											}
											else
											{
												$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_FIXED',
$paymentdetails['tax_details']['tax_value'],
RSMembershipHelper::getPriceFormat($paymentdetails['tax_details']['tax_value']));
											}
										}
										$paymentname = $paymentdetails['name'];
									}
									else
									{
										$paymentname = $paymentdetails;
									}
									?>
						<div class="rsmemgrid-form-group
rsmemgrid-form-check"><input <?php echo $i == 1 ?
'checked="checked"' : ''; ?>
type="radio" name="payment" value="<?php echo
$this->escape($plugin); ?>" id="payment<?php echo $i;
?>" class="rsmemgrid-form-check-input" /> <label
for="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-label"><?php echo
$this->escape($paymentname).$tax_value; ?></label></div>
								<?php } ?>
							<?php } ?>
					</div>
				</div>
			</div>
			<div class="item-page">
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_GRAND_TOTAL');
?></strong>:</label></div>
					<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_grand_total" data-fixedvalue="<?php echo
$this->upgrade->price;?>"><?php echo
RSMembershipHelper::getPriceFormat($this->upgrade->price);
?></span></div></div>
				</div>
			</div>
		<?php } ?>

		<?php if (!empty($this->membershipterms)) { ?>
			<div class="item-page">
				<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_TERM'); ?></h3>
				<div id="rsm_terms_frame">
					<div class="item-page">
						<div id="rsm_terms_container">
							<h1><?php echo
$this->escape($this->membershipterms->name); ?></h1>
							<?php
							if
(RSMembershipHelper::getConfig('trigger_content_plugins')) {
								$this->membershipterms->description =
JHtml::_('content.prepare',
$this->membershipterms->description);
							}
							echo $this->membershipterms->description;
							?>
						</div> <!-- rsm_terms_container -->
					</div>
				</div>
				<div class="rsmemgrid-form-group rsmemgrid-form-check
rsmemgrid-mt-2">
					<input type="checkbox" id="rsm_checkbox_agree"
class="rsmemgrid-form-check-input"
name="i_agree_to_terms" value="1" />
					<label for="rsm_checkbox_agree"
class="rsmemgrid-form-check-label"><?php echo
JText::_('COM_RSMEMBERSHIP_I_AGREE'); ?> (<?php echo
$this->escape($this->membershipterms->name); ?>)</label>
				</div>
			</div>
		<?php } ?>

		<div class="form-actions">
			<button type="button" class="btn rsmemgrid-btn"
onclick="document.location='<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$this->cid);
?>'" name="Cancel"><?php echo
JText::_('COM_RSMEMBERSHIP_BACK'); ?></button>
			<button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
JText::_('COM_RSMEMBERSHIP_UPGRADE'); ?></button>
		</div>
		<?php echo $this->token; ?>
		<input type="hidden" name="option"
value="com_rsmembership" />
		<input type="hidden" name="view"
value="mymembership" />
		<input type="hidden" name="task"
value="mymembership.upgradepaymentredirect" />
		<input type="hidden" name="cid"
value="<?php echo $this->cid; ?>" />
		<input type="hidden" name="to_id"
value="<?php echo $this->upgrade->membership_to_id
?>" />
	</form> <!-- rsm_upgrade_form -->

<?php
echo RSMembershipHelper::renderMagnificPopup('rsmembershipModal',
array(
    'url' 	   => false,
    'height'   => 400
));
?>
</div>views/mymembership/view.html.php000064400000021113151166265720013041
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipViewMymembership extends JViewLegacy
{
	public function display($tpl = null)
	{
		$app 	 = JFactory::getApplication();
		// Set params
		$this->params =
clone($app->getParams('com_rsmembership'));

		$display = null;
		$pathway_item  = JText::_('COM_RSMEMBERSHIP_MEMBERSHIP');
		if ($terms = $this->get('terms')) {
			$this->terms  = $terms;
			$this->action =
$this->escape(JRoute::_(JUri::getInstance(),false));

			$display = 'terms';
		} else {
			// Get the layout
			$layout = $this->getLayout();
			$model = $this->getModel();
			if ($layout == 'addextra') {

				$this->extra_id 	 = $this->get('extraId');
				$membership_id 		 = $this->get('cid');

				// store in session the ids
				$model->bindId($membership_id, $this->extra_id);

				// check if extra is already purchased (redirects if it is)
				$model->checkBoughtExtra();

				$this->payments = RSMembership::getPlugins(false);
				// get the encoded return url
				$this->return 	= base64_encode(JUri::getInstance());
				$this->data 	= $this->get('subscriberData');

				// get the membership
				$this->membership 		 = $model->getMembershipSubscriber();
				// get the user
				$this->user		         = JFactory::getUser();
				// Get the terms
                $this->membershipterms   =
$this->get('membershipterms');

				$this->fields 	 		 = RSMembershipHelper::getFields(false);
				$this->membership_fields =
RSMembershipHelper::getMembershipFields($this->membership->id, false,
$this->user->id, true,
$this->membership->last_transaction_id);

				// get the extra
				$this->extra 	= $model->getExtra($this->extra_id);
				$this->cid 	 	= $membership_id;
				$this->token	= JHtml::_('form.token');

				$pathway_item = JText::_('COM_RSMEMBERSHIP_ADDEXTRA');

			} else if($layout == 'upgrade') {

				$from_id 	 = $this->get('cid');
				$to_id 		 = $this->get('toid');

				// store in session the membership_id
				$model->bindId($from_id, $to_id, 'upgrade');

				$this->payments = RSMembership::getPlugins(false);

				// get the encoded return url
				$this->return 	= base64_encode(JUri::getInstance());

				$this->data 	= $this->get('subscriberData');

				// get the upgrade
				$this->upgrade =
$model->getMembershipSubscriber('upgrade');
				// get the user
				$this->user		= JFactory::getUser();

				// price
				$this->total 	=
RSMembershipHelper::getPriceFormat($this->upgrade->price);

				$this->fields	= RSMembershipHelper::getFields(true);
				$this->membership_fields =
RSMembershipHelper::getMembershipFields($this->upgrade->membership_to_id,
true, $this->user->id, true);

				$this->membershipterms =
$this->get('membershipterms');

				// Start the init object
				$init = new stdClass();

				// Build the mandatory validate checks array
				if (!empty($this->membershipterms)) {
					$init->validations = array('membershipterms');
				}

				// Check for field validations
				$fields_validation 	=
RSMembershipHelper::getFieldsValidation($this->upgrade->membership_to_id);
				if (!empty($fields_validation)) {
					$init->field_validations = $fields_validation;
				}

				if (isset($init->validations) || isset($init->field_validations))
{
					// In case the scripts aren't loaded in the <head> area
					$inline_js = 'jQuery(function()
{'."\n\t".'RSMembership.subscribe.init = jQuery.extend(
{}, RSMembership.subscribe.init, '.json_encode($init).'
);'."\n".'});'."\n";
					JFactory::getDocument()->addScriptDeclaration($inline_js);
				}


				$this->config 	= RSMembershipHelper::getConfig();
				$this->cid 		= $from_id;
				$this->token	= JHtml::_('form.token');

				$pathway_item = JText::_('COM_RSMEMBERSHIP_UPGRADE');

			} else if($layout == 'renew'){

				$membership_id 		 = $this->get('cid');
				// store in session the membership_id
				$model->bindId($membership_id, null, 'renew');

				$this->payments = RSMembership::getPlugins(false);

				// get the encoded return url
				$this->return 	= base64_encode(JUri::getInstance());

				$this->data = $this->get('subscriberData');

				// get the user
				$this->user		= JFactory::getUser();

				// get the membership
				$this->membership 		 =
$model->getMembershipSubscriber('renew');
				$this->membershipterms 	 =
$this->get('membershipterms');
				$this->fields 			 = RSMembershipHelper::getFields(true);
				$this->membership_fields =
RSMembershipHelper::getMembershipFields($this->membership->id, true,
$this->user->id, true,
$this->membership->last_transaction_id);

				// Start the init object
				$init = new stdClass();

				// Build the mandatory validate checks array
				if (!empty($this->membershipterms)) {
					$init->validations = array('membershipterms');
				}

				// Check for field validations
				$fields_validation 	=
RSMembershipHelper::getFieldsValidation($this->membership->id);
				if (!empty($fields_validation)) {
					$init->field_validations = $fields_validation;
				}

				if (isset($init->validations) || isset($init->field_validations))
{
					// In case the scripts aren't loaded in the <head> area
					$inline_js = 'jQuery(function()
{'."\n\t".'RSMembership.subscribe.init = jQuery.extend(
{}, RSMembership.subscribe.init, '.json_encode($init).'
);'."\n".'});'."\n";
					JFactory::getDocument()->addScriptDeclaration($inline_js);
				}

				$this->extras = $this->get('boughtExtrasRenew');
				$this->cid 		= $this->get('cid');
				$this->config	= RSMembershipHelper::getConfig();
				$this->token	= JHtml::_('form.token');

				$pathway_item = JText::_('COM_RSMEMBERSHIP_RENEW');

			} else if($layout == 'payment') {

				$action_type = $app->input->getCmd('action_type',
'addextra');

				switch($action_type) {
					case 'addextra':
						// process the payment
						$model->addExtraPayment();

						$pathway_item 			 = JText::_('COM_RSMEMBERSHIP_ADDEXTRA');
						$this->html_container_id = 'rsm_addextra_container';
					break;

					case 'renew':
						// process the payment
						$model->renewPayment();

						$pathway_item 			 = JText::_('COM_RSMEMBERSHIP_RENEW');
						$this->html_container_id = 'rsm_renew_payment_content';
					break;

					case 'upgrade':
						// process the payment
						$model->upgradePayment();

						$pathway_item 			 = JText::_('COM_RSMEMBERSHIP_RENEW');
						$this->html_container_id = 'rsm_renew_payment_content';
					break;
				}
				// return the output
				$this->html = $this->get('html');

			} 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
rsmemgrid-form-control-sm"');

				$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;

				// 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);

			}

			$this->currency =
RSMembershipHelper::getConfig('currency');

			if (in_array($layout,array('addextra', 'upgrade',
'renew'))) {
				// display the grand total after payment selection
				RSMembershipHelper::buildGrandTotal();
			}
		}

		$pathway = $app->getPathway();

		// Set pathway
		$pathway->addItem($pathway_item, '');

        if (!empty($this->membership))
        {
            $this->params->set('page_heading',
$this->membership->name);
        }

		// load the tooltip framework
		RSMembershipHelper::loadTooltipFramework();

		parent::display($display);
	}
}views/mymemberships/index.html000064400000000054151166265720012574
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mymemberships/metadata.xml000064400000000317151166265720013103
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_MY_MEMBERSHIPS">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_MY_MEMBERSHIPS_MENU_DESC]]>
		</message>
	</view>
</metadata>views/mymemberships/tmpl/default.php000064400000013146151166265720013716
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_mymemberships" class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

<form action="<?php echo $this->action; ?>"
method="post" name="adminForm"
id="rsm_mymemberships_form">
<?php if ( !empty($this->items) ) { ?>
<div class="table-responsive rsmemgrid-table-responsive">
<table class="rsmembershiptable <?php echo
$this->escape($this->params->get('pageclass_sfx'));
?> table table-stripped table-hover rsmemgrid-table
rsmemgrid-table-stripped rsmemgrid-table-hover">
<?php if ($this->params->get('show_headings', 1)) {
?>
<tr>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="right" width="5%"><?php echo
JText::_('#'); ?></th>
 	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP'); ?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_START'); ?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_END'); ?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_STATUS');
?></th>
</tr>
<?php } ?>

<?php $k = 1; ?>
<?php $i = 0; ?>
<?php foreach ($this->items as $item) {
	$css_status = ( $item->status == 0 ? 'success' : (
$item->status == 1 ? 'warning' : 'error' ) );
?>
<tr class="rsmesectiontableentry<?php echo $k .
$this->escape($this->params->get('pageclass_sfx'));
?> <?php echo $css_status;?>" >
	<td align="right"><?php echo
$this->pagination->getRowOffset($i); ?></td>
	<td><a href="<?php echo
JRoute::_('index.php?option=com_rsmembership&view=mymembership&cid='.$item->id.$this->Itemid);
?>"><?php echo $this->escape($item->name);
?></a></td>
	<td><i class="icon icon-clock rsmemgrid-icon
rsmemgrid-icon-clock"></i> <?php echo
RSMembershipHelper::showDate($item->membership_start); ?></td>
	<td><i class="icon icon-clock rsmemgrid-icon
rsmemgrid-icon-clock"></i> <?php echo (
$item->membership_end == '0000-00-00 00:00:00' ?
JText::_('COM_RSMEMBERSHIP_UNLIMITED') :
RSMembershipHelper::showDate($item->membership_end)); ?></td>
	<td><?php echo
JText::_('COM_RSMEMBERSHIP_STATUS_'.$item->status);
?></td>
</tr>
<?php $k = $k == 1 ? 2 : 1; ?>
<?php $i++; ?>
<?php } ?>

<?php if ($this->params->get('show_pagination', 1)
&& $this->pagination->get('pages.total') > 1) {
?>
<tr>
	<td align="center" colspan="5" class="center
pagination sectiontablefooter<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>">
		<?php echo $this->pagination->getPagesLinks(); ?>
	</td>
</tr>
<tr>
	<td colspan="5" align="right"><?php echo
$this->pagination->getPagesCounter(); ?></td>
</tr>
<?php } ?>
</table>
</div>
<input type="hidden" name="limitstart"
value="<?php echo $this->limitstart; ?>" />

<?php } ?>
</form>

<?php if (!empty($this->transactions)) { ?>
<p><?php echo
JText::sprintf('COM_RSMEMBERSHIP_HAVE_PENDING_TRANSACTIONS',
count($this->transactions)); ?></p>
<div class="table-responsive rsmemgrid-table-responsive">
<table class="rsmembershiptable <?php echo
$this->escape($this->params->get('pageclass_sfx'));
?> table table-stripped table-hover rsmemgrid-table
rsmemgrid-table-stripped rsmemgrid-table-hover"
id="rsm_transactions_tbl">
<?php if ($this->params->get('show_headings', 1)) {
?>
<tr>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="right" width="5%"><?php echo
JText::_('#'); ?></th>
 	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION'); ?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_DATE');
?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_PRICE');
?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_GATEWAY'); ?></th>
	<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_STATUS');
?></th>
</tr>
<?php } ?>
<?php $k = 1; ?>
<?php foreach ($this->transactions as $i => $item) {
	 $css_status = ( $item->status == 'active' ?
'success' : ( $item->status == 'pending' ?
'warning' : 'error' ) );
?>
<tr class="sectiontableentry<?php echo $k .
$this->escape($this->params->get('pageclass_sfx'));
?> <?php echo $css_status;?> " >
	<td align="right"><?php echo $i+1; ?></td>
	<td><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION_'.strtoupper($item->type));
?></td>
	<td><?php echo RSMembershipHelper::showDate($item->date);
?></td>
	<td><?php echo
RSMembershipHelper::getPriceFormat($item->price); ?></td>
	<td><?php echo $item->gateway; ?></td>
	<td><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION_STATUS_'.strtoupper($item->status));
?></td>
</tr>
<?php $k = $k == 1 ? 2 : 1; ?>
<?php $i++; ?>
<?php } ?>
</table>
</div>
<?php } ?>
</div>views/mymemberships/tmpl/default.xml000064400000004035151166265720013724
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout
title="COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_MEMBERSHIPS_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_MEMBERSHIPS_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field name="show_headings" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_HEADINGS"
description="COM_RSMEMBERSHIP_SHOW_HEADINGS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_pagination" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_price" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PRICE"
description="COM_RSMEMBERSHIP_SHOW_PRICE">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_status" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_STATUS"
description="COM_RSMEMBERSHIP_SHOW_STATUS">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_expire" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_START_EXPIRE_DATE"
description="COM_RSMEMBERSHIP_START_EXPIRE_DATE_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_cancel_subscription"
type="radio" class="btn-group" default="1"
label="COM_RSMEMBERSHIP_CANCEL_SUBSCRIPTION"
description="COM_RSMEMBERSHIP_CANCEL_SUBSCRIPTION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
			</fieldset>
		</fields>
	</config>
</metadata>views/mymemberships/tmpl/index.html000064400000000054151166265720013550
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mymemberships/view.html.php000064400000004161151166265720013230
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewMymemberships extends JViewLegacy
{
	public function display($tpl = null)
	{
	    $app                = JFactory::getApplication();
		$this->params 		=
clone($app->getParams('com_rsmembership'));
		$this->items 		= $this->get('Items');
		$this->pagination  	= $this->get('pagination');
		$this->total 		= $this->get('total');
		$this->action		=
$this->escape(JRoute::_(JUri::getInstance(),false));
		$this->date_format	=
RSMembershipHelper::getConfig('date_format');
		$this->transactions = $this->get('transactions');
		$this->limitstart	= $app->input->get('limitstart', 0,
'int');
		
		if (empty($this->items) && empty($this->transactions)) {
			$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_NO_MEMBERSHIPS_BOUGHT'),
'notice');
		}

		$Itemid = $app->input->get('Itemid',0, 'int');
		if ($Itemid > 0)
			$this->Itemid  	= '&Itemid='.$Itemid;
		else
			$this->Itemid	= '';

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'])
            && $active->query['view'] ==
'mymemberships')
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }

		// Description
		if ($this->params->get('menu-meta_description'))
			$this->document->setDescription($this->params->get('menu-meta_description'));
		// Keywords
		if ($this->params->get('menu-meta_keywords'))
			$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
		// Robots
		if ($this->params->get('robots'))
			$this->document->setMetadata('robots',
$this->params->get('robots'));

		parent::display();
	}
}views/mytransactions/index.html000064400000000054151166265720012766
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mytransactions/metadata.xml000064400000000354151166265720013276
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <view title="COM_RSMEMBERSHIP_MY_TRANSACTIONS">
        <message>
            <![CDATA[COM_RSMEMBERSHIP_MY_TRANSACTIONS_MENU_DESC]]>
        </message>
    </view>
</metadata>views/mytransactions/tmpl/default.php000064400000016542151166265720014113
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2020 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_mytransactions" class="item-page">
    <?php if ($this->params->get('show_page_heading',
1)) { ?>
        <div class="page-header">
            <h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
        </div>
    <?php } ?>

    <form action="<?php echo $this->action; ?>"
method="post" name="adminForm"
id="rsm_mymemberships_form">
        <?php if ( !empty($this->items) ) {
            $colspan = 6;
            ?>
            <div class="table-responsive
rsmemgrid-table-responsive">
            <table class="rsmembershiptable <?php echo
$this->escape($this->params->get('pageclass_sfx'));
?> table table-stripped table-hover rsmemgrid-table
rsmemgrid-table-stripped rsmemgrid-table-hover
rsmemgrid-table-sm">
                <?php if
($this->params->get('show_headings', 1)) { ?>
                    <tr>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="right" width="5%"><?php echo
JText::_('#'); ?></th>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION'); ?></th>
                        <?php if
($this->params->get('show_details', 1)) { ?>
                            <th class="sectiontableheader<?php
echo $this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_DETAILS'); ?></th>
                        <?php $colspan++; } ?>
                        <?php if
($this->params->get('show_invoice', 1)) { ?>
                            <th class="sectiontableheader<?php
echo $this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_INVOICE'); ?></th>
                        <?php $colspan++; } ?>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_DATE');
?></th>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_PRICE');
?></th>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo
JText::_('COM_RSMEMBERSHIP_GATEWAY'); ?></th>
                        <th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JText::_('COM_RSMEMBERSHIP_STATUS');
?></th>
                    </tr>
                <?php } ?>

                <?php $k = 1; ?>
                <?php $i = 0; ?>
                <?php foreach ($this->items as $item) {
                    $css_status = ( $item->status ==
'completed' ? 'success' : ( $item->status ==
'pending' ? 'warning' : 'error' ) );
                    ?>
                    <tr class="rsmesectiontableentry<?php echo
$k . $this->escape($this->params->get('pageclass_sfx'));
?> <?php echo $css_status;?>" >
                        <td align="right"><?php echo
$this->pagination->getRowOffset($i); ?></td>
                        <td><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION_'.strtoupper($item->type));
?></td>
                        <?php if
($this->params->get('show_details', 1)) { ?>
                        <td>
                            <?php
                            $params =
RSMembershipHelper::parseParams($item->params);
                            switch ($item->type)
                            {
                                case 'new':
                                    if
(!empty($params['membership_id']))
                                        echo
isset($this->cache->memberships[$params['membership_id']])
? $this->cache->memberships[$params['membership_id']] :
JText::_('COM_RSMEMBERSHIP_COULD_NOT_FIND_MEMBERSHIP');
                                    if
(!empty($params['extras']))
                                        foreach
($params['extras'] as $extra)
                                            if (!empty($extra))
                                                echo '<br />-
'.$this->cache->extra_values[$extra];
                                    break;

                                case 'upgrade':
                                    if
(!empty($params['from_id']) &&
!empty($params['to_id']))
                                        echo
$this->cache->memberships[$params['from_id']].'
-&gt;
'.$this->cache->memberships[$params['to_id']];
                                    break;

                                case 'addextra':
                                    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>
                        <?php } ?>
                        <?php if
($this->params->get('show_invoice', 1)) { ?>
                        <td>
                            <?php if ($item->status ==
'completed' && $item->membership_data &&
$item->membership_data->use_membership_invoice) { ?>
                                <a class="rsm_pdf"
href="<?php echo
JRoute::_("index.php?option=com_rsmembership&task=mytransaction.outputinvoice&id=$item->id");
?>"></a>
                            <?php } ?>
                        </td>
                        <?php } ?>
                        <td><?php echo
RSMembershipHelper::showDate($item->date); ?></td>
                        <td><?php echo
RSMembershipHelper::getPriceFormat($item->price); ?></td>
                        <td><?php echo $item->gateway;
?></td>
                        <td><?php echo
JText::_('COM_RSMEMBERSHIP_TRANSACTION_STATUS_'.strtoupper($item->status));
?></td>
                    </tr>
                    <?php $k = $k == 1 ? 2 : 1; ?>
                    <?php $i++; ?>
                <?php } ?>

                <?php if
($this->params->get('show_pagination', 1) &&
$this->pagination->get('pages.total') > 1) { ?>
                    <tr>
                        <td align="center"
colspan="<?php echo $colspan; ?>" class="center
pagination sectiontablefooter<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>">
                            <?php echo
$this->pagination->getPagesLinks(); ?>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="<?php echo $colspan;
?>" align="right"><?php echo
$this->pagination->getPagesCounter(); ?></td>
                    </tr>
                <?php } ?>
            </table>
            </div>
            <input type="hidden" name="limitstart"
value="<?php echo $this->limitstart; ?>" />

        <?php } ?>
    </form>
</div>views/mytransactions/tmpl/default.xml000064400000003346151166265720014122
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout
title="COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_TRANSACTIONS_LAYOUT">
        <message>
           
<![CDATA[COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_TRANSACTIONS_LAYOUT]]>
        </message>
    </layout>
    <config>
        <fields name="params">
            <fieldset name="basic">
                <field name="show_headings"
type="radio" class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_HEADINGS"
description="COM_RSMEMBERSHIP_SHOW_HEADINGS_DESC">
                    <option
value="1">COM_RSMEMBERSHIP_SHOW</option>
                    <option
value="0">COM_RSMEMBERSHIP_HIDE</option>
                </field>
                <field name="show_pagination"
type="radio" class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
                    <option
value="1">COM_RSMEMBERSHIP_SHOW</option>
                    <option
value="0">COM_RSMEMBERSHIP_HIDE</option>
                </field>
				<field name="show_invoice" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_INVOICE"
description="COM_RSMEMBERSHIP_SHOW_INVOICE_DESC">
                    <option
value="1">COM_RSMEMBERSHIP_SHOW</option>
                    <option
value="0">COM_RSMEMBERSHIP_HIDE</option>
                </field>
                <field name="show_details"
type="radio" class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_DETAILS"
description="COM_RSMEMBERSHIP_SHOW_DETAILS_DESC">
                    <option
value="1">COM_RSMEMBERSHIP_SHOW</option>
                    <option
value="0">COM_RSMEMBERSHIP_HIDE</option>
                </field>
            </fieldset>
        </fields>
    </config>
</metadata>views/mytransactions/tmpl/index.html000064400000000054151166265720013742
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/mytransactions/view.html.php000064400000004563151166265720013430
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2020 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewMytransactions extends JViewLegacy
{
    public function display($tpl = null)
    {
        $app                = JFactory::getApplication();
        $this->params 		=
clone($app->getParams('com_rsmembership'));
        $this->items 		= $this->get('Items');
        $this->pagination  	= $this->get('pagination');
        $this->total 		= $this->get('total');
        $this->action		=
$this->escape(JRoute::_(JUri::getInstance(),false));
        $this->date_format	=
RSMembershipHelper::getConfig('date_format');
        $this->limitstart	=
$app->input->get('limitstart', 0, 'int');

        if ($this->params->get('show_details', 1)) {
            $this->cache = RSMembershipHelper::getCache();
        }

        if (empty($this->items) &&
empty($this->transactions)) {
           
$app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_NO_TRANSACTIONS_INITIATED'),
'notice');
        }

        $Itemid = $app->input->get('Itemid',0,
'int');
        if ($Itemid > 0)
            $this->Itemid  	= '&Itemid='.$Itemid;
        else
            $this->Itemid	= '';

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'])
            && $active->query['view'] ==
'mytransactions')
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }

        // Description
        if ($this->params->get('menu-meta_description'))
           
$this->document->setDescription($this->params->get('menu-meta_description'));
        // Keywords
        if ($this->params->get('menu-meta_keywords'))
            $this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
        // Robots
        if ($this->params->get('robots'))
            $this->document->setMetadata('robots',
$this->params->get('robots'));

        parent::display();
    }
}views/removedata/index.html000064400000000054151166265720012037
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/removedata/tmpl/default.php000064400000000523151166265720013154
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

$this->app->enqueueMessage(JText::_('COM_RSMEMBERSHIP_DATA_HAS_BEEN_ANONYMISED'));views/removedata/tmpl/index.html000064400000000054151166265720013013
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/removedata/view.html.php000064400000000705151166265720012473
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipViewRemovedata extends JViewLegacy
{
	protected $app;
	
	public function display($tpl = null)
	{
		$this->app = JFactory::getApplication();
		parent::display($tpl);
	}
}views/rsmembership/index.html000064400000000054151166265720012410
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/rsmembership/metadata.xml000064400000000311151166265720012711
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_MEMBERSHIPS">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_MEMBERSHIPS_MENU_DESC]]>
		</message>
	</view>
</metadata>views/rsmembership/tmpl/default.php000064400000007103151166265720013526
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

$chunks = array_chunk($this->items,
$this->params->get('columns_no', 2));
?>
<div id="rsm_memberships" class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>
	<?php
	foreach ($chunks as $items)
	{
		$column_size = 12 / count($items);
		?>
		<div class="rsmemgrid-row">
		<?php
			foreach ($items as $item) 
			{
				$link  		= JRoute::_( RSMembershipRoute::Membership($item->id,
$this->Itemid) );
				$apply_link = JRoute::_( RSMembershipRoute::Subscribe(
$item->category_id, $item->category_name, $item->id,
$item->name, $this->Itemid ) );

				$price 		= RSMembershipHelper::getPriceFormat($item->price);
				$image 		= !empty($item->thumb) ?
JHtml::image('components/com_rsmembership/assets/thumbs/'.$item->thumb,
$item->name, 'class="rsm_thumb"') : '';

				$placeholders = array(
					'{price}' 	=> $price,
					'{buy}'		=> '',
					'{extras}'  => '',
					'{stock}'	=> ($item->stock > -1 ? ( $item->stock
== 0 ? JText::_('COM_RSMEMBERSHIP_UNLIMITED') : $item->stock)
: JText::_('COM_RSMEMBERSHIP_OUT_OF_STOCK_PLACEHOLDER')) ,
					'<hr id="system-readmore" />' =>
''
				);
				
				// Trigger content plugins if enabled
				if (RSMembershipHelper::getConfig('trigger_content_plugins'))
{
					$item->description = JHtml::_('content.prepare',
$item->description);
				}
				
				$item->description = str_replace(array_keys($placeholders),
array_values($placeholders), $item->description);
				?>
					<div class="rsmemgrid-col-md-<?php echo $column_size; ?>
rsm_container<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>">
						<div class="rsmemgrid-card">
							<div class="rsm_thumbnail"><?php echo $image;
?></div>
							<div class="rsmemgrid-card-body">
								<h2 class="rsm_title rsmemgrid-card-title"><?php
if ($this->params->get('show_category', 0)) { ?><?php
echo $item->category_id ? $item->category_name :
JText::_('COM_RSMEMBERSHIP_NO_CATEGORY'); ?> - <?php }
?><a href="<?php echo $link; ?>"><?php echo
$item->name; ?></a></h2>
								<h2 class="rsm_title"><small><?php echo
$price; ?></small></h2>
								<?php echo $item->description; ?>
								<div class="rsmemgrid-clearfix"></div>

									<div class="btn-group rsmemgrid-btn-group">
										<?php if ($this->params->get('show_buttons',
2) == 1 || $this->params->get('show_buttons', 2) == 2) {
?>
											<a href="<?php echo $link; ?>"
class="btn rsmemgrid-btn"><?php echo
JText::_('COM_RSMEMBERSHIP_DETAILS'); ?></a>
										<?php } ?>

										<?php if (($this->params->get('show_buttons',
2) == 2 || $this->params->get('show_buttons', 2) == 3)
&& $item->stock != -1) { ?>
											<a href="<?php echo $apply_link; ?>"
class="btn btn-success rsmemgrid-btn"><?php echo
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'); ?></a>
										<?php } ?>
									</div>

								<div class="rsmemgrid-clearfix"></div>
							</div>
						</div>
					</div>
		<?php } ?>
		</div>
		<?php
	}
if ($this->params->get('show_pagination', 0) &&
$this->pagination->get('pages.total') > 1) { ?>
	<div class="pagination">
		<?php echo $this->pagination->getPagesLinks(); ?>
	</div>
	<?php echo $this->pagination->getPagesCounter(); ?>
<?php } ?>
	<div class="rsmemgrid-clearfix"></div>
</div>views/rsmembership/tmpl/default.xml000064400000005257151166265720013547
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_RSMEMBERSHIP_DEFAULT_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_DEFAULT_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="params">
			<fieldset name="basic"
addfieldpath="/administrator/components/com_rsmembership/fields">
				<field name="columns_no" type="list"
default="2"
label="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS_IN"
description="COM_RSMEMBERSHIP_SHOW_MEMBERSHIPS_IN_DESC">
					<option
value="1">COM_RSMEMBERSHIP_1_COLUMN</option>
					<option
value="2">COM_RSMEMBERSHIP_2_COLUMNS</option>
					<option
value="3">COM_RSMEMBERSHIP_3_COLUMNS</option>
				</field>
				<field name="show_buttons" type="list"
default="2" label="COM_RSMEMBERSHIP_SHOW_BUTTONS"
description="COM_RSMEMBERSHIP_SHOW_BUTTONS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_DETAILS</option>
					<option
value="2">COM_RSMEMBERSHIP_DETAILS_COM_RSMEMBERSHIP_SUBSCRIBE</option>
					<option
value="3">COM_RSMEMBERSHIP_SUBSCRIBE</option>
				</field>
				<field name="categories" type="sql"
default="" multiple="multiple"
label="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES"
description="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES_DESC" />
				
				<field name="categories" type="sql"
multiple="multiple" class="input-large"
label="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES"
description="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES_DESC" 
query="SELECT id, name FROM #__rsmembership_categories"
key_field="id" value_field="name" />
				
				<field name="show_category" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_CATEGORY"
description="COM_RSMEMBERSHIP_SHOW_CATEGORY_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_pagination" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="orderby" type="list"
default="" label="COM_RSMEMBERSHIP_ORDER"
description="COM_RSMEMBERSHIP_ORDER_DESC">
					<option
value="">COM_RSMEMBERSHIP_DEFAULT</option>
					<option
value="name">COM_RSMEMBERSHIP_TITLE</option>
					<option
value="price">COM_RSMEMBERSHIP_PRICE</option>
				</field>
				<field name="orderdir" type="radio"
class="btn-group" default="ASC"
label="COM_RSMEMBERSHIP_DIRECTION"
description="COM_RSMEMBERSHIP_DIRECTION_DESC">
					<option
value="ASC">COM_RSMEMBERSHIP_ASCENDENT</option>
					<option
value="DESC">COM_RSMEMBERSHIP_DESCENDENT</option>
				</field>
			</fieldset>
		</fields>
	</config>
</metadata>views/rsmembership/tmpl/index.html000064400000000054151166265720013364
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/rsmembership/tmpl/list.php000064400000006663151166265720013067
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

$listOrder	=
$this->escape($this->state->get('list.ordering'));
$listDirn	=
$this->escape($this->state->get('list.direction'));
?>

<script language="javascript"
type="text/javascript">
Joomla.tableOrdering = function(order, dir, task) 
{
	var form = document.adminForm;

	form.filter_order.value		= order;
	form.filter_order_Dir.value	= dir;
	form.submit(task);
}
</script>

<div id="rsm_memberships_list"
class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

	<form action="<?php echo JRoute::_('index.php');
?>" method="post" name="adminForm"
id="rsm_rsmembership_form_list">
	<div class="table-responsive rsmemgrid-table-responsive">
	<table width="99%" class="rsmemgrid-table<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?> table table-stripped table-bordered rsmemgrid-table-stripped
rsmemgrid-table-bordered rsmemgrid-table-hover">
	<?php if ($this->params->get('show_headings', 1)) {
?>
		<tr>
			<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>" align="right" width="5%"><?php echo
JText::_('#'); ?></th>
			<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JHtml::_('grid.sort', 
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP'), 'm.name',
$listDirn, $listOrder); ?></th>
			<?php if ($this->params->get('show_category', 0)) {
?>
			<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JHtml::_('grid.sort', 
JText::_('COM_RSMEMBERSHIP_CATEGORY'), 'c.name',
$listDirn, $listOrder); ?></th>
			<?php } ?>
			<th class="sectiontableheader<?php echo
$this->escape($this->params->get('pageclass_sfx'));
?>"><?php echo JHtml::_('grid.sort', 
JText::_('COM_RSMEMBERSHIP_PRICE'), 'price', $listDirn,
$listOrder); ?></th>
		</tr>
	<?php } ?>

	<?php $k = 1; ?>
	<?php $i = 0; ?>
	<?php foreach ($this->items as $item) {
		$catid = $item->category_id ?
'&catid='.$item->category_id.':'.JFilterOutput::stringURLSafe($item->category_name)
: ''; ?>
		<tr class="sectiontableentry<?php echo $k .
$this->escape($this->params->get('pageclass_sfx'));
?>" >
			<td align="right"><?php echo
$this->pagination->getRowOffset($i); ?></td>
			<td><a href="<?php echo
JRoute::_(RSMembershipRoute::Membership($item->id, $this->Itemid));
?>"><?php echo $this->escape($item->name);
?></a></td>
			<?php if ($this->params->get('show_category', 0)) {
?>
			<td><?php echo $item->category_id ? $item->category_name
: JText::_('COM_RSMEMBERSHIP_NO_CATEGORY'); ?></td>
			<?php } ?>
			<td><?php echo
RSMembershipHelper::getPriceFormat($item->price); ?></td>
		</tr>
	<?php $k = $k == 1 ? 2 : 1; ?>
	<?php $i++; ?>
	<?php } ?>
	<?php if ($this->params->get('show_pagination', 0)
&& $this->pagination->get('pages.total') > 1) {
?>
		<tr><td colspan="4" align="center"
class="center"><?php echo
$this->pagination->getListFooter(); ?></td></tr>
	<?php } ?>
	</table>
	</div>
	<input type="hidden" name="filter_order"
value="" />
	<input type="hidden" name="filter_order_Dir"
value="" />
</form>
</div>views/rsmembership/tmpl/list.xml000064400000004117151166265720013070
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_RSMEMBERSHIP_LIST_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_LIST_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="params">
			<fieldset name="basic"
addfieldpath="/administrator/components/com_rsmembership/fields">
				<field name="categories" type="sql"
multiple="multiple" class="input-large"
label="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES"
description="COM_RSMEMBERSHIP_SHOW_FROM_CATEGORIES_DESC" 
query="SELECT id, name FROM #__rsmembership_categories"
key_field="id" value_field="name" />
				<field name="show_category" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_CATEGORY"
description="COM_RSMEMBERSHIP_SHOW_CATEGORY_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_headings" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_SHOW_HEADINGS"
description="COM_RSMEMBERSHIP_SHOW_HEADINGS_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="show_pagination" type="radio"
class="btn-group" default="1"
label="COM_RSMEMBERSHIP_PAGINATION"
description="COM_RSMEMBERSHIP_PAGINATION_DESC">
					<option
value="1">COM_RSMEMBERSHIP_SHOW</option>
					<option
value="0">COM_RSMEMBERSHIP_HIDE</option>
				</field>
				<field name="orderby" type="list"
default="" label="COM_RSMEMBERSHIP_ORDER"
description="COM_RSMEMBERSHIP_ORDER_DESC">
					<option
value="ordering">COM_RSMEMBERSHIP_DEFAULT</option>
					<option
value="name">COM_RSMEMBERSHIP_TITLE</option>
					<option
value="price">COM_RSMEMBERSHIP_PRICE</option>
				</field>
				<field name="orderdir" type="radio"
class="btn-group" default="ASC"
label="COM_RSMEMBERSHIP_DIRECTION"
description="COM_RSMEMBERSHIP_DIRECTION_DESC">
					<option
value="ASC">COM_RSMEMBERSHIP_ASCENDENT</option>
					<option
value="DESC">COM_RSMEMBERSHIP_DESCENDENT</option>
				</field>
			</fieldset>
		</fields>
	</config>
</metadata>views/rsmembership/view.html.php000064400000003673151166265720013053
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewRSMembership extends JViewLegacy
{
	public function display($tpl = null) 
	{
		$app = JFactory::getApplication();

		$this->params 	=
clone($app->getParams('com_rsmembership'));
		$this->items 		= $this->get('Items');
		$this->state 		= $this->get('State');
		$this->pagination 	= $this->get('Pagination');
		$this->Itemid 		= $app->input->get('Itemid',0,
'int');
		$this->currency 	=
RSMembershipHelper::getConfig('currency');

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'])
            && $active->query['view'] ==
'rsmembership')
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }
        else
        {
            if ($category = $this->get('category'))
            {
                $this->params->set('page_heading',
$category->name);
            }
        }

		// Description
		if ($this->params->get('menu-meta_description'))
			$this->document->setDescription($this->params->get('menu-meta_description'));
		// Keywords
		if ($this->params->get('menu-meta_keywords'))
			$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
		// Robots
		if ($this->params->get('robots'))
			$this->document->setMetadata('robots',
$this->params->get('robots'));

		// load the tooltip framework
		RSMembershipHelper::loadTooltipFramework();
			
		parent::display($tpl);
	}
}views/subscribe/index.html000064400000000054151166265720011671
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/subscribe/metadata.xml000064400000000130151166265720012171
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view hidden="true" />
</metadata>views/subscribe/tmpl/default.php000064400000033120151166265720013005
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');


// Add the javascript text variables
if (!empty($this->membershipterms)) {
	JText::script('COM_RSMEMBERSHIP_PLEASE_AGREE_MEMBERSHIP');
}
if ($this->choose_username && !$this->logged) {
	JText::script('COM_RSMEMBERSHIP_PLEASE_TYPE_USERNAME');
	JText::script('COM_RSMEMBERSHIP_USERNAME_IS_OK');
	JText::script('COM_RSMEMBERSHIP_USERNAME_NOT_OK');
}
if ($this->choose_password && !$this->logged) {
	JText::script('COM_RSMEMBERSHIP_PLEASE_TYPE_PASSWORD');
	JText::script('COM_RSMEMBERSHIP_PLEASE_TYPE_PASSWORD_6');
	JText::script('COM_RSMEMBERSHIP_PLEASE_CONFIRM_PASSWORD');
}
if (!$this->logged) {
	JText::script('COM_RSMEMBERSHIP_PLEASE_TYPE_NAME');
	JText::script('COM_RSMEMBERSHIP_PLEASE_TYPE_EMAIL');
}

JText::script('COM_RSMEMBERSHIP_THERE_WAS_AN_ERROR');

?>

<div id="rsm_subscribe" class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
		<div class="page-header">
			<h1><?php echo $this->escape($this->membership->name);
?></h1>
		</div>
	<?php } ?>

<?php if (!$this->logged && $this->show_login) { ?>
	<div class="rsm_form_container">
		<?php echo $this->loadTemplate('login'); ?>
	</div>
<?php } ?>
	<div class="rsm_form_container">
	<?php if (!$this->logged) { ?>
		<h1><?php echo
JText::_('COM_RSMEMBERSHIP_NEW_CUSTOMER'); ?></h1>
	<?php } ?>
	<?php if (!$this->logged && $this->show_login) { ?>
		<p><?php echo
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE_PLEASE_ELSE');
?></p>
	<?php } ?>
		<form method="post" class="rsmembership_form"
action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=validatesubscribe');
?>" name="membershipForm" onsubmit="return
RSMembership.subscribe.validate_subscribe(this);"
id="rsm_subscribe_default_form">
			<div class="item-page">
				<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION');
?></h3>
				<?php if ($this->choose_username) { ?>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="rsm_username"><?php echo
JText::_('COM_RSMEMBERSHIP_USERNAME'); ?><?php echo
(!$this->logged ? '
'.JText::_('COM_RSMEMBERSHIP_REQUIRED') :
'');?>:</label></div>
					<?php if (!$this->logged) { ?>
					<div class="rsmemgrid-col-sm-8">
						<input type="text" name="username"
id="rsm_username" size="40" value="<?php echo
!empty($this->data->username) ?
$this->escape($this->data->username) : ''; ?>"
onkeyup="return RSMembership.subscribe.check_username(this)"
onkeydown="RSMembership.subscribe.ajax_flag()"
autocomplete="off" class="rsmemgrid-form-control
rsmemgrid-form-control-sm" maxlength="50" /><?php echo
JHtml::image('com_rsmembership/load.gif', 'Loading',
'id="rsm_loading" style="display: none;"',
true); ?>
						<div class="clearfix"></div>
						<div id="rsm_username_message" style="display:
none"></div>
						<div class="clearfix"></div>
						<div id="rsm_suggestions" style="display:
none">
							<p><strong><?php echo
JText::_('COM_RSMEMBERSHIP_HERE_ARE_SOME_USERNAME_SUGGESTIONS');
?></strong><br /><a href="javascript: void(0);"
onclick="rsm_check_username(document.getElementById('rsm_username'))"><strong><?php
echo JText::_('COM_RSMEMBERSHIP_CHECK_OTHER_SUGGESTIONS');
?></strong></a></p>
							<ol id="rsm_suggestions_ol"></ol>
						</div>
					</div>
					<?php } else { ?>
					<div class="rsmemgrid-col-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('username'));
?></div></div>
					<?php } ?>
				</div>
				<?php } ?>
				<?php if ($this->choose_password) { ?>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="rsm_password"><?php echo
JText::_('COM_RSMEMBERSHIP_PASSWORD'); ?><?php echo
(!$this->logged ? '
'.JText::_('COM_RSMEMBERSHIP_REQUIRED') :
'');?>:</label></div>
					<?php if (!$this->logged) { ?>
					<div class="rsmemgrid-col-sm-8"><input
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
type="password" name="password"
id="rsm_password" size="40" value=""
autocomplete="off" /></div>
					<?php } else { ?>
					<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext">**********</div></div>
					<?php } ?>
				</div>
				<?php if (!$this->logged) { ?>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="rsm_password2"><?php echo
JText::_('COM_RSMEMBERSHIP_CONFIRM_PASSWORD'); ?> <?php
echo JText::_('COM_RSMEMBERSHIP_REQUIRED');
?>:</label></div>
					<div class="rsmemgrid-col-sm-8"><input
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
type="password" name="password2"
id="rsm_password2" size="40" value=""
autocomplete="off" /></div>
				</div>
				<?php } ?>
				<?php } ?>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="name"><?php echo
JText::_('COM_RSMEMBERSHIP_NAME'); ?><?php echo
(!$this->logged ? '
'.JText::_('COM_RSMEMBERSHIP_REQUIRED') :
'');?>:</label></div>
					<?php if (!$this->logged) { ?>
					<div class="rsmemgrid-col-sm-8"><input
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
type="text" name="name" id="name"
size="40" value="<?php echo
!empty($this->data->name) ? $this->escape($this->data->name)
: ''; ?>" maxlength="50"
autocomplete="off" /></div>
					<?php } else { ?>
					<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('name'));
?></div></div>
					<?php } ?>
				</div>
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="email"><?php echo JText::_(
'COM_RSMEMBERSHIP_EMAIL' ); ?><?php echo (!$this->logged
? ' '.JText::_('COM_RSMEMBERSHIP_REQUIRED') :
'');?>:</label></div>
					<?php if (!$this->logged) { ?>
					<div class="rsmemgrid-col-sm-8"><input
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
type="text" id="email" name="email"
size="40" value="<?php echo
!empty($this->data->email) ?
$this->escape($this->data->email) : ''; ?>"
maxlength="100" autocomplete="off" /></div>
					<?php } else { ?>
					<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('email'));
?></div></div>
					<?php } ?>
				</div>
			</div>
			
		<?php if (count($this->fields)) { ?>
			<div class="item-page">
				<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_OTHER_INFORMATION'); ?></h3>
				<?php foreach ($this->fields as $field) {
				$hidden = (isset($field[2]) && $field[2] == 'hidden')
? true : false;
				?>
				<div class="rsmemgrid-form-group rsmemgrid-row"<?php
echo ($hidden ? '
style="display:none"':'')?>>
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
					<div class="rsmemgrid-col-sm-8"><?php echo
$field[1]; ?></div>
				</div>
				<?php } ?>
			</div>
		<?php } ?>
		
		<?php if (count($this->membership_fields)) { ?>
			<div class="item-page">
				<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>
				<?php foreach ($this->membership_fields as $field) {
				$hidden = (isset($field[2]) && $field[2] == 'hidden')
? true : false;
				?>
				<div class="rsmemgrid-form-group rsmemgrid-row"<?php
echo ($hidden ? '
style="display:none"':'')?>>
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
					<div class="rsmemgrid-col-sm-8"><?php echo
$field[1]; ?></div>
				</div>
				<?php } ?>
			</div>
		<?php } ?>

		<?php if ($this->use_captcha) { ?>
		<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_SECURITY'); ?></h3>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<?php if ($this->use_recaptcha_new) { ?>
					<div class="rsmemgrid-col-12">
						<div class="g-recaptcha"
							data-sitekey="<?php echo
$this->escape($this->config->recaptcha_new_site_key); ?>"
							data-theme="<?php echo
$this->escape($this->config->recaptcha_new_theme); ?>"
							data-type="<?php echo
$this->escape($this->config->recaptcha_new_type); ?>"
						></div>
					</div>
				<?php } else { ?>
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label">
					<label for="submit_captcha"><span
class="hasRsmemTooltip"
data-tooltipster='{"side":"left"}'
title="<?php echo
JText::_('COM_RSMEMBERSHIP_CAPTCHA_DESC');
?>"><?php echo JText::_($this->captcha_case_sensitive ?
'COM_RSMEMBERSHIP_CAPTCHA_CASE_SENSITIVE' :
'COM_RSMEMBERSHIP_CAPTCHA'); ?></span></label>
				</div>
				<div class="rsmemgrid-col-sm-8">
					<?php if ($this->use_builtin) { ?>
					<img src="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=captcha&sid='.uniqid('captcha'));
?>" id="submit_captcha_image" alt="Antispam"
/>
					<span class="hasRsmemTooltip"
data-tooltipster='{"side":"left"}'
title="<?php echo
JText::_('COM_RSMEMBERSHIP_REFRESH_CAPTCHA_DESC');
?>"><a style="border-style: none"
href="javascript: void(0)" onclick="return
RSMembership.subscribe.refresh_captcha();"><?php echo
JHtml::image('com_rsmembership/refresh.gif',
JText::_('COM_RSMEMBERSHIP_REFRESH_CAPTCHA'),
'border="0" onclick="this.blur()"
align="top"', true); ?></a></span><br
/>
					<input type="text" name="captcha"
id="submit_captcha" size="40" value=""
class="rsmemgrid-form-control rsmemgrid-form-control-sm" />
					<?php } elseif ($this->use_recaptcha) { ?>
						<?php echo $this->show_recaptcha; ?>
					<?php } ?>
				</div>
				<?php } ?>
			</div>
		</div>
		<?php } ?>

		<?php echo $this->extrasview; ?>
		
		<?php if ($this->has_coupons) { ?>
		<div class="item-page">
			<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_DISCOUNTS'); ?></h3>
			<p><?php echo
JText::_('COM_RSMEMBERSHIP_COUPON_DESC'); ?></p>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="coupon"><?php echo
JText::_('COM_RSMEMBERSHIP_COUPON');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8">
					<?php if ($this->one_page_checkout) { ?>
						<input type="text" name="coupon"
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
id="coupon"
oninput="RSMembership.buildTotal.set_coupon(this.value,<?php echo
$this->membership->id; ?>)" size="40"
value="" maxlength="64" />
						<?php echo JHtml::image('com_rsmembership/load.gif',
'Loading', 'id="rsm_coupon_loading"
style="display: none;"', true); ?>
						<span id="rsm-coupon-ok" ></span> <button
type="button" class="btn btn-danger btn-small rsmemgrid-btn
rsmemgrid-btn-sm" style="display:none"
id="rsm-coupon-clear"
onclick="RSMembership.buildTotal.clear_coupon(true)"><?php
echo JText::_('COM_RSMEMBERSHIP_REMOVE_COUPON');
?></button>
					<?php } else { ?>
						<input type="text" name="coupon"
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
id="coupon" size="40" value=""
maxlength="64" />
					<?php } ?>
				</div>
			</div>
		</div>
		<?php } ?>

		<?php if ($this->one_page_checkout) { ?>
			<div class="item-page"
id="rsm_discount_value_container"
style="display:none">
				<div class="rsmemgrid-form-group rsmemgrid-row">
					<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_DISCOUNT_VALUE');
?></strong>:</label></div>
					<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_discount_value"
></span></div></div>
				</div>
			</div>
		<?php } ?>

		<?php if ($this->one_page_checkout &&
($this->showPayments || $this->membership->extras)) { ?>
			<?php echo $this->loadTemplate('payment'); ?>
		<?php } ?>

		<?php if (!empty($this->membershipterms)) { ?>
		<div class="item-page">
			<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_TERM'); ?></h3>
			<div id="rsm_terms_frame">
				<div class="item-page">
					<div id="rsm_terms_container">
						<h1><?php echo
$this->escape($this->membershipterms->name); ?></h1>
						<?php
						if
(RSMembershipHelper::getConfig('trigger_content_plugins')) {
							$this->membershipterms->description =
JHtml::_('content.prepare',
$this->membershipterms->description);
						}
						echo $this->membershipterms->description;
						?>
					</div> <!-- rsm_terms_container -->
				</div>
			</div>
			<div class="rsmemgrid-form-group rsmemgrid-form-check
rsmemgrid-mt-2">
				<input type="checkbox" id="rsm_checkbox_agree"
class="rsmemgrid-form-check-input"
name="i_agree_to_terms" value="1" />
				<label for="rsm_checkbox_agree"
class="rsmemgrid-form-check-label"><?php echo
JText::_('COM_RSMEMBERSHIP_I_AGREE'); ?> (<?php echo
$this->escape($this->membershipterms->name); ?>)</label>
			</div>
		</div>
		<?php } ?>

		<div class="form-actions">
			<button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
$this->one_page_checkout ?
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE') :
JText::_('COM_RSMEMBERSHIP_NEXT'); ?></button>
		</div>
		<?php echo JHtml::_('form.token');?>
		<input type="hidden" name="option"
value="com_rsmembership" />
		<input type="hidden" name="view"
value="subscribe" />
		<input type="hidden" name="task"
value="validatesubscribe" />
		<input type="hidden" name="cid"
value="<?php echo $this->membership->id; ?>" />
		</form>
	</div>
</div>

<?php
	echo
RSMembershipHelper::renderMagnificPopup('rsmembershipModal',
array(
		'url' 	   => false,
		'height'   => 400
	));
?>views/subscribe/tmpl/default_login.php000064400000004676151166265720014213
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_subscribe_login">
	<h1><?php echo
JText::_('COM_RSMEMBERSHIP_RETURNING_CUSTOMER');
?></h1>
	<p><?php echo
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE_PLEASE_LOGIN');
?></p>
	<form class="rsmembership_form form-horizontal"
method="post" action="<?php echo
JRoute::_('index.php'); ?>"
id="rsm_subscribe_login_form">
	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_LOGIN_INFORMATION'); ?></h3>


		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="username"><?php echo
JText::_('COM_RSMEMBERSHIP_USERNAME')
?></label></div>
			<div class="rsmemgrid-col-sm-8"><input
name="username" id="username" type="text"
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
alt="username" size="18" /></div>
		</div>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label
for="passwd"><?php echo
JText::_('COM_RSMEMBERSHIP_PASSWORD')
?></label></div>
			<div class="rsmemgrid-col-sm-8"><input
type="password" id="passwd" name="password"
class="rsmemgrid-form-control rsmemgrid-form-control-sm"
size="18" alt="password" /></div>
		</div>
		<?php if(JPluginHelper::isEnabled('system',
'remember')) { ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-8 rsmemgrid-offset-md-4">
				<div class="rsmemgrid-form-group
rsmemgrid-form-check">
					<input type="checkbox" id="remember"
name="remember" class="inputbox
rsmemgrid-form-check-input" value="yes" title="<?php
echo JText::_('COM_RSMEMBERSHIP_REMEMBER_ME'); ?>" />
					<label for="remember"
class="rsmemgrid-form-check-label"><?php echo
JText::_('COM_RSMEMBERSHIP_REMEMBER_ME') ?></label>
				</div>
			</div>
		</div>
		<?php } ?>

		<div class="form-actions">
			<button type="submit" class="btn btn-info
rsmemgrid-btn"><?php echo
JText::_('COM_RSMEMBERSHIP_LOGIN') ?></button>
		</div>
		<?php echo JHtml::_('form.token');?>
		<input type="hidden" name="option"
value="com_users" />
		<input type="hidden" name="task"
value="user.login" />
		<input type="hidden" name="return"
value="<?php echo $this->return; ?>" />
	</div>
	</form>
</div>views/subscribe/tmpl/default_payment.php000064400000005177151166265720014555
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2020 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_subscribe_payment">
	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_PAYMENT_INFORMATION');
?></h3>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4 rsmemgrid-d-flex
rsmemgrid-align-items-center
rsmemgrid-col-form-label"><label><?php echo 
JText::_('COM_RSMEMBERSHIP_PAY_WITH');
?>:</label></div>
			<div class="rsmemgrid-col-sm-8">
			<?php
			$i = 0;
			if ( !empty($this->payments) )
			{
				foreach ($this->payments as $plugin => $paymentdetails) {
					$i++;
					$tax_value = '';
					$paymentname = '';
					if (is_array($paymentdetails))
					{
						if ($paymentdetails['tax_details'])
						{
							if ($paymentdetails['tax_details']['tax_type']
== 0)
							{
								$tax_value = $this->total *
($paymentdetails['tax_details']['tax_value'] / 100);
								$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_PERCENT',
$tax_value,RSMembershipHelper::getPriceFormat($tax_value),
$paymentdetails['tax_details']['tax_value']);
							}
							else
							{
								$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_FIXED',
$paymentdetails['tax_details']['tax_value'],
RSMembershipHelper::getPriceFormat($paymentdetails['tax_details']['tax_value']));
							}
						}
						$paymentname = $paymentdetails['name'];
					}
					else
					{
						$paymentname = $paymentdetails;
					}
					?>
					<div class="rsmemgrid-form-group
rsmemgrid-form-check">
						<input <?php echo $i == 1 ?
'checked="checked"' : ''; ?>
type="radio" name="payment" value="<?php echo
$this->escape($plugin); ?>" id="payment<?php echo $i;
?>" class="rsmemgrid-form-check-input" />
						<label for="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-label"><?php echo
$this->escape($paymentname).$tax_value; ?></label>
					</div>
				<?php } ?>
			<?php } ?>
			</div>
		</div>
	</div>
	<div class="item-page">
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_GRAND_TOTAL');
?></strong>:</label></div>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_grand_total" data-fixedvalue="<?php echo
$this->grand_total;?>"><?php echo
RSMembershipHelper::getPriceFormat($this->total);
?></span></div></div>
		</div>
	</div>
</div>views/subscribe/tmpl/index.html000064400000000054151166265720012645
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/subscribe/tmpl/payment.php000064400000001152151166265720013036
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>

<div class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
		<div class="page-header">
			<h1><?php echo
$this->escape($this->params->get('page_heading',
$this->membership->name)); ?></h1>
		</div>
	<?php } ?>

	<div id="rsm_subscribe_container">
		<?php echo $this->html; ?>
	</div><!-- rsm_subscribe_container -->
</div>views/subscribe/tmpl/preview.php000064400000022531151166265720013046
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>
<div id="rsm_subscribe_preview"
class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
		<div class="page-header">
			<h1><?php echo
$this->escape($this->params->get('page_heading',
$this->membership->name)); ?></h1>
		</div>
	<?php } ?>

	<form method="post" class="rsmembership_form"
action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=paymentredirect');
?>" name="membershipForm"
id="rsm_subscribe_preview_form">
	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_PURCHASE_INFORMATION');
?></h3>

			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->membership->name); ?> - <?php echo
RSMembershipHelper::getPriceFormat($this->membership->price);
?></div></div>
			</div>
			<?php if (isset($this->data->coupon) &&
strlen($this->data->coupon)) { ?>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_COUPON');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->data->coupon); ?></div></div>
			</div>
			<?php } ?>
			<?php if ($this->extras) { ?>
				<?php foreach ($this->extras as $extra) { ?>
					<div class="rsmemgrid-form-group rsmemgrid-row">
						<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
$this->escape($extra->getParentName());
?>:</label></div>
						<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($extra->name); ?> - <?php echo
RSMembershipHelper::getPriceFormat($extra->price);
?></div></div>
					</div>
				<?php } ?>
			<?php } ?>
			<?php if ($this->membership->use_renewal_price) { ?>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_RENEWAL_PRICE');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
RSMembershipHelper::getPriceFormat($this->total -
$this->membership->price + $this->membership->renewal_price);
?></div></div>
			</div>
			<?php } ?>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-12"><hr /></div>
			</div>
			<div class="rsmemgrid-form-group rsmemgrid-row">
				<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_TOTAL_COST');
?>:</label></div>
				<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
RSMembershipHelper::getPriceFormat($this->total);
?></div></div>
			</div>

	</div>

	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_ACCOUNT_INFORMATION');
?></h3>
		<?php if ($this->choose_username) { ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_USERNAME');
?>:</label></div>
			<?php if (!$this->logged) { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->data->username);
?></div></div>
			<?php } else { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('username'));
?></div></div>
			<?php } ?>
		</div>
		<?php } ?>
		<?php if ($this->choose_password) { ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_PASSWORD');
?>:</label></div>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext">**********</div></div>
		</div>
		<?php } ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo
JText::_('COM_RSMEMBERSHIP_NAME');
?>:</label></div>
			<?php if (!$this->logged) { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->data->name); ?></div></div>
			<?php } else { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('name'));
?></div></div>
			<?php } ?>
		</div>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><?php echo JText::_(
'COM_RSMEMBERSHIP_EMAIL' ); ?>:</label></div>
			<?php if (!$this->logged) { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->data->email); ?></div></div>
			<?php } else { ?>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><?php echo
$this->escape($this->user->get('email'));
?></div></div>
			<?php } ?>
		</div>
		<?php foreach ($this->fields as $field) { ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
			<div class="rsmemgrid-col-sm-8"><?php echo $field[1];
?></div>
		</div>
		<?php } ?>
	</div>

	<?php if (count($this->membership_fields)>0) {?>
	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_INFORMATION');
?></h3>
		<?php foreach ($this->membership_fields as $field) { ?>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><?php echo $field[0];
?></div>
			<div class="rsmemgrid-col-sm-8"><?php echo
(trim($field[1])=='' ? '-' : $field[1]);
?></div>
		</div>
		<?php } ?>
	</div>
	<?php } ?>

	<?php if ($this->showPayments) { ?>
	<div class="item-page">
		<h3 class="page-header"><?php echo
JText::_('COM_RSMEMBERSHIP_PAYMENT_INFORMATION');
?></h3>
		<div class="rsmemgrid-form-group rsmemgrid-row">
			<div class="rsmemgrid-col-sm-4 rsmemgrid-d-flex
rsmemgrid-align-items-center
rsmemgrid-col-form-label"><label><?php echo 
JText::_('COM_RSMEMBERSHIP_PAY_WITH');
?>:</label></div>
			<div class="rsmemgrid-col-sm-8">
				<?php
					$i = 0;
					if ( !empty($this->payments) )
					{
						foreach ($this->payments as $plugin => $paymentdetails) {
							$i++;
							$tax_value = '';
							$paymentname = '';
							if (is_array($paymentdetails))
							{
								if ($paymentdetails['tax_details'])
								{
									if ($paymentdetails['tax_details']['tax_type']
== 0)
									{
										$tax_value = $this->total *
($paymentdetails['tax_details']['tax_value'] / 100);
										$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_PERCENT',
$tax_value, RSMembershipHelper::getPriceFormat($tax_value),
$paymentdetails['tax_details']['tax_value']);
									}
									else
									{
										$tax_value =
JText::sprintf('COM_RSMEMBERSHIP_PAY_TAX_VALUE_FIXED',
$paymentdetails['tax_details']['tax_value'],
RSMembershipHelper::getPriceFormat($paymentdetails['tax_details']['tax_value']));
									}
								}
								$paymentname = $paymentdetails['name'];
							}
							else
							{
								$paymentname = $paymentdetails;
							}
						?>
						<div class="rsmemgrid-form-group
rsmemgrid-form-check">
							<input <?php echo $i == 1 ?
'checked="checked"' : ''; ?>
type="radio" name="payment" value="<?php echo
$this->escape($plugin); ?>" id="payment<?php echo $i;
?>" class="rsmemgrid-form-check-input" />
							<label for="payment<?php echo $i; ?>"
class="rsmemgrid-form-check-label"><?php echo
$this->escape($paymentname).$tax_value; ?></label>
						</div>
					<?php } ?>
				<?php } ?>
			</div>
		</div>
	</div>
	<?php } ?>
	<div class="item-page">
		<div class="rsmemgrid-form-group rsmemgrid-row
rsmemgrid-mb-3">
			<div class="rsmemgrid-col-sm-4
rsmemgrid-col-form-label"><label><strong><?php echo
JText::_('COM_RSMEMBERSHIP_GRAND_TOTAL');
?></strong>:</label></div>
			<div class="rsmemgrid-col-sm-8"><div
class="rsmemgrid-form-control-plaintext"><span
id="rsm_grand_total" data-fixedvalue="<?php echo
$this->total;?>"><?php echo
RSMembershipHelper::getPriceFormat($this->total);
?></span></div></div>
		</div>
	</div>
	<div class="form-actions">
		<button type="button" class="btn rsmemgrid-btn"
onclick="document.location='<?php echo
JRoute::_('index.php?option=com_rsmembership&view=subscribe&cid='.$this->membership->id.'&task=back');
?>'" name="Cancel"><?php echo
JText::_('COM_RSMEMBERSHIP_BACK'); ?></button>
		<button type="submit" class="btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'); ?></button>
	</div>
	<?php echo JHtml::_('form.token');?>
	<input type="hidden" name="option"
value="com_rsmembership" />
	<input type="hidden" name="view"
value="subscribe" />
	<input type="hidden" name="task"
value="paymentredirect" />
	<input type="hidden" name="cid"
value="<?php echo $this->membership->id; ?>" />
</form>
</div>views/subscribe/view.html.php000064400000013533151166265720012330
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

class RSMembershipViewSubscribe extends JViewLegacy
{
	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(false);
		
		// Set pathway
		$pathway->addItem($this->membership->name,
JRoute::_(RSMembershipRoute::Membership($this->membership->id,
$app->input->getInt('Itemid'))));
		$pathway->addItem(JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'),
'');

		$model = $this->getModel();
		
		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 			 	= RSMembershipHelper::getFields();
				$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');

				// Start the init object
				$init = new stdClass();

				$doc = JFactory::getDocument();
				if ($this->use_builtin) {
					if ($doc->getType() == 'html') {
						$init->captcha_url =
JRoute::_('index.php?option=com_rsmembership&task=captcha&sid=#SID#',
false);
					}
				}

				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) {
					if ($doc->getType() == 'html') {
						$doc->addScript('https://www.google.com/recaptcha/api.js?hl='.JFactory::getLanguage()->getTag());
					}
				}

				// Build the mandatory validate checks array
				$validate_checks = array();
				if (!empty($this->membershipterms)) {
					$validate_checks[] = 'membershipterms';
				}

				if ($this->choose_username && !$this->logged) {
					$validate_checks[] = 'username';
				}

				if ($this->choose_password && !$this->logged) {
					$validate_checks[] = 'password';
				}

				if (!$this->logged) {
					$validate_checks[] = 'name';
				}

				if (!empty($validate_checks)) {
					$init->validations = $validate_checks;
					if (in_array('username', $validate_checks)) {
						$init->check_user_url =
JUri::root(true).'/index.php?option=com_rsmembership&task=checkusername';
					}
				}

				// Check for field validations
				$fields_validation 	=
RSMembershipHelper::getFieldsValidation($this->membership->id);
				if (!empty($fields_validation)) {
					$init->field_validations = $fields_validation;
				}

				if (isset($init->validations) || isset($init->field_validations)
|| isset($init->captcha_url)) {
					// In case the scripts aren't loaded in the <head> area
					$inline_js = 'jQuery(function()
{'."\n\t".'RSMembership.subscribe.init = jQuery.extend(
{}, RSMembership.subscribe.init, '.json_encode($init).'
);'."\n".'});'."\n";
					$doc->addScriptDeclaration($inline_js);
				}

				if ($this->one_page_checkout) {
					// display the grand total after payment selection
					RSMembershipHelper::buildGrandTotal();

					// keep only the membership cost
					$this->grand_total = $this->membership->price;
				}

				$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');

				// display the grand total after payment selection
				RSMembershipHelper::buildGrandTotal();

			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?
		$this->showPayments = $model->showPaymentOptions();

		// load the tooltip framework
		RSMembershipHelper::loadTooltipFramework();

		parent::display();
	}
	
	protected function assignExtrasView() {
		// Create the View
		$view = new JViewLegacy(array(
			'name' 		=> 'extras',
			'base_path' =>
JPATH_SITE.'/components/com_rsmembership'
		));

		// Create the Model
		$model = JModelLegacy::getInstance('Extras',
'RSMembershipModel');
		
		// Assign the Model to the View and set it as default.
		$view->setModel($model, true);
		
		$view->model				= &$model;
		$view->item   				= $this->membership;
		$view->extras 				= $model->getItems();
		$view->show_subscribe_btn	= false;
		
		$this->extrasview = $view->loadTemplate();
	}
}views/terms/index.html000064400000000054151166265720011042
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/terms/metadata.xml000064400000000274151166265730011354
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_TERM">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_TERMS_MENU_DESC]]>
		</message>
	</view>
</metadata>views/terms/tmpl/default.php000064400000001422151166265730012157
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>

<div id="rsm_terms_detail" class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

	<div id="rsm_terms_container">	
		<?php
		if (RSMembershipHelper::getConfig('trigger_content_plugins'))
{
			$this->terms->description = JHtml::_('content.prepare',
$this->terms->description);
		}
		echo $this->terms->description;
		?>
	</div> <!-- rsm_terms_container -->
</div>views/terms/tmpl/default.xml000064400000001060151166265730012166
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_RSMEMBERSHIP_TERM_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_TERM_LAYOUT]]>
		</message>
	</layout>
	<config>
		<fields name="request">
			<fieldset name="request">
				<field name="cid" type="sql"
class="input-large"
label="COM_RSMEMBERSHIP_VIEW_SELECT_TERMS"
description="COM_RSMEMBERSHIP_VIEW_SELECT_TERMS_DESC" 
query="SELECT id, name FROM #__rsmembership_terms"
key_field="id" value_field="name"
required="true" />
			</fieldset>
		</fields>
	</config>
</metadata>views/terms/tmpl/index.html000064400000000054151166265730012017
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/terms/view.html.php000064400000003367151166265730011506
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewTerms extends JViewLegacy
{
	public function display($tpl = null)
	{
		$app = JFactory::getApplication();
		
		$terms 		= $this->get('terms');
		$pathway 	= $app->getPathway();
		$pathway->addItem($terms->name, '');
		
		// get parameters
		$this->params =
clone($app->getParams('com_rsmembership'));
		
		$this->terms = $terms;

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'],
$active->query['cid'])
            && $active->query['view'] ==
'terms'
            && $active->query['cid'] ==
$this->terms->id)
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }
        else
        {
            $this->params->def('page_heading',
$this->terms->name);
        }

		// Description
		if ($this->params->get('menu-meta_description'))
			$this->document->setDescription($this->params->get('menu-meta_description'));
		// Keywords
		if ($this->params->get('menu-meta_keywords'))
			$this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
		// Robots
		if ($this->params->get('robots'))
			$this->document->setMetadata('robots',
$this->params->get('robots'));

		parent::display();
	}
}views/thankyou/index.html000064400000000054151166265730011553
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/thankyou/metadata.xml000064400000000130151166265730012053
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view hidden="true" />
</metadata>views/thankyou/tmpl/default.php000064400000001403151166265740012667
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');
?>

<div id="rsm_thankyou" class="item-page">
	<?php if ($this->params->get('show_page_heading', 1)) {
?>
	<div class="page-header">
		<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
	</div>
	<?php } ?>

	<div id="rsm_thankyou_container">
		<?php
		if (RSMembershipHelper::getConfig('trigger_content_plugins'))
{
			$this->message = JHtml::_('content.prepare',
$this->message);
		}
		echo $this->message;
		?>
	</div><!-- rsm_thankyou_container -->
</div><!-- item-page
-->views/thankyou/tmpl/index.html000064400000000054151166265740012530
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/thankyou/view.html.php000064400000001114151166265740012203
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewThankYou extends JViewLegacy
{
	public function display( $tpl = null )
	{
		// get parameters
		$this->params  =
clone(JFactory::getApplication()->getParams('com_rsmembership'));
		$this->message = $this->get('message');
		
		parent::display();
	}
}views/user/index.html000064400000000054151166265740010670
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/user/metadata.xml000064400000000307151166265740011176
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<view title="COM_RSMEMBERSHIP_MY_ACCOUNT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_MY_ACCOUNT_MENU_DESC]]>
		</message>
	</view>
</metadata>views/user/tmpl/default.php000064400000004624151166265740012013
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

JText::script('COM_RSMEMBERSHIP_THERE_WAS_AN_ERROR');
?> 

<div id="rsm_user">
	<div class="item-page">
		<?php if ($this->params->get('show_page_heading', 1))
{ ?>
		<div class="page-header">
			<h1><?php echo
$this->escape($this->params->get('page_heading'));
?></h1>
		</div>
		<?php } ?>

		<form method="post" class="rsmembership_form
rsmemgrid-form" action="<?php echo
JRoute::_('index.php?option=com_rsmembership&task=validateuser');
?>" name="membershipForm" onsubmit="return
RSMembership.subscribe.validate_subscribe(this);"
id="rsm_user_form">
			<?php $this->field->startFieldset('',
'rsmembership_form_table input'); ?>
			<?php if ($this->fields) { ?>
				<?php foreach ($this->fields as $field) { ?>
					<?php echo  $this->field->showField($field[0], $field[1]);
?>
				<?php } ?>
			<div class="form-actions">
				<button type="submit" class="button btn btn-success
rsmemgrid-btn rsmemgrid-float-right"><?php echo
JText::_('COM_RSMEMBERSHIP_SAVE'); ?></button>
			</div>
			<?php } ?>
			<?php if ($this->allow_self_anonymisation) { ?>
				<button type="button" class="btn btn-danger
rsmemgrid-btn rsmemgrid-float-left"
onclick="RSMembership.removeData(this);"><?php echo
JText::_('COM_RSMEMBERSHIP_REMOVE_DATA_AND_CLOSE_ACCOUNT');
?></button>
			<?php } ?>
			<?php echo $this->field->endFieldset(); ?>
		<?php echo JHtml::_('form.token'); ?>
		<input type="hidden" name="task"
value="validateuser" />
		</form><!-- rsm_user_form -->
	</div>

	<?php if ($this->allow_self_anonymisation) { ?>
	<div id="rsmembership_remove_data_and_close_account">
		<div class="alert alert-warning">
			<p><?php echo
JText::_('COM_RSMEMBERSHIP_REMOVE_DATA_AND_CLOSE_ACCOUNT_SURE');
?></p>
			<p><strong><?php echo
JText::_('COM_RSMEMBERSHIP_REMOVE_DATA_AND_CLOSE_ACCOUNT_SURE_CONT');
?></strong></p>
			<p><button type="button"
onclick="RSMembership.requestRemoveData(this);" class="btn
btn-danger"><?php echo
JText::sprintf('COM_RSMEMBERSHIP_YES_SEND_ME_A_LINK',
$this->email); ?></button></p>
		</div>
	</div>
	<?php
	}

echo RSMembershipHelper::renderMagnificPopup('rsmembershipModal',
array(
	'url' 	   => false,
	'height'   => 400
));
?>
</div>views/user/tmpl/default.xml000064400000000351151166265740012015
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout
title="COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_ACCOUNT_LAYOUT">
		<message>
			<![CDATA[COM_RSMEMBERSHIP_SHOW_SUBSCRIBER_ACCOUNT_LAYOUT]]>
		</message>
	</layout>
</metadata>views/user/tmpl/index.html000064400000000054151166265740011644
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>views/user/view.html.php000064400000004427151166265770011334
0ustar00<?php
/**
 * @package	RSMembership!
 * @copyright	(c) 2009 - 2016 RSJoomla!
 * @link		https://www.rsjoomla.com
 * @license	GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
 */

defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view');

class RSMembershipViewUser extends JViewLegacy
{
    public function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $user = JFactory::getUser();

        // get parameters
        $this->params =
clone($app->getParams('com_rsmembership'));
        $this->fields = RSMembershipHelper::getFields();
        $this->field  = $this->get('RSFieldset');
        $this->allow_self_anonymisation =
RSMembershipHelper::getConfig('allow_self_anonymisation', 0)
&& !$user->authorise('core.admin');
        $this->email = $user->email;

        // Check for field validations
        $fields_validation 	= RSMembershipHelper::getFieldsValidation();
        if (!empty($fields_validation)) {
           
JFactory::getDocument()->addScriptDeclaration('jQuery(function()
{'."\n\t".'RSMembership.subscribe.init.field_validations
=
'.json_encode($fields_validation).';'."\n".'});'."\n");
        }

        // Because the application sets a default page title,
        // we need to get it from the menu item itself
        $active = $app->getMenu()->getActive();
        if ($active
            && $active->component ==
'com_rsmembership'
            && isset($active->query['view'])
            && $active->query['view'] ==
'user')
        {
            $this->params->def('page_heading',
$this->params->get('page_title', $active->title));
        }

        // Description
        if ($this->params->get('menu-meta_description'))
           
$this->document->setDescription($this->params->get('menu-meta_description'));
        // Keywords
        if ($this->params->get('menu-meta_keywords'))
            $this->document->setMetadata('keywords',
$this->params->get('menu-meta_keywords'));
        // Robots
        if ($this->params->get('robots'))
            $this->document->setMetadata('robots',
$this->params->get('robots'));

        // load the tooltip framework
        RSMembershipHelper::loadTooltipFramework();

        parent::display();
    }
}