Esempio n. 1
0
 function sc_threadtopic()
 {
     global $THREADTOPIC_REPLY;
     $tmp = $this->forum->postGet($this->threadInfo['thread_id'], 0, 1);
     e107::getScBatch('view', 'forum')->setScVar('postInfo', $tmp[0]);
     return $this->e107->tp->parseTemplate($THREADTOPIC_REPLY, true);
 }
Esempio n. 2
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);
 }
Esempio n. 4
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);
    }
}
Esempio n. 5
0
function display_help($tagid = "helpb", $mode = 1, $addtextfunc = "addtext", $helpfunc = "help", $helpsize = '')
{
    return e107::getBB()->renderButtons($mode, 'data');
    // guessing the name of the textarea as 'data' no indicator unfortunately.
    // may cause pre-image and pre-file selector issues.
    //  if(defsettrue('e_WYSIWYG')) { return; }
    global $tp, $pref, $eplug_bb, $bbcode_func, $register_bb, $bbcode_help, $bbcode_helpactive, $bbcode_helptag, $bbcode_helpsize;
    $bbcode_helpsize = $helpsize;
    $bbcode_func = $addtextfunc;
    $bbcode_help = $helpfunc;
    $bbcode_helptag = $tagid;
    // $arr = get_defined_vars();
    // print_a($arr);
    // load the template
    if (is_readable(THEME . "bbcode_template.php")) {
        include THEME . "bbcode_template.php";
    } else {
        include e_THEME . "templates/bbcode_template.php";
    }
    if ($mode != 2 && $mode != "forum") {
        $bbcode_helpactive = TRUE;
    }
    // Load the Plugin bbcode AFTER the templates, so they can modify or replace.
    if (!empty($pref['e_bb_list'])) {
        foreach ($pref['e_bb_list'] as $val) {
            if (is_readable(e_PLUGIN . $val . "/e_bb.php")) {
                require e_PLUGIN . $val . "/e_bb.php";
            }
        }
    }
    $temp = array();
    $temp['news'] = $BBCODE_TEMPLATE_NEWSPOST;
    $temp['submitnews'] = $BBCODE_TEMPLATE_SUBMITNEWS;
    $temp['extended'] = $BBCODE_TEMPLATE_NEWSPOST;
    $temp['admin'] = $BBCODE_TEMPLATE_ADMIN;
    $temp['mailout'] = $BBCODE_TEMPLATE_MAILOUT;
    $temp['page'] = $BBCODE_TEMPLATE_CPAGE;
    $temp['maintenance'] = $BBCODE_TEMPLATE_ADMIN;
    $temp['comment'] = $BBCODE_TEMPLATE;
    $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE;
    if (isset($temp[$mode])) {
        $BBCODE_TEMPLATE = $temp[$mode];
    }
    $visible = deftrue('e_WYSIWYG') ? "style='display:none'" : "";
    if (is_readable(e_CORE . "shortcodes/batch/bbcode_shortcodes.php")) {
        $sc = e107::getScBatch('bbcode');
        if ($tagid == 'data') {
            $tagid = 'data_';
        }
        $data = array('tagid' => $tagid, 'template' => $mode, 'trigger' => $addtextfunc, 'hint_func' => $helpfunc, 'hint_active' => $bbcode_helpactive, 'size' => $helpsize);
        $sc->setVars($data);
        return "<div id='bbcode-panel-" . $tagid . "' class='mceToolbar bbcode-panel' {$visible}>" . $tp->parseTemplate($BBCODE_TEMPLATE) . "</div>";
    } else {
        return "ERROR: " . e_CORE . "shortcodes/batch/bbcode_shortcodes.php IS NOT READABLE.";
    }
}
Esempio n. 6
0
 function sc_social_login($parm = null)
 {
     $pref = e107::pref('core', 'social_login_active');
     if (empty($pref)) {
         return;
     }
     $sc = e107::getScBatch('signup');
     $text = "<p>Sign in with:</p>";
     $text .= $sc->sc_signup_xup_login($parm);
     $text .= "\n\t\t<div class='clearfix'></div><hr class='clearfix' />";
     return $text;
 }
Esempio n. 7
0
 function parseheader($LAYOUT)
 {
     $tp = e107::getParser();
     $tmp = explode("\n", $LAYOUT);
     $sc = e107::getScBatch('_theme_');
     foreach ($tmp as $line) {
         if (preg_match("/{.+?}/", $line)) {
             echo $tp->parseTemplate($line, true, $sc) . "\n";
             // retain line-breaks.
         } else {
             echo $line . "\n";
             // retain line-breaks.
         }
     }
 }
 /**
  * Render menu contents.
  */
 function renderMenu()
 {
     $template = e107::getTemplate('nodejs_online');
     $sc = e107::getScBatch('nodejs_online', true);
     $tp = e107::getParser();
     e107_require_once(e_PLUGIN . 'nodejs_online/includes/nodejs_online.php');
     $users = nodejs_online_get_online_users();
     $sc->setVars(array('count' => count($users)));
     $text = $tp->parseTemplate($template['MENU']['HEADER'], true, $sc);
     foreach ($users as $uid => $user) {
         $sc->setVars(array('user' => $user));
         $text .= $tp->parseTemplate($template['MENU']['ITEM'], true, $sc);
     }
     $text .= $tp->parseTemplate($template['MENU']['FOOTER'], true);
     e107::getRender()->tablerender(LAN_NODEJS_ONLINE_MENU_01, $text);
     unset($text);
 }
