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="jnewscss" style="padding: 10px; text-align: left">' . $br; $html .= '<legend><strong>' . _JNEWS_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; } if ($GLOBALS['jnews_cb_showHTML']) { $html .= jnews::miseEnHTML(_JNEWS_RECEIVE_HTML, _JNEWS_RECEIVE_HTML_TIPS, $receive_html); } if ($GLOBALS['jnews_time_zone'] == 1) { $html .= jnews::miseEnHTML(_JNEWS_TIME_ZONE_ASK, _JNEWS_TIME_ZONE_ASK_TIPS, $subscriber->timezone); } $html .= '</table>'; $html .= '</fieldset></div>'; $html .= getjNewsTab::_showSubscriberLists($user, $subscriber, $listings, $queues, $frontEnd, $access); 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; }
public static function createTemplate(&$template, $form) { if (!class_exists('JHtmlBehavior')) { jimport('joomla.html.html.behavior'); } $tagjs = "function insertTag(tag){ try{if(jInsertEditorText(tag,'template_body')){ return true;}else{jInsertEditorText(tag,'alt_body'); return true}} catch(err){alert('Your editor does not enable jNews to automatically insert the tag, please copy/paste it manually in your Newsletter'); return false;}}"; if (!isset($template)) { $template = new stdClass(); } //we change the permission of the template //if we not change the permission to writable(755) the images won't show @($mediacomjNewsTemplatesdir = JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS . $template->namekey); @chmod(JNEWS_JPATH_ROOT_NO_ADMIN . DS . 'media' . DS . JNEWS_OPTION . DS . 'templates' . DS . $template->namekey, 0755); $template->name = isset($template->name) ? $template->name : ''; $template->namekey = isset($template->namekey) ? $template->namekey : ''; $template->published = isset($template->published) ? $template->published : 0; $template->premium = isset($template->premium) ? $template->premium : 0; $template->thumbnail = isset($template->thumbnail) ? $template->thumbnail : ''; $template->description = isset($template->description) ? $template->description : ''; $template->availability = isset($template->availability) ? $template->availability : '1'; $template->body = isset($template->body) ? $template->body : ''; $template->altbody = isset($template->altbody) ? $template->altbody : ''; $template->styles = isset($template->styles) ? $template->styles : ''; $template->csstyle = isset($template->csstyle) ? $template->csstyle : ''; $editor = JFactory::getEditor(); // if(!$GLOBALS[JNEWS.'disabletooltip']){ if (version_compare(JVERSION, '3.0.0', '<')) { JHTML::_('behavior.tooltip'); } else { JHtml::_('behavior.tooltip'); } $text = str_replace('"', '"', $template->name); $namekey = str_replace('"', '"', $template->namekey); if (function_exists('htmlspecialchars_decode')) { $text = htmlspecialchars_decode($text, ENT_NOQUOTES); $namekey = htmlspecialchars_decode($namekey, ENT_NOQUOTES); } elseif (function_exists('html_entity_decode')) { $text = html_entity_decode($text, ENT_NOQUOTES); $namekey = html_entity_decode($namekey, ENT_NOQUOTES); } $readOnlyNamekey = !empty($namekey) ? 'READONLY' : ''; $styles = $template->styles; $styles['color_bg'] = !empty($styles) && isset($styles['color_bg']) ? $styles['color_bg'] : '#FFFFFF'; $styles['cssfile'] = !empty($styles) && isset($styles['cssfile']) ? $styles['cssfile'] : ''; $templateHTML['name'] = '<input type="text" name="template_name" class="inputbox" size="40" maxlength="64" value="' . $text . '" />'; $templateHTML['namekey'] = '<input type="text" name="template_namekey" class="inputbox" size="40" maxlength="64" value="' . $namekey . '" ' . $readOnlyNamekey . ' />'; $templateHTML['publish'] = jnews::HTML_BooleanList('confirmed', 'class="inputbox"', $template->published); $templateHTML['premium'] = jnews::HTML_BooleanList('premium', 'class="inputbox"', $template->premium); $templateHTML['bgcolor'] = jnews::colorPicker('styles[color_bg]', 15, $styles['color_bg']); $templateHTML['thumbnail'] = jNews_TemplatesHTML::_attachment($template->thumbnail); $templateHTML['description'] = '<br/><textarea rows="5" cols="45" name="description">' . $template->description . '</textarea><br/>'; unset($styles['cssfile']); $templateHTML['cssfile'] = '<div id="cssfile" style="display:none;"><input type="text" name="styles[cssfile]" style="margin: 2px 0 2px 2px;" class="inputbox" size="45" value="' . jNews_Templates::escapeVal(@$styles['cssfile']) . '" />'; $templateHTML['cssfile'] .= '<input type="button" onclick="javascript:hideMainMenu(); submitbutton(\'apply\')" style="margin: 2px 0 2px 2px;" name="Process External CSS" class="button" value="' . _JNEWS_EXTERNALCSS_PROCESS . '"></div>'; // } //remove empty classname unset($styles['']); echo $form['main']; ?> <table cellpadding="1" cellspacing="0" border="0" width="99%"> <tbody> <tr> <td width="20%" valign="top"> <fieldset style="margin-top:7px;"> <?php echo jnews::beginingOfTable('jnewstable'); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_NAME, _JNEWS_TEMPLATE_NAME_T, $templateHTML['name']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_ALIAS, _JNEWS_TEMPLATE_NAMEKEY_T, $templateHTML['namekey']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_PUBLISH, _JNEWS_TEMPLATE_PUBLISH_T, $templateHTML['publish']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_DEFAULT, _JNEWS_TEMPLATE_DEFAULT_T, $templateHTML['premium']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_BG, _JNEWS_TEMPLATE_BG_T, $templateHTML['bgcolor']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_UPLOAD, _JNEWS_TEMPLATE_UPLOAD_T, $templateHTML['thumbnail']); echo jnews::miseEnHTML(_JNEWS_TEMPLATE_DESC, _JNEWS_TEMPLATE_DESC_T, $templateHTML['description']); echo jnews::endOfTable(); ?> </fieldset> </td> <td width="49%" valign="top"> <?php $switchjs = 'function switchContent() { var option=[\'jNewsStyles\',\'jNewsCSSTextbox\']; for(var i=0; i<option.length; i++){ obj=document.getElementById(option[i]); obj.className=(obj.className=="visible")? "hidden" : "visible"; } var form = document.adminForm; if(form.stylechosen.value == \'0\'){form.stylechosen.value = 1}else{form.stylechosen.value = 0} } function showInput() { var el = document.getElementById(\'cssfile\'); if ( el.style.display != \'none\' ) { el.style.display = \'none\'; } else { el.style.display = \'\'; el.focus(); } }'; $jnewscss = '.visible {display:block;} .hidden {display:none;}'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($switchjs . $tagjs); $doc->addStyleDeclaration($jnewscss); //echo '<a name="cssfileindex">'; jNews_TemplatesHTML::_styles($styles); //add the specific style //echo '</a>'; echo '<div id="jNewsCSSTextbox" style="padding: 4px;" class="hidden">' . jNews_TemplatesHTML::_csstextbox($template->csstyle) . '</div>'; echo '<div class="button2-left">'; echo '<div class="blank"><a href="#" style="cursor: hand;" onclick="switchContent()" title="Toggle Template Styling" >' . _JNEWS_CSS_TOGGLESTYLE . '</a></div>'; echo '</div>'; // echo '<div class="button2-left">'; // echo '<div class="blank"><a href="#cssfileindex" style="cursor: hand;" onclick="showInput()" title="Click to Input External CSS" >'._JNEWS_EXTERNALCSS_LINK.'</a></div>'; // echo '</div>'; echo $templateHTML['cssfile']; ?> </td> </tr> <tr> <td colspan="2" width="100%"> <fieldset class="jnewscss"> <legend> <?php echo _JNEWS_HTML_VERSION; ?> </legend> <?php echo $editor->display('template_body', $template->body, '99%', '800', '75', '50', true); ?> </fieldset> <fieldset class="jnewscss"> <legend><?php echo _JNEWS_NONHTML_VERSION; ?> </legend> <textarea name="alt_body" rows="20" cols="70" style="width: 100%; height: 400px;"><?php echo $template->altbody; ?> </textarea> </fieldset> </td> </tr> </tbody> </table> <?php echo JHTML::_('behavior.keepalive'); }