function sc_contact_email($parm = '') { $userEmail = deftrue('USEREMAIL'); $disabled = !empty($userEmail) ? 'readonly' : ''; // don't allow change from a verified email address. return "<input type='email' " . $disabled . " id='contactEmail' title='a valid email address' name='email_send' required='required' size='30' class='tbox form-control' value='" . (vartrue($_POST['email_send']) ? $_POST['email_send'] : USEREMAIL) . "' />"; }
function sc_siteurl($parm = '') { if (strlen(deftrue('SITEURL')) < 3) { return e107::getPref('siteurl'); } return SITEURL; }
function display_help($tagid = "helpb", $mode = 1, $addtextfunc = "addtext", $helpfunc = "help", $helpsize = '') { return e107::getBB()->renderButtons($mode, 'data'); // guessing the name of the textarea as 'data' no indicator unfortunately. // may cause pre-image and pre-file selector issues. // if(defsettrue('e_WYSIWYG')) { return; } global $tp, $pref, $eplug_bb, $bbcode_func, $register_bb, $bbcode_help, $bbcode_helpactive, $bbcode_helptag, $bbcode_helpsize; $bbcode_helpsize = $helpsize; $bbcode_func = $addtextfunc; $bbcode_help = $helpfunc; $bbcode_helptag = $tagid; // $arr = get_defined_vars(); // print_a($arr); // load the template if (is_readable(THEME . "bbcode_template.php")) { include THEME . "bbcode_template.php"; } else { include e_THEME . "templates/bbcode_template.php"; } if ($mode != 2 && $mode != "forum") { $bbcode_helpactive = TRUE; } // Load the Plugin bbcode AFTER the templates, so they can modify or replace. if (!empty($pref['e_bb_list'])) { foreach ($pref['e_bb_list'] as $val) { if (is_readable(e_PLUGIN . $val . "/e_bb.php")) { require e_PLUGIN . $val . "/e_bb.php"; } } } $temp = array(); $temp['news'] = $BBCODE_TEMPLATE_NEWSPOST; $temp['submitnews'] = $BBCODE_TEMPLATE_SUBMITNEWS; $temp['extended'] = $BBCODE_TEMPLATE_NEWSPOST; $temp['admin'] = $BBCODE_TEMPLATE_ADMIN; $temp['mailout'] = $BBCODE_TEMPLATE_MAILOUT; $temp['page'] = $BBCODE_TEMPLATE_CPAGE; $temp['maintenance'] = $BBCODE_TEMPLATE_ADMIN; $temp['comment'] = $BBCODE_TEMPLATE; $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE; if (isset($temp[$mode])) { $BBCODE_TEMPLATE = $temp[$mode]; } $visible = deftrue('e_WYSIWYG') ? "style='display:none'" : ""; if (is_readable(e_CORE . "shortcodes/batch/bbcode_shortcodes.php")) { $sc = e107::getScBatch('bbcode'); if ($tagid == 'data') { $tagid = 'data_'; } $data = array('tagid' => $tagid, 'template' => $mode, 'trigger' => $addtextfunc, 'hint_func' => $helpfunc, 'hint_active' => $bbcode_helpactive, 'size' => $helpsize); $sc->setVars($data); return "<div id='bbcode-panel-" . $tagid . "' class='mceToolbar bbcode-panel' {$visible}>" . $tp->parseTemplate($BBCODE_TEMPLATE) . "</div>"; } else { return "ERROR: " . e_CORE . "shortcodes/batch/bbcode_shortcodes.php IS NOT READABLE."; } }
function checkWritable() { $mes = e107::getMessage(); if (deftrue('e_MEDIA') && is_dir(e_MEDIA) && !is_writable(e_MEDIA)) { $mes->addWarning("The folder " . e_MEDIA . " is not writable. Please correct before proceeding."); } if (deftrue('e_SYSTEM') && is_dir(e_SYSTEM) && !is_writable(e_SYSTEM)) { $mes->addWarning("The folder " . e_SYSTEM . " is not writable. Please correct before proceeding."); } }
function render_emailprint($mode, $id, $look = 0, $parm = array()) { // $look = 0 --->display all icons // $look = 1 --->display email icon only // $look = 2 --->display print icon only $tp = e107::getParser(); $text_emailprint = ""; //new method emailprint_class : (only news is core, rest is plugin: searched for e_emailprint.php which should hold $email and $print values) if ($mode == "news") { $email = "news"; $print = "news"; } else { //load the others from plugins $handle = opendir(e_PLUGIN); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_dir(e_PLUGIN . $file)) { $plugin_handle = opendir(e_PLUGIN . $file . "/"); while (false !== ($file2 = readdir($plugin_handle))) { if ($file2 == "e_emailprint.php") { require_once e_PLUGIN . $file . "/" . $file2; } } } } } if (deftrue('BOOTSTRAP')) { $genericMail = $tp->toGlyph('icon-envelope', false); // "<i class='icon-envelope'></i>"; $genericPrint = $tp->toGlyph('fa-print', false); // "<i class='icon-print'></i>"; $class = varset($parm['class']) ? $parm['class'] : ""; } else { $genericMail = "<img src='" . e_IMAGE_ABS . "generic/email.png' alt='" . LAN_EMAIL_7 . "' />"; $genericPrint = "<img src='" . e_IMAGE_ABS . "generic/printer.png' alt='" . LAN_PRINT_1 . "' />"; $class = ""; } if ($look == 0 || $look == 1) { $ico_mail = defined("ICONMAIL") && file_exists(THEME . "images/" . ICONMAIL) ? "<img src='" . THEME_ABS . "images/" . ICONMAIL . "' alt='" . LAN_EMAIL_7 . "' />" : $genericMail; //TDOD CSS class $text_emailprint .= "<a class='e-tip hidden-print" . $class . "' href='" . e_HTTP . "email.php?" . $email . "." . $id . "' title='" . LAN_EMAIL_7 . "'>" . $ico_mail . "</a> "; } if ($look == 0 || $look == 2) { $ico_print = defined("ICONPRINT") && file_exists(THEME . "images/" . ICONPRINT) ? "<img src='" . THEME_ABS . "images/" . ICONPRINT . "' alt='" . LAN_PRINT_1 . "' />" : $genericPrint; //TODO CSS class $text_emailprint .= "<a class='e-tip " . $class . " hidden-print' href='" . e_HTTP . "print.php?" . $print . "." . $id . "' title='" . LAN_PRINT_1 . "'>" . $ico_print . "</a>"; } return $text_emailprint; }
function facebook($data) { if (!deftrue('SOCIAL_FACEBOOK_INIT')) { return "<div class='alert alert-important alert-danger'>Unable to render comments. Missing Facebook appID.</div>"; } e107::js('footer-inline', SOCIAL_FACEBOOK_INIT); if (E107_DEBUG_LEVEL > 0) { $link = "http://developers.facebook.com/docs/plugins/comments/"; } else { $link = e_REQUEST_URL; } $pref = e107::pref('social'); $limit = vartrue($pref['facebook_comments_limit'], 10); $theme = vartrue($pref['facebook_comments_theme'], 'light'); $loading = vartrue($pref['facebook_comments_loadingtext'], 'Loading...'); $text = '<div class="fb-comments" data-href="' . $link . '" data-width="100%" data-numposts="' . $limit . '" data-colorscheme="' . $theme . '">' . $loading . '</div>'; return $text; }
function sc_rss_types() { global $row, $tp; // $url1 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); // $url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); // $url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); // $url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : ''); $url2 = e107::url('rss_menu', 'rss', $row); $url4 = e107::url('rss_menu', 'atom', $row); if (deftrue('BOOTSTRAP') === 3) { $text = "\n\t\t\t<div>\n\t\t\t\t<a class='btn btn-sm btn-default' href='" . e107::url('rss_menu', 'rss', $row) . "' title='RSS 2.0'>" . $tp->toGlyph('fa-rss') . " RSS</a>\n\t\t\t\t<a class='btn btn-sm btn-default' href='" . e107::url('rss_menu', 'atom', $row) . "' title='ATOM'>" . $tp->toGlyph('fa-rss') . " Atom</a>\n\t\t\t</div>"; return $text; } $text = ""; // $text .= "<a href='".$url1."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss1.png' class='icon' alt='RSS 0.92' /></a>"; $text .= "<a href='" . $url2 . "' class='rss'><img src='" . e_PLUGIN_ABS . "rss_menu/images/rss2.png' class='icon' alt='RSS 2.0' /></a>"; // $text .= "<a href='".$url3."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss3.png' class='icon' alt='RDF' /></a>"; $text .= "<a href='" . $url4 . "' class='rss'><img src='" . e_PLUGIN_ABS . "rss_menu/images/rss4.png' class='icon' alt='ATOM' /></a>"; return $text; }
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; } }
$phpinfo = str_replace("</body></html>", "", $phpinfo); $phpinfo = str_replace('border="0"', '', $phpinfo); //$phpinfo = str_replace('<table ','<table class="table table-striped adminlist" ',$phpinfo); $phpinfo = str_replace('name=', 'id=', $phpinfo); $phpinfo = str_replace('class="e"', 'class="forumheader2 text-left"', $phpinfo); $phpinfo = str_replace('class="v"', 'class="forumheader3 text-left"', $phpinfo); $phpinfo = str_replace('class="v"', 'class="forumheader3 text-left"', $phpinfo); $phpinfo = str_replace('class="h"', 'class="fcaption"', $phpinfo); $phpinfo = str_replace('<table cellpadding="3" width="600">', '<table class="table table-striped adminlist"><colgroup><col style="width:30%" /><col style="width:auto" /></colgroup>', $phpinfo); $mes = e107::getMessage(); $security_risks = array("allow_url_fopen" => 'If you have Curl enabled, you should consider disabling this feature.', "allow_url_include" => 'This is a security risk and is not needed by e107.', "display_errors" => 'On a production server, it is better to disable the displaying of errors in the browser.', "expose_php" => 'Disabling this will hide your PHP version from browsers.', "register_globals" => 'This is a security risk and should be disabled.'); foreach ($security_risks as $risk => $diz) { if (ini_get($risk)) { $srch = '<tr><td class="forumheader2 text-left">' . $risk . '</td><td class="forumheader3">'; $repl = '<tr><td class="forumheader2 text-left">' . $risk . '</td><td title="' . $tp->toAttribute($diz) . '" class="forumheader3 alert alert-danger">'; $phpinfo = str_replace($srch, $repl, $phpinfo); $mes->addWarning("<b>" . $risk . "</b>: " . $diz); } } if ($sessionSavePath = ini_get('session.save_path')) { if (!is_writable($sessionSavePath)) { $mes->addError("<b>session.save_path</b> is not writable! That can cause major issues with your site."); } } // $phpinfo = preg_replace("#^.*<body>#is", "", $phpinfo); ob_end_clean(); if (deftrue('e_DEBUG')) { $mes->addDebug("Session ID: " . session_id()); } $ns->tablerender("PHPInfo", $mes->render() . $phpinfo); require_once "footer.php";
/** * Go online * @param boolean $online_tracking * @param boolean $flood_control * @return void */ public function goOnline($online_tracking = false, $flood_control = false) { // global $pref, $e_event; // Not needed as globals //global $online_timeout, $online_warncount, $online_bancount; // Not needed as globals //global $members_online, $total_online; // Not needed as globals global $listuserson; // FIXME - remove it, make it property, call e_online signleton - e107::getOnline() $e107 = e107::getInstance(); $sql = e107::getDb(); $user = e107::getUser(); if ($online_tracking || $flood_control) { $online_timeout = 300; list($ban_access_guest, $ban_access_member) = explode(',', e107::getPref('ban_max_online_access', '100,200')); $online_bancount = max($ban_access_guest, 50); // Safety net for incorrect values if ($user->isUser()) { $online_bancount = max($online_bancount, $ban_access_member); } $online_warncount = $online_bancount * 0.9; // Set warning threshold at 90% of ban threshold //TODO Add support for all queries. // $page = (strpos(e_SELF, 'forum_') !== FALSE) ? e_SELF.'.'.e_QUERY : e_SELF; // $page = (strpos(e_SELF, 'comment') !== FALSE) ? e_SELF.'.'.e_QUERY : $page; // $page = (strpos(e_SELF, 'content') !== FALSE) ? e_SELF.'.'.e_QUERY : $page; $page = e_REQUEST_URI; // mod rewrite & single entry support // FIXME parse url, trigger registered e_online callbacks $page = e107::getParser()->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter $ip = e107::getIPHandler()->getIP(FALSE); $udata = $user->isUser() && USER ? $user->getId() . '.' . $user->getName() : '0'; // USER check required to make sure they logged in without an error. $agent = $_SERVER['HTTP_USER_AGENT']; // XXX - more exceptions, e.g. hide online location for admins/users (pref), e_jlsib.php, etc // XXX - more advanced flod timing when e_AJAX_REQUEST, e.g. $ban_access_ajax = 300 $update_page = deftrue('e_AJAX_REQUEST') ? '' : ", online_location='{$page}'"; $insert_query = array('online_timestamp' => time(), 'online_flag' => 0, 'online_user_id' => $udata, 'online_ip' => $ip, 'online_location' => $page, 'online_pagecount' => 1, 'online_active' => 0, 'online_agent' => $agent, 'online_language' => e_LAN); // !deftrue('e_AJAX_REQUEST') // TODO add option to hide users from online list? boolean online_hide field? // don't do anything if main admin logged in as another user if ($user->isUser() && !$user->getParentId()) { // Find record that matches IP or visitor, or matches user info if ($sql->select('online', '*', "(`online_ip` = '{$ip}' AND `online_user_id` = '0') OR `online_user_id` = '{$udata}'")) { $row = $sql->fetch(); if ($row['online_user_id'] == $udata) { //Matching user record if ($row['online_timestamp'] < time() - $online_timeout) { //It has been at least 'online_timeout' seconds since this user's info last logged //Update user record with timestamp, current IP, current page and set pagecount to 1 $query = "online_timestamp='" . time() . "', online_ip='{$ip}'{$update_page}, online_pagecount=1, `online_active` = 1 WHERE online_user_id='{$row['online_user_id']}'"; } else { if (!$user->isAdmin()) { $row['online_pagecount']++; } // Update user record with current IP, current page and increment pagecount $query = "online_ip='{$ip}'{$update_page}, `online_pagecount` = '" . intval($row['online_pagecount']) . "', `online_active` = 1 WHERE `online_user_id` = '{$row['online_user_id']}'"; } } else { //Found matching visitor record (ip only) for this user if ($row['online_timestamp'] < time() - $online_timeout) { // It has been at least 'timeout' seconds since this user has connected // Update record with timestamp, current IP, current page and set pagecount to 1 $query = "`online_timestamp` = '" . time() . "', `online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = 1, `online_active` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; } else { // Another visit within the timeout period if (!$user->isAdmin()) { $row['online_pagecount']++; } //Update record with current IP, current page and increment pagecount $query = "`online_user_id` = '{$udata}'{$update_page}, `online_pagecount` = " . intval($row['online_pagecount']) . ", `online_active` =1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; } } $sql->update('online', $query); } else { $sql->insert('online', $insert_query); } } elseif (!$user->getParentId()) { //Current page request is from a guest if ($sql->select('online', '*', "`online_ip` = '{$ip}' AND `online_user_id` = '0'")) { // Recent visitor $row = $sql->fetch(); if ($row['online_timestamp'] < time() - $online_timeout) { //Update record with timestamp, current page, and set pagecount to 1 $query = "`online_timestamp` = '" . time() . "'{$update_page}, `online_pagecount` = 1 WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; } else { //Update record with current page and increment pagecount $row['online_pagecount']++; // echo "here {$online_pagecount}"; $query = "`online_pagecount` = {$row['online_pagecount']}{$update_page} WHERE `online_ip` = '{$ip}' AND `online_user_id` = '0'"; } $sql->update('online', $query); } else { // New visitor $sql->insert('online', $insert_query); } } if ($user->isAdmin() || e107::getPref('autoban') != 1 && e107::getPref('autoban') != 2 || !isset($row['online_pagecount'])) { $row['online_pagecount'] = 1; } // Always allow localhost - any problems are usually semi-intentional! if (varset($row['online_ip']) != '127.0.0.1' && varset($row['online_ip']) != e107::LOCALHOST_IP && varset($row['online_ip']) != e107::LOCALHOST_IP2) { // Check for excessive access if ($row['online_pagecount'] > $online_bancount) { e107::lan('core', 'banlist', true); //e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php' $reason = e107::getParser()->lanVars(BANLAN_78, $row['online_pagecount']); // str_replace('--HITS--',$row['online_pagecount'], BANLAN_78) if (true === e107::getIPHandler()->add_ban(2, $reason, $ip, 0)) { e107::getEvent()->trigger('flood', $ip); //BC e107::getEvent()->trigger('user_ban_flood', $ip); exit; } } elseif ($row['online_pagecount'] >= $online_warncount) { echo "<div style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>" . LAN_WARNING . "</b><br /><br />" . CORE_LAN6 . "<br /></div>"; exit; } } // Delete records for users (and guests) not seen for a while // FIXME - DB optimization - mark records as deleted (online_deleted=1), delete once per hour (could be pref) via e_cron // FIXME - Additional prefs for this (it does 2-3 more queries no matter someone need them), could be also separate method // Speed up ajax requests if (!deftrue('e_AJAX_REQUEST')) { $sql->delete('online', '`online_timestamp` < ' . (time() - $online_timeout)); // FIXME - don't use constants below, save data in class vars, call e_online signleton - e107::getOnline() // $total_online = $sql->db_Count('online'); // 1 less query! :-) if ($total_online = $sql->gen('SELECT o.*,u.user_image FROM #online AS o LEFT JOIN #user AS u ON o.online_user_id = u.user_id WHERE o.online_pagecount > 0 ORDER BY o.online_timestamp DESC')) { $member_list = ''; $members_online = 0; $listuserson = array(); while ($row = $sql->fetch()) { $row['online_bot'] = $this->isBot($row['online_agent']); // Sort into usable format and add bot field. $user = array('user_location' => $row['online_location'], 'user_bot' => $this->isBot($row['online_agent']), 'user_agent' => $row['online_agent'], 'user_ip' => $row['online_ip'], 'user_currentvisit' => $row['online_timestamp'], 'user_online' => $row['online_flag'], 'user_pagecount' => $row['online_pagecount'], 'user_active' => $row['online_active'], 'user_image' => vartrue($row['user_image'], false), 'online_user_id' => $row['online_user_id'], 'user_language' => $row['online_language']); if ($row['online_user_id'] != 0) { $vals = explode('.', $row['online_user_id'], 2); $user['user_id'] = $vals[0]; $user['user_name'] = $vals[1]; $member_list .= "<a href='" . SITEURL . "user.php?id.{$vals[0]}'>{$vals[1]}</a> "; $listuserson[$row['online_user_id']] = $row['online_location']; $this->users[] = $user; $members_online++; } else { $user['user_id'] = 0; $user['user_name'] = 'guest'; // Maybe should just be an empty string? $this->guests[] = $user; } } } define('TOTAL_ONLINE', $total_online); define('MEMBERS_ONLINE', $members_online); define('GUESTS_ONLINE', $total_online - $members_online); define('ON_PAGE', $sql->db_Count('online', '(*)', "WHERE `online_location` = '{$page}' ")); define('MEMBER_LIST', $member_list); //update most ever online $olCountPrefs = e107::getConfig('history'); // Get historic counts of members on line $olCountPrefs->setParam('nologs', true); if ($total_online > $olCountPrefs->get('most_members_online') + $olCountPrefs->get('most_guests_online')) { $olCountPrefs->set('most_members_online', MEMBERS_ONLINE); $olCountPrefs->set('most_guests_online', GUESTS_ONLINE); $olCountPrefs->set('most_online_datestamp', time()); $olCountPrefs->save(false, true, false); } } } else { define('e_TRACKING_DISABLED', true); // Used in forum, online menu define('TOTAL_ONLINE', ''); define('MEMBERS_ONLINE', ''); define('GUESTS_ONLINE', ''); define('ON_PAGE', ''); define('MEMBER_LIST', ''); } }
function pageIndex() { // Use always nextprev shortcode (with a special default 'page' tempalte) $titles = implode("|", $this->pageTitles); $total_items = count($this->pageTitles); //$parms = $total_items.",1,".$this->pageSelected.",".e_SELF."?".$this->pageID.".[FROM],,$titles"; $row = $this->page; $row['page'] = '--FROM--'; $url = rawurlencode(e107::getUrl()->create('page/view', $row, 'allow=page_id,page_title,page_sef,page')); $parms = 'nonavcount&bullet=' . rawurlencode($this->bullet . ' ') . '&caption=<!-- Empty -->&' . 'pagetitle=' . rawurlencode($titles) . '&tmpl_prefix=' . deftrue('PAGE_NEXTPREV_TMPL', 'page') . '&total=' . $total_items . '&amount=1¤t=' . $this->pageSelected . '&url=' . $url; $itext = $total_items ? e107::getParser()->parseTemplate("{NEXTPREV={$parms}}") : ""; return $itext; }
/** * Core NEXTPREV shortcode * Comma separated parameters are now deprecated. * Parameter string should be formatted as if it were the query string passed via a URL: * <code>$parm = 'total=10&amount=5¤t=0&type=...'</code> * * Parameter list: * - total (integer) [required]: total records/pages * - amount (integer| string 'all') [required]: Records per page, always 1 when we counting pages (see 'type' parameter), ignored where tmpl_prefix is not set and 'old_np' pref is false * - current (integer)[required]: Current record/page * - type (string page|record) [optional]: What kind of navigation logic we need, default is 'record' (the old way) * * - url (rawurlencode'd string) [required]: URL template, will be rawurldecode'd after parameters are parsed to array, '--AMP--' strings will be replaced with '&' * NOTE: URL should be DOUBLE encoded, which means you need to encode the query only of passed URL (W3C standards) and rawurlencode the whole URL string * The reason to do this is to not break the whole shortcode $parm string, shortcode itself is doing decode once, which means we'll end up with correct, W3C compliant URL string * 'url' now supports url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 and route::news/list/category::id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 formats * * Preffered 'FROM' template is now '--FROM--' (instead '[FROM]') * - caption (rawurlencode'd string) [optional]: Label, rawurldecode'd after parameters are parsed to array, language constants are supported * - pagetitle (rawurlencode'd string) [optional]: Page labels, rawurldecode'd after parameters are parsed to array, * separated by '|', if present they will be used as lablels instead page numbers; language constants are supported * - plugin (string) [optional]: plugin name used for template loading * - tmpl_prefix (string) [optional]: template keys prefix; core supported are 'default' and 'dropdown', default depends on 'old_np' pref * - navcount (integer) [optional]: number of navigation items to be shown, minimal allowed value is 4, default is 10 * - nonavcount (no value) [optional]: if is set it'll disable navigation counting (navcount will be ignored) * - bullet (string) [optional]: currently it should contain the markup to be prepended to the navigation item title * * WARNING: You have to do rawuldecode() on url, caption and title parameter values (before passing them to the shortcode) * or you'll break the whole script * * TODO - add create URL support when new URL handler is ready * * @param string $parm * @return string page navigation bar HTML */ function nextprev_shortcode($parm = '') { $e107 = e107::getInstance(); $pref = e107::getPref(); $tp = e107::getParser(); e107::coreLan('np'); /** * The NEW way. * New parameter requirements formatted as a GET string. * Template support. */ if (strpos($parm, 'total=') !== false) { parse_str($parm, $parm); // Calculate $total_items = intval($parm['total']); $check_render = true; if (vartrue($parm['glyphs']) && deftrue('BOOTSTRAP')) { $LAN_NP_FIRST = $tp->toGlyph("icon-fast-backward.glyph", false); $LAN_NP_PREVIOUS = $tp->toGlyph("icon-backward.glyph", false); $LAN_NP_NEXT = $tp->toGlyph("icon-forward.glyph", false); $LAN_NP_LAST = $tp->toGlyph("icon-fast-forward", false); } else { $LAN_NP_FIRST = LAN_NP_FIRST; $LAN_NP_PREVIOUS = LAN_NP_PREVIOUS; $LAN_NP_NEXT = LAN_NP_NEXT; $LAN_NP_LAST = LAN_NP_LAST; } // search for template keys - default_start, default_end etc. if (isset($parm['tmpl_prefix'])) { // forced $tprefix = vartrue($parm['tmpl_prefix'], 'default'); //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items; } elseif (isset($parm['tmpl'])) { // forced $tprefix = vartrue($parm['tmpl'], 'default'); //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items; } elseif ($pref['old_np']) { $tprefix = 'default'; //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items; } else { $tprefix = 'dropdown'; //$parm['amount'] = 'all'; } if ($tprefix == 'default' && deftrue('BOOTSTRAP')) { $tprefix = 'bootstrap'; } $tprefix .= '_'; if ($parm['amount'] === 'all') { $perpage = 1; // amount is ignored $check_render = $total_items > 1; } else { $perpage = intval($parm['amount']); } if (!$check_render) { return ''; } // TODO - rename old_np to something more meaningful $current_start = intval($parm['current']); $nptype = varset($parm['type'], 'record'); switch ($nptype) { case 'page': $perpage = 1; $current_page = $current_start; $first_page = 1; $next_page = $current_page + 1; $prev_page = $current_page - 1; $total_pages = $last_page = $total_items; $index_add = 1; break; default: $total_pages = ceil($total_items / $perpage); $last_page = ceil($total_pages * $perpage) - $perpage; $current_page = $current_start / $perpage + 1; $next_page = $current_page * $perpage; $prev_page = $current_start - $perpage; $first_page = 0; $index_add = 0; break; } if ($total_pages <= 1) { return ''; } // urldecoded once by parse_str() if (substr($parm['url'], 0, 7) == 'route::') { // New - use URL assembling engine // Format is: route::module/controller/action::urlParams::urlOptions // Example: route::news/list/category::id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 // WARNING - url parameter string have to be rawurlencode-ed BEFORE passed to the shortcode, or it'll break everything $urlParms = explode('::', str_replace('--AMP--', '&', $parm['url'])); $url = str_replace('--FROM--', '[FROM]', $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3]))); } elseif (substr($parm['url'], 0, 5) == 'url::') { // New - use URL assembling engine // Format is: url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 // WARNING - url parameter string have to be rawurlencode-ed BEFORE passed to the shortcode, or it'll break everything $urlParms = explode('::', str_replace('--AMP--', '&', $parm['url'])); $url = str_replace('--FROM--', '[FROM]', $e107->url->create($urlParms[1], array(), varset($urlParms[2]))); } else { $url = str_replace(array('--FROM--', '--AMP--'), array('[FROM]', '&'), $parm['url']); } // Simple parser vars $e_vars = new e_vars(array('total_pages' => $total_pages, 'current_page' => $current_page)); // urldecoded by parse_str() if (!varset($parm['caption'])) { $e_vars->caption = 'LAN_NP_CAPTION'; } // Advanced multilingual support: 'Page [x] of [y]' -> match the exact argument, result would be 'Page 1 of 20' $e_vars->caption = $tp->lanVars(defset($e_vars->caption, $e_vars->caption), array('x' => $current_page, 'y' => $total_pages)); // sprintXX(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages); // urldecoded by parse_str() $pagetitle = explode('|', vartrue($parm['pagetitle'])); // new - bullet support $bullet = vartrue($parm['bullet'], ''); // no navigation counter if (isset($parm['nonavcount'])) { $navcount = $total_pages; $navmid = 0; } else { // navigation number settings $navcount = abs(intval(vartrue($parm['navcount'], 10))); // prevent infinite loop! if ($navcount < 4) { $navcount = 4; } $navmid = floor($navcount / 2); } // get template - nextprev_template.php, support for plugin template locations - myplug/templates/nextprev_template.php $tmpl = e107::getTemplate(varset($parm['plugin'], null), 'nextprev'); // init advanced navigation visibility $show_first = $show_prev = $current_page != 1; $show_last = $show_next = $current_page != $total_pages; // Render // Parse via simpleParse() $tp = e107::getParser(); // Nextprev navigation start $ret = $tp->simpleParse($tmpl[$tprefix . 'start'], $e_vars); // caption, e.g. 'Page 1 of 20' box if ($e_vars->caption) { $ret .= $tp->simpleParse($tmpl[$tprefix . 'nav_caption'], $e_vars); } $ret_array = array(); // Show from 1 to $navcount || $total_pages if ($current_page <= $navmid || $total_pages <= $navcount) { $loop_start = 0; $loop_end = $navcount; $show_first = false; if ($navcount >= $total_pages) { $loop_end = $total_pages; $show_last = false; } } else { if ($current_page + $navmid >= $total_pages) { $loop_start = $total_pages - $navcount; if ($loop_start < 0) { $loop_start = 0; } $loop_end = $total_pages; $show_last = false; } else { $loop_start = $current_page - $navmid; $loop_end = $current_page + ($navcount - $navmid); // odd/even $navcount support if ($loop_start < 0) { $loop_start = 0; } elseif ($loop_end > $total_pages) { $loop_end = $total_pages; $show_last = false; } } } // Add 'first', 'previous' navigation if ($show_prev) { if ($show_first && !empty($tmpl[$tprefix . 'nav_first'])) { $e_vars->url = str_replace('[FROM]', $first_page, $url); $e_vars->label = $LAN_NP_FIRST; $e_vars->url_label = LAN_NP_URLFIRST; $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_first'], $e_vars); } if (!empty($tmpl[$tprefix . 'nav_prev'])) { $e_vars->url = str_replace('[FROM]', $prev_page, $url); $e_vars->label = $LAN_NP_PREVIOUS; $e_vars->url_label = LAN_NP_URLPREVIOUS; $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_prev'], $e_vars); } } $e_vars_loop = new e_vars(); $e_vars_loop->bullet = stripslashes($bullet); // fix magicquotes $ret_items = array(); for ($c = $loop_start; $c < $loop_end; $c++) { $label = ''; if (varset($pagetitle[$c])) { $label = defset($pagetitle[$c], $pagetitle[$c]); } $e_vars_loop->url = str_replace('[FROM]', $perpage * ($c + $index_add), $url); $e_vars_loop->label = $label ? $tp->toHTML(stripslashes($label), false, 'TITLE') : $c + 1; //quick fix servers with magicquotes - stripslashes() if ($c + 1 == $current_page) { $e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_URLCURRENT; $ret_items[] = $tp->simpleParse($tmpl[$tprefix . 'item_current'], $e_vars_loop); } else { $e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_GOTO; $e_vars_loop->url_label = str_replace("[x]", $c + 1, $e_vars_loop->url_label); $ret_items[] = $tp->simpleParse($tmpl[$tprefix . 'item'], $e_vars_loop); } } $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'items_start'], $e_vars) . implode($tmpl[$tprefix . 'separator'], $ret_items) . $tp->simpleParse($tmpl[$tprefix . 'items_end'], $e_vars); unset($ret_items, $e_vars_loop); if ($show_next) { if (!empty($tmpl[$tprefix . 'nav_next'])) { $e_vars->url = str_replace('[FROM]', $next_page, $url); $e_vars->label = $LAN_NP_NEXT; $e_vars->url_label = LAN_NP_URLNEXT; $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_next'], $e_vars); } if ($show_last && !empty($tmpl[$tprefix . 'nav_last'])) { $e_vars->url = str_replace('[FROM]', $last_page, $url); //$last_page $e_vars->label = $LAN_NP_LAST; $e_vars->url_label = LAN_NP_URLLAST; $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_last'], $e_vars); } } $ret .= implode($tmpl[$tprefix . 'separator'], $ret_array); // Nextprev navigation end $ret .= $tp->simpleParse($tmpl[$tprefix . 'end'], $e_vars); unset($e_vars, $ret_array); return $ret; } else { $parm_count = substr_count($parm, ','); while ($parm_count < 5) { $parm .= ','; $parm_count++; } $p = explode(',', $parm, 6); $total_items = intval($p[0]); $perpage = intval($p[1]); // page number instead record start now supported if (is_numeric($p[2])) { $current_start = intval($p[2]); $current_page = $current_start / $perpage + 1; $total_pages = ceil($total_items / $perpage); $index_add = 0; } else { $perpage = 1; $current_start = intval(array_pop(explode(':', $p[2], 2))); $current_page = $current_start; $total_pages = $total_items; $index_add = 1; } if ($total_items < $perpage) { return ''; } $url = trim($p[3]); $caption = trim($p[4]); $pagetitle = explode('|', trim($p[5])); $caption = !$caption || $caption == 'off' ? LAN_GOPAGE . ' ' : $caption; while (substr($url, -1) == '.') { $url = substr($url, 0, -1); } } if ($total_pages > 1) { if (vartrue($pref['old_np'])) { $NP_PRE_ACTIVE = ''; $NP_POST_ACTIVE = ''; $NP_STYLE = ''; if (!defined('NEXTPREV_NOSTYLE') || NEXTPREV_NOSTYLE == FALSE) { $NP_PRE_ACTIVE = '['; $NP_POST_ACTIVE = '] '; $NP_STYLE = "style='text-decoration:underline'"; } // Use OLD nextprev method $nppage = ''; $nppage .= "\n\n<!-- Start of Next/Prev -->\n\n"; if ($total_pages > 10) { //$current_page = ($current_start/$perpage)+1; for ($c = 0; $c <= 2; $c++) { if ($perpage * ($c + $index_add) == $current_start) { $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n"; } else { $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url); $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n"; } } if ($current_page >= 3 && $current_page <= 5) { for ($c = 3; $c <= $current_page; $c++) { if ($perpage * ($c + $index_add) == $current_start) { $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n"; } else { $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url); $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n"; } } } else { if ($current_page >= 6 && $current_page <= $total_pages - 5) { $nppage .= " ... "; for ($c = $current_page - 2; $c <= $current_page; $c++) { if ($perpage * ($c + $index_add) == $current_start) { $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n"; } else { $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url); $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n"; } } } } $nppage .= " ... "; if ($current_page + 5 > $total_pages && $current_page != $total_pages) { $tmp = $current_page - 2; } else { $tmp = $total_pages - 3; } for ($c = $tmp; $c <= $total_pages - 1; $c++) { if ($perpage * ($c + $index_add) == $current_start) { $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n"; } else { $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url); $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n"; } } } else { for ($c = 0; $c < $total_pages; $c++) { if ($perpage * ($c + $index_add) == $current_start) { $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n"; } else { $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url); $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n"; } } } $nppage .= "\n\n<!-- End of Next/Prev -->\n\n"; return $caption . $nppage; } // Use NEW nextprev method $np_parm['template'] = "<span class='form-group form-inline'>[PREV] [DROPDOWN] [NEXT]<span>"; $np_parms['prev'] = ' << '; $np_parms['next'] = ' >> '; $np_parms['np_class'] = 'tbox npbutton btn btn-default'; $np_parms['dropdown_class'] = 'tbox npdropdown form-control'; $caption = ''; // legacy has no caption. if ($cached_parms = getcachedvars('nextprev')) { $tmp = $cached_parms; foreach ($tmp as $key => $val) { $np_parms[$key] = $val; } } $prev = ''; $next = ''; if ($current_page > 1) { $prevstart = $current_start - $perpage; if (substr($url, 0, 5) == 'url::') { $urlParms = explode('::', $url); $urlParms[2] = str_replace('[FROM]', $prevstart, $urlParms[2]); $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3])); } else { $link = str_replace('[FROM]', $prevstart, $url); } $prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>"; } if ($current_page < $total_pages) { $nextstart = $current_start + $perpage; if (substr($url, 0, 5) == 'url::') { $urlParms = explode('::', $url); $urlParms[2] = str_replace('[FROM]', $nextstart, $urlParms[2]); $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3])); } else { $link = str_replace('[FROM]', $nextstart, $url); } $next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>"; } $dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>"; for ($i = 1; $i <= $total_pages; $i++) { $sel = ''; if ($current_page == $i) { $sel = " selected='selected' "; } $newstart = ($i - 1 + $index_add) * $perpage; if (substr($url, 0, 5) == 'url::') { $urlParms = explode('::', $url); $urlParms[2] = str_replace('[FROM]', $newstart, $urlParms[2]); $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3])); } else { $link = str_replace('[FROM]', $newstart, $url); } $c = $i - 1 + $index_add; $title = isset($pagetitle[$c]) && $pagetitle[$c] ? $pagetitle[$c] : $i; $dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n"; } $dropdown .= '</select>'; $ret = $np_parm['template']; // Set default if (isset($np_parms['template']) && $np_parms['template']) { $ret = $np_parms['template']; // Use override } $ret = str_replace('[DROPDOWN]', $dropdown, $ret); $ret = str_replace('[PREV]', $prev, $ret); $ret = str_replace('[NEXT]', $next, $ret); return $caption . $ret; } }
function user_extended_edit($struct, $curval) { $tp = e107::getParser(); $frm = e107::getForm(); if (trim($curval) == "" && $struct['user_extended_struct_default'] != "") { $curval = $struct['user_extended_struct_default']; } $choices = explode(",", $struct['user_extended_struct_values']); foreach ($choices as $k => $v) { $choices[$k] = str_replace("[E_COMMA]", ",", $v); } $parms = explode("^,^", $struct['user_extended_struct_parms']); $include = preg_replace("/\n/", " ", $tp->toHtml($parms[0])); $regex = $tp->toText($parms[1]); $regexfail = $tp->toText($parms[2]); $fname = "ue[user_" . $struct['user_extended_struct_name'] . "]"; $required = vartrue($struct['user_extended_struct_required']) == 1 ? "required" : ""; $fid = $frm->name2id($fname); if (strpos($include, 'class') === FALSE) { $include .= " class='form-control tbox' "; } switch ($struct['user_extended_struct_type']) { case EUF_TEXT: //textbox //textbox case EUF_INTEGER: //integer $ret = "<input id='{$fid}' type='text' name='{$fname}' value='{$curval}' {$include} {$required} />"; return $ret; break; case EUF_RADIO: //radio $ret = ''; foreach ($choices as $choice) { $choice = trim($choice); if (strpos($choice, "|") !== FALSE) { list($val, $label) = explode("|", $choice); } elseif (strpos($choice, " => ") !== FALSE) { list($val, $label) = explode(" => ", $choice); } else { $val = $choice; $label = $choice; } $label = deftrue($label, $label); if (deftrue('BOOTSTRAP')) { $ret .= $frm->radio($fname, $val, $curval == $val, array('label' => $label, 'required' => $struct['user_extended_struct_required'])); } else { $chk = $curval == $val ? " checked='checked' " : ""; $ret .= "<input id='{$fid}' {$include} type='radio' name='{$fname}' value='{$val}' {$chk} {$required} /> {$label}"; } } return $ret; break; case EUF_CHECKBOX: //checkboxes foreach ($choices as $choice) { $choice = trim($choice); if (strpos($choice, "|") !== FALSE) { list($val, $label) = explode("|", $choice); } elseif (strpos($choice, " => ") !== FALSE) { list($val, $label) = explode(" => ", $choice); } else { $val = $choice; $label = $choice; } $label = deftrue($label, $label); if (deftrue('BOOTSTRAP')) { $ret .= $frm->checkbox($fname, $val, $curval == $val, array('label' => $label, 'required' => $struct['user_extended_struct_required'])); } else { $chk = $curval == $val ? " checked='checked' " : ""; $ret .= "<input {$include} type='checkbox' name='{$fname}[]' value='{$val}' {$chk} /> {$label}<br />"; } } return $ret; break; case EUF_DROPDOWN: //dropdown $ret = "<select {$include} id='{$fid}' name='{$fname}' {$required} >\n"; $ret .= "<option value=''> </option>\n"; // ensures that the user chose it. foreach ($choices as $choice) { $choice = trim($choice); $choice = deftrue($choice, $choice); $sel = $curval == $choice ? " selected='selected' " : ""; $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n"; } $ret .= "</select>\n"; return $ret; break; case EUF_PREDEFINED: // predefined list, shown in dropdown $listRoot = trim($struct['user_extended_struct_values']); // Base list name $filename = e_CORE . 'sql/extended_' . $listRoot . '.php'; if (!is_readable($filename)) { return 'No file: ' . $filename; } require_once $filename; $className = 'extended_' . $listRoot; if (!class_exists($className)) { return '?????'; } $temp = new $className(); if (!method_exists($className, 'getValue')) { return '???-???'; } $temp->pointerReset(); $ret = "<select id='{$fid}' {$include} name='{$fname}' {$required} >\n"; $ret .= "<option value=''> </option>\n"; // ensures that the user chooses it. while (FALSE !== ($row = $temp->getValue(0, 'next'))) { $val = key($row); $choice = $temp->getValue($val, 'display'); $sel = $curval == $val ? " selected='selected' " : ''; $ret .= "<option value='{$val}' {$sel}>{$choice}</option>\n"; } $ret .= "</select>\n"; return $ret; case EUF_DB_FIELD: //db_field $sql = e107::getDb('ue'); $order = $choices[3] ? "ORDER BY " . $tp->toDB($choices[3], true) : ""; if ($sql->select($tp->toDB($choices[0], true), $tp->toDB($choices[1], true) . "," . $tp->toDB($choices[2], true), "1 {$order}")) { $choiceList = $sql->db_getList('ALL', FALSE); $ret = "<select id='{$fid}' {$include} name='{$fname}' {$required} >\n"; $ret .= "<option value=''> </option>\n"; // ensures that the user chose it. foreach ($choiceList as $cArray) { $cID = trim($cArray[$choices[1]]); $cText = trim($cArray[$choices[2]]); $sel = $curval == $cID ? " selected='selected' " : ""; $ret .= "<option value='{$cID}' {$sel}>{$cText}</option>\n"; } $ret .= "</select>\n"; return $ret; } else { return ""; } break; case EUF_TEXTAREA: //textarea return "<textarea id='{$fid}' {$include} name='{$fname}' {$required} >{$curval}</textarea>"; break; case EUF_DATE: //date if ($curval == '0000-00-00') { $curval = ''; } return e107::getForm()->datepicker($fname, $curval, 'format=yyyy-mm-dd'); break; case EUF_LANGUAGE: // language $lanlist = e107::getLanguage()->installed(); sort($lanlist); $ret = "<select {$include} id='{$fid}' name='{$fname}' {$required} >\n"; $ret .= "<option value=''> </option>\n"; // ensures that the user chose it. foreach ($lanlist as $choice) { $choice = trim($choice); $sel = $curval == $choice || !USER && $choice == e_LANGUAGE ? " selected='selected' " : ""; $ret .= "<option value='{$choice}' {$sel}>{$choice}</option>\n"; } $ret .= "</select>\n"; break; } return $ret; }
function generateBar($perc) { if (deftrue('BOOTSTRAP', false)) { $val = intval($perc); return ' <div class="progress"> <div class="bar progress-bar" role="progressbar" aria-valuenow="' . $val . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $val . '%;"> <span class="sr-only">' . $val . '%</span> </div> </div>'; } else { $barl = $this->barl; $barr = $this->barr; $bar = $this->bar; return $perc ? "<div style='width: 100%'><div style='background-image: url({$barl}); width: 5px; height: 14px; float: left;'></div><div style='background-image: url({$bar}); width: " . min(intval($perc), 90) . "%; height: 14px; float: left;'></div><div style='background-image: url({$barr}); width: 5px; height: 14px; float: left;'></div></div>" : ""; } }
function renderCreateButtonsBar($id, $fdata, $model, $tab = 0) { /* $text = vartrue($fdata['fieldset_pre'])." <fieldset id='{$id}'> <legend>".vartrue($fdata['legend'])."</legend> ".vartrue($fdata['table_pre'])." <table class='table adminform'> <colgroup> <col class='col-label' /> <col class='col-control' /> </colgroup> <tbody> "; */ $text = ''; // required fields - model definition $model_required = $model->getValidationRules(); $required_help = false; $hidden_fields = array(); foreach ($fdata['fields'] as $key => $att) { if ($tab !== false && varset($att['tab'], 0) !== $tab) { continue; } // convert aliases - not supported in edit mod if (vartrue($att['alias']) && !$model->hasData($key)) { $key = $att['field']; } if ($key == 'checkboxes' || $key == 'options') { continue; } $parms = vartrue($att['formparms'], array()); if (!is_array($parms)) { parse_str($parms, $parms); } $label = vartrue($att['note']) ? '<div class="label-note">' . deftrue($att['note'], $att['note']) . '</div>' : ''; $help = vartrue($att['help']) ? '<div class="field-help">' . deftrue($att['help'], $att['help']) . '</div>' : ''; $valPath = trim(vartrue($att['dataPath'], $key), '/'); $keyName = $key; if (strpos($valPath, '/')) { $tmp = explode('/', $valPath); $keyName = array_shift($tmp); foreach ($tmp as $path) { $keyName .= '[' . $path . ']'; } } if ('hidden' === $att['type']) { if (!is_array($att['writeParms'])) { parse_str(varset($att['writeParms']), $tmp); } else { $tmp = $att['writeParms']; } if (!vartrue($tmp['show'])) { $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId()); unset($tmp); continue; } unset($tmp); } // type null - system (special) fields if (vartrue($att['type']) !== null && !vartrue($att['noedit']) && $key != $model->getFieldIdName()) { $required = ''; $required_class = ''; if (isset($model_required[$key]) || vartrue($att['validate'])) { $required = $this->getRequiredString(); $required_class = ' class="required-label"'; // TODO - add 'required-label' to the core CSS definitions $required_help = true; if (vartrue($att['validate'])) { // override $model_required[$key] = array(); $model_required[$key][] = true === $att['validate'] ? 'required' : $att['validate']; $model_required[$key][] = varset($att['rule']); $model_required[$key][] = $att['title']; $model_required[$key][] = varset($att['error']); } } /* $text .= " <tr> <td> ".$required."<span{$required_class}>".defset(vartrue($att['title']), vartrue($att['title']))."</span>".$label." </td> <td> ".$this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()))." {$help} </td> </tr> "; * */ } //if($bckp) $model->remove($bckp); } if ($required_help) { // $required_help = '<div class="form-note">'.$this->getRequiredString().' - required fields</div>'; //TODO - lans } // $text .= " // </tbody> // </table></fieldset>"; $text .= "\r\n\t\t\t\t" . implode("\n", $hidden_fields) . "\r\n\t\t\t\t" . vartrue($fdata['table_post']) . "\r\n\t\t\t\t<div class='buttons-bar center'>\r\n\t\t"; // After submit options $defsubmitopt = array('list' => 'go to list', 'create' => 'create another', 'edit' => 'edit current'); $submitopt = isset($fdata['after_submit_options']) ? $fdata['after_submit_options'] : true; if (true === $submitopt) { $submitopt = $defsubmitopt; } if ($submitopt) { $selected = isset($fdata['after_submit_default']) && array_key_exists($fdata['after_submit_default'], $submitopt) ? $fdata['after_submit_default'] : ''; } $triggers = vartrue($fdata['triggers'], 'auto'); if (is_string($triggers) && 'auto' === $triggers) { $triggers = array(); if ($model->getId()) { $triggers['submit'] = array(LAN_UPDATE, 'update', $model->getId()); } else { $triggers['submit'] = array(LAN_CREATE, 'create', 0); } $triggers['cancel'] = array(LAN_CANCEL, 'cancel'); } foreach ($triggers as $trigger => $tdata) { $text .= $trigger == 'submit' ? "<div class=' btn-group'>" : ""; $text .= $this->admin_button('etrigger_' . $trigger, $tdata[0], $tdata[1]); if ($trigger == 'submit' && $submitopt) { $text .= '<button class="btn btn-success dropdown-toggle left" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu col-selection"> <li class="dropdown-header nav-header">After submit:</li> '; foreach ($defsubmitopt as $k => $v) { $text .= "<li><a href='#' class='e-noclick'>" . $this->radio('__after_submit_action', $k, $selected == $k, "label=" . $v) . "</a></li>"; } //$text .= ' // <li role="menuitem"> // <div class="options left" style="padding:5px"> // '.$this->radio_multi('__after_submit_action', $submitopt, $selected, true).' // </div></li>'; $text .= '</ul>'; } $text .= $trigger == 'submit' ? "</div>" : ""; if (isset($tdata[2])) { $text .= $this->hidden($trigger . '_value', $tdata[2]); } } $text .= "\r\n\t\t\t\t</div>\r\n\t\t\t\r\n\t\t\t" . vartrue($fdata['fieldset_post']) . "\r\n\t\t"; return $text; }
if (file_exists(THEME . 'forum_design.php')) { include_once THEME . 'forum_design.php'; } if (!vartrue($FORUMSTART)) { if (file_exists(THEME . 'forum_viewtopic_template.php')) { require_once THEME . 'forum_viewtopic_template.php'; } elseif (file_exists(THEME . 'templates/forum/forum_viewtopic_template.php')) { require_once THEME . 'templates/forum/forum_viewtopic_template.php'; } elseif (file_exists(THEME . 'forum_template.php')) { require_once THEME . 'forum_template.php'; } else { require_once e_PLUGIN . 'forum/templates/forum_viewtopic_template.php'; } } // New in v2.x if (is_array($FORUM_VIEWTOPIC_TEMPLATE) && deftrue('BOOTSTRAP', false)) { $FORUMSTART = $FORUM_VIEWTOPIC_TEMPLATE['start']; $FORUMTHREADSTYLE = $FORUM_VIEWTOPIC_TEMPLATE['thread']; $FORUMEND = $FORUM_VIEWTOPIC_TEMPLATE['end']; $FORUMREPLYSTYLE = $FORUM_VIEWTOPIC_TEMPLATE['replies']; } //TODO Clean up this mess!! // get info for main thread ------------------------------------------------------------------------------------------------------------------------------------------------------------------- $tVars = new e_vars(); $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK) //$tVars->BREADCRUMB = $crumbs['breadcrumb']; //$tVars->BACKLINK = $tVars->BREADCRUMB; //$tVars->FORUM_CRUMB = $crumbs['forum_crumb']; $tVars->THREADNAME = $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'); $prev = $forum->threadGetNextPrev('prev', $thread->threadId, $thread->threadInfo['forum_id'], $thread->threadInfo['thread_lastpost']);
$year_selector .= ">" . $i . "</option>\n"; } $year_selector .= "</select>\n</div>"; // -------------------------- // create the archive display // -------------------------- $newline = 0; $archive = "<div style='text-align:center'>\n\t\t<table class='table' border='0' cellspacing='7'>\n\t\t<tr>"; $archive .= "<td colspan='{$months_per_row}'>{$year_selector}</td></tr><tr>"; for ($i = 1; $i <= 12; $i++) { if (++$newline == $months_per_row + 1) { $archive .= "</tr><tr>"; $newline = 1; } $archive .= "<td style='vertical-align:top'>"; if (!deftrue('BOOTSTRAP')) { $archive .= "<div class='fcaption' style='text-align:center; margin-bottom:2px;'>"; // href the current month regardless of newsposts or any month with news if ($req_year == $cur_year && $i == $cur_month || $day_links[$i]) { $archive .= "<a class='forumlink' href='" . e107::getUrl()->create('news/list/month', 'id=' . formatDate($req_year, $i)) . "'>" . $marray[$i - 1] . "</a>"; } else { $archive .= $marray[$i - 1]; } $archive .= "</div>"; } if ($req_year == $cur_year && $i == $cur_month) { $req_day = $cur_day; } else { $req_day = ""; } $archive .= "<div>" . calendar($req_day, $i, $req_year, $day_links[$i], $pref['blogcal_ws']) . "</div></td>\n";
*/ $eplug_admin = true; require_once '../../class2.php'; if (!getperms('P')) { header('location:' . e_BASE . 'index.php'); exit; } e107::includeLan(e_PLUGIN . 'forum/languages/' . e_LANGUAGE . '/English_admin.php'); e107::lan('forum', '', 'front'); $legacy = false; if (E107_DEBUG_LEVEL > 0 && $legacy == true) { define('OLD_FORUMADMIN', true); //e107::getMessage()->addwarning("Experimental code now active. Using this page in debug mode active could break your forum configuration."); } // Generated e107 Plugin Admin Area if (!deftrue('OLD_FORUMADMIN')) { class forum_admin extends e_admin_dispatcher { protected $modes = array('main' => array('controller' => 'forum_ui', 'path' => null, 'ui' => 'forum_form_ui', 'uipath' => null), 'mods' => array('controller' => 'forum_ui', 'path' => null, 'ui' => 'forum_form_ui', 'uipath' => null), 'report' => array('controller' => 'reported_ui', 'path' => null, 'ui' => 'reported_form_ui', 'uipath' => null), 'post' => array('controller' => 'post_ui', 'path' => null, 'ui' => 'post_form_ui', 'uipath' => null)); protected $adminMenu = array('main/list' => array('caption' => LAN_MANAGE, 'perm' => 'P'), 'main/create' => array('caption' => LAN_CREATE, 'perm' => 'P'), 'opt1' => array('divider' => true), 'main/rules' => array('caption' => WMGLAN_5, 'perm' => 'P'), 'mods/list' => array('caption' => LAN_FORUM_2003, 'perm' => 'P'), 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P'), 'opt2' => array('divider' => true), 'report/list' => array('caption' => FORLAN_116, 'perm' => 'P'), 'post/list' => array('caption' => "Latest Posts", 'perm' => 'P'), 'main/prune' => array('caption' => LAN_PRUNE, 'perm' => 'P'), 'main/tools' => array('caption' => FORLAN_153, 'perm' => 'p')); protected $adminMenuAliases = array('main/edit' => 'main/list'); protected $menuTitle = 'Forum'; function init() { if (E107_DEBUG_LEVEL > 0) { $this->adminMenu['opt3'] = array('divider' => true); $this->adminMenu['main/update'] = array('caption' => "Redo v1.x Forum Upgrade", 'perm' => 0, 'uri' => '{e_PLUGIN}forum/forum_update.php'); } } } class forum_ui extends e_admin_ui
/** * List the installed language packs. * @return */ function show_packs() { $frm = e107::getForm(); $ns = e107::getRender(); $tp = e107::getParser(); if (is_readable(e_ADMIN . "ver.php")) { include e_ADMIN . "ver.php"; list($ver, $tmp) = explode(" ", $e107info['e107_version']); } $lans = getLanList(); $release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date"; $compat_diz = defined("LANG_LAN_31") ? LANG_LAN_31 : "Compatibility"; $lan_pleasewait = deftrue('LAN_PLEASEWAIT') ? $tp->toJS(LAN_PLEASEWAIT) : "Please Wait"; $lan_displayerrors = deftrue('LANG_LAN_33') ? LANG_LAN_33 : "Display only errors during verification"; $text = "<form id='lancheck' method='post' action='" . e_SELF . "?tools'>\n\t\t\t<table class='table table-striped'>"; $text .= "<thead>\n\t\t<tr>\n\t\t<th>" . ADLAN_132 . "</th>\n\t\t<th>" . $release_diz . "</th>\t\t\n\t\t<th>" . $compat_diz . "</th>\n\t\t<th>" . LAN_STATUS . "</td>\n\t\t<th style='width:25%;white-space:nowrap'>" . LAN_OPTIONS . "</td>\n\t\t</tr>\n\t\t</thead>\n\t\t"; require_once e_HANDLER . "xml_class.php"; $xm = new XMLParse(); foreach ($lans as $language) { if ($language == "English") { continue; } $metaFile = e_LANGUAGEDIR . $language . "/" . $language . ".xml"; if (is_readable($metaFile)) { $rawData = file_get_contents($metaFile); if ($rawData) { $array = $xm->parse($rawData); $value = $array['e107Language']['attributes']; } else { $value = array('date' => " ", 'compatibility' => ' '); } } else { $value = array('date' => " ", 'compatibility' => ' '); } $errFound = isset($_SESSION['lancheck'][$language]['total']) && $_SESSION['lancheck'][$language]['total'] > 0 ? TRUE : FALSE; $text .= "<tr>\n\t\t\t<td >" . $language . "</td>\n\t\t\t<td>" . $value['date'] . "</td>\n\t\t\t<td>" . $value['compatibility'] . "</td>\n\t\t\t<td>" . ($ver != $value['compatibility'] || $errFound ? ADMIN_FALSE_ICON : ADMIN_TRUE_ICON) . "</td>\n\t\t\t<td><input type='submit' name='language_sel[{$language}]' value=\"" . LAN_CHECK_2 . "\" class='btn btn-primary' />\n\t\t\t<input type='submit' name='ziplang[{$language}]' value=\"" . LANG_LAN_23 . "\" class='button' onclick=\"this.value = '" . $lan_pleasewait . "'\" /></td>\t\n\t\t\t</tr>"; } $text .= "\n\t\t\n\t\t</tr></table>"; $text .= "<table class='table table-striped'>"; $text .= "<thead><tr><th>" . LAN_OPTIONS . "</th></tr></thead><tbody>"; $srch = array("[", "]"); $repl = array("<a rel='external' href='http://e107.org/content/About-Us:The-Team#translation-team'>", "</a>"); $diz = deftrue("LANG_LAN_28") ? LANG_LAN_28 : "Check this box if you're an [e107 certified translator]."; $checked = varset($_COOKIE['e107_certified']) == 1 ? true : false; $text .= "<tr><td>"; $text .= $frm->checkbox('contribute_pack', 1, $checked, array('label' => str_replace($srch, $repl, $diz))); $text .= "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td>"; $echecked = varset($_SESSION['lancheck-errors-only']) == 1 ? true : false; $text .= $frm->checkbox('errorsonly', 1, $echecked, array('label' => $lan_displayerrors)); $text .= " </td>\n\t\t\n\t\t</tr>"; // $text .= " // <tr> // <td>".$frm->checkbox('non-core-plugs-themes',1,$echecked,array('label'=>$lan_displayerrors))."</td> // </tr> // "; $text .= "</tbody></table>"; $text .= "</form>"; $text .= "<div class='smalltext center' style='padding-top:50px'>" . LANG_LAN_AGR . "</div>"; $ns->tablerender(ADLAN_132 . SEP . LANG_LAN_32, $text); return; }
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); }
function doReplace($matches) { if (defined($matches[1]) && (deftrue('ADMIN') || strpos($matches[1], 'ADMIN') === FALSE)) { return constant($matches[1]); } return $matches[1]; }
private function renderLanguageTableInfo() { $text = ''; if (e107::getConfig()->get('multilanguage')) { $curTable = $this->getController()->getTableName(); $sitelanguage = e107::getConfig()->get('sitelanguage'); if ($curTable != e107::getDb()->db_IsLang($curTable)) { $lang = e107::getDb()->mySQLlanguage; } else { $lang = $sitelanguage; } $def = deftrue('LAN_UI_USING_DATABASE_TABLE', 'Using [x] database table'); $diz = e107::getParser()->lanVars($def, $lang); // "Using ".$lang." database table"; $class = $sitelanguage == $lang ? "default" : ""; $text = "<span class='adminui-language-table-info " . $class . " e-tip' title=\"" . $diz . "\">"; $text .= e107::getParser()->toGlyph('fa-hdd-o'); // '<i class="icon-hdd"></i> '; $text .= e107::getLanguage()->toNative($lang) . "</span>"; return $text; } return false; }
} $newpostday = $thispostday; $news['category_id'] = $news['news_category']; if ($action == "item") { unset($news['news_render_type']); } // $template = false; $ix->render_newsitem($news, 'default', '', $template, $param); $i++; } $amount = ITEMVIEW; $nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount=' . NEWS_NEXTPREV_NAVCOUNT : ''; $url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms)); // Example of passing route data instead building the URL outside the shortcode - for a reference only // $url = rawurlencode('url::'.$newsRoute.'::'.http_build_query($newsUrlparms, null, '&')); $parms = 'tmpl_prefix=' . deftrue('NEWS_NEXTPREV_TMPL', 'default') . '&total=' . $news_total . '&amount=' . $amount . '¤t=' . $newsfrom . $nitems . '&url=' . $url; echo $tp->parseTemplate("{NEXTPREV={$parms}}"); // $parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]"; // $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}"); // echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : ""); $cache_data = ob_get_clean(); require_once HEADERF; echo $cache_data; setNewsCache($cacheString, $cache_data); } // ##### -------------------------------------------------------------------------------------------------------------- function show_newsarchive($newsAr, $i = 1) { global $ns, $gen, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2; // do not show the news archive on the news.php?item.X page (but only on the news mainpage) require_once e_CORE . 'shortcodes/batch/news_archives.php';
// $LOGIN_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />"; // } // $LOGIN_TABLE_AUTOLOGIN = "******"; // $LOGIN_TABLE_AUTOLOGIN_LAN = LAN_LOGIN_8; // $LOGIN_TABLE_SUBMIT = "<input class='btn btn-primary button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />"; if (!isset($LOGIN_TABLE) || !$LOGIN_TABLE) { if (file_exists(THEME . 'templates/login_template.php')) { require_once THEME . 'templates/login_template.php'; } elseif (file_exists(THEME . 'login_template.php')) { require_once THEME . 'login_template.php'; } else { require_once e_CORE . "templates/login_template.php"; } } $sc = e107::getScBatch('login'); if (deftrue('BOOTSTRAP') && isset($LOGIN_TEMPLATE['page'])) { $LOGIN_TABLE_HEADER = $LOGIN_TEMPLATE['page']['header']; $LOGIN_TABLE = "<form class='form-signin' method='post' action='" . e_SELF . "' onsubmit='hashLoginPassword(this)' >" . $LOGIN_TEMPLATE['page']['body'] . "</form>"; $LOGIN_TABLE_FOOTER = $LOGIN_TEMPLATE['page']['footer']; } $text = $tp->parseTemplate($LOGIN_TABLE, true, $sc); // $text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE); if (getperms('0')) { echo "<div class='alert alert-block alert-error alert-danger center'> You are currently logged in.</div>"; } // echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER); $login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME; echo LOGINMESSAGE; echo $tp->parseTemplate($LOGIN_TABLE_HEADER, $sc); $ns->tablerender($login_message, $text, 'login_page');
echo "\tSyncWithServerTime('', '{$_serverPath}', '{$_serverDomain}');\n"; //tdOffset disabled as it can't live together with HTTP_IF_NONE_MATCH (page load speed) //echo " SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');\n"; echo "</script>\n"; } // // H Final HTML // // browser cache control - FIXME - use this value as AJAX requests cache control! // TODO - create the $bcache string via e107 class method, use it in the canCache() method $uclist = e107::getUser()->getClassList(); sort($uclist, SORT_NUMERIC); $bcache = (deftrue('e_NOCACHE') ? time() : e107::getPref('e_jslib_browser_cache')) . '.' . implode(',', $uclist); echo "\n<!-- " . md5($bcache) . " -->\n"; unset($uclist, $bcache); $show = deftrue('e_POWEREDBY_DISABLE') ? "none" : "block"; // Let search engines find us to increase e107.org ranking - even if hidden. //XXX Must not contain IDs or Classes // echo "<div style='text-align:center; display:".$show."; position: absolute; width:99%; height:20px; margin-top:-30px; z-index:30000; opacity:1.0; color: silver'>Proudly powered by <a style='color:silver' href='http://e107.org/' title='e107 Content Management System'>e107</a></div>"; unset($show); echo "\n</body>\n</html>"; // Shutdown $e107->destruct(); // // I Send the buffered page data, along with appropriate headers // $page = ob_get_clean(); // New - see class2.php $ehd = new e_http_header(); $ehd->setContent($page); $ehd->send();
function sc_extended($parm = '') { $class = vartrue($parm['class']) ? "class='" . $parm['class'] . "'" : ''; if ($this->news_item['news_extended'] && ($this->param['current_action'] != 'extend' || $parm == 'force')) { $es = defined('EXTENDEDSTRING') ? EXTENDEDSTRING : LAN_MORE; $es1 = defined('PRE_EXTENDEDSTRING') ? PRE_EXTENDEDSTRING : ''; $es2 = defined('POST_EXTENDEDSTRING') ? POST_EXTENDEDSTRING : ''; if (deftrue('ADMIN_AREA') && isset($_POST['preview'])) { return $es1 . $es . $es2 . "<br />" . $this->news_item['news_extended']; } else { return $es1 . "<a {$class} href='" . e107::getUrl()->create('news/view/item', $this->news_item) . "'>" . $es . "</a>" . $es2; } } return ''; }
function forum_rules($action = 'check') { if (ADMIN == true) { $type = 'forum_rules_admin'; } elseif (USER == true) { $type = 'forum_rules_member'; } else { $type = 'forum_rules_guest'; } $result = e107::getDb()->select('generic', 'gen_chardata', "gen_type = '{$type}' AND gen_intdata = 1"); if ($action == 'check') { return $result; } if ($result) { $row = e107::getDb()->fetch(); $rules_text = e107::getParser()->toHTML($row['gen_chardata'], true); } else { $rules_text = LAN_FORUM_0072; } $text = ''; if (deftrue('BOOTSTRAP')) { $breadarray = array(array('text' => e107::pref('forum', 'title', LAN_PLUGIN_FORUM_NAME), 'url' => e107::url('forum', 'index')), array('text' => LAN_FORUM_0016, 'url' => null)); $text = e107::getForm()->breadcrumb($breadarray); } $text .= "<div id='forum-rules'>" . $rules_text . "</div>"; $text .= "<div class='center'>" . e107::getForm()->pagination(e107::url('forum', 'index'), LAN_BACK) . "</div>"; e107::getRender()->tablerender(LAN_FORUM_0016, $text, array('forum', 'forum_rules')); }
function pluginUpgrade() { $pref = e107::getPref(); $admin_log = e107::getAdminLog(); $plugin = e107::getPlugin(); $sql = e107::getDb(); $mes = e107::getMessage(); $plug = $plugin->getinfo($this->id); $_path = e_PLUGIN . $plug['plugin_path'] . '/'; if (file_exists($_path . 'plugin.xml')) { $plugin->install_plugin_xml($this->id, 'upgrade'); } else { include e_PLUGIN . $plug['plugin_path'] . '/plugin.php'; $func = $eplug_folder . '_upgrade'; if (function_exists($func)) { $text .= call_user_func($func); } if (is_array($upgrade_alter_tables)) { $result = $plugin->manage_tables('upgrade', $upgrade_alter_tables); if (true !== $result) { //$text .= EPL_ADLAN_9.'<br />'; $mes->addWarning(EPL_ADLAN_9)->addDebug($result); } else { $text .= EPL_ADLAN_7 . "<br />"; } } if (is_array($upgrade_add_prefs)) { $plugin->manage_prefs('add', $upgrade_add_prefs); $text .= EPL_ADLAN_8 . '<br />'; } if (is_array($upgrade_remove_prefs)) { $plugin->manage_prefs('remove', $upgrade_remove_prefs); } if (is_array($upgrade_add_array_pref)) { foreach ($upgrade_add_array_pref as $key => $val) { $plugin->manage_plugin_prefs('add', $key, $eplug_folder, $val); } } if (is_array($upgrade_remove_array_pref)) { foreach ($upgrade_remove_array_pref as $key => $val) { $plugin->manage_plugin_prefs('remove', $key, $eplug_folder, $val); } } $plugin->manage_search('upgrade', $eplug_folder); $plugin->manage_notify('upgrade', $eplug_folder); $eplug_addons = $plugin->getAddons($eplug_folder); $info = $plugin->getinfo($this->id); $name = deftrue($info['plugin_name'], $info['plugin_name']) . " v" . $eplug_version . "({e_PLUGIN}" . $info['plugin_path'] . ")"; e107::getLog()->add('PLUGMAN_02', $name, E_LOG_INFORMATIVE, ''); $text .= isset($eplug_upgrade_done) ? '<br />' . $eplug_upgrade_done : "<br />" . LAN_UPGRADE_SUCCESSFUL; $sql->update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='{$this->id}' "); $pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version e107::getConfig('core')->setPref($pref); $plugin->rebuildUrlConfig(); e107::getConfig('core')->save(); } $mes->addSuccess($text); $plugin->save_addon_prefs('update'); }
/** * Register any shortcodes that were registered by the theme * $register_sc[] = 'MY_THEME_CODE' * * @return e_parse_shortcode */ protected function loadThemeShortcodes() { global $register_sc; // $this->registered_codes[$code]['type'] = 'plugin'; // $this->registered_codes[$code]['function'] = strtolower($code).'_shortcode'; // $this->registered_codes[$code]['path'] = e_PLUGIN.$path.'/shortcodes/single/'; // $this->registered_codes[$code]['perms'] = $uclass; if (deftrue('e_DEVELOPER')) { if (file_exists(THEME . "theme_shortcodes.php")) { $classFunc = 'theme_shortcodes'; $path = THEME . "theme_shortcodes.php"; include_once $path; $this->registerClassMethods($classFunc, $path, false); } } if (isset($register_sc) && is_array($register_sc)) { foreach ($register_sc as $code) { if (!$this->isRegistered($code)) { $code = strtoupper($code); $this->registered_codes[$code]['type'] = 'theme'; } } } return $this; }
// ob_end_clean(); unset($ret); } // [JSManager] Load JS Footer Includes by priority e107::getJs()->renderJs('footer', true); // [JSManager] Load JS Footer inline code by priority // // G final JS script keeps user and server time in sync. // It must be the last thing created before sending the page to the user. // // see e107.js and class2.php // This must be done as late as possible in page processing. $_serverTime = time(); $lastSet = isset($_COOKIE['e107_tdSetTime']) ? $_COOKIE['e107_tdSetTime'] : 0; $_serverPath = e_HTTP; $_serverDomain = deftrue('MULTILANG_SUBDOMAIN') ? '.' . e_DOMAIN : ''; if (abs($_serverTime - $lastSet) > 120) { /* update time delay every couple of minutes. * Benefit: account for user time corrections and changes in internet delays * Drawback: each update may cause all server times to display a bit different */ // echo "<script type='text/javascript'>\n"; // e107::js('footer-inline',"SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}');",'prototype'); //echo "SyncWithServerTime('{$_serverTime}', '{$_serverPath}', '{$_serverDomain}'); // </script>\n"; } e107::getJs()->renderJs('footer_inline', true); // // H Final HTML // echo "</body></html>";