Esempio n. 9
0
 /**
  * Send messages to clients for updating online menu.
  */
 public function nodejs_update_online_menu()
 {
     e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
     e107_require_once(e_PLUGIN . 'nodejs_online/includes/nodejs_online.php');
     $template = e107::getTemplate('nodejs_online');
     $sc = e107::getScBatch('nodejs_online', true);
     $tp = e107::getParser();
     $users = nodejs_online_get_online_users();
     $message = (object) array('broadcast' => true, 'callback' => 'nodejsOnlineMenu', 'type' => 'nodejsOnlineMenuBadge', 'markup' => count($users));
     nodejs_enqueue_message($message);
     $list = '<li role="presentation" class="nav-header dropdown-header">' . LAN_NODEJS_ONLINE_MENU_01 . '</li>';
     foreach ($users as $uinfo => $row) {
         $sc->setVars(array('user' => $row));
         $list .= $tp->parseTemplate($template['MENU']['ITEM'], true, $sc);
     }
     $message = (object) array('broadcast' => true, 'callback' => 'nodejsOnlineMenu', 'type' => 'nodejsOnlineMenuList', 'markup' => $list);
     nodejs_enqueue_message($message);
 }
 /**
  * Render menu contents.
  */
 function renderMenu()
 {
     $template = e107::getTemplate('paypal_donation');
     $sc = e107::getScBatch('paypal_donation', true);
     $tp = e107::getParser();
     $db = e107::getDb();
     $db->select('paypal_donation', '*', 'pd_status = 1 ORDER BY pd_weight ASC');
     $text = '';
     while ($row = $db->fetch()) {
         if (check_class($row['pd_visibility']) === true) {
             $item = array('menu_item' => $row, 'amounts' => $this->getAmounts($row['pd_id']), 'raised' => $this->getRaised($row['pd_id']));
             $sc->setVars($item);
             $text .= $tp->parseTemplate($template['MENU'], true, $sc);
         }
     }
     e107::getRender()->tablerender(LAN_PAYPAL_DONATION_FRONT_01, $text);
     unset($text);
 }
 /**
  * Render menu.
  */
 function renderMenu()
 {
     $tpl = e107::getTemplate('nodejs_forum');
     $sc = e107::getScBatch('nodejs_forum', true);
     $tp = e107::getParser();
     $items = $this->getLatestForumPosts();
     $text = $tp->parseTemplate($tpl['MENU']['RECENT']['HEADER'], true, $sc);
     foreach ($items as $item) {
         // Get topic page number.
         $postNum = $this->getPostNum($item['thread']['thread_id'], $item['post']['post_id']);
         $postPage = ceil($postNum / vartrue($this->plugForumPrefs['postspage'], 10));
         $item['topicPage'] = $postPage;
         $sc->setVars($item);
         $text .= $tp->parseTemplate($tpl['MENU']['RECENT']['ITEM'], true, $sc);
     }
     if (empty($items)) {
         $text .= '<div class="no-posts text-center">' . LAN_PLUGIN_NODEJS_FORUM_FRONT_05 . '</div>';
     }
     $text .= $tp->parseTemplate($tpl['MENU']['RECENT']['FOOTER'], true, $sc);
     e107::getRender()->tablerender(LAN_PLUGIN_NODEJS_FORUM_FRONT_04, $text);
     unset($text);
 }
Esempio n. 12
0
 /**
  * Scan plugin directories and get information from e_libraries.php files.
  */
 function pluginsPage()
 {
     e107_require_once(e_PLUGIN . 'libraries/libraries.php');
     $mes = e107::getMessage();
     $tpl = e107::getTemplate('libraries');
     $sc = e107::getScBatch('libraries', true);
     $tp = e107::getParser();
     $addonsList = libraries_update_addon_list();
     $summ = count($addonsList);
     $message = str_replace('[summ]', $summ, LAN_PLUGIN_LIBRARIES_ADMIN_03);
     $mes->addInfo($message);
     $this->addTitle(LAN_PLUGIN_LIBRARIES_ADMIN_02);
     $output = $mes->render();
     $libraries = libraries_info();
     $output .= $tp->parseTemplate($tpl['TABLE']['HEADER']);
     foreach ($libraries as $machine_name => $info) {
         $details = libraries_detect($machine_name);
         $sc->setVars(array('name' => $details['name'], 'plugin' => varset($details['plugin'], false), 'theme' => varset($details['theme'], false), 'vendor' => $details['vendor url'], 'download' => $details['download url'], 'installed' => array('status' => $details['installed'], 'error' => varset($details['error'], ''), 'message' => varset($details['error message'], ''))));
         $output .= $tp->parseTemplate($tpl['TABLE']['ROW'], true, $sc);
     }
     $output .= $tp->parseTemplate($tpl['TABLE']['FOOTER']);
     return $output;
 }
Esempio n. 13
0
 function showImages($cat)
 {
     $mes = e107::getMessage();
     $tp = e107::getParser();
     $template = e107::getTemplate('gallery');
     $sc = e107::getScBatch('gallery', TRUE);
     $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);
     }
     $text = $tp->parseTemplate($template['LIST_START'], TRUE);
     $text .= $inner;
     $text .= $tp->parseTemplate($template['LIST_END'], TRUE);
     e107::getRender()->tablerender("Gallery :: " . $catname, $mes->render() . $text);
 }
Esempio n. 14
0
/**
 * Event callback after triggering "postcomment".
 *
 * @param array $comment
 *  Comment item.
 *
 * $comment contains:
 * - comment_pid
 * - comment_item_id
 * - comment_subject
 * - comment_author_id
 * - comment_author_name
 * - comment_author_email
 * - comment_datestamp
 * - comment_comment
 * - comment_blocked
 * - comment_ip
 * - comment_type
 * - comment_lock
 * - comment_share
 * - comment_nick
 * - comment_time
 * - comment_id
 *
 * getCommentData() returns with array, which contains:
 * - comment_datestamp
 * - comment_author_id
 * - comment_author
 * - comment_comment
 * - comment_subject
 * - comment_type
 * - comment_title
 * - comment_url
 */
