Example #1
0
 /**
  * Constructor.
  */
 function __construct()
 {
     if (USERID > 0) {
         $this->plugPrefs = e107::getPlugConfig('nodejs_online')->getPref();
         $this->include_components();
     }
 }
 /**
  * Constructor.
  */
 function __construct()
 {
     if (USER) {
         $this->plugPrefs = e107::getPlugConfig('nodejs_online')->getPref();
         $this->renderMenu();
     }
 }
Example #3
0
 public function __construct()
 {
     $this->e107 = e107::getInstance();
     $this->userViewed = array();
     $this->modArray = array();
     $this->loadPermList();
     $this->prefs = e107::getPlugConfig('forum');
     if (!$this->prefs->get('postspage')) {
         $this->setDefaults();
     }
     //		var_dump($this->prefs);
     /*
     		$this->fieldTypes['forum_post']['post_user'] 			= '******';
     		$this->fieldTypes['forum_post']['post_forum'] 			= 'int';
     		$this->fieldTypes['forum_post']['post_datestamp'] 		= 'int';
     		$this->fieldTypes['forum_post']['post_edit_datestamp']	= 'int';
     		$this->fieldTypes['forum_post']['post_edit_user']		= '******';
     		$this->fieldTypes['forum_post']['post_thread'] 			= 'int';
     		$this->fieldTypes['forum_post']['post_options'] 		= 'escape';
     		$this->fieldTypes['forum_post']['post_attachments'] 	= 'escape';
     
     		$this->fieldTypes['forum_thread']['thread_user'] 		= '******';
     		$this->fieldTypes['forum_thread']['thread_lastpost'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_lastuser'] 	= '******';
     		$this->fieldTypes['forum_thread']['thread_sticky'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_forum_id'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_active'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_datestamp']	= 'int';
     		$this->fieldTypes['forum_thread']['thread_views'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_replies'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_options'] 	= 'escape';
     
     		$this->fieldTypes['forum']['forum_lastpost_user']	 	= '******';
     */
 }
Example #4
0
 /**
  * database update settings
  * 
  * @return string $message
  * 
  */
 function db_update_menu()
 {
     //	$sql = e107::getDb();
     //	$tp = e107::getParser();
     // Get the preferences so we've got a reference for changes
     //	$list_pref = $this->parent->getListPrefs();
     //	$temp = array();
     //	while(list($key, $value) = each($_POST))
     //	{
     //		if($value != LIST_ADMIN_2){ $temp[$tp->toDB($key)] = $tp->toDB($value); }
     //	}
     e107::getPlugConfig('list_new')->reset()->setPref($_POST)->save(true);
     //	retrieve with e107::pref('list_new');
     return;
     /*
     		if ($this->e107->admin_log->logArrayDiffs($temp, $list_pref, 'LISTNEW_01'))
     		{
     			$tmp = $this->e107->arrayStorage->WriteArray($list_pref);
     			$sql->update("core", "e107_value='{$tmp}' WHERE e107_name='list' ");
     			$message = LIST_ADMIN_3;
     		}
     		else
     		{
     			$message = LIST_ADMIN_17;
     		}
     		return $message;
     */
 }
Example #5
0
/**
 * Event callback after triggering "user_forum_post_created".
 *
 * @param array $info
 *  Details about forum post.
 */
function nodejs_forum_event_user_forum_post_created_callback($info)
{
    $postID = intval(vartrue($info['data']['post_id'], 0));
    $postUserID = intval(vartrue($info['data']['post_user'], 0));
    $postThreadID = intval(vartrue($info['data']['post_thread'], 0));
    if ($postID === 0 || $postThreadID === 0) {
        return;
    }
    // Get forum plugin preferences.
    $plugForumPrefs = e107::getPlugConfig('forum')->getPref();
    $db = e107::getDb();
    // Load thread.
    $thread = $db->retrieve('forum_thread', '*', 'thread_id = ' . $postThreadID);
    $threadUser = intval(vartrue($thread['thread_user'], 0));
    // Load forum to check (read) permission.
    $forum = $db->retrieve('forum', '*', 'forum_id = ' . intval(vartrue($thread['thread_forum_id'], 0)));
    // Author of the forum post.
    $authorPost = e107::user($postUserID);
    // Author of the forum topic.
    $authorThread = e107::user($threadUser);
    e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
    $template = e107::getTemplate('nodejs_forum');
    $sc = e107::getScBatch('nodejs_forum', true);
    $tp = e107::getParser();
    // Get topic page number.
    $postNum = $db->count('forum_post', '(*)', "WHERE post_id <= " . $postID . " AND post_thread = " . $postThreadID . " ORDER BY post_id ASC");
    $postPage = ceil($postNum / vartrue($plugForumPrefs['postspage'], 10));
    // Push rendered row item into Latest Forum Posts menu.
    $sc_vars = array('author' => $authorPost, 'post' => $info['data'], 'thread' => $thread, 'topicPage' => $postPage);
    $sc->setVars($sc_vars);
    $markup = $tp->parseTemplate($template['MENU']['RECENT']['ITEM'], true, $sc);
    $message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForumMenu', 'type' => 'latestForumPosts', 'markup' => $markup);
    nodejs_enqueue_message($message);
    // Broadcast logged in users to inform about new forum post created.
    if ($authorPost) {
        $sc->setVars($sc_vars);
        $markup = $tp->parseTemplate($template['NOTIFICATION']['POST_ALL'], true, $sc);
        // It's a public forum, so broadcast every online user.
        if (intval(vartrue($forum['forum_class'], 0)) === 0) {
            $message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
            nodejs_enqueue_message($message);
        } else {
            $forumClass = vartrue($forum['forum_class'], 0);
            $db->select('nodejs_presence');
            while ($row = $db->fetch()) {
                if (isset($row['uid']) && check_class($forumClass, null, $row['uid'])) {
                    $message = (object) array('channel' => 'nodejs_user_' . $row['uid'], 'callback' => 'nodejsForum', 'type' => 'newForumPostAny', 'markup' => $markup, 'exclude' => $postUserID);
                    nodejs_enqueue_message($message);
                }
            }
        }
    }
    // Broadcast logged in (thread-author) user to inform about new forum post created in his/her topic.
    if (isset($authorThread['user_id'])) {
        $sc->setVars($sc_vars);
        $markup = $tp->parseTemplate($template['NOTIFICATION']['POST_OWN'], true, $sc);
        $message = (object) array('channel' => 'nodejs_user_' . $authorThread['user_id'], 'callback' => 'nodejsForum', 'type' => 'newForumPostOwn', 'markup' => $markup, 'exclude' => $postUserID);
        nodejs_enqueue_message($message);
    }
}
 /**
  * Constructor.
  */
 function __construct()
 {
     if (e107::isInstalled('nodejs_comment')) {
         // Get plugin preferences.
         $this->plugPrefs = e107::getPlugConfig('nodejs_comment')->getPref();
         $this->renderMenu();
     }
 }
