public static function mailingOptions($action, $task, $listId, $mailingId, $subscriberId, $listType, $artId, $contentType, $blogId, $blogType, $dealId, $dealType, $tmplid, $flexiid, $flexitype, $captchaWidth = 80, $captchaHeight = 25, $captchaBGColor = '', $captchaFTColor = '') { $Itemid = JRequest::getInt('Itemid'); if (empty($Itemid)) { $Itemid = $GLOBALS[JNEWS . 'itemidAca']; } if (empty($lisType)) { $lisType = 1; } $acl = JFactory::getACL(); $database = JFactory::getDBO(); $my = JFactory::getUser(); $new = false; $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; $gids = array(); $gids = explode(',', $gid); if (empty($gids)) { $gids = $gid; } if (version_compare(JVERSION, '1.6.0', '<')) { $listsAddEdit = jNews_Lists::getIDswithacclevel($my->gid); } else { $groups = JAccess::getGroupsByUser($my->id); $listsAddEdit = jNews_Lists::getIDswithacclevel($groups); } //for popup window JHTML::_('behavior.modal'); if ($listType < 1) { $dropLlistPost = JRequest::getVar('droplist'); if (!empty($dropLlistPost)) { $maliste = explode('-', $dropLlistPost); $listType = $maliste[0]; $listId = $maliste[1]; } elseif ($listId > 0) { $maliste = jNews_Lists::getLists($listId, 0, null, 'listnameA', false, false, false, false); $listType = $maliste[0]->list_type; } } switch ($task) { case 'refreshcaptcha': $newcode = jNews_Captcha::generateCode('5'); $_SESSION['captcha'] = $newcode; $newesc = jNews_Captcha::encryptData($newcode, crypt($GLOBALS[JNEWS . 'captcha_code'], $GLOBALS[JNEWS . 'captcha_code'])); $newdecrypt = jNews_Captcha::decryptData($newesc, crypt($GLOBALS[JNEWS . 'captcha_code'], $GLOBALS[JNEWS . 'captcha_code'])); $newpath = JNEWS_JPATH_LIVE_NO_HTTPS . '/index.php?option=' . JNEWS_OPTION . '&act=captcha&tmpl=component&width=' . $captchaWidth . '&height=' . $captchaHeight . '&bgcolor=' . $captchaBGColor . '&ftcolor=' . $captchaFTColor . '&characters=5&esc=' . $newesc . '&encpwd=' . crypt($GLOBALS[JNEWS . 'captcha_code'], $GLOBALS[JNEWS . 'captcha_code']); echo '<div id="newcode">' . $newdecrypt . '</div>'; echo '<div id="newesc">' . $newesc . '</div>'; echo '<div id="newdecrypt">' . $newdecrypt . '</div>'; echo '<div id="newpath">' . $newpath . '</div>'; exit; break; case 'blogContent': $artId = $blogId; $contentType = $blogType; case 'flexicontent': $session =& JFactory::getSession(); if ($flexitype == 'country') { $flexCategoriesCountries = $session->get('flexi_countries', array(), 'JNEWLSETTER'); if (isset($flexCategoriesCountries[$flexiid])) { unset($flexCategoriesCountries[$flexiid]); } else { $flexCategoriesCountries[$flexiid] = $flexiid; } //we set this value in the session $session->set('flexi_countries', $flexCategoriesCountries, 'JNEWLSETTER'); } else { $flexCategoriesIndustries = $session->get('flexi_industries', array(), 'JNEWLSETTER'); if (isset($flexCategoriesIndustries[$flexiid])) { unset($flexCategoriesIndustries[$flexiid]); } else { $flexCategoriesIndustries[$flexiid] = $flexiid; } //we set this value in the session $session->set('flexi_industries', $flexCategoriesIndustries, 'JNEWLSETTER'); } break; case 'articleContent': jNews_Mailing::getContent($artId, $contentType, $task, $tmplid); break; case 'dealContent': jNews_Mailing::getDeal($dealId, $dealType, $tmplid); break; case 'listpanel': $listType = JRequest::getVar('listype'); if ($listType == 1 || $listType == 7) { frontHTML::showPanel('list'); } break; case 'cancel': frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); break; case 'delete': JRequest::checkToken() or die('Invalid Token'); if (empty($mailingId)) { echo '<script> javascript:alert("' . _JNEWS_DELETE_MAILING . '"); javascript:history.go(-1); </script>'; } else { $d['mailing'] = jNews_Mailing::getOneMailing('', $mailingId, '', $new); echo jnews::printYN(jNews_Mailing::delete($d), @constant($GLOBALS[JNEWS . 'listname' . $d['mailing']->list_type]) . _JNEWS_SUCCESS_DELETED, _JNEWS_ERROR); frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); } break; case 'togle': // defined toggle for publish and unpublish of mailings $id = JRequest::getVar('mailingid'); $col = JRequest::getVar('col'); $mailingId = !empty($id) && !empty($col) ? $id : $mailingId; $task = !empty($mailingId) && !empty($col) ? $col : $task; switch ($task) { case 'publishMailing': $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); jNews_Mailing::publishMailing($mailingId); break; case 'unpublishMailing': $mailing = jNews_Mailing::getOneMailing('', $mailingId, '', $new); jNews_Mailing::unpublishMailing($mailingId); break; default: break; } echo '<script> javascript:history.go(-1); </script>'; break; case 'edit': if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists) || jnews::checkPermissions('admin')) { if (empty($mailingId)) { echo '<script> javascript:alert("' . _JNEWS_SELECT_MAILING . '"); javascript:history.go(-1); </script>'; } else { frontEnd::mailingEdit($subscriberId, $mailingId, $listId, $listType, 'mailing'); //savemailing } } } else { //edit a mailing $canAccess = false; if (class_exists('jNews_Pro') && !empty($listId)) { $list = jNews_Lists::getOneList($listId); $accessAuthorizedA = explode(',', $list->acc_id); if (!is_array($accessAuthorizedA) || $accessAuthorizedA[0] != 'all') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $usergid = $my->gid; } else { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); } if (is_array($accessAuthorizedA)) { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $accessAuthorizedA); } else { if (!in_array($usergid, $accessAuthorizedA)) { $canAccess = false; } } } else { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $accessAuthorizedA); } else { if ($usergid != $accessAuthorizedA) { $canAccess = false; } } } } } //cehck if I am the owner of the list $archivemailing = jNews_Mailing::getOneMailing(0, $mailingId, 0, $new); if ($archivemailing->author_id == $my->id) { $canAccess = true; } if ($canAccess || jnews::checkPermissions('admin') || jnews::checkPermissions($gid) || !empty($listsAddEdit)) { if (empty($mailingId)) { echo '<script> javascript:alert("' . _JNEWS_SELECT_MAILING . '"); javascript:history.go(-1); </script>'; } else { frontEnd::mailingEdit($subscriberId, $mailingId, $listId, $listType, 'mailing', $canAccess); //savemailing } } } break; case 'new': case 'add': if ($GLOBALS[JNEWS . 'enable_jsub']) { if (!empty($my->id)) { $ownedlists = jNews_Lists::getOwnedlists($my->id); } if (!empty($ownedlists) || jnews::checkPermissions('admin')) { frontEnd::mailingEdit($subscriberId, $mailingId, $listId, $listType, 'mailing'); //savemailing } } else { //$list = jNews_Lists::getOneList($listId); $canAccess = false; if (class_exists('jNews_Pro') && !empty($listId)) { $list = jNews_Lists::getOneList($listId); $accessAuthorizedA = explode(',', $list->acc_id); if (!is_array($accessAuthorizedA) || $accessAuthorizedA[0] != 'all') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $usergid = $my->gid; } else { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); } if (is_array($accessAuthorizedA)) { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $accessAuthorizedA); } else { if (!in_array($usergid, $accessAuthorizedA)) { $canAccess = false; } } } else { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $accessAuthorizedA); } else { if ($usergid != $accessAuthorizedA) { $canAccess = false; } } } } } if ($canAccess || jnews::checkPermissions('admin') || jnews::checkPermissions($gid) || !empty($listsAddEdit)) { frontEnd::mailingEdit($subscriberId, $mailingId, $listId, $listType, 'mailing', true); //savemailing } } break; case 'archive': if (class_exists('jNews_Pro')) { $list = jNews_Lists::getOneList($listId); $listIds = explode(',', $list->acc_id); if (!is_array($listIds) || $listIds[0] != 'all') { if (version_compare(JVERSION, '1.6.0', '<')) { //j15 $usergid = $my->gid; } else { if (version_compare(JVERSION, '3.0.0', '>')) { //j3.0 $usergid = JAccess::getGroupsByUser($my->id, false); //this is huck for joomla >3.0 because if you check this link http://joomla.dev/administrator/index.php?option=com_config&view=component&component=com_users&return=aHR0cDovL2pvb21sYS5kZXYvYWRtaW5pc3RyYXRvci9pbmRleC5waHA%2Fb3B0aW9uPWNvbV91c2VycyZ2aWV3PWdyb3Vwcw%3D%3D //you will see Guest User Group = Public by default and into db table #__extensions where element == com_users => params => you will see guest_usergroup == 13 // but if you try to change user group in brovser to registered for example => save=>save again as public => check again db=> you will see guest_usergroup = 1 //i think it is joomla bug because if jommla woks fine needs to be 13 // thants why i created this "if" if ($usergid[0] === '13') { $usergid[0] = '1'; } } else { //j16 $usergid = JAccess::getGroupsByUser($my->id, false); } } if (is_array($listIds)) { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $listIds); if (empty($canAccess)) { break; } } else { if (!in_array($usergid, $listIds)) { break; } } } else { if (is_array($usergid)) { $canAccess = array_intersect($usergid, $listIds); if (empty($canAccess)) { break; } } else { if ($usergid != $listIds) { break; } } } } } frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, true, _JNEWS_MENU_VIEW_ARCHIVE . ' '); break; case 'save': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); break; case 'savepreview': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Mailing::saveMailing($mailingId, $listId), _JNEWS_MAILING_SAVED, _JNEWS_ERROR); case 'preview': case 'view': if ($mailingId != 0) { if ($listId > 0) { $archivemailing = jNews_Mailing::getMailingView($mailingId, $listId); } else { $archivemailing = jNews_Mailing::getMailingView($mailingId); } $list = jNews_Lists::getOneList($listId); $acc_level = $list->acc_level; jNews_ProcessMail::replaceClass($archivemailing->htmlcontent, $archivemailing->textonly); if (!empty($archivemailing->template_id)) { jNews_Templates::includeStyles($archivemailing->htmlcontent, $archivemailing->template_id); } $archivemailing->htmlcontent = str_replace('{tag:subscriptions}', '', $archivemailing->htmlcontent); $mainLink = JRoute::_('index.php?option=' . JNEWS_OPTION); $forms['main'] = '<form method="post" action="' . $mainLink . '" onsubmit="submitbutton();return false;" name="mosForm" >' . "\n\r"; $forms['main'] .= '<input type="hidden" name="Itemid" value="' . $Itemid . '" />'; //for view it online view $currentUrl = JURI::current(); $gid = !empty($GLOBALS[JNEWS . 'list_creatorfe']) ? $GLOBALS[JNEWS . 'list_creatorfe'] : 0; if (version_compare(JVERSION, '1.6.0', '<')) { $listsAddEdit = jNews_Lists::getIDswithacclevel($my->gid); } else { $groups = JAccess::getGroupsByUser($my->id); if (!$my->id) { $listsAddEdit = array(); } else { $listsAddEdit = jNews_Lists::getIDswithacclevel($groups); } } if (jnews::checkPermissions('admin') || jnews::checkPermissions($gid) || !empty($listsAddEdit)) { $menuA = array(); $onlyPreview = JRequest::getInt('onlypreview'); if (!$onlyPreview) { //menu Preview $menuNew = new stdClass(); $menuNew->popup = new stdClass(); $menuNew->popup->isPop = false; $menuNew->action = 'view'; $linkBut = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=view&mailingid=' . $mailingId . '&onlypreview=1'); $menuNew->link = $linkBut; $menuNew->onclick = new stdClass(); $menuNew->onclick->custom = true; $menuNew->onclick->js = ''; $menuNew->title = _JNEWS_VIEW_BROWSER; $menuA['view'] = $menuNew; //menu edit $menuNew = new stdClass(); $menuNew->popup = new stdClass(); $menuNew->popup->isPop = false; $menuNew->action = 'edit'; $linkBut = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=edit&mailingid=' . $mailingId . '&listype=' . $listType); $menuNew->link = $linkBut; $menuNew->onclick = new stdClass(); $menuNew->onclick->custom = true; $menuNew->onclick->js = ''; $menuNew->title = 'Edit'; $menuA['edit'] = $menuNew; //menu send $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; $menuA['sendready'] = $menuSend; // menu back $menuBack = new stdClass(); $menuBack->popup = new stdClass(); $menuBack->popup = new stdClass(); $menuBack->popup->isPop = false; $menuBack->link = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing', false); $menuBack->action = 'back'; $menuBack->onclick = new stdClass(); $menuBack->onclick->custom = true; $menuBack->onclick->js = ''; $menuBack->title = _JNEWS_MENU_BACK; $menuA['back'] = $menuBack; } frontHTML::formStart(_JNEWS_NEWSLETTER_ARCHIVE, 0, '', $menuA); } else { //can be improved where we check if user can edit if (empty($archivemailing->visible) || empty($archivemailing->published) && $task == 'view') { echo '<center>Access to this mailing is restricted!<center>'; break; } frontHTML::formStart(_JNEWS_NEWSLETTER_ARCHIVE, 0, '', null); } jNews_MailingsHTML::viewMailing($archivemailing, $forms); $go[] = jnews::makeObj('act', 'mailing'); $go[] = jnews::makeObj('task', 'viewmailing'); $go[] = jnews::makeObj('listid', $archivemailing->list_id); frontHTML::formEnd('', $go); } else { frontHTML::FEmenu(); frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); } break; case 'sendready': //we update the senddate of the newsletter jNews_Mailing::updatesenddate($mailingId); jNews_MailingsHTML::sendReady($mailingId, $listId, $listType); break; case 'send': if (!(require_once JNEWSPATH_CLASS . 'class.queue.php')) { return false; } $queueC = new jNews_Queue(); $queueC->checkForNewsletters($mailingId); $queueCount = jNews_Queue::getQueueCount($mailingId); $totalSub = JRequest::setVar('totalsend', $queueCount); $linkBut = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=continuesend&mailingid=' . $mailingId . '&totalsend=' . $totalSub, true, false, true); jNews_Tools::redirect($linkBut); //this line was commented out, we need this so that when we click the send button in the frontend the status of the sending will be displayed break; case 'continuesend': if (require_once JNEWSPATH_CLASS . 'class.queue.php') { $queueC = new jNews_Queue(); $totalSend = JRequest::getVar('totalsend', 0, '', 'int'); $alreadySent = JRequest::getVar('alreadysent', 0, '', 'int'); $queueC->start = $alreadySent; $queueC->total = $totalSend; $queueC->pause = $GLOBALS[JNEWS . 'pause_time']; $queueC->sendQueue(false, $mailingId, false, true); } ob_start(); exit; break; case 'unpublished': JRequest::checkToken() or die('Invalid Token'); jNews_Mailing::unpublishMailing($mailingId); frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); break; case 'copy': JRequest::checkToken() or die('Invalid Token'); $message = jnews::printYN(jNews_Mailing::copyMailing($mailingId), _JNEWS_MAILING_COPY, _JNEWS_ERROR); if (empty($listId) or $listId == 0) { $lsid = jNews_Mailing::getListId($mailingId); } jNews_Mailing::insertListMailings($listId); frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, false, _JNEWS_MENU_MAILING); break; case 'cpanel': jNews_Tools::redirect('index.php?option=' . JNEWS_OPTION); break; default: //alex archive // $viewarchive = false; // if(empty($my->id)) $viewarchive = true; $viewarchive = true; frontEnd::showMailingsFront($task, $action, $subscriberId, $listId, $listType, $viewarchive, _JNEWS_MENU_MAILING); break; } return true; }
function createOld() { $my = JFactory::getUser(); $Itemid = $GLOBALS[JNEWS . 'itemidAca']; if (!empty($Itemid)) { $item = '&Itemid=' . $Itemid; } else { $item = ''; } $this->_addCSS(); $hidden = ''; $htmlOK = false; $HTML = ''; $formname = 'modjnewsForm' . $this->num; //check if subscription listing is not empty //if not empty print the module //else just print the message $HTML .= '<div id="jnews_module' . $this->num . '">'; switch ($this->effect) { case 'default': $HTML .= ''; break; case 'mootools-slide': $HTML .= $this->_addMootoolsSlide(); break; case 'mootools-modal': $HTML .= $this->_addMootoolsModal(); break; default: $HTML .= ''; } if (!empty($this->lists)) { $subscriber = ''; if ($my->id > 0) { //login $loggedin = true; $subscriber = $this->_getSubscriberInfo($my->id); if (empty($subscriber)) { $loggedin = false; } } else { //logout $loggedin = false; } if (!$loggedin && $GLOBALS[JNEWS . 'allow_unregistered']) { $HTML .= $this->_printscript(); } if (!$GLOBALS[JNEWS . 'disabletooltip']) { if (version_compare(JVERSION, '3.0.0', '<')) { JHTML::_('behavior.tooltip'); } else { JHtml::_('behavior.tooltip'); } } $linkForm = 'option=' . JNEWS_OPTION; $linkForm = jNews_Tools::completeLink($linkForm, false, false); $HTML .= '<form action="' . $linkForm . '" method="post" name="modjnewsForm' . $this->num . '">'; //pretext if (!empty($this->introtext)) { $text = '<span class="pretext">' . $this->introtext . '</span>'; $HTML .= jnews::printLine($this->linear, $text); } //subscription list///889 $HTML .= $this->_showSubcriptionListOld($subscriber, $loggedin, $item); if (!$loggedin) { if ($GLOBALS[JNEWS . 'allow_unregistered']) { $HTML .= $this->showInputFields(); } else { //required registered $HTML .= $this->NeedToRegister(); $htmlOK = false; } $HTML .= $this->showReceiveHTML($subscriber); $HTML .= $this->showTerms($subscriber); //for captcha if ($GLOBALS[JNEWS . 'level'] > 1) { //check the version is plus or pro if (empty($esc) && $this->enable_captcha) { //check if $esc has been initialized $code = jNews_Captcha::generateCode('5'); $HTML .= $this->_showCaptcha($code); $hidden .= $this->_showCaptchaHidden($code); } } $HTML .= $this->_showButton(false); } else { //login $HTML .= $this->forLoggedIn($Itemid); } if (!empty($this->posttext)) { $text = '<span class="postext">' . $this->posttext . '</span>'; $HTML .= jnews::printLine($this->linear, $text); } if (version_compare(JVERSION, '3.0.0', '<')) { $HTML .= JHTML::_('form.token'); } else { $HTML .= JHtml::_('form.token'); } $HTML .= $hidden . '</form>'; } else { // no listing $HTML .= '<p class="jnews-nolist">' . _JNEWS_LIST_NOT_AVAIL . '</p>'; } if ($this->effect != 'mootools-slide') { $HTML .= '<div style="display:none; width:50px;" id="message' . $this->num . '"></div>'; $HTML .= '<div style="display:none; width:50px; padding-top:5px; height:100%" id="ajax_loading' . $this->num . '"><img alt="loader" src="' . JURI::base() . 'components/' . JNEWS_OPTION . '/images/16/ajax-loader.gif"/>' . _JNEWS_PLEASE_WAIT . '</div>'; } $HTML .= ''; switch ($this->effect) { case 'mootools-slide': $HTML .= '</div></div>'; break; case 'mootools-modal': $HTML .= '</div></div></div>'; break; case 'default': default: break; } $HTML .= '</div>'; $HTML .= '<div style="display:none" ><a href="http://www.joobi.co">Joomla Extensions</a> powered by Joobi</div>'; return $HTML; }
public static function editSubscriber($subscriber, $listings, $queues, $forms, $access = false, $frontEnd = false, $cb = false) { $mainframe = JFactory::getApplication(); $my = JFactory::getUser(); if (!$GLOBALS[JNEWS . 'disabletooltip']) { if (version_compare(JVERSION, '3.0.0', '<')) { JHTML::_('behavior.tooltip'); } else { JHtml::_('behavior.tooltip'); } } if (empty($subscriber->receive_html)) { $subscriber->receive_html = 0; } $lists['receive_html'] = jnews::HTML_BooleanList('receive_html', 'class="inputbox"', $subscriber->receive_html, JText::_(_CMN_YES), JText::_(_CMN_NO)); //Fixed added by Lorenz Meyer for the Yes No Translation if (empty($subscriber->confirmed)) { $subscriber->confirmed = 0; } $lists['confirmed'] = jnews::HTML_BooleanList('confirmed', 'class="inputbox"', $subscriber->confirmed, JText::_(_CMN_YES), JText::_(_CMN_NO)); if (empty($subscriber->blacklist)) { $subscriber->blacklist = 0; } $lists['blacklist'] = jnews::HTML_BooleanList('blacklist', 'class="inputbox"', $subscriber->blacklist, JText::_(_CMN_YES), JText::_(_CMN_NO)); $br = "\n\r"; $html = $forms['main']; $html .= '<div style="width:100%; align:left;">' . $br; $html .= '<fieldset class="jnewscss" style="padding: 10px; text-align: left">' . $br; $html .= '<legend><strong>' . _JNEWS_SUB_INFO . '</strong></legend>' . $br; $html .= '<table cellpadding="2" cellspacing="0" align="center"><tr><td>' . $br; if (empty($subscriber->name)) { $subscriber->name = ''; } $text = str_replace('"', '"', $subscriber->name); if (function_exists('htmlspecialchars_decode')) { $text = htmlspecialchars_decode($text, ENT_NOQUOTES); } elseif (function_exists('html_entity_decode')) { $text = html_entity_decode($text, ENT_NOQUOTES); } if (!$cb) { $html .= jnews::miseEnHTML(_JNEWS_INPUT_NAME, _JNEWS_INPUT_NAME_TIPS, '<input type="text" name="name" size="30" value="' . $text . '" class="inputbox" />'); if (empty($subscriber->email) || !jNews_Subscribers::validEmail($subscriber->email)) { $subscriber->email = ''; } $html .= jnews::miseEnHTML(_JNEWS_INPUT_EMAIL, _JNEWS_INPUT_EMAIL_TIPS, '<input type="text" name="email" size="30" class="inputbox" value="' . $subscriber->email . '" />'); //additional columns if ($GLOBALS[JNEWS . 'level'] > 2) { //check if the version of jnews is pro if (empty($subscriber->column1)) { $subscriber->column1 = ''; } if (empty($subscriber->column2)) { $subscriber->column2 = ''; } if (empty($subscriber->column3)) { $subscriber->column3 = ''; } if (empty($subscriber->column4)) { $subscriber->column4 = ''; } if (empty($subscriber->column5)) { $subscriber->column5 = ''; } if ($GLOBALS[JNEWS . 'show_column1']) { //show column1 $html .= jnews::miseEnHTML($GLOBALS[JNEWS . 'column1_name'], _JNEWS_INPUT_COLUMN_TIPS . '1', '<input type="text" name="column1" size="30" class="inputbox" value="' . $subscriber->column1 . '" />'); } if ($GLOBALS[JNEWS . 'show_column2']) { //show column2 $html .= jnews::miseEnHTML($GLOBALS[JNEWS . 'column2_name'], _JNEWS_INPUT_COLUMN_TIPS . '2', '<input type="text" name="column2" size="30" class="inputbox" value="' . $subscriber->column2 . '" />'); } if ($GLOBALS[JNEWS . 'show_column3']) { //show column3 $html .= jnews::miseEnHTML($GLOBALS[JNEWS . 'column3_name'], _JNEWS_INPUT_COLUMN_TIPS . '3', '<input type="text" name="column3" size="30" class="inputbox" value="' . $subscriber->column3 . '" />'); } if ($GLOBALS[JNEWS . 'show_column4']) { //show column4 $html .= jnews::miseEnHTML($GLOBALS[JNEWS . 'column4_name'], _JNEWS_INPUT_COLUMN_TIPS . '4', '<input type="text" name="column4" size="30" class="inputbox" value="' . $subscriber->column4 . '" />'); } if ($GLOBALS[JNEWS . 'show_column5']) { //show column5 $html .= jnews::miseEnHTML($GLOBALS[JNEWS . 'column5_name'], _JNEWS_INPUT_COLUMN_TIPS . '5', '<input type="text" name="column5" size="30" class="inputbox" value="' . $subscriber->column5 . '" />'); } } } else { $html .= '<input type="hidden" name="cb_integration" value="1" />'; } if (empty($subscriber->ip)) { $subscriber->ip = ''; } //$mainframe = JFactory::getApplication(); if ($mainframe->isAdmin() or $GLOBALS[JNEWS . 'sub_info_fields']) { $html .= jnews::miseEnHTML(_JNEWS_IP, _JNEWS_IP_TIPS, $subscriber->ip); } $html .= jnews::miseEnHTML(_JNEWS_RECEIVE_HTML, _JNEWS_RECEIVE_HTML_TIPS, $lists['receive_html']); if ($GLOBALS[JNEWS . 'time_zone'] == 1) { $html .= jnews::miseEnHTML(_JNEWS_TIME_ZONE_ASK, _JNEWS_TIME_ZONE_ASK_TIPS, ' <input type="text" name="timezone" size="30" class="inputbox" value="' . $subscriber->timezone . '" />'); } else { if (empty($subscriber->timezone)) { $subscriber->timezone = ''; } $html .= '<input type="hidden" name="timezone" value="' . $subscriber->timezone . '" />'; } if ($access) { if (empty($subscriber->user_id)) { $subscriber->user_id = 0; } if ($subscriber->user_id == 0) { if ($mainframe->isAdmin() or $GLOBALS[JNEWS . 'confirm_html']) { $html .= jnews::miseEnHTML(_JNEWS_CONFIRMED, '', $lists['confirmed']); } } else { if (!$cb || !$mainframe->isAdmin()) { $html .= '<input type="hidden" name="confirmed" value="' . $subscriber->confirmed . '" />'; } } //improvement added; blacklist will only be shown in the backend if ($mainframe->isAdmin() || $GLOBALS[JNEWS . 'sub_info_fields']) { $html .= jnews::miseEnHTML(_JNEWS_BLACK_LIST, '', $lists['blacklist']); } if (empty($subscriber->subscribe_date)) { $subscriber->subscribe_date = 0; } if ($mainframe->isAdmin() or $GLOBALS[JNEWS . 'sub_info_fields']) { $html .= jnews::miseEnHTML(_JNEWS_REGISTRATION_DATE, '', date('Y-m-d h:i', jnews::getNow(0, true, $subscriber->subscribe_date))); $html .= jnews::miseEnHTML(_JNEWS_USER_ID, '', $subscriber->user_id); } } else { $html .= '<input type="hidden" name="confirmed" value="' . $subscriber->confirmed . '" />'; $html .= '<input type="hidden" name="blacklist" value="' . $subscriber->blacklist . '" />'; } //captcha FE if (empty($my->id) && !$cb && !$mainframe->isAdmin() && class_exists('jNews_Captcha') && $GLOBALS[JNEWS . 'level'] > 2) { if (extension_loaded('gd') && extension_loaded('mcrypt')) { $gdinfo = gd_info(); // $captchaHTML=''; $moduleParams = self::getModuleParams(); $captcha_width = $moduleParams->get('captcha_width'); $captcha_height = $moduleParams->get('captcha_height'); $captcha_bgcolor = urlencode($moduleParams->get('captcha_bgcolor')); $captcha_ftcolor = urlencode($moduleParams->get('captcha_ftcolor')); if ($gdinfo['FreeType Support']) { if (isset($_SESSION) && !isset($_SESSION['captcha'])) { $code = jNews_Captcha::generateCode('5'); $_SESSION['captcha'] = $code; } else { $code = $_SESSION['captcha']; } // $captchaHTML .= '<div class="subscriptionCaptcha" style="float:left;">'; // $escaptcha = jNews_Captcha::encryptData($code, crypt( $GLOBALS[JNEWS.'captcha_code'], $GLOBALS[JNEWS.'captcha_code'] ) ); // $esc = $escaptcha; // $decrypt=jNews_Captcha::decryptData( $esc, crypt( $GLOBALS[JNEWS.'captcha_code'], $GLOBALS[JNEWS.'captcha_code'] ) ); // $path= JNEWS_JPATH_LIVE_NO_HTTPS.'/index.php?option='.JNEWS_OPTION.'&act=captcha&tmpl=component&width='.$captcha_width.'&height='.$captcha_height.'&bgcolor='.$captcha_bgcolor.'&ftcolor='.$captcha_ftcolor.'&characters=5&esc='. $esc.'&encpwd='.crypt($GLOBALS[JNEWS.'captcha_code'],$GLOBALS[JNEWS.'captcha_code'] ); // $captchaHTML .= '<img alt="catchme" style="border: 0px;" src="'. $path .'" id="captcha_image1" />'; // $url = htmlentities( jNews_Tools::completeLink( 'option='.JNEWS_OPTION.'&act=mailing&task=refreshcaptcha&captchawidth='.$captcha_width.'&captchaheight='.$captcha_height .'&captchabgcolor='.$captcha_bgcolor.'&captchaftcolor='.$captcha_ftcolor, false, false, true ) ); // $captchaHTML .= ' <img alt="refresh" style="border: 0px;" src="'. JURI::base().'components/'.JNEWS_OPTION.'/images/refresh.png" onclick="refreshCaptcha1(\''.$url.'\');" id="refreshButton" title="Refresh Captcha" />'; // $captchaHTML .= '</div>'; // $captchaHTML .='<div class="entered_captcha"><input class="inputbox" title ="'._JNEWS_CAPTCHA_TIPS.'" name="security_code" size="7" type="text" class="entered_captcha"/></div>'; // $captchaHTML .= '</div>'; $captchaHTML = self::_showCaptcha($code); $html .= jnews::miseEnHTML(_JNEWS_CAPTCHA_CAPTION, '', $captchaHTML); // $escaptcha = jNews_Captcha::encryptData($code, crypt($GLOBALS[JNEWS.'captcha_code'],$GLOBALS[JNEWS.'captcha_code'])); // $esc = $escaptcha; // $newdecrypt = jNews_Captcha::decryptData($esc, crypt($GLOBALS[JNEWS.'captcha_code'],$GLOBALS[JNEWS.'captcha_code'])); // $html .='<input type="hidden" id="security_captcha1" name="security_captcha" value="'.$esc.'" />'; // $html .='<input type="hidden" id="captcode1" name="captcode" value="'.$newdecrypt.'" />'; $html .= self::_showCaptchaHidden($code, "2"); //checking of captcha $captcha_width = (int) $captcha_width; $captcha_height = (int) $captcha_height; $js = ' function insertNewCaptcha1(html){ var form = document.adminForm; if(!form){ form = document.mosForm; } var window = document.getElementById("sbox-content"); var root = document.getElementById("captcha1"); if(form.security_code.value == "") {alert( "' . addslashes(_JNEWS_REGWARN_CAPTCHA) . '" ); return false;} if(form.captcode.value != "version2" && form.security_code.value != form.captcode.value){ alert( "' . addslashes(_JNEWS_CAPTCHA_MSG) . '" );return false; } if(root == null){ root = document.createElement(\'div\'); root.setAttribute("style", "width:10px;heigth:10px;display:none;"); root.setAttribute("id", "captcha1"); var body = document.getElementsByTagName(\'body\')[0].appendChild(root); } root.innerHTML = html; var newcode = document.getElementById(\'newcode\'); var newesc = document.getElementById(\'newesc\'); var newdecrypt = document.getElementById(\'newdecrypt\'); var newpath = document.getElementById(\'newpath\'); var newsecuritycaptcha = document.getElementById(\'security_captcha1\'); var newcaptcode = document.getElementById(\'captcode1\'); var image = document.getElementById(\'captcha_image1\'); var path = newpath.innerHTML; var intIndexOfMatch = path.indexOf( "&" ); while (intIndexOfMatch != -1){ path= path.replace( "&", "&" ); intIndexOfMatch = path.indexOf( "&" ); } image.setAttribute("src", path); image.setAttribute("width", ' . $captcha_width . '); image.setAttribute("height", ' . $captcha_height . '); newsecuritycaptcha.value = newesc.innerHTML; newcaptcode.value = newcode.innerHTML; if(window != null){ windowImages = window.getElementsByTagName("img"); windowInput = window.getElementsByTagName("input"); var captcha_image = windowImages.captcha_image1; var captcode = windowInput.captcode1; var security_captcha = windowInput.security_captcha1; security_captcha.value = newesc.innerHTML; captcode.value = newcode.innerHTML; captcha_image.setAttribute("src", path); } document.getElementById(\'entered_captcha\').value=\'\'; document.getElementsByTagName(\'body\')[0].removeChild(root); } '; if (version_compare(JVERSION, '1.6.0', '<')) { //1.5 $js .= "function refreshCaptcha1(url){\n\t var form = document.adminForm;\n\t\t\t\tif(!form){\n\t\t\t\t\tform = document.mosForm;\n\t\t\t\t}\n\t\t\tvar ajax = new Ajax(url,{data: 'height=1',method: 'POST',onComplete : function(result){insertNewCaptcha1(result); }});ajax.request();}"; } else { $js .= "function refreshCaptcha1(url){\n\t var ajax = new Request({url : url,data: 'height=1',method: 'POST',onComplete : function(result){insertNewCaptcha1(result); }});ajax.send();}"; } $document = JFactory::getDocument(); $document->addScriptDeclaration($js, 'text/javascript'); } else { echo 'Your Server does not support GD Library FreeType Support do the captcha cannot be shown!'; echo '<br />Please enable the GD Library FreeType Support to see the captcha.'; } } } $html .= '</table>'; $html .= '</fieldset></div>'; if (!$cb) { $lists = $mainframe->isAdmin() ? jNews_Lists::getLists(0, 1, '', '', false, true, true, false, false) : jNews_Lists::getLists('', 1, '', '', false, true, false, false, true); $listsAr = $mainframe->isAdmin() ? jNews_Lists::getLists(0, 2, '', '', false, true, true, false, false) : jNews_Lists::getLists('', 2, '', '', false, true, false, false, true); } else { $lists = $listings; $listsAr = array(); } if (empty($listsAr)) { $listwidth = '100%'; } else { $listwidth = '50%'; } if (empty($lists)) { $listarwidth = '100%'; } else { $listarwidth = '50%'; } $html .= '<table width="100%"><tr>'; $html .= '<td width="' . $listwidth . '">'; $html .= jNews_SubscribersHTML::showSubscriberLists($subscriber, $lists, $queues, $frontEnd, $access); $html .= '</td>'; $html .= '<td width="' . $listarwidth . '" valign="top">'; $html .= jNews_SubscribersHTML::showSubscriberLists($subscriber, $listsAr, $queues, $frontEnd, $access); $html .= '</td>'; $html .= '</tr></table>'; return $html; }