コード例 #1
0
ファイル: view.raw.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $row = $this->get('extravalue');
     $this->assignRef('row', $row);
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     parent::display($tpl);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_RENEW'), '');
     // get the logged user
     $this->user = JFactory::getUser();
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->payments = RSMembership::getPlugins();
         // get the encoded return url
         $this->return = base64_encode(JURI::getInstance());
         $this->data = $this->get('data');
         // get the membership
         $this->membership = $this->get('membership');
         $this->membershipterms = $this->get('membershipterms');
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, true, $this->user->id, true, $this->membership->last_transaction_id);
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     // get the extras
     $this->extras = $this->get('extras');
     $this->cid = $this->get('cid');
     $this->config = $this->get('config');
     $this->params = $params;
     $this->token = JHTML::_('form.token');
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 function display($tpl = null)
 {
     $this->params = clone JFactory::getApplication()->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 = JFactory::getApplication()->input->get('limitstart', 0, 'int');
     $Itemid = JFactory::getApplication()->input->get('Itemid', 0, 'int');
     if ($Itemid > 0) {
         $this->Itemid = '&Itemid=' . $Itemid;
     } else {
         $this->Itemid = '';
     }
     // 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();
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $params = clone $mainframe->getParams('com_rsmembership');
     $this->assignRef('params', $params);
     $this->assignRef('memberships', $this->get('memberships'));
     $this->assignRef('pagination', $this->get('pagination'));
     $this->assignRef('total', $this->get('total'));
     $this->assignRef('action', JRequest::getURI());
     $this->assignRef('date_format', RSMembershipHelper::getConfig('date_format'));
     $this->assignRef('transactions', $this->get('transactions'));
     $this->assignRef('limitstart', JRequest::getInt('limitstart', 0));
     $Itemid = JRequest::getInt('Itemid', 0);
     if ($Itemid > 0) {
         $this->assign('Itemid', '&Itemid=' . $Itemid);
     } else {
         $this->assign('Itemid', '');
     }
     if (RSMembershipHelper::isJ16()) {
         // 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();
 }
コード例 #5
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     $pathway =& $mainframe->getPathway();
     $pathway->addItem(JText::_('RSM_RENEW'), '');
     // token
     $token = JHTML::_('form.token');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->assign('payments', RSMembership::getPlugins());
         // get the encoded return url
         $return = base64_encode(JRequest::getURI());
         $this->assignRef('return', $return);
         $data = $this->get('data');
         $this->assignRef('data', $data);
         // get the membership
         $membership = $this->get('membership');
         $this->assignRef('membership', $membership);
         $this->assignRef('fields', RSMembershipHelper::getFields(false));
     } elseif ($layout == 'payment') {
         $this->assignRef('html', $this->get('html'));
     }
     // get the extra
     $this->assignRef('extra', $this->get('extra'));
     $this->assignRef('cid', $this->get('cid'));
     $this->assignRef('config', $this->get('config'));
     $this->assignRef('params', $params);
     $this->assignRef('user', $this->get('user'));
     $this->assignRef('token', $token);
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     parent::display();
 }
コード例 #6
0
ファイル: view.raw.php プロジェクト: JozefAB/qk
 function display($tpl = null)
 {
     $this->item = $this->get('Item');
     $this->ordering = $this->get('SharedOrdering');
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display($tpl);
 }
コード例 #7
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     JToolBarHelper::title('RSMembership!', 'rsmembership');
     JSubMenuHelper::addEntry(JText::_('RSM_TRANSACTIONS'), 'index.php?option=com_rsmembership&view=transactions');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIPS'), 'index.php?option=com_rsmembership&view=memberships');
     JSubMenuHelper::addEntry(JText::_('RSM_CATEGORIES'), 'index.php?option=com_rsmembership&view=categories');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_EXTRAS'), 'index.php?option=com_rsmembership&view=extras');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_UPGRADES'), 'index.php?option=com_rsmembership&view=upgrades');
     JSubMenuHelper::addEntry(JText::_('RSM_COUPONS'), 'index.php?option=com_rsmembership&view=coupons');
     JSubMenuHelper::addEntry(JText::_('RSM_PAYMENT_INTEGRATIONS'), 'index.php?option=com_rsmembership&view=payments');
     JSubMenuHelper::addEntry(JText::_('RSM_FILES'), 'index.php?option=com_rsmembership&view=files');
     JSubMenuHelper::addEntry(JText::_('RSM_FILE_TERMS'), 'index.php?option=com_rsmembership&view=terms');
     JSubMenuHelper::addEntry(JText::_('RSM_USERS'), 'index.php?option=com_rsmembership&view=users');
     JSubMenuHelper::addEntry(JText::_('RSM_FIELDS'), 'index.php?option=com_rsmembership&view=fields');
     JSubMenuHelper::addEntry(JText::_('RSM_REPORTS'), 'index.php?option=com_rsmembership&view=reports');
     JSubMenuHelper::addEntry(JText::_('RSM_CONFIGURATION'), 'index.php?option=com_rsmembership&view=configuration', true);
     JSubMenuHelper::addEntry(JText::_('RSM_UPDATES'), 'index.php?option=com_rsmembership&view=updates');
     JToolBarHelper::apply();
     JToolBarHelper::save();
     JToolBarHelper::cancel();
     $config = RSMembershipHelper::getConfig();
     $this->assignRef('config', $config);
     $lists['show_login'] = JHTML::_('select.booleanlist', 'show_login', 'class="inputbox"', $config->show_login);
     $create_user_instantly = array(JHTML::_('select.option', '0', JText::_('RSM_WHEN_PAYMENT')), JHTML::_('select.option', '1', JText::_('RSM_WHEN_ORDER')));
     $lists['price_show_free'] = JHTML::_('select.booleanlist', 'price_show_free', 'class="inputbox"', $config->price_show_free);
     $lists['create_user_instantly'] = JHTML::_('select.genericlist', $create_user_instantly, 'create_user_instantly', 'class="inputbox"', 'value', 'text', $config->create_user_instantly);
     $lists['choose_username'] = JHTML::_('select.booleanlist', 'choose_username', 'class="inputbox"', $config->choose_username);
     $lists['choose_password'] = JHTML::_('select.booleanlist', 'choose_password', 'class="inputbox"', $config->choose_password);
     $lists['disable_registration'] = JHTML::_('select.booleanlist', 'disable_registration', 'class="inputbox" onclick="rsm_enable_registration(this.value)"', $config->disable_registration);
     // CAPTCHA
     $captcha = array(JHTML::_('select.option', 0, JText::_('No')), JHTML::_('select.option', 1, JText::_('RSM_USE_BUILTIN_CAPTCHA')), JHTML::_('select.option', 2, JText::_('RSM_USE_RECAPTCHA')));
     $lists['captcha_enabled'] = JHTML::_('select.genericlist', $captcha, 'captcha_enabled', 'class="inputbox" onclick="rsm_captcha_enable(this.value);"', 'value', 'text', $config->captcha_enabled);
     $lists['captcha_enabled_for'] = '';
     $captcha_enabled_for = explode(',', $config->captcha_enabled_for);
     $lists['captcha_enabled_for'] .= '<input type="checkbox" ' . ($captcha_enabled_for[0] ? 'checked="checked"' : '') . ' ' . ($config->captcha_enabled ? '' : 'disabled="disabled"') . ' name="captcha_enabled_for_unregistered" value="1" id="captcha_enabled_for0" /> <label for="captcha_enabled_for0">' . JText::_('RSM_CAPTCHA_UNREGISTERED') . '</label>';
     $lists['captcha_enabled_for'] .= '<input type="checkbox" ' . ($captcha_enabled_for[1] ? 'checked="checked"' : '') . ' ' . ($config->captcha_enabled ? '' : 'disabled="disabled"') . ' name="captcha_enabled_for_registered" value="1" id="captcha_enabled_for1" /> <label for="captcha_enabled_for1">' . JText::_('RSM_CAPTCHA_REGISTERED') . '</label>';
     $lists['captcha_lines'] = JHTML::_('select.booleanlist', 'captcha_lines', 'class="inputbox"' . ($config->captcha_enabled != 1 ? ' disabled="disabled"' : ''), $config->captcha_lines);
     $lists['captcha_case_sensitive'] = JHTML::_('select.booleanlist', 'captcha_case_sensitive', 'class="inputbox"' . ($config->captcha_enabled != 1 ? ' disabled="disabled"' : ''), $config->captcha_case_sensitive);
     $themes = array(JHTML::_('select.option', 'red', JText::_('RSM_RECAPTCHA_THEME_RED')), JHTML::_('select.option', 'white', JText::_('RSM_RECAPTCHA_THEME_WHITE')), JHTML::_('select.option', 'blackglass', JText::_('RSM_RECAPTCHA_THEME_BLACKGLASS')), JHTML::_('select.option', 'clean', JText::_('RSM_RECAPTCHA_THEME_CLEAN')));
     $lists['recaptcha_theme'] = JHTML::_('select.genericlist', $themes, 'recaptcha_theme', 'class="inputbox"' . ($config->captcha_enabled != 2 ? ' disabled="disabled"' : ''), 'value', 'text', $config->recaptcha_theme);
     $lists['idev_enable'] = JHTML::_('select.booleanlist', 'idev_enable', 'class="inputbox" onclick="rsm_idev_enable(this.value)"', $config->idev_enable);
     $lists['idev_track_renewals'] = JHTML::_('select.booleanlist', 'idev_track_renewals', 'class="inputbox" ' . ($config->idev_enable ? '' : 'disabled="disabled"'), $config->idev_track_renewals);
     $lists['one_page_checkout'] = JHTML::_('select.booleanlist', 'one_page_checkout', 'class="inputbox"', $config->one_page_checkout, JText::_('RSM_ONE_PAGE_CHECKOUT'), JText::_('RSM_MULTI_PAGE_CHECKOUT'));
     $this->assignRef('lists', $lists);
     $params = array();
     $params['startOffset'] = JRequest::getInt('tabposition', 0);
     $pane =& JPane::getInstance('Tabs', $params, true);
     $this->assignRef('pane', $pane);
     $this->assign('module_helper', RSMembershipHelper::getPatchFile('module'));
     $this->assign('module_writable', is_writable($this->module_helper));
     $this->assign('module_patched', RSMembershipHelper::checkPatches('module'));
     $this->assign('menu_helper', RSMembershipHelper::getPatchFile('menu'));
     $this->assign('menu_writable', is_writable($this->menu_helper));
     $this->assign('menu_patched', RSMembershipHelper::checkPatches('menu'));
     parent::display($tpl);
 }
