Exemplo n.º 1
0
 function showMailings($task, $action, $listId, $listType, $message, $showHeader, $title)
 {
     $start = mosGetParam($_REQUEST, 'start', 0);
     //ADRIEN
     //$limit = mosGetParam($_REQUEST, 'limit', $GLOBALS['mosConfig_list_limit']);
     $limit = -1;
     $emailsearch = mosGetParam($_REQUEST, 'emailsearch', '');
     $dropList = mosGetParam($_REQUEST, 'droplist', 'ZZZZ');
     if ($dropList == 'ZZZZ') {
         $dropList = $listType . '-' . $listId;
     }
     $total = 0;
     $dropListValues = explode('-', $dropList);
     $listType = $dropListValues[0];
     $listId = $dropListValues[1];
     if ($listId > 0) {
         $listTypeM = 0;
     } else {
         $listTypeM = $listType;
     }
     $orddef = 'idD';
     if ($listType == 2) {
         $orddef = 'idA';
     }
     $order = mosGetParam($_REQUEST, 'order', $orddef);
     if ($listId == 0) {
         $lists['title'] = lisType::chooseType($task, $action, $listType, 'titles', '', $title);
     } else {
         $listing = lists::getLists($listId, 0, 1, '', false, false, true);
         $lists['title'] = $title . "<span style='color: rgb(51, 51, 51);'>" . $listing[0]->list_name . "</span>";
     }
     $dropDownList = lisType::getMailingDropList($listId, $listType, $order);
     $lists['droplist'] = mosHTML::selectList($dropDownList, 'droplist', 'class="inputbox" size="1" onchange="document.AcajoomFilterForm.submit();"', 'id', 'name', $dropList);
     $mailings = xmailing::getMailings($listId, $listTypeM, $start, $limit, $emailsearch, $total, $order, false, false);
     $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
     $forms['select'] = " <form action='index2.php' method='post' name='AcajoomFilterForm'> \n\r";
     $show = lisType::showType($listType, 'showMailings');
     if ($showHeader) {
         xmailing::_header($task, $action, $listType, $message, '');
     }
     backHTML::formStart('show_mailing', 0, '');
     mailingsHTML::showMailingList($mailings, $lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action);
     backHTML::formEnd();
 }
Exemplo n.º 2
0
 function ReadImages($imagePath, $folderPath, &$folders, &$images)
 {
     jimport('joomla.filesystem.folder');
     $imgFiles = JFolder::files($imagePath);
     if (!empty($imgFiles)) {
         foreach ($imgFiles as $file) {
             $ff_ = $folderPath . DS . $file;
             $ff = $folderPath . DS . $file;
             $i_f = $imagePath . '/' . $file;
             if (is_dir($i_f) && $file != 'CVS' && $file != '.svn') {
                 $folders[] = JHTML::_('select.option', $ff_);
                 mailingsHTML::ReadImages($i_f, $ff_, $folders, $images);
             } else {
                 if (eregi("bmp|gif|jpg|png", $file) && is_file($i_f)) {
                     // leading / we don't need
                     $imageFile = substr($ff, 1);
                     $images[$folderPath][] = JHTML::_('select.option', $imageFile, $file);
                 }
             }
         }
     }
     //endif
 }
Exemplo n.º 3
0
 function mailingEdit($subscriberId, $mailingId, $listId, $listType, $action)
 {
     global $my, $Itemid;
     if (ACA_CMSTYPE) {
         // joomla 15
         $issue_nb = JRequest::getVar('issue_nb', '0');
         $my =& JFactory::getUser();
     } else {
         //joomla 1x
         $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 0));
         global $my;
     }
     //endif
     $accessGrant = false;
     $new = 0;
     if (class_exists('pro')) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if ($listId > 0) {
             $list = lists::getOneList($listId);
             $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
             $acc_level = $list->acc_level;
         } else {
             return false;
         }
         if (acajoom::checkPermissions('hello', 0, $acc_level)) {
             $accessGrant = true;
         }
     } else {
         if ($subscriberId != 0 and ($my->usertype == 'Administrator' or $my->usertype == 'Super Administrator')) {
             $accessGrant = true;
         }
     }
     if ($accessGrant) {
         if ($issue_nb == 0) {
             $issue_nb = xmailing::countMailings($listId, '');
             $issue_nb++;
         }
         if (empty($mailing)) {
             if ($mailingId > 0) {
                 $mailing = xmailing::getOneMailing('', $mailingId, $issue_nb, $new);
             } else {
                 if ($listId > 0) {
                     $list = lists::getOneList($listId);
                     $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
                 } else {
                     return false;
                 }
             }
         }
         $mainLink = '.php?option=com_acajoom&act=savemailing';
         compa::completeLink($mainLink, false);
         $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" >' . "\n\r";
         $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />';
         $show = lisType::showType($mailing->list_type, 'editmailing');
         frontHTML::formStart(_ACA_EDIT_A . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $mailing->html, 'edit_mailing');
         mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
         $go[] = acajoom::makeObj('act', $action);
         frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]), $go);
     } else {
         echo acajoom::printM('red', _NOT_AUTH);
     }
     return true;
 }