Example #7
0
 function sc_faq_submit_question()
 {
     $faqpref = e107::getPlugConfig('faqs')->getPref();
     $frm = e107::getForm();
     if (check_class($faqpref['add_faq'])) {
         $text = "<div class='faq-submit-question-container'><a class='e-expandit faq-submit-question' href='faqs.php'>Submit a Question</a>\n\t\t\t<div class='e-hideme faq-submit-question-form'>\n\t\t\t<form method=\"post\" action=\"" . e_SELF . "?cat.{$id}.{$idx}\" id=\"dataform\">\n\t\t\t<div>" . $frm->textarea('ask_a_question', '') . '<br />' . $frm->submit('submit_a_question', 'Go') . "</div>\n\t\t\t</form>\n\t\t\t</div>\n\t\t\t</div>\t\t\t\n\t\t\t";
         return $text;
     }
 }
 /**
  * Constructor.
  */
 public function __construct()
 {
     // Get plugin preferences.
     $this->plugPrefs = e107::getPlugConfig('paypal_donation')->getPref();
     $ipn = $this->readIPN();
     $valid = $this->validateIPN($ipn);
     if ($valid === true) {
         $this->processIPN();
     }
 }
 /**
  * Constructor.
  */
 function __construct()
 {
     // Get plugin preferences.
     $this->plugPrefs = e107::getPlugConfig('paypal_donation')->getPref();
     if (vartrue($_POST['donation'], false)) {
         if ($this->formValidate()) {
             $this->formSubmit();
         }
     }
     // Render menu.
     $this->renderMenu();
 }
Example #10
0
 /**
  * Constructor.
  */
 function __construct()
 {
     // Include necessary CSS and JS files regardless of whether the current user is logged in, or not.
     $this->includePublicComponents();
     if (USERID > 0) {
         $db = e107::getDb();
         // Plugin preferences.
         $this->plugPrefs = e107::getPlugConfig('nodejs_comment')->getPref();
         // Extended User Fields values by current, logged in user.
         $this->defaultValues = $db->retrieve('user_extended', '*', 'user_extended_id = ' . USERID);
         // Include necessary CSS and JS files only for logged in user.
         $this->includePrivateComponents();
     }
 }
Example #11
0
 public function __construct($update = false)
 {
     if (!empty($_POST['fjsubmit']) && !empty($_POST['forumjump'])) {
         $url = e107::getParser()->filter($_POST['forumjump'], 'url');
         e107::getRedirect()->go($_POST['forumjump']);
         exit;
     }
     $this->e107 = e107::getInstance();
     $tp = e107::getParser();
     $this->userViewed = array();
     $this->modArray = array();
     if ($update === false) {
         $this->loadPermList();
     }
     $this->prefs = e107::getPlugConfig('forum');
     if (!$this->prefs->get('postspage')) {
         $this->setDefaults();
     }
     //		var_dump($this->prefs);
     /*
     		$this->fieldTypes['forum_post']['post_user'] 			= '******';
     		$this->fieldTypes['forum_post']['post_forum'] 			= 'int';
     		$this->fieldTypes['forum_post']['post_datestamp'] 		= 'int';
     		$this->fieldTypes['forum_post']['post_edit_datestamp']	= 'int';
     		$this->fieldTypes['forum_post']['post_edit_user']		= '******';
     		$this->fieldTypes['forum_post']['post_thread'] 			= 'int';
     		$this->fieldTypes['forum_post']['post_options'] 		= 'escape';
     		$this->fieldTypes['forum_post']['post_attachments'] 	= 'escape';
     
     		$this->fieldTypes['forum_thread']['thread_user'] 		= '******';
     		$this->fieldTypes['forum_thread']['thread_lastpost'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_lastuser'] 	= '******';
     		$this->fieldTypes['forum_thread']['thread_sticky'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_forum_id'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_active'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_datestamp']	= 'int';
     		$this->fieldTypes['forum_thread']['thread_views'] 		= 'int';
     		$this->fieldTypes['forum_thread']['thread_replies'] 	= 'int';
     		$this->fieldTypes['forum_thread']['thread_options'] 	= 'escape';
     
     		$this->fieldTypes['forum']['forum_lastpost_user']	 	= '******';
     */
 }
