Example #1
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);
    }
}
Example #2
0
 function unanswered()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $limit = 25;
     $count = $sql->retrieve('faqs', 'faq_id', "faq_answer=''  ", true);
     $existing = $sql->retrieve('faqs', 'faq_id,faq_question,faq_datestamp', "faq_answer=''  ORDER BY faq_datestamp DESC LIMIT " . $limit, true);
     if (empty($existing)) {
         return;
     }
     $questions = array();
     foreach ($existing as $row) {
         $questions[] = "<i>" . $row['faq_question'] . "</i><br /><small>" . $tp->toDate($row['faq_datestamp'], 'short') . "</small>\n";
         //	$questions[] = $row['faq_question'];
     }
     //
     //	$questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>");
     $name = SITENAME . " Automation";
     $email = e107::pref('core', 'siteadminemail');
     $name = e107::pref('core', 'siteadmin');
     $link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
     $body = "<h2>" . count($count) . " Unuanswered Questions at " . SITENAME . "</h2>To answer these questions, please login to " . SITENAME . " and then <a href='{$link}'>click here</a>.<br />\n\t\t\tThe " . $limit . " most recent questions are displayed below.\n\t\t\t<ul><li>" . implode("</li><li>", $questions) . "</li></ul>";
     $eml = array('subject' => count($count) . " Unuanswered Question as of " . date('d-M-Y') . " ", 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $body);
     e107::getEmail()->sendEmail($email, $name, $eml);
 }
Example #3
0
 function showImages($cat)
 {
     $mes = e107::getMessage();
     $tp = e107::getParser();
     $template = e107::getTemplate('gallery');
     $template = array_change_key_case($template);
     $sc = e107::getScBatch('gallery', TRUE);
     if (defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) {
         $template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
     }
     $sc->total = e107::getMedia()->countImages($cat);
     $sc->amount = 12;
     // TODO Add Pref. amount per page.
     $sc->curCat = $cat;
     $sc->from = $_GET['frm'] ? intval($_GET['frm']) : 0;
     $list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount);
     $catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs');
     $inner = "";
     foreach ($list as $row) {
         $sc->setVars($row);
         $inner .= $tp->parseTemplate($template['list_item'], TRUE, $sc);
     }
     $text = $tp->parseTemplate($template['list_start'], TRUE, $sc);
     $text .= $inner;
     $text .= $tp->parseTemplate($template['list_end'], TRUE, $sc);
     e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text);
 }
 /**
  * Render menu.
  */
 function renderMenu()
 {
     $tpl = e107::getTemplate('nodejs_comment');
     $sc = e107::getScBatch('nodejs_comment', true);
     $tp = e107::getParser();
     $cm = e107::getComment();
     $amount = (int) vartrue($this->plugPrefs['comment_display'], 10);
     /**
      * getCommentData() returns with array, which contains:
      * - comment_datestamp
      * - comment_author_id
      * - comment_author
      * - comment_comment
      * - comment_subject
      * - comment_type
      * - comment_title
      * - comment_url
      */
     $items = $cm->getCommentData($amount);
     $text = $tp->parseTemplate($tpl['MENU']['LATEST']['HEADER'], true, $sc);
     foreach ($items as $item) {
         $sc->setVars($item);
         $text .= $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
     }
     if (empty($items)) {
         $text .= '<a href="#" class="list-group-item no-posts text-center">' . LAN_PLUGIN_NODEJS_COMMENT_FRONT_05 . '</a>';
     }
     $text .= $tp->parseTemplate($tpl['MENU']['LATEST']['FOOTER'], true, $sc);
     e107::getRender()->tablerender(LAN_PLUGIN_NODEJS_COMMENT_FRONT_04, $text);
     unset($text);
 }