コード例 #8
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = clone $app->getParams('com_rsmembership');
     $this->params = $params;
     $this->item = $this->get('Item');
     if (empty($this->item->id) || !$this->item->published) {
         JError::raiseWarning(500, JText::_('COM_RSMEMBERSHIP_MEMBERSHIP_NOT_EXIST'));
         $app->redirect(JRoute::_(RSMembershipRoute::Memberships()));
     }
     $currency = RSMembershipHelper::getConfig('currency');
     // {price} placeholder
     $price = RSMembershipHelper::getPriceFormat($this->item->price);
     // {extras} placeholder
     $viewclass = RSMembershipHelper::isJ3() ? 'JViewLegacy' : 'JView';
     if ($viewclass == 'JView') {
         jimport('joomla.application.component.view');
     }
     $view = new $viewclass(array('name' => 'extras', 'base_path' => JPATH_SITE . '/components/com_rsmembership'));
     $view->model = JModelLegacy::getInstance('Extras', 'RSMembershipModel');
     $view->extras = $view->model->getItems();
     $view->item = $this->item;
     $view->show_subscribe_btn = $this->item->stock == -1 ? false : true;
     $this->extras = $view->loadTemplate();
     $placeholders = array('{price}' => $price, '{buy}' => '', '{extras}' => '', '{stock}' => $this->item->stock > -1 ? $this->item->stock == 0 ? JText::_('COM_RSMEMBERSHIP_UNLIMITED') : $this->item->stock : JText::_('COM_RSMEMBERSHIP_OUT_OF_STOCK_PLACEHOLDER'), '<hr id="system-readmore" />' => '');
     $replace = array_keys($placeholders);
     $with = array_values($placeholders);
     $this->item->description = str_replace($replace, $with, $this->item->description);
     // prepare the Pathway
     $pathway = $app->getPathway();
     $this->Itemid = JFactory::getApplication()->input->get('Itemid', 0, 'int');
     $layout = JFactory::getApplication()->input->get('layout', '', 'cmd');
     if ($this->item->category_id) {
         $pathway->addItem($this->item->category_name, JRoute::_(RSMembershipRoute::Memberships($this->item->category_id, $this->Itemid, $layout)));
     }
     $pathway->addItem($this->item->name, '');
     // Title
     if (!$params->get('page_title')) {
         $this->document->setTitle($this->item->name);
     } else {
         $this->document->setTitle($params->get('page_title') . ' - ' . $this->item->name);
     }
     // Description
     if ($params->get('menu-meta_description')) {
         $this->document->setDescription($params->get('menu-meta_description'));
     }
     // Keywords
     if ($params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $params->get('menu-meta_keywords'));
     }
     // Robots
     if ($params->get('robots')) {
         $this->document->setMetadata('robots', $params->get('robots'));
     }
     parent::display();
 }
コード例 #9
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     JToolBarHelper::title('RSMembership!', 'rsmembership');
     JSubMenuHelper::addEntry(JText::_('RSM_TRANSACTIONS'), 'index.php?option=com_rsmembership&view=transactions');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIPS'), 'index.php?option=com_rsmembership&view=memberships');
     JSubMenuHelper::addEntry(JText::_('RSM_CATEGORIES'), 'index.php?option=com_rsmembership&view=categories');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_EXTRAS'), 'index.php?option=com_rsmembership&view=extras');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_UPGRADES'), 'index.php?option=com_rsmembership&view=upgrades', true);
     JSubMenuHelper::addEntry(JText::_('RSM_COUPONS'), 'index.php?option=com_rsmembership&view=coupons');
     JSubMenuHelper::addEntry(JText::_('RSM_PAYMENT_INTEGRATIONS'), 'index.php?option=com_rsmembership&view=payments');
     JSubMenuHelper::addEntry(JText::_('RSM_FILES'), 'index.php?option=com_rsmembership&view=files');
     JSubMenuHelper::addEntry(JText::_('RSM_FILE_TERMS'), 'index.php?option=com_rsmembership&view=terms');
     JSubMenuHelper::addEntry(JText::_('RSM_USERS'), 'index.php?option=com_rsmembership&view=users');
     JSubMenuHelper::addEntry(JText::_('RSM_FIELDS'), 'index.php?option=com_rsmembership&view=fields');
     JSubMenuHelper::addEntry(JText::_('RSM_REPORTS'), 'index.php?option=com_rsmembership&view=reports');
     JSubMenuHelper::addEntry(JText::_('RSM_CONFIGURATION'), 'index.php?option=com_rsmembership&view=configuration');
     JSubMenuHelper::addEntry(JText::_('RSM_UPDATES'), 'index.php?option=com_rsmembership&view=updates');
     $task = JRequest::getVar('task', '');
     if ($task == 'edit') {
         JToolBarHelper::title('RSMembership! <small>[' . JText::_('RSM_EDIT_MEMBERSHIP_UPGRADE') . ']</small>', 'rsmembership');
         JToolBarHelper::apply();
         JToolBarHelper::save();
         JToolBarHelper::cancel();
         $this->assignRef('editor', JFactory::getEditor());
         $row = $this->get('upgrade');
         $this->assignRef('row', $row);
         $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
         $memberships = $this->get('memberships');
         $lists['from'] = JHTML::_('select.genericlist', $memberships, 'membership_from_id', '', 'value', 'text', $row->membership_from_id);
         $lists['to'] = JHTML::_('select.genericlist', $memberships, 'membership_to_id', '', 'value', 'text', $row->membership_to_id);
         $this->assignRef('lists', $lists);
     } else {
         JToolBarHelper::addNewX('edit');
         JToolBarHelper::editListX('edit');
         JToolBarHelper::spacer();
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::spacer();
         JToolBarHelper::deleteList('RSM_CONFIRM_DELETE');
         $filter_state = $mainframe->getUserStateFromRequest('rsmembership.filter_state', 'filter_state');
         $mainframe->setUserState('rsmembership.filter_state', $filter_state);
         $lists['state'] = JHTML::_('grid.state', $filter_state);
         $this->assignRef('lists', $lists);
         $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'ordering'));
         $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC'));
         $this->assignRef('upgrades', $this->get('upgrades'));
         $this->assignRef('pagination', $this->get('pagination'));
     }
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     parent::display($tpl);
 }