Example #12
0
File: db.php Project: notzen/e107
 /**
  * Preferences Editor
  * @return string text for display
  */
 private function pref_editor($type = 'core')
 {
     //TODO Add drop-down for editing personal perfs also. ie. user pref of self. (admin)
     global $pref, $e107, $emessage, $frm;
     $config = $type == 'core' ? e107::getConfig('core') : e107::getPlugConfig($type);
     $spref = $config->getPref();
     ksort($spref);
     $text = "\n\t\t\t\t<form method='post' action='" . e_ADMIN . "db.php?mode=" . $_GET['mode'] . "&amp;type=" . $type . "' id='pref_edit'>\n\t\t\t\t\t<fieldset id='core-db-pref-edit'>\n\t\t\t\t\t\t<legend class='e-hideme'>" . DBLAN_20 . "</legend>";
     $text .= "<select class='tbox' name='type_select' onchange='urljump(this.options[selectedIndex].value)' >\n\t\t<option value='" . e_ADMIN . "db.php?mode=" . $_GET['mode'] . "&amp;type=core'>Core</option>\n";
     //	e107::getConfig($type)->aliases
     e107::getDb()->db_Select_gen("SELECT e107_name FROM #core WHERE e107_name LIKE ('plugin_%') ORDER BY e107_name");
     while ($row = e107::getDb()->db_Fetch()) {
         $key = str_replace("plugin_", "", $row['e107_name']);
         $selected = varset($_GET['type']) == $key ? "selected='selected'" : "";
         $text .= "<option value='" . e_ADMIN . "db.php?mode=" . $_GET['mode'] . "&amp;type=" . $key . "' {$selected}>" . ucwords($key) . "</option>\n";
     }
     $text .= "</select></div>\n\t\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t\t<col style='width: 5%' />\n\t\t\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t\t\t<col style='width: 70%' />\n\t\t\t\t\t\t\t\t<col style='width: 5%' />\n\t\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th class='center'>" . LAN_DELETE . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_17 . "</th>\n\t\t\t\t\t\t\t\t\t<th>" . DBLAN_18 . "</th>\n\t\t\t\t\t\t\t\t\t<th class='center last'>" . LAN_OPTIONS . "</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t";
     foreach ($spref as $key => $val) {
         $ptext = is_array($val) ? "<pre>" . print_r($val, TRUE) . "</pre>" : htmlspecialchars($val, ENT_QUOTES, 'utf-8');
         $ptext = $e107->tp->textclean($ptext, 80);
         $text .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='center autocheck e-pointer'>" . $frm->checkbox("delpref2[{$key}]", 1) . "</td>\n\t\t\t\t\t<td>{$key}</td>\n\t\t\t\t\t<td>{$ptext}</td>\n\t\t\t\t\t<td class='center'>" . $frm->submit_image("delpref[{$key}]", LAN_DELETE, 'delete', LAN_CONFIRMDEL . " [{$key}]") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t";
     }
     $text .= "\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t\t\t" . $frm->admin_button('delpref_checked', LAN_DELCHECKED, 'delete') . "\n\t\t\t\t\t\t\t" . $frm->admin_button('back', LAN_BACK, 'back') . "\n\t\t\t\t\t\t\t<input type='hidden' name='pref_type' value='" . $type . "' />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</fieldset>\n\t\t\t\t</form>\n\n";
     e107::getRender()->tablerender(DBLAN_10 . ' :: ' . DBLAN_20 . " :: " . ucwords($type), $emessage->render() . $text);
     return $text;
 }
