public function actionForbidden() { $this->getResponse()->setRenderMod('error403')->addHeader('HTTP/1.0 403 Forbidden'); $this->addTitle(LAN_ERROR_7); $template = e107::getCoreTemplate('error', 403); $vars = new e_vars(array('siteUrl' => SITEURL)); $body = e107::getParser()->parseTemplate($template['start'] . $template['body'] . $template['end'], true, null, $vars); $this->addBody($body); }
function navigation_shortcode($parm = '') { $types = array('main' => 1, 'side' => 2, 'footer' => 3, 'alt' => 4, 'alt5' => 5, 'alt6' => 6); $category = varset($types[$parm], 1); $tmpl = vartrue($parm, 'main'); $nav = e107::getNav(); $template = e107::getCoreTemplate('navigation', $tmpl); $data = $nav->initData($category); // $data = $nav->collection($category); return $nav->render($data, $template); }
/** * Page Navigation * @example {PAGE_NAVIGATION: template=navdoc&auto=1} in your Theme template. */ function sc_page_navigation($parm = '') { // $parm = eHelper::scParams($parm); $tmpl = e107::getCoreTemplate('chapter', vartrue($parm['template'], 'nav'), true, true); // always merge $template = $tmpl['showPage']; $request = $this->request; if ($request && is_array($request)) { switch ($request['action']) { case 'listBooks': $parm['cbook'] = 'all'; $template = $tmpl['listBooks']; if (e107::getPref('listBooks', false) == false) { return false; } break; case 'listChapters': $parm['cbook'] = $request['id']; $template = $tmpl['listChapters']; break; case 'listPages': $parm['cchapter'] = $request['id']; $template = $tmpl['listPages']; break; case 'showPage': $parm['cpage'] = $request['id']; break; } } if ($parm) { $parm = http_build_query($parm, null, '&'); } else { $parm = ''; } $links = e107::getAddon('page', 'e_sitelink'); $data = $links->pageNav($parm); if (isset($data['title']) && !vartrue($template['noAutoTitle'])) { // use chapter title $template['caption'] = $data['title']; $data = $data['body']; } if (empty($data)) { return; } return e107::getNav()->render($data, $template); }
function __construct() { $this->search_prefs = e107::getConfig('search')->getPref(); $this->search_info = $this->searchConfig(); if (deftrue('BOOTSTRAP')) { $tmp = e107::getCoreTemplate('search', 'form'); $SEARCH_TOP_TABLE = $tmp['start']; $SEARCH_BOT_TABLE = $tmp['end']; $SEARCH_CATS = $tmp['category']; $SEARCH_TYPE = $tmp['type']; $SEARCH_ADV = $tmp['advanced']; $SEARCH_ENHANCED = $tmp['enhanced']; $SEARCH_ADV_COMBO = $tmp['advanced-combo']; $this->template = $tmp; unset($tmp); } else { if (file_exists(THEME . "search_template.php")) { require THEME . "search_template.php"; } else { require e_CORE . "templates/search_template.php"; } $SEARCH_TOP_TABLE .= "{SEARCH_ENHANCED}"; $tmp = array(); $tmp['start'] = $SEARCH_TOP_TABLE; $tmp['end'] = $SEARCH_BOT_TABLE; $tmp['category'] = $SEARCH_CATS; $tmp['type'] = $SEARCH_TYPE; $tmp['advanced'] = $SEARCH_ADV; $tmp['enhanced'] = $SEARCH_ENHANCED; $tmp['advanced-combo'] = $SEARCH_ADV_COMBO; $this->template = $tmp; } if (e_AJAX_REQUEST) { if (vartrue($_POST['t'])) { echo $this->sc_search_advanced_block($_POST['t']); } exit; } }
/** * Render user email. * Additional user fields: * 'mail_subject' -> required when type is not signup * 'mail_body' -> required when type is not signup * 'mail_copy_to' -> optional, carbon copy, used when type is not signup * 'mail_bcopy_to' -> optional, blind carbon copy, used when type is not signup * 'mail_attach' -> optional, attach files, available for all types, additionally it overrides $SIGNUPEMAIL_ATTACHMENTS when type is signup * 'mail_options' -> optional, available for all types, any additional valid mailer option as described in e107Email::sendEmail() phpDoc help (options above can override them) * All standard user fields from the DB (user_name, user_loginname, etc.) * * @param string $type signup|notify|email|quickadd * @param array $userInfo * @return array */ public function renderEmail($type, $userInfo) { $pref = e107::getPref(); $ret = array(); $tp = e107::getParser(); $mes = e107::getMessage(); // mailer options if (isset($userInfo['mail_options']) && is_array($userInfo['mail_options'])) { $ret = $userInfo['mail_options']; } // required for signup and quickadd email type e107::coreLan('signup'); $EMAIL_TEMPLATE = e107::getCoreTemplate('email'); if (!is_array($EMAIL_TEMPLATE)) { // load from old location. (root of theme folder if it exists) if (file_exists(THEME . 'email_template.php')) { include THEME . 'email_template.php'; } else { // include core default. include e107::coreTemplatePath('email'); } // BC Fixes. $EMAIL_TEMPLATE['signup']['subject'] = $SIGNUPEMAIL_SUBJECT; $EMAIL_TEMPLATE['signup']['cc'] = $SIGNUPEMAIL_CC; $EMAIL_TEMPLATE['signup']['bcc'] = $SIGNUPEMAIL_BCC; $EMAIL_TEMPLATE['signup']['attachments'] = $SIGNUPEMAIL_ATTACHMENTS; $EMAIL_TEMPLATE['signup']['body'] = $SIGNUPEMAIL_TEMPLATE; $EMAIL_TEMPLATE['quickadduser']['body'] = $QUICKADDUSER_TEMPLATE['email_body']; $EMAIL_TEMPLATE['notify']['body'] = $NOTIFY_TEMPLATE['email_body']; } $template = ''; switch ($type) { case 'signup': $template = vartrue($SIGNUPPROVIDEREMAIL_TEMPLATE) ? $SIGNUPPROVIDEREMAIL_TEMPLATE : $EMAIL_TEMPLATE['signup']['body']; $ret['template'] = 'signup'; // // false Don't allow additional headers (mailer) ?? break; case 'quickadd': $template = $EMAIL_TEMPLATE['quickadduser']['body']; $ret['template'] = 'quickadduser'; // Don't allow additional headers (mailer) break; case 'notify': if (vartrue($userInfo['mail_body'])) { $template = $userInfo['mail_body']; } //$NOTIFY_HEADER.$userInfo['mail_body'].$NOTIFY_FOOTER; $ret['template'] = 'notify'; break; case 'email': case 'default': if (vartrue($userInfo['mail_body'])) { $template = $userInfo['mail_body']; } //$EMAIL_HEADER.$userInfo['mail_body'].$EMAIL_FOOTER; $ret['template'] = 'default'; break; } if (!$template) { $mes->addDebug('$template is empty in user_model.php line 1171.'); // Debug only, do not translate. return array(); } $pass_show = varset($userInfo['user_password']); // signup email only if ($type == 'signup') { $HEAD = ''; $FOOT = ''; $ret['e107_header'] = $userInfo['user_id']; if (vartrue($EMAIL_TEMPLATE['signup']['cc'])) { $ret['email_copy_to'] = $EMAIL_TEMPLATE['signup']['cc']; } if (vartrue($EMAIL_TEMPLATE['signup']['bcc'])) { $ret['email_bcopy_to'] = $EMAIL_TEMPLATE['signup']['bcc']; } if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['mail_attach']; } elseif (vartrue($EMAIL_TEMPLATE['signup']['attachments'])) { $ret['email_attach'] = $EMAIL_TEMPLATE['signup']['attachments']; } $style = vartrue($SIGNUPEMAIL_LINKSTYLE) ? "style='{$SIGNUPEMAIL_LINKSTYLE}'" : ""; if (empty($userInfo['activation_url']) && !empty($userInfo['user_sess']) && !empty($userInfo['user_id'])) { $userInfo['activation_url'] = SITEURL . "signup.php?activate." . $userInfo['user_id'] . "." . $userInfo['user_sess']; } $sc = array(); $sc['LOGINNAME'] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; $sc['PASSWORD'] = $pass_show ? $pass_show : '******'; $sc['ACTIVATION_LINK'] = strpos($userInfo['activation_url'], 'http') === 0 ? '<a href="' . $userInfo['activation_url'] . '">' . $userInfo['activation_url'] . '</a>' : $userInfo['activation_url']; // $sc['SITENAME'] = SITENAME; $sc['SITEURL'] = "<a href='" . SITEURL . "' {$style}>" . SITEURL . "</a>"; $sc['USERNAME'] = $userInfo['user_name']; $sc['USERURL'] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; $sc['DISPLAYNAME'] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; $sc['EMAIL'] = $userInfo['user_email']; $sc['ACTIVATION_URL'] = $userInfo['activation_url']; $ret['email_subject'] = $EMAIL_TEMPLATE['signup']['subject']; // $subject; $ret['send_html'] = TRUE; $ret['shortcodes'] = $sc; if (!varset($EMAIL_TEMPLATE['signup']['header'])) { $HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"; $HEAD .= "<html xmlns='http://www.w3.org/1999/xhtml' >\n"; $HEAD .= "<head><meta http-equiv='content-type' content='text/html; charset=utf-8' />\n"; $HEAD .= $SIGNUPEMAIL_USETHEME == 1 ? "<link rel=\"stylesheet\" href=\"" . SITEURLBASE . THEME_ABS . "style.css\" type=\"text/css\" />\n" : ""; $HEAD .= "<title>" . LAN_SIGNUP_58 . "</title>\n"; if ($SIGNUPEMAIL_USETHEME == 2) { $CSS = file_get_contents(THEME . "style.css"); $HEAD .= "<style>\n" . $CSS . "\n</style>"; } $HEAD .= "</head>\n"; if (vartrue($SIGNUPEMAIL_BACKGROUNDIMAGE)) { $HEAD .= "<body background=\"" . $SIGNUPEMAIL_BACKGROUNDIMAGE . "\" >\n"; } else { $HEAD .= "<body>\n"; } } else { $HEAD = ""; // $tp->parseTemplate($EMAIL_TEMPLATE['signup']['header'], true); } if (!varset($EMAIL_TEMPLATE['signup']['footer'])) { $FOOT = "\n</body>\n</html>\n"; } else { $FOOT = ""; // $tp->parseTemplate($EMAIL_TEMPLATE['signup']['footer'], true); } $ret['send_html'] = TRUE; $ret['email_body'] = $HEAD . $template . $FOOT; // e107::getParser()->parseTemplate(str_replace($search,$replace,$HEAD.$template.$FOOT), true); $ret['preview'] = $tp->parseTemplate($ret['email_body'], true, $sc); // Non-standard field $ret['shortcodes'] = $sc; return $ret; } // all other email types if (!$userInfo['mail_subject']) { $mes->addDebug('No Email subject provided to renderEmail() method.'); // Debug only, do not translate. return array(); } $templateName = $ret['template']; $ret['email_subject'] = varset($EMAIL_TEMPLATE[$templateName]['subject'], $EMAIL_TEMPLATE['default']['subject']); // $subject; $ret['e107_header'] = $userInfo['user_id']; if (vartrue($userInfo['email_copy_to'])) { $ret['email_copy_to'] = $userInfo['email_copy_to']; } if (vartrue($userInfo['email_bcopy_to'])) { $ret['email_bcopy_to'] = $userInfo['email_bcopy_to']; } if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['email_attach']; } $sc = array(); $sc['LOGINNAME'] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; $sc['DISPLAYNAME'] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; $sc['SITEURL'] = "<a href='" . SITEURL . "'>" . SITEURL . "</a>"; $sc['USERNAME'] = $userInfo['user_name']; $sc['USERURL'] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; $sc['PASSWORD'] = $pass_show ? $pass_show : '******'; $sc['SUBJECT'] = $userInfo['mail_subject']; /* $search[0] = '{LOGINNAME}'; $replace[0] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email']; $search[1] = '{DISPLAYNAME}'; $replace[1] = $userInfo['user_login'] ? $userInfo['user_login'] : $userInfo['user_name']; $search[2] = '{EMAIL}'; $replace[2] = $userInfo['user_email']; $search[3] = '{SITENAME}'; $replace[3] = SITENAME; $search[4] = '{SITEURL}'; $replace[4] = "<a href='".SITEURL."'>".SITEURL."</a>"; $search[5] = '{USERNAME}'; $replace[5] = $userInfo['user_name']; $search[6] = '{USERURL}'; $replace[6] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : ""; $ret['email_subject'] = $subject; // str_replace($search, $replace, $subject); - performed in mail handler. $search[7] = '{PASSWORD}'; $replace[7] = $pass_show ? $pass_show : '******'; */ if (isset($userInfo['activation_url'])) { $sc['ACTIVATION_URL'] = $userInfo['activation_url']; $sc['ACTIVATION_LINK'] = strpos($userInfo['activation_url'], 'http') === 0 ? '<a href="' . $userInfo['activation_url'] . '">' . $userInfo['activation_url'] . '</a>' : $userInfo['activation_url']; /* $search[8] = '{ACTIVATION_URL}'; $replace[8] = $userInfo['activation_url']; $search[9] = '{ACTIVATION_LINK}'; $replace[9] = strpos($userInfo['activation_url'], 'http') === 0 ? '<a href="'.$userInfo['activation_url'].'">'.$userInfo['activation_url'].'</a>' : $userInfo['activation_url']; */ } $ret['send_html'] = TRUE; $ret['email_body'] = $template; // e107::getParser()->parseTemplate(str_replace($search, $replace, $template)); - performed in mail handler. $ret['preview'] = $ret['mail_body']; // Non-standard field $ret['shortcodes'] = $sc; return $ret; }
$error = ''; $text = ' '; $password1 = ''; $password2 = ''; $email = ''; // Used in shortcodes $loginname = ''; $realname = ''; $image = ''; $avatar_upload = ''; $photo_upload = ''; $_POST['ue'] = ''; $signature = ''; } if (!empty($pref['membersonly_enabled'])) { $template = e107::getCoreTemplate('membersonly', 'signup'); define('e_IFRAME', true); define('e_IFRAME_HEADER', $template['header']); define('e_IFRAME_FOOTER', $template['footer']); unset($template); } /* if($signup_imagecode) { // require_once(e_HANDLER."secure_img_handler.php"); // $sec_img = new secure_image; } */ if ((USER || intval($pref['user_reg']) !== 1 || vartrue($pref['auth_method'], 'e107') != 'e107') && !getperms('0')) { header('location: ' . e_HTTP . 'index.php'); }
function sc_user_addons($parm = '') { $template = e107::getCoreTemplate('user', 'addon'); $tp = e107::getParser(); $data = e107::getAddonConfig('e_user', null, 'profile', $this->var); if (empty($data)) { return; } $text = ''; foreach ($data as $plugin => $val) { foreach ($val as $v) { $value = vartrue($v['url']) ? "<a href=\"" . $v['url'] . "\">" . $v['text'] . "</a>" : $v['text']; $array = array('USER_ADDON_LABEL' => $v['label'], 'USER_ADDON_TEXT' => $value); $text .= $tp->parseTemplate($template, true, $array); } } return $text; }
* * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * Purpose: Display a Menu item (panel) for each 'chapter' of a specific book. ie. the chapter-equivalent of {CMENU} . * @example in theme.php: {MENU: path=page/chapter&book=1} to render all chapters in book 1. */ if (!defined('e107_INIT')) { exit; } $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $parm = eHelper::scParams($parm); $template = e107::getCoreTemplate('chapter', 'panel'); $insert = vartrue($parm['book']) ? "AND chapter_parent = " . intval($parm['book']) : ''; //TODO Limits and cache etc. $data = $sql->retrieve("SELECT * FROM #page_chapters WHERE chapter_visibility IN (" . USERCLASS_LIST . ") AND chapter_template = 'panel' " . $insert . " LIMIT 24", true); $sc = e107::getScBatch('page', null, 'cpage'); $body = $template['listChapters']['start']; foreach ($data as $row) { $sc->setVars($row); $sc->setChapter($row['chapter_id']); $title = $tp->toHtml($row['chapter_name'], false, 'TITLE'); // Used when tablerender style includes the caption. $body .= $tp->parseTemplate($template['listChapters']['item'], true, $sc); // check for $mode == 'page-menu' in tablestyle() if you need a simple 'echo' without rendering styles. } $body .= $template['listChapters']['end']; $caption = $tp->parseTemplate($template['listChapters']['caption'], true, $sc);
<?php if (!defined('e107_INIT')) { exit; } e107::lan('core', 'contact'); $head = '<form id="contact-menu" action="' . e_HTTP . 'contact.php" method="post" >'; //XXX Template must conform to Bootstrap specs: http://twitter.github.com/bootstrap/base-css.html#forms //TODO Security Image. $foot = '</form>'; $template = e107::getCoreTemplate('contact', 'menu'); $contact_shortcodes = e107::getScBatch('contact'); $text = $tp->parseTemplate($head . $template . $foot, true, $contact_shortcodes); $ns->tablerender("Contact Us", $text, 'contact-menu');
$tmp = explode(".", e_QUERY); if ($tmp[0] == "self") { $tmp[1] = USERID; } if (USERID == $tmp[1] || ADMIN && getperms("4")) { $sql->select("user", "user_sess", "user_id='" . USERID . "'"); $row = $sql->db_Fetch(); @unlink(e_AVATAR_UPLOAD . $row['user_sess']); $sql->update("user", "user_sess='' WHERE user_id=" . intval($tmp[1])); header("location:" . e_SELF . "?id." . $tmp[1]); exit; } } $qs = explode(".", e_QUERY); $self_page = $qs[0] == 'id' && intval($qs[1]) == USERID; $USER_TEMPLATE = e107::getCoreTemplate('user'); e107::scStyle($sc_style); if (empty($USER_TEMPLATE)) { e107::getMessage()->addDebug("Using v1.x user template"); include_once e107::coreTemplatePath('user'); //correct way to load a core template. } else { $USER_FULL_TEMPLATE = $USER_TEMPLATE['view']; $USER_SHORT_TEMPLATE_START = $USER_TEMPLATE['list']['start']; $USER_SHORT_TEMPLATE = $USER_TEMPLATE['list']['item']; $USER_SHORT_TEMPLATE_END = $USER_TEMPLATE['list']['end']; } $TEMPLATE = str_replace('{USER_EMBED_USERPROFILE}', '{USER_ADDONS}', $TEMPLATE); // BC Fix $user_shortcodes = e107::getScBatch('user'); $user_shortcodes->wrapper('user/view');
function setIconArray() { if (!defined('E_32_MAIN')) { e107::getCoreTemplate('admin_icons'); } $this->iconArray = array('main' => E_32_MAIN, 'admin' => E_32_ADMIN, 'admin_pass' => E_32_ADPASS, 'banlist' => E_32_BANLIST, 'cache' => E_32_CACHE, 'comment' => E_32_COMMENT, 'credits' => E_32_CREDITS, 'cron' => E_32_CRON, 'custom' => E_32_CUST, 'database' => E_32_DATAB, 'docs' => E_32_DOCS, 'emoticon' => E_32_EMOTE, 'filemanage' => E_32_FILE, 'fileinspector' => E_32_INSPECT, 'frontpage' => E_32_FRONT, 'image' => E_32_IMAGES, 'language' => E_32_LANGUAGE, 'links' => E_32_LINKS, 'mail' => E_32_MAIL, 'maintain' => E_32_MAINTAIN, 'menus' => E_32_MENUS, 'meta' => E_32_META, 'newsfeed' => E_32_NEWSFEED, 'news' => E_32_NEWS, 'notify' => E_32_NOTIFY, 'phpinfo' => E_32_PHP, 'plug_manage' => E_32_PLUGMANAGER, 'poll' => E_32_POLLS, 'prefs' => E_32_PREFS, 'search' => E_32_SEARCH, 'syslogs' => E_32_ADMINLOG, 'theme_manage' => E_32_THEMEMANAGER, 'upload' => E_32_UPLOADS, 'eurl' => E_32_EURL, 'userclass' => E_32_USERCLASS, 'user_extended' => E_32_USER_EXTENDED, 'users' => E_32_USER, 'wmessage' => E_32_WELCOME); }
/** * Sets one or more parameters from an array. See @see{sendEmail()} for list of parameters * Where parameter not present, doesn't change it - so can repeatedly call this function for bulk mailing, or to build up the list * (Note that there is no requirement to use this method for everything; parameters can be set by mixing this method with individual setting) * * @param array $eml - list of parameters to set/change. Key is parameter name. @see{sendEmail()} for list of parameters * * @return int zero if no errors detected */ public function arraySet($eml) { $tp = e107::getParser(); $tmpl = null; // Cleanup legacy key names. ie. remove 'email_' prefix. foreach ($eml as $k => $v) { if (substr($k, 0, 6) == 'email_') { $nkey = substr($k, 6); $eml[$nkey] = $v; unset($eml[$k]); } } if (vartrue($eml['template'])) { if ($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) { $eml['shortcodes'] = $this->processShortcodes($eml); // print_a($eml); $emailBody = $tmpl['header'] . $tmpl['body'] . $tmpl['footer']; $eml['body'] = $tp->parseTemplate($emailBody, true, $eml['shortcodes']); // $eml['body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']). $tp->toEmail($tmpl['footer'])); if ($this->debug) { // echo "<h4>e107Email::arraySet() - line ".__LINE__."</h4>"; // print_a($tmpl); } unset($eml['add_html_header']); // disable other headers when template is used. $this->Subject = $tp->parseTemplate($tmpl['subject'], true, varset($eml['shortcodes'], null)); } else { if ($this->debug) { echo "<h4>Couldn't find email template: " . $eml['template'] . "</h4>"; } // $emailBody = $eml['body']; if (vartrue($eml['subject'])) { $this->Subject = $tp->parseTemplate($eml['subject'], true, varset($eml['shortcodes'], null)); } e107::getMessage()->addDebug("Couldn't find email template: " . $eml['template']); } } else { if (vartrue($eml['subject'])) { $this->Subject = $tp->parseTemplate($eml['subject'], true, varset($eml['shortcodes'], null)); } // $eml['body'] = ($tp->toEmail($tmpl['header']). str_replace('{BODY}', $eml['body'], $tmpl['body']). $tp->toEmail($tmpl['footer'])); } $this->Subject = str_replace("'", "'", $this->Subject); // Perform Override from template. foreach ($this->overrides as $k => $v) { if (!empty($tmpl[$v])) { $eml[$v] = $tmpl[$v]; } } $identifier = deftrue('MAIL_IDENTIFIER', 'X-e107-id'); if (isset($eml['SMTPDebug'])) { $this->SMTPDebug = $eml['SMTPDebug']; } // 'FALSE' is a valid value! if (!empty($eml['sender_email'])) { $this->From = $eml['sender_email']; } if (!empty($eml['sender_name'])) { $this->FromName = $eml['sender_name']; } if (!empty($eml['replyto'])) { $this->AddAddressList('replyto', $eml['replyto'], vartrue($eml['replytonames'], '')); } if (isset($eml['html'])) { $this->allow_html = $eml['html']; } // 'FALSE' is a valid value! if (isset($eml['html_header'])) { $this->add_HTML_header = $eml['html_header']; } // 'FALSE' is a valid value! if (!empty($eml['body'])) { $this->makeBody($eml['body'], $this->allow_html, $this->add_HTML_header); } if (!empty($eml['attachment'])) { $this->attach($eml['attachment']); } if (!empty($eml['cc'])) { $this->AddAddressList('cc', $eml['cc'], vartrue($eml['cc_names'], '')); } if (!empty($eml['bcc'])) { $this->AddAddressList('bcc', $eml['bcc'], vartrue($eml['bcc_names'], '')); } if (!empty($eml['returnreceipt'])) { $this->ConfirmReadingTo = $eml['returnreceipt']; } if (!empty($eml['inline_images'])) { $this->addInlineImages($eml['inline_images']); } if (!empty($eml['priority'])) { $this->Priority = $eml['priority']; } if (!empty($eml['e107_header'])) { $this->AddCustomHeader($identifier . ": {$eml['e107_header']}"); } if (!empty($eml['wordwrap'])) { $this->WordWrap = $eml['wordwrap']; } if (!empty($eml['split'])) { $this->SingleTo = $eml['split'] != FALSE; } if (!empty($eml['smtp_username'])) { $this->Username = $eml['smtp_username']; } if (!empty($eml['smtp_password'])) { $this->Password = $eml['smtp_password']; } if (!empty($eml['bouncepath'])) { $this->Sender = $eml['bouncepath']; // Bounce path $this->save_bouncepath = $eml['bouncepath']; // Bounce path } if (!empty($eml['extra_header'])) { if (is_array($eml['extra_header'])) { foreach ($eml['extra_header'] as $eh) { $this->addCustomHeader($eh); } } else { $this->addCustomHeader($eml['extra_header']); } } // print_a($eml); if ($this->debug) { // echo "<h4>e107Email::arraySet() - line ".__LINE__."</h4>"; return 0; // print_a($eml); //$this->PreSend(); //$debugEml = $this->GetSentMIMEMessage(). //print_a($debugEml); } $this->logLine("ArraySet Data:" . print_r($eml, true)); return 0; // No error }
function sc_userextended_field($parm = '') { global $usersettings_shortcodes, $extended_showed, $ue, $USEREXTENDED_FIELD, $REQUIRED_FIELD; if (deftrue('BOOTSTRAP') === 3) { $USEREXTENDED_FIELD = e107::getCoreTemplate('usersettings', 'extended-field'); } if (isset($extended_showed['field'][$parm])) { return ""; } $sql = e107::getDb(); $tp = e107::getParser(); $ret = ""; $fInfo = getcachedvars("extendeddata_{$parm}"); if (!$fInfo) { $qry = "\n\t\t\tSELECT * FROM #user_extended_struct\n\t\t\tWHERE user_extended_struct_applicable IN (" . $tp->toDB($this->var['userclass_list'], true) . ")\n\t\t\tAND user_extended_struct_write IN (" . USERCLASS_LIST . ")\n\t\t\tAND user_extended_struct_name = '" . $tp->toDB($parm, true) . "'\n\t\t\t"; if ($sql->gen($qry)) { $fInfo = $sql->fetch(); } } if ($fInfo) { $fname = $fInfo['user_extended_struct_text']; if (defined($fname)) { $fname = constant($fname); } $fname = $tp->toHTML($fname, "", "emotes_off, defs"); if ($fInfo['user_extended_struct_required'] == 1 && !deftrue('BOOTSTRAP')) { $fname = str_replace("{FIELDNAME}", $fname, $REQUIRED_FIELD); } $parms = explode("^,^", $fInfo['user_extended_struct_parms']); $fhide = ""; if ($parms[3]) { $chk = strpos($this->var['user_hidden_fields'], "^user_" . $parm . "^") === FALSE ? FALSE : TRUE; if (isset($_POST['updatesettings'])) { $chk = isset($_POST['hide']['user_' . $parm]); } $fhide = $ue->user_extended_hide($fInfo, $chk); } $uVal = str_replace(chr(1), "", $this->var['user_' . $parm]); $fval = $ue->user_extended_edit($fInfo, $uVal); $ret = $USEREXTENDED_FIELD; $ret = str_replace("{FIELDNAME}", $fname, $ret); $ret = str_replace("{FIELDVAL}", $fval, $ret); $ret = str_replace("{HIDEFIELD}", $fhide, $ret); } $extended_showed['field'][$parm] = 1; return $ret; }
function processViewPage() { if ($this->checkCache()) { return; } $sql = e107::getDb(); $query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p\n\t\tLEFT JOIN #user AS u ON p.page_author = u.user_id\n\t\tWHERE p.page_id=" . intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later if (!$sql->db_Select_gen($query)) { $ret['title'] = LAN_PAGE_12; // ***** CHANGED $ret['sub_title'] = ''; $ret['text'] = LAN_PAGE_3; $ret['comments'] = ''; $ret['rating'] = ''; $ret['np'] = ''; $ret['err'] = TRUE; $ret['cachecontrol'] = false; $this->authorized = 'nf'; $this->template = e107::getCoreTemplate('page', 'default'); $this->batch = e107::getScBatch('page')->setVars(new e_vars($ret))->setScVar('page', array()); define("e_PAGETITLE", $ret['title']); return; } $this->page = $sql->db_Fetch(); $this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default')); if (empty($this->template)) { $this->template = e107::getCoreTemplate('page', 'default'); } $this->batch = e107::getScBatch('page'); $this->pageText = $this->page['page_text']; $this->pageCheckPerms($this->page['page_class'], $this->page['page_password'], $this->page['page_title']); if ($this->debug) { echo "<b>pageText</b> " . $this->pageText . " <br />"; } $this->parsePage(); $pagenav = $rating = $comments = ''; if ($this->authorized === true) { $pagenav = $this->pageIndex(); $rating = $this->pageRating($this->page['page_rating_flag']); $comments = $this->pageComment($this->page['page_comment_flag']); } $ret['title'] = $this->page['page_title']; $ret['sub_title'] = $this->title; $ret['text'] = $this->pageToRender; $ret['np'] = $pagenav; $ret['rating'] = $rating; $ret['comments'] = $comments; $ret['err'] = FALSE; $ret['cachecontrol'] = isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true; // Don't cache password protected pages $this->batch->setVars(new e_vars($ret))->setScVar('page', $this->page); define('e_PAGETITLE', eHelper::formatMetaTitle($ret['title'])); define('META_DESCRIPTION', $this->page['page_metadscr']); define('META_KEYWORDS', $this->page['page_metakeys']); //return $ret; }
/** * Render menu * * @param string $mpath menu path * @param string $mname menu name * @param string $parm menu parameters * @param boolean $return * return string if required */ public function renderMenu($mpath, $mname = '', $parm = '', $return = false) { // global $sql; // required at the moment. global $sc_style, $e107_debug; $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); if ($tmp = e107::unserialize($parm)) { $parm = $tmp; unset($tmp); } $this->_current_parms = $parm; $this->_current_menu = $mname; if ($return) { ob_start(); } if (e_DEBUG === true) { echo "\n<!-- Menu Start: " . $mname . " -->\n"; } e107::getDB()->db_Mark_Time($mname); if (is_numeric($mpath) || $mname === false) { $query = $mname === false ? "menu_name = '" . $mpath . "' " : "page_id=" . intval($mpath) . " "; // load by ID or load by menu-name (menu_name) $sql->select("page", "*", $query); $page = $sql->fetch(); if (!empty($page['menu_class']) && !check_class($page['menu_class'])) { echo "\n<!-- Menu not rendered due to userclass settings -->\n"; return; } $caption = vartrue($page['menu_icon']) ? $tp->toIcon($page['menu_icon']) : ''; $caption .= $tp->toHTML($page['menu_title'], true, 'parse_sc, constants'); if (vartrue($page['menu_template'])) { $template = e107::getCoreTemplate('menu', $page['menu_template'], true, true); // override and merge required. ie. when menu template is not in the theme, but only in the core. $page_shortcodes = e107::getScBatch('page', null, 'cpage'); $page_shortcodes->setVars($page); $head = $tp->parseTemplate($template['start'], true); $foot = $tp->parseTemplate($template['end'], true); // print_a($template['body']); $text = $head . $tp->parseTemplate($template['body'], true, $page_shortcodes) . $template['end']; // echo "TEMPLATE= ($mpath)".$page['menu_template']; // if($template['noTableRender'] !==true) // XXX Deprecated - causes confusion while themeing. use {SETSTYLE=none} instead. // { $ns->tablerender($caption, $text, 'cmenu-' . $page['menu_template']); // } // else // { // echo $text; // } } else { $text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants'); $ns->tablerender($caption, $text, 'cmenu'); } } else { // not sure what would break this, but it's good idea to go away e107::loadLanFiles($mpath); //include once is not an option anymore //e107_include will break many old menus (evil globals), so we'll wait for a while... //e107_include(e_PLUGIN.$mpath."/".$mname.".php"); //if(substr($mpath,-1)!='/') //{ // $mpath .= '/'; //} $mpath = trim($mpath, '/') . '/'; // faster... $e107_debug ? include e_PLUGIN . $mpath . $mname . '.php' : @(include e_PLUGIN . $mpath . $mname . '.php'); } e107::getDB()->db_Mark_Time("(After " . $mname . ")"); if ($error_handler->debug == true) { echo "\n<!-- Menu End: " . $mname . " -->\n"; } if ($return) { $ret = ob_get_contents(); ob_end_clean(); return $ret; } }
<?php /* * e107 website system * * Copyright (C) 2008-2013 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * */ if (!defined('e107_INIT')) { exit; } //FIXME XXX - This menu should call the {PAGE_NAVIGATION} shortcode instead of duplicating its code and automatically display all links. $parm = eHelper::scParams($parm); $tmpl = e107::getCoreTemplate('chapter', 'nav', true, true); // always merge and allow override $template = $tmpl['showPage']; $request = e107::getRegistry('core/pages/request'); if ($request && is_array($request)) { switch ($request['action']) { case 'listChapters': $parm['cbook'] = $request['id']; $template = $tmpl['listChapters']; break; case 'listPages': $parm['cchapter'] = $request['id']; $template = $tmpl['listPages']; break; case 'showPage': $parm['cpage'] = $request['id'];
// needed? /* if (USE_IMAGECODE) { $sc = array ( 'FPW_TABLE_SECIMG_LAN' => LAN_FPW2, 'FPW_TABLE_SECIMG_HIDDEN' => "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />", 'FPW_TABLE_SECIMG_SECIMG' => $sec_img->r_image(), 'FPW_TABLE_SECIMG_TEXTBOC' => "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />" ); } */ if (deftrue('BOOTSTRAP')) { // TODO do we want the <form> element outside the template? $FPW_TABLE = "<form method='post' action='" . SITEURL . "fpw.php' autocomplete='off'>"; $FPW_TABLE .= e107::getCoreTemplate('fpw', 'form'); $FPW_TABLE .= "</form>"; $caption = deftrue('LAN_FPW_100', "Forgot your password?"); } elseif (!$FPW_TABLE) { require_once e107::coreTemplatePath('fpw'); //correct way to load a core template. $caption = LAN_03; } $sc = new fpw_shortcodes(); // New Shortcode names in v2. BC Fix. $bcShortcodes = array('{FPW_TABLE_SECIMG_LAN}', '{FPW_TABLE_SECIMG_HIDDEN}', '{FPW_TABLE_SECIMG_SECIMG}', '{FPW_TABLE_SECIMG_TEXTBOC}'); $nwShortcodes = array('{FPW_CAPTCHA_LAN}', '{FPW_CAPTCHA_HIDDEN}', '{FPW_CAPTCHA_IMG}', '{FPW_CAPTCHA_INPUT}'); $FPW_TABLE = str_replace($bcShortcodes, $nwShortcodes, $FPW_TABLE); $text = $tp->parseTemplate($FPW_TABLE, true, $sc); // $text = $tp->simpleParse($FPW_TABLE, $sc); $ns->tablerender($caption, $text);
$message = e107::getEmail()->sendEmail($send_to, $send_to_name, $eml, false) ? LANCONTACT_09 : LANCONTACT_10; // $message = (sendemail($send_to,"[".SITENAME."] ".$subject, $body,$send_to_name,$sender,$sender_name)) ? LANCONTACT_09 : LANCONTACT_10; if (isset($pref['contact_emailcopy']) && $pref['contact_emailcopy'] && $email_copy == 1) { require_once e_HANDLER . "mail.php"; sendemail($sender, "[" . SITENAME . "] " . $subject, $body, ADMIN, $sender, $sender_name); } $ns->tablerender('', "<div class='alert alert-success'>" . $message . "</div>"); require_once FOOTERF; exit; } else { message_handler("P_ALERT", $error); } } if (SITECONTACTINFO) { if (!isset($CONTACT_INFO)) { $CONTACT_INFO = e107::getCoreTemplate('contact', 'info'); } $text = $tp->parseTemplate($CONTACT_INFO, true, vartrue($contact_shortcodes)); $ns->tablerender(LANCONTACT_01, $text, "contact"); } if (check_class($active) && isset($pref['sitecontacts']) && $pref['sitecontacts'] != e_UC_NOBODY) { $contact_shortcodes = e107::getScBatch('contact'); // Wrapper support $contact_shortcodes->wrapper('contact/form'); $text = $tp->parseTemplate($CONTACT_FORM, true, $contact_shortcodes); if (trim($text) != "") { $ns->tablerender(LANCONTACT_02, $text, "contact"); } } elseif ($active == e_UC_MEMBER && $pref['sitecontacts'] != e_UC_NOBODY) { $srch = array("[", "]"); $repl = array("<a class='alert-link' href='" . e_SIGNUP . "'>", "</a>");
if ((!ADMIN || !getperms("4")) && e_QUERY && e_QUERY != "update") { header('location:' . e_BASE . 'usersettings.php'); exit; } include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_user.php'); // Generic user-related language defines include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_usersettings.php'); require_once e_HANDLER . 'ren_help.php'; require_once e_HANDLER . 'user_extended_class.php'; // require_once (e_HANDLER.'user_handler.php'); require_once e_HANDLER . 'validator_class.php'; $ue = new e107_user_extended(); $userMethods = e107::getUserSession(); require_once e_HANDLER . 'ren_help.php'; if (deftrue('BOOTSTRAP') === 3) { $template = e107::getCoreTemplate('usersettings', '', true, true); // always merge $USERSETTINGS_MESSAGE = "{MESSAGE}"; $USERSETTINGS_MESSAGE_CAPTION = LAN_OK; $USERSETTINGS_EDIT_CAPTION = LAN_USET_39; // 'Update User Settings' $USERSETTINGS_EDIT = $template['edit']; $usersettings_shortcodes = e107::getScBatch('usersettings'); $usersettings_shortcodes->wrapper('usersettings/edit'); } else { include_once e107::coreTemplatePath('usersettings'); //correct way to load a core template. e107::scStyle($sc_style); $usersettings_shortcodes = e107::getScBatch('usersettings'); } e107::js('footer-inline', "\n\tfunction addtext_us(sc)\n\t{\n\t\tdocument.getElementById('dataform').image.value = sc;\n\t}\n\t");
} $fcaption = UP_LAN_0 . ' ' . $user_name; /* if (!$USERPOSTS_FORUM_TABLE) { if (file_exists(THEME.'userposts_template.php')) { require_once(THEME.'userposts_template.php'); } else { require_once(e_BASE.$THEMES_DIRECTORY.'templates/userposts_template.php'); } }*/ // new template engine - override in THEME/templates/userposts_template.php $USERPOSTS_TEMPLATE = e107::getCoreTemplate('userposts'); $s_info = ''; $_POST['f_query'] = trim(varset($_POST['f_query'])); if ($_POST['f_query'] !== '') { $f_query = $tp->toDB($_POST['f_query']); $s_info = "AND (t.thread_name REGEXP('" . $f_query . "') OR p.post_entry REGEXP('" . $f_query . "'))"; $fcaption = UP_LAN_12 . ' ' . $user_name; } $qry = "\n\tSELECT SQL_CALC_FOUND_ROWS p.*, t.*, f.* FROM `#forum_post` AS p\n\tLEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread\n\tLEFT JOIN `#forum` AS f ON f.forum_id = p.post_forum\n\tWHERE p.post_user = {$id}\n\tAND p.post_forum IN ({$forumList})\n\t{$s_info}\n\tORDER BY p.post_datestamp DESC LIMIT {$from}, 10\n\t"; if (!$sql->db_Select_gen($qry)) { $ftext .= "<span class='mediumtext'>" . UP_LAN_8 . '</span>'; } else { $gen = e107::getDateConvert(); $vars = new e_vars(); $userposts_forum_table_string = ''; while (true) {
function templatesPage() { $templates = e107::getCoreTemplate('email', null, 'front'); $tab = array(); foreach ($templates as $k => $layout) { $caption = $k; $text = "<iframe src='" . e_ADMIN . "mailout.php?mode=main&action=preview&id=" . $k . "' width='100%' height='700'>Loading...</iframe>"; $tab[$k] = array('caption' => $caption, 'text' => $text); } return e107::getForm()->tabs($tab); }
/** * Get a list of all the available email templates, by name and variable name * * @param string $sel - currently (all|system|user) - selects template type * * @return array - key is the variable name of the template, value is the stored * template name */ public function getEmailTemplateNames($sel = 'all') { $ret = array(); $templates = e107::getCoreTemplate('email', false, 'front', false); foreach ($templates as $key => $layout) { if (vartrue($layout['name'])) { $ret[$key] = $layout['name']; } } return $ret; /* foreach (array(e_CORE.'templates/email_template.php', THEME.'templates/email_template.php') as $templateFileName ) // Override file then defaults if (is_readable($templateFileName)) { require($templateFileName); $tVars = get_defined_vars(); if (isset($tVars['GLOBALS'])) unset($tVars['GLOBALS']); foreach ($tVars as $tKey => $tData) { if (is_array($tData) && isset($tData['template_name'])) { if (!isset($tData['template_type']) || ($tData['template_type'] == 'all') || ($tData['template_type'] == $sel)) { $ret[$tKey] = $tData['template_name']; } } if ($tKey != 'ret') { unset($tVars[$tKey]); } } } print_a($ret); return $ret; */ }
function processViewPage() { if ($this->checkCache()) { return; } $sql = e107::getDb(); $query = "SELECT p.*, u.user_id, u.user_name, user_login FROM #page AS p\n\t\tLEFT JOIN #user AS u ON p.page_author = u.user_id\n\t\tWHERE p.page_id=" . intval($this->pageID); // REMOVED AND p.page_class IN (".USERCLASS_LIST.") - permission check is done later if (!$sql->gen($query)) { header("HTTP/1.0 404 Not Found"); // exit; /* $ret['title'] = LAN_PAGE_12; // ***** CHANGED $ret['sub_title'] = ''; $ret['text'] = LAN_PAGE_3; $ret['comments'] = ''; $ret['rating'] = ''; $ret['np'] = ''; $ret['err'] = TRUE; $ret['cachecontrol'] = false; */ // ---------- New (to replace values above) ---- $this->page['page_title'] = LAN_PAGE_12; // ***** CHANGED $this->page['sub_title'] = ''; $this->page['page_text'] = LAN_PAGE_3; $this->page['comments'] = ''; $this->page['rating'] = ''; $this->page['np'] = ''; $this->page['err'] = TRUE; $this->page['cachecontrol'] = false; // ------------------------------------- $this->authorized = 'nf'; $this->template = e107::getCoreTemplate('page', 'default'); // $this->batch = e107::getScBatch('page',null,'cpage')->setVars(new e_vars($ret))->setScVar('page', array()); ///Upgraded to setVars() array. (not using '$this->page') $this->batch = e107::getScBatch('page', null, 'cpage')->setVars($this->page); define("e_PAGETITLE", $this->page['page_title']); return; } $this->page = $sql->fetch(); // setting override to true breaks default. $this->template = e107::getCoreTemplate('page', vartrue($this->page['page_template'], 'default'), true, true); if (!$this->template) { // switch to default $this->template = e107::getCoreTemplate('page', 'default', false, false); } if (empty($this->template)) { $this->template = e107::getCoreTemplate('page', 'default'); } $this->batch = e107::getScBatch('page', null, 'cpage'); $this->pageText = $this->page['page_text']; $this->pageCheckPerms($this->page['page_class'], $this->page['page_password'], $this->page['page_title']); if ($this->debug) { echo "<b>pageText</b> " . $this->pageText . " <br />"; } $this->parsePage(); $pagenav = $rating = $comments = ''; if ($this->authorized === true) { $pagenav = $this->pageIndex(); $rating = $this->pageRating($this->page['page_rating_flag']); $comments = $this->pageComment($this->page['page_comment_flag']); } /* $ret['title'] = $this->page['page_title']; $ret['sub_title'] = $this->title; $ret['text'] = $this->pageToRender; $ret['np'] = $pagenav; $ret['rating'] = $rating; $ret['comments'] = $comments; $ret['err'] = FALSE; $ret['cachecontrol'] = (isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true); // Don't cache password protected pages */ // $this->batch->setVars(new e_vars($ret))->setScVar('page', $this->page); // Removed in favour of $this->var (cross-compatible with menus and other parts of e107 that use the same shortcodes) // ---- New --- - $this->page['page_text'] = $this->pageToRender; $this->page['np'] = $pagenav; $this->page['rating'] = $rating; $this->page['comments'] = $comments; $this->page['err'] = FALSE; $this->page['cachecontrol'] = isset($this->page['page_password']) && !$this->page['page_password'] && $this->authorized === true; // ----------------- $this->batch->setVars($this->page); define('e_PAGETITLE', eHelper::formatMetaTitle($this->page['page_title'])); if ($this->page['page_metadscr']) { define('META_DESCRIPTION', eHelper::formatMetaDescription($this->page['page_metadscr'])); } if ($this->page['page_metakeys']) { define('META_KEYWORDS', eHelper::formatMetaKeys($this->page['page_metakeys'])); } $tp = e107::getParser(); if ($tp->isImage($this->page['menu_image'])) { $mimg = $tp->thumbUrl($this->page['menu_image'], 'w=800', false, true); e107::meta('og:image', $mimg); } //return $ret; }
<?php if (!defined('e107_INIT')) { exit; } $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $template = e107::getCoreTemplate('page', 'panel'); //TODO Limits and cache etc. $data = $sql->retrieve("SELECT * FROM #page WHERE page_class IN (" . USERCLASS_LIST . ") AND FIND_IN_SET('panel', page_template) LIMIT 3", true); //TODO Use shortcodes and template. foreach ($data as $row) { $title = $tp->toHtml($row['page_title'], false, 'TITLE'); $body = $tp->toHtml($row['page_text'], true, 'BODY'); $ns->tablerender($title, $body, 'page-menu'); // check for $mode == 'page-menu' in tablestyle() if you need a simple 'echo' without rendering styles. }