コード例 #10
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $task = JRequest::getVar('task', '');
     $filter_state = $mainframe->getUserStateFromRequest('rsmembership.filter_state', 'filter_state');
     $mainframe->setUserState('rsmembership.filter_state', $filter_state);
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     $this->assignRef('lists', $lists);
     $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'ordering'));
     $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC'));
     $this->assignRef('memberships', $this->get('memberships'));
     $this->assignRef('pagination', $this->get('pagination'));
     $filter_word = JRequest::getWord('search', '');
     $this->assignRef('filter_word', $filter_word);
     $this->assignRef('currency', RSMembershipHelper::getConfig('currency'));
     parent::display($tpl);
 }
コード例 #11
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     // Set pathway
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_MEMBERSHIP'), '');
     // Set params
     $this->params = clone $app->getParams('com_rsmembership');
     if ($terms = $this->get('terms')) {
         $this->terms = $terms;
         $this->action = $this->escape(JRoute::_(JURI::getInstance(), false));
         parent::display('terms');
     } else {
         $this->cid = $this->get('cid');
         $this->membership = $this->get('membership');
         $this->membershipterms = $this->get('membershipterms');
         $this->boughtextras = $this->get('boughtextras');
         $this->extras = $this->get('extras');
         $upgrades_array = $this->get('upgrades');
         $upgrades = array();
         foreach ($upgrades_array as $upgrade) {
             $upgrades[] = JHTML::_('select.option', $upgrade->membership_to_id, $upgrade->name . ' - ' . RSMembershipHelper::getPriceFormat($upgrade->price));
         }
         $has_upgrades = !empty($upgrades);
         $this->has_upgrades = $has_upgrades;
         $lists['upgrades'] = JHTML::_('select.genericlist', $upgrades, 'to_id', 'class="inputbox input-medium"');
         $this->folders = $this->get('folders');
         $this->files = $this->get('files');
         $this->previous = $this->get('previous');
         $this->from = $this->get('from');
         $this->lists = $lists;
         $Itemid = $app->input->get('Itemid', 0, 'int');
         $this->Itemid = '';
         if ($Itemid > 0) {
             $this->Itemid = '&Itemid=' . $Itemid;
         }
         $this->currency = RSMembershipHelper::getConfig('currency');
         // get the logged user
         $this->user = JFactory::getUser();
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->membership_id, false, $this->user->id, true, $this->membership->last_transaction_id);
         parent::display();
     }
 }
コード例 #12
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $pathway =& $mainframe->getPathway();
     $pathway->addItem(JText::_('RSM_MEMBERSHIP'), '');
     $params = clone $mainframe->getParams('com_rsmembership');
     $this->assignRef('params', $params);
     $terms = $this->get('terms');
     if (!empty($terms)) {
         $this->assignRef('terms', $terms);
         $this->assignRef('action', JRequest::getURI());
         parent::display('terms');
     } else {
         $this->assignRef('cid', $this->get('cid'));
         $this->assignRef('membership', $this->get('membership'));
         $this->assignRef('membershipterms', $this->get('membershipterms'));
         $this->assignRef('boughtextras', $this->get('boughtextras'));
         $this->assignRef('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);
         }
         $has_upgrades = !empty($upgrades);
         $this->assign('has_upgrades', $has_upgrades);
         $lists['upgrades'] = JHTML::_('select.genericlist', $upgrades, 'to_id', 'class="inputbox"');
         $this->assignRef('folders', $this->get('folders'));
         $this->assignRef('files', $this->get('files'));
         $this->assignRef('previous', $this->get('previous'));
         $this->assignRef('date_format', RSMembershipHelper::getConfig('date_format'));
         $this->assignRef('from', $this->get('from'));
         $this->assignRef('lists', $lists);
         $Itemid = JRequest::getInt('Itemid', 0);
         if ($Itemid > 0) {
             $this->assign('Itemid', '&Itemid=' . $Itemid);
         } else {
             $this->assign('Itemid', '');
         }
         $this->assign('currency', RSMembershipHelper::getConfig('currency'));
         parent::display();
     }
 }
コード例 #13
0
 function onAfterDispatch()
 {
     if (class_exists('RSMembershipHelper')) {
         if (RSMembershipHelper::getConfig('disable_registration')) {
             $j_option = JRequest::getVar('option');
             $j_view = JRequest::getVar('view');
             $j_task = JRequest::getVar('task');
             if ($j_option == 'com_user' && ($j_task == 'register' || $j_view == 'register') || $j_option == 'com_users' && ($j_task == 'registration.register' || $j_view == 'registration')) {
                 $url = JRoute::_('index.php?option=com_rsmembership', false);
                 $custom_url = RSMembershipHelper::getConfig('registration_page');
                 if (!empty($custom_url)) {
                     $url = $custom_url;
                 }
                 $mainframe =& JFactory::getApplication();
                 $mainframe->redirect($url);
             }
         }
         RSMembershipHelper::checkShared();
     }
 }
コード例 #14
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 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');
     // 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);
 }
コード例 #15
0
ファイル: membership_subscriber.php プロジェクト: JozefAB/qk
 public function getItem($pk = null)
 {
     static $cache = array();
     if (!isset($cache[$pk])) {
         $item = parent::getItem($pk);
         if (isset($item->extras)) {
             $item->extras = explode(',', $item->extras);
         }
         if (empty($item->user_id)) {
             $item->user_id = JFactory::getApplication()->input->get('user_id', 0, 'int');
         }
         if (empty($item->currency)) {
             $item->currency = RSMembershipHelper::getConfig('currency');
         }
         @(list($date, $time) = explode(' ', $item->membership_end, 2));
         if ($item->membership_end == '0000-00-00 00:00:00' || $date == '1970-01-01' || $date == '1969-12-31') {
             $item->unlimited = 1;
         }
         $membership_info = array();
         $hasTransaction = (int) $item->last_transaction_id;
         if ($item->membership_id && $hasTransaction) {
             if ($membership_fields = RSMembership::getCustomMembershipFields($item->membership_id)) {
                 // get the trasaction
                 $transaction = JTable::getInstance('Transaction', 'RSMembershipTable');
                 $transaction->load($item->last_transaction_id);
                 $user_data = $transaction->user_data ? (object) unserialize($transaction->user_data) : (object) array();
                 $selected = isset($user_data->membership_fields) ? $user_data->membership_fields : array();
                 foreach ($membership_fields as $field) {
                     $membership_info[] = RSMembershipHelper::showCustomField($field, $selected, true, true, 'membership');
                 }
             }
         }
         $item->membership_info = $membership_info;
         $cache[$pk] = $item;
     }
     return $cache[$pk];
 }
