public static function showSubscriberLists($subscriberId, $action) { $lists = jNews_Lists::getLists(0, 0, $subscriberId, '', false, true, false); if ($subscriberId == 0) { $subscriber = ''; $queues = ''; jNews_SubscribersHTML::showSubscriberLists($subscriber, $lists, $queues, true); } else { frontEnd::subscriptions('', $subscriberId, 0, 'save'); } return true; }
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; }