Example #5
0
function user_avatar_shortcode($parm = '')
{
    global $loop_uid;
    $height = e107::getPref("im_height");
    $width = e107::getPref("im_width");
    $tp = e107::getParser();
    if (intval($loop_uid) > 0 && trim($parm) == "") {
        $parm = $loop_uid;
    }
    if (is_numeric($parm)) {
        if ($parm == USERID) {
            $image = USERIMAGE;
        } else {
            $row = get_user_data(intval($parm));
            $image = $row['user_image'];
        }
    } elseif ($parm) {
        $image = $parm;
    } elseif (USERIMAGE) {
        $image = USERIMAGE;
    } else {
        $image = "";
    }
    if (vartrue($image)) {
        $img = strpos($image, "://") !== false ? $image : $tp->thumbUrl(e_MEDIA . "avatars/" . $image, "aw=" . $width . "&ah=" . $height);
        $text = "<img class='user-avatar e-tip' src='" . $img . "' alt='' style='width:" . $width . "px; height:" . $height . "px' />\n\t\t";
    } else {
        $img = $tp->thumbUrl(e_IMAGE . "generic/blank_avatar.jpg", "aw=" . $width . "&ah=" . $height);
        $text = "<img class='user-avatar' src='" . $img . "' alt='' />";
    }
    return $text;
}
Example #6
0
function iconpicker_shortcode($parm)
{
    $parms = array();
    parse_str($parm, $parms);
    $name = varset($parms['id']);
    $sql = e107::getDb();
    $frm = e107::getForm();
    $tp = e107::getParser();
    // $sc_parameters is currently being used to select the media-category.
    $qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") ";
    $qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
    $qry .= "ORDER BY media_category,media_name";
    $str = "";
    $size_section = array();
    $lastsize = "16";
    if ($sql->db_Select_gen($qry)) {
        while ($row = $sql->db_Fetch()) {
            list($tmp, $tmp2, $size) = explode("_", $row['media_category']);
            if ($str != '' && $size != $lastsize) {
                $size_section[] = $str;
                $str = "";
            }
            $str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>";
            $lastsize = $size;
        }
        return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>';
    }
}
Example #7
0
 /**
  * chapter/index and book/index by name callback
  * @param eRequest $request
  */
 public function chapterIdByTitle(eRequest $request)
 {
     $name = $request->getRequestParam('name');
     if ($id = $request->getRequestParam('id')) {
         $request->setRequestParam('name', $id);
         return;
     } elseif (!$name || is_numeric($name)) {
         if (ADMIN) {
             e107::getMessage()->addError("One of your page-chapters is missing a SEF URL value");
         }
         return;
     }
     $sql = e107::getDb('url');
     $name = e107::getParser()->toDB($name);
     if ($sql->select('page_chapters', 'chapter_id', "chapter_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['chapter_id']);
         $request->setRequestParam('type', 'bk');
         e107::getMessage()->addDebug("Set CHAPTER ID =  '" . $name['chapter_id'] . "'");
     } elseif ($sql->select('page', 'page_id', "page_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['page_id']);
         $request->setRequestParam('type', 'id');
         e107::getMessage()->addDebug("Set PAGE ID =  '" . $name['page_id'] . "'");
     } else {
         if (ADMIN) {
             e107::getMessage()->addError("Couldn't find a book, chapter or page with a SEF URL value of '" . $name . "'");
         }
         $request->setRequestParam('id', 0);
     }
 }
Example #8
0
 public function renderBanner($row)
 {
     $sql = e107::getDb('banner');
     $tp = e107::getParser();
     if (!$row['banner_image']) {
         return "<a href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external'>no image assigned to this banner</a>";
     }
     $fileext1 = substr(strrchr($row['banner_image'], '.'), 1);
     $sql->update('banner', 'banner_impressions=banner_impressions+1 WHERE banner_id=' . (int) $row['banner_id']);
     switch ($fileext1) {
         case 'swf':
             return "\n\t\t\t\t\t<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"468\" height=\"60\">\n\n\t\t\t\t\t<param name=\"movie\" value=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\">\n\n\t\t\t\t\t<param name=\"quality\" value=\"high\">\n\n\t\t\t\t\t<param name=\"SCALE\" value=\"noborder\">\n\n\t\t\t\t\t<embed src=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\" width=\"468\" height=\"60\" scale=\"noborder\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>\n\t\t\t\t\t</object>\n\t\t\t\t\t";
             break;
         case 'html':
         case 'js':
         case 'php':
             // Code - may 'echo' text, or may return it as a value
             $file_data = file_get_contents(e_IMAGE . 'banners/' . $row['banner_image']);
             return $file_data;
             break;
         default:
             $src = $row['banner_image'][0] == '{' ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS . 'banners/' . $row['banner_image'];
             $ban_ret = "<img class='e-banner img-responsive' src='" . $src . "' alt='" . $row['banner_clickurl'] . "' style='border:0' />";
             break;
     }
     return "<a class='e-tip' href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external' title=\"" . $tp->toAttribute($row['banner_description']) . "\">" . $ban_ret . '</a>';
 }
Example #9
0
 function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE)
 {
     $tp = e107::getParser();
     $cat_link = strpos($cat_link, '://') === FALSE ? e_HTTP . $cat_link : $cat_link;
     $cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE);
     if ($cat_open == 4 || $cat_open == 5) {
         $dimen = $cat_open == 4 ? "600,400" : "800,600";
         $href = " href=\"javascript:open_window('" . $cat_link . "'," . $dimen . ")\"";
     } else {
         $href = "href='" . $cat_link . "'";
     }
     $text = "<a class='menuItem' " . $href . " ";
     if ($cat_id) {
         if (isset($params[2]) && $params[2] == 'link') {
             $text .= "onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\"";
         } else {
             $text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\"";
         }
     }
     if ($cat_open == 1) {
         $text .= " rel='external' ";
     }
     $text .= ">";
     if ($cat_img != 'no_icons') {
         $text .= "<span class='menuItemBuffer'>" . $cat_img . "</span>";
     }
     $text .= "<span class='menuItemText'>" . $tp->toHTML($cat_title, "", "defs, no_hook") . "</span>";
     if ($cat_id) {
         $text .= "<span class=\"menuItemArrow\">&#9654;</span>";
     }
     $text .= "</a>";
     return $text;
 }