コード例 #16
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // get parameters
     $params = clone $app->getParams('com_rsmembership');
     $pathway = $app->getPathway();
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_UPGRADE'), '');
     // token
     $token = JHTML::_('form.token');
     // get the logged user
     $this->user = JFactory::getUser();
     // the new membership id
     $this->cid = $this->get('cid');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         $this->payments = RSMembership::getPlugins();
         // get the encoded return url
         $this->return = base64_encode(JURI::getInstance());
         $this->data = $this->get('data');
         // get the upgrade
         $this->upgrade = $this->get('upgrade');
         // price
         $this->total = RSMembershipHelper::getPriceFormat($this->upgrade->price);
         $this->fields = RSMembershipHelper::getFields(true);
         $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->upgrade->membership_to_id);
         $this->membership_fields = RSMembershipHelper::getMembershipFields($this->upgrade->membership_to_id, true, $this->user->id, true);
         $this->membershipterms = $this->get('membershipterms');
     } elseif ($layout == 'payment') {
         $this->html = $this->get('html');
     }
     $this->config = RSMembershipHelper::getConfig();
     $this->params = $params;
     $this->token = $token;
     $this->currency = RSMembershipHelper::getConfig('currency');
     parent::display();
 }
コード例 #17
0
ファイル: configuration.php プロジェクト: JozefAB/qk
 protected function loadFormData()
 {
     $data = (array) RSMembershipHelper::getConfig();
     return $data;
 }
コード例 #18
0
ファイル: subscribe.php プロジェクト: atikahmed/joomla-probid
 function getUseRecaptcha()
 {
     $captcha_enabled = RSMembershipHelper::getConfig('captcha_enabled');
     return $captcha_enabled == 2;
 }
コード例 #19
0
ファイル: recaptchalib.php プロジェクト: JozefAB/qk
    /**
     * Gets the challenge HTML (javascript and non-javascript version).
     * This is called from the browser, and the resulting reCAPTCHA HTML widget
     * is embedded within the HTML form it was called from.
     * @param string $pubkey A public key for reCAPTCHA
     * @param string $error The error given by reCAPTCHA (optional, default is null)
     * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
     * @return string - The HTML to be embedded in the user's form.
     */
    static function getHTML($error = null, $use_ssl = false)
    {
        $pubkey = RSMembershipHelper::getConfig('recaptcha_public_key');
        if ($pubkey == null || $pubkey == '') {
            return "To use reCAPTCHA you must get an API key from <a href='http://recaptcha.net/api/getkey'>http://recaptcha.net/api/getkey</a>";
        }
        $return = ' <script type="text/javascript">var RecaptchaOptions = { theme : \'' . RSMembershipHelper::getConfig('recaptcha_theme') . '\' };</script>';
        $use_ssl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || getenv('SSL_PROTOCOL_VERSION');
        if ($use_ssl) {
            $server = COM_RSMEMBERSHIP_RECAPTCHA_API_SECURE_SERVER;
        } else {
            $server = COM_RSMEMBERSHIP_RECAPTCHA_API_SERVER;
        }
        $errorpart = "";
        if ($error) {
            $errorpart = "&amp;error=" . $error;
        }
        $return .= '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>

		<noscript>
			<iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
			<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
			<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
		</noscript>';
        return $return;
    }
コード例 #20
0
 function captcha()
 {
     $captcha_enabled = RSMembershipHelper::getConfig('captcha_enabled');
     if (!$captcha_enabled) {
         return false;
     }
     ob_end_clean();
     if ($captcha_enabled == 1) {
         if (!class_exists('JSecurImage')) {
             require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'securimage' . DS . 'securimage.php';
         }
         $captcha = new JSecurImage();
         $captcha_lines = RSMembershipHelper::getConfig('captcha_lines');
         if ($captcha_lines) {
             $captcha->num_lines = 8;
         } else {
             $captcha->num_lines = 0;
         }
         $captcha_characters = RSMembershipHelper::getConfig('captcha_characters');
         $captcha->code_length = $captcha_characters;
         $captcha->image_width = 30 * $captcha_characters + 50;
         $captcha->show();
     }
     die;
 }
コード例 #21
0
ファイル: rsmembershipwire.php プロジェクト: JozefAB/qk
 public function onMembershipPayment($plugin, $data, $extra, $membership, &$transaction, $html)
 {
     $this->loadLanguage('plg_system_rsmembership', JPATH_ADMINISTRATOR);
     $this->loadLanguage('plg_system_rsmembershipwire', JPATH_ADMINISTRATOR);
     if (preg_match('#rsmembershipwire([0-9]+)#', $plugin, $match)) {
         $id = $match[1];
         $payment = JTable::getInstance('Payment', 'RSMembershipTable');
         $payment->load($id);
         $tax_value = $payment->tax_value;
         if (!empty($tax_value)) {
             $tax_type = $payment->tax_type;
             // percent ?
             if ($tax_type == 0) {
                 $tax_value = $transaction->price * ($tax_value / 100);
             }
             $transaction->price = $transaction->price + $tax_value;
         }
         if (RSMembershipHelper::getConfig('trigger_content_plugins')) {
             $payment->details = JHtml::_('content.prepare', $payment->details);
         }
         $html = $payment->details;
         // Store the transaction so we can get an ID
         $transaction->store();
         $replacements = array('{price}' => RSMembershipHelper::getPriceFormat($transaction->price), '{transaction_id}' => $transaction->id, '{tax}' => RSMembershipHelper::getPriceFormat($tax_value), '{membership}' => $membership->name);
         if (!empty($data) && is_object($data)) {
             if (isset($data->username)) {
                 $replacements['{username}'] = $data->username;
             }
             if (isset($data->name)) {
                 $replacements['{name}'] = $data->name;
             }
             if (isset($data->email)) {
                 $replacements['{email}'] = $data->email;
             }
             if (isset($data->coupon)) {
                 $replacements['{coupon}'] = $data->coupon;
             }
             if (isset($data->fields) && is_array($data->fields)) {
                 foreach ($data->fields as $field => $value) {
                     if (is_array($value)) {
                         $value = implode("\n", $value);
                     }
                     $replacements['{' . $field . '}'] = $value;
                 }
             }
         }
         $replace = array_keys($replacements);
         $with = array_values($replacements);
         $html = str_replace($replace, $with, $html);
         $html .= '<form method="post" action="' . JRoute::_('index.php?option=com_rsmembership&task=thankyou') . '">';
         $html .= '<div class="form-actions"><input class="button btn btn-success pull-right" type="submit" value="' . JText::_('COM_RSMEMBERSHIP_CONTINUE') . '" /></div>';
         $html .= '<input type="hidden" name="option" value="com_rsmembership" />';
         $html .= '<input type="hidden" name="task" value="thankyou" />';
         $html .= '</form>';
         // No hash for this
         $transaction->hash = '';
         $transaction->gateway = $payment->name;
         if ($membership->activation == 2) {
             $transaction->status = 'completed';
         }
         return $html;
     }
 }
コード例 #22
0
ファイル: controller.php プロジェクト: JozefAB/qk
 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();
 }