function nodejs_comment_event_postcomment_callback($comment)
{
    e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
    $tpl = e107::getTemplate('nodejs_comment');
    $sc = e107::getScBatch('nodejs_comment', true);
    $tp = e107::getParser();
    $cm = e107::getComment();
    $cid = (int) vartrue($comment['comment_id'], 0);
    $pid = (int) vartrue($comment['comment_pid'], 0);
    $uid = (int) vartrue($comment['comment_author_id'], 0);
    $commentData = $cm->getCommentData(1, 0, 'comment_id=' . $cid);
    if (!isset($commentData[0])) {
        return;
    }
    $authorData = e107::user($uid);
    // Send notification to everyone for updating latest comments menu.
    $sc->setVars($commentData[0]);
    $markup = $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
    $message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsCommentMenu', 'type' => 'latestComments', 'markup' => $markup);
    nodejs_enqueue_message($message);
    // Send notification to everyone for notifying about new comment.
    $sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
    $markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_ALL'], true, $sc);
    $message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsComments', 'type' => 'newCommentAny', 'markup' => $markup, 'exclude' => $authorData['user_id']);
    nodejs_enqueue_message($message);
    // Reply on comment.
    if ($pid > 0) {
        $commentParentData = $cm->getCommentData(1, 0, 'comment_id=' . $pid);
        array_pop($commentParentData);
        $authorParentData = e107::user();
        // Send notification to author of parent comment for notifying about new reply.
        $sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
        $markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_OWN'], true, $sc);
        $message = (object) array('channel' => 'nodejs_user_' . $authorParentData['user_id'], 'callback' => 'nodejsComments', 'type' => 'newCommentOwn', 'markup' => $markup, 'exclude' => $authorData['user_id']);
        nodejs_enqueue_message($message);
    }
}
Esempio n. 15
0
 function __construct()
 {
     global $pref, $TEMPLATE_TAGWORDS, $tagwords_shortcodes;
     $this->e107 = e107::getInstance();
     //language
     e107::includeLan(e_PLUGIN . "tagwords/languages/" . e_LANGUAGE . ".php");
     //shortcodes
     //require_once(e_PLUGIN.'tagwords/tagwords_shortcodes.php');
     $this->shortcodes = e107::getScBatch('tagwords', TRUE);
     //$this->shortcodes = $tagwords_shortcodes;
     //template
     if (is_readable(THEME . "tagwords_template.php")) {
         require_once THEME . "tagwords_template.php";
     } else {
         require_once e_PLUGIN . "tagwords/tagwords_template.php";
     }
     $this->template = $TEMPLATE_TAGWORDS;
     $this->pref = $this->get_prefs();
     //load plugin and core tagword areas
     $this->loadPlugin();
     $this->loadCore();
     //prepare and assign key'ed tagwords data
     $this->mapper();
 }
Esempio n. 16
0
 /**
  * Render Category tree
  *
  * @param array $template 
  * @param array $parms [return, parsesc=>1|0, mode=>string]
  * @param boolean $tablerender
  * @return string
  */
 function render($template = array(), $parms = array(), $tablerender = true)
 {
     if (!$this->hasTree()) {
         return '';
     }
     $ret = array();
     $tp = e107::getParser();
     $param['current_action'] = 'list';
     // TODO more default parameters
     $bullet = defined('BULLET') ? THEME_ABS . 'images/' . BULLET : THEME_ABS . 'images/bullet2.gif';
     $vars = new e_vars(array('bullet' => $bullet, 'total' => $this->getTotal(), 'currentTotal' => count($this->getTree())));
     $parser = e107::getParser();
     $batch = e107::getScBatch('news')->setScVar('param', $param);
     $batch->wrapper('news_menu/latest');
     //@SecretR - Please FIXME, I'm lost in here. (Cam)
     $i = 1;
     $items = $this->getTree();
     if (!empty($items)) {
         $start = $parser->parseTemplate($template['start'], true, $vars);
         // must be here in case {SETIMAGE} is present and used for items below.
     }
     foreach ($items as $news) {
         $vars->counter = $i;
         $batch->setScVar('news_item', $news->getData());
         $ret[] = $parser->parseTemplate($template['item'], true, $batch, $vars);
         $i++;
     }
     if (!empty($items)) {
         $end = $parser->parseTemplate($template['end'], true, $vars);
     }
     if ($ret) {
         $separator = varset($template['separator'], '');
         $ret = $start . implode($separator, $ret) . $end;
         $return = isset($parms['return']) ? true : false;
         if ($tablerender) {
             $caption = vartrue($parms['caption']) ? defset($parms['caption'], $parms['caption']) : LAN_NEWSLATEST_MENU_TITLE;
             // found in plugins/news/languages/English.php
             $mod = true === $tablerender ? 'news_latest_menu' : $tablerender;
             return e107::getRender()->tablerender($caption, $ret, varset($parms['mode'], $mod), $return);
         }
         if ($return) {
             return $ret;
         }
         echo $ret;
     }
     return '';
 }
Esempio n. 17
0
File: page.php Progetto: armpit/e107
 public function renderCache()
 {
     $comments = '';
     if ($this->cacheData['COMMENT_FLAG']) {
         $vars = new e_vars(array('comments' => $this->pageComment(true)));
         $comments = e107::getScBatch('page', null, 'cpage')->setVars($vars)->cpagecomments();
     }
     define('e_PAGETITLE', eHelper::formatMetaTitle($this->cacheData['TITLE']));
     define('META_DESCRIPTION', $this->cacheData['META_DSCR']);
     define('META_KEYWORDS', $this->cacheData['META_KEYS']);
     if ($this->debug) {
         echo "<b>Reading page from cache</b><br />";
     }
     return str_replace('[[PAGECOMMENTS]]', $comments, $this->cacheData['PAGE']);
 }
