Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Acajoom plugin for CB 1.2.3 ?

14 years 2 months ago #144595 by carsten888
Acajoom plugin for CB 1.2.3 ? was created by carsten888
I need a Acajoom plugin which will work with CB 1.2.3.

Please Log in or Create an account to join the conversation.

14 years 1 month ago #145586 by bdawwg8569
Replied by bdawwg8569 on topic Re:Acajoom plugin for CB 1.2.3 ?
I am also in need of this plugin. Anybody have anything?

Please Log in or Create an account to join the conversation.

14 years 1 month ago #145587 by carsten888
Replied by carsten888 on topic Re:Acajoom plugin for CB 1.2.3 ?
I spent hours coding this, but somehow it does not seem too stable.


[code:1]<?php
defined('_JEXEC') OR defined('_VALID_MOS') OR die('...Direct Access to this location is not allowed...');
/**
* @copyright Copyright (C) 2009 Joobi Limited All rights reserved.
* @license This file is released under the GPL license ( www.gnu.org/licenses )
* @link www.ijoobi.com
*/


if ( !defined('ACA_JPATH_ROOT') ) {
if ( defined('JPATH_ROOT') AND class_exists('JFactory')) { // joomla 15
define ('ACA_JPATH_ROOT' , JPATH_ROOT );
} else { //joomla 1x
define( 'ACA_JPATH_ROOT', $GLOBALS);
}
}//endif
require_once( ACA_JPATH_ROOT . '/components/com_acajoom/defines.php');

$_PLUGINS->registerFunction( 'onUserActive', 'userActivated','getAcajoomTab' );
$_PLUGINS->registerFunction( 'onAfterDeleteUser', 'userDeleted','getAcajoomTab' );

