function showImages($cat) { $mes = e107::getMessage(); $tp = e107::getParser(); $template = e107::getTemplate('gallery'); $template = array_change_key_case($template); $sc = e107::getScBatch('gallery', TRUE); if (defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) { $template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']); } $sc->total = e107::getMedia()->countImages($cat); $sc->amount = 12; // TODO Add Pref. amount per page. $sc->curCat = $cat; $sc->from = $_GET['frm'] ? intval($_GET['frm']) : 0; $list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount); $catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs'); $inner = ""; foreach ($list as $row) { $sc->setVars($row); $inner .= $tp->parseTemplate($template['list_item'], TRUE, $sc); } $text = $tp->parseTemplate($template['list_start'], TRUE, $sc); $text .= $inner; $text .= $tp->parseTemplate($template['list_end'], TRUE, $sc); e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text); }
/** * @return string * @param string $query * @desc Internal class function that returns the filename of a cache file based on the query. * @scope private * If the tag begins 'menu_', e_QUERY is not included in the hash which creates the file name */ function cache_fname($CacheTag, $syscache = false) { if (strpos($CacheTag, "nomd5_") === 0) { // Add 'nomd5' to indicate we are not calculating an md5 $CheckTag = '_nomd5'; } elseif (isset($this) && $this instanceof ecache) { if (defined("THEME")) { if (strpos($CacheTag, "nq_") === 0) { // We do not care about e_QUERY, so don't use it in the md5 calculation if (!$this->CachenqMD5) { $this->CachenqMD5 = md5(e_BASE . (defined("ADMIN") && ADMIN == true ? "admin" : "") . e_LANGUAGE . THEME . USERCLASS_LIST . filemtime(THEME . 'theme.php')); } // Add 'nq' to indicate we are not using e_QUERY $CheckTag = '_nq_' . $this->CachenqMD5; } else { // It's a page - need the query in the hash if (!$this->CachePageMD5) { $this->CachePageMD5 = md5(e_BASE . e_LANGUAGE . THEME . USERCLASS_LIST . defset('e_QUERY') . filemtime(THEME . 'theme.php')); } $CheckTag = '_' . $this->CachePageMD5; } } else { // Check if a custom CachePageMD5 is in use in e_module.php. $CheckTag = $this->CachePageMD5 ? "_" . $this->CachePageMD5 : ""; } } else { $CheckTag = ''; } $q = ($syscache ? "S_" : "C_") . preg_replace("#\\W#", "_", $CacheTag); $fname = e_CACHE_CONTENT . $q . $CheckTag . '.cache.php'; //echo "cache f_name = $fname <br />"; return $fname; }
/** * Update the current Repo. of this e107 installation. (eg. e107 on github) */ function gitrepo() { $mes = e107::getMessage(); $fl = e107::getFile(); if (is_dir(e_BASE . ".git")) { $gitPath = defset('e_GIT', 'git'); // addo to e107_config.php to // Change Dir. $cmd = 'cd ' . e_ROOT; $mes->addDebug($cmd); $text = `{$cmd} 2>&1`; // Remove any local changes. $cmd = $gitPath . ' reset --hard'; $mes->addDebug($cmd); $text .= `{$cmd} 2>&1`; // Run Pull request $cmd = $gitPath . ' pull'; $mes->addDebug($cmd); $text .= `{$cmd} 2>&1`; $return = print_a($text, true); $mes->addSuccess($return); if (unlink(e_BASE . "install.php")) { $mes->addDebug("Removed install.php"); } } else { $mes->addError("No git repo found"); //TODO LAN } $fl->chmod(e_BASE . "cron.php", 0755); $fl->chmod(e_HANDLER . "bounce_handler.php", 0755); }
function js() { //FIXME include_once e_LANGUAGEDIR . e_LANGUAGE . "/lan_user_extended.php"; $text = "\n\n\n\t\tfunction changeHelp(type) {\n\t //<![CDATA[\n\t\tvar ftype;\n\t\tvar helptext;\n\n\n\t\t"; for ($i = 1; $i <= 9; $i++) { $type_const = "UE_LAN_{$i}"; $help_const = "\"" . str_replace("/", "\\/", "EXTLAN_HELP_{$i}") . "\""; $text .= "\n\t\t\t\tif(type == \"{$i}\")\n\t\t\t\t{\n\t\t\t\t\txtype=\"" . defset($type_const) . "\";\n\t\t\t\t\twhat=\"" . defset($help_const) . "\";\n\t\t\t\t}"; } $text .= "\n\t\t//\tdocument.getElementById('ue_type').innerHTML=''+xtype+'';\n\t\t//\tdocument.getElementById('ue_help').innerHTML=''+what+'';\n\n\t\t\tif(type == 4){\n\t\t\t\tdocument.getElementById('db_mode').style.display = '';\n\t\t\t\tdocument.getElementById('values').style.display = 'none';\n\t\t\t}else{\n\t document.getElementById('values').style.display = '';\n\t\t\t\tdocument.getElementById('db_mode').style.display = 'none';\n\t\t\t}\n\t\t\t // ]]>\n\t\t}\n\n\n"; return $text; }
function sc_cm_comment($parm = '') { $menu_pref = e107::getConfig('menu')->getPref(); $tp = e107::getParser(); $COMMENT = ''; if ($menu_pref['comment_characters'] > 0) { $COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap'))); if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters']) { $COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'], '') . ($this->var['comment_url'] ? " <a href='" . $this->var['comment_url'] . "'>" : "") . defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']) . ($this->var['comment_url'] ? "</a>" : ""); } } return $COMMENT; }
/** * Parameter list (GET string format): * - text: used if href is true * - href (1/0): return only URL if false, else return tag * - rel: rel tag attribute * * @param string $parm * @return string */ public function sc_featurebox_url($parm = '') { $tp = e107::getParser(); $url = $tp->replaceConstants($this->get('fb_imageurl'), 'full'); if (empty($url)) { return ''; } parse_str($parm, $parm); if (!vartrue($parm['href'])) { return $tp->replaceConstants($url); } $title = vartrue($parm['text']) ? defset($parm['text']) : FBLAN_02; $alt = $tp->toAttribute($this->get('fb_title'), false, 'TITLE'); return '<a id="featurebox-url-' . $this->getId() . '" href="' . $url . '" title="' . $alt . '" rel="' . $tp->toAttribute(vartrue($parm['rel'], '')) . '">' . $title . '</a>'; }
/** * Parameter list (GET string format): * - text: used if href is true * - href (1/0): return only URL if false, else return tag * - rel: rel tag attribute * * @param string $parm * @return string */ public function sc_featurebox_url($parm = '') { $tp = e107::getParser(); $url = $tp->replaceConstants($this->get('fb_imageurl'), 'full'); if (empty($url)) { return ''; } parse_str($parm, $parm); if (vartrue($parm['href'])) { return $tp->replaceConstants($url); } $title = vartrue($parm['text']) ? defset($parm['text']) : LAN_MORE; $alt = $tp->toAttribute($this->get('fb_title'), false, 'TITLE'); $buttonCls = vartrue($parm['button']) ? 'class="btn btn-primary btn-featurebox" ' : ""; return '<a ' . $buttonCls . 'id="featurebox-url-' . $this->getId() . '" href="' . $url . '" title="' . $alt . '" rel="' . $tp->toAttribute(vartrue($parm['rel'], '')) . '">' . $title . '</a>'; }
/** * Render a Poll creation Form * @param $mode string - admin | forum | front */ function renderPollForm($mode = 'admin') { $tp = e107::getParser(); $frm = e107::getForm(); // echo "MODE=".$mode; //XXX New v2.x default for front-end. Currently used by forum-post in bootstrap mode. // TODO LAN - Needs a more generic LAN rewrite when used on another area than forum if ($mode == 'front') { $text = "\n\t\t\t\n\t\t\t<div class='alert alert-info'>\n\t\t\t\t<small >" . LAN_FORUM_3029 . "</small>\n\t\t\t</div>"; // $text .= "<form>"; $text .= "\n\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label for='poll_title'>Poll question</label>\n\t\t\t\t\t" . $frm->text('poll_title', $tp->post_toForm(vartrue($_POST['poll_title'])), '200', array('placeholder' => LAN_FORUM_3030, 'id' => 'poll_title')) . " \n\t\t\t\t</div>"; $option_count = vartrue($_POST['poll_option']) ? count($_POST['poll_option']) : 2; $text .= "\t\t\n\t\t\t\t<div id='pollsection'>\n\t\t\t\t\t<label for='pollopt'>Poll answers</label>"; for ($count = 1; $count <= $option_count; $count++) { // if ($count != 1 && $_POST['poll_option'][($count-1)] =="") // { // // break; // } $opt = $count == 1 ? "id='poll_answer'" : ""; $text .= "<div class='form-group' " . $opt . ">\n\t\t\t\t\t\t\t\t" . $frm->text('poll_option[]', $_POST['poll_option'][$count - 1], '200', array('placeholder' => LAN_FORUM_3031, 'id' => $opt)) . "\n\t\t\t\t\t\t\t </div>"; } $text .= "</div>"; // end pollsection div $text .= "<div class='form-group control-group'>\n\t\t\t\t\t\t\t<input class='btn btn-default' type='button' id='addoption' name='addoption' value='" . LAN_FORUM_3032 . "' />\n\t\t\t\t\t\t</div>\n\n\t\t\t\t"; //FIXME - get this looking good with Bootstrap CSS only. $opts = array(1 => LAN_YES, 0 => LAN_NO); // Set to IP address.. Can add a pref to Poll admin for 'default front-end storage method' if demand is there for it. $text .= "<br />\n\t\t\t <div class='form-horizontal control-group'>\n\t\t\t\t<label class='control-label'>" . LAN_FORUM_3033 . "</label>\n\t\t\t\t<div class='radio controls'>\n\t\t\t\t\t" . $frm->radio('multipleChoice', $opts, vartrue($_POST['multipleChoice'], 0)) . $frm->hidden('storageMethod', 1) . "\n\t\t\t\t</div>\n\t\t\t</div>\t\t\t\n\t\t"; // $text .= "</form>"; return $text; /* $text .= " <div class='controls controls-row'>".POLL_506." <input type='radio' name='multi/pleChoice' value='1'".(vartrue($_POST['multipleChoice']) ? " checked='checked'" : "")." /> ".POLL_507." <input type='radio' name='multi/pleChoice' value='0'".(!$_POST['multipleChoice'] ? " checked='checked'" : "")." /> ".POLL_508." </div>"; */ //XXX Should NOT be decided by USER /* $text .= " <div> ".POLLAN_16." <input type='radio' name='storageMethod' value='0'".(!vartrue($_POST['storageMethod']) ? " checked='checked'" : "")." /> ".POLLAN_17."<br /> <input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] == 1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br /> <input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19." </div> "; */ } //TODO Hardcoded FORUM code needs to be moved somewhere. if ($mode == 'forum') { $text = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'><span class='smalltext'>" . LAN_FORUM_3029 . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'><div class='normaltext'>" . LAN_FORUM_3030 . ": </div></td>\n\t\t\t\t<td style='width:80%'class='forumheader3'><input class='tbox' type='text' name='poll_title' size='70' value='" . $tp->post_toForm(vartrue($_POST['poll_title'])) . "' maxlength='200' /></td>\n\t\t\t</tr>"; $option_count = count(vartrue($_POST['poll_option'])) ? count($_POST['poll_option']) : 1; $text .= "\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'>" . LAN_FORUM_3031 . "</td>\n\t\t\t\t<td style='width:80%'>\n\t\t\t\t<div id='pollsection'>"; for ($count = 1; $count <= $option_count; $count++) { if ($count != 1 && $_POST['poll_option'][$count - 1] == "") { break; } $opt = $count == 1 ? "id='pollopt'" : ""; $text .= "<span {$opt}><input class='tbox' type='text' name='poll_option[]' size='40' value=\"" . $_POST['poll_option'][$count - 1] . "\" maxlength='200' />"; $text .= "</span><br />"; } $text .= "\n\t\t\t\t</div>\n\t\t\t\t<input class='btn btn-default button' type='button' name='addoption' value='" . LAN_FORUM_3032 . "' onclick=\"duplicateHTML('pollopt','pollsection')\" /><br />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:20%'>" . LAN_FORUM_3033 . "</td>\n\t\t\t\t<td style='width:80%'>\n\t\t\t\t<input type='radio' name='multipleChoice' value='1'" . (vartrue($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . LAN_YES . " \n\t\t\t\t<input type='radio' name='multipleChoice' value='0'" . (!$_POST['multipleChoice'] ? " checked='checked'" : "") . " /> " . LAN_NO . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='width:30%'>" . LAN_FORUM_3034 . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='storageMethod' value='0'" . (!vartrue($_POST['storageMethod']) ? " checked='checked'" : "") . " /> " . LAN_FORUM_3035 . "<br />\n\t\t\t\t\t<input type='radio' name='storageMethod' value='1'" . ($_POST['storageMethod'] == 1 ? " checked='checked'" : "") . " /> " . LAN_FORUM_3036 . "<br />\n\t\t\t\t\t<input type='radio' name='storageMethod' value='2'" . ($_POST['storageMethod'] == 2 ? " checked='checked'" : "") . " /> " . LAN_FORUM_3037 . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t"; return $text; } $formgo = e_SELF . (e_QUERY && !defined("RESET") && strpos(e_QUERY, 'delete') === FALSE ? "?" . e_QUERY : ""); $text = "<div>\n\t\t<form method='post' action='{$formgo}'>\n\t\t<table class='table adminform'>\n <colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tr>\n\t\t<td style='width:30%'><div class='normaltext'>" . POLLAN_3 . ":</div></td>\n\t\t<td style='width:70%'>\n\t\t<input class='tbox input-xxlarge' type='text' name='poll_title' size='70' value='" . $tp->post_toForm(varset($_POST['poll_title'])) . "' maxlength='200' />"; $option_count = varset($_POST['poll_option']) && count($_POST['poll_option']) ? count($_POST['poll_option']) : 2; $text .= "</td></tr><tr>\n\t\t<td style='width:30%;vertical-align:top'>" . LAN_OPTIONS . " :</td>\n\t\t<td style='width:70%'>\n\t\t<div id='pollsection'>"; for ($count = 1; $count <= $option_count; $count++) { $opt = $count == 1 ? "id='pollopt'" : ""; $text .= "<span class='form-inline' style='display:inline-block; padding-bottom:5px' {$opt}><input class='tbox input-large' type='text' name='poll_option[]' size='40' value=\"" . $tp->post_toForm($_POST['poll_option'][$count - 1]) . "\" maxlength='200' />"; $text .= "</span><br />"; } $text .= "</div><input class='btn btn-default' type='button' name='addoption' value='" . POLLAN_8 . "' onclick=\"duplicateHTML('pollopt','pollsection')\" /><br />\n\t\t</td></tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_9 . "</td>\n\t\t<td style='width:70%'>\n\t\t<input type='radio' name='multipleChoice' value='1'" . (varset($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . POLLAN_10 . " \n\t\t<input type='radio' name='multipleChoice' value='0'" . (!varset($_POST['multipleChoice']) ? " checked='checked'" : "") . " /> " . POLLAN_11 . "\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_12 . "</td>\n\t\t<td style='width:70%'>\n\t\t<input type='radio' name='showResults' value='0'" . (!varset($_POST['showResults']) ? " checked='checked'" : "") . " /> " . POLLAN_13 . "<br />\n\t\t<input type='radio' name='showResults' value='1'" . (varset($_POST['showResults']) ? " checked='checked'" : "") . " /> " . POLLAN_14 . "\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_15 . "</td>"; $uclass = ADMIN ? "" : "public,member,admin,classes,matchclass"; $text .= "\n\t\t<td>" . r_userclass("pollUserclass", vartrue($_POST['pollUserclass']), 'off', $uclass) . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:30%'>" . POLLAN_16 . "</td>\n\t\t<td>\n\t\t<input type='radio' name='storageMethod' value='0'" . (!varset($_POST['storageMethod']) ? " checked='checked'" : "") . " /> " . POLLAN_17 . "<br />\n\t\t<input type='radio' name='storageMethod' value='1'" . (varset($_POST['storageMethod']) == 1 ? " checked='checked'" : "") . " /> " . POLLAN_18 . "<br />\n\t\t<input type='radio' name='storageMethod' value='2'" . (varset($_POST['storageMethod']) == 2 ? " checked='checked'" : "") . " /> " . POLLAN_19 . "\n\t\t</td></tr>\n\n\t\t<tr>\n\t\t<td>" . POLLAN_20 . ": </td><td>\n\t\t<input type='radio' name='poll_comment' value='1'" . (varset($_POST['poll_comment']) ? " checked='checked'" : "") . " /> " . POLLAN_10 . "\n\t\t<input type='radio' name='poll_comment' value='0'" . (!varset($_POST['poll_comment']) ? " checked='checked'" : "") . " /> " . POLLAN_11 . "\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div class='buttons-bar center'>"; if (isset($_POST['preview']) || varset($_POST['edit'])) { // $text .= "<input type='submit' name='preview' value='".POLLAN_24."' /> "; $text .= $frm->admin_button('preview', POLLAN_24, 'other'); if (POLLACTION == 'edit') { $text .= $frm->admin_button('submit', LAN_UPDATE, 'update') . "\n\t\t\t\t\n\t\t\t\t<input type='hidden' name='poll_id' value='" . intval($_POST['poll_id']) . "' /> "; } else { $text .= $frm->admin_button('submit', 'no-value', 'submit', LAN_CREATE); // $text .= "<input type='submit' name='submit' value='".POLLAN_23."' /> "; } } else { $text .= $frm->admin_button('preview', 'no-value', 'other', POLLAN_24); // $text .= "<input type='submit' name='preview' value='".POLLAN_24."' /> "; } if (defset('POLLID')) { $text .= $frm->admin_button('reset', 'no-value', 'reset', POLLAN_25); // $text .= "<input type='submit' name='reset' value='".POLLAN_25."' /> "; } $text .= "</div>\n\t\t</form>\n\t\t</div>"; return $text; }
/** * Create form fieldset, called internal by {@link renderCreateForm()) * * @param string $id field id * @param array $fdata fieldset data * @param e_admin_model $model * @return string */ function renderCreateFieldset($id, $fdata, $model, $tab = 0) { $text = vartrue($fdata['fieldset_pre']) . "\r\n\t\t\t<fieldset id='{$id}'>\r\n\t\t\t\t<legend>" . vartrue($fdata['legend']) . "</legend>\r\n\t\t\t\t" . vartrue($fdata['table_pre']) . "\r\n\t\t\t\t<table class='table adminform'>\r\n\t\t\t\t\t<colgroup>\r\n\t\t\t\t\t\t<col class='col-label' />\r\n\t\t\t\t\t\t<col class='col-control' />\r\n\t\t\t\t\t</colgroup>\r\n\t\t\t\t\t<tbody>\r\n\t\t"; // 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' || $att['type'] === null || $att['type'] === false) { 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 (!empty($att['writeParms']) && !is_array($att['writeParms'])) { parse_str(varset($att['writeParms']), $writeParms); } else { $writeParms = varset($att['writeParms']); } if ('hidden' === $att['type']) { if (!vartrue($writeParms['show'])) { $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array())); 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']); } } /* if('hidden' === $att['type']) { parse_str(varset($att['writeParms']), $tmp); if(!vartrue($tmp['show'])) { $hidden_fields[] = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array())); unset($tmp); continue; } unset($tmp); } */ $leftCell = $required . "<span{$required_class}>" . defset(vartrue($att['title']), vartrue($att['title'])) . "</span>" . $label; $rightCell = $this->renderElement($keyName, $model->getIfPosted($valPath), $att, varset($model_required[$key], array()), $model->getId()) . " {$help}"; if (vartrue($att['type']) == 'bbarea' || varset($writeParms['nolabel']) == true) { $text .= "\r\n\t\t\t\t\t<tr><td colspan='2'>"; $text .= "<div style='padding-bottom:8px'>" . $leftCell . "</div>"; $text .= $rightCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t"; } else { // rightCellClass // leftCellClass $leftCellClass = !empty($writeParms['tdClassLeft']) ? " class='" . $writeParms['tdClassLeft'] . "'" : ""; $rightCellClass = !empty($writeParms['tdClassRight']) ? " class='" . $writeParms['tdClassRight'] . "'" : ""; $trClass = !empty($writeParms['trClass']) ? " class='" . $writeParms['trClass'] . "'" : ""; $text .= "\r\n\t\t\t\t\t<tr{$trClass}>\r\n\t\t\t\t\t\t<td{$leftCellClass}>\r\n\t\t\t\t\t\t\t" . $leftCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td{$rightCellClass}>\r\n\t\t\t\t\t\t\t" . $rightCell . "\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t"; } } //if($bckp) $model->remove($bckp); } //print_a($fdata); if ($required_help) { $required_help = '<div class="form-note">' . $this->getRequiredString() . ' - required fields</div>'; //TODO - lans } $text .= "\r\n\t\t\t\t\t</tbody>\r\n\t\t\t\t</table>"; $text .= implode("\n", $hidden_fields); $text .= "</fieldset>"; $text .= vartrue($fdata['fieldset_post']); return $text; /* $text .= " ".implode("\n", $hidden_fields)." ".$required_help." ".vartrue($fdata['table_post'])." <div class='buttons-bar center'> "; // 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="nav-header">After submit:</li> '; foreach($defsubmitopt as $k=>$v) { $text .= "<li><a href='#' class='e-noclick'>".$this->radio('__after_submit_action', $k, $selected,"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 .= " </div> ".vartrue($fdata['fieldset_post'])." "; return $text; */ }
/** * Get and parse core preference values (if available) * * @return void */ protected function _init() { // Try to auto-detect runtime location $this->setInAdmin(defset('e_ADMIN_AREA', false)); if ($this->isInAdmin()) { $this->_libraries['jquery'] = array("https://cdn.jsdelivr.net/jquery/2.1.4/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.min.js", "https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.js", "https://cdn.jsdelivr.net/jquery.ui/1.11.4/themes/smoothness/jquery-ui.min.css"); // "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js", // "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css", //https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css } if (isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true') { $this->_libraries['jquery'] = array("jquery/jquery.min.js"); } $customJqueryUrls = e107::getPref('library-jquery-urls'); if (vartrue($customJqueryUrls) && $this->_in_admin === false) { $this->_libraries['jquery'] = explode("\n", $customJqueryUrls); } // Try to load browser cache id from core preferences //$this->setCacheId(deftrue('e_NOCACHE') ? time() : e107::getPref('e_jslib_browser_cache')); $this->setCacheId(e107::getPref('e_jslib_browser_cache'), 0); // Load stored in preferences core lib paths ASAP - FIXME - find better way to store libs - array structure and separate table row // $core_libs = e107::getPref('e_jslib_core'); $this->_core_prefs = e107::getPref('e_jslib_core'); $core = array(); if (is_array($this->_core_prefs)) { foreach ($this->_core_prefs as $id => $vis) { $this->_dependence = $id; if (!$this->libDisabled($id, $vis)) { //echo "<h2>FRAMEWORK Loaded: ".$id." :: ".$vis."</h2>"; if (vartrue($this->_libraries[$id])) { foreach ($this->_libraries[$id] as $path) { //echo "<h4>Loaded: ".$path." :: ".$vis."</h4>"; $core[$path] = $vis; } } } } } $this->_dependence = null; if ($vis != 'auto') { $this->checkLibDependence(null, $core); } // Load stored in preferences plugin lib paths ASAP $plug_libs = e107::getPref('e_jslib_plugin'); if (!$plug_libs) { $plug_libs = array(); } foreach ($plug_libs as $plugname => $lib_paths) { $this->pluginLib($plugname, $lib_paths); } // Load stored in preferences theme lib paths ASAP // TODO - decide if THEME should directly use themeLib() or // we store paths in 'e_jslib_theme' on theme installation only (theme.xml)! $theme_libs = e107::getPref('e_jslib_theme'); if (!$theme_libs) { $theme_libs = array(); } $this->themeLib($theme_libs); // TEST VALUES // $this->_e_jslib_plugin[] = '{e_PLUGIN}myplug/test.js'; // $this->_e_jslib_plugin[] = 'http://somesite/myplug/test.js'; // $this->_e_jslib_theme[] = '{THEME}js/test.js'; // $this->_e_jslib_theme[] = 'http://somesite/js/test.js'; }
/** * Set the Language (Constants, $_SESSION and $_COOKIE) for the current page. * @param string $language force set * @return void */ function set($language = null) { $pref = e107::getPref(); $session = e107::getSession(); // default core session namespace if ($language && ($language = $this->isValid($language))) { $this->detect = $language; } if ($this->detect) { // new - e_language moved to e107 namespace - $_SESSION['e107']['e_language'] if (!$session->has('e_language') || $session->get('e_language') != $this->detect && $this->isValid($session->get('e_language'))) { $session->set('e_language', $this->detect); } if (varset($_COOKIE['e107_language']) != $this->detect && defset('MULTILANG_SUBDOMAIN') != TRUE) { setcookie('e107_language', $this->detect, time() + 86400, e_HTTP); $_COOKIE['e107_language'] = $this->detect; // Used only when a user returns to the site. Not used during this session. } else { if (isset($_COOKIE['e107_language'])) { unset($_COOKIE['e107_language']); } } $user_language = $this->detect; } else { if ($session->has('e_language')) { $user_language = $session->get('e_language'); } elseif (isset($_COOKIE['e107_language']) && ($user_language = $this->isValid($_COOKIE['e107_language']))) { $session->set('e_language', $user_language); } else { $user_language = $pref['sitelanguage']; if ($session->is('e_language')) { $session->clear('e_language'); } if (isset($_COOKIE['e107_language'])) { unset($_COOKIE['e107_language']); } } } $this->e_language = $user_language; $this->setDefs(); return; }
define('e_PAGETITLE', $tp->toHTML($category_name, FALSE, 'TITLE')); } $currentNewsAction = $action; require_once HEADERF; $action = $currentNewsAction; if (vartrue($NEWSLISTSTYLE)) { $template = array('start' => '', 'item' => $NEWSLISTSTYLE, 'end' => ''); } else { $template = e107::getTemplate('news', 'news', 'list'); } // Legacy Styling.. $param = array(); $param['itemlink'] = defined("NEWSLIST_ITEMLINK") ? NEWSLIST_ITEMLINK : ""; $param['thumbnail'] = defined("NEWSLIST_THUMB") ? NEWSLIST_THUMB : "border:0px"; $param['catlink'] = defined("NEWSLIST_CATLINK") ? NEWSLIST_CATLINK : ""; $param['caticon'] = defined("NEWSLIST_CATICON") ? NEWSLIST_CATICON : defset('ICONSTYLE', ''); $param['current_action'] = $action; // NEW - allow news batch shortcode override (e.g. e107::getScBatch('news', 'myplugin', true); ) e107::getEvent()->trigger('news_list_parse', $newsList); $text = ''; if (vartrue($template['start'])) { $text .= $tp->parseTemplate($template['start'], true); } foreach ($newsList as $row) { $text .= $ix->render_newsitem($row, 'return', '', $template['item'], $param); } if (vartrue($template['end'])) { $text .= $tp->parseTemplate($template['end'], true); } $icon = $row['category_icon'] ? "<img src='" . e_IMAGE . "icons/" . $row['category_icon'] . "' alt='' />" : ""; // Deprecated.
/** * Replace e107 path constants * Note: only an ADMIN user can convert {e_ADMIN} * TODO - runtime cache of search/replace arrays (object property) when $mode !== '' * @param string $text * @param string $mode [optional] abs|full "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc * TRUE = produce truncated URL path, e.g. e107plugins/etc * "" (default) = URL's get relative path e.g. ../e107_plugins/etc * @param mixed $all [optional] if TRUE, then when $mode is "full" or TRUE, USERID is also replaced... * when $mode is "" (default), ALL other e107 constants are replaced * @return string */ public function replaceConstants($text, $mode = '', $all = FALSE) { if ($mode != "") { $e107 = e107::getInstance(); $replace_relative = array($e107->getFolder('media_files'), $e107->getFolder('media_video'), $e107->getFolder('media_image'), $e107->getFolder('media_icon'), $e107->getFolder('media_avatar'), $e107->getFolder('web_js'), $e107->getFolder('web_css'), $e107->getFolder('web_image'), $e107->getFolder('web_pack'), e_IMAGE_ABS, e_THEME_ABS, $e107->getFolder('images'), $e107->getFolder('plugins'), $e107->getFolder('files'), $e107->getFolder('themes'), $e107->getFolder('handlers'), $e107->getFolder('media'), $e107->getFolder('web'), $e107->site_theme ? $e107->getFolder('themes') . $e107->site_theme . '/' : '', defset('THEME_ABS'), ADMIN ? $e107->getFolder('admin') : '', '', $e107->getFolder('core'), $e107->getFolder('system')); switch ($mode) { case 'abs': $replace_absolute = array(e_MEDIA_FILE_ABS, e_MEDIA_VIDEO_ABS, e_MEDIA_IMAGE_ABS, e_MEDIA_ICON_ABS, e_MEDIA_AVATAR_ABS, e_JS_ABS, e_CSS_ABS, e_WEB_IMAGE_ABS, e_PACK_ABS, e_IMAGE_ABS, e_THEME_ABS, e_IMAGE_ABS, e_PLUGIN_ABS, e_FILE_ABS, e_THEME_ABS, '', e_MEDIA_ABS, e_WEB_ABS, defset('THEME_ABS'), defset('THEME_ABS'), ADMIN ? e_ADMIN_ABS : '', $e107->server_path, '', ''); break; case 'full': $replace_absolute = array(SITEURLBASE . e_MEDIA_FILE_ABS, SITEURLBASE . e_MEDIA_VIDEO_ABS, SITEURLBASE . e_MEDIA_IMAGE_ABS, SITEURLBASE . e_MEDIA_ICON_ABS, SITEURLBASE . e_MEDIA_AVATAR_ABS, SITEURLBASE . e_JS_ABS, SITEURLBASE . e_CSS_ABS, SITEURLBASE . e_WEB_IMAGE_ABS, SITEURLBASE . e_PACK_ABS, SITEURLBASE . e_IMAGE_ABS, SITEURLBASE . e_THEME_ABS, SITEURLBASE . e_IMAGE_ABS, SITEURLBASE . e_PLUGIN_ABS, SITEURLBASE . e_FILE_ABS, SITEURLBASE . e_THEME_ABS, '', SITEURLBASE . e_MEDIA_ABS, SITEURLBASE . e_WEB_ABS, defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', ADMIN ? SITEURLBASE . e_ADMIN_ABS : '', SITEURL, '', ''); break; } // sub-folders first! $search = array('{e_MEDIA_FILE}', '{e_MEDIA_VIDEO}', '{e_MEDIA_IMAGE}', '{e_MEDIA_ICON}', '{e_MEDIA_AVATAR}', '{e_WEB_JS}', '{e_WEB_CSS}', '{e_WEB_IMAGE}', '{e_WEB_PACK}', "{e_IMAGE_ABS}", "{e_THEME_ABS}", "{e_IMAGE}", "{e_PLUGIN}", "{e_FILE}", "{e_THEME}", "{e_HANDLER}", "{e_MEDIA}", "{e_WEB}", "{THEME}", "{THEME_ABS}", "{e_ADMIN}", "{e_BASE}", "{e_CORE}", "{e_SYSTEM}"); /*if (ADMIN) { $replace_relative[] = $e107->getFolder('admin'); $replace_absolute[] = SITEURL.$e107->getFolder('admin'); $search[] = "{e_ADMIN}"; }*/ if ($all) { if (USER) { // Can only replace with valid number for logged in users $replace_relative[] = USERID; $replace_absolute[] = USERID; } else { $replace_relative[] = ''; $replace_absolute[] = ''; } $search[] = "{USERID}"; } // current THEME /*if(!defined('THEME')) { //if not already parsed by doReplace $text = str_replace(array('{THEME}', '{THEME_ABS}'), '', $text); } else { $replace_relative[] = THEME; $replace_absolute[] = THEME_ABS; $search[] = "{THEME}"; $replace_relative[] = THEME; $replace_absolute[] = THEME_ABS; $search[] = "{THEME_ABS}"; }*/ $replace = (string) $mode == "full" || (string) $mode == 'abs' ? $replace_absolute : $replace_relative; return str_replace($search, $replace, $text); } // $pattern = ($all ? "#\{([A-Za-z_0-9]*)\}#s" : "#\{(e_[A-Z]*)\}#s"); $pattern = $all ? '#\\{([A-Za-z_0-9]*)\\}#s' : '#\\{(e_[A-Z]*(?:_IMAGE|_VIDEO|_FILE|_CONTENT|_ICON|_AVATAR|_JS|_CSS|_PACK|_DB|_ABS){0,1})\\}#s'; $text = preg_replace_callback($pattern, array($this, 'doReplace'), $text); if (!defined('THEME')) { //if not already parsed by doReplace $text = str_replace(array('{THEME}', '{THEME_ABS}'), '', $text); } else { $srch = array('{THEME}', '{THEME_ABS}'); $repl = array(THEME, THEME_ABS); $text = str_replace($srch, $repl, $text); } return $text; }
} $text .= "</table>\n</div>"; $ns->tablerender(TOP_LAN_3, $text); } if ($subaction == 'chat' || $subaction == 'all') { $top_forum_posters = $sql->db_Select("user", "*", "`user_chats` > 0 ORDER BY user_chats DESC LIMIT 0, 10"); $text = "\r\n\t\t\t<div style='text-align:center'>\r\n\t\t\t<table style='width:95%' class='fborder'>\r\n\t\t\t<tr>\r\n\t\t\t<td style='width:10%; text-align:center' class='forumheader3'> </td>\r\n\t\t\t<td style='width:20%' class='forumheader3'>" . TOP_LAN_1 . "</td>\r\n\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>" . TOP_LAN_2 . "</td>\r\n\t\t\t<td style='width:30%; text-align:center' class='forumheader3'>" . TOP_LAN_6 . "</td>\r\n\t\t\t</tr>\n"; $counter = 1; if ($top_forum_posters) { while ($row = $sql->db_Fetch()) { // TODO - Custom ranking (chat), LANs $ldata = $rank->getRanks($row); if (vartrue($ldata['special'])) { $r = $ldata['special']; } else { $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']); } if (!$r) { $r = 'n/a'; } $text .= "<tr>\r\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$counter}</td>\r\n\t\t\t\t\t<td style='width:50%' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', 'id=' . $row['user_id'] . '&name=' . $row['user_name']) . "'>{$row['user_name']}</a></td>\r\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$row['user_chats']}</td>\r\n\t\t\t\t\t<td style='width:30%; text-align:center' class='forumheader3'>{$r}</td>\r\n\t\t\t\t\t</tr>"; $counter++; } } else { $text .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='forumheader3' colspan='4'>No results</td>\r\n\t\t\t\t</tr>"; } $text .= "</table>\n</div>"; $ns->tablerender(TOP_LAN_5, $text); } } require_once FOOTERF;
/** * Create media category. * 'class' data is optional, 'id' key is ignored * * @param array $data associative array, db keys should be passed without the leading 'media_cat_' e.g. 'class', 'type', etc. * @return integer last inserted ID or false on error */ public function createCategory($datas) { foreach ($datas as $k => $v) { $data['media_cat_' . $k] = $v; } $data['media_cat_id'] = 0; if (!isset($data['media_cat_class']) || '' === $data['media_cat_class']) { $data['media_cat_class'] = defset('e_UC_MEMBER', 253); } return e107::getDb()->insert('core_media_cat', $data); }
function sc_admin_siteinfo($parm = '') { if ($parm == 'creditsonly' && e_PAGE != "credits.php" && e_PAGE != "phpinfo.php") { return; } if (ADMIN) { global $ns, $pref, $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb; if (file_exists(e_ADMIN . 'ver.php')) { include e_ADMIN . 'ver.php'; } if ($parm == "version") { return $e107info['e107_version']; } $obj = e107::getDateConvert(); $install_date = $obj->convert_date($pref['install_date'], 'long'); if (is_readable(THEME . "theme.xml")) { $xml = e107::getXml(); $data = $xml->loadXMLfile(THEME . "theme.xml", true); $themename = $data['@attributes']['name']; $themeversion = $data['@attributes']['version']; $themedate = $data['@attributes']['date']; $themeauthor = $data['author']['@attributes']['name']; } $text = "<b>" . FOOTLAN_1 . "</b>\n\t\t\t<br />" . SITENAME . "\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_2 . "</b>\n\t\t\t<br />\n\t\t\t<a href=\"mailto:" . SITEADMINEMAIL . "\">" . SITEADMIN . "</a>\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t<b>e107</b>\n\t\t\t<br />\n\t\t\t" . FOOTLAN_3 . " " . $e107info['e107_version'] . "\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_20 . "</b>\n\t\t\t<br />\n\t\t\t[" . e_SECURITY_LEVEL . "] " . defset('LAN_SECURITYL_' . e_SECURITY_LEVEL, 'n/a') . " \n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_18 . "</b>\n\t\t\t<br />" . $pref['sitetheme'] . "<br /><br />\n\t\t\t<b>" . FOOTLAN_5 . "</b>\n\t\t\t<br />\n\t\t\t" . $themename . " v" . $themeversion . " " . ($themeauthor ? FOOTLAN_6 . ' ' . $themeauthor : '') . " " . ($themedate ? "(" . $themedate . ")" : ""); $text .= $themeinfo ? "<br />" . FOOTLAN_7 . ": " . $themeinfo : ''; $text .= "<br /><br />\n\t\t\t<b>" . FOOTLAN_8 . "</b>\n\t\t\t<br />\n\t\t\t" . $install_date . "\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_9 . "</b>\n\t\t\t<br />" . preg_replace("/PHP.*/i", "", $_SERVER['SERVER_SOFTWARE']) . "<br />(" . FOOTLAN_10 . ": " . $_SERVER['SERVER_NAME'] . ")\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_11 . "</b>\n\t\t\t<br />\n\t\t\t" . phpversion() . "\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_12 . "</b>\n\t\t\t<br />\n\t\t\t" . e107::getDB()->mySqlServerInfo . "<br />\n\t\t\t" . FOOTLAN_16 . ": " . $mySQLdefaultdb . "\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_17 . "</b>\n\t\t\t<br />utf-8\n\t\t\t<br /><br />\n\t\t\t<b>" . FOOTLAN_19 . "</b>\n\t\t\t<br />\n\t\t\t" . date('r') . "<br />"; return $ns->tablerender(FOOTLAN_13, $text, '', TRUE); } }
} if (!defined("OTHERNEWS_COLS")) { define("OTHERNEWS_COLS", "1"); } if (!defined("OTHERNEWS_CELL")) { define("OTHERNEWS_CELL", "padding:0px;vertical-align:top"); } if (!defined("OTHERNEWS_SPACING")) { define("OTHERNEWS_SPACING", "0"); } $param['itemlink'] = defset('OTHERNEWS_ITEMLINK'); $param['thumbnail'] = defset('OTHERNEWS_THUMB'); $param['catlink'] = defset('OTHERNEWS_CATLINK'); $param['caticon'] = defset('OTHERNEWS_CATICON'); $style = defset('OTHERNEWS_CELL'); $nbr_cols = defset('OTHERNEWS_COLS'); $_t = time(); $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n\nLEFT JOIN #user AS u ON n.news_author = u.user_id\nLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\nWHERE n.news_class IN (" . USERCLASS_LIST . ") AND n.news_start < " . $_t . " AND (n.news_end=0 || n.news_end>" . $_t . ") AND FIND_IN_SET(2, n.news_render_type) ORDER BY n.news_datestamp DESC LIMIT 0," . OTHERNEWS_LIMIT; if ($sql->gen($query)) { $text = $tp->parseTemplate($template['start'], true); if (OTHERNEWS_COLS !== false) { $text .= "<table style='width:100%' cellpadding='0' cellspacing='" . OTHERNEWS_SPACING . "'>"; $t = 0; $wid = floor(100 / $nbr_cols); while ($row = $sql->fetch()) { $text .= $t % $nbr_cols == 0 ? "<tr>" : ""; $text .= "\n<td style='{$style} ; width:{$wid}%;'>\n"; $text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param); $text .= "\n</td>\n"; if (($t + 1) % $nbr_cols == 0) { $text .= "</tr>";
/* * 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) * */ require_once "class2.php"; include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/lan_' . e_PAGE); if (!$pref['upload_enabled'] || $pref['upload_class'] == 255) { header("location: " . e_BASE . "index.php"); exit; } if (!defined("USER_WIDTH") && defset('BOOTSTRAP') == false) { define("USER_WIDTH", "width:97%"); } require_once e_HANDLER . 'upload_handler.php'; class userUpload { function __construct() { /* e107::css('inline', " input[type=file] { } ");
//echo "<script type='text/javascript'>document.location.href='admin.php'</script>\n"; } } $e_sub_cat = 'logout'; if (ADMIN == FALSE) { define("e_IFRAME", TRUE); } if (!defset('NO_HEADER')) { require_once e_ADMIN . "header.php"; } if (ADMIN == FALSE) { // Needs help from Deso, Vesko and Stoev! :-) e107::css('inline', "\n\t\t\n\t\t\tbody \t\t\t\t{ \ttext-align: left; font-size:15px; line-height:1.5em; font-weight:normal; font-family:Arial, Helvetica, sans-serif; background:#081D28 url(" . e_IMAGE . "logo_template_large.png) no-repeat 50% 40px; }\n\t\t\ta\t\t\t\t\t{ \tcolor:#F6931E; text-decoration:none; }\n\t\t\ta:hover\t\t\t\t{ \tcolor:silver; text-decoration:none; }\n\t\t\t.bold\t\t\t\t{ \tfont-weight:bold; }\n\t\t\t.field\t\t\t\t{ \ttext-align:center;padding:5px }\n\t\t\t.field input\t\t{\tpadding:5px; \n\t\t\t\t\t\t\t\t\tborder-width:1px;\t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tborder-style:solid;\n \t\t\t\t\t\t\t\tborder-color:#aaa #c8c8c8 #c8c8c8 #aaa;\n\t\t\t\t\t\t\t\t\tbackground:#fff;\n\t\t\t\t\t\t\t\t\tfont:16px arial, helvetica, sans-serif;\n\t\t\t\t\t\t\t\t\t-moz-border-radius: 4px;\n\t\t\t\t\t\t\t\t\t-webkit-border-radius: 4px;\n\t\t\t\t\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t\t\t\t\t\t-moz-box-shadow: 1px 1px 2px #999 inset;\n\t\t\t\t\t\t\t\t\t-webkit-box-shadow: 1px 1px 2px #999 inset;\n\t\t\t\t\t\t\t\t\tbox-shadow: 1px 1px 2px #999 inset;\n\t\t\t\t\t\t\t\t}\n\t\t\t\n\t\t\t.field input:focus\t{\n\t\t\t\t\t\t\t\t\tborder:1px solid #F6931E;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t.field input:hover\t{\n\t\t\t\t\t\t\t\t\tborder:1px solid #F6931E;\n\t\t\t\t\t\t\t\t}\n\t\t\t\n\t\t\t#login-admin \t\t{\n\t\t\t\t\t\t\t\t\tmargin-left:auto;\n\t\t\t\t\t\t\t\t\tmargin-right:auto;\n\t\t\t\t\t\t\t\t\tmargin-top:12%;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\twidth:400px; \n\t\t\t\t\t\t\t\t\t/*\t\n\t\t\t\t\t\t\t\t\tpadding: 10px 20px 0 20px;\n\t\t\t\t\t\t\t\t\t-moz-border-radius:5px;\n\t\t\t\t\t\t\t\t\t-webkit-border-radius:5px;\n\t\t\t\t\t\t\t\t\tborder-radius:5px;\n\t\t\t\t\t\t\t\t\t-moz-box-shadow:5px 5px 20px #000000;\n\t\t\t\t\t\t\t\t\t-webkit-box-shadow:5px 5px 20px #000000;\n\t\t\t\t\t\t\t\t\tbox-shadow:5px 5px 20px #000000;\t\n\t\t\t\t\t\t\t\t\tbackground-color: #FEFEFE;\n\t\t\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\t}\n\t\t\t\n\t\t\t#login-admin label \t{ \tdisplay: none; text-align: right\t}\n\t\t\t\t\n\t\t\t\n\t\t\t.admin-submit \t\t{ \ttext-align: center; \tpadding:20px;\t}\n\t\t\t\n\t\t\t.submit\t\t\t\t{ }\n\t\t\t\n\t\t\n\t\t\t.placeholder \t\t{\tcolor: #bbb; font-style:italic\t}\n\t\n\t\t\t::-webkit-input-placeholder { font-style:italic;\tcolor: #bbb; \t}\n\t\t\n\t\t\t:-moz-placeholder \t{ font-style:italic;\tcolor: #bbb; \t\t}\n\t\t\t\n\t\t\th2\t\t\t\t\t{ text-align: center; color: #FAAD3D; }\n\t\t\t\n\t\t\t#username\t\t\t{background: url(" . e_IMAGE . "admin_images/admins_16.png) no-repeat scroll 7px 7px; padding-left:30px; }\n\t\t\t\t \n\t\t\t#userpass\t\t\t{background: url(" . e_IMAGE . "admin_images/lock_16.png) no-repeat scroll 7px 7px; padding-left:30px; }\n\t\t\t\n\t\t\tinput[disabled] \t{\tcolor: silver;\t}\n\t\t\tbutton[disabled] span\t{\tcolor: silver;\t}\n\t\t\n\t\t"); $obj = new auth(); $obj->authform(); if (!defset('NO_HEADER')) { require_once e_ADMIN . "footer.php"; } exit; } } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// class auth { /** * Admin auth login * @return null */ public function authform() { global $use_imagecode, $sec_img, $pref;
* $Source: /cvs_backup/e107_0.8/e107_plugins/comment_menu/comment_menu.php,v $ * $Revision$ * $Date$ * $Author$ */ if (!defined('e107_INIT')) { exit; } require_once e_PLUGIN . "comment_menu/comment_menu_shortcodes.php"; $cobj = e107::getObject('comment'); //require_once (e_HANDLER."comment_class.php"); //$cobj = new comment; if (file_exists(THEME . "comment_menu_template.php")) { require_once THEME . "comment_menu_template.php"; } else { require_once e_PLUGIN . "comment_menu/comment_menu_template.php"; } $data = $cobj->getCommentData(intval($menu_pref['comment_display'])); $text = ''; // no posts yet .. if (empty($data) || !is_array($data)) { $text = CM_L1; } foreach ($data as $row) { e107::setRegistry('plugin/comment_menu/current', $row); $text .= $tp->parseTemplate($COMMENT_MENU_TEMPLATE, true, $comment_menu_shortcodes); } e107::setRegistry('plugin/comment_menu/current', null); $title = e107::getConfig('menu')->get('comment_caption'); e107::getRender()->tablerender(defset($title, $title), $text, 'comment_menu');
$container_only = true; } else { $container_only = false; } if (substr($forum_info['sub_parent'], 0, 1) == '*') { $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1); } $forum->set_crumb(true, '', $fVars); // set $BREADCRUMB (and $BACKLINK) $fVars->FORUMTITLE = $forumInfo['forum_name']; $fVars->MODERATORS = LAN_FORUM_1009 . ': ' . implode(', ', $modArray); $fVars->BROWSERS = ''; if (varset($pref['track_online'])) { $fVars->BROWSERS = $users . ' ' . ($users == 1 ? LAN_FORUM_0059 : LAN_FORUM_0060) . ' (' . $member_users . ' ' . ($member_users == 1 ? LAN_FORUM_0061 : LAN_FORUM_0062) . ", " . $guest_users . " " . ($guest_users == 1 ? LAN_FORUM_0063 : LAN_FORUM_0064) . ')'; } if (defset('BOOTSTRAP') == 3 && !empty($FORUM_VIEWFORUM_TEMPLATE['iconkey'])) { $fVars->ICONKEY = $tp->parseTemplate($FORUM_VIEWFORUM_TEMPLATE['iconkey'], true); } else { $fVars->ICONKEY = "\n\t<table class='table table-bordered' style='width:100%'>\n\t<tr>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_new_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_0039 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_nonew_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_0040 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_sticky_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_1011 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_announce_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_1013 . "</td>\n\t</tr>\n\t<tr>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_new_popular_small . "</td>\n\t<td style='width:2%' class='smallblacktext'>" . LAN_FORUM_0039 . " " . LAN_FORUM_1010 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_nonew_popular_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_0040 . " " . LAN_FORUM_1010 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_stickyclosed_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_1012 . "</td>\n\t<td style='vertical-align:middle; text-align:center; width:2%'>" . IMAGE_closed_small . "</td>\n\t<td style='width:10%' class='smallblacktext'>" . LAN_FORUM_1014 . "</td>\n\t</tr>\n\t</table>"; } $fVars->SEARCH = "\n\t<form method='get' class='form-inline input-append' action='" . e_BASE . "search.php'>\n\t<p>\n\t<input class='tbox' type='text' name='q' size='20' value='' maxlength='50' />\n\t<button class='btn btn-default button' type='submit' name='s' >" . LAN_SEARCH . "</button>\n\t<input type='hidden' name='r' value='0' />\n\t<input type='hidden' name='ref' value='forum' />\t\n\t</p>\n\t</form>"; if ($forum->checkPerm($forumId, 'post')) { $fVars->PERMS = LAN_FORUM_0043 . ' - ' . LAN_FORUM_0045 . ' - ' . LAN_FORUM_0047; } else { $fVars->PERMS = LAN_FORUM_0044 . ' - ' . LAN_FORUM_0046 . ' - ' . LAN_FORUM_0048; } $sticky_threads = 0; $stuck = false; $reg_threads = 0; $unstuck = false; $threadList = $forum->forumGetThreads($forumId, $threadFrom, $view);
function renderBatchFilter($type = 'batch', $selected = '') { $optdiz = array('batch' => LAN_BATCH_LABEL_PREFIX . ' ', 'filter' => LAN_FILTER_LABEL_PREFIX . ' '); $table = $this->getController()->getTableName(); $text = ''; $textsingle = ''; foreach ($this->getController()->getFields() as $key => $val) { if (!varset($val[$type])) { continue; } $option = array(); $parms = vartrue($val['writeParms'], array()); if (is_string($parms)) { parse_str($parms, $parms); } switch ($val['type']) { case 'bool': case 'boolean': //TODO modify description based on $val['parm] if (vartrue($parms['reverse'])) { $option['bool__' . $key . '__0'] = LAN_YES; // see newspost.php : news_allow_comments for an example. $option['bool__' . $key . '__1'] = LAN_NO; } else { $option['bool__' . $key . '__1'] = LAN_YES; $option['bool__' . $key . '__0'] = LAN_NO; } if ($type == 'batch') { $option['boolreverse__' . $key] = LAN_BOOL_REVERSE; } break; case 'checkboxes': case 'comma': // TODO lan if (!isset($parms['__options'])) { $parms['__options'] = array(); } if (!is_array($parms['__options'])) { parse_str($parms['__options'], $parms['__options']); } $opts = $parms['__options']; unset($parms['__options']); //remove element options if any $options = $parms ? $parms : array(); if (empty($options)) { continue; } if ($type == 'batch') { $_option = array(); if (isset($options['addAll'])) { $option['attach_all__' . $key] = vartrue($options['addAll'], '(add all)'); unset($options['addAll']); } if (isset($options['clearAll'])) { $_option['deattach_all__' . $key] = vartrue($options['clearAll'], '(clear all)'); unset($options['clearAll']); } if (vartrue($opts['simple'])) { foreach ($options as $value) { $option['attach__' . $key . '__' . $value] = 'Add ' . $value; $_option['deattach__' . $key . '__' . $value] = 'Remove ' . $value; } } else { foreach ($options as $value => $label) { $option['attach__' . $key . '__' . $value] = 'Add ' . $label; $_option['deattach__' . $key . '__' . $value] = 'Remove ' . $label; } } $option = array_merge($option, $_option); unset($_option); } else { unset($options['addAll'], $options['clearAll']); if (vartrue($opts['simple'])) { foreach ($options as $k) { $option[$key . '__' . $k] = $k; } } else { foreach ($options as $k => $name) { $option[$key . '__' . $k] = $name; } } } break; case 'templates': case 'layouts': $parms['raw'] = true; $val['writeParms'] = $parms; $tmp = $this->renderElement($key, '', $val); if (is_array($tmp)) { foreach ($tmp as $k => $name) { $option[$key . '__' . $k] = $name; } } break; case 'dropdown': // use the array $parm; if (!empty($parms['optArray'])) { $fopts = $parms; $parms = $fopts['optArray']; unset($fopts['optArray']); $parms['__options'] = $fopts; } if (!is_array(varset($parms['__options']))) { parse_str($parms['__options'], $parms['__options']); } $opts = $parms['__options']; if (vartrue($opts['multiple'])) { // no batch support for multiple, should have some for filters soon continue; } unset($parms['__options']); //remove element options if any foreach ($parms as $k => $name) { $option[$key . '__' . $k] = $name; } break; case 'language': // full list of // full list of case 'lanlist': // use the array $parm; if (!is_array(varset($parms['__options']))) { parse_str($parms['__options'], $parms['__options']); } $opts = $parms['__options']; if (vartrue($opts['multiple'])) { // no batch support for multiple, should have some for filters soon continue; } $options = $val['type'] === 'language' ? e107::getLanguage()->getList() : e107::getLanguage()->getLanSelectArray(); foreach ($options as $code => $name) { $option[$key . '__' . $code] = $name; } break; case 'datestamp': //TODO today, yesterday, this-month, last-month . $dateFilters = array('hour' => "Past Hour", "day" => "Past 24 hours", "week" => "Past Week", "month" => "Past Month", "year" => "Past Year"); foreach ($dateFilters as $k => $name) { $option['datestamp__' . $key . '__' . $k] = $name; // $option['bool__'.$key.'__0'] = LAN_NO; // $option[$key.'__'.$k] = $name; } break; case 'userclass': $classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes')); foreach ($classes as $k => $name) { $option[$key . '__' . $k] = $name; } break; case 'userclasses': $classes = e107::getUserClass()->uc_required_class_list(vartrue($parms['classlist'], 'public,nobody,guest,admin,main,classes')); $_option = array(); if ($type == 'batch') { // FIXME Lan foreach ($classes as $k => $v) { $option['ucadd__' . $key . '__' . $k] = LAN_ADD . ' ' . $v; $_option['ucremove__' . $key . '__' . $k] = 'Remove ' . $v; } $option['ucaddall__' . $key] = '(add all)'; $_option['ucdelall__' . $key] = '(clear all)'; $option = array_merge($option, $_option); } else { foreach ($classes as $k => $v) { $option[$key . '__' . $k] = $v; } } unset($_option); break; case 'method': $method = $key; $list = call_user_func_array(array($this, $method), array('', $type, $parms)); if (is_array($list)) { //check for single option if (isset($list['singleOption'])) { $textsingle .= $list['singleOption']; continue; } // non rendered options array foreach ($list as $k => $name) { $option[$key . '__' . $k] = $name; } } elseif (!empty($list)) { $text .= $list; continue; } break; case 'user': // TODO - User Filter $sql = e107::getDb(); $field = $val['field']; $query = "SELECT d." . $field . ", u.user_name FROM #" . $val['table'] . " AS d LEFT JOIN #user AS u ON d." . $field . " = u.user_id GROUP BY d." . $field . " ORDER BY u.user_name"; $row = $sql->retrieve($query, true); foreach ($row as $data) { $k = $data[$field]; if ($k == 0) { $option[$key . '__' . $k] = "(" . LAN_ANONYMOUS . ")"; } else { $option[$key . '__' . $k] = vartrue($data['user_name'], 'Unknown'); } } break; } if (count($option) > 0) { $text .= "\t" . $this->optgroup_open($optdiz[$type] . defset($val['title'], $val['title']), varset($disabled)) . "\n"; foreach ($option as $okey => $oval) { $text .= $this->option($oval, $okey, $selected == $okey) . "\n"; } $text .= "\t" . $this->optgroup_close() . "\n"; } } return $textsingle . $text; }
e107::coreLan('header', true); e107::coreLan('footer', true); $_globalLans = e107::pref('core', 'lan_global_list'); $_plugins = e107::getPref('plug_installed'); if (!empty($_plugins) && !empty($_globalLans) && is_array($_plugins) && count($_plugins) > 0) { $_plugins = array_keys($_plugins); foreach ($_plugins as $_p) { if (in_array($_p, $_globalLans) && defset('e_CURRENT_PLUGIN') != $_p) { continue; } e107::loadLanFiles($_p, 'admin'); } } // Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed include_once e107::coreTemplatePath('admin_icons'); if (!defset('e_ADMIN_UI') && !defset('e_PAGETITLE')) { $array_functions = e107::getNav()->adminLinks('legacy'); // replacement see e107_handlers/sitelinks.php foreach ($array_functions as $val) { $link = str_replace("../", "", $val[0]); if (strpos(e_SELF, $link) !== FALSE) { // define('e_PAGETITLE',$val[1]); } } } if (!defined('ADMIN_WIDTH')) { define('ADMIN_WIDTH', "width:100%;"); } /** * Automate DB system messages DEPRECATED * NOTE: default value of $output parameter will be changed to false (no output by default) in the future
/** * Get error string by given error code * * @param string $error_code * @return integer error code */ function getErrorByCode($error_code) { $lan = 'LAN_VALIDATE_' . $error_code; return defset($lan, $lan); }
/** * Validate all user-modifable extended user fields which are presented. * Primarily intended to validate data entered by a user or admin * * @param array $inArray is the input data (usually from $_POST or $_POST['ue'], although doesn't have to be) - may have 'surplus' values * @param array $hideArray is a set of possible 'hide' flags * @param boolean $isSignup TRUE causes required fields to be specifically checked, else only data passed is checked * * @return array with three potential subkeys: * 'data' - valid data values (key is field name) * ['data']['user_hidden_fields'] is the hidden fields * 'errors' - data values in error * 'errortext' - error message corresponding to erroneous value * * @todo - does $hidden_fields need to be merged with values for fields not processed? (Probably not - should only relate to fields current user can see) * @todo - make sure admin can edit fields of other users */ public function userExtendedValidateAll($inArray, $hideArray, $isSignup = FALSE) { $tp = e107::getParser(); $eufVals = array(); // 'Answer' array $hideFlags = array(); foreach ($this->fieldDefinitions as $k => $defs) { $category = $defs['user_extended_struct_parent']; if ($category == 0 || $isSignup && (int) $this->catDefinitions[$category]['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $this->catDefinitions[$category]['user_extended_struct_write'] === (int) e_UC_MEMBER || check_class($this->catDefinitions[$category]['user_extended_struct_applicable']) && check_class($this->catDefinitions[$category]['user_extended_struct_write'])) { // Category applicable to user if ($isSignup && (int) $defs['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $defs['user_extended_struct_write'] === (int) e_UC_MEMBER || check_class($defs['user_extended_struct_applicable']) && check_class($defs['user_extended_struct_write'])) { // User can also update field $f = 'user_' . $defs['user_extended_struct_name']; if (isset($inArray[$f]) || $isSignup && $defs['user_extended_struct_required'] == 1) { // Only allow valid keys $val = varset($inArray[$f], FALSE); $err = $this->user_extended_validate_entry($val, $defs); if ($err === true) { // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined $eufVals['errortext'][$f] = str_replace('--SOMETHING--', $tp->toHtml(defset($defs['user_extended_struct_text'], $defs['user_extended_struct_text']), FALSE, 'defs'), LAN_USER_75); $eufVals['errors'][$f] = ERR_GENERIC; } elseif ($err) { // Specific error message returned - usually regex fail $eufVals['errortext'][$f] = $err; $eufVals['errors'][$f] = ERR_GENERIC; } elseif (!$err) { $eufVals['data'][$f] = $tp->toDB($val); } if (isset($hideArray[$f])) { $hideFlags[] = $f; } } } } } $hidden_fields = implode('^', $hideFlags); if ($hidden_fields != '') { $hidden_fields = '^' . $hidden_fields . '^'; } $eufVals['data']['user_hidden_fields'] = $hidden_fields; return $eufVals; }
e107_include(e_PLUGIN . $val . "/e_header.php"); } } unset($e_headers); echo e107::getUrl()->response()->renderMeta() . "\n"; // render all the e107::meta() entries. echo "<title>" . (defined('e_PAGETITLE') ? e_PAGETITLE . ' - ' : (defined('PAGE_NAME') ? PAGE_NAME . ' - ' : "")) . SITENAME . "</title>\n\n"; // // D: Register CSS // $e_js = e107::getJs(); $e_pref = e107::getConfig('core'); // Other Meta tags. // Register Core CSS first, TODO - convert $no_core_css to constant, awaiting for path changes // NOTE: PREVIEWTHEME check commented - It shouldn't break anything as it's overridden by theme CSS now if (!(isset($no_core_css) && $no_core_css !== true) && defset('CORE_CSS') !== false) { //echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n"; $e_js->otherCSS('{e_WEB_CSS}e107.css'); } // re-initalize in case globals are destroyed from $e_headers includes $e_js = e107::getJs(); $e_pref = e107::getConfig('core'); // --- Load plugin Meta files - now possible to add to all zones! -------- $e_meta_content = ''; if (is_array($pref['e_meta_list'])) { // $pref = e107::getPref(); ob_start(); foreach ($pref['e_meta_list'] as $val) { $fname = e_PLUGIN . $val . "/e_meta.php"; // Do not place inside a function - BC $pref required. . if (is_readable($fname)) {
/** * 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 topPosters() { $pref = e107::pref('core'); $rank = e107::getRank(); $sql = e107::getDb(); $sql2 = e107::getDb('sql2'); $ns = e107::getRender(); $tp = e107::getParser(); define('IMAGE_rank_main_admin_image', $pref['rank_main_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_main_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_main_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/" . IMODE . "/main_admin.png' alt='' />"); define('IMAGE_rank_admin_image', $pref['rank_admin_image'] && file_exists(THEME . "forum/" . $pref['rank_admin_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_admin_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/" . IMODE . "/admin.png' alt='' />"); define('IMAGE_rank_moderator_image', $pref['rank_moderator_image'] && file_exists(THEME . "forum/" . $pref['rank_moderator_image']) ? "<img src='" . THEME_ABS . "forum/" . $pref['rank_moderator_image'] . "' alt='' />" : "<img src='" . e_PLUGIN_ABS . "forum/images/" . IMODE . "/moderator.png' alt='' />"); if ($this->subaction == 'forum' || $this->subaction == 'all') { require_once e_PLUGIN . 'forum/forum_class.php'; $forum = new e107forum(); $qry = "\n\t\t\tSELECT ue.*, u.* FROM `#user_extended` AS ue\n\t\t\tLEFT JOIN `#user` AS u ON u.user_id = ue.user_extended_id\n\t\t\tWHERE ue.user_plugin_forum_posts > 0\n\t\t\tORDER BY ue.user_plugin_forum_posts DESC LIMIT {$this->from}, {$this->view}\n\t\t\t"; // $top_forum_posters = $sql->db_Select("user", "*", "`user_forums` > 0 ORDER BY user_forums DESC LIMIT ".$from.", ".$view.""); $text = "\n\t\t\t<div>\n\t\t\t<table style='width:95%' class='table table-striped fborder'>\n\t\t\t<tr>\n\t\t\t<th style='width:10%; text-align:center' class='forumheader3'> </th>\n\t\t\t<th style='width:50%' class='forumheader3'>" . TOP_LAN_1 . "</th>\n\t\t\t<th style='width:10%; text-align:center' class='forumheader3'>" . TOP_LAN_2 . "</th>\n\t\t\t<th style='width:30%; text-align:center' class='forumheader3'>" . TOP_LAN_6 . "</th>\n\t\t\t</tr>\n"; $counter = 1 + $this->from; if ($sql2->gen($qry)) { while ($row = $sql2->fetch()) { //$ldata = get_level($row['user_id'], $row['user_plugin_forum_posts'], $row['user_comments'], $row['user_chats'], $row['user_visits'], $row['user_join'], $row['user_admin'], $row['user_perms'], $pref); $ldata = $rank->getRanks($row, USER && $forum->isModerator(USERID)); if (vartrue($ldata['special'])) { $r = $ldata['special']; } else { $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']); } if (!$r) { $r = 'n/a'; } $text .= "<tr>\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$counter}</td>\n\t\t\t\t\t<td style='width:50%' class='forumheader3'><a href='" . e107::getUrl()->create('user/profile/view', 'id=' . $row['user_id'] . '&name=' . $row['user_name']) . "'>{$row['user_name']}</a></td>\n\t\t\t\t\t<td style='width:10%; text-align:center' class='forumheader3'>{$row['user_plugin_forum_posts']}</td>\n\t\t\t\t\t<td style='width:30%; text-align:center' class='forumheader3'>{$r}</td>\n\t\t\t\t\t</tr>"; $counter++; } } $text .= "</table>\n</div>"; if ($this->subaction == 'forum') { $ftotal = $sql->count('user', '(*)', 'WHERE `user_forums` > 0'); $parms = "{$ftotal},{$this->view},{$this->from}," . e_SELF . '?[FROM].top.forum.' . $this->view; $text .= "<div class='nextprev'>" . $tp->parseTemplate("{NEXTPREV={$parms}}") . '</div>'; } $ns->tablerender(TOP_LAN_0, $text); } }
/** * Render Category tree * * @param array $template * @param array $parms [return, parsesc=>1|0, mode=>string] * @param boolean $tablerender * @return string */ function render($template = array(), $parms = array(), $tablerender = true) { if (!$this->hasTree()) { return ''; } $ret = array(); $tp = e107::getParser(); if (!isset($parms['parsesc'])) { $parms['parsesc'] = true; } $parsesc = $parms['parsesc'] ? true : false; $active = ''; if (e_PAGE == 'news.php') { $tmp = explode('.', e_QUERY); if (vartrue($tmp[1])) { $active = $tmp[1]; } } $bullet = defined('BULLET') ? THEME_ABS . 'images/' . BULLET : THEME_ABS . 'images/bullet2.gif'; $obj = new e_vars(array('bullet' => $bullet)); foreach ($this->getTree() as $cat) { $obj->active = ''; if ($active && $active == $cat->getId()) { $obj->active = ' active'; } $ret[] = $cat->toHTML($template['item'], $parsesc, $obj); } if ($ret) { $separator = varset($template['separator'], ''); $ret = $template['start'] . implode($separator, $ret) . $template['end']; $return = isset($parms['return']) ? true : false; if ($tablerender) { $caption = vartrue($parms['caption']) ? defset($parms['caption'], $parms['caption']) : LAN_NEWSCAT_MENU_TITLE; // found in plugins/news/languages/English.php $mod = true === $tablerender ? 'news_categories_menu' : $tablerender; return e107::getRender()->tablerender($caption, $ret, varset($parms['mode'], $mod), $return); } if ($return) { return $ret; } echo $ret; } return ''; }
public function getLabel() { $label = $this->isCategory() ? $this->getValue('name') : $this->getValue('text'); return defset($label, $label); }