Example #13
0
 /**
  * Process XML tags <mainPrefs> and <pluginPrefs>
  * @param object $mode 'core' or the folder name of the plugin.
  * @param object $function install|uninstall|upgrade|refresh
  * @param object $prefArray XML array of prefs. eg. mainPref() or pluginPref();
  * @return none
  */
 function XmlPrefs($mode = 'core', $function, $prefArray)
 {
     //XXX Could also be used for theme prefs.. perhaps this function should be moved elsewhere?
     //TODO array support for prefs. <key>? or array() as used in xml site export?
     $mes = e107::getMessage();
     if (!varset($prefArray) || !varset($prefArray)) {
         return;
     }
     $config = $mode == 'core' ? e107::getConfig('core') : e107::getPlugConfig($mode);
     foreach ($prefArray['pref'] as $tag) {
         $key = varset($tag['@attributes']['name']);
         $value = vartrue($tag['@value']);
         if (substr($value, 0, 5) == "e_UC_") {
             $value = constant($value);
         }
         $remove = varset($tag['@attributes']['deprecate']) == 'true' ? TRUE : FALSE;
         if (varset($tag['@attributes']['value'])) {
             $mes->addError("Deprecated plugin.xml spec. found. Use the following format: " . htmlentities("<pref name='name'>value</pref>"));
         }
         switch ($function) {
             case 'install':
             case 'upgrade':
                 $ret = $config->add($key, $value);
                 if ($ret->data_has_changed == TRUE) {
                     $mes->addSuccess("Adding Pref: " . $key);
                 }
                 break;
             case 'refresh':
                 if ($remove) {
                     $config->remove($key, $value);
                     $mes->addSuccess("Removing Pref: " . $key);
                 } else {
                     $config->update($key, $value);
                     $mes->addSuccess("Updating Pref: " . $key);
                 }
                 break;
             case 'uninstall':
                 $config->remove($key, $value);
                 $mes->addSuccess("Removing Pref: " . $key);
                 break;
         }
     }
     if ($mode != "core") {
         $config->save(true, false, false);
     }
     return;
 }
Example #14
0
/**
 * Returns information about registered libraries.
 *
 * The returned information is unprocessed; i.e., as registered by plugins.
 *
 * @param $library
 *   (optional) The machine name of a library to return registered information for. If omitted, information about all
 *   registered libraries is returned.
 *
 * @return array|false
 *   An associative array containing registered information for all libraries, the registered information for the
 *   library specified by $name, or FALSE if the library $name is not registered.
 */
function &libraries_info($library = null)
{
    // This static cache is re-used by libraries_detect() to save memory.
    static $libraries;
    if (!isset($libraries)) {
        $libraries = array();
        $plugPrefs = e107::getPlugConfig('libraries')->getPref();
        $addonsList = vartrue($plugPrefs['addon_list'], array());
        // Gather information from libraries_info() in enabled plugins/themes.
        foreach ($addonsList as $type => $items) {
            foreach ($items as $name) {
                if ($type == 'plugin') {
                    e107_require_once(e_PLUGIN . $name . '/e_libraries.php');
                }
                if ($type == 'theme') {
                    e107_require_once(e_THEME . $name . '/e_libraries.php');
                }
                $addonClass = $name . '_libraries';
                if (class_exists($addonClass)) {
                    $class = new $addonClass();
                    if (method_exists($class, 'libraries_info')) {
                        $info = $class->libraries_info();
                        if (is_array($info)) {
                            foreach ($info as $machine_name => $properties) {
                                if ($type == 'plugin') {
                                    $properties['info type'] = 'plugin';
                                    $properties['plugin'] = $name;
                                    $libraries[$machine_name] = $properties;
                                }
                                if ($type == 'theme') {
                                    $properties['info type'] = 'theme';
                                    $properties['theme'] = $name;
                                    $libraries[$machine_name] = $properties;
                                }
                            }
                        }
                    }
                }
            }
        }
        // Provide defaults.
        foreach ($libraries as $machine_name => &$properties) {
            libraries_info_defaults($properties, $machine_name);
        }
        // Allow enabled plugins/themes to alter the registered libraries.
        foreach ($addonsList as $type => $items) {
            foreach ($items as $name) {
                if ($type == 'plugin') {
                    e107_require_once(e_PLUGIN . $name . '/e_libraries.php');
                }
                if ($type == 'theme') {
                    e107_require_once(e_THEME . $name . '/e_libraries.php');
                }
                $addonClass = $name . '_libraries';
                if (class_exists($addonClass)) {
                    $class = new $addonClass();
                    if (method_exists($class, 'libraries_info_alter')) {
                        $class->libraries_info_alter($libraries);
                    }
                }
            }
        }
        // TODO:
        // Invoke callbacks in the 'info' group.
        foreach ($libraries as &$properties) {
            libraries_invoke('info', $properties);
        }
    }
    if (isset($library)) {
        if (!empty($libraries[$library])) {
            return $libraries[$library];
        } else {
            $false = false;
            return $false;
        }
    }
    return $libraries;
}
 /**
  * Constructor.
  */
 function __construct()
 {
     parent::__construct();
     // Get plugin preferences.
     $this->plugPrefs = e107::getPlugConfig('paypal_donation')->getPref();
 }
 /**
  * Constructor.
  */
 function __construct()
 {
     parent::__construct();
     $this->plugPrefs = e107::getPlugConfig('nodejs_comment')->getPref();
 }