Example #10
0
function plugin_shortcode($parm = '')
{
    $tp = e107::getParser();
    @(list($menu, $parms) = explode('|', $parm . '|', 2));
    $path = $tp->toDB(dirname($menu));
    $name = $tp->toDB(basename($menu));
    //BC Fix for v2.x
    $changeMenuPaths = array(array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'), array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'counter_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'), array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'), array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news2_menu'));
    foreach ($changeMenuPaths as $k => $v) {
        if ($v['oldpath'] == $path && $v['menu'] == $name) {
            $path = $v['newpath'];
            continue;
        }
    }
    if ($path == '.') {
        $path = $menu;
    }
    /**
     * @todo check if plugin is installed when installation required
     */
    /**
     *	fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters
     */
    return e107::getMenu()->renderMenu($path, $name, trim($parms, '|'), true);
}
Example #11
0
 function getListData()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $list_caption = $this->parent->settings['caption'];
     $list_display = $this->parent->settings['open'] ? "" : "none";
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $lvisit = $this->parent->getlvisit();
         $qry = "cb_datestamp>" . $lvisit;
     } else {
         $qry = "cb_id != '0' ";
     }
     $qry .= " ORDER BY cb_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']);
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     if (!($chatbox_posts = $this->parent->e107->sql->gen("SELECT * FROM #chatbox WHERE " . $qry))) {
         $list_data = LIST_CHATBOX_2;
     } else {
         while ($row = $this->parent->e107->sql->fetch()) {
             $cb_id = substr($row['cb_nick'], 0, strpos($row['cb_nick'], "."));
             $cb_nick = substr($row['cb_nick'], strpos($row['cb_nick'], ".") + 1);
             $cb_message = $row['cb_blocked'] ? CHATBOX_L6 : str_replace("<br />", " ", $tp->toHTML($row['cb_message']));
             $rowheading = $this->parent->parse_heading($cb_message);
             $record['icon'] = $bullet;
             $record['heading'] = $rowheading;
             $record['author'] = $this->parent->settings['author'] ? $cb_id != 0 ? "<a href='" . e_BASE . "user.php?id.{$cb_id}'>" . $cb_nick . "</a>" : $cb_nick : "";
             $record['category'] = "";
             $record['date'] = $this->parent->settings['date'] ? $row['cb_datestamp'] ? $this->parent->getListDate($row['cb_datestamp']) : "" : "";
             $record['info'] = "";
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
Example #12
0
/**
 * @DEPRECATED 
 * Use e107::getParser()->parseTemplate("{USER_AVATAR=".$avatar."}",true); instead. 
 */
function avatar($avatar)
{
    return e107::getParser()->parseTemplate("{USER_AVATAR=" . $avatar . "}", true);
    /*
    	global $tp;
    	if (stristr($avatar, '-upload-') !== false)
    	{
    		return e_AVATAR_UPLOAD.str_replace('-upload-', '', $avatar);
    	}
    	elseif (stristr($avatar, 'Binary') !== false)
    	{
    		$sqla = new db;
    		preg_match("/Binary\s(.*?)\//", $avatar, $result);
    		$sqla->db_Select('rbinary', '*', "binary_id='".$tp->toDB($result[1])."' ");
    		$row = $sqla->db_Fetch();
    		return $row['binary_data'];
    	}
    	elseif (strpos($avatar, 'http://') === false)
    	{
    		return SITEURLBASE.e_IMAGE_ABS."avatars/".$avatar;
    	}
    	else
    	{
    		return $avatar;
    	}
    */
}
Example #13
0
 function getLink($id)
 {
     if ($this->row == '') {
         $this->row = $this->getRecord($id);
     }
     $url = e_BASE . "download.php?view." . $this->row['download_id'];
     return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['download_name'], TRUE, '') . "</a>";
 }
Example #14
0
 function getLink($id)
 {
     if ($this->row == '') {
         $this->row = $this->getRecord($id);
     }
     $url = e_BASE . "page.php?" . $this->row['page_id'];
     $url = e107::getUrl()->create('page/view', $this->row, 'allow=page_id,page_title,page_sef');
     return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['page_title'], TRUE, '') . "</a>";
 }
