function getPayments() { $plugins = RSMembership::getPlugins(); $return = array(); foreach ($plugins as $paymentplugin => $name) { if (preg_match('#rsmembershipwire([0-9]+)#', $paymentplugin, $match)) { continue; } $tmp = new stdClass(); $tmp->name = $name; $tmp->limitations = ''; $className = 'plgSystem' . $paymentplugin; if (class_exists($className) && method_exists($className, 'getLimitations')) { $dispatcher =& JDispatcher::getInstance(); $plugin = new $className($dispatcher, array()); $tmp->limitations = $plugin->getLimitations(); } if (RSMembershipHelper::isJ16()) { $this->_db->setQuery("SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND `folder`='system' AND `client_id`='0' AND `element`='" . $this->_db->getEscaped($paymentplugin) . "' LIMIT 1"); } else { $this->_db->setQuery("SELECT `id` FROM #__plugins WHERE `folder`='system' AND `client_id`='0' AND `element`='" . $this->_db->getEscaped($paymentplugin) . "' LIMIT 1"); } $tmp->cid = $this->_db->loadResult(); $return[] = $tmp; } $return = array_merge($return, $this->getWirePayments()); return $return; }
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(); }
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'); 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', true); JSubMenuHelper::addEntry(JText::_('RSM_CONFIGURATION'), 'index.php?option=com_rsmembership&view=configuration'); JSubMenuHelper::addEntry(JText::_('RSM_UPDATES'), 'index.php?option=com_rsmembership&view=updates'); $params = array(); $params['allowAllClose'] = true; $pane =& JPane::getInstance('sliders', $params); $this->assignRef('pane', $pane); $date = RSMembershipHelper::getCurrentDate(); if (RSMembershipHelper::isJ16()) { $date =& JFactory::getDate(); $date = $date->toUnix(); } $this->assignRef('from_calendar', JHTML::_('calendar', '', 'from_date', 'rsm_from_calendar')); $this->assignRef('to_calendar', JHTML::_('calendar', date('Y-m-d', $date), 'to_date', 'rsm_to_calendar')); $this->assign('user_id', $this->get('userId')); $this->assign('report', $this->get('report')); $this->assign('count_memberships', $this->get('countMemberships')); $color_pickers = !empty($this->report) && $this->report == 2 ? '4' : $this->count_memberships; $this->assign('color_pickers', $color_pickers); $lists['transaction_types'] = $this->get('transactiontypes'); $lists['memberships'] = $this->get('memberships'); $lists['memberships_transactions'] = $this->get('membershipstransactions'); $units = array(); $units[] = JHTML::_('select.option', 'day', JText::_('RSM_DAY')); $units[] = JHTML::_('select.option', 'month', JText::_('RSM_MONTH')); $units[] = JHTML::_('select.option', 'quarter', JText::_('RSM_QUARTER')); $units[] = JHTML::_('select.option', 'year', JText::_('RSM_YEAR')); $lists['unit'] = JHTML::_('select.genericlist', $units, 'unit'); $reports = array(); $reports[] = JHTML::_('select.option', 'report_1', JText::_('RSM_REPORT_1')); $reports[] = JHTML::_('select.option', 'report_2', JText::_('RSM_REPORT_2')); $lists['report'] = JHTML::_('select.genericlist', $reports, 'report', 'onchange="rsm_check_report(this.value);"'); $gateways = $this->assign('gateways', $this->get('gateways')); $viewin = array(); $viewin[] = JHTML::_('select.option', 60, JText::_('RSM_MINUTES')); $viewin[] = JHTML::_('select.option', 3600, JText::_('RSM_HOURS')); $viewin[] = JHTML::_('select.option', 86400, JText::_('RSM_DAYS')); $lists['viewin'] = JHTML::_('select.genericlist', $viewin, 'viewin', 'style="display: none;"'); $this->assignRef('lists', $lists); $this->assign('customer', $this->get('customer')); if ($this->get('ie')) { JError::raiseWarning(500, JText::_('RSM_IE_WARNING')); } parent::display($tpl); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $terms = $this->get('terms'); $pathway =& $mainframe->getPathway(); $pathway->addItem($terms->name, ''); // get parameters $params = clone $mainframe->getParams('com_rsmembership'); $this->assignRef('params', $params); $this->assignRef('terms', $terms); 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(); }
function __construct() { parent::__construct(); $document =& JFactory::getDocument(); // Add the css stylesheet $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/rsmembership.css'); if (RSMembershipHelper::isJ16()) { $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_rsmembership/assets/css/rsmembership16.css'); } // Set the database object $this->_db =& JFactory::getDBO(); RSMembershipHelper::readConfig(); }
function __construct() { parent::__construct(); $user = JFactory::getUser(); if ($user->get('guest')) { $mainframe =& JFactory::getApplication(); $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(JRoute::_('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->_execute(); }
function plgSystemRSMembershipAuthorize(&$subject, $config) { parent::__construct($subject, $config); $this->_plugin =& JPluginHelper::getPlugin('system', 'rsmembershipauthorize'); jimport('joomla.html.parameter'); $this->_params = new JParameter($this->_plugin->params); if (!$this->canRun()) { return; } RSMembership::addPlugin('Credit Card', 'rsmembershipauthorize'); $this->_db = JFactory::getDBO(); if (RSMembershipHelper::isJ16()) { $this->joomla16prefix = 'rsmembershipauthorize/'; } $lang =& JFactory::getLanguage(); $lang->load('plg_system_rsmembershipauthorize', JPATH_ADMINISTRATOR); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsmembership'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect('index.php?option=' . $user_option . '&view=login&return=' . $link); } // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.memberships.limit', $limit); $this->setState($option . '.memberships.limitstart', $limitstart); $this->_query = $this->_buildQuery(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $params = clone $mainframe->getParams('com_rsmembership'); $this->assignRef('params', $params); $membership = $this->get('membership'); $this->assignRef('membership', $membership); if (empty($membership->id) || !$membership->published) { JError::raiseWarning(500, JText::_('RSM_MEMBERSHIP_NOT_EXIST')); $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership', false)); } $category = $this->get('category'); $pathway =& $mainframe->getPathway(); if ($category) { $catid = $category->id . ':' . JFilterOutput::stringURLSafe($category->name); $pathway->addItem($category->name, JRoute::_('index.php?option=com_rsmembership&view=rsmembership&catid=' . $catid)); } $pathway->addItem($membership->name, ''); $document =& JFactory::getDocument(); if (!$params->get('page_title')) { $document->setTitle($membership->name); } else { $document->setTitle($params->get('page_title') . ' - ' . $membership->name); } 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(); }
function __construct() { parent::__construct(); // large databases need lots of memory ini_set('memory_limit', '128M'); $this->_db = JFactory::getDBO(); $this->_db->setQuery("SET SQL_BIG_SELECTS=1"); $this->_db->query(); $document =& JFactory::getDocument(); $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/rsmembership.js'); $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/bluff/js-class.js'); $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/bluff/bluff-min.js'); $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/bluff/excanvas.js'); $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/reports.js'); jimport('joomla.plugin.helper'); if (RSMembershipHelper::isJ16() || JPluginHelper::isEnabled('system', 'mtupgrade')) { $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/rainbow12.js'); } else { $document->addScript(JURI::base() . 'components/com_rsmembership/assets/js/rainbow.js'); } $document->addStyleSheet(JURI::base() . 'components/com_rsmembership/assets/css/reports.css'); $this->_getMemberships(); }
function display($tpl = null) { $membership_id = JRequest::getInt('membership_id'); $extra_value_id = JRequest::getInt('extra_value_id'); if (!empty($membership_id)) { $this->assign('id', $membership_id); $this->assign('what', 'membership_id'); $this->assign('function', 'addmembershipshared'); } else { $this->assign('id', $extra_value_id); $this->assign('what', 'extra_value_id'); $this->assign('function', 'addextravaluefolders'); } $this->assignRef('pluginShareTypes', $this->get('pluginShareTypes')); $layout = JRequest::getVar('layout'); switch ($layout) { case 'plugin': $this->assignRef('headers', $this->get('headers')); $this->assignRef('data', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', $this->get('sortColumn')); $this->assignRef('sortOrder', $this->get('sortOrder')); $this->assign('share_type', $this->get('shareType')); break; case 'article': $this->assignRef('articles', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'ordering')); $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC')); break; case 'section': $this->assignRef('sections', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'ordering')); $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC')); break; case 'category': $this->assignRef('categories', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', JRequest::getVar('filter_order', RSMembershipHelper::isJ16() ? 'title' : 'ordering')); $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC')); break; case 'module': $this->assign('has_patches', RSMembershipHelper::checkPatches($layout)); $this->assignRef('modules', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'client_id, position, ordering')); $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC')); break; case 'menu': $this->assign('has_patches', RSMembershipHelper::checkPatches($layout)); $this->assignRef('items', $this->get('data')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('sortColumn', JRequest::getVar('filter_order', 'menutype, ordering')); $this->assignRef('sortOrder', JRequest::getVar('filter_order_Dir', 'ASC')); break; case 'url': $row = $this->get('url'); $where = array(JHTML::_('select.option', 'backendurl', JText::_('RSM_BACKEND')), JHTML::_('select.option', 'frontendurl', JText::_('RSM_FRONTEND'))); $lists['where'] = JHTML::_('select.genericlist', $where, 'where', '', 'value', 'text', $row->type); $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published); $this->assignRef('lists', $lists); $this->assignRef('row', $row); break; } $filter_word = JRequest::getString('search', ''); $this->assignRef('filter_word', $filter_word); parent::display($tpl); }
function _getRSMembershipHTML($userName, $userId, $memberships, $Itemid) { ob_start(); $content = ''; if (!$memberships) { ?> <div class="icon-nopost"> <?php if (RSMembershipHelper::isJ16()) { ?> <img src="<?php echo JURI::base(); ?> plugins/community/plg_rsmembership/plg_rsmembership/favicon.png" alt="" /> <?php } else { ?> <img src="<?php echo JURI::base(); ?> plugins/community/plg_rsmembership/favicon.png" alt="" /> <?php } ?> </div> <div class="content-nopost"> <?php echo JText::sprintf('RSM_NO_MEMBERSHIPS', $userName); ?> </div> <?php } else { ?> <div id="community-rsmembership-wrap"> <div class="ctitle"><?php echo JText::_('RSM_MEMBERSHIPS'); ?> </div> <table cellpadding="2" cellspacing="0" border="0" width="100%"> <?php foreach ($memberships as $membership) { ?> <tr> <td width="15"> <?php if (RSMembershipHelper::isJ16()) { ?> <img src="<?php echo JURI::base(); ?> plugins/community/plg_rsmembership/plg_rsmembership/favicon.png" alt="" /> <?php } else { ?> <img src="<?php echo JURI::base(); ?> plugins/community/plg_rsmembership/favicon.png" alt="" /> <?php } ?> </td> <td valign="top"> <a href="<?php echo JRoute::_('index.php?option=com_rsmembership&view=membership&cid=' . $membership->id . ':' . JFilterOutput::stringURLSafe($membership->name) . '&Itemid=' . $Itemid); ?> "><?php echo $membership->name; ?> </a> </td> <td align="right"> <?php echo JText::sprintf('RSM_STARTED_EXPIRES', date(RSMembershipHelper::getConfig('date_format'), $membership->membership_start), date(RSMembershipHelper::getConfig('date_format'), $membership->membership_end)); ?> </td> </tr> <?php } ?> </table> </div> <?php } $content = ob_get_contents(); ob_end_clean(); return $content; }
function _buildQuery() { $layout = JRequest::getVar('layout'); $query = ''; switch ($layout) { case 'article': if (RSMembershipHelper::isJ16()) { $query = "SELECT a.*, c.title AS categorytitle FROM #__content a LEFT JOIN #__categories c ON (c.id = a.catid) WHERE 1"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND a.`title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY `" . $sortColumn . "` " . $sortOrder; } else { $query = "SELECT a.*, c.title AS categorytitle, s.title AS sectiontitle FROM #__content a LEFT JOIN #__categories c ON (c.id = a.catid) LEFT JOIN #__sections s ON (s.id = a.sectionid) WHERE 1"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND a.`title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY `" . $sortColumn . "` " . $sortOrder; } break; case 'section': $query = "SELECT * FROM #__sections WHERE 1"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY `" . $sortColumn . "` " . $sortOrder; break; case 'category': if (RSMembershipHelper::isJ16()) { $query = "SELECT * FROM #__categories WHERE `extension`='com_content' "; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'title'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY `" . $sortColumn . "` " . $sortOrder; } else { $query = "SELECT * FROM #__categories WHERE 1"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY `" . $sortColumn . "` " . $sortOrder; } break; case 'module': $query = "SELECT * FROM #__modules m WHERE 1"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%' OR `module` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'client_id, position, ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY " . $sortColumn . " " . $sortOrder; break; case 'menu': if (RSMembershipHelper::isJ16()) { $query = "SELECT id, title AS name, menutype, published FROM #__menu m WHERE published != '-2' AND client_id=0 AND `parent_id` > 0"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `title` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'menutype, ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY " . $sortColumn . " " . $sortOrder; } else { $query = "SELECT * FROM #__menu m WHERE published != '-2'"; $filter_word = JRequest::getVar('search', ''); if (!empty($filter_word)) { $query .= " AND `name` LIKE '%" . $this->_db->getEscaped($filter_word) . "%'"; } $sortColumn = JRequest::getVar('filter_order', 'menutype, ordering'); $sortColumn = $this->_db->getEscaped($sortColumn); $sortOrder = JRequest::getVar('filter_order_Dir', 'ASC'); $sortOrder = $this->_db->getEscaped($sortOrder); $query .= " ORDER BY " . $sortColumn . " " . $sortOrder; } break; } return $query; }
?> </span> <span><?php echo $this->pagination->orderDownIcon($j, $n, true, 'orderdown', 'Move Down', 'ordering'); ?> </span> <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?> " class="text_area" style="text-align:center" /> </td> </tr> <?php $j++; } else { $link = RSMembershipHelper::isJ16() ? JRoute::_('index.php?option=com_rsmembership&task=editplugin&cid=' . $row->cid) : JRoute::_('index.php?option=com_plugins&view=plugin&client=site&task=edit&cid[]=' . $row->cid); ?> <tr class="row<?php echo $k; ?> "> <td align="center"><?php echo $i + 1; ?> </td> <td><a href="<?php echo $link; ?> "><?php echo $this->escape($row->name); ?>
function getMembership() { jimport('joomla.html.pagination'); $cid = JRequest::getVar('cid', 0); if (is_array($cid)) { $cid = $cid[0]; } $cid = (int) $cid; $row =& JTable::getInstance('RSMembership_Memberships', 'Table'); $row->load($cid); $this->_db->setQuery("SELECT `extra_id` FROM #__rsmembership_membership_extras WHERE `membership_id`='" . $cid . "'"); $row->extras = $this->_db->loadResultArray(); $instances = RSMembership::getSharedContentPlugins(); $this->_db->setQuery("SELECT * FROM #__rsmembership_membership_shared WHERE `membership_id`='" . $cid . "' ORDER BY `ordering`"); $row->shared = $this->_db->loadObjectList(); foreach ($row->shared as $s => $shared) { switch ($shared->type) { default: foreach ($instances as $instance) { if (method_exists($instance, 'showUserFriendlyParams')) { $instance->showUserFriendlyParams($shared); } } $row->shared[$s] = $shared; break; case 'article': $this->_db->setQuery("SELECT `title` FROM #__content WHERE `id`='" . (int) $shared->params . "'"); $row->shared[$s]->params = $this->_db->loadResult(); break; case 'section': $this->_db->setQuery("SELECT `title` FROM #__sections WHERE `id`='" . (int) $shared->params . "'"); $row->shared[$s]->params = $this->_db->loadResult(); break; case 'category': $this->_db->setQuery("SELECT `title` FROM #__categories WHERE `id`='" . (int) $shared->params . "'"); $row->shared[$s]->params = $this->_db->loadResult(); break; case 'module': $this->_db->setQuery("SELECT `title`, `module` FROM #__modules WHERE `id`='" . (int) $shared->params . "'"); $module = $this->_db->loadObject(); $row->shared[$s]->params = '(' . $module->module . ') ' . $module->title; break; case 'menu': if (RSMembershipHelper::isJ16()) { $this->_db->setQuery("SELECT `title` AS `name`, `menutype` FROM #__menu WHERE `id`='" . (int) $shared->params . "'"); } else { $this->_db->setQuery("SELECT `name`, `menutype` FROM #__menu WHERE `id`='" . (int) $shared->params . "'"); } $menu = $this->_db->loadObject(); $row->shared[$s]->params = '(' . $menu->menutype . ') ' . $menu->name; break; } } $row->sharedPagination = new JPagination(count($row->shared), 0, 0); // attachments $this->_db->setQuery("SELECT * FROM #__rsmembership_membership_attachments WHERE `membership_id`='" . $cid . "' ORDER BY `ordering`"); $attachments = $this->_db->loadObjectList(); foreach ($attachments as $attachment) { $this->attachments[$attachment->email_type][] = $attachment; } foreach ($this->attachments as $email_type => $attachments) { $this->attachmentsPagination[$email_type] = new JPagination(count($attachments), 0, 0); } return $row; }
function onMembershipPayment($plugin, $data, $extra, $membership, &$transaction) { if (!$this->canRun()) { return; } if ($plugin != $this->_plugin->name) { return false; } $this->loadLanguage('plg_system_rsmembership'); $this->loadLanguage('plg_system_rsmembershipauthorize'); $document =& JFactory::getDocument(); $document->addScript(JURI::root() . 'plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/script.js'); $document->addStyleSheet(JURI::root() . 'plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/style.css'); JHTML::_('behavior.tooltip'); $fields = $this->_getFields(); $transaction->gateway = 'Authorize.Net'; $html = ''; $html .= '<form method="post" class="rsmembership_form" action="' . JRoute::_('index.php?option=com_rsmembership&task=thankyou') . '" onsubmit="return rsm_check_authorize(\'' . JRoute::_('index.php?option=com_rsmembership&plugin_task=authorize') . '\');">'; $html .= '<fieldset>'; $html .= '<legend>' . JText::_('RSM_AUTHORIZE_CARD_INFO') . '</legend>'; $html .= '<table cellpadding="0" cellspacing="0" border="0" width="100%" class="rsmembership_form_table">'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_image'][0] . '</td>'; $html .= '<td>' . $fields['cc_image'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_number'][0] . '</td>'; $html .= '<td>' . $fields['cc_number'][1] . ' ' . $fields['csc_number'][0] . ' ' . $fields['csc_number'][1] . ' <span id="rsm_whats_csc" onmouseover="rsm_tooltip.show(\'rsm_tooltip\');" onmouseout="rsm_tooltip.hide();">' . JText::_('RSM_AUTHORIZE_WHATS_CSC') . '</span></td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . JText::_('RSM_AUTHORIZE_EXP_DATE') . '</td>'; $html .= '<td>' . $fields['cc_exp_mm'][0] . ' ' . $fields['cc_exp_mm'][1] . ' ' . $fields['cc_exp_yy'][0] . ' ' . $fields['cc_exp_yy'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_fname'][0] . '</td>'; $html .= '<td>' . $fields['cc_fname'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40">' . $fields['cc_lname'][0] . '</td>'; $html .= '<td>' . $fields['cc_lname'][1] . '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td height="40" colspan="2">' . JText::sprintf('RSM_AUTHORIZE_PRICE_DESC', RSMembershipHelper::getPriceFormat($transaction->price)) . '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</fieldset>'; $html .= '<input class="button" type="submit" id="rsm_pay_button" value="' . JText::_('RSM_AUTHORIZE_PAY_NOW') . '" />'; $html .= JHTML::image('components/com_rsmembership/assets/images/load.gif', 'Loading', 'id="rsm_loading" style="display: none;"'); $html .= '<input type="hidden" name="membership_id" id="membership_id" value="' . $membership->id . '" />'; $html .= '<input type="hidden" name="option" value="com_rsmembership" />'; $html .= '<input type="hidden" name="task" value="thankyou" />'; $html .= '</form>'; $html .= '<div id="rsm_response" class="rsm_response_error">'; $html .= '</div>'; $html .= '<div id="rsm_tooltip" style="display: none;">'; if (RSMembershipHelper::isJ16()) { $html .= '<div>' . JText::_('RSM_AUTHORIZE_WHATS_CSC_DESC', true) . '</div><div align="center">' . JHTML::image('plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/images/cc_csc.gif', 'CSC') . '</div>'; } $html .= '</div>'; $warning = JHTML::image('plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/images/warning.png', 'Warning', array('id' => 'rsm_warning')); $html .= '<script type="text/javascript">'; $html .= 'function rsm_get_error_message(code) {'; $html .= 'if (code == 0) return \'' . $warning . ' ' . JText::_('RSM_AUTHORIZE_ERRORS', true) . '\';'; $html .= '}'; $html .= '</script>'; return $html; }
<?php /** * @version 1.0.0 * @package RSMembership! 1.0.0 * @copyright (C) 2009-2010 www.rsjoomla.com * @license GPL, http://www.gnu.org/licenses/gpl-2.0.html */ defined('_JEXEC') or die('Restricted access'); ?> <?php if (RSMembershipHelper::isJ16()) { ?> <?php if ($this->params->get('show_page_heading', 1)) { ?> <h1><?php echo $this->escape($this->params->get('page_title')); ?> </h1> <?php } } else { ?> <?php if ($this->params->get('show_page_title', 1)) { ?> <div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>
function getMemberships() { $return = array(); $categories = $this->_getList("SELECT name, id FROM #__rsmembership_categories ORDER BY `ordering` ASC"); $memberships = $this->_getList("SELECT id, name, category_id FROM #__rsmembership_memberships ORDER BY `ordering` ASC"); $tmp = new stdClass(); $tmp->id = 0; $tmp->name = JText::_('RSM_NO_CATEGORY'); if (is_array($categories)) { array_unshift($categories, $tmp); } foreach ($categories as $category) { $return[] = JHTML::_('select.optgroup', $category->name); foreach ($memberships as $membership) { if ($membership->category_id != $category->id) { continue; } $return[] = JHTML::_('select.option', $membership->id, $membership->name); } if (!RSMembershipHelper::isJ16()) { $optgroup = new stdClass(); $optgroup->value = '</OPTGROUP>'; $optgroup->text = ''; $return[] = $optgroup; } } return $return; }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect('index.php?option=' . $user_option . '&view=login&return=' . $link); } $this->_getMembership(); $this->getParentFolders(); $this->getExtraParentFolders(); // let's see if the membership is active if ($this->_data->status > 0) { return; } // let's get the path $path = JRequest::getVar('path'); if (!empty($path)) { $path = explode("|", $path); // extract the parent folder's id $parent_id = (int) $path[0]; if (empty($parent_id)) { $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&view=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)) { $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&view=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) { $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&view=mymemberships', false)); } // let's see if we've requested a download $task = JRequest::getVar('task'); if ($task == 'download') { // check if path exists and is a file if (is_file($path)) { // check if we need to agree to terms first $this->_db->setQuery("SELECT `term_id` FROM #__rsmembership_files WHERE `path`='" . $this->_db->getEscaped($path) . "'"); $term_id = $this->_db->loadResult(); if (!empty($term_id)) { $row =& JTable::getInstance('RSMembership_Terms', 'Table'); $row->load($term_id); if (!$row->published) { $term_id = 0; } } $agree = JRequest::getVar('agree'); 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('RSMembership_Logs', 'Table'); $date = JFactory::getDate(); $row->date = $date->toUnix(); $row->user_id = $user->get('id'); $row->path = $path; $row->ip = $_SERVER['REMOTE_ADDR']; $row->store(); exit; } } else { $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&view=mymemberships', false)); } } else { // check if the path exists and is a folder if (is_dir($path)) { $this->_folder = $path; if (substr($this->_folder, -1) == DS) { $this->_folder = substr($this->_folder, 0, -1); } } else { $mainframe->redirect(JRoute::_('index.php?option=com_rsmembership&view=mymemberships', false)); } } } $this->_getDBFiles(); }
<td width="30%" height="40"><label for="remember"><?php echo JText::_('RSM_REMEMBER_ME'); ?> Yes Please.</label></td> <td><input type="checkbox" id="remember" name="remember" class="inputbox" value="yes" alt="Remember Me" /></td> </tr> <?php } ?> </table> <input type="submit" name="Submit" class="button" value="<?php echo JText::_('RSM_LOGIN'); ?> " /> <?php echo $this->token; ?> <input type="hidden" name="option" value="<?php echo RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; ?> " /> <input type="hidden" name="task" value="<?php echo RSMembershipHelper::isJ16() ? 'user.login' : 'login'; ?> " /> <input type="hidden" name="return" value="<?php echo $this->return; ?> " /> </fieldset> </form>
function unpatchmenu() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); jimport('joomla.filesystem.file'); $menu = RSMembershipHelper::getPatchFile('menu'); $buffer = JFile::read($menu); if (strpos($buffer, 'RSMembershipHelper') === false) { return $this->setRedirect('index.php?option=com_rsmembership&view=configuration&tabposition=1', JText::_('RSM_PATCH_NOT_APPLIED')); } if (!is_writable($menu)) { JError::raiseWarning(500, JText::_('RSM_PATCH_NOT_WRITABLE')); return $this->setRedirect('index.php?option=com_rsmembership&view=configuration&tabposition=1'); } if (RSMembershipHelper::isJ16()) { if (RSMembershipHelper::isJ25()) { $with = "\$items \t\t= \$menu->getItems('menutype', \$params->get('menutype'));"; } else { $with = "\$items \t\t= \$menu->getItems('menutype',\$params->get('menutype'));"; } $replace = $with . "\n" . "\t\t" . "if (file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_rsmembership'.DS.'helpers'.DS.'rsmembership.php')) {" . "\n" . "\t\t\t" . "include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_rsmembership'.DS.'helpers'.DS.'rsmembership.php');" . "\n" . "\t\t\t" . "RSMembershipHelper::checkMenuShared(\$items);" . "\n" . "\t\t" . "}" . "\n"; $buffer = str_replace($replace, $with, $buffer); } else { $possibles = array("\n" . "\t\t\t" . "RSMembershipHelper::checkMenuShared(&\$rows);", "\n" . "\t\t\t" . "RSMembershipHelper::checkMenuShared(\$rows);"); foreach ($possibles as $possible) { $with = "\$rows = \$items->getItems('menutype', \$params->get('menutype'));"; $replace = $with . "\n" . "\t\t" . "if (file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_rsmembership'.DS.'helpers'.DS.'rsmembership.php')) {" . "\n" . "\t\t\t" . "include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_rsmembership'.DS.'helpers'.DS.'rsmembership.php');" . $possible . "\n" . "\t\t" . "}" . "\n"; $buffer = str_replace($replace, $with, $buffer); } } if (JFile::write($menu, $buffer)) { return $this->setRedirect('index.php?option=com_rsmembership&view=configuration', JText::_('RSM_PATCH_REMOVED_SUCCESS')); } JError::raiseWarning(500, JText::_('RSM_PATCH_NOT_WRITABLE')); $this->setRedirect('index.php?option=com_rsmembership&view=configuration&tabposition=1'); }
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); }
function addToRSMail($membership_id, $user_id, $email, $user_data) { if (empty($membership_id)) { return false; } jimport('joomla.html.parameter'); if (file_exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rsmail' . DS . 'rsmail.php')) { $email = strtolower($email); // Load the language file $lang =& JFactory::getLanguage(); $lang->load('com_rsmail', JPATH_ADMINISTRATOR); $lang->load('com_rsmail', JPATH_SITE); $tag = $lang->getTag(); $db =& JFactory::getDBO(); $db->setQuery("SELECT IdList, params FROM #__rsmail_integrations WHERE `IntegrationType`='rsmembership'"); $integrations = $db->loadObjectList(); if ($integrations) { foreach ($integrations as $detail) { $reg =& JRegistry::getInstance(''); if (RSMembershipHelper::isJ16()) { $reg->loadJSON($detail->params); } else { $reg->loadINI($detail->params); } $params = $reg->toObject(); if ($params->membership_id == $membership_id && $detail->IdList > 0) { $db->setQuery("SELECT * FROM `#__rsmail_config`"); $rsmailConfigDb = $db->loadObjectList(); $rsmailConfig = array(); foreach ($rsmailConfigDb as $rowConfig) { $rsmailConfig[$rowConfig->ConfigName] = $rowConfig->ConfigValue; } $db->setQuery("SELECT COUNT(IdSubscriber) FROM #__rsmail_subscribers WHERE IdList = " . (int) $detail->IdList . " AND SubscriberEmail = '" . $db->getEscaped($email) . "'"); $alreadySubscribed = $db->loadResult(); if (!$alreadySubscribed) { //set the status of the subscriber $published = 0; $published = $rsmailConfig['confirm_email'] == 0 ? 1 : 0; //lets add the subscriber into RSMail! $date = JFactory::getDate(); $unix = $date->toUnix(); $db->setQuery("INSERT INTO #__rsmail_subscribers SET SubscriberEmail = '" . $db->getEscaped($email) . "' , IdList = " . (int) $detail->IdList . " , DateSubscribed = " . $unix . " , UserId = " . (int) $user_id . " , SubscriberIp = '" . $db->getEscaped(@$_SERVER['REMOTE_ADDR']) . "' , published = " . $published); $db->query(); $subscriberId = $db->insertid(); foreach ($params as $prop => $param) { if ($param == JText::_('RSM_IGNORE')) { continue; } if ($prop == 'membership_id') { continue; } if (!isset($user_data->fields[$prop])) { continue; } if (is_array($user_data->fields[$prop])) { $user_data->fields[$prop] = implode(', ', $user_data->fields[$prop]); } $db->setQuery("INSERT INTO #__rsmail_subscriber_details SET IdSubscriber = " . (int) $subscriberId . " , IdList = " . (int) $detail->IdList . " , FieldName = '" . $db->getEscaped($param) . "' , FieldValue = '" . $db->getEscaped($user_data->fields[$prop]) . "'"); $db->query(); } //send the confirmation email if ($published == 0) { $db->setQuery("SELECT ListName FROM #__rsmail_lists WHERE IdList = " . (int) $detail->IdList); $listName = $db->loadResult(); $to = $email; $from = $rsmailConfig['confirm_from']; $fromName = $rsmailConfig['confirm_fromname']; $subject = $rsmailConfig['confirm_subject']; $type = $rsmailConfig['confirm_type']; $db->setQuery("SELECT `text` FROM #__rsmail_emails WHERE `type` = 'confirmation' AND lang = '" . $db->getEscaped($tag) . "' "); $message = $db->loadResult(); $secret = md5($detail->IdList . $subscriberId . $db->getEscaped($email)); $secretLink = '<a href="' . JURI::root() . 'index.php?option=com_rsmail&task=activate&secret=' . $secret . '">' . JText::_('RSM_CLICK_TO_ACTIVATE') . '</a>'; $bad = array('{newsletter}', '{email}', '{activationlink}'); $good = array($listName, $to, $secretLink); $subject = str_replace($bad, $good, $subject); $message = str_replace($bad, $good, $message); JUtility::sendMail($from, $fromName, $to, $subject, $message, $type); } return true; } return null; } } } } return false; }