Esempio n. 18
0
     if (vartrue($newsAr[1]['category_sef'])) {
         $newsUrlparms['name'] = $newsAr[1]['category_sef'];
     }
     if (!isset($NEWSLISTCATTITLE)) {
         $NEWSLISTCATTITLE = "<h1 class='newscatlist-title'>" . $tp->toHTML($category_name, FALSE, 'TITLE') . "</h1>";
     } else {
         $NEWSLISTCATTITLE = str_replace("{NEWSCATEGORY}", $tp->toHTML($category_name, FALSE, 'TITLE'), $NEWSLISTCATTITLE);
     }
     echo $NEWSLISTCATTITLE;
 }
 $i = 1;
 while (isset($newsAr[$i]) && $i <= $interval) {
     $news = $newsAr[$i];
     // Set the Values for the social shortcode usage.
     $socialArray = array('url' => e107::getUrl()->create('news/view/item', $news, 'full=1'), 'title' => $tp->toText($news['news_title']), 'tags' => $news['news_meta_keywords']);
     $socialObj = e107::getScBatch('social');
     if (is_object($socialObj)) {
         $socialObj->setVars($socialArray);
     }
     if (function_exists("news_style")) {
         $template = news_style($news, $action, $param);
     }
     //        render new date header if pref selected ...
     $thispostday = strftime("%j", $news['news_datestamp']);
     if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) {
         echo "<div class='" . DATEHEADERCLASS . "'>" . strftime("%A %d %B %Y", $news['news_datestamp']) . "</div>";
     }
     $newpostday = $thispostday;
     $news['category_id'] = $news['news_category'];
     if ($action == "item") {
         unset($news['news_render_type']);
Esempio n. 19
0
<?php

if (!defined('e107_INIT')) {
    exit;
}
e107::lan('core', 'contact');
$head = '<form id="contact-menu" action="' . e_HTTP . 'contact.php" method="post" >';
//XXX Template must conform to Bootstrap specs: http://twitter.github.com/bootstrap/base-css.html#forms
//TODO Security Image.
$foot = '</form>';
$template = e107::getCoreTemplate('contact', 'menu');
$contact_shortcodes = e107::getScBatch('contact');
$text = $tp->parseTemplate($head . $template . $foot, true, $contact_shortcodes);
$ns->tablerender("Contact Us", $text, 'contact-menu');
Esempio n. 20
0
    function renderLatestComments()
    {
        $sql = e107::getDb();
        $tp = e107::getParser();
        if (!check_class('B')) {
            //		return;
        }
        if (!($rows = $sql->retrieve('comments', '*', 'comment_blocked=2 ORDER BY comment_id DESC LIMIT 25', true))) {
            return null;
        }
        $sc = e107::getScBatch('comment');
        $text = '
		  <ul class="media-list unstyled">';
        // <button class='btn btn-mini'><i class='icon-pencil'></i> Edit</button>
        //XXX Always keep template hardcoded here - heavy use of ajax and ids.
        $count = 1;
        foreach ($rows as $row) {
            $hide = $count > 3 ? ' hide' : '';
            $TEMPLATE = "{SETIMAGE: w=40&h=40}\n\t\t\t<li id='comment-" . $row['comment_id'] . "' class='media" . $hide . "'>\n\t\t\t\t<span class='media-object pull-left'>{USER_AVATAR=" . $row['comment_author_id'] . "}</span> \n\t\t\t\t<div class='btn-group pull-right'>\n\t            \t<button data-target='" . e_BASE . "comment.php' data-comment-id='" . $row['comment_id'] . "' data-comment-action='delete' class='btn btn-sm btn-mini btn-danger'><i class='icon-remove'></i> Delete</button>\n\t            \t<button data-target='" . e_BASE . "comment.php' data-comment-id='" . $row['comment_id'] . "' data-comment-action='approve' class='btn btn-sm btn-mini btn-success'><i class='icon-ok'></i> Approve</button>\n\t            </div>\n\t\t\t\t<div class='media-body'><small class='muted smalltext'>Posted by {USERNAME} {TIMEDATE=relative}</small><br />\n\t\t\t\t\t<p>{COMMENT}</p> \n\t\t\t\t</div>\n\t\t\t\t</li>";
            //TODO LAN for 'Posted by [x] ';
            $sc->setVars($row);
            $text .= $tp->parseTemplate($TEMPLATE, true, $sc);
            $count++;
        }
        $text .= '
     		</ul>
		    <div class="right">
		      <a class="btn btn-mini btn-primary text-right" href="' . e_ADMIN . 'comment.php?searchquery=&filter_options=comment_blocked__2">View all</a>
		    </div>
		 ';
        // $text .= "<small class='text-center text-warning'>Note: Not fully functional at the moment.</small>";
        $ns = e107::getRender();
        return $ns->tablerender("Latest Comments", $text, 'core-infopanel_online', true);
    }
Esempio n. 21
0
/*
* AnteUp - A Donation Tracking Plugin for e107
*
* Copyright (C) 2012-2015 Patrick Weaver (http://trickmod.com/)
* For additional information refer to the README.mkd file.
*
*/
require_once "../../class2.php";
require_once HEADERF;
require_once e_PLUGIN . "anteup/_class.php";
e107::lan('anteup');
$pref = e107::pref('anteup');
if (!empty($pref['anteup_paypal']) || $pref['anteup_paypal'] != "*****@*****.**") {
    $frm = e107::getForm();
    $tp = e107::getParser();
    $sc = e107::getScBatch('anteup', true);
    $template = e107::getTemplate('anteup');
    $text = $frm->open('donate_form', 'post', 'https://www.paypal.com/cgi-bin/webscr');
    $text .= $tp->parseTemplate($template['donate'], false, $sc);
    $text .= $frm->hidden('cmd', '_xclick');
    $text .= $frm->hidden('business', $pref['anteup_paypal']);
    $text .= $frm->hidden('notify_url', ANTEUP_ABS . 'ipn.php');
    $text .= $frm->hidden('return', ANTEUP_ABS . 'return.php?thanks');
    $text .= $frm->hidden('cancel_return', ANTEUP_ABS . 'return.php?cancel');
    $text .= $frm->close();
} else {
    $text = "<div class='center'>" . LAN_ANTEUP_DONATE_04 . "</div>";
}
e107::getRender()->tablerender(LAN_ANTEUP_DONATE_TITLE, $text);
require_once FOOTERF;
Esempio n. 22
0
File: admin.php Progetto: gitye/e107
        if (isset($potential)) {
            //$text = ADLAN_ERR_3."<br /><br />";
            $mes->addWarning(ADLAN_ERR_3);
            $text = '<ul>';
            foreach ($potential as $p_file) {
                $text .= '<li>' . $p_file . '</li>';
            }
            $mes->addWarning($text);
            //$ns -> tablerender(ADLAN_ERR_1, $text);
        }
    }
}
// ---------------------------------------------------------
// auto db update
if ('0' == ADMINPERMS) {
    $sc = e107::getScBatch('admin');
    echo $tp->parseTemplate('{ADMIN_COREUPDATE=alert}', true, $sc);
    require_once e_ADMIN . 'update_routines.php';
    update_check();
}
// end auto db update
/*
if (e_QUERY == 'purge' && getperms('0'))
{
	$admin_log->purge_log_events(false);
}
*/
$td = 1;
// DEPRECATED
function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE)
{
Esempio n. 23
0
|     GNU General Public License (http://gnu.org).
|
|     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/links_page/links.php $
|     $Revision: 11678 $
|     $Id: links.php 11678 2010-08-22 00:43:45Z e107coders $
|     $Author: e107coders $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) {
    require_once '../../class2.php';
}
if (!e107::isInstalled('links_page')) {
    e107::redirect();
    exit;
}
$link_shortcodes = e107::getScBatch('links_page', TRUE);
require_once e_PLUGIN . 'links_page/link_defines.php';
require_once e_HANDLER . "userclass_class.php";
$eArrayStorage = e107::getArrayStorage();
$db = e107::getDb();
$mes = e107::getMessage();
require_once e_HANDLER . "form_handler.php";
$rs = new form();
require_once e_HANDLER . "file_class.php";
$fl = new e_file();
$cobj = e107::getComment();
require_once e_PLUGIN . 'links_page/link_class.php';
$lc = new linkclass();
global $tp;
$linkspage_pref = e107::pref('links_page');
$deltest = array_flip($_POST);
Esempio n. 24
0
    $e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= "******"\n";
    } else {
        $postInfo['thread_start'] = true;
        $forum_shortcodes = e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo);
        $forthr = $tp->parseTemplate($FORUMTHREADSTYLE, true, vartrue($forum_shortcodes)) . "\n";
    }
}
unset($loop_uid);
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active']) {
    //XXX Show only on the last page??
    if (!vartrue($forum_quickreply)) {
        $ajaxInsert = $thread->pages == $thread->page || $thread->pages == 0 ? 1 : 0;
        //	$ajaxInsert = 1;
        //	echo "AJAX-INSERT=".$ajaxInsert ."(".$thread->pages." vs ".$thread->page.")";
        $frm = e107::getForm();
        $tVars->QUICKREPLY = "\n\t\t<form action='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "' method='post'>\n\t\t<div class='form-group'>\n\t\t\t<textarea cols='80' placeholder='" . LAN_FORUM_2007 . "' rows='4' id='forum-quickreply-text' class='tbox input-xxlarge form-control' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>\n\t\t</div>\n\t\t<div class='center text-center form-group'>\n\t\t\t<input type='submit' data-token='" . e_TOKEN . "' data-forum-insert='" . $ajaxInsert . "' data-forum-post='" . $thread->threadInfo['thread_forum_id'] . "' data-forum-thread='" . $threadId . "' data-forum-action='quickreply' name='reply' value='" . LAN_FORUM_2006 . "' class='btn btn-success button' />\n\t\t\t<input type='hidden' name='thread_id' value='{$thread_parent}' />\n\t\t</div>\n\t\t\n\t\t</form>";
        if (E107_DEBUG_LEVEL > 0) {
            //	echo "<div class='alert alert-info'>Thread id: ".$threadId."</div>";
            //	print_a($this);
Esempio n. 25
0
 function renderButtons($template, $id = '', $options = array())
 {
     $tp = e107::getParser();
     require e107::coreTemplatePath('bbcode');
     //correct way to load a core template.
     $pref = e107::getPref('e_bb_list');
     if (!empty($pref)) {
         foreach ($pref as $val) {
             if (is_readable(e_PLUGIN . $val . "/e_bb.php")) {
                 require e_PLUGIN . $val . "/e_bb.php";
             }
         }
     }
     $temp = array();
     $temp['news'] = $BBCODE_TEMPLATE_NEWSPOST;
     $temp['submitnews'] = $BBCODE_TEMPLATE_SUBMITNEWS;
     $temp['extended'] = $BBCODE_TEMPLATE_NEWSPOST;
     $temp['admin'] = $BBCODE_TEMPLATE_ADMIN;
     $temp['mailout'] = $BBCODE_TEMPLATE_MAILOUT;
     $temp['page'] = $BBCODE_TEMPLATE_CPAGE;
     $temp['maintenance'] = $BBCODE_TEMPLATE_ADMIN;
     $temp['comment'] = $BBCODE_TEMPLATE_COMMENT;
     $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE;
     if (isset($temp[$template])) {
         $BBCODE_TEMPLATE = $temp[$template];
     } elseif (strpos($template, "{") !== false) {
         $BBCODE_TEMPLATE = $template;
         $template = 'comment';
     } elseif (ADMIN_AREA) {
         $BBCODE_TEMPLATE = $BBCODE_TEMPLATE_ADMIN;
     } else {
         $BBCODE_TEMPLATE = $BBCODE_TEMPLATE;
     }
     $bbcode_shortcodes = e107::getScBatch('bbcode');
     $data = array('tagid' => $id, 'template' => $template, 'trigger' => vartrue($options['trigger']), 'size' => vartrue($helpsize), 'eplug_bb' => varset($eplug_bb));
     $bbcode_shortcodes->setVars($data);
     return "<div id='bbcode-panel-" . $id . "' class='mceToolbar bbcode-panel'>" . $tp->parseTemplate($BBCODE_TEMPLATE, TRUE, $bbcode_shortcodes) . "</div>";
 }
Esempio n. 26
0
 function parse_admin($ADMINLAYOUT)
 {
     $sc = e107::getScBatch('admin');
     $tp = e107::getParser();
     $adtmp = explode("\n", $ADMINLAYOUT);
     for ($a = 0; $a < count($adtmp); $a++) {
         if (preg_match("/{.+?}/", $adtmp[$a])) {
             echo $tp->parseTemplate($adtmp[$a], true, $sc);
         } else {
             echo $adtmp[$a];
         }
     }
 }
Esempio n. 27
0
    $e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= "******"\n";
    } else {
        $postInfo['thread_start'] = true;
        e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo);
        $forthr = $e107->tp->parseTemplate($FORUMTHREADSTYLE, true, $forum_shortcodes) . "\n";
    }
}
unset($loop_uid);
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active']) {
    if (!$forum_quickreply) {
        $tVars->QUICKREPLY = "\n\t\t<form action='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "' method='post'>\n\t\t<p>" . LAN_393 . ":<br />\n\t\t<textarea cols='60' rows='4' class='tbox' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>\n\t\t<br />\n\t\t<input type='submit' name='fpreview' value='" . LAN_394 . "' class='button' /> &nbsp;\n\t\t<input type='submit' name='reply' value='" . LAN_395 . "' class='button' />\n\t\t<input type='hidden' name='thread_id' value='{$thread_parent}' />\n\t\t</p>\n\t\t</form>";
    } else {
        $tVars->QUICKREPLY = $forum_quickreply;
    }
}
$forend = $tp->simpleParse($FORUMEND, $tVars);
$forumstring = $forstr . $forthr . $forrep . $forend;
//If last post came after USERLV and not yet marked as read, mark the thread id as read
$threadsViewed = explode(',', $currentUser['user_plugin_forum_viewed']);
Esempio n. 28
0
 //	$LOGIN_TABLE_SECIMG_SECIMG = $sec_img->r_image();
 //		$LOGIN_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
 //	}
 //	$LOGIN_TABLE_AUTOLOGIN = "******";
 //	$LOGIN_TABLE_AUTOLOGIN_LAN = LAN_LOGIN_8;
 //	$LOGIN_TABLE_SUBMIT = "<input class='btn btn-primary button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
 if (!isset($LOGIN_TABLE) || !$LOGIN_TABLE) {
     if (file_exists(THEME . 'templates/login_template.php')) {
         require_once THEME . 'templates/login_template.php';
     } elseif (file_exists(THEME . 'login_template.php')) {
         require_once THEME . 'login_template.php';
     } else {
         require_once e_CORE . "templates/login_template.php";
     }
 }
 $sc = e107::getScBatch('login');
 if (deftrue('BOOTSTRAP') && isset($LOGIN_TEMPLATE['page'])) {
     $LOGIN_TABLE_HEADER = $LOGIN_TEMPLATE['page']['header'];
     $LOGIN_TABLE = "<form class='form-signin' method='post' action='" . e_SELF . "' onsubmit='hashLoginPassword(this)' >" . $LOGIN_TEMPLATE['page']['body'] . "</form>";
     $LOGIN_TABLE_FOOTER = $LOGIN_TEMPLATE['page']['footer'];
 }
 $text = $tp->parseTemplate($LOGIN_TABLE, true, $sc);
 //	$text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);
 if (getperms('0')) {
     echo "<div class='alert alert-block alert-error alert-danger center'> You are currently logged in.</div>";
 }
 //	echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER);
 $login_message = SITENAME;
 //	$login_message = LAN_LOGIN_3." | ".SITENAME;
 echo LOGINMESSAGE;
 echo $tp->parseTemplate($LOGIN_TABLE_HEADER, $sc);