コード例 #23
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     // get parameters
     $params = clone $mainframe->getParams('com_rsmembership');
     // get the membership
     $membership = $this->get('membership');
     // check if the membership exists
     if (empty($membership->id)) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_EXIST'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     if (!$membership->published || $membership->stock == -1) {
         JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_PUBLISHED'));
         $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false));
     }
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($membership->name, JRoute::_('index.php?option=com_rsmembership&view=membership&cid=' . $membership->id . ':' . JFilterOutput::stringURLSafe($membership->name)));
     $pathway->addItem(JText::_('RSM_SUBSCRIBE'), '');
     // get the extras
     $extras = $this->get('extras');
     // check if the user is logged in
     $user =& JFactory::getUser();
     $logged = $user->get('guest') ? false : true;
     $show_login = RSMembershipHelper::getConfig('show_login');
     // token
     $token = JHTML::_('form.token');
     // get the current task
     $task = JRequest::getVar('task', '');
     $choose_username = RSMembershipHelper::getConfig('choose_username');
     $choose_password = RSMembershipHelper::getConfig('choose_password');
     // get the current layout
     $layout = $this->getLayout();
     if ($layout == 'default') {
         // get the encoded return url
         $return = base64_encode(JRequest::getURI());
         $this->assignRef('return', $return);
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $muser = $this->get('user');
         $data = $this->get('data');
         if ($task == 'back' || $task == 'validatesubscribe') {
             $this->assignRef('data', $data);
         }
         $this->assignRef('fields_validation', RSMembershipHelper::getFieldsValidation());
         $this->assignRef('fields', RSMembershipHelper::getFields());
         $this->assign('use_captcha', $this->get('usecaptcha'));
         $this->assign('use_builtin', $this->get('usebuiltin'));
         $this->assign('use_recaptcha', $this->get('userecaptcha'));
         if ($this->get('userecaptcha')) {
             if (!class_exists('JReCAPTCHA')) {
                 require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmembership' . DS . 'helpers' . DS . 'recaptcha' . DS . 'recaptchalib.php';
             }
             $this->assign('show_recaptcha', JReCAPTCHA::getHTML($this->get('recaptchaerror')));
         }
         $this->assign('has_coupons', $this->get('hasCoupons'));
     } elseif ($layout == 'preview') {
         $this->assign('choose_username', $choose_username);
         $this->assign('choose_password', $choose_password);
         $this->assignRef('fields', RSMembershipHelper::getFields(false));
         $this->assign('payments', RSMembership::getPlugins());
         $data = $this->get('data');
         $this->assignRef('data', $data);
     } elseif ($layout == 'payment') {
         $this->assignRef('html', $this->get('html'));
     }
     $this->assignRef('config', $this->get('config'));
     $this->assignRef('params', $params);
     $this->assignRef('membership', $membership);
     $this->assignRef('membershipterms', $this->get('membershipterms'));
     $this->assignRef('extras', $extras);
     $this->assignRef('logged', $logged);
     $this->assignRef('show_login', $show_login);
     $this->assignRef('user', $user);
     $this->assignRef('muser', $muser);
     $this->assignRef('token', $token);
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     $this->assign('one_page_checkout', RSMembershipHelper::getConfig('one_page_checkout'));
     if ($this->one_page_checkout) {
         $this->assign('payments', RSMembership::getPlugins());
     }
     $total = 0;
     $total += $membership->price;
     if ($extras) {
         foreach ($extras as $extra) {
             $total += $extra->price;
         }
     }
     $this->assign('total', $total);
     parent::display();
 }
コード例 #24
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $pathway = $app->getPathway();
     // Assign variables
     $this->membership = $this->get('Membership');
     $this->extras = $this->get('Extras');
     $this->params = clone $app->getParams('com_rsmembership');
     $this->user = JFactory::getUser();
     $this->logged = (bool) (!$this->user->guest);
     $this->token = JHtml::_('form.token');
     // Assign config variables
     $this->config = RSMembershipHelper::getConfig();
     $this->show_login = $this->config->show_login;
     $this->choose_username = $this->config->choose_username;
     $this->choose_password = $this->config->choose_password;
     $this->currency = $this->config->currency;
     $this->one_page_checkout = $this->config->one_page_checkout;
     $this->captcha_case_sensitive = $this->config->captcha_case_sensitive;
     $this->payments = RSMembership::getPlugins();
     // Set pathway
     $pathway->addItem($this->membership->name, JRoute::_(RSMembershipRoute::Membership($this->membership->id, $app->input->getInt('Itemid'))));
     $pathway->addItem(JText::_('COM_RSMEMBERSHIP_SUBSCRIBE'), '');
     switch ($this->getLayout()) {
         default:
             // Get the encoded return url
             $this->return = base64_encode(JURI::getInstance());
             $this->data = (object) $this->get('Data');
             $this->membershipterms = $this->get('MembershipTerms');
             $this->has_coupons = $this->get('HasCoupons');
             $this->fields_validation = RSMembershipHelper::getFieldsValidation($this->membership->id);
             $this->fields = RSMembershipHelper::getFields(true);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id);
             // Handle CAPTCHA
             $this->use_captcha = $this->get('UseCaptcha');
             $this->use_builtin = $this->get('UseBuiltin');
             $this->use_recaptcha = $this->get('UseReCaptcha');
             $this->use_recaptcha_new = $this->get('UseReCaptchaNew');
             if ($this->use_recaptcha) {
                 if (!class_exists('JReCAPTCHA')) {
                     require_once JPATH_ADMINISTRATOR . '/components/com_rsmembership/helpers/recaptcha/recaptchalib.php';
                 }
                 $this->show_recaptcha = JReCAPTCHA::getHTML($this->get('ReCaptchaError'));
             }
             if ($this->use_recaptcha_new) {
                 $doc = JFactory::getDocument();
                 if ($doc->getType() == 'html') {
                     $doc->addScript('https://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage()->getTag());
                 }
             }
             $this->assignExtrasView();
             break;
         case 'preview':
             $this->fields = RSMembershipHelper::getFields(false);
             $this->membership_fields = RSMembershipHelper::getMembershipFields($this->membership->id, false);
             $this->data = (object) $this->get('Data');
             break;
         case 'payment':
             $this->html = $this->get('Html');
             break;
     }
     // Calculate the Total
     $this->total = $this->get('Total');
     // Do we need to display the payment options?
     $model = $this->getModel();
     $this->showPayments = $model->showPaymentOptions();
     parent::display();
 }
コード例 #25
0
 /**
  * Validate the code to the user code
  *
  * @access private
  *
  */
 function validate()
 {
     // retrieve code from session
     $session = JFactory::getSession();
     $code = $this->getCode();
     if ($code != '' && $this->isCodeExpired()) {
         $code = '';
     }
     $code_entered = $this->code_entered;
     if (!RSMembershipHelper::getConfig('captcha_case_sensitive')) {
         $code = trim(strtolower($code));
         $code_entered = trim(strtolower($code_entered));
     }
     $this->correct_code = false;
     if ($code != '' && $code == $code_entered) {
         $this->correct_code = true;
         $session->set('com_rsmembership.securimage.value', '');
         $session->set('com_rsmembership.securimage.ctime', '');
     }
 }
コード例 #26
0
?>
</span> <?php 
echo JHTML::calendar($this->row->membership_start, 'membership_start', 'membership_start', '%s', 'onchange="rsmembership_date(this.value,\'membership_start\')" style="display: none"');
?>
</td>
		</tr>
		<tr>
			<td width="200"><span class="hasTip" title="<?php 
echo JText::_('RSM_MEMBERSHIP_END_DESC');
?>
"><label for="membership_end"><?php 
echo JText::_('RSM_MEMBERSHIP_END');
?>
</label></span></td>
			<td><span id="membership_end_ajax"><?php 
echo date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($this->row->membership_end));
?>
</span> <?php 
echo JHTML::calendar($this->row->membership_end, 'membership_end', 'membership_end', '%s', 'onchange="rsmembership_date(this.value,\'membership_end\')" style="display: none"');
?>
			<input type="checkbox" name="unlimited" id="change_unlimited" value="1" onchange="rsmembership_change_unlimited(this);" <?php 
echo $this->row->membership_end == 0 ? 'checked="checked"' : '';
?>
 /> <label for="change_unlimited"><?php 
echo JText::_('RSM_UNLIMITED');
?>
</label>
			</td>
		</tr>
		<tr>
			<td width="200"><span class="hasTip" title="<?php 
コード例 #27
0
ファイル: default.php プロジェクト: JozefAB/qk
		<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;
?>
			<div id="rsm_extras_container<?php 
echo $this->item->id;
?>
">
				<?php 
echo $this->extras;
?>
			</div>

			<?php 
echo JHTML::_('form.token');
コード例 #28
0
    ?>
" class="modal" rel="{handler: 'iframe', size: {x: 660, y: 475}}"><?php 
    echo $row->name != '' ? $row->name : JText::_('RSM_NO_TITLE');
    ?>
</a></td>
			<td>
				<?php 
    echo RSMembershipHelper::getPriceFormat($row->price);
    ?>
			</td>
			<td><?php 
    echo date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($row->membership_start));
    ?>
</td>
			<td><?php 
    echo $row->membership_end > 0 ? date(RSMembershipHelper::getConfig('date_format'), RSMembershipHelper::getCurrentDate($row->membership_end)) : JText::_('RSM_UNLIMITED');
    ?>
</td>
			<td><?php 
    echo JText::_('RSM_STATUS_' . $row->status);
    ?>
</td>
			<td align="center"><?php 
    echo JHTML::_('image', JURI::root() . 'administrator/' . $image, JText::_('RSM_STATUS'));
    ?>
</td>
			<td align="center"><?php 
    echo JHTML::_('grid.published', $row, $i);
    ?>
</td>
		</tr>
コード例 #29
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if ($tpl == 'shared' || $tpl == 'files') {
         parent::display($tpl);
         return true;
     }
     $task = JRequest::getVar('task', '');
     JToolBarHelper::title('RSMembership!', 'rsmembership');
     JSubMenuHelper::addEntry(JText::_('RSM_TRANSACTIONS'), 'index.php?option=com_rsmembership&view=transactions');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIPS'), 'index.php?option=com_rsmembership&view=memberships', true);
     JSubMenuHelper::addEntry(JText::_('RSM_CATEGORIES'), 'index.php?option=com_rsmembership&view=categories');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_EXTRAS'), 'index.php?option=com_rsmembership&view=extras');
     JSubMenuHelper::addEntry(JText::_('RSM_MEMBERSHIP_UPGRADES'), 'index.php?option=com_rsmembership&view=upgrades');
     JSubMenuHelper::addEntry(JText::_('RSM_COUPONS'), 'index.php?option=com_rsmembership&view=coupons');
     JSubMenuHelper::addEntry(JText::_('RSM_PAYMENT_INTEGRATIONS'), 'index.php?option=com_rsmembership&view=payments');
     JSubMenuHelper::addEntry(JText::_('RSM_FILES'), 'index.php?option=com_rsmembership&view=files');
     JSubMenuHelper::addEntry(JText::_('RSM_FILE_TERMS'), 'index.php?option=com_rsmembership&view=terms');
     JSubMenuHelper::addEntry(JText::_('RSM_USERS'), 'index.php?option=com_rsmembership&view=users');
     JSubMenuHelper::addEntry(JText::_('RSM_FIELDS'), 'index.php?option=com_rsmembership&view=fields');
     JSubMenuHelper::addEntry(JText::_('RSM_REPORTS'), 'index.php?option=com_rsmembership&view=reports');
     JSubMenuHelper::addEntry(JText::_('RSM_CONFIGURATION'), 'index.php?option=com_rsmembership&view=configuration');
     JSubMenuHelper::addEntry(JText::_('RSM_UPDATES'), 'index.php?option=com_rsmembership&view=updates');
     if ($task == 'edit') {
         JToolBarHelper::title('RSMembership! <small>[' . JText::_('RSM_EDIT_MEMBERSHIP') . ']</small>', 'rsmembership');
         JToolBarHelper::apply();
         JToolBarHelper::save();
         JToolBarHelper::cancel();
         $params = array();
         $params['startOffset'] = JRequest::getInt('tabposition', 0);
         $tabs =& JPane::getInstance('Tabs', $params, true);
         $this->assignRef('tabs', $tabs);
         $params = array();
         $params['allowAllClose'] = true;
         $pane =& JPane::getInstance('Sliders', $params);
         $this->assignRef('pane', $pane);
         $this->assignRef('editor', JFactory::getEditor());
         $row = $this->get('membership');
         $this->assignRef('row', $row);
         $this->assignRef('attachments', $this->get('attachments'));
         $this->assignRef('attachmentsPagination', $this->get('attachmentsPagination'));
         $lists['categories'] = JHTML::_('select.genericlist', $this->get('categories'), 'category_id', '', 'id', 'name', $row->category_id);
         $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
         $lists['use_renewal_price'] = JHTML::_('select.booleanlist', 'use_renewal_price', 'class="inputbox" onclick="rsm_enable_renewal_price(this.value)"', $row->use_renewal_price);
         $period_type = array(JHTML::_('select.option', 'h', JText::_('RSM_HOURS')), JHTML::_('select.option', 'd', JText::_('RSM_DAYS')), JHTML::_('select.option', 'm', JText::_('RSM_MONTHS')), JHTML::_('select.option', 'y', JText::_('RSM_YEARS')));
         $lists['period_type'] = JHTML::_('select.genericlist', $period_type, 'period_type', $row->fixed_expiry ? 'disabled="disabled"' : '', 'value', 'text', $row->period_type);
         $lists['use_trial_period'] = JHTML::_('select.booleanlist', 'use_trial_period', 'class="inputbox" onclick="rsm_enable_trial(this.value)"', $row->use_trial_period);
         $lists['trial_period_type'] = JHTML::_('select.genericlist', $period_type, 'trial_period_type', !$row->use_trial_period || $row->fixed_expiry ? 'disabled="disabled"' : '', 'value', 'text', $row->trial_period_type);
         $lists['recurring'] = JHTML::_('select.booleanlist', 'recurring', 'class="inputbox"', $row->recurring);
         $lists['unique'] = JHTML::_('select.booleanlist', 'unique', 'class="inputbox"', $row->unique);
         $lists['no_renew'] = JHTML::_('select.booleanlist', 'no_renew', 'class="inputbox"', $row->no_renew);
         $activation = array(JHTML::_('select.option', '0', JText::_('RSM_ACTIVATION_MANUAL')), JHTML::_('select.option', '1', JText::_('RSM_ACTIVATION_AUTO')), JHTML::_('select.option', '2', JText::_('RSM_ACTIVATION_INSTANT')));
         $lists['activation'] = JHTML::_('select.genericlist', $activation, 'activation', '', 'value', 'text', $row->activation);
         $all_extras = $this->get('extras');
         $extras = array();
         foreach ($all_extras as $extra) {
             $extras[] = JHTML::_('select.option', $extra->id, $extra->name);
         }
         $lists['extras'] = JHTML::_('select.genericlist', $extras, 'extras[]', 'multiple="multiple" size="10"', 'value', 'text', $row->extras, 'extras');
         $this->assign('hasExtra', count($extras) > 0);
         $modes = array(JHTML::_('select.option', '0', JText::_('RSM_PLAIN_TEXT')), JHTML::_('select.option', '1', JText::_('RSM_HTML')));
         $lists['user_email_use_global'] = JHTML::_('select.booleanlist', 'user_email_use_global', 'class="inputbox" onclick="rst_email_enable(this.value);"', $row->user_email_use_global);
         $lists['user_email_mode'] = JHTML::_('select.radiolist', $modes, 'user_email_mode', '', 'value', 'text', $row->user_email_mode);
         $lists['admin_email_mode'] = JHTML::_('select.radiolist', $modes, 'admin_email_mode', '', 'value', 'text', $row->admin_email_mode);
         $action = array(JHTML::_('select.option', '0', JText::_('RSM_MEMBERSHIP_SHOW_THANKYOU')), JHTML::_('select.option', '1', JText::_('RSM_MEMBERSHIP_REDIRECT')));
         $lists['action'] = JHTML::_('select.genericlist', $action, 'action', '', 'value', 'text', $row->action);
         $all_terms = $this->get('terms');
         $terms = array();
         $terms[] = JHTML::_('select.option', 0, JText::_('RSM_NO_TERMS_SELECTED'));
         foreach ($all_terms as $term) {
             $terms[] = JHTML::_('select.option', $term->id, $term->name);
         }
         $lists['terms'] = JHTML::_('select.genericlist', $terms, 'term_id', '', 'value', 'text', $row->term_id, 'term_id');
         // GID
         $lists['gid_enable'] = JHTML::_('select.booleanlist', 'gid_enable', 'class="inputbox" onclick="rsm_enable_gid(this.value)"', $row->gid_enable);
         if (RSMembershipHelper::isJ16()) {
             $lists['gid_subscribe'] = JHtml::_('access.usergroups', 'gid_subscribe', (array) $row->gid_subscribe, true);
             $lists['gid_expire'] = JHtml::_('access.usergroups', 'gid_expire', (array) $row->gid_expire, true);
         } else {
             $acl =& JFactory::getACL();
             $gtree = $acl->get_group_children_tree(null, 'USERS', false);
             foreach ($gtree as $i => $item) {
                 if ($item->value == 29 || $item->value == 30) {
                     $gtree[$i]->disable = true;
                 }
             }
             $lists['gid_subscribe'] = JHTML::_('select.genericlist', $gtree, 'gid_subscribe', 'size="10"', 'value', 'text', $row->gid_subscribe);
             $lists['gid_expire'] = JHTML::_('select.genericlist', $gtree, 'gid_expire', 'size="10"', 'value', 'text', $row->gid_expire);
         }
         $lists['disable_expired_account'] = JHTML::_('select.booleanlist', 'disable_expired_account', 'class="inputbox"', $row->disable_expired_account);
         $lists['fixed_day'] = JHTML::_('select.genericlist', $this->get('days'), 'fixed_day', !$row->fixed_expiry ? ' disabled="disabled"' : '', 'value', 'text', $row->fixed_day);
         $lists['fixed_month'] = JHTML::_('select.genericlist', $this->get('months'), 'fixed_month', !$row->fixed_expiry ? ' disabled="disabled"' : '', 'value', 'text', $row->fixed_month);
         $lists['fixed_year'] = JHTML::_('select.genericlist', $this->get('years'), 'fixed_year', !$row->fixed_expiry ? ' disabled="disabled"' : '', 'value', 'text', $row->fixed_year);
         $this->assignRef('lists', $lists);
     } else {
         JToolBarHelper::addNewX('edit');
         JToolBarHelper::editListX('edit');
         JToolBarHelper::spacer();
         JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'Duplicate');
         JToolBarHelper::spacer();
         JToolBarHelper::publishList();
         JToolBarHelper::unpublishList();
         JToolBarHelper::spacer();
         JToolBarHelper::deleteList('RSM_CONFIRM_DELETE');
         $lists['categories'] = JHTML::_('select.genericlist', $this->get('categories'), 'category_id', 'onchange="submitform();"', 'id', 'name', $mainframe->getUserStateFromRequest('rsmembership.category_id', 'category_id'));
         $filter_state = $mainframe->getUserStateFromRequest('rsmembership.filter_state', 'filter_state');
         $mainframe->setUserState('rsmembership.filter_state', $filter_state);
         $lists['state'] = JHTML::_('grid.state', $filter_state);
         $this->assignRef('lists', $lists);
         $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'm.ordering'));
         $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC'));
         $this->assignRef('memberships', $this->get('memberships'));
         $this->assignRef('pagination', $this->get('pagination'));
         $filter_word = JRequest::getString('search', '');
         $this->assignRef('filter_word', $filter_word);
     }
     $this->assign('currency', RSMembershipHelper::getConfig('currency'));
     parent::display($tpl);
 }
コード例 #30
0
ファイル: rsmembershippaypal.php プロジェクト: JozefAB/qk
 protected function onPaymentNotification()
 {
     if (!$this->canRun()) {
         return;
     }
     ob_end_clean();
     $name = $this->getTranslation($this->params->get('payment_name', 'PayPal'));
     require_once JPATH_ADMINISTRATOR . '/components/com_rsmembership/helpers/adapters/input.php';
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $jinput = RSInput::create();
     $log = array();
     $req = $this->_buildPostData();
     $this->addLog("IPN received: {$req}");
     // post back to PayPal system to validate
     $url = $this->params->get('mode') ? 'https://www.paypal.com/cgi-bin/webscr' : 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     $only_completed = (int) $this->params->get('only_completed', 0);
     if (!extension_loaded('curl') || !function_exists('curl_exec') || !is_callable('curl_exec')) {
         $this->addLog('[err] cURL is not installed or executable, cannot connect back to PayPal for validation!');
         $this->finish();
     }
     $this->addLog("Connecting to {$url} to verify if PayPal response is valid.");
     require_once JPATH_ADMINISTRATOR . '/components/com_rsmembership/helpers/version.php';
     $version = (string) new RSMembershipVersion();
     $website = JUri::root();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.paypal.com'));
     curl_setopt($ch, CURLOPT_USERAGENT, "RSMembership!/{$version} ({$website})");
     $res = curl_exec($ch);
     $errstr = curl_error($ch);
     curl_close($ch);
     if ($errstr) {
         $this->addLog('[err] cURL reported error: ' . $errstr);
         $this->finish();
     }
     // assign posted variables to local variables
     $item_name = $jinput->get('item_name', '', 'none');
     $item_number = $jinput->get('item_number', '', 'none');
     $payment_status = $jinput->get('payment_status', '', 'none');
     $payment_amount = $jinput->get('mc_gross', '', 'none');
     $payment_currency = $jinput->get('mc_currency', '', 'none');
     $txn_id = $jinput->get('txn_id', '', 'none');
     $txn_type = $jinput->get('txn_type', '', 'none');
     $receiver_email = $jinput->get('receiver_email', '', 'none');
     $payer_email = $jinput->get('payer_email', '', 'none');
     $custom = $jinput->get('custom', 0, 'none');
     // try to get the transaction id based on the custom hash
     $transaction_id = $this->getTransactionId($custom);
     // Do not deny the transaction for now.
     $deny = false;
     $this->addLog("Transaction ID is '{$transaction_id}', based on '{$custom}'.");
     if ($res) {
         $this->addLog("Successfully connected to {$url}. Response is {$res}");
         if (strcmp($res, "VERIFIED") == 0) {
             $this->addLog("Response is VERIFIED.");
             $log[] = "PayPal reported a valid transaction.";
             $log[] = "Payment status is " . (!empty($payment_status) ? $payment_status : 'empty') . ".";
             // check the payment_status is Completed
             if (!$only_completed || $only_completed && $payment_status == 'Completed') {
                 // sign up - do nothing, we use our "custom" parameter to identify the transaction
                 if ($txn_type == 'subscr_signup') {
                     $log[] = "Subscription signup has been received.";
                     // If this is a free trial, we'll need to make sure that the transaction is accepted since "subscr_payment" will be received after the trial ends
                     $mc_amount1 = $jinput->get('mc_amount1', '', 'none');
                     $subscr_id = $jinput->get('subscr_id', '', 'none');
                     if ((double) $mc_amount1 == (double) $transaction->price && $mc_amount1 == '0.00') {
                         // Emulate the variables needed below to approve the transaction
                         // No txn_id here, let's just use subscr_id so we can use something for PayPal identification.
                         $txn_id = 'Subscription ID: ' . $subscr_id;
                         $payment_amount = $mc_amount1;
                         // Load the transaction so that it can be processed below
                         $transaction = $this->getTransaction($transaction_id, 'id');
                     }
                 } elseif ($txn_type == 'subscr_payment' || $txn_type == 'recurring_payment') {
                     $log[] = "Adding new payment...";
                     // check that txn_id has not been previously processed
                     // check custom_hash from db -> if custom_hash == txn_id
                     $query->clear();
                     $query->select($db->qn('id'))->from($db->qn('#__rsmembership_transactions'))->where($db->qn('hash') . ' = ' . $db->q($txn_id))->where($db->qn('gateway') . ' = ' . $db->q($name));
                     $db->setQuery($query);
                     if (!$db->loadResult()) {
                         $transaction = $this->getTransaction($custom);
                         // check if transaction exists
                         if (!empty($transaction)) {
                             // this transaction has already been processed
                             // we need to create a new "renewal" transaction
                             if ($transaction->status == 'completed') {
                                 $log[] = "Identified this payment as recurring.";
                                 $query->clear();
                                 $query->select($db->qn('id'))->select($db->qn('user_id'))->select($db->qn('membership_id'))->from($db->qn('#__rsmembership_membership_subscribers'))->where($db->qn('from_transaction_id') . ' = ' . $db->q($transaction->id));
                                 $db->setQuery($query);
                                 $membership = $db->loadObject();
                                 if (!empty($membership)) {
                                     $user = JFactory::getUser($membership->user_id);
                                     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_rsmembership/tables');
                                     $transaction = JTable::getInstance('Transaction', 'RSMembershipTable');
                                     $transaction->user_id = $user->get('id');
                                     $transaction->user_email = $user->get('email');
                                     $transaction->type = 'renew';
                                     $params = array();
                                     $params[] = 'id=' . $membership->id;
                                     $params[] = 'membership_id=' . $membership->membership_id;
                                     $transaction->params = implode(';', $params);
                                     // params, membership, extras etc
                                     $date = JFactory::getDate();
                                     $transaction->date = $date->toSql();
                                     $transaction->ip = $_SERVER['REMOTE_ADDR'];
                                     $transaction->price = $payment_amount;
                                     $transaction->currency = RSMembershipHelper::getConfig('currency');
                                     $transaction->hash = '';
                                     $transaction->gateway = $name;
                                     $transaction->status = 'pending';
                                     // store the transaction
                                     $transaction->store();
                                     RSMembership::finalize($transaction->id);
                                     $log[] = "Successfully added the recurring transaction to the database.";
                                 } else {
                                     $log[] = "Could not identify the original transaction for this recurring payment.";
                                 }
                             }
                         } else {
                             $log[] = "Could not identify transaction with custom hash {$custom}. Stopping.";
                         }
                     } else {
                         $log[] = "The transaction {$txn_id} has already been processed. Stopping.";
                     }
                 } else {
                     // check that txn_id has not been previously processed
                     // check custom_hash from db -> if custom_hash == txn_id
                     $query->clear();
                     $query->select($db->qn('id'))->from($db->qn('#__rsmembership_transactions'))->where($db->qn('hash') . ' = ' . $db->q($txn_id))->where($db->qn('gateway') . ' = ' . $db->q($name));
                     $db->setQuery($query);
                     if (!$db->loadResult()) {
                         $query->clear();
                         $query->select('*')->from($db->qn('#__rsmembership_transactions'))->where($db->qn('custom') . ' = ' . $db->q($custom))->where($db->qn('status') . ' != ' . $db->q('completed'));
                         $db->setQuery($query);
                         $transaction = $db->loadObject();
                         // check if transaction exists
                         if (empty($transaction)) {
                             $log[] = "Could not identify transaction with custom hash {$custom}. Stopping.";
                         }
                     } else {
                         $log[] = "The transaction {$txn_id} has already been processed. Stopping.";
                     }
                 }
                 if (!empty($transaction)) {
                     $plugin_email = $this->normalize($this->params->get('email'));
                     $primary_email = $this->normalize($this->params->get('primary_email'));
                     $receiver_email = $this->normalize($receiver_email);
                     if (!$primary_email) {
                         $primary_email = $plugin_email;
                     }
                     // check that receiver_email is your Primary PayPal email
                     if ($receiver_email == $plugin_email || $receiver_email == $primary_email) {
                         // check that payment_amount/payment_currency are correct
                         // check $payment_amount == $price from $subscription_id && $payment_currency == $price from $subscription_id
                         $price = $this->_convertNumber($transaction->price);
                         $currency = $this->normalize(RSMembershipHelper::getConfig('currency'));
                         $payment_currency = $this->normalize($payment_currency);
                         if ((double) $payment_amount >= (double) $price) {
                             if ($currency == $payment_currency) {
                                 // set the hash
                                 $this->setTransactionHash($transaction->id, $txn_id);
                                 // process payment unless manual activation selected
                                 $membership_id = $this->getMembershipId($transaction->params, $transaction->type);
                                 if ($membership_id) {
                                     $query->clear()->select('activation')->from($db->qn('#__rsmembership_memberships'))->where($db->qn('id') . ' = ' . $db->q((int) $membership_id));
                                     $db->setQuery($query);
                                     $activation = $db->loadResult();
                                     if ($activation != MEMBERSHIP_ACTIVATION_MANUAL) {
                                         RSMembership::approve($transaction->id);
                                     }
                                     $activationText = 'missing';
                                     if ($activation == MEMBERSHIP_ACTIVATION_MANUAL) {
                                         $activationText = 'manual';
                                     } elseif ($activation == MEMBERSHIP_ACTIVATION_AUTO) {
                                         $activationText = 'auto';
                                     } elseif ($activation == MEMBERSHIP_ACTIVATION_INSTANT) {
                                         $activationText = 'instant';
                                     }
                                     $log[] = "Activation is {$activationText}.";
                                     $log[] = "Successfully added the payment to the database.";
                                 } else {
                                     $log[] = "The membership could not be found in the database.";
                                 }
                             } else {
                                 $log[] = "Expected a currency of {$currency}. PayPal reports this payment is made in {$payment_currency}. Stopping.";
                                 $deny = true;
                             }
                         } else {
                             $log[] = "Expected an amount of {$price} {$currency}. PayPal reports this payment is {$payment_amount} {$payment_currency}. Stopping.";
                             $deny = true;
                         }
                     } else {
                         $log[] = "Expected payment to be made to {$plugin_email}" . ($primary_email ? " or {$primary_email}" : "") . ". PayPal reports this payment is made for {$receiver_email}. Stopping.";
                         $deny = true;
                     }
                 }
             } else {
                 $log[] = "Payment status is {$payment_status}. Stopping.";
             }
         } elseif (strcmp($res, "INVALID") == 0) {
             $this->addLog("[err] Response is INVALID.");
             $log[] = "Could not verify transaction authencity. PayPal said it's invalid.";
             $log[] = "String sent to PayPal is {$req}";
             $deny = true;
             // log for manual investigation
         } else {
             $this->addLog("[err] PayPal response returned invalid data. Data is presented below:");
             $this->addLog($res);
             $this->addLog("End of data.");
             $log[] = 'PayPal response is not valid! Should be either VERIFIED or INVALID, received "' . strip_tags($res) . '"';
         }
     } else {
         $log[] = "Could not open {$url} in order to verify this transaction. Error reported is: {$errstr}";
     }
     if ($transaction_id) {
         $log[] = "String sent by PayPal is {$req}";
         RSMembership::saveTransactionLog($log, $transaction_id);
         if ($deny) {
             RSMembership::deny($transaction_id);
         }
     }
     $this->finish();
 }