Exemplo n.º 4
0
/**
* @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
*/
function mailing($action, $task, $listId, $listType, $mailingId, $message)
{
    $showMailings = false;
    switch ($task) {
        case 'edit':
            if (ACA_CMSTYPE) {
                // joomla 15
                $issue_nb = intval(JRequest::getVar('issue_nb', 1));
            } else {
                //joomla 1x
                $issue_nb = intval(mosGetParam($_REQUEST, 'issue_nb', 1));
            }
            //endif
            $list = lists::getOneList($listId);
            $mailing = xmailing::getOneMailing($list, $mailingId, $issue_nb, $new);
            $show = lisType::showType($mailing->list_type, 'editmailing');
            if ($mailing->published != 1 or $mailing->list_type != 1 or isset($show['admin']) and $show['admin']) {
                $forms['main'] = " <form action='index2.php' method='post' enctype='multipart/form-data' name='adminForm'> \n ";
                xmailing::_header($task, $action, $mailing->list_type, $message, 'edit');
                mailingsHTML::editMailing($mailing, $new, $listId, $forms, $show);
                $go[] = acajoom::makeObj('act', $action);
                backHTML::formEnd($go);
            } else {
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $mailing->list_type, $message);
                //backHTML::formStart();
                mailingsHTML::viewMailing($mailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $mailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'new':
        case 'add':
            if ($listId == 0) {
                echo "<script> alert('" . addslashes(_ACA_SELCT_MAILING) . "'); window.history.go(-1);</script>\n";
                return false;
            } else {
                $total = xmailing::countMailings($listId, '');
                $total++;
                compa::redirect('index2.php?option=com_acajoom&act=mailing&task=edit&mailingid=0&issue_nb=' . $total . '&listid=' . $listId);
            }
            break;
        case 'saveSend':
            xmailing::saveMailing($mailingId, $listId);
        case 'sendNewsletter':
            if ($listId < 1 or $listType < 0) {
                $mailing = xmailing::getOneMailing('', $mailingId, '', $new, true);
                $listId = $mailing->list_id;
                $listType = $mailing->list_type;
            }
            if (lisType::sendType($listType)) {
                $checkStatus = lists::checkStatus($listId);
                if ($checkStatus == false) {
                    $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NOT_PUBLISHED);
                    $showMailings = true;
                } else {
                    $receivers = subscribers::getSubscribers(-1, -1, '', $total, $listId, '', 1, 1, 'sub_emailA');
                    if (empty($receivers)) {
                        $message = acajoom::printYN(0, _ACA_MESSAGE_SENT_SUCCESSFULLY, _ACA_NO_SUSCRIBERS);
                        $showMailings = true;
                    } else {
                        $status = queue::sendNewsletter(true, $mailingId, $listId, $receivers, $message);
                        $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
                        $showMailings = true;
                        flush();
                        sleep(5);
                        compa::redirect('index2.php?option=com_acajoom&act=mailing&listype=' . $listType, $message);
                    }
                }
            } else {
                if (class_exists('auto')) {
                    $message = acajoom::printYN(auto::processQueue(true), _ACA_QUEUE_SENT_SUCCESS, _ACA_ERROR);
                }
                $showMailings = true;
            }
            break;
        case 'savePreview':
            xmailing::saveMailing($mailingId, $listId);
        case 'preview':
            if (ACA_CMSTYPE) {
                // joomla 15
                $emailaddress = JRequest::getVar('emailaddress', '');
            } else {
                //joomla 1x
                $emailaddress = mosGetParam($_REQUEST, 'emailaddress', '');
            }
            //endif
            if (!empty($emailaddress)) {
                $status = xmailing::preview($mailingId, $listId, $message);
                $message = acajoom::printYN($status, _ACA_MESSAGE_SENT_SUCCESSFULLY, $message);
            }
            backHTML::_header(_ACA_PREVIEW_TITLE, 'preview_f2.png', $message, $task, $action);
            mailingsHTML::previewMailingHTML($mailingId, $listId, $listType);
            if ($listId > 0) {
                $archivemailing = xmailing::getMailingView($mailingId, $listId);
            } else {
                $archivemailing = xmailing::getMailingView($mailingId);
            }
            $forms['main'] = '';
            $list = lists::getOneList($archivemailing->list_id);
            $textonly = '';
            acajoom_mail::getContent($archivemailing->images, $list->layout, $archivemailing->htmlcontent, $textonly);
            acajoom_mail::replaceClass($archivemailing->htmlcontent, $textonly);
            mailingsHTML::viewMailing($archivemailing, $forms);
            break;
        case 'view':
            if ($mailingId != 0) {
                if ($listId > 0) {
                    $archivemailing = xmailing::getMailingView($mailingId, $listId);
                } else {
                    $archivemailing = xmailing::getMailingView($mailingId);
                }
                $forms['main'] = " <form action='index2.php' method='post' name='adminForm'> \n\r";
                xmailing::_header($task, $action, $listType, $message);
                backHTML::formStart('', 0, '');
                mailingsHTML::viewMailing($archivemailing, $forms);
                $go[] = acajoom::makeObj('act', 'mailing');
                $go[] = acajoom::makeObj('task', 'viewmailing');
                $go[] = acajoom::makeObj('listid', $archivemailing->list_id);
                backHTML::formEnd($go);
            }
            break;
        case 'deleteMailing':
            $d['mailing'] = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::delete($d), @constant($GLOBALS[ACA . 'listname' . $d['mailing']->list_type]) . _ACA_SUCCESS_DELETED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancel':
            compa::redirect('index2.php?option=com_acajoom');
            break;
        case 'copy':
            $message = acajoom::printYN(xmailing::copyMailing($mailingId), _ACA_MAILING_COPY, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cancelMailing':
            $showMailings = true;
            break;
        case 'publishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::publishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_PUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'unpublishMailing':
            $mailing = xmailing::getOneMailing('', $mailingId, '', $new);
            $message = acajoom::printYN(xmailing::unpublishMailing($mailingId), @constant($GLOBALS[ACA . 'listname' . $mailing->list_type]) . ' ' . _ACA_UNPUBLISHED, _ACA_ERROR);
            $showMailings = true;
            break;
        case 'cpanel':
            backHTML::controlPanel();
            break;
        case 'save':
            $message = acajoom::printYN(xmailing::saveMailing($mailingId, $listId), _ACA_MAILING_SAVED, _ACA_ERROR);
            $showMailings = true;
            unset($GLOBALS["task"]);
            unset($_REQUEST["task"]);
            break;
        case 'show':
        default:
            $showMailings = true;
            break;
    }
    if ($showMailings) {
        xmailing::showMailings($task, $action, $listId, $listType, $message, true, _ACA_MENU_MAILING);
    }
    return true;
}
    function layout($mailingEdit, $lists, $show)
    {
        global $_MAMBOTS;
        global $_VERSION, $mainframe;
        $joomAca15 = $_VERSION->RELEASE != '1.0' && class_exists('JFactory') ? true : false;
        if ($joomAca15) {
            $editor =& JFactory::getEditor();
        }
        if (!empty($_SESSION['skip_subscribers' . $mailingEdit->id])) {
            echo 'If you click on the Send button, the process will skip the first ' . $_SESSION['skip_subscribers' . $mailingEdit->id] . ' subscribers';
        }
        ?>
	<fieldset class="acajoomcss">
	<legend><?php 
        echo @constant($GLOBALS[ACA . 'listname' . $mailingEdit->list_type]) . ' ' . _ACA_CONTENT;
        ?>
</legend>
	<table class="acajoomtable" cellspacing="1">
		<tbody>
		<tr>
			<td valign="top" width="59%">
		<?php 
        mailingsHTML::subject($mailingEdit, $lists, $show);
        if ($show['htmlcontent']) {
            if ($mailingEdit->html != 0) {
                if ($joomAca15) {
                    echo $editor->display('content', $mailingEdit->htmlcontent, '100%', '400', '80', '30');
                    echo $editor->getButtons('text');
                } else {
                    editorArea('editor2', $mailingEdit->htmlcontent, 'content', '100%;', '400', '80', '30');
                }
            } else {
                echo '<textarea name="content" rows="20" cols="75">' . $mailingEdit->htmlcontent . '</textarea>';
            }
        }
        ?>
			</td>
			<td valign="top" width="40%">
			<?php 
        $config_tabs = new mosTabs(0);
        $config_tabs->startPane('acaMailingOptions');
        $config_tabs->startTab(_ACA_LIST_T_GENERAL, 'acaMailingOptions.general');
        mailingsHTML::description($mailingEdit, $lists, $show);
        $config_tabs->endTab();
        $config_tabs->startTab(_ACA_LIST_OPT_TAG, 'acaMailingOptions.options');
        echo '<div style"width:280px;"><span class="editlinktip">';
        $tip = _ACA_INFO_MAILING_CONTENT;
        $title = _ACA_CONTENT;
        echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
        echo '</span><br /><strong>' . _ACA_USABLE_TAGS . '</strong><br />';
        echo _ACA_NAMEREP . '<br />' . _ACA_FIRST_NAME_REP;
        if ($mailingEdit->list_type == 7) {
            echo '<br />' . _ACA_TAGS_AUTONEWS;
        }
        if (class_exists('auto')) {
            echo '<br />' . _ACA_TAGS_ISSUE_NB . '<br />';
            echo '<br />' . _ACA_TAGS_DATE . '<br />';
        }
        if (class_exists('tags')) {
            echo '<br />' . _ACA_TAGS_CB . '<br />';
        }
        echo '</div>';
        $config_tabs->endTab();
        if (!$joomAca15) {
            $config_tabs->startTab(_ACA_LIST_OPT_IMG, 'acaMailingOptions.joom15');
            mailingsHTML::images($lists);
            $config_tabs->endTab();
        }
        if ($show['sitecontent']) {
            $config_tabs->startTab(_ACA_LIST_OPT_CTT, 'acaMailingOptions.content');
            echo _ACA_CONTENT_ITEM_SELECT_T;
            //echo _ACA_INSERT_CONTENT.'<br />';
            if ($joomAca15) {
                JPluginHelper::importPlugin('acajoom');
                $bot_results = $mainframe->triggerEvent('acajoombot_editabs');
            } else {
                $_MAMBOTS->loadBotGroup('acajoom');
                $bot_results = $_MAMBOTS->trigger('acajoombot_editabs');
            }
            if (!empty($bot_results)) {
                foreach ($bot_results as $bot_result) {
                    echo $bot_result[1];
                }
            }
            $config_tabs->endTab();
        }
        if ($GLOBALS[ACA . 'show_jcalpro'] and class_exists('pro')) {
            $config_tabs->startTab(_ACA_SHOW_JCALPRO, 'acaMailingOptions.jcalpro');
            mailingsHTML::jcalpro();
            $config_tabs->endTab();
        }
        if ($show['attachement']) {
            $config_tabs->startTab(_ACA_ATTACHMENTS, 'acaMailingOptions.attachement');
            mailingsHTML::attachement($mailingEdit, $lists, $show);
            $config_tabs->endTab();
        }
        $config_tabs->endPane();
        ?>
			</td>
		</tr>


	<?php 
        if ($show['textcontent'] and $mailingEdit->html) {
            ?>
		<tr>
			<td>
				<textarea name="alt_content" rows="20" cols="70"><?php 
            echo $mailingEdit->textonly;
            ?>
</textarea>
			</td>
			<td class="key" style="vertical-align: top;">
				<span class="editlinktip">
				<?php 
            $tip = _ACA_INFO_MAILING_NOHTML;
            $title = _ACA_NONHTML;
            echo compa::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
            ?>
				</span><br />
				<strong><?php 
            echo _ACA_USABLE_TAGS;
            ?>
</strong><br />
				<?php 
            echo _ACA_NAMEREP . '<br />' . _ACA_FIRST_NAME_REP;
            if ($mailingEdit->list_type == 7) {
                echo '<br />' . _ACA_TAGS_AUTONEWS;
            }
            ?>

			</td>
		</tr>
	<?php 
        }
        ?>
		</tbody>
	</table>
	</fieldset>
	<?php 
    }