public static function mailingEdit($subscriberId, $mailingId, $listId, $listType = '', $action, $grantCAnAccess = false) { global $my, $Itemid; $issue_nb = JRequest::getVar('issue_nb', '0'); $my = JFactory::getUser(); if (version_compare(JVERSION, '1.6.0', '>=')) { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); $my->gid = $usergid[0]; } $accessGrant = false; if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } $new = 0; if (class_exists('jNews_Pro')) { if ($issue_nb == 0) { $issue_nb = jNews_Mailing::countMailings($listId, ''); $issue_nb++; } if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } else { if (!empty($ownedlists)) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } else { $listId = jNews_Lists::getIDacclevel($my->gid); $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); $acc_level = $list->acc_level; } } $id = 0; if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists)) { $id = $my->id; } } if (jnews::checkPermissions($acc_level)) { $accessGrant = true; } } else { if ($subscriberId != 0 && jnews::checkPermissions('admin')) { $accessGrant = true; } } if (@(include_once JNEWSPATH_ADMIN . 'social' . DS . 'class.social.php')) { if (class_exists('jNews_Social') && !$GLOBALS[JNEWS . 'enable_jsub']) { $accessGrant = true; } } if ($accessGrant || $grantCAnAccess) { if ($issue_nb == 0) { $issue_nb = jNews_Mailing::countMailings($listId, ''); $issue_nb++; } if (empty($mailing)) { if ($mailingId > 0) { $mailing = jNews_Mailing::getOneMailing('', $mailingId, $issue_nb, $new); } else { if ($listId > 0) { $list = jNews_Lists::getOneList($listId); $mailing = jNews_Mailing::getOneMailing($list, $mailingId, $issue_nb, $new); } else { return false; } } } $mainLink = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid; $mainLink = jNews_Tools::completeLink($mainLink, false, false); $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); //$forms['main'] = '<form method="post" enctype="multipart/form-data" action="'. $mainLink . '" onsubmit="submitbutton();return false;" name="adminForm" id="adminForm">'."\n\r"; $forms['main'] = '<form method="post" enctype="multipart/form-data" action="' . $mainLink . '" name="adminForm" id="adminForm">' . "\n\r"; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; $show = jNews_ListType::showType($mailing->mailing_type, 'editmailing'); $menuA = null; if ($GLOBALS[JNEWS . 'level'] > 1) { //menu object start here //to create the template menu $listype = JRequest::getInt('listype', 0, 'request'); $menuTag = new stdClass(); $menuTag->link = 'administrator/' . jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', true, false, true); if ($listype == 7) { $delaymax = JRequest::getInt('delay_max', 0, 'request'); $notifyID = JRequest::getInt('notify_id', 0, 'request'); $catid = JRequest::getVar('cat_id', 0, 'request'); $menuTag->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags&listype=' . $listype . '&cat_id=' . $catid . '&delay_max=' . $delaymax . '¬ify_id=' . $notifyID, false, false, true); } else { $menuTag->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=tags', false, false, true); } $menuTag->popup = new stdClass(); $menuTag->popup->isPop = true; $menuTag->popup->rel = true; $menuTag->popup->x = 750; $menuTag->popup->y = 500; $menuTag->action = 'tags'; $menuTag->title = _JNEWS_MAILING_TAG; //to create the template menu $menuTemplate = new stdClass(); $menuTemplate->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=templates&task=assign', false, false, true); $menuTemplate->popup = new stdClass(); $menuTemplate->popup->isPop = true; $menuTemplate->popup->rel = true; $menuTemplate->popup->x = 640; $menuTemplate->popup->y = 480; $menuTemplate->action = 'template'; $menuTemplate->title = _JNEWS_LIST_T_TEMPLATE; //to create cancel menu $menuCancel = new stdClass(); $menuCancel->popup = new stdClass(); $menuCancel->popup->isPop = false; $menuCancel->link = '#'; $menuCancel->action = 'cancel'; $menuCancel->onclick = new stdClass(); $menuCancel->onclick->custom = false; $menuCancel->onclick->js = ''; $menuCancel->title = _JNEWS_CANCEL; //to create save menu $linksave = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $listId . '&listype=' . $listType . '&Itemid=' . $Itemid; if ($listId == 0) { $linksave = 'option=' . JNEWS_OPTION . '&act=mailing&listype=' . $listType . '&Itemid=' . $Itemid; } $linksave = jNews_Tools::completeLink($linksave, false); $menuSave = new stdClass(); $menuSave->popup = new stdClass(); $menuSave->popup->isPop = false; $menuSave->link = '#'; $menuSave->action = 'save'; $menuSave->onclick = new stdClass(); $menuSave->onclick->custom = false; $menuSave->onclick->js = ''; $menuSave->title = _JNEWS_SAVE; //to create preview menu $menuPreview = new stdClass(); $menuPreview->popup = new stdClass(); $menuPreview->popup->isPop = false; $menuPreview->link = '#'; $menuPreview->action = 'savepreview'; $menuPreview->onclick = new stdClass(); $menuPreview->onclick->custom = false; $menuPreview->onclick->js = ''; $menuPreview->title = 'Preview'; //to create send menu $menuSend = new stdClass(); $menuSend->popup = new stdClass(); $menuSend->popup->isPop = true; $menuSend->popup->rel = true; $menuSend->popup->x = 750; $menuSend->popup->y = 500; $linkBut = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=sendready&mailingid=' . $mailingId . '&listype=' . $listType, true, false, true); $menuSend->link = $linkBut; $menuSend->action = 'sendready'; $menuSend->onclick = new stdClass(); $menuSend->onclick->custom = false; $menuSend->onclick->js = ""; $menuSend->title = _JNEWS_MENU_SEND; //to create the divider $menuDivider = new stdClass(); $menuDivider->divider = true; $menuA = array(); if (empty($mailingId)) { $menuA['template'] = $menuTemplate; } $menuA['tags'] = $menuTag; $menuA['divider1'] = $menuDivider; $menuA['preview'] = $menuPreview; $menuA['save'] = $menuSave; if ($listType == 1 && $mailingId != 0) { $menuA['send'] = $menuSend; } $menuA['divider'] = $menuDivider; $menuA['cancel'] = $menuCancel; } frontHTML::formStart(_JNEWS_EDIT_A . @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]), $mailing->html, 'edit_mailing', $menuA); jNews_MailingsHTML::editMailing($mailing, $new, $listId, $forms, $show, $listType); $go[] = jnews::makeObj('act', $action); $go[] = jnews::makeObj('listype', $listType); frontHTML::formEnd(_CMN_SAVE . ' ' . @constant($GLOBALS[JNEWS . 'listname' . $mailing->mailing_type]), $go); } else { echo jnews::printM('red', _NOT_AUTH); } return true; }
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; }