global $mainframe;
define('_ACAJOOMCLASS', ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');

if(!$mainframe->isAdmin()){
$Itemid = @$GLOBALS[ACA.'itemidAca'];
}

class getAcajoomTab extends cbTabHandler {
function getAcajoomTab() {
$this->cbTabHandler();
}

function _memGetTabParameters($user){
$params = $this->params;

$TabParams["show_archive"] = $params->get('show_archive', 1);
$TabParams["public_view"] = $params->get('public_view', 0);
$TabParams["acajoom_itemid"] = $params->get('acajoom_itemid', '');

return $TabParams;
}

function _editSubscriber($user, $subscriber, $listings, $queues, $forms, $access=false, $frontEnd=false, $cb=false ) {

$br = "\n\r";
$html = '<div style="width:100%; align:left;">'.$br;
$html .= '<fieldset class="acajoomcss" style="padding: 10px; text-align: left">'.$br;
$html .= '<legend><strong>'._ACA_SUB_INFO.'</strong></legend>'.$br;
$html .= '<table cellpadding="0" cellspacing="0" align="center">'.$br;

if ($subscriber->receive_html) {
$receive_html = _CMN_YES;
} else {
$receive_html = _CMN_NO;
}
$html .= acajoom::miseEnHTML(_ACA_RECEIVE_HTML , _ACA_RECEIVE_HTML_TIPS, $receive_html);

if ($GLOBALS==1) {
$html .= acajoom::miseEnHTML(_ACA_TIME_ZONE_ASK , _ACA_TIME_ZONE_ASK_TIPS, $subscriber->timezone);
}

$html .= '</table>';
$html .= '</fieldset></div>';

$html .= getAcajoomTab::_showSubscriberLists($user, $subscriber, $listings, $queues, $frontEnd, $access);

return $html;
}

function _showSubscriberLists($user, $subscriber, $lists, $queues, $frontEnd, $accessAdmin) {
global $Itemid;
$tabparams = $this->_memGetTabParameters($user);

if (!empty($lists)) {
$br = "\n\r";
$html = '<fieldset class="acajoomcss" style="padding: 4px; text-align: left">'.$br;
$html .= '<legend><strong>'._ACA_SUBSCRIPTIONS.'</strong></legend>' .$br;
$html .= '<table width="100%" border="0" cellspacing="0" cellpadding="4" class="adminlist">' .$br;
$html .= '<tr><th class="title">#</th>' .$br;
$html .= '<th class="title">'._ACA_LIST_NAME.'</th>' .$br;
$html .= '<th class="title" style="text-align: center;">'._ACA_LIST_T_SUBSCRIPTION.'</th>' .$br;

if ($tabparams) {$html .= '<th class="title" style="text-align: center;">'._ACA_VIEW_ARCHIVE.'</th>' .$br;}

$html .= '</tr>' .$br;

$subscribed = '';
$i = 0;
foreach ($lists as $list) {
$i++;
$subscribed = 0;
if (!empty($queues)) {
foreach ($queues as $queue) {
if ($queue->list_id == $list->id) {
$subscribed =1;
}
}
}

if (!empty($tabparams)) {
$item_id = $tabparams;
} else {
$item_id = $Itemid;
}

$html .= '<tr><td>'.$i.'</td><td>' .$br;
$link = ( $list->hidden AND ($list->list_type =='1' or $list->list_type =='7') AND $GLOBALS[ACA.'show_archive'] ) ? 'index.php?option=com_acajoom&act=mailing&task=archive&listid='.$list->id.'&Itemid='.$item_id : '#';

$html .= '<span class="aca_letter_names"';
if ($link == "#"«»){$html .= " onclick='return false;' ";}
$html .= '>'. compa::toolTip($list->list_desc ,$list->list_name,'', '', $list->list_name, $link, 1).' </span>' .$br;
$html .= '</td><td style="text-align: center;">' .$br;

if ( $subscribed == 1 ) {$html .= _CMN_YES;}
if ( $subscribed == 0 ) {$html .= _CMN_NO;}

$html .= '</td>' .$br;

if ($tabparams && ($list->list_type == 1 or $list->list_type == 7)) {
$link = '.php?option=com_acajoom&act=mailing&listid=' .$list->id . '&listype=' .$list->list_type .'&task=archive&Itemid=' . $item_id;
compa::completeLink($link,false);

$img = 'move_f2.png';
$html .= '<td height="20" style="text-align: center;">';
$html .= '<a href="' . $link. '" >'."\n\r" ;
$html .= '<img src="components/com_acajoom/images/' . $img. '" width="20" height="20" border="0" alt="'._ACA_VIEW_ARCHIVE.'" /></a></td>'."\n\r" ;
}elseif($tabparams) {
$html .= '<td height="20"><center>-</center></td>'."\n\r";
}

}
$html .= '<tr></table></fieldset>';
return $html;
}

}

function getDisplayTab( $tab, $user, $ui) {
global $Itemid;

if ( ACA_CMSTYPE ) { // joomla 15
$my =& JFactory::getUser();
$document=& JFactory::getDocument();
$document->addStyleSheet( 'components/com_acajoom/css/acajoom.css', 'text/css' );
} else { //joomla 1x
global $my;
global $mainframe;
$mainframe->addCustomHeadTag( '<link rel="stylesheet" href="components/com_acajoom/css/acajoom.css" type="text/css" >' );
}//endif


if(!getAcajoomTab::checkInstalled()) {
return _UE_NEWSLETTERNOTINSTALLED;
}

$tabparams = $this->_memGetTabParameters($user);

if (!$tabparams) {
if (empty($my->id) OR $my->id != $user->user_id) {return;}
}

$html = '';
require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');
require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/subscribers.acajoom.html.php');

if (!empty($user->id)) {
$userId = $user->user_id;
$subscriber = subscribers::getSubscriberInfoFromUserId($userId, false);
$subscriberId = $subscriber->id;
$queues = queue::getSubscriberLists($subscriberId);

$access = acajoom::checkPermissions('admin', $my->id);

} else {
$userId = 0;
$queues = '';
$access = false;
$subscriberId = 0;
$subscriber->id = '' ;
$subscriber->user_id = 0 ;
$subscriber->name = '' ;
$subscriber->email = '' ;
$subscriber->receive_html = 1 ;
$subscriber->confirmed = 1;
$subscriber->blacklist = 0;
$subscriber->timezone = '00:00:00';
$subscriber->language_iso = 'eng';
$subscriber->params = '';
$subscriber->subscribe_date = acajoom::getNow();
}

$lists = lists::getLists(0, 0, $subscriberId, '', false , true, false);
$doShowSubscribers = false;

$html .= getAcajoomTab::_editSubscriber($user, $subscriber, $lists, $queues, '', $access, false, true );
$html .= acajoom::noShow();

return $html;
}



function getEditTab( $tab, $user, $ui) {

global $Itemid;

if ( ACA_CMSTYPE ) { // joomla 15
$my =& JFactory::getUser();
if ($my->get('id') < 1) {
echo JText::_('ALERTNOTAUTH');
echo "<br />" . JText::_( 'You need to login.' );
return false;
}
} else { //joomla 1x
global $my;
if(intval($my->id) < 1) {
mosNotAuth();
return false;
}
}//endif

if(!getAcajoomTab::checkInstalled()) {
return _UE_NEWSLETTERNOTINSTALLED;
}

$html = '';
require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');
require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/subscribers.acajoom.html.php');

if (!empty($user->id)) {
$userId = $user->id;
$subscriber = subscribers::getSubscriberInfoFromUserId($userId);
if(empty($subscriber)){
subscribers::«»syncSubscribers(true);
$subscriber = subscribers::getSubscriberInfoFromUserId($userId);
}
$subscriberId = $subscriber->id;
$queues = queue::getSubscriberLists($subscriberId);

$access = acajoom::checkPermissions('admin', $my->id);

} else {
$userId = 0;
$queues = '';
$access = false;
$subscriberId = 0;
$subscriber->id = '' ;
$subscriber->user_id = 0 ;
$subscriber->name = '' ;
$subscriber->email = '' ;
$subscriber->receive_html = 1 ;
$subscriber->confirmed = 1;
$subscriber->blacklist = 0;
$subscriber->timezone = '00:00:00';
$subscriber->language_iso = 'eng';
$subscriber->params = '';
$subscriber->subscribe_date = acajoom::getNow();
}

$lists = lists::getLists(0, 0, $subscriberId, '', false , true, false);
$doShowSubscribers = false;

$mainLink = '.php?option=com_acajoom';
$selectLink = '.php?option=com_acajoom&act=subscriber';
compa::completeLink($mainLink,false);
compa::completeLink($selectLink,false);

//$forms = '<form method="post" action="'.$mainLink.'" onsubmit="submitbutton();return false;" name="mosForm" >' ."\n\r";
//$forms = '<form method="post" action="'.$selectLink.'" name="AcajoomFilterForm">';

$forms = '';
$html .= subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, false, true );

//$html .= '<input type="hidden" name="Itemid" value="'.$Itemid.'" />';
$html .= '<input type="hidden" name="subscriber_id" value="'.$subscriber->id.'" />';

return $html;
}


function saveEditTab($tab, &$user, $ui, $postdata) {

/*
echo print_r($tab);
echo '<br />';
echo print_r($user);
echo '<br />';
echo print_r($ui);
echo '<br />';
echo print_r($postdata);
echo '<br />';
exit;
*/
if ( ACA_CMSTYPE ) { // joomla 15
$my =& JFactory::getUser();
if ($my->get('id') < 1) {
echo JText::_('ALERTNOTAUTH');
echo "<br />" . JText::_( 'You need to login.' );
return;
}
} else { //joomla 1x
global $my;
if(intval($my->id) < 1) {
mosNotAuth();
return;
}
}//endif

//carsten
/*
require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');

if(!subscribers::updateOneSubscriber($user->user_id, $user)){
$this->_setErrorMSG(_ACA_ERROR);
}
*/
//echo 'useris'.$user->id;
//print_r($postdata);
$should_be_on_these_lists = array();
$loops = count($postdata)+1;
for($n = 1; $n < $loops; $n++){
//echo 'n='.$n;
if($postdata[$n]){
//wants to be on this list, so get list id
$list_id = $postdata[$n];
//echo 'should go on list='.$list_id;
$should_be_on_these_lists[] = $list_id;
}

}

$subscriber_id = $postdata;

$database = JFactory::getDBO();

//check which lists the user is on now
$database->setQuery("SELECT qid, list_id "
." FROM #__acajoom_queue "
." WHERE subscriber_id='$subscriber_id' "
);
$lists = $database->loadObjectList();
$list_rows_dealt_with = array();
foreach($lists as $list){
//echo $list->list_id;
if(!in_array($list->list_id, $should_be_on_these_lists)){
//it should not be on there, take it out
//delete row
$database->setQuery("DELETE FROM #__acajoom_queue WHERE qid='$list->qid' "«»);
$database->query();
//echo $list->qid;
}
$list_rows_dealt_with[] = $list->list_id;
}

//print_r($list_rows_dealt_with);
//exit;

foreach($should_be_on_these_lists as $should_be_on_this_list){
if(!in_array($should_be_on_this_list, $list_rows_dealt_with)){
//echo $should_be_on_this_list;
//should be on the list, but is not yet, so insert
$database->setQuery( "INSERT INTO #__acajoom_queue SET type='1', subscriber_id='$subscriber_id', list_id='$should_be_on_this_list' "«»);
$database->query();
}
}

//exit;
}

function getDisplayRegistration($tab, $user, $ui) {

if ( ACA_CMSTYPE ) { // joomla 15
$my =& JFactory::getUser();
} else { //joomla 1x
global $my;
}//endif

require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');
$html = '';

if ($GLOBALS=='1' ) {
$lists = lists::getSpecifiedLists($GLOBALS, false );
if (!empty($lists)) {

$i=0;
$accessLevel = 18; //default access level jack 31
$htmlOK = false;

if (!empty($GLOBALS)) {
$html .= '<tr><td class="titleCell" colspan="2">'. $GLOBALS .'</td></tr>';
}

if ($GLOBALS) {

foreach ($lists as $list) {
$i++;
$subscribed = 0;
if ($list->html ==1) $htmlOK = true;

$checked = $GLOBALS;
if ($list->hidden == 1) {
$subscriber->blacklist = 0;
if ($checked != 0) $checkedPrint = ' checked="checked" '; else $checkedPrint = '';
$html .= '<tr>';
if ($GLOBALS == 1) {
$text = "\n".'<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed" checked="checked" /></td>';
} else {
$text = "\n".'<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed" '.$checkedPrint.' /></td>';
}
$text .= "\n".'<input type="hidden" name="sub_list_id" value="'.$list->id.'" />';
$text .= "\n".'<td class="fieldCell"><span class="aca_list_name" onclick=\'return false;\'>'. compa::toolTip($list->list_desc ,$list->list_name, '', '', $list->list_name , '#', 1).'</span></td>';
$html .= $text;
$html .= '</tr>';
} else {
$html .= '<input type="hidden" value=1 name="subscribed" />';
$html .= "\n".'<input type="hidden" name="sub_list_id" value="'.$list->id.'" />';
}
$html .= "\n".'<input type="hidden" name="acc_level" value="'.$accessLevel.'" />';
}
} else {
foreach ($lists as $list) {
$i++;
$html .= '<input type="hidden" value="1" name="subscribed" />';
$html .= "\n".'<input type="hidden" name="sub_list_id" value="'.$list->id.'" />';
$html .= "\n".'<input type="hidden" name="acc_level" value="'.$accessLevel.'" />';
if ($list->html ==1) $htmlOK = true;
}
}

$checked = $GLOBALS;

if ($htmlOK) {
if ($GLOBALS) {
$html .= '<tr>';
if ($checked != 0) $checkedPrint = ' checked="checked" '; else $checkedPrint = '';
$text = '<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="receive_html" '.$checkedPrint.' /></td>';
$text .= '<td class="fieldCell">'._ACA_RECEIVE_HTML.'</td>';
$html .= acajoom::«»printLine(false, $text);
$html .= '</tr>';
} else {
$html .= '<input type="hidden" value="'.$checked.'" name="receive_html" />' . "\n";
}
} else {
$html .= '<input type="hidden" value="'.$checked.'" name="receive_html" />' . "\n";
}
} else {
$html = '<input type="hidden" value="'.$GLOBALS.'" name="receive_html" />' . "\n";
}
}else{
$html = '<input type="hidden" value="'.$GLOBALS.'" name="receive_html" />' . "\n";
}

return $html;
}


function saveRegistrationTab($tab, &$user, $ui, $postdata) {
//carsten
/*
global $ueConfig;

require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');
$erro = new xerr( __FILE__ , __FUNCTION__ );

if ($user->user_id >0 ) {

$erro->ck = subscribers::updateOneSubscriber($user->user_id, $user );
if (!$erro->Eck(__LINE__ , '7002') ) {

$this->_setErrorMSG(_ACA_ERROR);
return;
}

}
*/

//get subscriptions from form as array
$subscriptions = JRequest::getVar('subscribed', null, 'post', 'array');
$subscriptions_temp = array();
while($subscription = each($subscriptions)){
$subscriptions_temp[] = $subscription;
}

//if there are any subscriptions
if(count($subscriptions_temp)){


$user_id = $user->user_id;
$username = $user->username;
$email = $user->email;

//add user as subscriber
$database = JFactory::getDBO();
$database->setQuery( "INSERT INTO #__acajoom_subscribers SET user_id='$user_id', name='$username', email='$email', receive_htm='1', confirmed='1', params='' "«»);
$database->query();

//get subscribers id
//$subscriber_id = $database->insertid(); don't know why that does not work
$database->setQuery("SELECT id "
."FROM #__acajoom_subscribers "
."WHERE user_id='$user_id' "
."LIMIT 1 "
);
$rows = $database->loadObjectList();
foreach($rows as $row){
$subscriber_id = $row->id;
}

//add subscriptions
for($n = 0; $n < count($subscriptions_temp); $n++){
$subscription_id = $subscriptions_temp[$n];
$database->setQuery( "INSERT INTO #__acajoom_queue SET type='1', subscriber_id='$subscriber_id', list_id='$subscription_id' "«»);
$database->query();
}
}

return;
}

function userActivated($user, $success) {

require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');

$erro = new xerr( __FILE__ , __FUNCTION__ );
$erro->ck = subscribers::updateSubscribers( true );
$erro->Eck(__LINE__ , '7007');
$user->receive_html = -1;
if(!subscribers::updateOneSubscriber($user->user_id, $user, true )) {
$this->_setErrorMSG(_ACA_ERROR);
}

return;
}

function userDeleted($user, $success) {

require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php');
$erro = new xerr( __FILE__ , __FUNCTION__ );
if(!empty($user->user_id)){
$subscriberId = subscribers::getSubscriberIdFromUserId($user->user_id);
if(!empty($subscriberId)) subscribers::deleteOneSubscriber($subscriberId);
}
$erro->ck = subscribers::updateSubscribers();
$erro->Eck(__LINE__ , '7009');
return true;
}

function checkInstalled() {
if(!file_exists(_ACAJOOMCLASS)) {
return false;
}
return true;
}


}

