Пример #1
0
 function getListData()
 {
     $list_caption = $this->parent->settings['caption'];
     $list_display = $this->parent->settings['open'] ? "" : "none";
     $qry = '';
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $qry = "user_join>" . $this->parent->getlvisit() . " AND ";
     }
     $qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0," . intval($this->parent->settings['amount']);
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     if (!$this->parent->e107->sql->db_Select_gen("SELECT user_id,user_name,user_join FROM #user WHERE " . $qry)) {
         $list_data = LIST_MEMBER_2;
     } else {
         while ($row = $this->parent->e107->sql->db_Fetch()) {
             $record = array();
             $rowheading = $this->parent->parse_heading($row['user_name']);
             $record['icon'] = $bullet;
             $record['heading'] = USER ? "<a href='" . e_BASE . "user.php?id." . $row['user_id'] . "'>" . $rowheading . "</a>" : $rowheading;
             $record['category'] = '';
             $record['author'] = '';
             $record['date'] = varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['user_join']) : "";
             $record['info'] = '';
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
Пример #2
0
 function getListData()
 {
     $list_caption = $this->parent->settings['caption'];
     $list_display = $this->parent->settings['open'] ? "" : "none";
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $qry = " AND download_datestamp>" . $this->parent->getlvisit();
     } else {
         $qry = '';
     }
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     $qry = "SELECT d.download_id, d.download_name, d.download_author, d.download_datestamp,\n\t\t   dc.download_category_id, dc.download_category_name, dc.download_category_class\n\t\t   FROM #download AS d\n\t\t   LEFT JOIN #download_category AS dc ON d.download_category=dc.download_category_id\n\t\t   WHERE dc.download_category_class REGEXP '" . e_CLASS_REGEXP . "' AND d.download_class REGEXP '" . e_CLASS_REGEXP . "' AND d.download_active != '0' " . $qry . "\n\t\t   ORDER BY download_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']) . " ";
     $downloads = $this->parent->e107->sql->db_Select_gen($qry);
     if ($downloads == 0) {
         $list_data = LIST_DOWNLOAD_2;
     } else {
         $list_data = array();
         while ($row = $this->parent->e107->sql->db_Fetch()) {
             $record = array();
             $rowheading = $this->parent->parse_heading($row['download_name']);
             $record['icon'] = $bullet;
             $record['heading'] = "<a href='" . e_BASE . "download.php?view." . $row['download_id'] . "'>" . $rowheading . "</a>";
             $record['author'] = varsettrue($this->parent->settings['author']) ? $row['download_author'] : "";
             $record['category'] = varsettrue($this->parent->settings['category']) ? "<a href='" . e_BASE . "download.php?list." . $row['download_category_id'] . "'>" . $row['download_category_name'] . "</a>" : "";
             $record['date'] = varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['download_datestamp']) : "";
             $record['info'] = "";
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
Пример #3
0
 /**
  * Return data representing the user's selection criteria as entered in the $_POST array.
  * 
  * The value returned can be as simple as an array of chosen fields from the $_POST array, or it may be processed to make it more
  * convenient to use later. (In general, at least basic sanitising should be performed)
  * Conflicting selection criteria can also be resolved here.
  * The returned data is stored in the DB with a saved email. (Just return an empty string or array if this is undesirable)
  * The returned value is passed back to selectInit() and showSelect when needed.
  *
  * @return mixed Selection data - may be string, array or whatever suits
  */
 public function returnSelectors()
 {
     $tp = e107::getParser();
     $res = array();
     foreach ($this->selectFields as $k) {
         if (varsettrue($_POST[$k])) {
             $res[$k] = $tp->toDB($_POST[$k]);
         }
     }
     return $res;
 }
Пример #4
0
 /**
  *	Translate to <p> tag
  */
 function toHTML($code_text, $parm)
 {
     if ($parm && !strpos($parm, '=')) {
         $parm = 'class=' . $parm;
     }
     $code_text = trim($code_text);
     $parms = eHelper::scParams($parm);
     $class = " " . e107::getBB()->getClass('p');
     // consistent classes across all themes.
     $id = varsettrue($parms['id']) ? ' id="' . eHelper::secureIdAttr($parms['id']) . '"' : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     return "<p{$id}{$class}{$style}>" . $code_text . '</p>';
 }
Пример #5
0
 /**
  *	Translate youtube bbcode into the appropriate HTML
  */
 function toHTML($code_text, $parm)
 {
     // transform to class, equal sign at 0 position is not well formed parm string
     if ($parm && !strpos($parm, '=')) {
         $parm = 'class=' . $parm;
     }
     $parms = eHelper::scParams($parm);
     $class = " " . e107::getBB()->getClass('block');
     $id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     if (empty($code_text)) {
         $code_text = '<!-- -->';
     }
     return '<div' . $id . $class . $style . '>' . $code_text . '</div>';
 }
Пример #6
0
 /**
  *	Translate to <h*> tag
  */
 function toHTML($code_text, $parm)
 {
     $code_text = trim($code_text);
     if (empty($code_text)) {
         return '';
     }
     $bparms = eHelper::scDualParams($parm);
     $h = 'h' . ($bparms[1] ? intval($bparms[1]) : 2);
     $parms = $bparms[2];
     unset($bparms);
     $class = " " . e107::getBB()->getClass('h2');
     // consistent classes across all themes.
     $id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
     $style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
     return "<{$h}{$id}{$class}{$style}>" . $code_text . "</{$h}>";
 }
Пример #7
0
 function getListData()
 {
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $qry = " n.news_datestamp>" . $this->parent->getlvisit();
     } else {
         $qry = " (n.news_start=0 || n.news_start < " . time() . ") AND (n.news_end=0 || n.news_end>" . time() . ") ";
     }
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     $list_caption = $this->parent->settings['caption'];
     $list_display = varsettrue($this->parent->settings['open']) ? '' : 'none';
     $qry = "\n\t\tSELECT n.*, c.category_id AS news_category_id, c.category_name AS news_category_name, u.user_id AS news_author_id, u.user_name AS news_author_name\n\t\tFROM #news AS n\n\t\tLEFT JOIN #news_category AS c ON c.category_id = n.news_category\n\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\tWHERE " . $qry . " AND n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\tORDER BY n.news_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']);
     if (!$this->parent->e107->sql->db_Select_gen($qry)) {
         $list_data = LIST_NEWS_2;
     } else {
         $list_data = array();
         while ($row = $this->parent->e107->sql->db_Fetch()) {
             $row['news_title'] = $this->parse_news_title($row['news_title']);
             $rowheading = $this->parent->parse_heading($row['news_title']);
             $record = array();
             $record['icon'] = $bullet;
             $record['heading'] = "<a href='" . e_BASE . "news.php?item." . $row['news_id'] . "'>" . $rowheading . "</a>";
             $record['author'] = '';
             if (varsettrue($this->parent->settings['author'])) {
                 if ($row['news_author'] == 0) {
                     $record['author'] = $row['news_author'];
                 } else {
                     if (varsettrue($row['news_author_name'])) {
                         $record['author'] = "<a href='" . e_BASE . "user.php?id." . $row['news_author_id'] . "'>" . $row['news_author_name'] . "</a>";
                     }
                 }
             }
             $record['category'] = '';
             if (varsettrue($this->parent->settings['category'])) {
                 $record['category'] = "<a href='" . e_BASE . "news.php?cat." . $row['news_category_id'] . "'>" . $row['news_category_name'] . "</a>";
             }
             $record['date'] = '';
             if (varsettrue($this->parent->settings['date'])) {
                 $record['date'] = $this->parent->getListDate($row['news_datestamp']);
             }
             $record['info'] = '';
             //collect each result
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
Пример #8
0
 function getListData()
 {
     global $tp, $cobj;
     $list_caption = $this->parent->settings['caption'];
     $list_display = $this->parent->settings['open'] ? "" : "none";
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     $qry = '';
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $qry = "comment_datestamp>" . $this->parent->getlvisit();
     }
     $data = $cobj->getCommentData(intval($this->parent->settings['amount']), '0', $qry);
     if (empty($data)) {
         $list_data = LIST_COMMENT_2;
     } else {
         $list_data = array();
         foreach ($data as $row) {
             $record = array();
             $rowheading = $this->parent->parse_heading($row['comment_title']);
             $record['icon'] = $bullet;
             if ($row['comment_url']) {
                 $record['heading'] = "<a href='" . $row['comment_url'] . "'>" . $this->parent->e107->tp->toHTML($rowheading, true) . "</a>";
             } else {
                 $record['heading'] = $this->parent->e107->tp->toHTML($rowheading, true);
             }
             $category = '';
             if (varsettrue($this->parent->settings['category'])) {
                 if ($row['comment_category_url']) {
                     $record['category'] = "<a href='" . $row['comment_category_url'] . "'>" . $row['comment_category_heading'] . "</a>";
                 } else {
                     $record['category'] = $row['comment_category_heading'];
                 }
             }
             $record['author'] = varsettrue($this->parent->settings['author']) ? $row['comment_author'] : '';
             $record['date'] = varsettrue($this->parent->settings['date']) ? $this->parent->getListDate($row['comment_datestamp']) : "";
             $record['icon'] = $bullet;
             $record['info'] = '';
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
Пример #9
0
function run_updates($dbupdate)
{
    global $mes;
    foreach ($dbupdate as $func => $rmks) {
        if (function_exists('update_' . $func)) {
            $installed = call_user_func("update_" . $func);
            //?! (LAN_UPDATE == $_POST[$func])
            if (varsettrue($_POST['update_core'][$func]) && !$installed) {
                if (function_exists("update_" . $func)) {
                    $message = LAN_UPDATE_7 . " {$rmks}";
                    $error = call_user_func("update_" . $func, "do");
                    if ($error != '') {
                        $mes->add($message, E_MESSAGE_ERROR);
                        $mes->add($error, E_MESSAGE_ERROR);
                    } else {
                        $mes->add($message, E_MESSAGE_SUCCESS);
                    }
                }
            }
        }
    }
}
Пример #10
0
 function sc_tag_options()
 {
     global $tag;
     if (varsettrue($tag->pref['tagwords_view_search']) == 1 || varsettrue($tag->pref['tagwords_view_sort']) == 1 || varsettrue($tag->pref['tagwords_view_style']) == 1 || varsettrue($tag->pref['tagwords_view_area']) == 1) {
         return $this->e107->tp->parseTemplate($tag->template['options'], true, $tag->shortcodes);
     }
 }
Пример #11
0
 function make_def($list)
 {
     switch ($list['type']) {
         case 'key':
             return 'KEY ' . $list['name'] . ' (' . str_replace(array('(', ')'), '', $list['keyfield']) . ')';
         case 'ukey':
             return 'UNIQUE KEY ' . $list['name'] . ' (' . str_replace(array('(', ')'), '', $list['keyfield']) . ')';
         case 'ftkey':
             return 'FULLTEXT KEY ' . $list['name'] . ' (' . str_replace(array('(', ')'), '', $list['keyfield']) . ')';
         case 'pkey':
             return 'PRIMARY KEY (' . $list['name'] . ')';
         case 'field':
             // Require a field - got a key. so add a field at the end
             $def = $list['name'];
             if (isset($list['fieldtype'])) {
                 $def .= ' ' . $list['fieldtype'];
             }
             if (isset($list['vartype'])) {
                 $def .= ' ' . $list['vartype'];
             }
             if (isset($list['nulltype'])) {
                 $def .= ' ' . $list['nulltype'];
             }
             if (isset($list['default'])) {
                 $def .= ' default ' . $list['default'];
             }
             if (varsettrue($list['autoinc'])) {
                 $def .= ' auto_increment';
             }
             return $def;
     }
     return "Cannot generate definition for: " . $list['type'] . ' ' . $list['name'];
 }
Пример #12
0
 function pluginRenderPlugin($pluginList)
 {
     global $plugin;
     if (empty($pluginList)) {
         return '';
     }
     $tp = e107::getParser();
     $frm = e107::getForm();
     $text = "";
     foreach ($pluginList as $plug) {
         e107::loadLanFiles($plug['plugin_path'], 'admin');
         $_path = e_PLUGIN . $plug['plugin_path'] . '/';
         $plug_vars = false;
         $plugin_config_icon = "";
         if ($plugin->parse_plugin($plug['plugin_path'])) {
             $plug_vars = $plugin->plug_vars;
         }
         if (varset($plug['plugin_category']) == "menu") {
             continue;
         }
         if ($plug_vars) {
             $icon_src = (isset($plug_vars['plugin_php']) ? e_PLUGIN : $_path) . $plug_vars['administration']['icon'];
             $plugin_icon = $plug_vars['administration']['icon'] ? "<img src='{$icon_src}' alt='' class='icon S32' />" : E_32_CAT_PLUG;
             $conf_file = "#";
             $conf_title = "";
             if ($plug_vars['administration']['configFile'] && $plug['plugin_installflag'] == true) {
                 $conf_file = e_PLUGIN . $plug['plugin_path'] . '/' . $plug_vars['administration']['configFile'];
                 $conf_title = LAN_CONFIGURE . ' ' . $tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable");
                 $plugin_icon = "<a title='{$conf_title}' href='{$conf_file}' >" . $plugin_icon . "</a>";
                 $plugin_config_icon = "<a title='{$conf_title}' href='{$conf_file}' >" . ADMIN_CONFIGURE_ICON . "</a>";
             }
             $plugEmail = varset($plug_vars['author']['@attributes']['email'], '');
             $plugAuthor = varset($plug_vars['author']['@attributes']['name'], '');
             $plugURL = varset($plug_vars['author']['@attributes']['url'], '');
             $plugDate = varset($plug_vars['@attributes']['date'], '');
             $description = varset($plug_vars['description']['@attributes']['lang']) ? $tp->toHTML($plug_vars['description']['@attributes']['lang'], false, "defs,emotes_off, no_make_clickable") : $tp->toHTML($plug_vars['description']['@value'], false, "emotes_off, no_make_clickable");
             $plugReadme = "";
             if (varset($plug['plugin_installflag'])) {
                 $plugName = "<a title='{$conf_title}' href='{$conf_file}' >" . $tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable") . "</a>";
             } else {
                 $plugName = $tp->toHTML($plug['plugin_name'], false, "defs,emotes_off, no_make_clickable");
             }
             if (varset($plug_vars['readme'])) {
                 $plugReadme = $plug_vars['readme'];
             }
             if (varset($plug_vars['readMe'])) {
                 $plugReadme = $plug_vars['readMe'];
             }
             $text .= "<tr>";
             if (varset($this->fields['plugin_checkboxes'])) {
                 $rowid = "plugin_checkbox[" . $plug['plugin_id'] . "]";
                 $text .= "<td class='center middle'>" . $frm->checkbox($rowid, $plug['plugin_id']) . "</td>\n";
             }
             //	$text .= (in_array("plugin_status",$this->fieldpref)) ? "<td class='center'>".$img."</td>" : "";
             $text .= in_array("plugin_icon", $this->fieldpref) ? "<td class='center middle'>" . $plugin_icon . "</td>" : "";
             $text .= in_array("plugin_name", $this->fieldpref) ? "<td class='middle'>" . $plugName . "</td>" : "";
             $text .= in_array("plugin_version", $this->fieldpref) ? "<td class='middle'>" . $plug['plugin_version'] . "</td>" : "";
             $text .= in_array("plugin_date", $this->fieldpref) ? "<td class='middle'>" . $plugDate . "</td>" : "";
             $text .= in_array("plugin_folder", $this->fieldpref) ? "<td class='middle'>" . $plug['plugin_path'] . "</td>" : "";
             $text .= in_array("plugin_category", $this->fieldpref) ? "<td class='middle'>" . $plug['plugin_category'] . "</td>" : "";
             $text .= in_array("plugin_author", $this->fieldpref) ? "<td class='middle'><a href='mailto:" . $plugEmail . "' title='" . $plugEmail . "'>" . $plugAuthor . "</a>&nbsp;</td>" : "";
             $text .= in_array("plugin_website", $this->fieldpref) ? "<td class='center middle'>" . ($plugURL ? "<a href='{$plugURL}' title='{$plugURL}' >" . ADMIN_URL_ICON . "</a>" : "") . "</td>" : "";
             $text .= in_array("plugin_notes", $this->fieldpref) ? "<td class='center middle'>" . ($plugReadme ? "<a href='" . e_PLUGIN . $plug['plugin_path'] . "/" . $plugReadme . "' title='" . $plugReadme . "'>" . ADMIN_INFO_ICON . "</a>" : "&nbsp;") . "</td>" : "";
             $text .= in_array("plugin_description", $this->fieldpref) ? "<td class='middle'>" . $description . "</td>" : "";
             $text .= in_array("plugin_compatible", $this->fieldpref) ? "<td class='center middle'>" . varset($plug_vars['@attributes']['compatibility'], '') . "</td>" : "";
             $text .= in_array("plugin_compliant", $this->fieldpref) ? "<td class='center middle'>" . (varset($plug_vars['compliant']) || varsettrue($plug_vars['@attributes']['xhtmlcompliant']) ? ADMIN_TRUE_ICON : "&nbsp;") . "</td>" : "";
             // Plugin options Column --------------
             $text .= "<td class='center middle'>" . $plugin_config_icon;
             if ($plug_vars['@attributes']['installRequired']) {
                 if ($plug['plugin_installflag']) {
                     $text .= $plug['plugin_installflag'] ? "<a href=\"" . e_SELF . "?uninstall.{$plug['plugin_id']}\" title='" . EPL_ADLAN_1 . "'  >" . ADMIN_UNINSTALLPLUGIN_ICON . "</a>" : "<a href=\"" . e_SELF . "?install.{$plug['plugin_id']}\" title='" . EPL_ADLAN_0 . "' >" . ADMIN_INSTALLPLUGIN_ICON . "</a>";
                     //   $text .= ($plug['plugin_installflag'] ? "<button type='button' class='delete' value='no-value' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_1."</span></button>" : "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>");
                     if (PLUGIN_SHOW_REFRESH && !varsettrue($plug_vars['plugin_php'])) {
                         $text .= "<br /><br /><input type='button' class='button' onclick=\"location.href='" . e_SELF . "?refresh.{$plug['plugin_id']}'\" title='" . 'Refresh plugin settings' . "' value='" . 'Refresh plugin settings' . "' /> ";
                     }
                 } else {
                     //	$text .=  "<input type='button' class='button' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />";
                     //	$text .= "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>";
                     $text .= "<a href=\"" . e_SELF . "?install.{$plug['plugin_id']}\" title='" . EPL_ADLAN_0 . "' >" . ADMIN_INSTALLPLUGIN_ICON . "</a>";
                 }
             } else {
                 if ($plug_vars['menuName']) {
                     $text .= EPL_NOINSTALL . str_replace("..", "", e_PLUGIN . $plug['plugin_path']) . "/ " . EPL_DIRECTORY;
                 } else {
                     $text .= EPL_NOINSTALL_1 . str_replace("..", "", e_PLUGIN . $plug['plugin_path']) . "/ " . EPL_DIRECTORY;
                     if ($plug['plugin_installflag'] == false) {
                         e107::getDb()->db_Delete('plugin', "plugin_installflag=0 AND (plugin_path='{$plug['plugin_path']}' OR plugin_path='{$plug['plugin_path']}/' )  ");
                     }
                 }
             }
             if ($plug['plugin_version'] != $plug_vars['@attributes']['version'] && $plug['plugin_installflag']) {
                 //	$text .= "<br /><input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."' value='".EPL_UPGRADE."' />";
                 $text .= "<a href='" . e_SELF . "?upgrade.{$plug['plugin_id']}' title=\"" . EPL_UPGRADE . " to v" . $plug_vars['@attributes']['version'] . "\" >" . ADMIN_UPGRADEPLUGIN_ICON . "</a>";
             }
             $text .= "</td>";
             $text .= "</tr>";
         }
     }
     return $text;
 }
Пример #13
0
 function sc_list_displaystyle()
 {
     //open sections if content exists ? yes if true, else use individual setting of section
     return varsettrue($this->list_pref[$this->rc->mode . "_openifrecords"]) && is_array($this->rc->data['records']) ? "" : $this->rc->data['display'];
 }
Пример #14
0
/**
 * 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&current=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 '&amp;'
 * 	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();
    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;
        // 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 ($pref['old_np']) {
            $tprefix = 'default';
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } else {
            $tprefix = 'dropdown';
            //$parm['amount'] = 'all';
        }
        $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]', '&amp;'), $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 %1$d of %2$d' -> match the exact argument, result would be 'Page 1 of 20'
        $e_vars->caption = sprintf(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages);
        // urldecoded by parse_str()
        $pagetitle = explode('|', $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 = sprintf($e_vars_loop->url_label, $c + 1);
                $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' ? NP_3 . '&nbsp;' : $caption;
        while (substr($url, -1) == '.') {
            $url = substr($url, 0, -1);
        }
    }
    if ($total_pages > 1) {
        if (varsettrue($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'] = "[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]";
        $np_parms['prev'] = '&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;';
        $np_parms['next'] = '&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;';
        $np_parms['np_class'] = 'tbox npbutton';
        $np_parms['dropdown_class'] = 'tbox npdropdown';
        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;
    }
}
Пример #15
0
function show_prefs($mailAdmin)
{
    global $pref;
    $e107 = e107::getInstance();
    $frm = e107::getForm();
    $mes = e107::getMessage();
    e107::getCache()->CachePageMD5 = '_';
    $lastload = e107::getCache()->retrieve('emailLastBounce', FALSE, TRUE, TRUE);
    $lastBounce = round((time() - $lastload) / 60);
    $lastBounceText = $lastBounce > 1256474 ? "<b>Never</b>" : "<b>" . $lastBounce . " minutes </b>ago.";
    $text = "\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='mailsettingsform'>\n\t\t<fieldset id='mail'>\n\t\t<legend>" . LAN_MAILOUT_110 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td>" . LAN_MAILOUT_110 . "<br /></td>\n\t\t\t<td>" . $frm->admin_button('testemail', LAN_MAILOUT_112, 'other') . "&nbsp;\n\t\t\t<input name='testaddress' class='tbox' type='text' size='40' maxlength='80' value=\"" . (varset($_POST['testaddress']) ? $_POST['testaddress'] : USEREMAIL) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='vertical-align:top'>" . LAN_MAILOUT_115 . "<br /></td>\n\t\t<td>\n\t\t<select class='tbox' name='mailer' onchange='disp(this.value)'>\n";
    $mailers = array('php', 'smtp', 'sendmail');
    foreach ($mailers as $opt) {
        $sel = $pref['mailer'] == $opt ? "selected='selected'" : '';
        $text .= "<option value='{$opt}' {$sel}>{$opt}</option>\n";
    }
    $text .= "</select> <span class='field-help'>" . LAN_MAILOUT_116 . "</span><br />";
    // SMTP. -------------->
    $smtp_opts = explode(',', varset($pref['smtp_options'], ''));
    $smtpdisp = $pref['mailer'] != 'smtp' ? "style='display:none;'" : '';
    $text .= "<div id='smtp' {$smtpdisp}>\n\t\t<table class='table adminlist' style='margin-right:auto;margin-left:0px;border:0px'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t";
    $text .= "\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_87 . ":&nbsp;&nbsp;</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 . ":&nbsp;(" . LAN_OPTIONAL . ")&nbsp;&nbsp;</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 . ":&nbsp;(" . LAN_OPTIONAL . ")&nbsp;&nbsp;</td>\n\t\t<td>\n\t\t<input class='tbox' type='password' name='smtp_password' size='40' value='" . $pref['smtp_password'] . "' maxlength='50' />\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . LAN_MAILOUT_90 . "</td><td>\n\t\t<select class='tbox' name='smtp_options'>\n\n\t\t<option value=''>" . LAN_MAILOUT_96 . "</option>\n";
    $selected = in_array('secure=SSL', $smtp_opts) ? " selected='selected'" : '';
    $text .= "<option value='smtp_ssl'{$selected}>" . LAN_MAILOUT_92 . "</option>\n";
    $selected = in_array('secure=TLS', $smtp_opts) ? " selected='selected'" : '';
    $text .= "<option value='smtp_tls'{$selected}>" . LAN_MAILOUT_93 . "</option>\n";
    $selected = in_array('pop3auth', $smtp_opts) ? " selected='selected'" : '';
    $text .= "<option value='smtp_pop3auth'{$selected}>" . LAN_MAILOUT_91 . "</option>\n";
    $text .= "</select>\n<br />" . LAN_MAILOUT_94 . "</td></tr>";
    $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_57 . "</td><td>\n\t\t";
    $checked = varsettrue($pref['smtp_keepalive']) ? "checked='checked'" : '';
    $text .= "<input type='checkbox' name='smtp_keepalive' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>";
    $checked = in_array('useVERP', $smtp_opts) ? "checked='checked'" : "";
    $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_95 . "</td><td>\n\t\t<input type='checkbox' name='smtp_useVERP' value='1' {$checked} />\n\t\t</td>\n\t\t</tr>\n\t\t</table></div>";
    /* FIXME - posting SENDMAIL path triggers Mod-Security rules. 
    // Sendmail. -------------->
    	$senddisp = ($pref['mailer'] != 'sendmail') ? "style='display:none;'" : '';
    	$text .= "<div id='sendmail' {$senddisp}><table style='margin-right:0px;margin-left:auto;border:0px'>";
    	$text .= "
    	<tr>
    	<td>".LAN_MAILOUT_20.":&nbsp;&nbsp;</td>
    	<td>
    	<input class='tbox' type='text' name='sendmail' size='60' value=\"".(!$pref['sendmail'] ? "/usr/sbin/sendmail -t -i -r ".$pref['siteadminemail'] : $pref['sendmail'])."\" maxlength='80' />
    	</td>
    	</tr>
    
    	</table></div>";
    */
    $text .= "</td>\n\t</tr>\n\n\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_222 . "</td>\n\t\t<td>";
    $text .= $mailAdmin->sendStyleSelect(varset($pref['mail_sendstyle'], 'textonly'), 'mail_sendstyle');
    $text .= "<span class='field-help'>" . LAN_MAILOUT_223 . "</span>\n\t\t</td>\n\t</tr>\n\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_25 . "</td>\n\t\t<td> " . LAN_MAILOUT_26 . "\n\t\t<input class='tbox e-spinner' size='3' type='text' name='mail_pause' value='" . $pref['mail_pause'] . "' /> " . LAN_MAILOUT_27 . "<input class='tbox e-spinner' size='3' type='text' name='mail_pausetime' value='" . $pref['mail_pausetime'] . "' /> " . LAN_MAILOUT_29 . ".<br />\n\t\t<span class='field-help'>" . LAN_MAILOUT_30 . "</span>\n\t\t</td>\n\t</tr>\n\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_156 . "</td>\n\t\t<td><input class='tbox e-spinner' size='3' type='text' name='mail_workpertick' value='" . varset($pref['mail_workpertick'], 5) . "' />\n\t\t<span class='field-help'>" . LAN_MAILOUT_157 . "</span>\n\t\t</td>\n\t</tr>\n";
    if (isset($pref['e_mailout_list'])) {
        // Allow selection of email address sources
        $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_77 . "</td>\n\t\t<td> \n\t  ";
        $mail_enable = explode(',', $pref['mailout_enabled']);
        foreach ($pref['e_mailout_list'] as $mailer => $v) {
            $check = in_array($mailer, $mail_enable) ? "checked='checked'" : "";
            $text .= "&nbsp;<input type='checkbox' name='mail_mailer_enabled[]' value='{$mailer}' {$check} /> {$mailer}<br />";
        }
        $text .= "</td></tr>\n";
    }
    list($mail_log_option, $mail_log_email) = explode(',', varset($pref['mail_log_options'], '0,0'));
    $check = $mail_log_email == 1 ? " checked='checked'" : "";
    $text .= "<tr>\n\t\t<td>" . LAN_MAILOUT_72 . "</td>\n\t\t<td> \n\t\t<select class='tbox' name='mail_log_option'>\n\n\t\t<option value='0'" . ($mail_log_option == 0 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_73 . "</option>\n\n\t\t<option value='1'" . ($mail_log_option == 1 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_74 . "</option>\n\n\t\t<option value='2'" . ($mail_log_option == 2 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_75 . "</option>\n\n\t\t<option value='3'" . ($mail_log_option == 3 ? " selected='selected'" : '') . ">" . LAN_MAILOUT_119 . "</option>\n\n\t\t</select>\n\n\t\t<input type='checkbox' name='mail_log_email' value='1' {$check} />" . LAN_MAILOUT_76 . "</td>\n\t</tr>\n";
    $text .= "</table></fieldset>\n\t<fieldset id='core-mail-prefs-bounce'>\n\t\t<legend>" . LAN_MAILOUT_31 . "</legend>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_231 . "</td><td>";
    // bounce divs = mail_bounce_none, mail_bounce_auto, mail_bounce_mail
    $autoDisp = $pref['mail_bounce'] != 'auto' ? "style='display:none;'" : '';
    $autoMail = $pref['mail_bounce'] != 'mail' ? "style='display:none;'" : '';
    $bounceOpts = array('none' => LAN_MAILOUT_232, 'auto' => LAN_MAILOUT_233, 'mail' => LAN_MAILOUT_234);
    $text .= "<select name='mail_bounce' class='tbox' onchange='bouncedisp(this.value)'>\n<option value=''>&nbsp;</option>\n";
    foreach ($bounceOpts as $k => $v) {
        $selected = $pref['mail_bounce'] == $k ? " selected='selected'" : '';
        $text .= "<option value='{$k}'{$selected}>{$v}</option>\n";
    }
    $text .= "</select>\n</td>\n\t</tr></tbody></table>\n\n\n\t\t<table class='adminform' id='mail_bounce_auto' {$autoDisp}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr><td>" . LAN_MAILOUT_32 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_email2' value=\"" . $pref['mail_bounce_email'] . "\" /></td></tr>\n\t\n\t<tr>\n\t\t<td>" . LAN_MAILOUT_233 . "</td><td><b>" . e_DOCROOT . e107::getFolder('handlers') . "bounce_handler.php</b>";
    if (!is_readable(e_HANDLER . 'bounce_handler.php')) {
        $text .= "<br /><span class='required'>" . LAN_MAILOUT_161 . '</span>';
    } elseif (!is_executable(e_HANDLER . 'bounce_handler.php')) {
        $text .= "<br /><span class='required'>" . LAN_MAILOUT_162 . '</span>';
    }
    $text .= "<br /><span class='field-help'>" . LAN_MAILOUT_235 . "</span></td></tr>\n\t<tr><td>" . LAN_MAILOUT_236 . "</td><td>" . $lastBounceText . "</td></tr>\n\t</tbody></table>";
    // Parameters for mail-account based bounce processing
    $text .= "\n\t\t<table class='table adminform' id='mail_bounce_mail' {$autoMail}>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t<tbody>\n\t\t<tr><td>" . LAN_MAILOUT_32 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_email' value=\"" . $pref['mail_bounce_email'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_33 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pop3' value=\"" . $pref['mail_bounce_pop3'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_34 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_user' value=\"" . $pref['mail_bounce_user'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_35 . "</td><td><input class='tbox' size='40' type='text' name='mail_bounce_pass' value=\"" . $pref['mail_bounce_pass'] . "\" /></td></tr>\n\t\t<tr><td>" . LAN_MAILOUT_120 . "</td><td><select class='tbox' name='mail_bounce_type'>\n\n\t\t\t<option value=''>&nbsp;</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'>&nbsp;" . LAN_MAILOUT_246 . "</span></td></tr>\n\n\t</tbody>\n\t</table></fieldset>\n\n\t<div class='buttons-bar center'>" . $frm->admin_button('updateprefs', LAN_MAILOUT_28, 'update') . "</div>\n\n\t</form>";
    $caption = ADLAN_136 . ' :: ' . LAN_PREFS;
    $e107->ns->tablerender($caption, $mes->render() . $text);
}
Пример #16
0
 /**
  * Detect a Language Change
  * 1. Parked (sub)Domain		eg. http://es.mydomain.com (Preferred for SEO)
  * 2. e_MENU Query			eg. /index.php?[es]
  * 3. $_GET['elan']			eg. /index.php?elan=es
  * 4. $_POST['sitelanguage']	eg. <input type='hidden' name='sitelanguage' value='Spanish' /> 
  * 5. $GLOBALS['elan']		eg. <?php $GLOBALS['elan']='es' (deprecated) 
  * 
  * @param boolean $force force detection, don't use cached value
  */
 function detect($force = false)
 {
     global $pref;
     if (false !== $this->detect && !$force) {
         return $this->detect;
     }
     $this->_cookie_domain = '';
     if (varsettrue($pref['multilanguage_subdomain']) && $this->isLangDomain(e_DOMAIN) && defset('MULTILANG_SUBDOMAIN') !== FALSE) {
         $detect_language = e_SUBDOMAIN ? $this->isValid(e_SUBDOMAIN) : $pref['sitelanguage'];
         // Done in session handler now, based on MULTILANG_SUBDOMAIN value
         //e107_ini_set("session.cookie_domain", ".".e_DOMAIN); // Must be before session_start()
         $this->_cookie_domain = "." . e_DOMAIN;
         define('MULTILANG_SUBDOMAIN', TRUE);
     } elseif (e_MENU && ($detect_language = $this->isValid(e_MENU))) {
         define("e_LANCODE", TRUE);
     } elseif (isset($_GET['elan']) && ($detect_language = $this->isValid($_GET['elan']))) {
         // Do nothing
     } elseif (isset($_POST['setlanguage']) && ($detect_language = $this->isValid($_POST['sitelanguage']))) {
         // Do nothing
     } elseif (isset($GLOBALS['elan']) && ($detect_language = $this->isValid($GLOBALS['elan']))) {
         // Do nothing
     } else {
         $detect_language = FALSE;
         // ie. No Change.
     }
     // Done in session handler now
     // e107_ini_set("session.cookie_path", e_HTTP);
     $this->detect = $detect_language;
     return $detect_language;
 }
Пример #17
0
 function clean_links($link_items)
 {
     if (empty($link_items)) {
         return;
     }
     foreach ($link_items as $key => $value) {
         if (!varsettrue($value['link_url'])) {
             unset($link_items[$key]);
         }
     }
     return $link_items;
 }
Пример #18
0
 * $Author$
 *
*/
/**
 *	Menu for list_new plugin
 *
 *	@package e107_plugins
 *	@subpackage list_new
 */
if (!defined('e107_INIT')) {
    exit;
}
if (!plugInstalled('list_new')) {
    return;
}
unset($text);
global $rc;
if (!is_object($rc)) {
    require_once e_PLUGIN . "list_new/list_class.php";
    $rc = new listclass();
}
//set mode
$rc->mode = "new_menu";
//parse menu
$text = $rc->displayMenu();
$caption = varsettrue($rc->list_pref[$rc->mode . "_caption"], LIST_MENU_1);
$caption = $rc->e107->tp->toHtml($caption, FALSE, 'USER_TITLE');
$text = $rc->e107->tp->toHtml($text, TRUE, 'USER_BODY');
$rc->e107->ns->tablerender($caption, $text, 'list_new');
unset($caption);
unset($text);
Пример #19
0
 /**
  * Shortcodes - simple field getter (basic formatting)
  * THIS IS ONLY TEST, maybe useful for fields requiring simple formatting - it's a way too complicated for designers,
  * could be inner used inside the rest of news SCs.
  *
  * @param string $news_field name without the leading 'news_' prefix
  * @param mixed $default
  * @return string field value
  */
 public function sc_news_field($parm = '')
 {
     $tmp = explode('|', $parm, 2);
     $field = $tmp[0];
     if (!is_array($parm)) {
         parse_str(varset($tmp[1]), $parm);
     }
     $val = $this->field($field, '');
     //do more with $parm array, just an example here
     if (varsettrue($parm['format'])) {
         switch ($parm['format']) {
             //USAGE: {NEWS_FIELD=body|format=html&arg=1,BODY} -> callback e107->toHTML($value, true, 'BODY');
             case 'html':
                 $method = 'toHTML';
                 $callback = e107::getParser();
                 $parm['arg'] = explode(',', varset($parm['arg']));
                 $parm['arg'][0] = varsettrue($parm['arg'][0]) ? true : false;
                 //to boolean
                 $params = array($val);
                 //value is always the first callback argument
                 $params += $parm['arg'];
                 break;
                 //USAGE: {NEWS_FIELD=body|format=html_truncate&arg=200,...} -> callback e107->html_truncate($value, 200, '...');
             //USAGE: {NEWS_FIELD=body|format=html_truncate&arg=200,...} -> callback e107->html_truncate($value, 200, '...');
             case 'html_truncate':
                 $val = e107::getParser()->toHTML($val, true);
                 //USAGE: {NEWS_FIELD=title|format=text_truncate&arg=100,...} -> callback e107->text_truncate($value, 200, '...');
             //USAGE: {NEWS_FIELD=title|format=text_truncate&arg=100,...} -> callback e107->text_truncate($value, 200, '...');
             case 'text_truncate':
                 $method = $parm['format'];
                 $callback = e107::getParser();
                 $params = array($val);
                 //value is always the first callback argument
                 $params = array_merge($params, explode(',', $parm['arg']));
                 break;
                 //USAGE: {NEWS_FIELD=title|format=date} -> strftime($pref[shortdate], $value);
                 //USAGE: {NEWS_FIELD=title|format=date&arg=%Y} -> strftime('%Y', $value);
             //USAGE: {NEWS_FIELD=title|format=date} -> strftime($pref[shortdate], $value);
             //USAGE: {NEWS_FIELD=title|format=date&arg=%Y} -> strftime('%Y', $value);
             case 'date':
                 $method = $parm['format'];
                 $callback = e107::getParser();
                 $params = array($val);
                 //value is always the first callback argument
                 $params = array_merge($params, explode(',', $parm['arg']));
                 //should be done with date handler (awaiting for modifications)
                 return strftime(varset($parm['arg'], e107::getPref('shortdate')), $val);
                 break;
             default:
                 return $val;
                 break;
         }
         return call_user_func_array(array($callback, $method), $params);
     }
     return $val;
 }
Пример #20
0
 function toHTML($code_text, $parm)
 {
     $tp = e107::getParser();
     $pref = e107::getPref();
     $class = e107::getBB()->getClass('img');
     if (trim($code_text) == "") {
         return "";
     }
     // Do nothing on empty file
     if (preg_match("#\\.php\\?.*#", $code_text)) {
         return "";
     }
     $addlink = FALSE;
     // Automatic Img Resizing --
     $w = e107::getBB()->resizeWidth();
     // varies depending on the class set by external script. see admin->media-manager->prefs
     $h = e107::getBB()->resizeHeight();
     if (strpos($code_text, "://") == false && ($w || $h)) {
         $code_text = $tp->thumbUrl($code_text, 'w=' . $w . '&h=' . $h);
     }
     // ------------------------
     $search = array('"', '{E_IMAGE}', '{E_FILE}', '{e_IMAGE}', '{e_FILE}');
     $replace = array('&#039;', e_IMAGE_ABS, e_FILE_ABS, e_IMAGE_ABS, e_FILE_ABS);
     $replaceInt = array('&#039;', e_IMAGE, e_FILE, e_IMAGE, e_FILE);
     $intName = str_replace($search, $replaceInt, $code_text);
     // Server-relative file names
     unset($imgParms);
     $imgParms['class'] = "bbcode {$class}";
     //  This will be overridden if a new class is specified
     $imgParms['alt'] = '';
     $code_text = str_replace($search, $replace, $code_text);
     $code_text = $tp->toAttribute($code_text);
     $img_file = pathinfo($code_text);
     // 'External' file name. N.B. - might still contain a constant such as e_IMAGE
     if ($parm) {
         $parm = preg_replace('#onerror *=#i', '', $parm);
         $parm = str_replace("amp;", "&", $parm);
         parse_str($parm, $tmp);
         foreach ($tmp as $p => $v) {
             $imgParms[$p] = $v;
         }
     }
     $parmStr = "";
     foreach ($imgParms as $k => $v) {
         $parmStr .= $tp->toAttribute($k) . "='" . $tp->toAttribute($v) . "' ";
     }
     // Select a random file if required
     if (strpos($img_file['basename'], '*') !== FALSE) {
         $fileList = array();
         $intFile = pathinfo($intName);
         // N.B. - might still contain a constant such as e_IMAGE
         $matchString = '#' . str_replace('*', '.*?', $intFile['basename']) . '#';
         $dirName = $tp->replaceConstants($intFile['dirname'] . '/');
         // we want server-relative directory
         if (($h = opendir($dirName)) !== FALSE) {
             while (($f = readdir($h)) !== FALSE) {
                 if (preg_match($matchString, $f)) {
                     $fileList[] = $f;
                     // Just need to note file names
                 }
             }
             closedir($h);
         } else {
             echo "Error opening directory: {$dirName}<br />";
             return '';
         }
         if (count($fileList)) {
             $img_file['basename'] = $fileList[mt_rand(0, count($fileList) - 1)];
             // Just change name of displayed file - no change on directory
             $code_text = $img_file['dirname'] . "/" . $img_file['basename'];
         } else {
             echo 'No file: ' . $code_text;
             return '';
         }
     }
     // Check for whether we can display image down here - so we can show image name if appropriate
     if (!varsettrue($pref['image_post']) || !check_class($pref['image_post_class'])) {
         switch ($pref['image_post_disabled_method']) {
             case '1':
                 return CORE_LAN17;
             case '2':
                 return '';
         }
         return CORE_LAN18 . $code_text;
     }
     // Check for link to main image if required
     if (strpos($img_file['basename'], 'th_') === 0) {
         $addlink = TRUE;
         $main_name = $img_file['dirname'] . "/" . substr($img_file['basename'], 3);
         // delete the 'th' prefix from file name
     } elseif (strpos($img_file['basename'], 'thumb_') === 0) {
         $addlink = TRUE;
         $main_name = $img_file['dirname'] . "/" . substr($img_file['basename'], 6);
         // delete the 'thumb' prefix from file name
     }
     if ($addlink) {
         return "<a href='" . $main_name . "' rel='external'><img src='" . $code_text . "' {$parmStr} /></a>";
     } else {
         return "<img src='" . $code_text . "' {$parmStr} />";
     }
 }
Пример #21
0
     header("location:" . e_BASE . "index.php");
     exit;
 }
 $submitnews_user = USER ? USERNAME : trim($tp->toDB($_POST['submitnews_name']));
 $submitnews_email = USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email'])));
 $submitnews_title = $tp->toDB($_POST['submitnews_title']);
 $submitnews_item = $tp->toDB($_POST['submitnews_item']);
 $submitnews_item = str_replace("src=&quot;e107_images", "src=&quot;" . SITEURL . "e107_images", $submitnews_item);
 $submitnews_file = "";
 $submitnews_error = FALSE;
 if (!$submitnews_user || !$submitnews_email) {
     $message = SUBNEWSLAN_7;
     $submitnews_error = TRUE;
 }
 // ==== Process File Upload ====
 if (FILE_UPLOADS && $_FILES['file_userfile'] && varsettrue($pref['subnews_attach']) && varsettrue($pref['upload_enabled']) && check_class($pref['upload_class'])) {
     require_once e_HANDLER . 'upload_handler.php';
     $uploaded = process_uploaded_files(e_UPLOAD, FALSE, array('file_mask' => 'jpg,gif,png', 'max_file_count' => 1));
     if ($uploaded === FALSE || !is_array($uploaded)) {
         // Non-specific error
         $submitnews_error = TRUE;
         $message = SUBNEWSLAN_8;
     } else {
         $submitnews_filearray = array();
         foreach ($uploaded as $c => $v) {
             if (varset($uploaded[$c]['error'], 0) != 0) {
                 $submitnews_error = TRUE;
                 $message = handle_upload_messages($uploaded);
             } else {
                 if (isset($uploaded[$c]['name']) && isset($uploaded[$c]['type']) && isset($uploaded[$c]['size'])) {
                     $filename = $uploaded[$c]['name'];
Пример #22
0
require_once e_ADMIN . 'auth.php';
require_once e_HANDLER . 'message_handler.php';
// require_once(e_HANDLER.'user_handler.php'); //use e107::getUserSession() instead.
require_once e_HANDLER . 'validator_class.php';
$userMethods = e107::getUserSession();
$emessage = e107::getMessage();
$frm = e107::getForm();
if (isset($_POST['update_settings'])) {
    if ($_POST['ac'] == md5(ADMINPWCHANGE)) {
        $userData = array();
        $userData['data'] = array();
        if ($_POST['a_password'] != '' && $_POST['a_password2'] != '' && $_POST['a_password'] == $_POST['a_password2']) {
            $userData['data']['user_password'] = $sql->escape($userMethods->HashPassword($_POST['a_password'], $currentUser['user_loginname']), FALSE);
            unset($_POST['a_password']);
            unset($_POST['a_password2']);
            if (varsettrue($pref['allowEmailLogin'])) {
                $user_prefs = unserialize($currentUser['user_prefs']);
                $user_prefs['email_password'] = $userMethods->HashPassword($new_pass, $email);
                $userData['data']['user_prefs'] = serialize($user_prefs);
            }
            $userData['data']['user_pwchange'] = time();
            $userData['WHERE'] = 'user_id=' . USERID;
            validatorClass::addFieldTypes($userMethods->userVettingInfo, $userData, $userMethods->otherFieldTypes);
            $check = $sql->db_Update('user', $userData);
            if ($check) {
                $admin_log->log_event('ADMINPW_01', '', E_LOG_INFORMATIVE, '');
                $userMethods->makeUserCookie(array('user_id' => USERID, 'user_password' => $userData['data']['user_password']), FALSE);
                // Can't handle autologin ATM
                $emessage->add(UDALAN_3 . " " . ADMINNAME, E_MESSAGE_SUCCESS);
                $e_event->trigger('adpword');
                $ns->tablerender(UDALAN_2, $emessage->render());
Пример #23
0
 public static function dbValidateArray(&$targetData, &$definitions, $targetTable, $userID = 0)
 {
     global $pref;
     $u_sql = new db();
     $allOK = TRUE;
     $userID = intval($userID);
     // Precautionary
     $errMsg = '';
     if (!$targetTable) {
         return FALSE;
     }
     foreach ($targetData['data'] as $f => $v) {
         $errMsg = '';
         if (isset($definitions[$f])) {
             $options = $definitions[$f];
             // Validation options to use
             if (!varsettrue($options['fieldOptional']) || $v != '') {
                 $toDo = explode(',', $options['vetMethod']);
                 foreach ($toDo as $vm) {
                     switch ($vm) {
                         case 0:
                             // Shouldn't get this - just do nothing if we do
                             break;
                         case 1:
                             // Check for duplicates.
                             if ($v == '') {
                                 $errMsg = ERR_MISSING_VALUE;
                                 break;
                             }
                             $field = varset($options['dbFieldName'], $f);
                             if ($temp = $u_sql->db_Count($targetTable, "(*)", "WHERE `{$f}`='" . $v . "' AND `user_id` != " . $userID)) {
                                 $errMsg = ERR_DUPLICATE;
                             }
                             //								echo "Duplicate check: {$f} = {$v} Result: {$temp}<br />";
                             break;
                         case 2:
                             // Check against $pref
                             if (isset($options['vetParam']) && isset($pref[$options['vetParam']])) {
                                 $tmp = explode(",", $pref[$options['vetParam']]);
                                 foreach ($tmp as $disallow) {
                                     if ('!' == substr(trim($disallow), -1) && $v == str_replace('!', '', $disallow)) {
                                         // Exact match search (noticed with exclamation mark in the end of the word)
                                         $errMsg = ERR_DISALLOWED_TEXT_EXACT_MATCH;
                                     } elseif (stristr($v, trim($disallow))) {
                                         // Wild card search
                                         $errMsg = ERR_DISALLOWED_TEXT;
                                     }
                                 }
                                 unset($tmp);
                             }
                             break;
                         case 3:
                             // Check email address against remote server
                             if (varsettrue($pref['signup_remote_emailcheck'])) {
                                 require_once e_HANDLER . "mail_validation_class.php";
                                 list($adminuser, $adminhost) = split("@", SITEADMINEMAIL);
                                 $validator = new email_validation_class();
                                 $validator->localuser = $adminuser;
                                 $validator->localhost = $adminhost;
                                 $validator->timeout = 3;
                                 //	$validator->debug=1;
                                 //	$validator->html_debug=1;
                                 if ($validator->ValidateEmailBox(trim($v)) != 1) {
                                     $errMsg = ERR_INVALID_EMAIL;
                                 }
                             }
                             break;
                         default:
                             echo 'Invalid vetMethod: ' . $options['vetMethod'] . '<br />';
                             // Really a debug aid - should never get here
                     }
                     if ($errMsg) {
                         break;
                     }
                     // Just trap first error
                 }
                 // Add in other validation methods here
             }
         }
         if ($errMsg) {
             // Update the error
             $targetData['errors'][$f] = $errMsg;
             $targetData['failed'][$f] = $v;
             unset($targetData['data'][$f]);
             // Remove the valid entry
             $allOK = FALSE;
         }
     }
     return $allOK;
 }
Пример #24
0
 public function arraySet($paramlist)
 {
     if (isset($paramlist['SMTPDebug'])) {
         $this->SMTPDebug = $paramlist['SMTPDebug'];
     }
     // 'FALSE' is a valid value!
     if (varsettrue($paramlist['mail_subject'])) {
         $this->Subject = $paramlist['mail_subject'];
     }
     if (varsettrue($paramlist['mail_sender_email'])) {
         $this->From = $paramlist['mail_sender_email'];
     }
     if (varsettrue($paramlist['mail_sender_name'])) {
         $this->FromName = $paramlist['mail_sender_name'];
     }
     if (varsettrue($paramlist['mail_replyto'])) {
         $this->AddAddressList('replyto', $paramlist['mail_replyto'], varsettrue($paramlist['mail_replytonames'], ''));
     }
     if (isset($paramlist['send_html'])) {
         $this->allow_html = $paramlist['send_html'];
     }
     // 'FALSE' is a valid value!
     if (isset($paramlist['add_html_header'])) {
         $this->add_HTML_header = $paramlist['add_html_header'];
     }
     // 'FALSE' is a valid value!
     if (varsettrue($paramlist['mail_body'])) {
         $this->makeBody($paramlist['mail_body'], $this->allow_html, $this->add_HTML_header);
     }
     if (varsettrue($paramlist['mail_attach'])) {
         $this->attach($paramlist['mail_attach']);
     }
     if (varsettrue($paramlist['mail_copy_to'])) {
         $this->AddAddressList('cc', $paramlist['mail_copy_to'], varsettrue($paramlist['mail_cc_names'], ''));
     }
     if (varsettrue($paramlist['mail_bcopy_to'])) {
         $this->AddAddressList('bcc', $paramlist['mail_bcopy_to'], varsettrue($paramlist['mail_bcc_names'], ''));
     }
     if (varsettrue($paramlist['bouncepath'])) {
         $this->Sender = $paramlist['bouncepath'];
         // Bounce path
         $this->save_bouncepath = $paramlist['bouncepath'];
         // Bounce path
     }
     if (varsettrue($paramlist['returnreceipt'])) {
         $this->ConfirmReadingTo = $paramlist['returnreceipt'];
     }
     if (varsettrue($paramlist['mail_inline_images'])) {
         $this->addInlineImages($paramlist['mail_inline_images']);
     }
     if (varsettrue($paramlist['mail_priority'])) {
         $this->Priority = $paramlist['mail_priority'];
     }
     if (varsettrue($paramlist['e107_header'])) {
         $this->AddCustomHeader("X-e107-id: {$paramlist['e107_header']}");
     }
     if (varsettrue($paramlist['extra_header'])) {
         if (is_array($paramlist['extra_header'])) {
             foreach ($paramlist['extra_header'] as $eh) {
                 $this->addCustomHeader($eh);
             }
         } else {
             $this->addCustomHeader($paramlist['extra_header']);
         }
     }
     if (varset($paramlist['wordwrap'])) {
         $this->WordWrap = $paramlist['wordwrap'];
     }
     if (varsettrue($paramlist['split'])) {
         $this->SingleTo = $paramlist['split'] != FALSE;
     }
     return 0;
     // No error
 }
Пример #25
0
    } elseif ($total_read_threads != 0) {
        $fVars->INFO .= " (" . LAN_196 . $total_read_threads . LAN_197 . ")";
    }
    $fVars->INFO .= "<br />\n\t" . LAN_36 . " " . $lastvisit_datestamp . "<br />\n\t" . LAN_37 . " " . $datestamp;
} else {
    $fVars->INFO .= '';
    if (ANON == TRUE) {
        $fVars->INFO .= LAN_410 . '<br />' . LAN_44 . " <a href='" . e_SIGNUP . "'>" . LAN_437 . "</a> " . LAN_438;
    } elseif (USER == FALSE) {
        $fVars->INFO .= LAN_410 . '<br />' . LAN_45 . " <a href='" . e_SIGNUP . "'>" . LAN_439 . "</a> " . LAN_440;
    }
}
if (USER && $allread != TRUE && $total_new_threads && $total_new_threads >= $total_read_threads) {
    $fVars->INFO .= "<br /><a href='" . e_SELF . "?mark.all.as.read'>" . LAN_199 . '</a>' . (e_QUERY != 'new' ? ", <a href='" . e_SELF . "?new'>" . LAN_421 . "</a>" : '');
}
if (USER && varsettrue($forum->prefs->get('track')) && e_QUERY != 'track') {
    $fVars->INFO .= "<br /><a href='" . e_SELF . "?track'>" . LAN_393 . '</a>';
}
$fVars->FORUMINFO = LAN_192 . ($total_topics + $total_replies) . ' ' . LAN_404 . " ({$total_topics} " . ($total_topics == 1 ? LAN_411 : LAN_413) . ", {$total_replies} " . ($total_replies == 1 ? LAN_412 : LAN_414) . ")." . (!defined("e_TRACKING_DISABLED") ? "" : "<br />" . $users . " " . ($users == 1 ? LAN_415 : LAN_416) . " (" . $member_users . " " . ($member_users == 1 ? LAN_417 : LAN_419) . ", " . $guest_users . " " . ($guest_users == 1 ? LAN_418 : LAN_420) . ")<br />" . LAN_42 . $total_members . "<br />" . LAN_41 . "<a href='" . e_BASE . "user.php?id." . $nuser_id . "'>" . $nuser_name . "</a>.\n");
if (!isset($FORUM_MAIN_START)) {
    if (file_exists(THEME . 'forum_template.php')) {
        include_once THEME . 'forum_template.php';
    }
}
include e_PLUGIN . 'forum/templates/forum_template.php';
require_once HEADERF;
$forumList = $forum->forumGetForumList();
$newflag_list = $forum->forumGetUnreadForums();
if (!$forumList) {
    $ns->tablerender(PAGE_NAME, "<div style='text-align:center'>" . LAN_51 . '</div>', array('forum', '51'));
    require_once FOOTERF;
Пример #26
0
}
switch ($action) {
    case 'filetypes':
        if (!getperms('0')) {
            exit;
        }
        $definition_source = UPLLAN_58;
        $source_file = '';
        $edit_upload_list = varset($_POST['upload_do_edit'], FALSE);
        if (isset($_POST['generate_filetypes_xml'])) {
            // Write back edited data to filetypes_.xml
            $file_text = "<e107Filetypes>\n";
            foreach ($_POST['file_class_select'] as $k => $c) {
                if (!isset($_POST['file_line_delete_' . $c]) && varsettrue($_POST['file_type_list'][$k])) {
                    //		  echo "Key: {$k} Class: {$c}  Delete: {$_POST['file_line_delete'][$k]}  List: {$_POST['file_type_list'][$k]}  Size: {$_POST['file_maxupload'][$k]}<br />";
                    $file_text .= "    <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='" . varsettrue($_POST['file_maxupload'][$k], ini_get('upload_max_filesize')) . "' />\n";
                }
            }
            $file_text .= "</e107Filetypes>\n";
            if (($handle = fopen(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, 'wt')) == FALSE || fwrite($handle, $file_text) == FALSE || fclose($handle) == FALSE) {
                $text = UPLLAN_61 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES;
            } else {
                $text = '';
                $text .= '<br />' . UPLLAN_59 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES . '. ' . UPLLAN_60 . e_ADMIN . e_READ_FILETYPES . '<br />';
            }
            $ns->tablerender(UPLLAN_49, $text);
        }
        $current_perms = array();
        if ($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES) || !$edit_upload_list && is_readable(e_ADMIN . e_READ_FILETYPES)) {
            $xml = e107::getXml();
            $source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES : e_ADMIN . e_READ_FILETYPES;
Пример #27
0
 /**
  * Converts the text (presumably retrieved from the database) for HTML output.
  *
  * @param string $text
  * @param boolean $parseBB [optional]
  * @param string $modifiers [optional] TITLE|SUMMARY|DESCRIPTION|BODY|RAW|LINKTEXT etc.
  *		Comma-separated list, no spaces allowed
  *		first modifier must be a CONTEXT modifier, in UPPER CASE.
  *		subsequent modifiers are lower case - see $this->e_Modifiers for possible values
  * @param mixed $postID [optional]
  * @param boolean $wrap [optional]
  * @return string
  * @todo complete the documentation of this essential method
  */
 public function toHTML($text, $parseBB = FALSE, $modifiers = '', $postID = '', $wrap = FALSE)
 {
     if ($text == '') {
         return $text;
     }
     global $pref, $fromadmin;
     // Set default modifiers to start
     $opts = $this->e_optDefault;
     // Now process any modifiers that are specified
     if ($modifiers) {
         $aMods = explode(',', $modifiers);
         // If there's a supermodifier, it must be first, and in uppercase
         $psm = trim($aMods[0]);
         if (isset($this->e_SuperMods[$psm])) {
             // Supermodifier found - override default values where necessary
             $opts = array_merge($opts, $this->e_SuperMods[$psm]);
             $opts['context'] = $psm;
             unset($aMods[0]);
         }
         // Now find any regular modifiers; use them to modify the context
         // (there should only be one or two out of the list of possibles)
         foreach ($aMods as $mod) {
             // Slight concession to varying coding styles - stripping spaces is a waste of CPU cycles!
             $mod = trim($mod);
             if (isset($this->e_Modifiers[$mod])) {
                 // This is probably quicker than array_merge
                 // - especially as usually only one or two loops
                 foreach ($this->e_Modifiers[$mod] as $k => $v) {
                     // Update our context-specific options
                     $opts[$k] = $v;
                 }
             }
         }
     }
     // Turn off a few things if not enabled in options
     if (!varsettrue($pref['smiley_activate'])) {
         $opts['emotes'] = FALSE;
     }
     if (!varsettrue($pref['make_clickable'])) {
         $opts['link_click'] = FALSE;
     }
     if (!varsettrue($pref['link_replace'])) {
         $opts['link_replace'] = FALSE;
     }
     $fromadmin = $opts['fromadmin'];
     // Convert defines(constants) within text. eg. Lan_XXXX - must be the entire text string (i.e. not embedded)
     // The check for '::' is a workaround for a bug in the Zend Optimiser 3.3.0 and PHP 5.2.4 combination
     // - causes crashes if '::' in site name
     //TODO - marj - find a way to use language method here XOR remove the limit of 24 characters.
     if ($opts['defs'] && strlen($text) < 25 && (strpos($text, '::') === FALSE && defined(trim($text)))) {
         return constant(trim($text));
     }
     if ($opts['no_tags']) {
         $text = strip_tags($text);
     }
     // Make sure we have a valid count for word wrapping
     if (!$wrap && $pref['main_wordwrap']) {
         $wrap = $pref['main_wordwrap'];
     }
     //		$text = " ".$text;
     // Now get on with the parsing
     $ret_parser = '';
     $last_bbcode = '';
     // So we can change them on each loop
     $saveOpts = $opts;
     if ($parseBB == FALSE) {
         $content = array($text);
     } else {
         // Split each text block into bits which are either within one of the 'key' bbcodes, or outside them
         // (Because we have to match end words, the 'extra' capturing subpattern gets added to output array. We strip it later)
         $content = preg_split('#(\\[(table|html|php|code|scode|hide).*?\\[/(?:\\2)\\])#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
     }
     // Use $full_text variable so its available to special bbcodes if required
     foreach ($content as $full_text) {
         $proc_funcs = TRUE;
         $convertNL = TRUE;
         // We may have 'captured' a bbcode word - strip it if so
         if ($last_bbcode == $full_text) {
             $last_bbcode = '';
             $proc_funcs = FALSE;
             $full_text = '';
         } else {
             // Set the options for this pass
             $opts = $saveOpts;
             // Have to have a good test in case a 'non-key' bbcode starts the block
             // - so pull out the bbcode parameters while we're there
             if ($parseBB !== FALSE && preg_match('#(^\\[(table|html|php|code|scode|hide)(.*?)\\])(.*?)(\\[/\\2\\]$)#is', $full_text, $matches)) {
                 // It's one of the 'key' bbcodes
                 // Usually don't want 'normal' processing if its a 'special' bbcode
                 $proc_funcs = FALSE;
                 // $matches[0] - complete block from opening bracket of opening tag to closing bracket of closing tag
                 // $matches[1] - complete opening tag (inclusive of brackets)
                 // $matches[2] - bbcode word
                 // $matches[3] - parameter, including '='
                 // $matches[4] - bit between the tags (i.e. text to process)
                 // $matches[5] - closing tag
                 // In case we decide to load a file
                 $bbPath = e_CORE . 'bbcodes/';
                 $bbFile = strtolower(str_replace('_', '', $matches[2]));
                 $bbcode = '';
                 $className = '';
                 $full_text = '';
                 $code_text = $matches[4];
                 $parm = $matches[3] ? substr($matches[3], 1) : '';
                 $last_bbcode = $matches[2];
                 switch ($matches[2]) {
                     case 'php':
                         // Probably run the output through the normal processing functions - but put here so the PHP code can disable if desired
                         $proc_funcs = TRUE;
                         // This is just the contents of the php.bb file pulled in - its short, so will be quicker
                         //				$search = array("&quot;", "&#039;", "&#036;", '<br />', E_NL, "-&gt;", "&lt;br /&gt;");
                         //				$replace = array('"', "'", "$", "\n", "\n", "->", "<br />");
                         // Shouldn't have any parameter on this bbcode
                         // Not sure whether checks are necessary now we've reorganised
                         //				if (!$matches[3]) $bbcode = str_replace($search, $replace, $matches[4]);
                         // Because we're bypassing most of the initial parser processing, we should be able to just reverse the effects of toDB() and execute the code
                         // [SecretR] - avoid php code injections, missing php.bb will completely disable user posted php blocks
                         $bbcode = file_get_contents($bbPath . $bbFile . '.bb');
                         if (!$matches[3]) {
                             $code_text = html_entity_decode($matches[4], ENT_QUOTES, 'UTF-8');
                         }
                         break;
                     case 'html':
                         // This overrides and deprecates html.bb
                         $proc_funcs = TRUE;
                         $convertNL = FALSE;
                         $code_text = str_replace("\r\n", " ", $code_text);
                         $code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET);
                         $html_start = "<!-- bbcode-html-start -->";
                         // markers for html-to-bbcode replacement.
                         $html_end = "<!-- bbcode-html-end -->";
                         $full_text = str_replace(array("[html]", "[/html]"), "", $code_text);
                         // quick fix.. security issue?
                         $full_text = $this->replaceConstants($full_text, 'abs');
                         $full_text = $html_start . $full_text . $html_end;
                         break;
                     case 'table':
                         // strip <br /> from end of <table>
                         $convertNL = FALSE;
                         //	break;
                     //	break;
                     case 'hide':
                         $proc_funcs = TRUE;
                     default:
                         // Most bbcodes will just execute their normal file
                         // @todo should we cache these bbcodes? require_once should make class-related codes quite efficient
                         if (file_exists($bbPath . 'bb_' . $bbFile . '.php')) {
                             // Its a bbcode class file
                             require_once $bbPath . 'bb_' . $bbFile . '.php';
                             //echo "Load: {$bbFile}.php<br />";
                             $className = 'bb_' . $code;
                             $this->bbList[$code] = new $className();
                         } elseif (file_exists($bbPath . $bbFile . '.bb')) {
                             $bbcode = file_get_contents($bbPath . $bbFile . '.bb');
                         }
                 }
                 // end - switch ($matches[2])
                 if ($className) {
                     $tempCode = new $className();
                     $full_text = $tempCode->bbPreDisplay($matches[4], $parm);
                 } elseif ($bbcode) {
                     // Execute the file
                     $full_text = eval($bbcode);
                     // Require output of bbcode to be returned
                     // added to remove possibility of nested bbcode exploits ...
                     //   (same as in bbcode_handler - is it right that it just operates on $bbcode_return and not on $bbcode_output? - QUERY XXX-02
                 }
                 if (strpos($full_text, '[') !== FALSE) {
                     $exp_search = array('eval', 'expression');
                     $exp_replace = array('ev<b></b>al', 'expres<b></b>sion');
                     $bbcode_return = str_replace($exp_search, $exp_replace, $full_text);
                 }
             }
         }
         // Do the 'normal' processing - in principle, as previously - but think about the order.
         if ($proc_funcs && !empty($full_text)) {
             // Split out and ignore any scripts and style blocks. With just two choices we can match the closing tag in the regex
             $subcon = preg_split('#((?:<s)(?:cript[^>]+>.*?</script>|tyle[^>]+>.*?</style>))#mis', $full_text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
             foreach ($subcon as $sub_blk) {
                 if (substr($sub_blk, 0, 7) == '<script') {
                     if ($opts['scripts']) {
                         // Strip scripts unless permitted
                         $ret_parser .= $sub_blk;
                     }
                 } elseif (substr($sub_blk, 0, 6) == '<style') {
                     // Its a style block - just pass it through unaltered - except, do we need the line break stuff? - QUERY XXX-01
                     if (DB_INF_SHOW) {
                         echo "Processing stylesheet: {$sub_blk}<br />";
                     }
                     $ret_parser .= $sub_blk;
                 } else {
                     // Do 'normal' processing on a chunk
                     // Could put tag stripping in here
                     /*
                     						//	Line break compression - filter white space after HTML tags - among other things, ensures HTML tables display properly
                     						// Hopefully now achieved by other means
                     						if ($convertNL && !$opts['nobreak'])
                     						{
                     							$sub_blk = preg_replace("#>\s*[\r]*\n[\r]*#", ">", $sub_blk);
                     						}
                     */
                     //	Link substitution
                     // Convert URL's to clickable links, unless modifiers or prefs override
                     if ($opts['link_click']) {
                         if ($opts['link_replace']) {
                             $_ext = $pref['links_new_window'] ? " rel=\"external\"" : "";
                             //								$sub_blk = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\2\" {$_ext}>".$pref['link_text']."</a>", $sub_blk);
                             //								$sub_blk = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"http://\\2\" {$_ext}>".$pref['link_text']."</a>", $sub_blk);
                             $sub_blk = preg_replace("#(^|[\\s])([\\w]+?://(?:[\\w-%]+?)(?:\\.[\\w-%]+?)+.*?)(?=\$|[\\s[\\]<]|\\.\\s|\\.\$|,\\s|,\$)#is", "\\1<a href=\"\\2\" {$_ext}>" . $pref['link_text'] . "</a>", $sub_blk);
                             $sub_blk = preg_replace("#(^|[\\s])((?:www|ftp)(?:\\.[\\w-%]+?){2}.*?)(?=\$|[\\s[\\]<]|\\.\\s|\\.\$|,\\s|,\$)#is", "\\1<a href=\"http://\\2\" {$_ext}>" . $pref['link_text'] . "</a>", $sub_blk);
                             $email_text = $pref['email_text'] ? $this->replaceConstants($pref['email_text']) : LAN_EMAIL_SUBS;
                             $sub_blk = preg_replace("#([\n ])([a-z0-9\\-_.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>" . $email_text . "</a>", $sub_blk);
                         } else {
                             // CHARSET is utf-8 - e_parse_class.php too
                             //$email_text = ($this->isutf8) ? "\\1\\2©\\3" : "\\1\\2&copy;\\3";
                             $email_text = '$1$2©$3';
                             //								$sub_blk = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $sub_blk);
                             //								$sub_blk = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $sub_blk);
                             $sub_blk = preg_replace("#(^|[\\s])([\\w]+?://(?:[\\w-%]+?)(?:\\.[\\w-%]+?)+.*?)(?=\$|[\\s[\\]<]|\\.\\s|\\.\$|,\\s|,\$)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $sub_blk);
                             $sub_blk = preg_replace("#(^|[\\s])((?:www|ftp)(?:\\.[\\w-%]+?){2}.*?)(?=\$|[\\s[\\]<]|\\.\\s|\\.\$|,\\s|,\$)#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $sub_blk);
                             $sub_blk = preg_replace("#([\n ])([a-z0-9\\-_.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>" . $email_text . "</a>", $sub_blk);
                         }
                     }
                     // Convert emoticons to graphical icons, if enabled
                     if ($opts['emotes']) {
                         if (!is_object($this->e_emote)) {
                             require_once e_HANDLER . 'emote_filter.php';
                             $this->e_emote = new e_emoteFilter();
                         }
                         $sub_blk = $this->e_emote->filterEmotes($sub_blk);
                     }
                     // Reduce newlines in all forms to a single newline character (finds '\n', '\r\n', '\n\r')
                     if (!$opts['nobreak']) {
                         if ($convertNL) {
                             // We may need to convert to <br /> later
                             $sub_blk = preg_replace("#[\r]*\n[\r]*#", E_NL, $sub_blk);
                         } else {
                             // Not doing any more - its HTML so keep \n so HTML is formatted
                             $sub_blk = preg_replace("#[\r]*\n[\r]*#", "\n", $sub_blk);
                         }
                     }
                     //	Entity conversion
                     // Restore entity form of quotes and such to single characters, except for text destined for tag attributes or JS.
                     if ($opts['value']) {
                         // output used for attribute values.
                         $sub_blk = str_replace($this->replace, $this->search, $sub_blk);
                     } else {
                         // output not used for attribute values.
                         $sub_blk = str_replace($this->search, $this->replace, $sub_blk);
                     }
                     //   BBCode processing (other than the four already done, which shouldn't appear at all in the text)
                     if ($parseBB !== FALSE) {
                         if (!is_object($this->e_bb)) {
                             require_once e_HANDLER . 'bbcode_handler.php';
                             $this->e_bb = new e_bbcode();
                         }
                         if ($parseBB === TRUE) {
                             // 'Normal' or 'legacy' processing
                             if ($modifiers == "WYSIWYG") {
                                 $sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID, 'wysiwyg');
                             } else {
                                 $sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID);
                             }
                         } elseif ($parseBB === 'STRIP') {
                             // Need to strip all BBCodes
                             $sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID, 'default', TRUE);
                         } else {
                             // Need to strip just some BBCodes
                             $sub_blk = $this->e_bb->parseBBCodes($sub_blk, $postID, 'default', $parseBB);
                         }
                     }
                     // replace all {e_XXX} constants with their e107 value. modifier determines relative/absolute conversion
                     // (Moved to after bbcode processing by Cameron)
                     if ($opts['constants']) {
                         $sub_blk = $this->replaceConstants($sub_blk, $opts['constants']);
                         // Now decodes text values
                     }
                     // profanity filter
                     if ($pref['profanity_filter']) {
                         if (!is_object($this->e_pf)) {
                             require_once e_HANDLER . "profanity_filter.php";
                             $this->e_pf = new e_profanityFilter();
                         }
                         $sub_blk = $this->e_pf->filterProfanities($sub_blk);
                     }
                     //	Shortcodes
                     // Optional short-code conversion
                     if ($opts['parse_sc']) {
                         $sub_blk = $this->parseTemplate($sub_blk, TRUE);
                     }
                     //Run any hooked in parsers
                     if ($opts['hook']) {
                         if (varset($pref['tohtml_hook'])) {
                             //Process the older tohtml_hook pref (deprecated)
                             foreach (explode(",", $pref['tohtml_hook']) as $hook) {
                                 if (!is_object($this->e_hook[$hook])) {
                                     if (is_readable(e_PLUGIN . $hook . "/" . $hook . ".php")) {
                                         require_once e_PLUGIN . $hook . "/" . $hook . ".php";
                                         $hook_class = "e_" . $hook;
                                         $this->e_hook[$hook] = new $hook_class();
                                     }
                                 }
                                 $sub_blk = $this->e_hook[$hook]->{$hook}($sub_blk, $opts['context']);
                             }
                         }
                         if (isset($pref['e_tohtml_list']) && is_array($pref['e_tohtml_list'])) {
                             foreach ($pref['e_tohtml_list'] as $hook) {
                                 if (!is_object($this->e_hook[$hook])) {
                                     if (is_readable(e_PLUGIN . $hook . "/e_tohtml.php")) {
                                         require_once e_PLUGIN . $hook . "/e_tohtml.php";
                                         $hook_class = "e_tohtml_" . $hook;
                                         $this->e_hook[$hook] = new $hook_class();
                                     }
                                 }
                                 $sub_blk = $this->e_hook[$hook]->to_html($sub_blk, $opts['context']);
                             }
                         }
                     }
                     // 	Word wrap
                     if ($wrap && !$opts['nobreak']) {
                         $sub_blk = $this->textclean($sub_blk, $wrap);
                     }
                     //	Search highlighting
                     if ($opts['emotes']) {
                         if ($this->checkHighlighting()) {
                             $sub_blk = $this->e_highlight($sub_blk, $this->e_query);
                         }
                     }
                     if ($convertNL) {
                         // Default replaces all \n with <br /> for HTML display
                         $nl_replace = '<br />';
                         if ($opts['nobreak']) {
                             $nl_replace = '';
                         } elseif ($opts['retain_nl']) {
                             $nl_replace = "\n";
                         }
                         $sub_blk = str_replace(E_NL, $nl_replace, $sub_blk);
                     }
                     $ret_parser .= $sub_blk;
                 }
                 // End of 'normal' processing for a block of text
             }
             // End of 'foreach() on each block of non-script text
         } else {
             // Text block that needed no processing at all
             $ret_parser .= $full_text;
         }
     }
     return trim($ret_parser);
 }
Пример #28
0
     break;
     // End of 'Add' and 'Edit'
 // End of 'Add' and 'Edit'
 case 'transfer':
     $message = '';
     $error = false;
     if (isset($_POST['ban_import'])) {
         // Got a file to import
         require_once e_HANDLER . 'upload_handler.php';
         if (($files = process_uploaded_files(e_UPLOAD, FALSE, array('overwrite' => TRUE, 'max_file_count' => 1, 'file_mask' => 'csv'))) === FALSE) {
             // Invalid file
             $error = true;
             $message = BANLAN_47;
             $emessage->add($message, E_MESSAGE_ERROR);
         }
         if (empty($files) || varsettrue($files[0]['error'])) {
             $error = true;
             if (varset($files[0]['message'])) {
                 $emessage->add($files[0]['message'], E_MESSAGE_ERROR);
             }
         }
         if (!$error) {
             // Got a file of some sort
             $message = process_csv(e_UPLOAD . $files[0]['name'], intval(varset($_POST['ban_over_import'], 0)), intval(varset($_POST['ban_over_expiry'], 0)), $separator_char[intval(varset($_POST['ban_separator'], 1))], $quote_char[intval(varset($_POST['ban_quote'], 3))]);
             banlist_adminlog('07', 'File: ' . e_UPLOAD . $files[0]['name'] . '<br />' . $message);
         }
     }
     $text = "\n\t\t\t<form method='post' action='" . e_ADMIN_ABS . "banlist_export.php' id='core-banlist-transfer-form' >\n\t\t\t\t<fieldset id='core-banlist-transfer-export'>\n\t\t\t\t\t<legend>" . BANLAN_40 . "</legend>\n\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col style='width:30%' />\n\t\t\t\t\t\t\t<col style='width:30%' />\n\t\t\t\t\t\t\t<col style='width:40%' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th colspan='2'>" . BANLAN_36 . "</th>\n\t\t\t\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t";
     foreach ($ipAdministrator->getValidReasonList() as $i) {
         $text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan='3'>\n\t\t\t\t\t\t\t\t" . $frm->checkbox("ban_types[{$i}]", $i) . $frm->label($ipAdministrator->getBanTypeString($i, FALSE), "ban_types[{$i}]", $i) . "\n\t\t\t\t\t\t\t\t<span class='field-help'>(" . $ipAdministrator->getBanTypeString($i, TRUE) . ")</span>\n\t\t\t\t\t\t\t</td></tr>\n\t\t\t";
     }
Пример #29
0
                $online_location_page = ONLINE_EL13 . ": \"" . CLASSRESTRICTED . "\"";
            }
        } elseif (strstr($online_location, "_post")) {
            $sql->db_Select("forum_t", "thread_name, thread_forum_id", "thread_forum_id=" . intval($tmp[0]) . " AND thread_parent=0");
            $forum_t = $sql->db_Fetch();
            $sql->db_Select("forum", "forum_name", "forum_id=" . $forum_t['thread_forum_id']);
            $forum = $sql->db_Fetch();
            $online_location_page = ONLINE_EL12 . ": " . ONLINE_EL13 . " .:. " . $forum['forum_name'] . "->" . ONLINE_EL14 . " .:. " . $forum_t['thread_name'];
            $online_location = e_PLUGIN . "forum/forum_viewtopic.php?{$tmp['0']}.{$tmp['1']}";
        }
    }
    if (strstr($online_location, "admin")) {
        $class_check = FALSE;
        $online_location_page = ADMINAREA;
    }
    $ONLINE_TABLE_ICON = varsettrue($pref['plug_installed']['pm']) && $oid != USERID ? $tp->parseTemplate("{SENDPM={$oid}}", 'sendpm.sc') : "<img src='" . e_PLUGIN . "online_extended_menu/images/user.png' alt='' style='vertical-align:middle' />";
    $ONLINE_TABLE_USERNAME = "******" . e_BASE . "user.php?id.{$oid}'>{$oname}</a>";
    $ONLINE_TABLE_LOCATION = $class_check ? "<a href='{$online_location}'>{$online_location_page}</a>" : $online_location_page;
    $textstring .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $ONLINE_TABLE);
}
$ONLINE_TABLE_MEMBERS_ONLINE = ONLINE_EL1 . GUESTS_ONLINE;
$ONLINE_TABLE_GUESTS_ONLINE = ONLINE_EL2 . MEMBERS_ONLINE;
if (!isset($gen) || !is_object($gen)) {
    $gen = new convert();
}
$siteHistory = e107::getConfig('history')->getPref('');
$datestamp = $gen->convert_date($siteHistory['most_online_datestamp'], "short");
$ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8 . ($siteHistory['most_members_online'] + $siteHistory['most_guests_online']);
$ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2 . $siteHistory['most_members_online'];
$ONLINE_TABLE_MOST_GUESTS_ONLINE = ONLINE_EL1 . $siteHistory['most_guests_online'];
$ONLINE_TABLE_DATESTAMP = $datestamp;
Пример #30
0
/**
 * Create email to send to user who just registered.
 *
 * @param array $userInfo is the array of user-related DB variables
 *
 * @return array of data for mailer - field names directly compatible
 */
function render_email($userInfo, $preview = FALSE)
{
    // 1 = Body
    // 2 = Subject
    global $pref, $SIGNUPEMAIL_LINKSTYLE, $SIGNUPEMAIL_SUBJECT, $SIGNUPEMAIL_TEMPLATE;
    if ($preview == TRUE) {
        $userInfo['user_password'] = "******";
        $userInfo['user_loginname'] = "test-loginname";
        $userInfo['user_name'] = "test-username";
        $userInfo['user_email'] = "test-username@email";
        $userInfo['user_website'] = "www.test-site.com";
        // This may not be defined
        $userInfo['user_id'] = 0;
        $userInfo['user_sess'] = "1234567890ABCDEFGHIJKLMNOP";
    }
    define('RETURNADDRESS', substr(SITEURL, -1) == "/" ? SITEURL . "signup.php?activate." . $userInfo['user_id'] . "." . $userInfo['user_sess'] : SITEURL . "/signup.php?activate." . $userInfo['user_id'] . "." . $userInfo['user_sess'] . "." . e_LAN);
    $pass_show = $pref['user_reg_secureveri'] ? '*******' : $userInfo['user_password'];
    if (file_exists(THEME . 'email_template.php')) {
        require_once THEME . 'email_template.php';
    } else {
        require_once e_THEME . 'templates/email_template.php';
    }
    /*	Inline images now handled automatically - just include in email template with an absolute link
    	$inlineImages = array();
    	$inlineImages = explode(",",$SIGNUPEMAIL_IMAGES);
    	if (vartrue($SIGNUPEMAIL_BACKGROUNDIMAGE))
    	{
    		$inlineImages[] = $SIGNUPEMAIL_BACKGROUNDIMAGE;
    	}
    	if (count($inlineImages)) { $ret['mail_inline_images'] = implode(",",$inlineImages); }
    	*/
    $ret['mail_recipient_id'] = $userInfo['user_id'];
    if (vartrue($SIGNUPEMAIL_CC)) {
        $ret['mail_copy_to'] = $SIGNUPEMAIL_CC;
    }
    if (vartrue($SIGNUPEMAIL_BCC)) {
        $ret['mail_bcopy_to'] = $SIGNUPEMAIL_BCC;
    }
    if (vartrue($SIGNUPEMAIL_ATTACHMENTS)) {
        $ret['mail_attach'] = $SIGNUPEMAIL_ATTACHMENTS;
    }
    $style = $SIGNUPEMAIL_LINKSTYLE ? "style='{$SIGNUPEMAIL_LINKSTYLE}'" : "";
    $search[0] = '{LOGINNAME}';
    $replace[0] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email'];
    $search[1] = '{PASSWORD}';
    $replace[1] = $pass_show;
    $search[2] = '{ACTIVATION_LINK}';
    $replace[2] = "<a href='" . RETURNADDRESS . "' {$style}>" . RETURNADDRESS . "</a>";
    $search[3] = '{SITENAME}';
    $replace[3] = SITENAME;
    $search[4] = '{SITEURL}';
    $replace[4] = "<a href='" . SITEURL . "' {$style}>" . SITEURL . "</a>";
    $search[5] = '{USERNAME}';
    $replace[5] = $userInfo['user_name'];
    $search[6] = '{USERURL}';
    $replace[6] = varsettrue($userInfo['user_website']) ? $userInfo['user_website'] : "";
    /*	Inline images now handled automatically - just include in email template with an absolute link
    	$cnt=1;
    	foreach($inlineImages as $img)
    	{
    		if(is_readable($inlineImages[$cnt-1]))
    		{
    			$cid_search[] = "{IMAGE".$cnt."}";
    			$cid_replace[] = "<img alt=\"".SITENAME."\" src='cid:".md5($inlineImages[$cnt-1])."' />\n";
    			$path_search[] = "{IMAGE".$cnt."}";
    			$path_replace[] = "<img alt=\"".SITENAME."\" src=\"".$inlineImages[$cnt-1]."\" />\n";
    		}
    		$cnt++;
    	}
    	*/
    $subject = str_replace($search, $replace, $SIGNUPEMAIL_SUBJECT);
    $ret['mail_subject'] = $subject;
    $ret['send_html'] = TRUE;
    $HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
    $HEAD .= "<html xmlns='http://www.w3.org/1999/xhtml' >\n";
    $HEAD .= "<head><meta http-equiv='content-type' content='text/html; charset=utf-8' />\n";
    $HEAD .= $SIGNUPEMAIL_USETHEME == 1 ? "<link rel=\"stylesheet\" href=\"" . SITEURL . THEME . "style.css\" type=\"text/css\" />\n" : "";
    $HEAD .= $preview ? "<title>" . LAN_SIGNUP_58 . "</title>\n" : "";
    if ($SIGNUPEMAIL_USETHEME == 2) {
        $CSS = file_get_contents(THEME . "style.css");
        $HEAD .= "<style>\n" . $CSS . "\n</style>";
    }
    $HEAD .= "</head>\n";
    if (vartrue($SIGNUPEMAIL_BACKGROUNDIMAGE)) {
        $HEAD .= "<body background=\"" . $SIGNUPEMAIL_BACKGROUNDIMAGE . "\" >\n";
    } else {
        $HEAD .= "<body>\n";
    }
    $FOOT = "\n</body>\n</html>\n";
    $ret['mail_body'] = str_replace($search, $replace, $HEAD . $SIGNUPEMAIL_TEMPLATE . $FOOT);
    $ret['preview'] = $ret['mail_body'];
    // Non-standard field
    return $ret;
}