Esempio n. 29
0
 function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMethod = FALSE)
 {
     $ns = e107::getRender();
     $tp = e107::getParser();
     $sql = e107::getDb();
     global $POLLSTYLE;
     switch ($POLLMODE) {
         case 'query':
             // Show poll, register any vote
             if ($this->get_poll($pollArray) === FALSE) {
                 return '';
                 // No display if no poll
             }
             $pollArray = $this->pollRow;
             $POLLMODE = $this->pollmode;
             break;
         case 'results':
             if ($sql->gen($pollArray)) {
                 $pollArray = $sql->fetch();
             }
             break;
     }
     if ($type == 'preview') {
         $optionArray = array_filter($pollArray['poll_option']);
         $voteArray = array();
         $voteArray = array_pad($voteArray, count($optionArray), 0);
         $pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
     } else {
         if ($type == 'forum') {
             if (isset($_POST['fpreview'])) {
                 $pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
                 $optionArray = $pollArray['poll_option'];
             } else {
                 $optionArray = explode(chr(1), $pollArray['poll_options']);
                 $optionArray = array_slice($optionArray, 0, -1);
             }
             $voteArray = explode(chr(1), $pollArray['poll_votes']);
             //			$voteArray = array_slice($voteArray, 0, -1);
         } else {
             // Get existing results
             $optionArray = explode(chr(1), $pollArray['poll_options']);
             $optionArray = array_slice($optionArray, 0, -1);
             $voteArray = explode(chr(1), $pollArray['poll_votes']);
             //			$voteArray = array_slice($voteArray, 0, -1);
         }
     }
     $voteTotal = array_sum($voteArray);
     $percentage = array();
     if (count($voteArray)) {
         foreach ($voteArray as $votes) {
             if ($voteTotal > 0) {
                 $percentage[] = round($votes / $voteTotal * 100, 2);
             } else {
                 $percentage[] = 0;
             }
         }
     }
     /* get template */
     if (file_exists(THEME . 'poll_template.php')) {
         require THEME . 'poll_template.php';
     } else {
         if (!isset($POLL_NOTVOTED_START)) {
             require e_PLUGIN . 'poll/templates/poll_template.php';
         }
     }
     if (deftrue('BOOTSTRAP')) {
         if ($type == 'forum') {
             require_once e_PLUGIN . "forum/templates/forum_poll_template.php";
             $POLL_FORUM_NOTVOTED_START = $FORUM_POLL_TEMPLATE['form']['start'];
             $POLL_FORUM_NOTVOTED_LOOP = $FORUM_POLL_TEMPLATE['form']['item'];
             $POLL_FORUM_NOTVOTED_END = $FORUM_POLL_TEMPLATE['form']['end'];
             $POLL_FORUM_VOTED_START = $FORUM_POLL_TEMPLATE['results']['start'];
             $POLL_FORUM_VOTED_LOOP = $FORUM_POLL_TEMPLATE['results']['item'];
             $POLL_FORUM_VOTED_END = $FORUM_POLL_TEMPLATE['results']['end'];
         }
         $POLL_NOTVOTED_START = $POLL_TEMPLATE['form']['start'];
         $POLL_NOTVOTED_LOOP = $POLL_TEMPLATE['form']['item'];
         $POLL_NOTVOTED_END = $POLL_TEMPLATE['form']['end'];
         $POLL_VOTED_START = $POLL_TEMPLATE['results']['start'];
         $POLL_VOTED_LOOP = $POLL_TEMPLATE['results']['item'];
         $POLL_VOTED_END = $POLL_TEMPLATE['results']['end'];
     }
     $preview = FALSE;
     if ($type == 'preview') {
         $POLLMODE = 'notvoted';
     } elseif ($type == 'forum') {
         $preview = TRUE;
     }
     $comment_total = 0;
     if ($pollArray['poll_comment']) {
         // Only get comments if they're allowed on poll. And we only need the count ATM
         $comment_total = $sql->count("comments", "(*)", "WHERE `comment_item_id`='" . intval($pollArray['poll_id']) . "' AND `comment_type`=4");
     }
     $sc = e107::getScBatch('poll');
     $sc->setVars($pollArray);
     $QUESTION = $tp->toHTML($pollArray['poll_title'], TRUE, "emotes_off, defs");
     $VOTE_TOTAL = POLLAN_31 . ": " . $voteTotal;
     $COMMENTS = $pollArray['poll_comment'] ? " <a href='" . e_HTTP . "comment.php?comment.poll." . $pollArray['poll_id'] . "'>" . LAN_COMMENTS . ": " . $comment_total . "</a>" : "";
     $poll_count = $sql->count("polls", "(*)", "WHERE poll_id <= '" . $pollArray['poll_id'] . "'");
     $OLDPOLLS = '';
     if ($poll_count > 1) {
         $OLDPOLLS = $type == 'menu' ? "<a href='" . e_PLUGIN_ABS . "poll/oldpolls.php'>" . POLLAN_28 . "</a>" : "";
     }
     $AUTHOR = POLLAN_35 . " " . ($type == 'preview' || $type == 'forum' ? USERNAME : "******" . e_HTTP . "user.php?id." . $pollArray['poll_admin_id'] . "'>" . $pollArray['user_name'] . "</a>");
     switch ($POLLMODE) {
         case 'notvoted':
             $text = "<form method='post' action='" . e_SELF . (e_QUERY ? "?" . e_QUERY : "") . "'>\n" . preg_replace("/\\{(.*?)\\}/e", '$\\1', $type == "forum" ? $POLL_FORUM_NOTVOTED_START : $POLL_NOTVOTED_START);
             $count = 1;
             $sc->answerCount = 1;
             $alt = 0;
             // alternate style.
             $template = $type == "forum" ? $POLL_FORUM_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP;
             foreach ($optionArray as $option) {
                 $sc->answerOption = $option;
                 //	$MODE = ($mode) ? $mode : "";		/* debug */
                 //	$OPTIONBUTTON = ($pollArray['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='$count' />");
                 //	$OPTION = $tp->toHTML($option, TRUE);
                 //		$OPTIONBUTTON = $tp->parseTemplate("{OPTIONBUTTON}",true);
                 //	$OPTION = $tp->parseTemplate("{OPTION}",true);
                 //		$OPTION = $tp->parseTemplate("{ANSWER}",true);
                 $text .= $tp->parseTemplate($template, true, $sc);
                 $count++;
                 $sc->answerCount++;
             }
             $SUBMITBUTTON = "<input class='button btn btn-primary' type='submit' name='pollvote' value='" . POLLAN_30 . "' />";
             // disable submit when previewing the poll or when NOT viewing the poll in the forum
             if (('preview' == $type || $preview == TRUE) && strpos(e_REQUEST_SELF, "forum") === FALSE) {
                 $SUBMITBUTTON = "<input class='button btn btn-default e-tip' type='button' name='null' title='Disabled' value='" . POLLAN_30 . "' />";
             }
             $text .= "\n" . preg_replace("/\\{(.*?)\\}/e", '$\\1', $type == "forum" ? $POLL_FORUM_NOTVOTED_END : $POLL_NOTVOTED_END) . "\n</form>";
             break;
         case 'voted':
         case 'results':
             if ($pollArray['poll_result_type'] && !strstr(e_SELF, "comment.php")) {
                 $text = "<div style='text-align: center;'><br /><br />" . POLLAN_39 . "<br /><br /><a href='" . e_HTTP . "comment.php?comment.poll." . $pollArray['poll_id'] . "'>" . POLLAN_40 . "</a></div><br /><br />";
             } else {
                 $text = preg_replace("/\\{(.*?)\\}/e", '$\\1', $type == "forum" ? $POLL_FORUM_VOTED_START : $POLL_VOTED_START);
                 $count = 0;
                 foreach ($optionArray as $option) {
                     $OPTION = $tp->toHTML($option, TRUE);
                     $BAR = $this->generateBar($percentage[$count]);
                     //		$BAR = ($percentage[$count] ? "<div style='width: 100%'><div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".min(intval($percentage[$count]), 90)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div></div>" : "");
                     $PERCENTAGE = $percentage[$count] . "%";
                     $VOTES = POLLAN_31 . ": " . $voteArray[$count];
                     $text .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $type == "forum" ? $POLL_FORUM_VOTED_LOOP : $POLL_VOTED_LOOP);
                     $count++;
                 }
                 $text .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $type == "forum" ? $POLL_FORUM_VOTED_END : $POLL_VOTED_END);
             }
             break;
         case 'disallowed':
             $text = preg_replace("/\\{(.*?)\\}/e", '$\\1', $POLL_DISALLOWED_START);
             foreach ($optionArray as $option) {
                 $MODE = $mode;
                 /* debug */
                 $OPTION = $tp->toHTML($option, TRUE);
                 $text .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $POLL_DISALLOWED_LOOP);
                 $count++;
             }
             if ($pollArray['poll_vote_userclass'] == 253) {
                 $DISALLOWMESSAGE = POLLAN_41;
             } elseif ($pollArray['poll_vote_userclass'] == 254) {
                 $DISALLOWMESSAGE = POLLAN_42;
             } else {
                 $DISALLOWMESSAGE = POLLAN_43;
             }
             $text .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $POLL_DISALLOWED_END);
             break;
     }
     if (!defined("POLLRENDERED")) {
         define("POLLRENDERED", TRUE);
     }
     $caption = file_exists(THEME . "images/poll_menu.png") ? "<img src='" . THEME_ABS . "images/poll_menu.png' alt='' /> " . POLLAN_MENU_CAPTION : POLLAN_MENU_CAPTION;
     if ($type == 'preview') {
         $caption = POLLAN_23 . SEP . "Preview";
         // TODO LAN
         $text = "<div class='clearfix'>\n<div class='well span3'>" . $text . "</div></div>";
     } elseif ($type == 'forum') {
         $caption = LAN_4;
     }
     if ($returnMethod) {
         return $text;
     } else {
         $ns->tablerender($caption, $text, 'poll');
     }
 }