Example #15
0
 public function beforeUpdate($new_data, $old_data, $id)
 {
     if ($old_data['quote'] == "") {
         $new_data['quote'] = e107::getParser()->toDb($old_data['quote'], true, false, 'no_html');
     } else {
         $new_data['quote'] = $old_data['quote'];
     }
     return $new_data;
 }
Example #16
0
 public function actionForbidden()
 {
     $this->getResponse()->setRenderMod('error403')->addHeader('HTTP/1.0 403 Forbidden');
     $this->addTitle(LAN_ERROR_7);
     $template = e107::getCoreTemplate('error', 403);
     $vars = new e_vars(array('siteUrl' => SITEURL));
     $body = e107::getParser()->parseTemplate($template['start'] . $template['body'] . $template['end'], true, null, $vars);
     $this->addBody($body);
 }
Example #17
0
 function getLink($id)
 {
     if (empty($this->row)) {
         $this->row = $this->getRecord($id);
     }
     //$url = e_BASE."news.php?item.".$this->row['news_id'];
     $url = e107::getUrl()->create('news/view/item', $this->row);
     return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['news_title'], TRUE, '') . "</a>";
 }
Example #18
0
 /**
  * Optional - Advanced Where
  * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
  */
 function where($parm = '')
 {
     $tp = e107::getParser();
     $qry = "l.link_active = 1 AND l.link_class IN (" . USERCLASS_LIST . ") AND " . $advanced_where;
     if (isset($parm['cat']) && is_numeric($parm['cat'])) {
         $qry .= " l.link_category='" . $_GET['cat'] . "' AND";
     }
     return $qry;
 }
Example #19
0
 function getLink($id)
 {
     if ($this->row == '') {
         if ($this->row = $this->getRecord($id)) {
             $url = e_PLUGIN . "calendar_menu/event.php?{$this->row['event_start']}.event.{$this->row['event_id']}";
             return "<a href='" . $url . "'>" . e107::getParser()->toHTML($this->row['event_title'], TRUE, '') . "</a>";
         }
     }
     return '';
 }
Example #20
0
 function process()
 {
     $pref = e107::getConfig();
     $tp = e107::getParser();
     $theme_pref = array();
     $theme_pref['example'] = $tp->toDb($_POST['_blank_example']);
     $theme_pref['example2'] = $tp->toDb($_POST['_blank_example2']);
     $pref->set('sitetheme_pref', $theme_pref);
     return $pref->dataHasChanged();
 }
Example #21
0
 function process()
 {
     $pref = e107::getConfig();
     $tp = e107::getParser();
     $theme_pref = array();
     $theme_pref['nav_alignment'] = $_POST['nav_alignment'];
     $theme_pref['usernav_placement'] = $_POST['usernav_placement'];
     $theme_pref['branding'] = $_POST['branding'];
     $pref->set('sitetheme_pref', $theme_pref);
     return $pref->dataHasChanged();
 }
Example #22
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;
 }