[/code:1]

Please Log in or Create an account to join the conversation.

13 years 9 months ago #155649 by carsten888
Replied by carsten888 on topic Re:Acajoom plugin for CB 1.2.3 ?
this one works on CB 1.4
Code:
<?php defined('_JEXEC') OR defined('_VALID_MOS') OR die('...Direct Access to this location is not allowed...'); /** * @copyright Copyright (C) 2009 Joobi Limited All rights reserved. * @license This file is released under the GPL license (http://www.gnu.org/licenses ) * @link http://www.ijoobi.com */ if ( !defined('ACA_JPATH_ROOT') ) { if ( defined('JPATH_ROOT') AND class_exists('JFactory')) { // joomla 15 define ('ACA_JPATH_ROOT' , JPATH_ROOT ); } else { //joomla 1x define( 'ACA_JPATH_ROOT', $GLOBALS['mosConfig_absolute_path']); } }//endif require_once( ACA_JPATH_ROOT . '/components/com_acajoom/defines.php'); $_PLUGINS->registerFunction( 'onUserActive', 'userActivated','getAcajoomTab' ); $_PLUGINS->registerFunction( 'onAfterDeleteUser', 'userDeleted','getAcajoomTab' ); global $mainframe; define('_ACAJOOMCLASS', ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); if(!$mainframe->isAdmin()){ $Itemid = @$GLOBALS[ACA.'itemidAca']; } class getAcajoomTab extends cbTabHandler { function getAcajoomTab() { $this->cbTabHandler(); } function _memGetTabParameters($user){ $params = $this->params; $TabParams["show_archive"] = $params->get('show_archive', 1); $TabParams["public_view"] = $params->get('public_view', 0); $TabParams["acajoom_itemid"] = $params->get('acajoom_itemid', ''); return $TabParams; } function _editSubscriber($user, $subscriber, $listings, $queues, $forms, $access=false, $frontEnd=false, $cb=false ) { $br = "\n\r"; $html = '<div style="width:100%; align:left;">'.$br; $html .= '<fieldset class="acajoomcss" style="padding: 10px; text-align: left">'.$br; $html .= '<legend><strong>'._ACA_SUB_INFO.'</strong></legend>'.$br; $html .= '<table cellpadding="0" cellspacing="0" align="center">'.$br; if ($subscriber->receive_html) { $receive_html = _CMN_YES; } else { $receive_html = _CMN_NO; } $html .= acajoom::miseEnHTML(_ACA_RECEIVE_HTML , _ACA_RECEIVE_HTML_TIPS, $receive_html); if ($GLOBALS['aca_time_zone']==1) { $html .= acajoom::miseEnHTML(_ACA_TIME_ZONE_ASK , _ACA_TIME_ZONE_ASK_TIPS, $subscriber->timezone); } $html .= '</table>'; $html .= '</fieldset></div>'; $html .= getAcajoomTab::_showSubscriberLists($user, $subscriber, $listings, $queues, $frontEnd, $access); return $html; } function _showSubscriberLists($user, $subscriber, $lists, $queues, $frontEnd, $accessAdmin) { global $Itemid; $tabparams = $this->_memGetTabParameters($user); if (!empty($lists)) { $br = "\n\r"; $html = '<fieldset class="acajoomcss" style="padding: 4px; text-align: left">'.$br; $html .= '<legend><strong>'._ACA_SUBSCRIPTIONS.'</strong></legend>' .$br; $html .= '<table width="100%" border="0" cellspacing="0" cellpadding="4" class="adminlist">' .$br; $html .= '<tr><th class="title">#</th>' .$br; $html .= '<th class="title">'._ACA_LIST_NAME.'</th>' .$br; $html .= '<th class="title" style="text-align: center;">'._ACA_LIST_T_SUBSCRIPTION.'</th>' .$br; if ($tabparams['show_archive']) {$html .= '<th class="title" style="text-align: center;">'._ACA_VIEW_ARCHIVE.'</th>' .$br;} $html .= '</tr>' .$br; $subscribed = ''; $i = 0; foreach ($lists as $list) { $i++; $subscribed = 0; if (!empty($queues)) { foreach ($queues as $queue) { if ($queue->list_id == $list->id) { $subscribed =1; } } } if (!empty($tabparams['acajoom_itemid'])) { $item_id = $tabparams['acajoom_itemid']; } else { $item_id = $Itemid; } $html .= '<tr><td>'.$i.'</td><td>' .$br; $link = ( $list->hidden AND ($list->list_type =='1' or $list->list_type =='7') AND $GLOBALS[ACA.'show_archive'] ) ? 'index.php?option=com_acajoom&act=mailing&task=archive&listid='.$list->id.'&Itemid='.$item_id : '#'; $html .= '<span class="aca_letter_names"'; if ($link == "#"){$html .= " onclick='return false;' ";} $html .= '>'. compa::toolTip($list->list_desc ,$list->list_name,'', '', $list->list_name, $link, 1).' </span>' .$br; $html .= '</td><td style="text-align: center;">' .$br; if ( $subscribed == 1 ) {$html .= _CMN_YES;} if ( $subscribed == 0 ) {$html .= _CMN_NO;} $html .= '</td>' .$br; if ($tabparams['show_archive'] && ($list->list_type == 1 or $list->list_type == 7)) { $link = '.php?option=com_acajoom&act=mailing&listid=' .$list->id . '&listype=' .$list->list_type .'&task=archive&Itemid=' . $item_id; compa::completeLink($link,false); $img = 'move_f2.png'; $html .= '<td height="20" style="text-align: center;">'; $html .= '<a href="' . $link. '" >'."\n\r" ; $html .= '<img src="components/com_acajoom/images/' . $img. '" width="20" height="20" border="0" alt="'._ACA_VIEW_ARCHIVE.'" /></a></td>'."\n\r" ; }elseif($tabparams['show_archive']) { $html .= '<td height="20"><center>-</center></td>'."\n\r"; } } $html .= '<tr></table></fieldset>'; return $html; } } function getDisplayTab( $tab, $user, $ui) { global $Itemid; if ( ACA_CMSTYPE ) { // joomla 15 $my =& JFactory::getUser(); $document=& JFactory::getDocument(); $document->addStyleSheet( 'components/com_acajoom/css/acajoom.css', 'text/css' ); } else { //joomla 1x global $my; global $mainframe; $mainframe->addCustomHeadTag( '<link rel="stylesheet" href="components/com_acajoom/css/acajoom.css" type="text/css" >' ); }//endif if(!getAcajoomTab::checkInstalled()) { return _UE_NEWSLETTERNOTINSTALLED; } $tabparams = $this->_memGetTabParameters($user); if (!$tabparams['public_view']) { if (empty($my->id) OR $my->id != $user->user_id) {return;} } $html = ''; require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/subscribers.acajoom.html.php'); if (!empty($user->id)) { $userId = $user->user_id; $subscriber = subscribers::getSubscriberInfoFromUserId($userId, false); $subscriberId = $subscriber->id; $queues = queue::getSubscriberLists($subscriberId); $access = acajoom::checkPermissions('admin', $my->id); } else { $userId = 0; $queues = ''; $access = false; $subscriberId = 0; $subscriber->id = '' ; $subscriber->user_id = 0 ; $subscriber->name = '' ; $subscriber->email = '' ; $subscriber->receive_html = 1 ; $subscriber->confirmed = 1; $subscriber->blacklist = 0; $subscriber->timezone = '00:00:00'; $subscriber->language_iso = 'eng'; $subscriber->params = ''; $subscriber->subscribe_date = acajoom::getNow(); } $lists = lists::getLists(0, 0, $subscriberId, '', false , true, false); $doShowSubscribers = false; $html .= getAcajoomTab::_editSubscriber($user, $subscriber, $lists, $queues, '', $access, false, true ); $html .= acajoom::noShow(); return $html; } function getEditTab( $tab, $user, $ui) { global $Itemid; if ( ACA_CMSTYPE ) { // joomla 15 $my =& JFactory::getUser(); if ($my->get('id') < 1) { echo JText::_('ALERTNOTAUTH'); echo "<br />" . JText::_( 'You need to login.' ); return false; } } else { //joomla 1x global $my; if(intval($my->id) < 1) { mosNotAuth(); return false; } }//endif if(!getAcajoomTab::checkInstalled()) { return _UE_NEWSLETTERNOTINSTALLED; } $html = ''; require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/subscribers.acajoom.html.php'); if (!empty($user->id)) { $userId = $user->id; $subscriber = subscribers::getSubscriberInfoFromUserId($userId); if(empty($subscriber)){ subscribers::syncSubscribers(true); $subscriber = subscribers::getSubscriberInfoFromUserId($userId); } $subscriberId = $subscriber->id; $queues = queue::getSubscriberLists($subscriberId); $access = acajoom::checkPermissions('admin', $my->id); } else { $userId = 0; $queues = ''; $access = false; $subscriberId = 0; $subscriber->id = '' ; $subscriber->user_id = 0 ; $subscriber->name = '' ; $subscriber->email = '' ; $subscriber->receive_html = 1 ; $subscriber->confirmed = 1; $subscriber->blacklist = 0; $subscriber->timezone = '00:00:00'; $subscriber->language_iso = 'eng'; $subscriber->params = ''; $subscriber->subscribe_date = acajoom::getNow(); } $lists = lists::getLists(0, 0, $subscriberId, '', false , true, false); $doShowSubscribers = false; $mainLink = '.php?option=com_acajoom'; $selectLink = '.php?option=com_acajoom&act=subscriber'; compa::completeLink($mainLink,false); compa::completeLink($selectLink,false); $forms['main'] = ''; $html .= subscribersHTML::editSubscriber($subscriber, $lists, $queues, $forms, $access, false, true ); $html .= '<input type="hidden" name="subscriber_id" value="'.$subscriber->id.'" />'; return $html; } function saveEditTab($tab, &$user, $ui, $postdata) { if ( ACA_CMSTYPE ) { // joomla 15 $my =& JFactory::getUser(); if ($my->get('id') < 1) { echo JText::_('ALERTNOTAUTH'); echo "<br />" . JText::_( 'You need to login.' ); return; } } else { //joomla 1x global $my; if(intval($my->id) < 1) { mosNotAuth(); return; } }//endif //echo 'useris'.$user->id; //print_r($postdata); $should_be_on_these_lists = array(); $loops = count($postdata['subscribed'])+1; for($n = 1; $n < $loops; $n++){ //echo 'n='.$n; if($postdata['subscribed'][$n]){ //wants to be on this list, so get list id $list_id = $postdata['sub_list_id'][$n]; //echo 'should go on list='.$list_id; $should_be_on_these_lists[] = $list_id; } } $subscriber_id = $postdata['subscriber_id']; $database = JFactory::getDBO(); //check which lists the user is on now $database->setQuery("SELECT qid, list_id " ." FROM #__acajoom_queue " ." WHERE subscriber_id='$subscriber_id' " ); $lists = $database->loadObjectList(); $list_rows_dealt_with = array(); foreach($lists as $list){ //echo $list->list_id; if(!in_array($list->list_id, $should_be_on_these_lists)){ //it should not be on there, take it out //delete row $database->setQuery("DELETE FROM #__acajoom_queue WHERE qid='$list->qid' "); $database->query(); //echo $list->qid; } $list_rows_dealt_with[] = $list->list_id; } foreach($should_be_on_these_lists as $should_be_on_this_list){ if(!in_array($should_be_on_this_list, $list_rows_dealt_with)){ //echo $should_be_on_this_list; //should be on the list, but is not yet, so insert $database->setQuery( "INSERT INTO #__acajoom_queue SET type='1', subscriber_id='$subscriber_id', list_id='$should_be_on_this_list' "); $database->query(); } } //exit; } function getDisplayRegistration($tab, $user, $ui) { if ( ACA_CMSTYPE ) { // joomla 15 $my =& JFactory::getUser(); } else { //joomla 1x global $my; }//endif require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); $html = ''; if ($GLOBALS['aca_cb_plugin']=='1' ) { $lists = lists::getSpecifiedLists($GLOBALS['aca_cb_listIds'], false ); if (!empty($lists)) { $i=0; $accessLevel = 18; //default access level jack 31 $htmlOK = false; if (!empty($GLOBALS['aca_cb_intro'])) { $html .= '<tr><td class="titleCell" colspan="2">'. $GLOBALS['aca_cb_intro'] .'</td></tr>'; } if ($GLOBALS['aca_cb_showname']) { foreach ($lists as $list) { $i++; $subscribed = 0; if ($list->html ==1) $htmlOK = true; $checked = $GLOBALS['aca_cb_checkLists']; if ($list->hidden == 1) { $subscriber->blacklist = 0; if ($checked != 0) $checkedPrint = ' checked="checked" '; else $checkedPrint = ''; $html .= '<tr>'; if ($GLOBALS['aca_cb_checkLists'] == 1) { $text = "\n".'<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed['.$i.']" checked="checked" /></td>'; } else { $text = "\n".'<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="subscribed['.$i.']" '.$checkedPrint.' /></td>'; } $text .= "\n".'<input type="hidden" name="sub_list_id['.$i.']" value="'.$list->id.'" />'; $text .= "\n".'<td class="fieldCell"><span class="aca_list_name" onclick=\'return false;\'>'. compa::toolTip($list->list_desc ,$list->list_name, '', '', $list->list_name , '#', 1).'</span></td>'; $html .= $text; $html .= '</tr>'; } else { $html .= '<input type="hidden" value=1 name="subscribed['.$i.']" />'; $html .= "\n".'<input type="hidden" name="sub_list_id['.$i.']" value="'.$list->id.'" />'; } $html .= "\n".'<input type="hidden" name="acc_level['.$i.']" value="'.$accessLevel.'" />'; } } else { foreach ($lists as $list) { $i++; $html .= '<input type="hidden" value="1" name="subscribed['.$i.']" />'; $html .= "\n".'<input type="hidden" name="sub_list_id['.$i.']" value="'.$list->id.'" />'; $html .= "\n".'<input type="hidden" name="acc_level['.$i.']" value="'.$accessLevel.'" />'; if ($list->html ==1) $htmlOK = true; } } $checked = $GLOBALS['aca_cb_defaultHTML']; if ($htmlOK) { if ($GLOBALS['aca_cb_showHTML']) { $html .= '<tr>'; if ($checked != 0) $checkedPrint = ' checked="checked" '; else $checkedPrint = ''; $text = '<td class="titleCell" style="text-align: right;"><input type="checkbox" class="inputbox" value="1" name="receive_html" '.$checkedPrint.' /></td>'; $text .= '<td class="fieldCell">'._ACA_RECEIVE_HTML.'</td>'; $html .= acajoom::printLine(false, $text); $html .= '</tr>'; } else { $html .= '<input type="hidden" value="'.$checked.'" name="receive_html" />' . "\n"; } } else { $html .= '<input type="hidden" value="'.$checked.'" name="receive_html" />' . "\n"; } } else { $html = '<input type="hidden" value="'.$GLOBALS['aca_cb_defaultHTML'].'" name="receive_html" />' . "\n"; } }else{ $html = '<input type="hidden" value="'.$GLOBALS['aca_cb_defaultHTML'].'" name="receive_html" />' . "\n"; } return $html; } function saveRegistrationTab($tab, &$user, $ui, $postdata) { //get subscriptions from form as array $subscriptions = JRequest::getVar('subscribed', null, 'post', 'array'); $subscriptions_temp = array(); if($subscriptions){ while($subscription = each($subscriptions)){ $subscriptions_temp[] = $subscription['key']; } } //if there are any subscriptions if(count($subscriptions_temp)){ $user_id = $user->user_id; $username = $user->username; $email = $user->email; //add user as subscriber $database = JFactory::getDBO(); $database->setQuery( "INSERT INTO #__acajoom_subscribers SET user_id='$user_id', name='$username', email='$email', receive_htm='1', confirmed='1', params='' "); $database->query(); //get subscribers id //$subscriber_id = $database->insertid(); don't know why that does not work $database->setQuery("SELECT id " ."FROM #__acajoom_subscribers " ."WHERE user_id='$user_id' " ."LIMIT 1 " ); $rows = $database->loadObjectList(); foreach($rows as $row){ $subscriber_id = $row->id; } //add subscriptions for($n = 0; $n < count($subscriptions_temp); $n++){ $subscription_id = $subscriptions_temp[$n]; $database->setQuery( "INSERT INTO #__acajoom_queue SET type='1', subscriber_id='$subscriber_id', list_id='$subscription_id' "); $database->query(); } } return; } function userActivated($user, $success) { require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); $erro = new xerr( __FILE__ , __FUNCTION__ ); $erro->ck = subscribers::updateSubscribers( true ); $erro->Eck(__LINE__ , '7007'); $user->receive_html = -1; if(!subscribers::updateOneSubscriber($user->user_id, $user, true )) { $this->_setErrorMSG(_ACA_ERROR); } return; } function userDeleted($user, $success) { require_once(ACA_JPATH_ROOT_NO_ADMIN . '/administrator/components/com_acajoom/classes/class.acajoom.php'); $erro = new xerr( __FILE__ , __FUNCTION__ ); if(!empty($user->user_id)){ $subscriberId = subscribers::getSubscriberIdFromUserId($user->user_id); if(!empty($subscriberId)) subscribers::deleteOneSubscriber($subscriberId); } $erro->ck = subscribers::updateSubscribers(); $erro->Eck(__LINE__ , '7009'); return true; } function checkInstalled() { if(!file_exists(_ACAJOOMCLASS)) { return false; } return true; } }

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum