Esempio n. 1
0
function installAcyMailing()
{
    include_once rtrim(JPATH_ADMINISTRATOR, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_acymailing' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'helper.php';
    acymailing_increasePerf();
    $installClass = new acymailingInstall();
    $installClass->updateJoomailing();
    $installClass->addPref();
    $installClass->updatePref();
    $installClass->updateSQL();
    $installClass->displayInfo();
}
function com_install()
{
    include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php';
    @ini_set('max_execution_time', 0);
    acymailing_loadLanguage();
    $installClass = new acymailingInstall();
    $installClass->updateJoomailing();
    $installClass->addPref();
    $installClass->updatePref();
    $installClass->updateSQL();
    $installClass->displayInfo();
}
function com_install()
{
    include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_acymailing' . DS . 'helpers' . DS . 'helper.php';
    acymailing::increasePerf();
    $lang =& JFactory::getLanguage();
    $lang->load(ACYMAILING_COMPONENT, JPATH_SITE);
    $installClass = new acymailingInstall();
    $installClass->updateJoomailing();
    $installClass->addPref();
    $installClass->updatePref();
    $installClass->updateSQL();
    $installClass->displayInfo();
}
Esempio n. 4
0
function installAcyMailing(){
	$success = true;
	try{
		include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
	}catch(Exception $e){
		$updateHelper = acymailing_get('helper.update');
		$updateHelper->installTables();
		$success = false;
	}

	acymailing_increasePerf();

	$installClass = new acymailingInstall();
	$installClass->updateJoomailing();
	$installClass->addPref();
	$installClass->updatePref();
	$installClass->updateSQL();
	if($success) $installClass->displayInfo();
}
Esempio n. 5
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     JHTML::_('behavior.modal', 'a.modal');
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
         $pageInfo->filter->order->dir = 'asc';
     }
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}";
     }
     $query = 'SELECT ' . implode(' , ', $this->selectFields);
     $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.openunique/(a.senthtml+a.senttext-a.bounceunique)) END AS openprct';
     $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.clickunique/(a.senthtml+a.senttext-a.bounceunique)) END AS clickprct';
     $query .= ', CASE WHEN a.openunique = 0 THEN 0 ELSE (a.clickunique/a.openunique) END AS efficiencyprct';
     $query .= ', CASE WHEN (a.senthtml+a.senttext-a.bounceunique) = 0 THEN 0 ELSE (a.unsub/(a.senthtml+a.senttext-a.bounceunique)) END AS unsubprct';
     $query .= ', (a.senthtml+a.senttext) as totalsent';
     $query .= ', CASE WHEN (a.senthtml+a.senttext) = 0 THEN 0 ELSE (a.bounceunique/(a.senthtml+a.senttext)) END AS bounceprct';
     $query .= ' FROM ' . acymailing_table('stats') . ' as a';
     $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if ($rows === null) {
         acymailing_display(substr(strip_tags($database->getErrorMsg()), 0, 200) . '...', 'error');
         if (file_exists(ACYMAILING_BACK . 'install.acymailing.php')) {
             include_once ACYMAILING_BACK . 'install.acymailing.php';
             $installClass = new acymailingInstall();
             $installClass->fromVersion = '3.6.0';
             $installClass->update = true;
             $installClass->updateSQL();
         }
     }
     $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('stats') . ' as a';
     if (!empty($pageInfo->search)) {
         $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
     }
     if (!empty($filters)) {
         $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     acymailing_setTitle(JText::_('GLOBAL_STATISTICS'), 'stats', 'stats');
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('exportglobal', 'acyexport', '', JText::_('ACY_EXPORT'), false);
     JToolBarHelper::spacer();
     if (acymailing_isAllowed($config->get('acl_statistics_delete', 'all'))) {
         JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS'));
     }
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'statistics');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Esempio n. 6
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.ordering', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
         $pageInfo->filter->order->dir = 'asc';
     }
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->category = $app->getUserStateFromRequest($paramBase . ".category", 'category', '0', 'string');
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $this->filters[] = "a.name LIKE {$searchVal} OR a.description LIKE {$searchVal} OR a.tempid LIKE {$searchVal}";
     }
     if (!empty($pageInfo->category)) {
         $this->filters[] = 'a.category LIKE ' . $database->Quote($pageInfo->category);
     }
     $query = 'SELECT ' . implode(',', $this->selection) . ' FROM ' . acymailing_table('template') . ' as a';
     if (!empty($this->filters)) {
         $query .= ' WHERE (' . implode(') AND (', $this->filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     try {
         $this->rows = $database->loadObjectList();
     } catch (Exception $e) {
         $this->rows = null;
     }
     if ($this->rows === null) {
         acymailing_display(isset($e) ? $e->getMessage() : substr(strip_tags($database->getErrorMsg()), 0, 200) . '...', 'error');
         if (file_exists(ACYMAILING_BACK . 'install.acymailing.php')) {
             include_once ACYMAILING_BACK . 'install.acymailing.php';
             $installClass = new acymailingInstall();
             $installClass->fromVersion = '4.1.0';
             $installClass->update = true;
             $installClass->updateSQL();
         }
     }
     $queryCount = 'SELECT COUNT(a.tempid) FROM ' . acymailing_table('template') . ' as a';
     if (!empty($this->filters)) {
         $queryCount .= ' WHERE (' . implode(') AND (', $this->filters) . ')';
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($this->rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     if ($this->button) {
         acymailing_setTitle(JText::_('ACY_TEMPLATES'), 'acytemplate', 'template');
         $bar = JToolBar::getInstance('toolbar');
         $bar->appendButton('Acypopup', 'import', JText::_('IMPORT'), "index.php?option=com_acymailing&ctrl=template&task=upload&tmpl=component");
         JToolBarHelper::custom('export', 'acyexport', 'acyexport', JText::_('ACY_EXPORT'));
         JToolBarHelper::divider();
         JToolBarHelper::addNew();
         JToolBarHelper::editList();
         if (acymailing_isAllowed($config->get('acl_templates_delete', 'all'))) {
             JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS', true));
         }
         if (acymailing_isAllowed($config->get('acl_templates_copy', 'all'))) {
             JToolBarHelper::spacer();
             JToolBarHelper::custom('copy', 'copy.png', 'copy.png', JText::_('ACY_COPY'));
         }
         JToolBarHelper::divider();
         $bar->appendButton('Pophelp', 'template-listing');
         if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
             $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
         }
     }
     $toggleClass = acymailing_get('helper.toggle');
     $order = new stdClass();
     $order->ordering = false;
     $order->orderUp = 'orderup';
     $order->orderDown = 'orderdown';
     $order->reverse = false;
     if ($pageInfo->filter->order->value == 'a.ordering') {
         $order->ordering = true;
         if ($pageInfo->filter->order->dir == 'desc') {
             $order->orderUp = 'orderdown';
             $order->orderDown = 'orderup';
             $order->reverse = true;
         }
     }
     $this->assignRef('order', $order);
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $this->rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Esempio n. 7
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     JHTML::_('behavior.modal', 'a.modal');
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
         $pageInfo->filter->order->dir = 'asc';
     }
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}";
     }
     $listClass = acymailing_get('class.list');
     $lists = $listClass->getLists();
     $msgType = array();
     $msgType[] = JHTML::_('select.option', '0', JText::_('ALL_EMAILS'));
     $msgType[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('NEWSLETTER'));
     $msgType[] = JHTML::_('select.option', 'news', JText::_('ALL_LISTS'));
     foreach ($lists as $oneList) {
         $msgType[] = JHTML::_('select.option', 'list_' . $oneList->listid, $oneList->name);
     }
     $msgType[] = JHTML::_('select.option', '</OPTGROUP>');
     $msgType[] = JHTML::_('select.option', 'notification', JText::_('NOTIFICATIONS'));
     if (acymailing_level(1)) {
         $msgType[] = JHTML::_('select.option', 'autonews', JText::_('AUTONEW'));
         $msgType[] = JHTML::_('select.option', 'joomlanotification', JText::_('JOOMLA_NOTIFICATIONS'));
     }
     if (acymailing_level(3)) {
         $listCampaign = acymailing_get('class.list');
         $listCampaign->type = 'campaign';
         $campaigns = $listCampaign->getLists();
         $msgType[] = JHTML::_('select.option', '<OPTGROUP>', JText::_('FOLLOWUP'));
         $msgType[] = JHTML::_('select.option', 'followup', JText::_('ACY_ALL_CAMPAIGNS'));
         foreach ($campaigns as $oneCamp) {
             $msgType[] = JHTML::_('select.option', 'camp_' . $oneCamp->listid, $oneCamp->name);
         }
         $msgType[] = JHTML::_('select.option', '</OPTGROUP>');
     }
     $msgType[] = JHTML::_('select.option', 'welcome', JText::_('MSG_WELCOME'));
     $msgType[] = JHTML::_('select.option', 'unsub', JText::_('MSG_UNSUB'));
     $selectedMsgType = $app->getUserStateFromRequest($paramBase . "filter_msg", 'filter_msg', 0, 'string');
     $msgTypeChoice = JHTML::_('select.genericlist', $msgType, "filter_msg", 'class="inputbox" style="max-width: 200px;" onchange="document.adminForm.limitstart.value=0;document.adminForm.submit( );"', 'value', 'text', $selectedMsgType);
     $extraJoin = '';
     if (!empty($selectedMsgType)) {
         $subfilter = substr($selectedMsgType, 0, 5);
         if ($subfilter == 'camp_' || $subfilter == 'list_') {
             $filters[] = " b.type = '" . ($subfilter == 'camp_' ? 'followup' : 'news') . "'";
             $filters[] = " lm.listid = " . substr($selectedMsgType, 5);
             $extraJoin = " JOIN #__acymailing_listmail AS lm ON a.mailid = lm.mailid";
         } else {
             $filters[] = " b.type = '" . $selectedMsgType . "'";
         }
     }
     $query = 'SELECT ' . implode(' , ', $this->selectFields);
     $query .= ', CASE WHEN (a.senthtml+a.senttext) <= a.bounceunique THEN 0 ELSE (a.openunique/(a.senthtml+a.senttext-a.bounceunique)) END AS openprct';
     $query .= ', CASE WHEN (a.senthtml+a.senttext) <= a.bounceunique THEN 0 ELSE (a.clickunique/(a.senthtml+a.senttext-a.bounceunique)) END AS clickprct';
     $query .= ', CASE WHEN a.openunique = 0 THEN 0 ELSE (a.clickunique/a.openunique) END AS efficiencyprct';
     $query .= ', CASE WHEN (a.senthtml+a.senttext) <= a.bounceunique THEN 0 ELSE (a.unsub/(a.senthtml+a.senttext-a.bounceunique)) END AS unsubprct';
     $query .= ', (a.senthtml+a.senttext) as totalsent';
     $query .= ', CASE WHEN (a.senthtml+a.senttext) = 0 THEN 0 ELSE (a.bounceunique/(a.senthtml+a.senttext)) END AS bounceprct';
     $query .= ' FROM ' . acymailing_table('stats') . ' as a';
     $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
     if (!empty($extraJoin)) {
         $query .= $extraJoin;
     }
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if ($rows === null) {
         acymailing_display(substr(strip_tags($database->getErrorMsg()), 0, 200) . '...', 'error');
         if (file_exists(ACYMAILING_BACK . 'install.acymailing.php')) {
             include_once ACYMAILING_BACK . 'install.acymailing.php';
             $installClass = new acymailingInstall();
             $installClass->fromVersion = '3.6.0';
             $installClass->update = true;
             $installClass->updateSQL();
         }
     }
     $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('stats') . ' as a';
     if (!empty($pageInfo->search) || !empty($filters)) {
         $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
         if (!empty($extraJoin)) {
             $queryCount .= $extraJoin;
         }
     }
     if (!empty($filters)) {
         $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     $acyToolbar = acymailing::get('helper.toolbar');
     $acyToolbar->custom('exportglobal', JText::_('ACY_EXPORT'), 'export', false);
     if (acymailing_isAllowed($config->get('acl_statistics_delete', 'all'))) {
         $acyToolbar->delete();
     }
     $acyToolbar->divider();
     $acyToolbar->help('statistics');
     $acyToolbar->setTitle(JText::_('GLOBAL_STATISTICS'), 'stats');
     $acyToolbar->display();
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
     $this->assign('filterMsg', $msgTypeChoice);
 }