Example #23
0
function glyph_shortcode($parm = '')
{
    if (!is_array($parm)) {
        $file = $parm;
        $parm = null;
    } else {
        $file = vartrue($parm['type']);
        unset($parm['type']);
    }
    return e107::getParser()->toGlyph($file, $parm);
}
Example #24
0
 function faqCategories()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $sublinks = array();
     $sql->select("faqs_info", "*", "faq_info_id != '' ORDER BY faq_info_order");
     while ($row = $sql->fetch()) {
         $sublinks[] = array('link_name' => $tp->toHtml($row['faq_info_title'], '', 'TITLE'), 'link_url' => e107::getUrl()->sc('faqs/list/all', array('category' => $row['faq_info_id'])), 'link_description' => $row['faq_info_about'], 'link_button' => $row['faq_info_icon'], 'link_category' => '', 'link_order' => '', 'link_parent' => '', 'link_open' => '', 'link_class' => intval($row['faq_info_class']));
     }
     return $sublinks;
 }
Example #25
0
function search_user($row)
{
    $tp = e107::getParser();
    $res['link'] = e107::getUrl()->create('user/profile/view', array('id' => $row['user_id'], 'name' => $row['user_name']));
    //"user.php?id.".$row['user_id'];
    $res['pre_title'] = $row['user_id'] . " | ";
    $res['title'] = $row['user_name'];
    $res['summary'] = $row['user_signature'] ? LAN_SEARCH_72 . ": " . $row['user_signature'] : LAN_SEARCH_73;
    $res['detail'] = LAN_SEARCH_74 . ": " . $tp->toDate($row['user_join'], "long");
    return $res;
}
 /**
  * Render username as a link.
  *
  * @return string
  */
 function sc_online_user()
 {
     $tp = e107::getParser();
     $tp->thumbWidth = 20;
     $tp->thumbHeight = 20;
     $avatar = $tp->toAvatar($this->var['user']);
     $uparams = array('id' => $this->var['user']['user_id'], 'name' => $this->var['user']['user_name']);
     $markup = '<a href="' . e107::getUrl()->create('user/profile/view', $uparams) . '">';
     $markup .= $avatar . ' ' . $uparams['name'];
     $markup .= '</a>';
     return $markup;
 }
Example #27
0
 /**
  * Optional - Advanced Where
  * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
  */
 function where($parm = '')
 {
     $tp = e107::getParser();
     $qry = "";
     if (vartrue($parm['time']) && is_numeric($parm['time'])) {
         $qry .= " cb_datestamp " . ($parm['on'] == 'new' ? '>=' : '<=') . " '" . (time() - $parm['time']) . "' AND";
     }
     if (vartrue($parm['author'])) {
         $qry .= " cb_nick LIKE '%" . $tp->toDB($parm['author']) . "%' AND";
     }
     return $qry;
 }
Example #28
0
function setimage_shortcode($parm, $mode = '')
{
    ### Reset to defaults TODO site prefs
    if (isset($parm['default'])) {
        $parm['w'] = 100;
        $parm['h'] = 0;
        $parm['crop'] = 0;
    }
    e107::getParser()->thumbWidth = vartrue($parm['w'], 100);
    e107::getParser()->thumbHeight = vartrue($parm['h'], 0);
    e107::getParser()->thumbCrop = vartrue($parm['crop'], 0);
}
Example #29
0
 /**
  * Optional - Advanced Where
  * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
  */
 function where($parm = '')
 {
     $tp = e107::getParser();
     $qry = " find_in_set(x.faq_info_class,'" . USERCLASS_LIST . "') AND ";
     if (vartrue($parm['time']) && is_numeric($parm['time'])) {
         $qry .= " cb_datestamp " . ($parm['on'] == 'new' ? '>=' : '<=') . " '" . (time() - $parm['time']) . "' AND";
     }
     if (vartrue($parm['author'])) {
         $qry .= " cb_nick LIKE '%" . $tp->toDB($parm['author']) . "%' AND";
     }
     return $qry;
 }
Example #30
0
 function sc_cm_comment($parm = '')
 {
     $menu_pref = e107::getConfig('menu')->getPref();
     $tp = e107::getParser();
     $COMMENT = '';
     if ($menu_pref['comment_characters'] > 0) {
         $COMMENT = strip_tags($tp->toHTML($this->var['comment_comment'], TRUE, "emotes_off, no_make_clickable", "", e107::getPref('menu_wordwrap')));
         if ($tp->ustrlen($COMMENT) > $menu_pref['comment_characters']) {
             $COMMENT = $tp->text_truncate($COMMENT, $menu_pref['comment_characters'], '') . ($this->var['comment_url'] ? " <a href='" . $this->var['comment_url'] . "'>" : "") . defset($menu_pref['comment_postfix'], $menu_pref['comment_postfix']) . ($this->var['comment_url'] ? "</a>" : "");
         }
     }
     return $COMMENT;
 }