function __construct($config = FALSE) { $this->getConfig($config); $pref = e107::getConfig(); /* if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_PLUGIN."tinymce/tiny_mce_gzip.php")) { //unset($tinymce_plugins[7]); // 'zoom' causes an error with the gzip version. $text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce_gzip.js'></script> <script type='text/javascript'> tinyMCE_GZ.init({ plugins : '".implode(",",$tinymce_plugins)."', themes : 'advanced', languages : '".$tinylang[$lang]."', disk_cache : false, debug : false }); </script> "; } else {*/ // $text = "<script type='text/javascript' src='".e_PLUGIN_ABS."tinymce/tiny_mce.js'></script>\n"; //} // $text .= "<script type='text/javascript'>\n"; $text .= "\n /* TinyMce Config: " . $this->configName . " */"; $text .= $this->tinyMce_config(); $text .= "\t\t \n\t\$(document).ready(function()\n{\n\tstart_tinyMce(); \n\n}); "; $text .= "\n\n\tfunction tinymce_e107Paths(type, source) {\n\t"; $tp = e107::getParser(); $paths = array(e107::getFolder('images'), e107::getFolder('plugins'), e107::getFolder('media_images'), e107::getFolder('media_files'), e107::getFolder('media_videos')); $text .= "\n\t switch (type) {\n\n\t case 'get_from_editor':\n\t // Convert HTML to e107-BBcode\n\t source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');\n\t // source = source.replace(/^\\s*|\\s*\$/g,'');\n\n\t\t\t"; // Convert TinyMce Paths to e107 paths. foreach ($paths as $k => $path) { //echo "<br />$path = ".$tp->createConstants($path); $text .= "\t\tsource = source.replace(/(\"|])" . str_replace("/", "\\/", $path) . "/g,'\$1" . $tp->createConstants($path) . "');\n"; } $text .= "\n break;\n\n\t case 'insert_to_editor': // Convert e107Paths for TinyMce\n\n\t source = source.replace(/rel=\"external\"/, 'target=\"_blank\"');\n\t \n\t \n\n\t\t\t"; // Convert e107 paths to TinyMce Paths. foreach ($paths as $k => $path) { $const = str_replace("}", "\\}", $tp->createConstants($path)); $text .= "\t\tsource = source.replace(/" . $const . "/gi,'" . $path . "');\n"; } $text .= "\n\t break;\n\t }\n\n\t return source;\n\t}\n\n\t // ]]>\n\tfunction triggerSave()\n\t{\n\t tinyMCE.triggerSave();\n\t}\n\n\n\t"; //$text .= "</script>\n"; $this->js = $text; $this->render(); }
/** * Convert HTML to bbcode. */ function htmltoBBcode($text) { $text = str_replace("<!-- bbcode-html-start -->", "[html]", $text); $text = str_replace("<!-- bbcode-html-end -->", "[/html]", $text); // $text = str_replace('<!-- pagebreak -->',"[newpage=]",$text); if (substr($text, 0, 6) == '[html]') { return $text; } $text = $this->processTag('img', $text); // Youtube conversion (TinyMce) // return $text; // $text = preg_replace('/<img(?:\s*)?(?:class="([^"]*)")?(?:\s*)?(?:style="([^"]*)")?\s?(?:src="thumb.php\?src=([^"]*)&w=([\d]*)?&h=([\d]*)?")(?:\s*)?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?(?:alt="([^"]*)")? \/>/i',"[img style=width:$4px;height:$5px; alt=$8]$3[/img]",$text ); $text = preg_replace('/<img class="youtube-([\\w]*)" style="([^"]*)" src="([^"]*)" alt="([^"]*)" \\/>/i', "[youtube=\$1]\$4[/youtube]", $text); $text = preg_replace('/<!-- Start YouTube-([\\w,]*)-([\\w]*) -->([^!]*)<!-- End YouTube -->/i', '[youtube=$1]$2[/youtube]', $text); $text = preg_replace("/<a.*?href=\"(.*?)?request.php\\?file=([\\d]*)\".*?>(.*?)<\\/a>/i", "[file=\$2]\$3[/file]", $text); $text = preg_replace("/<a.*?href=\"(.*?)\".*?>(.*?)<\\/a>/i", "[link=\$1]\$2[/link]", $text); $text = preg_replace('/<div style="text-align: ([\\w]*);">([\\s\\S]*)<\\/div>/i', "[\$1]\$2[/\$1]", $text); // verified $text = preg_replace('/<div class="bbcode-(?:[\\w]*).* style="text-align: ([\\w]*);">([\\s\\S]*)<\\/div>/i', "[\$1]\$2[/\$1]", $text); // left / right / center // $text = preg_replace('/<img(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text ); // $text = preg_replace('/<img class="(?:[^"]*)"(?:\s*)?(?:style="([^"]*)")?\s?(?:src="([^"]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/i',"[img style=width:$4px;height:$5px;$1]$2[/img]",$text ); // $text = preg_replace('/<span (?:class="bbcode-color" )?style=\"color: ?(.*?);\">(.*?)<\/span>/i',"[color=$1]$2[/color]",$text); $text = preg_replace('/<span (?:class="bbcode underline bbcode-u)(?:[^>]*)>(.*?)<\\/span>/i', "[u]\$1[/u]", $text); // $text = preg_replace('/<table([^"]*)>/i', "[table $1]",$text); $text = preg_replace('/<table style="([^"]*)"([\\w ="]*)?>/i', "[table style=\$1]", $text); $text = preg_replace('/<table([\\w :\\-_;="]*)?>/i', "[table]", $text); $text = preg_replace('/<tbody([\\w ="]*)?>/i', "[tbody]", $text); $text = preg_replace('/<code([\\w :\\-_;="]*)?>/i', "[code]\n", $text); $text = preg_replace('/<strong([\\w :\\-_;="]*)?>/i', "[b]", $text); $text = preg_replace('/<em([\\w :\\-_;="]*)?>/i', "[i]", $text); $text = preg_replace('/<li([\\w :\\-_;="]*)?>/i', "[*]", $text); $text = preg_replace('/<ul([\\w :\\-_;="]*)?>/i', "[list]", $text); $text = preg_replace('/<ol([\\w :\\-_;="]*)?>/i', "[list=ol]", $text); $text = preg_replace('/<table([\\w :\\-_;="]*)?>/i', "[table]", $text); $text = preg_replace('/<tbody([\\w :\\-_;="]*)?>/i', "[tbody]", $text); $text = preg_replace('/<tr([\\w :\\-_;="]*)?>/i', "[tr]", $text); $text = preg_replace('/<td([\\w :\\-_;="]*)?>/i', "\t[td]", $text); $text = preg_replace('/<blockquote([\\w :\\-_;="]*)?>/i', "[blockquote]", $text); $text = preg_replace('/<p([\\w :\\-_;="]*)?>/i', "", $text); // Causes issues : [p] [/p] everywhere. // $ehttp = str_replace("/",'\/',e_HTTP); // $text = preg_replace('/thumb.php\?src='.$ehttp.'([^&]*)([^\[]*)/i', "$1",$text); // $text = preg_replace('/thumb.php\?src=([^&]*)([^\[]*)/i', "$1",$text); // Mostly closing tags. $convert = array(array("\n", '<br />'), array("\n", "</p>\n"), array("\n", "</p>"), array("[/list]", '</ul>\\n'), array("[/list]", '</ul>'), array("[/list]", '</ol>\\n'), array("[/list]", '</ol>'), array("[h=2]", '<h2 class="bbcode-center" style="text-align: center;">'), array("[h=2]", '<h2>'), array("[/h]", '</h2>'), array("[h=3]", '<h3 class="bbcode-center" style="text-align: center;">'), array("[h=3]", '<h3>'), array("[/h]", '</h3>'), array("[/b]", '</strong>'), array("[/i]", '</em>'), array("[/block]", '</div>'), array("[/table]", '</table>'), array("[/tbody]", '</tbody>'), array("[/code]\n", '</code>'), array("[/tr]", '</tr>'), array("[/td]", '</td>'), array("[/blockquote]", '</blockquote>'), array("]", ' style=]')); foreach ($convert as $arr) { $repl[] = $arr[0]; $srch[] = $arr[1]; } $paths = array(e107::getFolder('images'), e107::getFolder('plugins'), e107::getFolder('media_files'), e107::getFolder('media_videos')); $tp = e107::getParser(); foreach ($paths as $k => $path) { $srch[] = $path; $repl[] = $tp->createConstants($path); } $blank = array('</li>', 'width:px;height:px;'); $text = str_replace($blank, "", $text); // Cleanup return str_replace($srch, $repl, $text); }
function settingsPage() { global $pref; $frm = e107::getForm(); $tp = e107::getParser(); $sql = e107::getDb(); $ns = e107::getRender(); $mes = e107::getMessage(); if (function_exists('gd_info')) { $gd_info = gd_info(); $gd_version = $gd_info['GD Version']; } else { $gd_version = "<span class='error'> " . IMALAN_55 . "</span>"; } if ($pref['resize_method'] == "ImageMagick" && !vartrue(e107::getFolder('imagemagick'))) { $mes->addWarning('Please add: <b>$IMAGEMAGICK_DIRECTORY="' . $pref['im_path'] . '";</b> to your e107_config.php file'); } //$IM_NOTE = ""; $im_path = vartrue(e107::getFolder('imagemagick')); if ($im_path != "") { $im_file = $im_path . 'convert'; if (!file_exists($im_file)) { //$IM_NOTE = "<span class='error'>".IMALAN_52."</span>"; $mes->addWarning(IMALAN_52); } else { $cmd = "{$im_file} -version"; $tmp = `{$cmd}`; if (strpos($tmp, "ImageMagick") === FALSE) { //$IM_NOTE = "<span class='error'>".IMALAN_53."</span>"; $mes->addWarning(IMALAN_53); } } } $text = "\n\t\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\t\t\t\t<fieldset id='core-image-settings'>\n\t\t\t\t\t<legend class='e-hideme'>" . IMALAN_7 . "</legend>\n\t\t\t\t\t<table class='table adminform'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col class='col-label' />\n\t\t\t\t\t\t\t<col class='col-control' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . IMALAN_1 . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class='auto-toggle-area autocheck'>\n\t\t\t\t\t\t\t\t\t\t" . $frm->checkbox('image_post', 1, $pref['image_post']) . "\n\t\t\t\t\t\t\t\t\t\t<div class='field-help'>" . IMALAN_2 . "</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . IMALAN_10 . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . r_userclass('image_post_class', $pref['image_post_class'], "off", "public,guest,nobody,member,admin,main,classes") . "\n\t\t\t\t\t\t\t\t\t<div class='field-help'>" . IMALAN_11 . "</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . IMALAN_12 . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->select_open('image_post_disabled_method') . "\n\t\t\t\t\t\t\t\t\t\t" . $frm->option(IMALAN_14, '0', $pref['image_post_disabled_method'] == "0") . "\n\t\t\t\t\t\t\t\t\t\t" . $frm->option(IMALAN_15, '1', $pref['image_post_disabled_method'] == "1") . "\n\t\t\t\t\t\t\t\t\t" . $frm->select_close() . "\n\t\t\t\t\t\t\t\t\t<div class='field-help'>" . IMALAN_13 . "</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; list($img_import_w, $img_import_h) = explode("x", $pref['img_import_resize']); $text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . IMALAN_105 . "<div class='label-note'>" . IMALAN_106 . "</div></td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->text('img_import_resize_w', $img_import_w, 4) . "px X " . $frm->text('img_import_resize_h', $img_import_h, 4) . "px\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . IMALAN_3 . "<div class='label-note'>" . IMALAN_54 . " {$gd_version}</div></td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->select_open('resize_method') . "\n\t\t\t\t\t\t\t\t\t\t" . $frm->option('gd1', 'gd1', $pref['resize_method'] == "gd1") . "\n\t\t\t\t\t\t\t\t\t\t" . $frm->option('gd2', 'gd2', $pref['resize_method'] == "gd2") . "\n\t\t\t\t\t\t\t\t\t\t" . $frm->option('ImageMagick', 'ImageMagick', $pref['resize_method'] == "ImageMagick") . "\n\t\t\t\t\t\t\t\t\t" . $frm->select_close() . "\n\t\t\t\t\t\t\t\t\t<div class='field-help'>" . IMALAN_4 . "</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; /* $text .= " // Removed to prevent mod_security blocks, and show only when relevant (non-GD2 users) <tr> <td>".IMALAN_5."<div class='label-note'>{$IM_NOTE}</div></td> <td> ".$frm->text('im_path', $pref['im_path'])." <div class='field-help'>".IMALAN_6."</div> </td> </tr>"; // Removed as IE6 should no longer be supported. A 3rd-party plugin can be made for this functionality if really needed. $text .= " <tr> <td>".IMALAN_34." </td> <td> <div class='auto-toggle-area autocheck'> ".$frm->checkbox('enable_png_image_fix', 1, ($pref['enable_png_image_fix']))." <div class='field-help'>".IMALAN_35."</div> </div> </td> </tr>"; */ $text .= "\n\t\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . IMALAN_36 . "</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->admin_button('check_avatar_sizes', ADLAN_145) . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t\t" . $frm->admin_button('update_options', IMALAN_8, 'update') . "\n\t\t\t\t\t</div>\n\t\t\t\t</fieldset>\n\t\t\t</form>"; echo $mes->render() . $text; return; // $ns->tablerender(LAN_MEDIAMANAGER." :: ".IMALAN_7, $mes->render().$text); }
function prefsPage() { if (!getperms('0')) { return; } $pref = e107::getPref(); $e107 = e107::getInstance(); $frm = e107::getForm(); $mes = e107::getMessage(); $ns = e107::getRender(); if ($pref['mail_bounce'] == 'auto' && !empty($pref['mail_bounce_email']) && !is_executable(e_HANDLER . "bounce_handler.php")) { $mes->addWarning('Your bounce_handler.php file is NOT executable'); } e107::getCache()->CachePageMD5 = '_'; $lastload = e107::getCache()->retrieve('emailLastBounce', FALSE, TRUE, TRUE); $lastBounce = round((time() - $lastload) / 60); $lastBounceText = $lastBounce > 1256474 ? "<span class='label label-important label-danger'>Never</span>" : "<span class='label label-success'>" . $lastBounce . " minutes ago.</span>"; $text = "\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='mailsettingsform'>\n\t\t<fieldset id='mail'>\n\t\t<legend>" . LAN_MAILOUT_110 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td>" . LAN_MAILOUT_110 . "<br /></td>\n\t\t\t<td class='form-inline'><div class='input-append'>" . $frm->admin_button('testemail', LAN_MAILOUT_112, 'other') . " \n\t\t\t<input name='testaddress' class='tbox input-xlarge' type='text' size='40' maxlength='80' value=\"" . (varset($_POST['testaddress']) ? $_POST['testaddress'] : USEREMAIL) . "\" />\n\t\t\t <span style='padding-left:5px'>" . $this->mailAdmin->sendStyleSelect(varset($_POST['testtemplate'], 'textonly'), 'testtemplate') . "</span>\n\t\t\t</div></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_77 . "</td>\n\t\t<td> "; $mail_enable = explode(',', vartrue($pref['mailout_enabled'], 'core')); $coreCheck = in_array('core', $mail_enable) ? "checked='checked'" : ""; $text .= $frm->checkbox('mail_mailer_enabled[]', 'core', $coreCheck, 'users'); if (!empty($pref['e_mailout_list'])) { foreach ($pref['e_mailout_list'] as $mailer => $v) { $check = in_array($mailer, $mail_enable) ? "checked='checked'" : ""; $text .= $frm->checkbox('mail_mailer_enabled[]', $mailer, $check, $mailer); // $text .= " <input type='checkbox' name='mail_mailer_enabled[]' value='{$mailer}' {$check} /> {$mailer}<br />"; } } $text .= "</td></tr>\t\n\t\t\n\t\t\n\t\t<tr>\n\t\t<td style='vertical-align:top'>" . LAN_MAILOUT_115 . "<br /></td>\n\t\t<td>\n\t\t<select class='tbox input-xxlarge' name='mailer' onchange='disp(this.value)'>\n"; $mailers = array('php', 'smtp', 'sendmail'); foreach ($mailers as $opt) { $sel = $pref['mailer'] == $opt ? "selected='selected'" : ''; $text .= "<option value='{$opt}' {$sel}>{$opt}</option>\n"; } $text .= "</select> <span class='field-help'>" . LAN_MAILOUT_116 . "</span><br />"; // SMTP. --------------> $smtp_opts = explode(',', varset($pref['smtp_options'], '')); $smtpdisp = $pref['mailer'] != 'smtp' ? "style='display:none;'" : ''; $text .= "<div id='smtp' {$smtpdisp}>\n\t\t<table class='table adminlist' style='margin-right:auto;margin-left:0px;border:0px'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t"; $text .= "\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_87 . ": </td>\n\t\t<td>\n\t\t<input class='tbox' type='text' name='smtp_server' size='40' value='" . $pref['smtp_server'] . "' maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_88 . ": (" . LAN_OPTIONAL . ") </td>\n\t\t<td style='width:50%;' >\n\t\t<input class='tbox' type='text' name='smtp_username' size='40' value=\"" . $pref['smtp_username'] . "\" maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_89 . ": (" . LAN_OPTIONAL . ") </td>\n\t\t<td>\n\t\t<input class='tbox' type='password' name='smtp_password' size='40' value='" . $pref['smtp_password'] . "' maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_90 . "</td><td>\n\t\t<select class='tbox' name='smtp_options'>\n\n\t\t\n\t\t<option value=''>" . LAN_MAILOUT_96 . "</option>\n"; $selected = in_array('secure=SSL', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_ssl'{$selected}>" . LAN_MAILOUT_92 . "</option>\n"; $selected = in_array('secure=TLS', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_tls'{$selected}>" . LAN_MAILOUT_93 . "</option>\n"; $selected = in_array('pop3auth', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_pop3auth'{$selected}>" . LAN_MAILOUT_91 . "</option>\n"; $text .= "</select>\n<br />" . LAN_MAILOUT_94 . "</td></tr>"; $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_57 . "</td><td>\n\t\t"; $checked = vartrue($pref['smtp_keepalive']) ? "checked='checked'" : ''; $text .= "<input type='checkbox' name='smtp_keepalive' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>"; $checked = in_array('useVERP', $smtp_opts) ? "checked='checked'" : ""; $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_95 . "</td><td>\n\t\t<input type='checkbox' name='smtp_useVERP' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>\n\t\t</table></div>"; /* FIXME - posting SENDMAIL path triggers Mod-Security rules. // Sendmail. --------------> $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; $text .= "<div id='sendmail' {$senddisp}><table style='margin-right:0px;margin-left:auto;border:0px'>"; $text .= " <tr> <td>".LAN_MAILOUT_20.": </td> <td> <input class='tbox' type='text' name='sendmail' size='60' value=\"".(!$pref['sendmail'] ? "/usr/sbin/sendmail -t -i -r ".$pref['siteadminemail'] : $pref['sendmail'])."\" maxlength='80' /> </td> </tr> </table></div>"; */ $text .= "</td>\n\t</tr>\n\n\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_222 . "</td>\n\t\t<td>"; $text .= $this->mailAdmin->sendStyleSelect(varset($pref['mail_sendstyle'], 'textonly'), 'mail_sendstyle'); $text .= "<span class='field-help'>" . LAN_MAILOUT_223 . "</span>\n\t\t</td>\n\t</tr>\n\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_25 . "</td>\n\t\t<td class='form-inline'> " . LAN_MAILOUT_26 . " " . $frm->number('mail_pause', $pref['mail_pause']) . " " . LAN_MAILOUT_27 . " " . $frm->number('mail_pausetime', $pref['mail_pausetime']) . " " . LAN_MAILOUT_29 . ".<br />\n\t\t<span class='field-help'>" . LAN_MAILOUT_30 . "</span>\n\t\t</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_156 . "</td>\n\t\t<td>" . $frm->number('mail_workpertick', varset($pref['mail_workpertick'], 5)) . "<span class='field-help'>" . LAN_MAILOUT_157 . "</span>\n\t\t</td>\n\t</tr>\n\t\n\t\n\t"; list($mail_log_option, $mail_log_email) = explode(',', varset($pref['mail_log_options'], '0,0')); $check = $mail_log_email == 1 ? " checked='checked'" : ""; $logOptions = array(LAN_MAILOUT_73, LAN_MAILOUT_74, LAN_MAILOUT_75, LAN_MAILOUT_119); $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_72 . "</td>\n\t\t<td class='form-inline'>\n\t\t" . $frm->select('mail_log_option', $logOptions, $mail_log_option); $text .= " " . $frm->checkbox('mail_log_email', 1, $check, 'label=' . LAN_MAILOUT_76); $text .= "</td></tr>\n"; /* $text .= " <select class='tbox' name='mail_log_option'>\n <option value='0'".(($mail_log_option==0) ? " selected='selected'" : '').">".LAN_MAILOUT_73."</option>\n <option value='1'".(($mail_log_option==1) ? " selected='selected'" : '').">".LAN_MAILOUT_74."</option>\n <option value='2'".(($mail_log_option==2) ? " selected='selected'" : '').">".LAN_MAILOUT_75."</option>\n <option value='3'".(($mail_log_option==3) ? " selected='selected'" : '').">".LAN_MAILOUT_119."</option>\n </select>\n <input type='checkbox' name='mail_log_email' value='1' {$check} />".LAN_MAILOUT_76. "</td> </tr>\n"; */ if (function_exists('openssl_pkey_new') && deftrue('e_DEVELOPER')) { $text .= "<tr><td>DomainKeys Identified Mail (DKIM)</td><td class='form-inline'>" . $frm->button('DKIM_generate', 1, 'primary', 'Generate Public/Private keys') . "\n\t\t<span class='label label-warning'>Developer Mode Only</span></td></tr>"; } $text .= "</table></fieldset>\n\t<fieldset id='core-mail-prefs-bounce'>\n\t\t<legend>" . LAN_MAILOUT_31 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_231 . "</td><td>"; // bounce divs = mail_bounce_none, mail_bounce_auto, mail_bounce_mail $autoDisp = $pref['mail_bounce'] != 'auto' ? "style='display:none;'" : ''; $autoMail = $pref['mail_bounce'] != 'mail' ? "style='display:none;'" : ''; $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); $text .= "<select name='mail_bounce' class='tbox' onchange='bouncedisp(this.value)'>\n<option value=''> </option>\n"; foreach ($bounceOpts as $k => $v) { $selected = $pref['mail_bounce'] == $k ? " selected='selected'" : ''; $text .= "<option value='{$k}'{$selected}>{$v}</option>\n"; } $text .= "</select>\n</td>\n\t</tr></tbody></table>\n\n\n\t\t<table class='adminform' id='mail_bounce_auto' {$autoDisp}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td>" . LAN_EMAIL . "</td>\n\t\t\t<td><div class='input-append'>" . $frm->text('mail_bounce_email2', $pref['mail_bounce_email'], 40, 'size=xlarge'); if (!empty($pref['mail_bounce_email'])) { $text .= $frm->admin_button('send_bounce_test', 'Send Test', 'primary', 'Test'); } $text .= "</div></td>\n\t\t</tr>\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_233 . "</td><td><b>" . e_ROOT . e107::getFolder('handlers') . "bounce_handler.php</b>"; $status = ''; if (!is_readable(e_HANDLER . 'bounce_handler.php')) { $status = LAN_MAILOUT_161; } elseif (!is_executable(e_HANDLER . 'bounce_handler.php')) { $status = LAN_MAILOUT_162; } else { // $text .= " ".ADMIN_TRUE_ICON; } if (!empty($status)) { $text .= " <span class='label label-warning'>" . $status . "</span>"; } $text .= "<div>" . LAN_MAILOUT_235 . "</div>\n\t\n\t\n\t</td></tr>\n\t<tr><td>" . LAN_MAILOUT_236 . "</td><td>" . $lastBounceText . "</td></tr>"; $text .= "\n\t</tbody></table>"; // Parameters for mail-account based bounce processing $text .= "\n\t\t<table class='table adminform' id='mail_bounce_mail' {$autoMail}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>"; $bouncePrefs = array('mail_bounce_email' => LAN_EMAIL, 'mail_bounce_pop3' => LAN_MAILOUT_33, 'mail_bounce_user' => LAN_MAILOUT_34, 'mail_bounce_pass' => LAN_PASSWORD); foreach ($bouncePrefs as $key => $label) { $text .= "<tr><td>" . $label . "</td><td>" . $frm->text($key, $pref[$key], 40, 'size=xlarge') . "</td></tr>"; } /* $text .= " <tr><td>".LAN_MAILOUT_32."</td><td><input class='tbox' size='40' type='text' name='mail_bounce_email' value=\"".$pref['mail_bounce_email']."\" /></td></tr> <tr><td>".LAN_MAILOUT_33."</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pop3' value=\"".$pref['mail_bounce_pop3']."\" /></td></tr> <tr><td>".LAN_MAILOUT_34."</td><td><input class='tbox' size='40' type='text' name='mail_bounce_user' value=\"".$pref['mail_bounce_user']."\" /></td></tr> <tr><td>".LAN_PASSWORD."</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pass' value=\"".$pref['mail_bounce_pass']."\" /></td></tr> "; */ $text .= "\t\n\t\t<tr><td>" . LAN_MAILOUT_120 . "</td><td><select class='tbox' name='mail_bounce_type'>\n\n\t\t\t<option value=''> </option>\n\n\t\t\t<option value='pop3'" . ($pref['mail_bounce_type'] == 'pop3' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_121 . "</option>\n\n\t\t\t<option value='pop3/notls'" . ($pref['mail_bounce_type'] == 'pop3/notls' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_122 . "</option>\n\n\t\t\t<option value='pop3/tls'" . ($pref['mail_bounce_type'] == 'pop3/tls' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_123 . "</option>\n\n\t\t\t<option value='imap'" . ($pref['mail_bounce_type'] == 'imap' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_124 . "</option>\n\n\t\t</select></td></tr>\n\n\t\t"; $check = $pref['mail_bounce_delete'] == 1 ? " checked='checked'" : ""; $text .= "<tr><td>" . LAN_MAILOUT_36 . "</td><td><input type='checkbox' name='mail_bounce_delete' value='1' {$check} /></td></tr>"; $check = $pref['mail_bounce_auto'] == 1 ? " checked='checked'" : ""; $text .= "<tr><td>" . LAN_MAILOUT_245 . "</td><td><input type='checkbox' name='mail_bounce_auto' value='1' {$check} /><span class='field-help'> " . LAN_MAILOUT_246 . "</span></td></tr>\n\t\t\t\t"; $text .= "\n\t</tbody>\n\t</table></fieldset>\n\n\t<div class='buttons-bar center'>" . $frm->admin_button('updateprefs', LAN_MAILOUT_28, 'update') . "</div>\n\n\t</form>"; return $text; // $caption = ADLAN_136.SEP.LAN_PREFS; // $ns->tablerender($caption, $mes->render(). $text); }
public function moduleRows($data) { $text = ''; $tp = e107::getParser(); $frm = e107::getForm(); if (empty($data)) { return "\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='2'>" . LAN_EURL_EMPTY . "</td>\n\t\t\t\t</tr>\n\t\t\t"; } $PLUGINS_DIRECTORY = e107::getFolder("PLUGINS"); $srch = array("{SITEURL}", "{e_PLUGIN_ABS}"); $repl = array(SITEURL, SITEURL . $PLUGINS_DIRECTORY); foreach ($data as $obj) { $admin = $obj->config->admin(); $section = vartrue($admin['labels'], array()); $rowspan = count($obj->locations) + 1; $module = $obj->module; $generate = vartrue($admin['generate'], array()); /* $info .= " <tr> <td rowspan='$rowspan'><a class='e-tip' style='display:block' title='".LAN_EURL_LOCATION.$path."'> ".vartrue($section['name'], eHelper::labelize($obj->module))." </a></td> </tr> "; */ $opt = ""; $info = "<table class='table table-striped'>"; foreach ($obj->locations as $index => $location) { $objSub = $obj->defaultLocation != $location ? eDispatcher::getConfigObject($obj->module, $location) : false; if ($objSub) { $admin = $objSub->admin(); $section = vartrue($admin['labels'], array()); } elseif ($obj->defaultLocation != $location) { $section = array(); } $id = 'eurl-' . str_replace('_', '-', $obj->module) . '-' . $index; $checked = varset($obj->current[$module]) == $location ? ' checked="checked"' : ''; $path = eDispatcher::getConfigPath($module, $location, false); if (!is_readable($path)) { $path = str_replace('/url.php', '/', $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true)) . ' <em>(' . LAN_EURL_LOCATION_NONE . ')</em>'; $diz = LAN_EURL_DEFAULT; } else { $path = $tp->replaceConstants(eDispatcher::getConfigPath($module, $location, true), true); $diz = basename($path) != 'url.php' ? LAN_EURL_FRIENDLY : LAN_EURL_DEFAULT; } $label = vartrue($section['label'], $index == 0 ? LAN_EURL_DEFAULT : eHelper::labelize(ltrim(strstr($location, '/'), '/'))); $cssClass = $checked ? 'e-showme' : 'e-hideme'; $cssClass = 'e-hideme'; // always hidden for now, some interface changes could come after pre-alpha $exampleUrl = array(); if (!empty($section['examples'])) { foreach ($section['examples'] as $ex) { $exampleUrl[] = str_replace($srch, $repl, $ex); } } if (strpos($path, 'noid') !== false) { // $exampleUrl .= " ‡"; //XXX Add footer - denotes more CPU required. ? } $selected = varset($obj->current[$module]) == $location ? "selected='selected'" : ''; $opt .= "<option value='{$location}' {$selected} >" . $diz . ": " . $exampleUrl[0] . "</option>"; $info .= "<tr><td>" . $label . "\n\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t\t<td><strong>" . LAN_EURL_LOCATION . "</strong>: " . $path . "\n <p>" . vartrue($section['description'], LAN_EURL_PROFILE_INFO) . "</p><small>" . implode("<br />", $exampleUrl) . "</small></td>\n \n \n \n </tr>\n\t\t\t\t"; } $info .= "</table>"; $title = vartrue($section['name'], eHelper::labelize($obj->module)); $text .= "\n <tr>\n <td>" . $this->moreInfo($title, $info) . "</td>\n <td><select name='eurl_config[{$module}]' class='input-block-level'>" . $opt . "</select></td>\n <td>"; $bTable = $admin['generate']['table']; $bInput = $admin['generate']['input']; $bOutput = $admin['generate']['output']; $bPrimary = $admin['generate']['primary']; $text .= is_array($admin['generate']) ? $frm->admin_button('rebuild[' . $bTable . ']', $bPrimary . "::" . $bInput . "::" . $bOutput, 'delete', LAN_EURL_REBUILD) : ""; $text .= "</td>\n </tr>"; } /* For Miro - intuitive interface example. All configs are contained within one e_url.php file. Root namespacing automatically calculated based on selection. ie. choosing option 1 below will set root namespacing for news. Known bug (example): News title: Nothing's Gonna Change my World! Currently becomes: /Nothing%26%23039%3Bs%20Gonna%20Change%20my%20World%21 Should become: /nothings-gonna-change-my-world Good SEF reference: http://davidwalsh.name/generate-search-engine-friendly-urls-php-function [Miro] Solution comes from the module itself, not related with URL assembling in anyway (as per latest Skype discussion) */ // Global On/Off Switch Example // [Miro] there is no reason of switch, everything could go through single entry point at any time, without a need of .htaccess (path info) // Control is coming per configuration file. $example = "\n\t\t<tr><td>Enable Search-Engine-Friendly URLs</td>\n\t\t<td><input type='checkbox' name='SEF-active' value='1' />\n\t\t</td></tr>"; //Entry Example (Hidden unless the above global switch is active) $example .= "\n\t\t\n\t\t<tr><td>News</td>\n\t\t\t\t\t<td style='padding:0px'>\n\t\t\t\t\t<table style='width:600px;margin-left:0px'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />Default</td><td>/news.php?item.1</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />News Namespace and News Title</td><td>/news/news-item-title</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />Year and News Title</td><td>/2011/news-item-title</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />Year/Month and News Title</td><td>/2011/08/news-item-title</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />Year/Month/Day and News Title</td><td>/2011/08/27/news-item-title</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />News Category and News Title</td><td>/news-category/news-item-title</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; // For 0.8 Beta $example .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><input type='radio' class='radio' name='example' />Custom</td><td><input class='tbox' type='text' name='custom-news' value='' /></td>\n\t\t\t\t\t\t</tr>"; $example .= "</table>"; $example .= "</td>\n\t\t\t\t\t</tr>"; return $text; }
function show_prefs($mailAdmin) { global $pref; $e107 = e107::getInstance(); $frm = e107::getForm(); $mes = e107::getMessage(); e107::getCache()->CachePageMD5 = '_'; $lastload = e107::getCache()->retrieve('emailLastBounce', FALSE, TRUE, TRUE); $lastBounce = round((time() - $lastload) / 60); $lastBounceText = $lastBounce > 1256474 ? "<b>Never</b>" : "<b>" . $lastBounce . " minutes </b>ago."; $text = "\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='mailsettingsform'>\n\t\t<fieldset id='mail'>\n\t\t<legend>" . LAN_MAILOUT_110 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td>" . LAN_MAILOUT_110 . "<br /></td>\n\t\t\t<td>" . $frm->admin_button('testemail', LAN_MAILOUT_112, 'other') . " \n\t\t\t<input name='testaddress' class='tbox' type='text' size='40' maxlength='80' value=\"" . (varset($_POST['testaddress']) ? $_POST['testaddress'] : USEREMAIL) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='vertical-align:top'>" . LAN_MAILOUT_115 . "<br /></td>\n\t\t<td>\n\t\t<select class='tbox' name='mailer' onchange='disp(this.value)'>\n"; $mailers = array('php', 'smtp', 'sendmail'); foreach ($mailers as $opt) { $sel = $pref['mailer'] == $opt ? "selected='selected'" : ''; $text .= "<option value='{$opt}' {$sel}>{$opt}</option>\n"; } $text .= "</select> <span class='field-help'>" . LAN_MAILOUT_116 . "</span><br />"; // SMTP. --------------> $smtp_opts = explode(',', varset($pref['smtp_options'], '')); $smtpdisp = $pref['mailer'] != 'smtp' ? "style='display:none;'" : ''; $text .= "<div id='smtp' {$smtpdisp}>\n\t\t<table class='table adminlist' style='margin-right:auto;margin-left:0px;border:0px'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t"; $text .= "\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_87 . ": </td>\n\t\t<td>\n\t\t<input class='tbox' type='text' name='smtp_server' size='40' value='" . $pref['smtp_server'] . "' maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_88 . ": (" . LAN_OPTIONAL . ") </td>\n\t\t<td style='width:50%;' >\n\t\t<input class='tbox' type='text' name='smtp_username' size='40' value=\"" . $pref['smtp_username'] . "\" maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_89 . ": (" . LAN_OPTIONAL . ") </td>\n\t\t<td>\n\t\t<input class='tbox' type='password' name='smtp_password' size='40' value='" . $pref['smtp_password'] . "' maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_90 . "</td><td>\n\t\t<select class='tbox' name='smtp_options'>\n\n\t\t<option value=''>" . LAN_MAILOUT_96 . "</option>\n"; $selected = in_array('secure=SSL', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_ssl'{$selected}>" . LAN_MAILOUT_92 . "</option>\n"; $selected = in_array('secure=TLS', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_tls'{$selected}>" . LAN_MAILOUT_93 . "</option>\n"; $selected = in_array('pop3auth', $smtp_opts) ? " selected='selected'" : ''; $text .= "<option value='smtp_pop3auth'{$selected}>" . LAN_MAILOUT_91 . "</option>\n"; $text .= "</select>\n<br />" . LAN_MAILOUT_94 . "</td></tr>"; $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_57 . "</td><td>\n\t\t"; $checked = varsettrue($pref['smtp_keepalive']) ? "checked='checked'" : ''; $text .= "<input type='checkbox' name='smtp_keepalive' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>"; $checked = in_array('useVERP', $smtp_opts) ? "checked='checked'" : ""; $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_95 . "</td><td>\n\t\t<input type='checkbox' name='smtp_useVERP' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>\n\t\t</table></div>"; /* FIXME - posting SENDMAIL path triggers Mod-Security rules. // Sendmail. --------------> $senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : ''; $text .= "<div id='sendmail' {$senddisp}><table style='margin-right:0px;margin-left:auto;border:0px'>"; $text .= " <tr> <td>".LAN_MAILOUT_20.": </td> <td> <input class='tbox' type='text' name='sendmail' size='60' value=\"".(!$pref['sendmail'] ? "/usr/sbin/sendmail -t -i -r ".$pref['siteadminemail'] : $pref['sendmail'])."\" maxlength='80' /> </td> </tr> </table></div>"; */ $text .= "</td>\n\t</tr>\n\n\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_222 . "</td>\n\t\t<td>"; $text .= $mailAdmin->sendStyleSelect(varset($pref['mail_sendstyle'], 'textonly'), 'mail_sendstyle'); $text .= "<span class='field-help'>" . LAN_MAILOUT_223 . "</span>\n\t\t</td>\n\t</tr>\n\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_25 . "</td>\n\t\t<td> " . LAN_MAILOUT_26 . "\n\t\t<input class='tbox e-spinner' size='3' type='text' name='mail_pause' value='" . $pref['mail_pause'] . "' /> " . LAN_MAILOUT_27 . "<input class='tbox e-spinner' size='3' type='text' name='mail_pausetime' value='" . $pref['mail_pausetime'] . "' /> " . LAN_MAILOUT_29 . ".<br />\n\t\t<span class='field-help'>" . LAN_MAILOUT_30 . "</span>\n\t\t</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_156 . "</td>\n\t\t<td><input class='tbox e-spinner' size='3' type='text' name='mail_workpertick' value='" . varset($pref['mail_workpertick'], 5) . "' />\n\t\t<span class='field-help'>" . LAN_MAILOUT_157 . "</span>\n\t\t</td>\n\t</tr>\n"; if (isset($pref['e_mailout_list'])) { // Allow selection of email address sources $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_77 . "</td>\n\t\t<td> \n\t "; $mail_enable = explode(',', $pref['mailout_enabled']); foreach ($pref['e_mailout_list'] as $mailer => $v) { $check = in_array($mailer, $mail_enable) ? "checked='checked'" : ""; $text .= " <input type='checkbox' name='mail_mailer_enabled[]' value='{$mailer}' {$check} /> {$mailer}<br />"; } $text .= "</td></tr>\n"; } list($mail_log_option, $mail_log_email) = explode(',', varset($pref['mail_log_options'], '0,0')); $check = $mail_log_email == 1 ? " checked='checked'" : ""; $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_72 . "</td>\n\t\t<td> \n\t\t<select class='tbox' name='mail_log_option'>\n\n\t\t<option value='0'" . ($mail_log_option == 0 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_73 . "</option>\n\n\t\t<option value='1'" . ($mail_log_option == 1 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_74 . "</option>\n\n\t\t<option value='2'" . ($mail_log_option == 2 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_75 . "</option>\n\n\t\t<option value='3'" . ($mail_log_option == 3 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_119 . "</option>\n\n\t\t</select>\n\n\t\t<input type='checkbox' name='mail_log_email' value='1' {$check} />" . LAN_MAILOUT_76 . "</td>\n\t</tr>\n"; $text .= "</table></fieldset>\n\t<fieldset id='core-mail-prefs-bounce'>\n\t\t<legend>" . LAN_MAILOUT_31 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_231 . "</td><td>"; // bounce divs = mail_bounce_none, mail_bounce_auto, mail_bounce_mail $autoDisp = $pref['mail_bounce'] != 'auto' ? "style='display:none;'" : ''; $autoMail = $pref['mail_bounce'] != 'mail' ? "style='display:none;'" : ''; $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234); $text .= "<select name='mail_bounce' class='tbox' onchange='bouncedisp(this.value)'>\n<option value=''> </option>\n"; foreach ($bounceOpts as $k => $v) { $selected = $pref['mail_bounce'] == $k ? " selected='selected'" : ''; $text .= "<option value='{$k}'{$selected}>{$v}</option>\n"; } $text .= "</select>\n</td>\n\t</tr></tbody></table>\n\n\n\t\t<table class='adminform' id='mail_bounce_auto' {$autoDisp}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr><td>" . LAN_MAILOUT_32 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_email2' value=\"" . $pref['mail_bounce_email'] . "\" /></td></tr>\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_233 . "</td><td><b>" . e_DOCROOT . e107::getFolder('handlers') . "bounce_handler.php</b>"; if (!is_readable(e_HANDLER . 'bounce_handler.php')) { $text .= "<br /><span class='required'>" . LAN_MAILOUT_161 . '</span>'; } elseif (!is_executable(e_HANDLER . 'bounce_handler.php')) { $text .= "<br /><span class='required'>" . LAN_MAILOUT_162 . '</span>'; } $text .= "<br /><span class='field-help'>" . LAN_MAILOUT_235 . "</span></td></tr>\n\t<tr><td>" . LAN_MAILOUT_236 . "</td><td>" . $lastBounceText . "</td></tr>\n\t</tbody></table>"; // Parameters for mail-account based bounce processing $text .= "\n\t\t<table class='table adminform' id='mail_bounce_mail' {$autoMail}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr><td>" . LAN_MAILOUT_32 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_email' value=\"" . $pref['mail_bounce_email'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_33 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pop3' value=\"" . $pref['mail_bounce_pop3'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_34 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_user' value=\"" . $pref['mail_bounce_user'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_35 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pass' value=\"" . $pref['mail_bounce_pass'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_120 . "</td><td><select class='tbox' name='mail_bounce_type'>\n\n\t\t\t<option value=''> </option>\n\n\t\t\t<option value='pop3'" . ($pref['mail_bounce_type'] == 'pop3' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_121 . "</option>\n\n\t\t\t<option value='pop3/notls'" . ($pref['mail_bounce_type'] == 'pop3/notls' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_122 . "</option>\n\n\t\t\t<option value='pop3/tls'" . ($pref['mail_bounce_type'] == 'pop3/tls' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_123 . "</option>\n\n\t\t\t<option value='imap'" . ($pref['mail_bounce_type'] == 'imap' ? " selected='selected'" : "") . ">" . LAN_MAILOUT_124 . "</option>\n\n\t\t</select></td></tr>\n\n\t\t"; $check = $pref['mail_bounce_delete'] == 1 ? " checked='checked'" : ""; $text .= "<tr><td>" . LAN_MAILOUT_36 . "</td><td><input type='checkbox' name='mail_bounce_delete' value='1' {$check} /></td></tr>"; $check = $pref['mail_bounce_auto'] == 1 ? " checked='checked'" : ""; $text .= "<tr><td>" . LAN_MAILOUT_245 . "</td><td><input type='checkbox' name='mail_bounce_auto' value='1' {$check} /><span class='field-help'> " . LAN_MAILOUT_246 . "</span></td></tr>\n\n\t</tbody>\n\t</table></fieldset>\n\n\t<div class='buttons-bar center'>" . $frm->admin_button('updateprefs', LAN_MAILOUT_28, 'update') . "</div>\n\n\t</form>"; $caption = ADLAN_136 . ' :: ' . LAN_PREFS; $e107->ns->tablerender($caption, $mes->render() . $text); }
/** * File retrieval function. by Cam. * @param $file actual path or {e_xxxx} path to file. * */ function send($file) { global $e107; $pref = e107::getPref(); $tp = e107::getParser(); $DOWNLOADS_DIR = e107::getFolder('DOWNLOADS'); $DOWNLOADS_DIRECTORY = $DOWNLOADS_DIR[0] == DIRECTORY_SEPARATOR ? $DOWNLOADS_DIR : e_BASE . $DOWNLOADS_DIR; // support for full path eg. /home/account/folder. $FILES_DIRECTORY = e_BASE . e107::getFolder('FILES'); $MEDIA_DIRECTORY = realpath(e_MEDIA); // could be image, file or other type. $SYSTEM_DIRECTORY = realpath(e_SYSTEM); // downloading of logs etc. via browser if required. (Admin-only) $file = $tp->replaceConstants($file); @set_time_limit(10 * 60); @session_write_close(); @e107_ini_set("max_execution_time", 10 * 60); while (@ob_end_clean()) { } // kill all output buffering else it eats server resources @ob_implicit_flush(TRUE); $filename = $file; $file = basename($file); $path = realpath($filename); $path_downloads = realpath($DOWNLOADS_DIRECTORY); $path_public = realpath($FILES_DIRECTORY . "public/"); if (strstr($path, $SYSTEM_DIRECTORY) && !ADMIN) { header("location: {$e107->base_path}"); exit; } if (!strstr($path, $path_downloads) && !strstr($path, $path_public) && !strstr($path, $MEDIA_DIRECTORY) && !strstr($path, $SYSTEM_DIRECTORY)) { if (E107_DEBUG_LEVEL > 0 && ADMIN) { echo "Failed to Download <b>" . $file . "</b><br />"; echo "The file-path <b>" . $path . "<b> didn't match with either of \n\t\t\t\t<ul><li><b>{$path_downloads}</b></li>\n\t\t\t\t<li><b>{$path_public}</b></li></ul><br />"; echo "Downloads Path: " . $path_downloads . " (" . $DOWNLOADS_DIRECTORY . ")"; exit; } else { header("location: {$e107->base_path}"); exit; } } else { if (is_file($filename) && is_readable($filename) && connection_status() == 0) { $seek = 0; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $file = preg_replace('/\\./', '%2e', $file, substr_count($file, '.') - 1); } if (isset($_SERVER['HTTP_RANGE'])) { $seek = intval(substr($_SERVER['HTTP_RANGE'], strlen('bytes='))); } $bufsize = 2048; ignore_user_abort(true); $data_len = filesize($filename); if ($seek > $data_len - 1) { $seek = 0; } if ($filename == null) { $filename = basename($this->data); } $res =& fopen($filename, 'rb'); if ($seek) { fseek($res, $seek); } $data_len -= $seek; header("Expires: 0"); header("Cache-Control: max-age=30"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"{$file}\""); header("Content-Length: {$data_len}"); header("Pragma: public"); if ($seek) { header("Accept-Ranges: bytes"); header("HTTP/1.0 206 Partial Content"); header("status: 206 Partial Content"); header("Content-Range: bytes {$seek}-" . ($data_len - 1) . "/{$data_len}"); } while (!connection_aborted() && $data_len > 0) { echo fread($res, $bufsize); $data_len -= $bufsize; } fclose($res); } else { if (E107_DEBUG_LEVEL > 0 && ADMIN) { echo "file failed =" . $file . "<br />"; echo "path =" . $path . "<br />"; exit; } else { header("location: " . e_BASE . "index.php"); exit; } } } }
private function githubSyncProcess() { // Delete any existing file. if (file_exists(e_TEMP . "e107-master.zip")) { unlink(e_TEMP . "e107-master.zip"); } $result = e107::getFile()->getRemoteFile('https://codeload.github.com/e107inc/e107/zip/master', 'e107-master.zip', 'temp'); if ($result == false) { e107::getMessage()->addError("Couldn't download .zip file"); } $localfile = 'e107-master.zip'; chmod(e_TEMP . $localfile, 0755); require_once e_HANDLER . "pclzip.lib.php"; // $base = realpath(dirname(__FILE__)); $newFolders = array('e107-master/e107_admin/' => e_BASE . e107::getFolder('ADMIN'), 'e107-master/e107_core/' => e_BASE . e107::getFolder('CORE'), 'e107-master/e107_docs/' => e_BASE . e107::getFolder('DOCS'), 'e107-master/e107_handlers/' => e_BASE . e107::getFolder('HANDLERS'), 'e107-master/e107_images/' => e_BASE . e107::getFolder('IMAGES'), 'e107-master/e107_languages/' => e_BASE . e107::getFolder('LANGUAGES'), 'e107-master/e107_media/' => e_BASE . e107::getFolder('MEDIA'), 'e107-master/e107_plugins/' => e_BASE . e107::getFolder('PLUGINS'), 'e107-master/e107_system/' => e_BASE . e107::getFolder('SYSTEM'), 'e107-master/e107_themes/' => e_BASE . e107::getFolder('THEMES'), 'e107-master/e107_web/' => e_BASE . e107::getFolder('WEB'), 'e107-master/' => e_BASE); $srch = array_keys($newFolders); $repl = array_values($newFolders); $archive = new PclZip(e_TEMP . $localfile); $unarc = $fileList = $archive->extract(PCLZIP_OPT_PATH, e_TEMP, PCLZIP_OPT_SET_CHMOD, 0755); // Store in TEMP first. $error = array(); $success = array(); $skipped = array(); // print_a($unarc); $excludes = array('e107-master/', 'e107-master/install.php', 'e107-master/favicon.ico'); foreach ($unarc as $k => $v) { if (in_array($v['stored_filename'], $excludes)) { continue; } $oldPath = $v['filename']; $newPath = str_replace($srch, $repl, $v['stored_filename']); $message = "Moving " . $oldPath . " to " . $newPath; if ($v['folder'] == 1 && is_dir($newPath)) { // $skipped[] = $newPath. " (already exists)"; continue; } if (!rename($oldPath, $newPath)) { $error[] = $message; } else { $success[] = $message; } // echo $message."<br />"; } if (!empty($success)) { e107::getMessage()->addSuccess(print_a($success, true)); } if (!empty($skipped)) { e107::getMessage()->setTitle("Skipped", E_MESSAGE_INFO)->addInfo(print_a($skipped, true)); } if (!empty($error)) { e107::getMessage()->addError(print_a($error, true)); } e107::getRender()->tablerender(DBLAN_10 . SEP . "Sync with Github", e107::getMessage()->render()); }
function checklayout($str) { // Displays a basic representation of the theme global $PLUGINS_DIRECTORY, $rs, $sc_style, $menu_order, $style; // global $style required. $PLUGINS_DIRECTORY = e107::getFolder('PLUGINS'); $pref = e107::getPref(); $tp = e107::getParser(); $ns = e107::getRender(); $menuLayout = $this->curLayout != $pref['sitetheme_deflayout'] ? $this->curLayout : ""; // if(strstr($str, "LOGO")) // { // echo $tp->parseTemplate("{LOGO}"); // } if (strstr($str, "SETSTYLE")) { $tmp = explode("=", $str); $style = preg_replace("/\\{SETSTYLE=(.*?)\\}/si", "\\1", $str); $this->style = $style; $ns->setStyle($style); } elseif (strstr($str, "NAVIGATION")) { echo "<span class='label label-info'>Navigation Area</span>"; } elseif (strstr($str, "ALERT")) { //echo "[Navigation Area]"; } elseif (strstr($str, "LANGUAGELINKS")) { echo "<div class=text style='padding: 2px; text-align: center'>[Language]</div>"; } elseif (strstr($str, "CUSTOM")) { $cust = preg_replace("/\\W*\\{CUSTOM=(.*?)(\\+.*)?\\}\\W*/si", "\\1", $str); echo "<div style='padding: 2px'>[" . $cust . "]</div>"; } elseif (strstr($str, "CMENU")) { $cust = preg_replace("/\\W*\\{CMENU=(.*?)(\\+.*)?\\}\\W*/si", "\\1", $str); $this->customMenu[] = $cust; echo $tp->parseTemplate("{CMENU=" . $cust . "}", true); // echo $this->renderPanel('Embedded Custom Menu',$cust); } elseif (strstr($str, "SETIMAGE")) { $cust = preg_replace("/\\W*\\{SETIMAGE(.*?)(\\+.*)?\\}\\W*/si", "\\1", $str); echo $tp->parseTemplate("{SETIMAGE" . $cust . "}", true); // echo $this->renderPanel('Embedded Custom Menu',$cust); } elseif (strstr($str, "{WMESSAGE")) { echo "<div class=text style='padding: 30px; text-align: center'>[Welcome Message Area]</div>"; // echo $this->renderPanel('Embedded Custom Menu',$cust); } elseif (strstr($str, "{FEATUREBOX")) { echo "<div class=text style='padding: 80px; text-align: center'>[Featurebox Area]</div>"; // echo $this->renderPanel('Embedded Custom Menu',$cust); } else { if (strstr($str, "PLUGIN")) { $plug = preg_replace("/\\{PLUGIN=(.*?)\\}/si", "\\1", $str); $plug = trim($plug); if (file_exists(e_PLUGIN . "{$plug}/{$plug}_config.php")) { $link = e_PLUGIN . "{$plug}/{$plug}_config.php"; } if (file_exists(e_PLUGIN . $plug . "/config.php")) { $link = e_PLUGIN . $plug . "/config.php"; } // $plugtext = "<div class='menu-panel'>"; // $plugtext .= "<div class='menu-panel-header' title=\"".MENLAN_34."\">".$plug."</div>"; $plugtext = $link ? "(" . MENLAN_34 . ":<a href='{$link} btn-menu' title='" . LAN_CONFIGURE . "'>" . LAN_CONFIGURE . "</a>)" : ""; // $plugtext .= "</div>"; echo "<br />"; echo $this->renderPanel($plug, $plugtext); // $ns->tablerender($plug, $plugtext); } else { if (strstr($str, "MENU")) { $matches = array(); if (preg_match_all("/\\{MENU=([\\d]{1,3})(:[\\w\\d]*)?\\}/", $str, $matches)) { $menuText = ""; foreach ($matches[1] as $menu) { $menu = preg_replace("/\\{MENU=(.*?)(:.*?)?\\}/si", "\\1", $str); if (isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false) { $menuText .= $sc_style['MENU']['pre']; } // --------------- $menuText .= "\n\n<!-- START AREA " . $menu . " -->"; $menuText .= "<div id='start-area-" . $menu . "' class='menu-panel'>"; $menuText .= "<div class='menu-panel-header' >" . MENLAN_14 . " " . $menu . "</div>\n\n"; $sql9 = new db(); // $sql9 = e107::getDb('sql9'); if ($sql9->count("menus", "(*)", " WHERE menu_location='{$menu}' AND menu_layout = '" . $this->dbLayout . "' ")) { unset($text); $menuText .= $rs->form_open("post", e_SELF . "?configure=" . $this->curLayout, "frm_menu_" . intval($menu)); $MODE = 1; $sql9->select("menus", "*", "menu_location='{$menu}' AND menu_layout='" . $this->dbLayout . "' ORDER BY menu_order"); $menu_count = $sql9->db_Rows(); $cl = $this->dragDrop ? "'portlet" : "regularMenu"; $menuText .= "\n<div class='column' id='area-" . $menu . "'>\n\n"; while ($row = $sql9->fetch(MYSQL_ASSOC)) { $menuText .= "\n\n\n <!-- Menu Start " . $row['menu_name'] . "-->\n"; $menuText .= "<div class='{$cl}' id='block-" . $row['menu_id'] . "-" . $menu . "'>\n"; // echo "<div class='ggportal'>"; // $menuText .= "hi there"; $menuText .= $this->menuRenderMenu($row, $menu_count); // echo "\n</div>"; $menuText .= "\n</div>\n"; $menuText .= "<!-- Menu end -->\n\n\n"; // echo "<div><br /></div>"; } $menuText .= "\n\n</div>\n\n"; // End Column $menuText .= $rs->form_close(); } else { // placeholder $menuText .= "<div class='column' id='area-" . $menu . "'><!-- --></div>"; } $menuText .= "</div><!-- END OF AREA -->\n\n"; // --------------- if (isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false) { $menuText .= $sc_style['MENU']['post']; } } } $ns->tablerender('', $menuText); } else { echo $tp->parseTemplate($str, true); } } } }
function __construct($order) { /* constructor */ $sql = e107::getDB(); /* get today's logfile ... */ $logfile = e_LOG . 'logp_' . date('z.Y', time()) . '.php'; // $logfile = e_PLUGIN.'log/logs/logp_'.date('z.Y', time()).'.php'; if (is_readable($logfile)) { require $logfile; } // $logfile = e_PLUGIN.'log/logs/logi_'.date('z.Y', time()).'.php'; $logfile = e_LOG . 'logi_' . date('z.Y', time()) . '.php'; if (is_readable($logfile)) { require $logfile; } $this->filesiteTotal = vartrue($siteTotal); $this->filesiteUnique = vartrue($siteUnique); /* set order var */ $this->order = $order; $this->fileInfo = vartrue($pageInfo); $this->fileBrowserInfo = vartrue($browserInfo); $this->fileOsInfo = vartrue($osInfo); $this->fileScreenInfo = vartrue($screenInfo); $this->fileDomainInfo = vartrue($domainInfo); $this->fileReferInfo = vartrue($refInfo); $this->fileQueryInfo = vartrue($searchInfo); $this->fileRecent = vartrue($visitInfo); /* get main stat info from database */ if ($sql->select('logstats', 'log_data', "log_id='pageTotal'")) { $row = $sql->db_Fetch(); $this->dbPageInfo = unserialize($row['log_data']); } else { $this->dbPageInfo = array(); } /* temp consolidate today's info (if it exists)... */ if (is_array($pageInfo)) { foreach ($pageInfo as $key => $info) { $key = preg_replace("/\\?.*/", "", $key); if (array_key_exists($key, $this->dbPageInfo)) { $this->dbPageInfo[$key]['ttlv'] += $info['ttl']; $this->dbPageInfo[$key]['unqv'] += $info['unq']; } else { $this->dbPageInfo[$key]['url'] = $info['url']; $this->dbPageInfo[$key]['ttlv'] = $info['ttl']; $this->dbPageInfo[$key]['unqv'] = $info['unq']; } } } $this->bar = file_exists(THEME . 'images/bar.png') ? THEME . 'images/bar.png' : e_IMAGE . 'generic/bar.png'; $this->plugFolder = e107::getFolder('plugins'); /* end constructor */ }