Пример #1
0
 function getInput()
 {
     $app = JFactory::getApplication();
     require_once JPATH_SITE . '/components/com_jms/helpers/MCAPI.class.php';
     require_once JPATH_SITE . '/components/com_jms/helpers/MCauth.php';
     $MCauth = new MCauth();
     // Get the component config/params object.
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $api_key = $params->get($paramsPrefix . 'MCapi');
     if ($MCauth->MCauth()) {
         $text = '<div style="margin: 8px 0; float: left;">' . $api_key . '</div>';
     } else {
         $text = '<div style="margin: 8px 0; float: left;">';
         $text .= '<span style="color: red;">';
         $text .= 'No valid API Key or Joomlamailer Extension is not installed. ';
         $text .= '</span>';
         $text .= 'If Joomlamailer is installed';
         $text .= '<a href="index.php?option=com_joomailermailchimpintegration">';
         $text .= ' click here ';
         $text .= '</a>';
         $text .= 'to edit Configurations.<br />';
         $text .= '</div>';
     }
     return $text;
 }
 function display($tpl = null)
 {
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if (!$MCapi || !$MCauth->MCauth()) {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPDATE'), 'MC_logo_48.png');
         $user =& JFactory::getUser();
         if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
             JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
             JToolBarHelper::spacer();
         }
     } else {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPDATE'), 'MC_logo_48.png');
         $task = JRequest::getCmd('task');
         $force = $task == 'force';
         // Load the model
         $model =& $this->getModel();
         $updates =& $model->getUpdates($force);
         $this->assignRef('updates', $updates);
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #3
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     // Initialize variables.
     $options = array();
     $app = JFactory::getApplication();
     require_once JPATH_SITE . '/components/com_jms/helpers/MCAPI.class.php';
     require_once JPATH_SITE . '/components/com_jms/helpers/MCauth.php';
     $MCauth = new MCauth();
     // Get the component config/params object.
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $api_key = $params->get($paramsPrefix . 'MCapi');
     if ($MCauth->MCauth()) {
         $api = new MCAPI($api_key);
         $retval = $api->lists();
         if (is_array($retval['data'])) {
             foreach ($retval['data'] as $list) {
                 $options[] = JHTML::_('select.option', $list['id'], JText::_($list['name']));
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
 function display($tpl = null)
 {
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if (!$MCapi || !$MCauth->MCauth()) {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPLOAD_TEMPLATE'), 'MC_logo_48.png');
         $user =& JFactory::getUser();
         if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
             JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
             JToolBarHelper::spacer();
         }
     } else {
         $layout = JRequest::getVar('layout', 0, '', 'string');
         if ($layout == 'upload') {
             JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPLOAD_TEMPLATE'), 'MC_logo_48.png');
             JToolBarHelper::custom('start_upload', 'upload_32', 'upload_32', 'JM_START_UPLOAD', false, false);
             JToolBarHelper::spacer();
             JToolBarHelper::cancel();
             JToolBarHelper::spacer();
         } else {
             if ($layout == 'edit') {
                 JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_EDIT_TEMPLATE'), 'MC_logo_48.png');
                 JToolBarHelper::save();
                 JToolBarHelper::spacer();
                 JToolBarHelper::cancel();
                 JToolBarHelper::spacer();
                 // Get data from the model
                 $palettes =& $this->get('Palettes');
                 $this->assignRef('palettes', $palettes);
             } else {
                 JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_EMAIL_TEMPLATES'), 'MC_logo_48.png');
                 JToolBarHelper::addNewX('add', 'JM_UPLOAD_TEMPLATE');
                 JToolBarHelper::spacer();
                 JToolBarHelper::editListX();
                 JToolBarHelper::spacer();
                 JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THIS_TEMPLATE'));
                 JToolBarHelper::spacer();
                 $document =& JFactory::getDocument();
                 $document->addScript(JURI::base() . 'components/com_joomailermailchimpintegration/assets/js/download.js');
             }
         }
     }
     $items =& $this->get('Data');
     $this->assignRef('items', $items);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
 function display($tpl = null)
 {
     if (!JOOMLAMAILER_MANAGE_REPORTS) {
         $mainframe =& JFactory::getApplication();
         $mainframe->redirect('index.php?option=com_joomailermailchimpintegration', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_ANALYTICS_360'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $a360_has_key = false;
     $a360_api_key = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     $a360_ga_profile_id = $params->get($paramsPrefix . 'gprofileid');
     $gusername = $params->get($paramsPrefix . 'gusername');
     $gpassword = $params->get($paramsPrefix . 'gpw');
     $gapi = new gapi($gusername, $gpassword);
     if ($a360_api_key && $a360_ga_profile_id && $gusername && $gpassword && $MCauth->MCauth() && $gapi->auth_token) {
         if (!isset($_SESSION['gtoken'])) {
             $_SESSION['gtoken'] = $gapi->auth_token;
         }
         $a360_ga_token = $_SESSION['gtoken'];
         if ($a360_api_key && !empty($a360_api_key)) {
             $a360_has_key = true;
         }
         $this->assignRef('a360_has_key', $a360_has_key);
         $a360_list_options = $this->a360_dashboard($a360_api_key, $a360_ga_token, $a360_has_key);
         $this->assignRef('a360_list_options', $a360_list_options);
         $this->assignRef('a360_ga_token', $a360_ga_token);
         $doc =& JFactory::getDocument();
         $doc->addStyleSheet(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'css' . DS . 'a360' . DS . 'a360.css');
         $doc->addStyleSheet(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'css' . DS . 'a360' . DS . 'datePicker.css');
         $doc->addScript(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'js' . DS . 'analytics360' . DS . 'a360.js');
         $doc->addScript(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'js' . DS . 'analytics360' . DS . 'date.js');
         $doc->addScript(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'js' . DS . 'analytics360' . DS . 'date-coolite.js');
         $doc->addScript(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'js' . DS . 'analytics360' . DS . 'jquery.datePicker.js');
         $doc->addScript(JURI::base() . 'components' . DS . 'com_joomailermailchimpintegration' . DS . 'assets' . DS . 'js' . DS . 'analytics360' . DS . 'jquery.datePickerMultiMonth.js');
         $doc->addScript("http://www.google.com/jsapi");
         $doc->addScriptDeclaration('if (typeof google !== \'undefined\') {google.load("gdata", "1");google.load("visualization", "1", {"packages": ["areachart", "table", "piechart", "imagesparkline", "geomap", "columnchart"]});}');
         $doc->addScriptDeclaration('var MCapikey = "' . $params->get('MCapi') . '";');
         parent::display($tpl);
         require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
     } else {
         $mainframe =& JFactory::getApplication();
         $mainframe->redirect('index.php?option=com_joomailermailchimpintegration&view=campaigns', JText::_('JM_NO_ANALYTICS_LOGIN_SUPPLIED'), 'error');
     }
 }
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SEND_CAMPAIGN'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if (!$MCapi) {
         $user =& JFactory::getUser();
         if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
             JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
             JToolBarHelper::spacer();
         }
     } else {
         if (!$MCauth->MCauth()) {
             $user =& JFactory::getUser();
             if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
                 JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
                 JToolBarHelper::spacer();
             }
         } else {
             $AECambraVM =& $this->get('AECambraVM');
             $this->assignRef('AECambraVM', $AECambraVM);
             if ($AECambraVM) {
                 JToolBarHelper::custom('syncHotness', 'hotness_32', 'hotness_32', 'Sync Hotness', false, false);
                 JToolBarHelper::spacer();
             }
             if (JRequest::getVar('campaign', 0)) {
                 JToolBarHelper::custom('send', 'send', 'send', 'JM_SEND', false, false);
                 JToolBarHelper::spacer();
             }
             // Get data from the model
             $drafts =& $this->get('Drafts');
             $this->assignRef('drafts', $drafts);
             $campaigns =& $this->get('Campaigns');
             $this->assignRef('campaigns', $campaigns);
             $clientDetails =& $this->get('ClientDetails');
             $this->assignRef('clientDetails', $clientDetails);
             $MClists =& $this->get('MClists');
             $this->assignRef('MClists', $MClists);
         }
     }
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUBSCRIBERS'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi && $MCauth->MCauth()) {
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'JM_LISTS', false, false);
         JToolBarHelper::spacer();
         if (JRequest::getVar('type') == 's') {
             JToolBarHelper::custom('unsubscribe', 'unsubscribe', 'unsubscribe', 'JM_UNSUBSCRIBE', true, false);
             JToolBarHelper::spacer();
             JToolBarHelper::custom('delete', 'unsubscribe', 'unsubscribe', 'JM_DELETE', true, false);
             JToolBarHelper::spacer();
         } else {
             if (JRequest::getVar('type') == 'u') {
                 //		JToolBarHelper::custom( 'resubscribe', 'resubscribe', 'resubscribe', 'Resubscribe', false, false );
             }
         }
     }
     // Get data from the model
     $active =& $this->get('Active');
     $this->assignRef('active', $active);
     $listdetails =& $this->get('ListDetails');
     $this->assignRef('listDetails', $listdetails);
     $total =& $this->get('Total');
     $this->assignRef('total', $total);
     $users =& $this->get('Users');
     $this->assignRef('users', $users);
     //		if($total<$limit) $limit = $total;
     $this->assignRef('limitstart', $limitstart);
     $this->assignRef('limit', $limit);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #8
0
	    function fetchElement($name, $value, &$node, $control_name)
	    {
		jimport( 'joomla.filesystem.file' );
		$option = JRequest::getCmd('option');
		    $mainframe = & JFactory::getApplication();
		    if(!JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php')) {
			    $mainframe->redirect('index.php',JText::_('INSTALLJOOMAILER'),'error');
		    } else {
			    $moduleParams = new JParameter( $this->_parent->_raw );
			    $value = $moduleParams->get('listid');
			    require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php');
			    require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'helpers'.DS.'MCauth.php' );
			    $params = & JComponentHelper::getParams('com_joomailermailchimpintegration');
			    $apikey = $params->get('MCapi');
			    $MCauth = new MCauth();
			    if( !$apikey || !$MCauth->MCauth() ) {
				    $mainframe->redirect('index.php?option=com_joomailermailchimpintegration&view=main',JText::_('APIKEY ERROR'),'error');
			    }
			    $api = new joomlamailerMCAPI($apikey);
			    $lists = $api->lists();
			    $key = 'id';
			    $val = 'name';
			    $options[] = array($key=>'',$val=>JText::_('JM_PLEASE_SELECT_A_LIST'));
			    foreach ($lists as $list){
				$options[]=array($key=>$list[$key],$val=>$list[$val]);
			    }

			    if( $option == 'com_joomfish' ){
				$submitTask = 'translate.';
			    } else {
				$submitTask = '';
			    }
			    $attribs = "onchange='submitbutton(\"".$submitTask."apply\")'";
			   
			    $name = 'listid';
			    if($options){
				    $content =  JHTML::_('select.genericlist',$options, $control_name.'[listid]', $attribs, $key, $val, $value, $control_name.$name);
			    }

			    return $content;
		    }
	    }
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER'), 'MC_logo_48.png');
     $bar =& JToolBar::getInstance('toolbar');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     JToolBarHelper::custom('extensions', 'extensions', 'extensions', 'JM_EXTENSIONS', false, false);
     JToolBarHelper::spacer();
     if ($MCapi && $MCauth->MCauth()) {
         $subdomain = explode('-', $MCapi);
         $url = 'https://' . $subdomain[1] . '.admin.mailchimp.com';
         if (JOOMLAMAILER_CREATE_DRAFTS || JOOMLAMAILER_MANAGE_CAMPAIGNS) {
             JToolBarHelper::custom('templates', 'templates', 'templates', 'JM_EMAIL_TEMPLATES', false, false);
             JToolBarHelper::spacer();
         }
         $bar->appendButton('Popup', 'account-settings', 'JM_ACCOUNT_SETTINGS', $url, 990, 550);
         JToolBarHelper::spacer();
     } else {
         $url = 'https://login.mailchimp.com/';
         $bar->appendButton('Popup', 'account-settings', 'JM_ACCOUNT_SETTINGS', $url, 990, 550);
         JToolBarHelper::spacer();
     }
     $user =& JFactory::getUser();
     if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
         JToolBarHelper::preferences('com_joomailermailchimpintegration', '450');
         JToolBarHelper::spacer();
     }
     if ($MCapi && $MCauth->MCauth()) {
         $details =& $this->get('ClientDetails');
         $this->assignRef('details', $details);
         $drafts =& $this->get('Drafts');
         $this->assignRef('drafts', $drafts);
         $campaigns =& $this->get('Campaigns');
         $this->assignRef('campaigns', $campaigns);
         $chimpChatter =& $this->get('ChimpChatter');
         $this->assignRef('chimpChatter', $chimpChatter);
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #10
0
 function display($tpl = null)
 {
     if (!JOOMLAMAILER_MANAGE_LISTS) {
         $mainframe =& JFactory::getApplication();
         $mainframe->redirect('index.php?option=com_joomailermailchimpintegration', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_LISTS'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi && $MCauth->MCauth()) {
         JToolBarHelper::custom('addUsers', 'addUsers', 'addUsers', 'JM_ADD_USERS', false, false);
         JToolBarHelper::spacer();
     }
     // Get data from the model
     $items =& $this->get('Data');
     $this->assignRef('items', $items);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #11
0
	    function fetchElement($name, $value, &$node, $control_name)
	    {
		jimport( 'joomla.filesystem.file' );
		$mainframe = & JFactory::getApplication();
		if(!JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php')) {
		    $mainframe->redirect('index.php',JText::_('JM_INSTALLJOOMAILER'),'error');
		} else {
		    jimport('joomla.plugin.plugin');
		    $pluginParams = new JParameter( $this->_parent->_raw );
		    $value = $pluginParams->get('listid');
		    require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'libraries'.DS.'MCAPI.class.php');
		    require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomailermailchimpintegration'.DS.'helpers'.DS.'MCauth.php' );
		    $params =& JComponentHelper::getParams( 'com_joomailermailchimpintegration' );
		    $paramsPrefix = (version_compare(JVERSION,'1.6.0','ge')) ? 'params.' : '';
		    $MCapi = $params->get( $paramsPrefix.'MCapi' );
		    $MCauth = new MCauth();
		    if( !$MCapi || !$MCauth->MCauth() ) {
			$mainframe->redirect('index.php?option=com_joomailermailchimpintegration&view=main',JText::_('JM_INVALID_API_KEY'),'error');
		    }
		    $api = new joomlamailerMCAPI($MCapi);
		    $lists = $api->lists();
		    $key = 'id';
		    $val = 'name';
		    $options[] = array($key=>'',$val=>JText::_('JM_PLEASE_SELECT_A_LIST'));
		    foreach ($lists as $list){
			$options[]=array($key=>$list[$key],$val=>$list[$val]);
		    }

		    $attribs = "onchange='submitbutton(\"apply\")'";
		    $control_name = 'params';
		    $name = 'listid';
		    if($options){
			$content =  JHTML::_('select.genericlist',$options, 'params[listid]', $attribs, $key, $val, $value, $control_name.$name);
		    }

		    return $content;
		}
	    }
Пример #12
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $model =& $this->getModel('sync');
     $layout = JRequest::getVar('layout', 'default');
     if ($layout == 'default') {
         $db =& JFactory::getDBO();
         $filter_order = $mainframe->getUserStateFromRequest("{$option}.filter_order", 'filter_order', 'a.name', 'cmd');
         $filter_order_Dir = $mainframe->getUserStateFromRequest("{$option}.filter_order_Dir", 'filter_order_Dir', '', 'word');
         $filter_type = $mainframe->getUserStateFromRequest("{$option}.filter_type", 'filter_type', 0, 'string');
         $filter_status = $mainframe->getUserStateFromRequest("{$option}.filter_status", 'filter_status', 0, 'string');
         $filter_logged = $mainframe->getUserStateFromRequest("{$option}.filter_logged", 'filter_logged', 0, 'int');
         $filter_date = $mainframe->getUserStateFromRequest("{$option}.filter_date", 'filter_date', '', 'string');
         $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
         $search = JString::strtolower($search);
         $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
         $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
         $where = array();
         if (isset($search) && $search != '') {
             $searchEscaped = $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
             $where[] = 'a.username LIKE ' . $searchEscaped . ' OR a.email LIKE ' . $searchEscaped . ' OR a.name LIKE ' . $searchEscaped;
         }
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             if ($filter_type) {
                 if ($filter_type == 1) {
                     $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' ';
                 } else {
                     if ($filter_type == 'Public Backend') {
                         $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' ';
                     } else {
                         $where[] = ' um.group_id = ' . $db->Quote($filter_type) . ' ';
                     }
                 }
             }
         } else {
             if ($filter_type) {
                 if ($filter_type == 'Public Frontend') {
                     $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' ';
                 } else {
                     if ($filter_type == 'Public Backend') {
                         $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' ';
                     } else {
                         $where[] = 'a.usertype = LOWER( ' . $db->Quote($filter_type) . ' ) ';
                     }
                 }
             }
         }
         $where[] = ' a.block = 0 ';
         $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
         $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = 'SELECT COUNT(a.id)' . ' FROM #__users AS a' . ' INNER JOIN #__user_usergroup_map AS um ON um.user_id = a.id' . ' INNER JOIN #__usergroups AS ug ON ug.id = um.group_id' . $where;
         } else {
             $query = 'SELECT COUNT(a.id)' . ' FROM #__users AS a' . $where;
         }
         $db->setQuery($query);
         $total = $db->loadResult();
         jimport('joomla.html.pagination');
         $pagination = new JPagination($total, $limitstart, $limit);
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $query = 'SELECT a.*, ug.title AS groupname' . ' FROM #__users AS a' . ' INNER JOIN #__user_usergroup_map AS um ON um.user_id = a.id' . ' INNER JOIN #__usergroups AS ug ON ug.id = um.group_id' . $where . ' GROUP BY a.id' . $orderby;
         } else {
             $query = 'SELECT a.*, g.name AS groupname' . ' FROM #__users AS a' . ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' . ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' . ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' . $where . ' GROUP BY a.id' . $orderby;
         }
         $db->setQuery($query, $pagination->limitstart, $pagination->limit);
         $rows = $db->loadObjectList();
         // get list of Groups for dropdown filter
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             // Include the component HTML helpers.
             require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
             $dropdown = '<select name="filter_type" id="filter_type" class="inputbox" onchange="this.form.submit()">';
             $dropdown .= '<option value="">- ' . JText::_('JM_USERGROUP') . ' -</option>';
             $dropdown .= JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $filter_type);
             $dropdown .= '</select>';
             $lists['type'] = $dropdown;
         } else {
             $query = 'SELECT name AS value, name AS text' . ' FROM #__core_acl_aro_groups' . ' WHERE name != "ROOT"' . ' AND name != "USERS"';
             $db->setQuery($query);
             $types[] = JHtml::_('select.option', '0', '- ' . JText::_('JM_USERGROUP') . ' -');
             foreach ($db->loadObjectList() as $obj) {
                 $types[] = JHtml::_('select.option', $obj->value, JText::_($obj->text));
             }
             $lists['type'] = JHtml::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "{$filter_type}");
         }
         // table ordering
         $lists['order_Dir'] = $filter_order_Dir;
         $lists['order'] = $filter_order;
         // search filter
         $lists['search'] = $search;
         //date filter
         if ($filter_date == '') {
             $filter_date = JText::_('JM_LAST_VISIT_AFTER');
         }
         JHtml::_('behavior.calendar');
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $attr = array('size' => '16', 'style' => 'top:0;');
         } else {
             $attr = array('size' => '16', 'style' => 'top:0;', 'readonly' => 'readonly', 'onclick' => "showCalendar('filter_date', '%Y-%m-%d')");
         }
         $lists['filter_date'] = JHtml::_('calendar', $filter_date, 'filter_date', 'filter_date', '%Y-%m-%d', $attr);
         $this->assignRef('lists', $lists);
         $this->assignRef('pagination', $pagination);
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_ADD_USERS'), 'MC_logo_48.png');
     } else {
         if ($layout == 'sugar') {
             JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUGARCRM_CONFIGURATION'), 'MC_logo_48.png');
         } else {
             if ($layout == 'highrise') {
                 JToolBarHelper::title(JText::_('JM_NEWSLETTER_HIGHRISE_CONFIGURATION'), 'MC_logo_48.png');
             }
         }
     }
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi && $MCauth->MCauth()) {
         if ($layout == 'default') {
             if ($params->get($paramsPrefix . 'sugar_name') && $params->get($paramsPrefix . 'sugar_pwd')) {
                 JToolBarHelper::custom('sync_sugar', 'sync_sugar', 'sync_sugar', 'JM_ADD_TO_SUGAR', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('sugar', 'sync_sugar', 'sync_sugar', 'JM_SUGAR_CONFIG', false, false);
                 JToolBarHelper::spacer();
             }
             if ($params->get($paramsPrefix . 'highrise_url') && $params->get($paramsPrefix . 'highrise_api_token')) {
                 JToolBarHelper::custom('sync_highrise', 'sync_highrise', 'sync_highrise', 'JM_ADD_TO_HIGHRISE', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('highrise', 'sync_highrise', 'sync_highrise', 'JM_HIGHRISE_CONFIG', false, false);
                 JToolBarHelper::spacer();
             }
             JToolBarHelper::custom('mailchimp', 'sync', 'sync', 'JM_ADD_TO_MAILCHIMP', false, false);
             JToolBarHelper::spacer();
         } else {
             if ($layout == 'sugar') {
                 JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                 JToolBarHelper::spacer();
                 JToolBarHelper::custom('setConfig', 'sync_sugar', 'sync_sugar', 'JM_SAVE_CONFIG', false, false);
                 JToolBarHelper::spacer();
             } else {
                 if ($layout == 'highrise') {
                     JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                     JToolBarHelper::spacer();
                     JToolBarHelper::custom('setConfig', 'sync_highrise', 'sync_highrise', 'JM_SAVE_CONFIG', false, false);
                     JToolBarHelper::spacer();
                 }
             }
         }
     }
     if ($layout == 'default') {
         // Get data from the model
         $items =& $this->get('Data');
         $this->assignRef('items', $items);
         $subscriberLists =& $this->get('SubscriberLists');
         $this->assignRef('subscriberLists', $subscriberLists);
         $suppressed =& $this->get('Suppressed');
         $this->assignRef('suppressed', $suppressed);
         $groups =& $this->get('Groups');
         $this->assignRef('groups', $groups);
         $CRMusers =& $this->get('CRMusers');
         $this->assignRef('CRMusers', $CRMusers);
     } else {
         if ($layout == 'sugar') {
             $sugarFields =& $this->get('SugarFields');
             $this->assignRef('sugarFields', $sugarFields);
             $JSFields =& $this->get('JSFields');
             $this->assignRef('JSFields', $JSFields);
             $CBFields =& $this->get('CBFields');
             $this->assignRef('CBFields', $CBFields);
             $config =& $model->getConfig('sugar');
             $this->assignRef('config', $config);
         } else {
             if ($layout == 'highrise') {
                 $JSFields =& $this->get('JSFields');
                 $this->assignRef('JSFields', $JSFields);
                 $CBFields =& $this->get('CBFields');
                 $this->assignRef('CBFields', $CBFields);
                 $config =& $model->getConfig('highrise');
                 $this->assignRef('config', $config);
             }
         }
     }
     $total =& $this->get('TotalUsers');
     $this->assignRef('total', $total);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #13
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 **/
// no direct access
defined('_JEXEC') or die('Restricted Access');
JHTML::_('behavior.modal');
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'TwitterZoid.php';
$model =& $this->getModel();
$doc =& JFactory::getDocument();
$params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
$paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
$MCapi = $params->get($paramsPrefix . 'MCapi');
$MCauth = new MCauth();
if (!$MCapi) {
    echo $MCauth->apiKeyMissing();
} else {
    if (!$MCauth->MCauth()) {
        echo $MCauth->apiKeyMissing(1);
    } else {
        if (!isset($this->items)) {
            // no campaigns sent yet?
            echo JText::_('JM_NO_RECENT_CAMPAIGNS');
            $i = $n = 1;
        } else {
            $AIM = false;
            $clientDetails = $model->getClientDetails();
            foreach ($clientDetails['modules'] as $mod) {
                if ($mod['name'] == 'AIM Reports') {
Пример #14
0
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $model = $this->getModel();
     $mainframe =& JFactory::getApplication();
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUBSCRIBERS'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('MCapi');
     $MCauth = new MCauth();
     $AIM = true;
     $clientDetails = $model->getClientDetails();
     if ($MCapi && $MCauth->MCauth()) {
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'Lists', false, false);
         JToolBarHelper::spacer();
         if (JRequest::getVar('type') == 's') {
             JToolBarHelper::custom('unsubscribe', 'unsubscribe', 'unsubscribe', 'Unsubscribe', true, false);
             JToolBarHelper::spacer();
             JToolBarHelper::custom('delete', 'unsubscribe', 'unsubscribe', 'Delete', true, false);
             JToolBarHelper::spacer();
         } else {
             if (JRequest::getVar('type') == 'u') {
                 //				JToolBarHelper::custom( 'resubscribe', 'resubscribe', 'resubscribe', 'Resubscribe', false, false );
             }
         }
     }
     $userid = JRequest::getVar('uid', 0, 'get', 'string');
     $listid = JRequest::getVar('listid', 0, 'get', 'string');
     $email = JRequest::getVar('email', 0, '', 'string', JREQUEST_ALLOWRAW);
     $memberInfo = $model->getListsForEmail();
     foreach ($memberInfo['lists'] as $key => $list) {
         $member_rating = $memberInfo['lists'][$key]['member_rating'];
         break;
     }
     if ($userid) {
         $user =& JFactory::getUser($userid);
     }
     //TODO convert $start to GMT using JConfig and tzoffset
     $start = $user->registerDate;
     //$campaigns = $model->MC_object()->campaigns(array('sendtime_start'=>$start, 'list_id'=>$listid));
     $campaigns = $model->MC_object()->campaigns(array('sendtime_start' => $start, 'status' => 'sent'));
     //$lists = $model->MC_object()->listsForEmail($email);
     $stats = array();
     foreach ($campaigns as $campaign) {
         $listmemberinfo = $model->MC_object()->listMemberInfo($campaign['list_id'], $email);
         //Check if this email was ever subscribed to this list
         if ($listmemberinfo) {
             //if(in_array($campaign['list_id'], $lists)) {
             $clicks = 0;
             if ($AIM) {
                 $clickStats = $model->campaignEmailStatsAIM($campaign['id'], $user->email);
                 if (isset($clickStats[0])) {
                     foreach ($clickStats as $cs) {
                         if ($cs['action'] == 'click') {
                             $clicks++;
                         }
                     }
                 }
             }
             $stats[$campaign['id']]['clicks'] = $clicks;
             $opens = $model->MC_object()->campaignOpenedAIM($campaign['id']);
             if ($opens) {
                 foreach ($opens as $o) {
                     if ($o['email'] == $email) {
                         $stats[$campaign['id']]['opens'] = $o['open_count'];
                         $stats[$campaign['id']]['received'] = true;
                     } else {
                         $stats[$campaign['id']]['opens'] = 0;
                         $softbounces = $model->getSoftBounces($campaign['id']);
                         $hardbounces = $model->getHardBounces($campaign['id']);
                         $bounces = array_merge($softbounces, $hardbounces);
                         $stats[$campaign['id']]['received'] = in_array($email, $bounces) ? 0 : 1;
                     }
                 }
             }
             $stats[$campaign['id']]['title'] = $campaign['title'];
             $stats[$campaign['id']]['date'] = $campaign['send_time'];
             $stats[$campaign['id']]['segment_text'] = $campaign['segment_text'];
             $stats[$campaign['id']]['list_sub'] = $listmemberinfo['timestamp'];
         }
     }
     $cbpath = JPATH_ADMINISTRATOR . DS . 'components/com_comprofiler/admin.comprofiler.php';
     $jspath = JPATH_ADMINISTRATOR . DS . 'components/com_community/admin.community.php';
     $db =& JFactory::getDBO();
     $avatar = JURI::base() . 'components/com_joomailermailchimpintegration/assets/images/mailchimp_avatar.jpg';
     $gravatar_default = $avatar;
     if (JFile::exists($cbpath)) {
         //community builder is being used
         $query = 'SELECT avatar FROM #__comprofiler WHERE id=' . $userid;
         $db->setQuery($query);
         $avatarPath = $db->loadResult();
         if ($avatarPath) {
             $avatar = JURI::root() . 'images/comprofiler' . DS . $avatarPath;
         }
     } elseif (JFile::exists($jspath)) {
         //jomsocial is being used
         $query = 'SELECT avatar FROM #__community_users WHERE userid=' . $userid;
         $db->setQuery($query);
         $avatarPath = $db->loadResult();
         if ($avatarPath) {
             $avatar = JURI::root() . $avatarPath;
         }
     }
     if ($gravatar_default == $avatar) {
         $avatar = $model->getGravatar($gravatar_default);
     }
     $twitterName = $model->getTwitterName();
     $kloutScore = $model->getKloutScore();
     $this->assignRef('kloutScore', $kloutScore);
     $this->assignRef('twitterName', $twitterName);
     $facebookName = $model->getFacebookName();
     $this->assignRef('facebookName', $facebookName);
     $composite = new hotActivityComposite();
     $hotActivity = $composite->getActivity();
     $hotnessRating = $composite->getHotnessValue();
     $this->assignRef('hotnessRating', $hotnessRating);
     $this->assignRef('hotActivity', $hotActivity);
     $jomSocialGroups = $model->getJomSocialGroups();
     $totalDiscussionsOfUser = $model->getTotalJomSocialDiscussionsOfUser();
     $jomSocialDiscussions = $model->getRecentJomSocialDiscussions();
     jimport('joomla.html.pagination');
     $pagination = new JPagination(count($stats), $limitstart, $limit);
     $this->assignRef('memberRating', $member_rating);
     $this->assignRef('jomSocialGroups', $jomSocialGroups);
     $this->assignRef('jomSocialDiscussions', $jomSocialDiscussions);
     $this->assignRef('totalDiscussionsOfUser', $totalDiscussionsOfUser);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('email', $email);
     $this->assignRef('stats', $stats);
     $this->assignRef('limitstart', $limitstart);
     $this->assignRef('subscribed', $subscribed);
     $this->assignRef('user', $user);
     $this->assignRef('avatar', $avatar);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #15
0
 function display($tpl = null)
 {
     if (!JOOMLAMAILER_CREATE_DRAFTS && !JOOMLAMAILER_MANAGE_CAMPAIGNS) {
         $mainframe =& JFactory::getApplication();
         $mainframe->redirect('index.php?option=com_joomailermailchimpintegration', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_CAMPAIGNS'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi && $MCauth->MCauth()) {
         if (JOOMLAMAILER_CREATE_DRAFTS) {
             JToolBarHelper::custom('create', 'create-campaign', 'create-campaign', 'JM_CREATE_CAMPAIGN', false, false);
             JToolBarHelper::spacer();
         }
         $filter = JRequest::getVar('filter_status', 'sent', '', 'string');
         if (JOOMLAMAILER_CREATE_DRAFTS && !JOOMLAMAILER_MANAGE_CAMPAIGNS) {
             $filter = 'save';
             JRequest::setVar('filter_status', 'save');
         } else {
             if (!JOOMLAMAILER_CREATE_DRAFTS && JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                 if ($filter == 'save') {
                     JRequest::setVar('filter_status', 'sent');
                 }
             }
         }
         if ($filter == 'save') {
             if (JOOMLAMAILER_CREATE_DRAFTS) {
                 JToolBarHelper::editList();
                 JToolBarHelper::spacer();
             }
             if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                 JToolBarHelper::custom('send', 'send', 'send', 'JM_SEND', true, false);
                 JToolBarHelper::spacer();
             }
             if (JOOMLAMAILER_CREATE_DRAFTS) {
                 JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                 JToolBarHelper::spacer();
             }
         } else {
             if ($filter == 'schedule') {
                 JToolBarHelper::custom('unschedule', 'unschedule', 'unschedule', 'JM_UNSCHEDULE', true, false);
                 JToolBarHelper::spacer();
                 // you can only pause autoresponder and rss campaigns
                 //  JToolBarHelper::custom( 'pause', 'pause', 'pause', 'Pause', true, false );
                 if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                     JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                     JToolBarHelper::spacer();
                 }
             } else {
                 if ($filter == 'sent') {
                     JToolBarHelper::custom('copy', 'copy', 'copy', 'JM_REPLICATE', true, false);
                     JToolBarHelper::spacer();
                     if (JOOMLAMAILER_MANAGE_REPORTS) {
                         JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                         JToolBarHelper::spacer();
                     }
                 } else {
                     if ($filter == 'sending') {
                         if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                             JToolBarHelper::custom('pause', 'pause', 'pause', 'JM_PAUSE', true, false);
                             JToolBarHelper::spacer();
                         }
                         if (JOOMLAMAILER_MANAGE_REPORTS) {
                             JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                             JToolBarHelper::spacer();
                         }
                     } else {
                         if ($filter == 'paused') {
                             if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                                 JToolBarHelper::custom('resume', 'resume', 'resume', 'JM_RESUME', true, false);
                                 JToolBarHelper::spacer();
                             }
                             if (JOOMLAMAILER_MANAGE_REPORTS) {
                                 JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                                 JToolBarHelper::spacer();
                             }
                         }
                     }
                 }
             }
         }
     }
     if (JOOMLAMAILER_MANAGE_REPORTS) {
         $folders = $this->get('Folders');
         $undefined[0] = array('folder_id' => 0, 'name' => JText::_('JM_UNFILED'));
         $folder_id = JRequest::getVar('folder_id', 0, '', 'int');
         $folders = array_merge($undefined, $folders);
         $foldersDropDown = JHTML::_('select.genericlist', $folders, 'folder_id', 'onchange="document.adminForm.submit();"', 'folder_id', 'name', $folder_id);
         $this->assignRef('foldersDropDown', $foldersDropDown);
     }
     // Get data from the model
     $items =& $this->get('Data');
     $this->assignRef('items', $items);
     $page =& $this->get('Pagination');
     $this->assignRef('pagination', $page);
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }
Пример #16
0
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     if (!JOOMLAMAILER_CREATE_DRAFTS) {
         $mainframe->redirect('index.php?option=com_joomailermailchimpintegration', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     $model = $this->getModel();
     $sec_filter = JRequest::getVar('sec_filter', -1, '', 'int');
     $cat_filter = JRequest::getVar('cat_filter', -1, '', 'int');
     $k2cat_filter = JRequest::getVar('k2cat_filter', -1, '', 'int');
     // Get data from the model
     $pagination = $this->get('Pagination');
     $paginationK2 =& $this->get('PaginationK2');
     $this->assignRef('user', JFactory::getUser());
     $this->assignRef('lists', $this->get('Lists'));
     $this->assignRef('pagination', $pagination);
     $this->assignRef('paginationK2', $paginationK2);
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_CREATE_DRAFT'), 'MC_logo_48.png');
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
     $MCapi = $params->get($paramsPrefix . 'MCapi');
     $MCauth = new MCauth();
     if ($MCapi) {
         if (!$MCauth->MCauth()) {
             $user =& JFactory::getUser();
             if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
                 JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
                 JToolBarHelper::spacer();
             }
         } else {
             // Get data from the model
             $items = $this->get('Data');
             // apply stored article order
             $coreOrder = JRequest::getVar('coreOrder', 0, '', 'string');
             if ($coreOrder) {
                 $coreOrder = explode(';', $coreOrder);
                 unset($coreOrder[count($coreOrder) - 1]);
                 $coreArticles = array();
                 $i = 0;
                 foreach ($coreOrder as $co) {
                     foreach ($items as $c) {
                         if ($co == $c->id) {
                             $coreArticles[$i] = $c;
                         }
                     }
                     $i++;
                 }
                 if (count($coreArticles) == count($items)) {
                     $items = $coreArticles;
                 }
             }
             $this->assignRef('items', $items);
             if (!version_compare(JVERSION, '1.6.0', 'ge')) {
                 $seccat =& $this->get('seccat');
                 $this->assignRef('seccat', $seccat);
             }
             $VMproducts =& $this->get('VMproducts');
             $this->assignRef('VMproducts', $VMproducts);
             $lists =& $this->get('MClists');
             $this->assignRef('lists', $lists);
             $merge =& $this->get('MergeTags');
             $this->assignRef('merge', $merge);
             $core =& $this->get('Core');
             $this->assignRef('core', $core);
             if (version_compare(JVERSION, '1.6.0', 'ge')) {
                 $K2Installed = false;
             } else {
                 $K2Installed =& $this->get('K2Installed');
             }
             $this->assignRef('K2Installed', $K2Installed);
             if (!version_compare(JVERSION, '1.6.0', 'ge') && $K2Installed) {
                 $k2Limit = JRequest::getVar('k2Limit', $mainframe->getCfg('list_limit'), '', 'int');
                 $k2Limitstart = JRequest::getVar('k2Limitstart', 0, '', 'int');
                 $k2 = $model->getK2($k2Limitstart, $k2Limit);
                 $K2Total =& $this->get('K2Total');
                 $this->assignRef('K2Total', $K2Total);
                 //	$k2 =& $this->get('K2');
                 if (isset($k2[0])) {
                     $k2Order = JRequest::getVar('k2Order', 0, '', 'string');
                     if ($k2Order) {
                         $k2Order = explode(';', $k2Order);
                         $k2Articles = array();
                         $i = 0;
                         foreach ($k2Order as $co) {
                             $x = 0;
                             foreach ($k2 as $c) {
                                 if ($co == $c->id) {
                                     $k2Articles[$i] = $c;
                                     unset($k2[$x]);
                                 }
                                 $x++;
                             }
                             $i++;
                         }
                         $k2Articles = array_merge($k2Articles, $k2);
                         $k2 = $k2Articles;
                     }
                     $k2cat =& $this->get('k2cat');
                 } else {
                     $k2cat = false;
                 }
                 $k2Array = array();
                 $k2Articles = $k2;
                 $k2 = array();
                 if (isset($k2Articles)) {
                     foreach ($k2Articles as $c) {
                         if (!in_array($c->id, $k2Array)) {
                             $k2[] = $c;
                             $k2Array[] = $c->id;
                         }
                     }
                 }
                 $this->assignRef('k2', $k2);
                 $this->assignRef('k2cat', $k2cat);
             }
             $ImagesDropdown =& $this->get('ImagesDropdown');
             $this->assignRef('ImagesDropdown', $ImagesDropdown);
             $sec = $this->get('Sec');
             $secDropDown = JHTML::_('select.genericlist', $sec, 'sec_filter', 'onchange="document.adminForm.cat_filter.selectedIndex=\'\';document.adminForm.submit();"', 'id', 'title', $sec_filter);
             $this->assignRef('secDropDown', $secDropDown);
             $cat = $model->getCat($sec_filter);
             $catDropDown = JHTML::_('select.genericlist', $cat, 'cat_filter', 'onchange="document.adminForm.submit();"', 'id', 'title', $cat_filter);
             $this->assignRef('catDropDown', $catDropDown);
             if ($K2Installed) {
                 $first = new stdClass();
                 $first->id = -1;
                 $first->name = '-- ' . JText::_('JM_SELECT_A_CATEGORY') . ' --';
                 $k2cat = array_merge(array($first), $model->getK2Cat());
                 $k2catDropDown = JHTML::_('select.genericlist', $k2cat, 'k2cat_filter', 'onchange="document.adminForm.submit();"', 'id', 'name', $k2cat_filter);
                 $this->assignRef('k2catDropDown', $k2catDropDown);
                 $allk2cat = $model->getK2Cat();
                 $this->assignRef('allk2cat', $allk2cat);
             }
             $folders = $this->get('Folders');
             $undefined[0] = array('folder_id' => 0, 'name' => JText::_('JM_UNFILED'));
             $folder_id = JRequest::getVar('folder_id', 0, '', 'int');
             if ($folders) {
                 $folders = array_merge($undefined, $folders);
             } else {
                 $folders = $undefined;
             }
             $foldersDropDown = JHTML::_('select.genericlist', $folders, 'folder_id', '', 'folder_id', 'name', $folder_id);
             $this->assignRef('foldersDropDown', $foldersDropDown);
             $jsLimit = JRequest::getVar('jsLimit', $mainframe->getCfg('list_limit'), '', 'int');
             $jsLimitstart = JRequest::getVar('jsLimitstart', 0, '', 'int');
             $jomsocial = $model->getJomsocial($jsLimitstart, $jsLimit);
             // apply stored order
             $jsOrder = JRequest::getVar('jsOrder', 0, '', 'string');
             if ($jsOrder) {
                 $jsOrder = explode(';', $jsOrder);
                 unset($jsOrder[count($jsOrder) - 1]);
                 $coreArticles = array();
                 $i = 0;
                 if (isset($coreOrder) && is_array($coreOrder)) {
                     foreach ($coreOrder as $co) {
                         foreach ($items as $c) {
                             if ($co == $c->id) {
                                 $coreArticles[$i] = $c;
                             }
                         }
                         $i++;
                     }
                 }
                 if (count($coreArticles) == count($items)) {
                     $items = $coreArticles;
                 }
             }
             $this->assignRef('jomsocial', $jomsocial);
             $jsTotal = $model->getJomsocialTotal();
             $this->assignRef('jsTotal', $jsTotal);
             $jsFields = $model->getJomsocialFields();
             $this->assignRef('jsFields', $jsFields);
             $jsdiscussions = $model->getJomsocialDiscussions();
             $this->assignRef('jsdiscussions', $jsdiscussions);
             $aecConfig = $model->getAECconfig();
             $this->assignRef('aecConfig', $aecConfig);
             $aec = $model->getAECplans();
             $this->assignRef('aec', $aec);
             $ambra = $model->getAmbra();
             $this->assignRef('ambra', $ambra);
         }
     } else {
         $user =& JFactory::getUser();
         if (version_compare(JVERSION, '1.6.0', 'ge') && $user->authorise('core.admin', 'com_joomailermailchimpintegration') || !version_compare(JVERSION, '1.6.0', 'ge')) {
             JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
         }
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'footer.php';
 }