Esempio n. 30
0
<?php

/*
 * Forecasty - A weather plugin for e107
 *
 * Copyright (C) 2015 Patrick Weaver (http://trickmod.com/)
 * For additional information refer to the README.md file.
 *
 */
if (!defined('e107_INIT')) {
    exit;
}
require_once e_PLUGIN . 'forecasty/_class.php';
$pref = e107::pref('forecasty');
$tp = e107::getParser();
$sc = e107::getScBatch('forecasty', true);
$template = e107::getTemplate('forecasty');
// TODO: Gather the visitors location if they are a memeber, if not, utilize the fallbackLocation.
$location = $pref['fallbackLocation'];
$wf = new Forecasty($pref['apiKey'], $location);
$current = $wf->getData('current');
$hour = $wf->getData('nexthour');
$day = $wf->getData('nextday');
$week = $wf->getData('nextweek');
$sc->setVars(array('current' => array('temperature' => $current['temperature'], 'feelsLike' => $current['feelsLike'], 'icon' => $current['icon'], 'condition' => $current['condition'], 'humidity' => $current['humidity'], 'windSpeed' => $current['windSpeed'], 'visibility' => $current['visibility'], 'pressure' => $current['pressure'], 'dewPoint' => $current['dewPoint']), 'nexthour' => array('temperature' => $hour['temperature'], 'feelsLike' => $hour['feelsLike'], 'icon' => $hour['icon'], 'condition' => $hour['condition'], 'humidity' => $hour['humidity'], 'windSpeed' => $hour['windSpeed'], 'visibility' => $hour['visibility'], 'pressure' => $hour['pressure'], 'dewPoint' => $hour['dewPoint']), 'nextday' => array('temperature' => $day['temperature'], 'feelsLike' => $day['feelsLike'], 'icon' => $day['icon'], 'condition' => $day['condition'], 'humidity' => $day['humidity'], 'windSpeed' => $day['windSpeed'], 'visibility' => $day['visibility'], 'pressure' => $day['pressure'], 'dewPoint' => $day['dewPoint']), 'nextweek' => array('temperature' => $week['temperature'], 'feelsLike' => $week['feelsLike'], 'icon' => $week['icon'], 'condition' => $week['condition'], 'humidity' => $week['humidity'], 'windSpeed' => $week['windSpeed'], 'visibility' => $week['visibility'], 'pressure' => $week['pressure'], 'dewPoint' => $week['dewPoint'])));
$text = $tp->parseTemplate($template['menu'], false, $sc);
e107::getRender()->tablerender('Weather', $text);