Example #17
0
	// $emessage->add(ADLAN_PM_80, E_MESSAGE_SUCCESS);
}
*/
//include_lan(e_PLUGIN.'pm/languages/admin/'.e_LANGUAGE.'.php');
if (isset($_POST['update_prefs'])) {
    $temp = array();
    foreach ($_POST as $k => $v) {
        if (strpos($k, 'pm_option-') === 0) {
            $k = str_replace('pm_option-', '', $k);
            $temp[$k] = $v;
        }
    }
    if (e107::getLog()->logArrayDiffs($temp, $pm_prefs, 'PM_ADM_02')) {
        //	$sysprefs->setArray('pm_prefs');
        //print_a($temp);
        e107::getPlugConfig('pm')->setPref($temp)->save();
    } else {
        $mes->addInfo(LAN_NO_CHANGE);
    }
}
// Mantenance options
if (isset($_POST['pm_maint_execute'])) {
    $maintOpts = array();
    if (vartrue($_POST['pm_maint_sent'])) {
        $maintOpts['sent'] = 1;
    }
    if (vartrue($_POST['pm_maint_rec'])) {
        $maintOpts['rec'] = 1;
    }
    if (vartrue($_POST['pm_maint_blocked'])) {
        $maintOpts['blocked'] = 1;
 /**
  * Build a custom configuration form to handle plugin preferences.
  */
 function configPage()
 {
     $tpl = e107::getTemplate('google_analytics');
     $sc = e107::getScBatch('google_analytics', true);
     $tp = e107::getParser();
     $form = e107::getForm();
     $prefs = e107::getPlugConfig('google_analytics')->getPref();
     // Rendered form elements.
     $elements = '';
     // ---------- Panel: Web Property ID ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_02, 'body' => '');
     // Field: Web Property ID.
     $sc->setVars(array('id' => $form->name2id('account'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_09, 'element' => $form->text('account', vartrue($prefs['account'], ''), 80, array('placeholder' => 'UA-')), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_10));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Domains ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_03, 'body' => '');
     // Field: What are you tracking?
     $sc->setVars(array('id' => $form->name2id('domain_mode'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_11, 'element' => $form->radio('domain_mode', array(0 => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_12, 1 => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_14, 2 => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_16), vartrue($prefs['domain_mode'], 0)), 'help' => implode("\n", array(LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_13, LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_15, LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_17))));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: List of top-level domains
     $sc->setVars(array('id' => $form->name2id('cross_domains'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_18, 'element' => $form->textarea('cross_domains', vartrue($prefs['cross_domains'], ''), 3, 80, array('class' => 'form-control')), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_19));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Pages ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_20, 'body' => '');
     // Field: Add tracking to specific pages
     $sc->setVars(array('id' => $form->name2id('visibility_pages'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_24, 'element' => $form->radio('visibility_pages', array(0 => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_21, 1 => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_22), vartrue($prefs['visibility_pages'], 0)), 'help' => ''));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     $sc->setVars(array('id' => $form->name2id('pages'), 'label' => '', 'element' => $form->textarea('pages', vartrue($prefs['pages'], ''), 3, 80, array('class' => 'form-control')), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_23));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: User Classes ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_04, 'body' => '');
     // Field: Add tracking to specific pages
     $sc->setVars(array('id' => $form->name2id('visibility_roles'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_25, 'element' => $form->userclass('visibility_roles', vartrue($prefs['visibility_roles'], 0)), 'help' => ''));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Users ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_26, 'body' => '');
     // Field: Add tracking to specific pages
     $sc->setVars(array('id' => $form->name2id('track_user_id'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_27, 'element' => $form->checkbox('track_user_id', 1, (bool) vartrue($prefs['track_user_id'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_28));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Links and Downloads ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_05, 'body' => '');
     // Field: Track clicks on outbound links
     $sc->setVars(array('id' => $form->name2id('track_outbound'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_29, 'element' => $form->checkbox('track_outbound', 1, (bool) vartrue($prefs['track_outbound'], false)), 'help' => ''));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track clicks on mailto links
     $sc->setVars(array('id' => $form->name2id('track_mailto'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_30, 'element' => $form->checkbox('track_mailto', 1, (bool) vartrue($prefs['track_mailto'], false)), 'help' => ''));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track downloads (clicks on file links) for the following extensions
     $sc->setVars(array('id' => $form->name2id('track_files'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_31, 'element' => $form->checkbox('track_files', 1, (bool) vartrue($prefs['track_files'], false)), 'help' => ''));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track downloads (clicks on file links) for the following extensions
     $sc->setVars(array('id' => $form->name2id('track_files_extensions'), 'label' => '', 'element' => $form->text('track_files_extensions', vartrue($prefs['track_files_extensions'], ''), 512), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_32));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track enhanced link attribution
     $sc->setVars(array('id' => $form->name2id('track_link_id'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_33, 'element' => $form->checkbox('track_link_id', 1, (bool) vartrue($prefs['track_link_id'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_34));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track changing URL fragments as pageviews
     $sc->setVars(array('id' => $form->name2id('track_url_fragments'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_35, 'element' => $form->checkbox('track_url_fragments', 1, (bool) vartrue($prefs['track_url_fragments'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_36));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Advertising ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_06, 'body' => '');
     // Field: Track AdSense ads
     $sc->setVars(array('id' => $form->name2id('track_adsense'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_37, 'element' => $form->checkbox('track_adsense', 1, (bool) vartrue($prefs['track_adsense'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_38));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Track display features
     $sc->setVars(array('id' => $form->name2id('track_double_click'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_39, 'element' => $form->checkbox('track_double_click', 1, (bool) vartrue($prefs['track_double_click'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_40));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Privacy ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_07, 'body' => '');
     // Field: Anonymize visitors IP address
     $sc->setVars(array('id' => $form->name2id('tracker_anonymize_ip'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_41, 'element' => $form->checkbox('tracker_anonymize_ip', 1, (bool) vartrue($prefs['tracker_anonymize_ip'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_42));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Field: Universal web tracking opt-out
     $sc->setVars(array('id' => $form->name2id('privacy_do_not_track'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_43, 'element' => $form->checkbox('privacy_do_not_track', 1, (bool) vartrue($prefs['privacy_do_not_track'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_44));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Panel: Advanced settings ----------
     $scVars = array('title' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_45, 'body' => '');
     // Field: Locally cache tracking code file
     /*
     $sc->setVars(array(
     	'id'      => $form->name2id('cache'),
     	'label'   => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_46,
     	'element' => $form->checkbox('cache', 1, (bool) vartrue($prefs['cache'], false)),
     	'help'    => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_47,
     ));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     */
     // Field: Enable debugging
     $sc->setVars(array('id' => $form->name2id('debug'), 'label' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_48, 'element' => $form->checkbox('debug', 1, (bool) vartrue($prefs['debug'], false)), 'help' => LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_49));
     $scVars['body'] .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENT'], true, $sc);
     // Render panel.
     $sc->setVars($scVars);
     $elements .= $tp->parseTemplate($tpl['ADMIN']['FORM_ELEMENTS'], true, $sc);
     // ---------- Render form ----------
     $scVars = array('elements' => $elements, 'actions' => $form->submit('submit', LAN_PLUGIN_GOOGLE_ANALYTICS_ADMIN_08));
     $sc->setVars($scVars);
     $html = $form->open('', 'post', e_SELF);
     $html .= $form->hidden('saveConfig', 1);
     $html .= $tp->parseTemplate($tpl['ADMIN']['FORM'], true, $sc);
     $html .= $form->close();
     return $html;
 }
Example #19
0
 /**
  * Constructor.
  */
 function __construct()
 {
     $this->plugPrefs = e107::getPlugConfig('links_page')->getPref();
     $this->link_shortcodes = e107::getScBatch('links_page', true);
     $this->link_template = e107::getTemplate('links_page', 'links_page');
 }
Example #20
0
 function __construct()
 {
     $this->plugPrefs = e107::getPlugConfig('links_page')->getPref();
 }
 /**
  * Constructor.
  */
 function __construct()
 {
     parent::__construct();
     // Get plugin preferences.
     $this->plugPrefs = e107::getPlugConfig('google_analytics')->getPref();
 }
Example #22
0
 function sc_faq_edit()
 {
     $tp = e107::getParser();
     $faqpref = e107::getPlugConfig('faqs')->getPref();
     if ($faqpref['add_faq'] && $this->var['faq_author'] == USERID || ADMIN) {
         // UNDER CONSTRUCTION
         //return "[ <a href='faqs.php?edit.".$this->var['faq_parent'].".".$this->var['faq_id']."'>Edit</a> ]";
     }
 }
Example #23
0
function step4()
{
    global $pref;
    $mes = e107::getMessage();
    $ns = e107::getRender();
    $stepCaption = 'Step 4: Move user specific forum data and forum prefs';
    if (!isset($_POST['move_user_data'])) {
        $text = "\n\t\tThis step will move the main forum preferences into its own table row.  It will also move all user_viewed data from user table into the user extended table.<br />\n\t\tThe user_forum field data will not be moved, as it will be recalculated later.<br />\n\t\t<br />\n\t\tDepending on the size of your user table, this step could take a while.\n\t\t<br /><br />\n\t\t<form method='post'>\n\t\t<input class='btn btn-success' data-loading-text='Please wait...' type='submit' name='move_user_data' value='Proceed with user data move' />\n\t\t</form>\n\t\t";
        $ns->tablerender($stepCaption, $text);
        return;
    }
    /** Convert forum prefs to their own row **/
    $fconf = e107::getPlugConfig('forum', '', false);
    $coreConfig = e107::getConfig();
    $old_prefs = array();
    foreach ($pref as $k => $v) {
        if (substr($k, 0, 6) == 'forum_') {
            $nk = substr($k, 6);
            $mes->addDebug("Converting {$k} to {$nk}");
            $old_prefs[$nk] = $v;
            $coreConfig->remove($k);
        }
    }
    $forumPrefList = array('reported_post_email', 'email_notify', 'email_notify_on');
    foreach ($forumPrefList as $_fp) {
        $mes->addDebug("converting {$_fp} to {$_fp}");
        $old_prefs[$_fp] = $coreConfig->get($_fp);
        $coreConfig->remove($_fp);
    }
    $fconf->setPref($old_prefs)->save(false, true);
    $coreConfig->save(false, true);
    $result = array('usercount' => 0, 'viewcount' => 0, 'trackcount' => 0);
    $db = new db();
    if ($db->select('user', 'user_id, user_viewed, user_realm', "user_viewed != '' OR user_realm != ''")) {
        require_once e_HANDLER . 'user_extended_class.php';
        $ue = new e107_user_extended();
        while ($row = $db->fetch(MYSQL_ASSOC)) {
            $result['usercount']++;
            $userId = (int) $row['user_id'];
            $viewed = $row['user_viewed'];
            $viewed = trim($viewed, '.');
            $tmp = preg_split('#\\.+#', $viewed);
            $viewed = implode(',', $tmp);
            $realm = $row['user_realm'];
            $realm = str_replace('USERREALM', '', $realm);
            $realm = trim($realm, '-.');
            $trackList = preg_split('#\\D+#', $realm);
            $debug = 'user_id = ' . $userId . '<br />';
            $debug .= 'viewed = ' . $viewed . '<br />';
            $debug .= 'realm = ' . $realm . '<br />';
            $debug .= 'tracking = ' . implode(',', $trackList) . '<br />';
            //	$debug .= print_a($trackList, true);
            //	$mes -> addDebug($debug);
            if ($viewed != '') {
                $ue->user_extended_setvalue($userId, 'plugin_forum_viewed', mysql_real_escape_string($viewed));
                $result['viewcount']++;
            }
            if (is_array($trackList) && count($trackList)) {
                foreach ($trackList as $threadId) {
                    $result['trackcount']++;
                    $threadId = (int) $threadId;
                    if ($threadId > 0) {
                        $tmp = array();
                        $tmp['track_userid'] = $userId;
                        $tmp['track_thread'] = $threadId;
                        e107::getDb()->insert('forum_track', $tmp);
                    }
                }
            }
        }
    }
    $mes->addSuccess("User data move results:\n\t<ul>\n\t<li>Number of users processed: {$result['usercount']} </li>\n\t<li>Number of viewed data processed: {$result['viewcount']} </li>\n\t<li>Number of tracked records added: {$result['trackcount']} </li>\n\t</ul>\n\t");
    $text = "<form method='post' action='" . e_SELF . "?step=5'>\n\t<input class='btn btn-success' type='submit' name='nextStep[5]' value='Proceed to step 5' />\n\t</form>";
    $ns->tablerender($stepCaption, $mes->render() . $text);
}
Example #24
0
File: faqs.php Project: armpit/e107
        $faq_question = $aj->formtpa($_POST['faq_question'], "on");
        $data = $aj->formtpa($_POST['data'], "on");
        $sql->db_Update("faqs", "faq_parent='" . $_POST['faq_parent'] . "', faq_question ='{$faq_question}', faq_answer='{$data}', faq_comment='" . $_POST['faq_comment'] . "'  WHERE faq_id='" . $idx . "' ");
        $message = FAQ_ADLAN_29;
        unset($faq_question, $data);
    } else {
        $message = FAQ_ADLAN_30;
    }
}
if (isset($_POST['commentsubmit'])) {
    $pid = isset($_POST['pid']) ? $_POST['pid'] : 0;
    $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "faq", $idx, $pid, $_POST['subject']);
}
// Actions +++++++++++++++++++++++++++++
$faq = new faq();
$faqpref = e107::getPlugConfig('faqs')->getPref();
if ($action == "" || $action == "main") {
    if (vartrue($faqpref['classic_look'])) {
        $ftmp = $faq->show_existing_parents($action, $sub_action, $id, $from, $amount);
        $caption = FAQLAN_41;
    } else {
        $srch = vartrue($_GET['srch']);
        $ftmp = $faq->view_all($srch);
        $caption = FAQLAN_FAQ;
    }
    $pageTitle = '';
    //	define("e_PAGETITLE", $ftmp['caption']);
    if (vartrue($faqpref['page_title'])) {
        $pageTitle = $faqpref['page_title'][e_LANGUAGE];
    } else {
        $pageTitle = $ftmp['caption'];
Example #25
0
File: faqs.php Project: notzen/e107
 function __construct()
 {
     $sc = e107::getScBatch('faqs', TRUE);
     $this->pref = e107::getPlugConfig('faqs')->getPref();
     $sc->pref = $this->pref;
     // setScVar('faqs_shortcodes', 'pref', $this->pref);
 }
Example #26
0
 /**
  * Set Config object
  * @return e_admin_ui
  */
 protected function _setConfig()
 {
     $this->_pref = $this->pluginName == 'core' ? e107::getConfig() : e107::getPlugConfig($this->pluginName);
     $dataFields = $validateRules = array();
     foreach ($this->prefs as $key => $att) {
         // create dataFields array
         $dataFields[$key] = vartrue($att['data'], 'string');
         // create validation array
         if (vartrue($att['validate'])) {
             $validateRules[$key] = array(true === $att['validate'] ? 'required' : $att['validate'], varset($att['rule']), $att['title'], varset($att['error'], $att['help']));
         }
         /* Not implemented in e_model yet
         			elseif(vartrue($att['check']))
         			{
         				$validateRules[$key] = array($att['check'], varset($att['rule']), $att['title'], varset($att['error'], $att['help']));
         			}*/
     }
     $this->_pref->setDataFields($dataFields)->setValidationRules($validateRules);
     return $this;
 }
Example #27
0
/**
 * Ensures the private key variable used to generate tokens is set.
 *
 * @return string
 *   The private key.
 */
function google_analytics_get_private_key()
{
    $prefs = e107::getPlugConfig('google_analytics')->getPref();
    $key = varset($prefs['private_key'], '');
    if (empty($key)) {
        $key = google_analytics_random_key();
        e107::getPlugConfig('google_analytics')->set('private_key', $key)->save();
    }
    return $key;
}
Example #28
0
{
    global $ef;
    global $action;
    $ef->show_options($action);
}
if ($_POST['save_settings']) {
    $tpref['customjs'] = $_POST['customjs'];
    $tpref['theme_advanced_buttons1'] = $_POST['theme_advanced_buttons1'];
    $tpref['theme_advanced_buttons2'] = $_POST['theme_advanced_buttons2'];
    $tpref['theme_advanced_buttons3'] = $_POST['theme_advanced_buttons3'];
    $tpref['theme_advanced_buttons4'] = $_POST['theme_advanced_buttons4'];
    $tpref['plugins'] = $_POST['mce_plugins'];
    e107::getPlugConfig('tinymce')->setPref($tpref);
    e107::getPlugConfig('tinymce')->save();
}
$tpref = e107::getPlugConfig('tinymce')->getPref();
if ($_POST['save_settings']) {
    $emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS);
    e107::getRender()->tablerender(LAN_UPDATED, $emessage->render());
}
if (!$tpref['theme_advanced_buttons1']) {
    $tpref['theme_advanced_buttons1'] = "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect";
}
if (!$tpref['theme_advanced_buttons2']) {
    $tpref['theme_advanced_buttons2'] = "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor";
}
if (!$tpref['theme_advanced_buttons3']) {
    $tpref['theme_advanced_buttons3'] = "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,emoticons,ibrowser";
}
if (!$tpref['theme_advanced_buttons4']) {
    $tpref['theme_advanced_buttons4'] = "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage";
Example #29
0
if (!getperms('P')) {
    header('location:' . e_BASE . 'index.php');
    exit;
}
$e_sub_cat = 'forum';
require_once e_ADMIN . 'auth.php';
require_once e_HANDLER . 'userclass_class.php';
require_once e_HANDLER . 'form_handler.php';
require_once e_HANDLER . 'ren_help.php';
require_once e_PLUGIN . 'forum/forum_class.php';
require_once e_PLUGIN . 'forum/forum_admin_class.php';
$emessage = eMessage::getInstance();
$rs = new form();
$for = new e107forum();
$forum = new forumAdmin();
$fPref = e107::getPlugConfig('forum', '', false);
define('IMAGE_new', "<img src='" . img_path('new.png') . "' alt='' />");
define('IMAGE_sub', "<img src='" . e_PLUGIN . "forum/images/forums_16.png' alt='" . FORLAN_145 . "' title='" . FORLAN_145 . "' />");
define('IMAGE_nosub', "<img src='" . e_PLUGIN . "forum/images/sub_forums_16.png' alt='" . FORLAN_145 . "' title='" . FORLAN_145 . "' />");
$deltest = array_flip($_POST);
if (e_QUERY) {
    $tmp = explode('.', e_QUERY);
    $action = $tmp[0];
    $sub_action = $tmp[1];
    $id = $tmp[2];
    unset($tmp);
}
if (isset($_POST['delete'])) {
    $tmp = array_pop(array_flip($_POST['delete']));
    list($delete, $del_id) = explode('_', $tmp);
}
Example #30
0
$sql = e107::getDb();
$gen = new convert();
$pref = e107::getPref();
e107::lan('forum', 'menu', true);
// English_menu.php or {LANGUAGE}_menu.php
// include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_newforumposts_menu.php');
// include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/'.e_LANGUAGE.'_menu.php');
include_once e_PLUGIN . 'forum/forum_class.php';
$max_age = vartrue($menu_pref['newforumposts_maxage'], 0);
$max_age = $max_age == 0 ? '' : '(t.post_datestamp > ' . (time() - (int) $max_age * 86400) . ') AND ';
$forum = new e107forum();
$forumList = implode(',', $forum->getForumPermList('view'));
//TODO: Use query from forum class to get thread list
$qry = "\nSELECT\n\tp.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry,\n\tt.thread_id, t.thread_datestamp, t.thread_name, u.user_name\nFROM `#forum_post` as p\nLEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread\nLEFT JOIN `#user` AS u ON u.user_id = p.post_user\nWHERE {$maxage} p.post_forum IN ({$forumList})\nORDER BY p.post_datestamp DESC LIMIT 0, " . $menu_pref['newforumposts_display'];
// Get forum plugin preferences.
$plugForumPrefs = e107::getPlugConfig('forum')->getPref();
// New MySQL class instantiation to avoid overrides.
$db = new e_db_mysql();
// TODO: cache menu.
if ($results = $sql->gen($qry)) {
    $text = "<ul>";
    while ($row = $sql->fetch(MYSQL_ASSOC)) {
        $datestamp = $gen->convert_date($row['post_datestamp'], 'relative');
        $id = $row['thread_id'];
        $topic = $row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:';
        $topic .= strip_tags($tp->toHTML($row['thread_name'], true, 'emotes_off, no_make_clickable, parse_bb', '', $pref['menu_wordwrap']));
        if ($row['post_user_anon']) {
            $poster = $row['post_user_anon'];
        } else {
            if ($row['user_name']) {
                $poster = "<a href='" . e107::getUrl()->create('user/profile/view', array('name' => $row['user_name'], 'id' => $row['post_user'])) . "'>{$row['user_name']}</a>";