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 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);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
Example #6
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.
  */
 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);
 }
Example #8
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);
 }
Example #9
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;
 }
Example #10
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);
    }
}
Example #11
0
 public function actionList()
 {
     $request = $this->getRequest();
     // use only filtered variables
     $cid = $request->getRequestParam('cat');
     if ($cid && !isset($this->catList[$cid])) {
         // get ID by SEF
         $_cid = null;
         foreach ($this->catList as $id => $row) {
             if ($cid === $row['media_cat_sef']) {
                 $_cid = $id;
                 break;
             }
         }
         $cid = $_cid;
     }
     if (empty($cid) || !isset($this->catList[$cid])) {
         $this->_forward('category');
         return;
     }
     $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($cid);
     $sc->amount = e107::getPlugPref('gallery', 'perpage', 12);
     // TODO Add Pref. amount per page.
     $sc->curCat = $cid;
     $sc->from = $request->getRequestParam('frm', 0);
     $list = e107::getMedia()->getImages($cid, $sc->from, $sc->amount);
     $catname = $tp->toHtml($this->catList[$cid]['media_cat_title'], false, 'defs');
     $cat = $this->catList[$cid];
     $inner = "";
     foreach ($list as $row) {
         $sc->setVars($row)->addVars($cat);
         $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);
     if (isset($template['list_caption'])) {
         $title = $tp->parseTemplate($template['list_caption'], TRUE, $sc);
         $this->addTitle($title)->addBody($text);
     } else {
         $this->addTitle($catname)->addTitle(LAN_PLUGIN_GALLERY_TITLE)->addBody($text);
     }
 }
Example #12
0
File: faqs.php Project: armpit/e107
 function view_all_query($srch = '')
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $text = "";
     $insert = "";
     $item = false;
     $removeUrl = e107::url('faqs', 'index');
     if (!empty($srch)) {
         $srch = $tp->toDB($srch);
         $insert = " AND (f.faq_question LIKE '%" . $srch . "%' OR f.faq_answer LIKE '%" . $srch . "%' OR FIND_IN_SET ('" . $srch . "', f.faq_tags) ) ";
         $message = "<span class='label label-lg label-info'>" . $srch . " <a class='e-tip' title='Remove' href='" . $removeUrl . "'>×</a></span>";
         e107::getMessage()->setClose(false, E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE, E_MESSAGE_INFO)->addInfo($message);
         $text = e107::getMessage()->render();
     }
     if (!empty($_GET['id'])) {
         $srch = intval($_GET['id']);
         //	$insert = " AND (f.faq_id = ".$srch.") ";
         $item = $srch;
     }
     if (!empty($_GET['cat'])) {
         $srch = $tp->toDB($_GET['cat']);
         $insert = " AND (cat.faq_info_sef = '" . $srch . "') ";
     }
     if (!empty($_GET['tag'])) {
         $srch = $tp->toDB($_GET['tag']);
         $insert = " AND FIND_IN_SET ('" . $srch . "', f.faq_tags)  ";
         $message = "<span class='label label-lg label-info'>" . $srch . " <a class='e-tip' title='Remove' href='" . $removeUrl . "'>×</a></span>";
         e107::getMessage()->setClose(false, E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE, E_MESSAGE_INFO)->addInfo($message);
         $text = e107::getMessage()->render();
     }
     list($orderBy, $ascdesc) = explode('-', vartrue($this->pref['orderby'], 'faq_order-ASC'));
     $query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (" . USERCLASS_LIST . ") " . $insert . " ORDER BY cat.faq_info_order, f." . $orderBy . " " . $ascdesc . " ";
     if (!$sql->gen($query)) {
         $message = !empty($srch) ? "<b>" . $srch . "</b> was not found in search results. <a class='e-tip' title='Reset' href='" . $removeUrl . "'>Reset</a>" : LAN_FAQS_NONE_AVAILABLE;
         return "<div class='alert alert-warning alert-block'>" . $message . "</div>";
         //TODO LAN
     }
     // -----------------
     $FAQ_LISTALL = e107::getTemplate('faqs', true, 'all');
     $prevcat = "";
     $sc = e107::getScBatch('faqs', true);
     $sc->counter = 1;
     $sc->tag = htmlspecialchars($tag, ENT_QUOTES, 'utf-8');
     $sc->category = $category;
     if (!empty($_GET['id'])) {
         $sc->item = intval($_GET['id']);
         $js = "\n\t\t\t\t\$( document ).ready(function() {\n                    \$('html, body').animate({ scrollTop:  \$('div#faq_" . $sc->item . "').offset().top - 300 }, 4000);\n\t\t\t\t});\n\n\t\t\t\t";
         e107::js('footer-inline', $js);
     }
     //	$text = $tp->parseTemplate($FAQ_START, true, $sc);
     //	$text = "";
     if ($this->pref['list_type'] == 'ol') {
         $reversed = $ascdesc == 'DESC' ? 'reversed ' : '';
         $tsrch = array('<ul ', '/ul>');
         $trepl = array('<ol ' . $reversed, '/ol>');
         $FAQ_LISTALL['start'] = str_replace($tsrch, $trepl, $FAQ_LISTALL['start']);
         $FAQ_LISTALL['end'] = str_replace($tsrch, $trepl, $FAQ_LISTALL['end']);
     }
     while ($rw = $sql->fetch()) {
         $rw['faq_sef'] = eHelper::title2sef($tp->toText($rw['faq_question']), 'dashl');
         $sc->setVars($rw);
         if ($sc->item == $rw['faq_id']) {
             $this->pageTitle = $rw['faq_question'];
             $this->pageDescription = $rw['faq_answer'];
         }
         if ($rw['faq_info_order'] != $prevcat) {
             if ($prevcat != '') {
                 $text .= $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc);
             }
             $text .= "\n\n<!-- FAQ Start " . $rw['faq_info_order'] . "-->\n\n";
             $text .= $tp->parseTemplate($FAQ_LISTALL['start'], true, $sc);
             $start = TRUE;
         }
         $text .= $tp->parseTemplate($FAQ_LISTALL['item'], true, $sc);
         $prevcat = $rw['faq_info_order'];
         $sc->counter++;
     }
     $text .= $start ? $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc) : "";
     //		$text .= $tp->parseTemplate($FAQ_END, true, $sc);
     return $text;
 }
<?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);
Example #14
0
 /**
  *
  */
 function renderPreview()
 {
     global $FORUM_PREVIEW;
     // BC v1.x
     $tp = e107::getParser();
     $ns = e107::getRender();
     $this->processAttachments();
     require_once HEADERF;
     if (USER) {
         $poster = USERNAME;
     } else {
         $poster = $_POST['anonname'] ? $_POST['anonname'] : LAN_ANONYMOUS;
     }
     $postdate = e107::getDate()->convert_date(time(), "forum");
     $tsubject = $tp->post_toHTML($_POST['subject'], true);
     $tpost = $tp->post_toHTML($_POST['post'], true);
     if ($_POST['poll_title'] != '' && check_class($this->forumObj->prefs->get('poll'))) {
         require_once e_PLUGIN . "poll/poll_class.php";
         $poll = new poll();
         $poll_text = $poll->render_poll($_POST, 'forum', 'notvoted', true);
     } else {
         $poll_text = false;
     }
     if (empty($FORUM_PREVIEW)) {
         if (deftrue('BOOTSTRAP')) {
             $FORUM_PREVIEW = e107::getTemplate('forum', 'forum_preview', 'item');
         } else {
             if (file_exists(THEME . "forum_preview_template.php")) {
                 require_once THEME . "forum_preview_template.php";
             } else {
                 require_once e_PLUGIN . "forum/templates/forum_preview_template.php";
             }
         }
     }
     $shortcodes = array('PREVIEW_DATE' => $postdate, 'PREVIEW_SUBJECT' => $tsubject, 'PREVIEW_POST' => $tpost);
     $text = $tp->simpleParse($FORUM_PREVIEW, $shortcodes);
     if ($poll_text) {
         $ns->tablerender($_POST['poll_title'], $poll_text);
     }
     $ns->tablerender(LAN_FORUM_3005, $text);
     /*
     		if ($this->action == 'edit')
     		{
     			if ($_POST['subject'])
     			{
     				$action = 'edit';
     			}
     			else
     			{
     				$action = 'rp';
     			}
     			$eaction = true;
     		}
     		else if($this->action == 'quote')
     		{
     			$action = 'rp';
     			$eaction = false;
     		}*/
 }
Example #15
0
require_once e_HANDLER . "news_class.php";
unset($text);
global $OTHERNEWS_STYLE;
$ix = new news();
$caption = TD_MENU_L1;
if (!empty($parm)) {
    if (is_string($parm)) {
        parse_str($parm, $parms);
    } else {
        $parms = $parm;
    }
}
if (!$OTHERNEWS_STYLE) {
    if (deftrue('BOOTSTRAP')) {
        define("OTHERNEWS_COLS", false);
        $template = e107::getTemplate('news', 'news_menu', 'other');
        $item_selector = '<div class="btn-group pull-right"><a class="btn btn-mini btn-xs btn-default" href="#otherNews" data-slide="prev">‹</a>  
 		<a class="btn btn-mini btn-xs btn-default" href="#otherNews" data-slide="next">›</a></div>';
        if (!empty($parms['caption'])) {
            $template['caption'] = e107::getParser()->toHtml($parms['caption'], true, 'TITLE');
        }
        $caption = "<div class='inline-text'>" . $template['caption'] . " " . $item_selector . "</div>";
        $OTHERNEWS_STYLE = $template['item'];
    } else {
        if (!empty($parms['caption'])) {
            $caption = e107::getParser()->toHtml($parms['caption'], true, 'TITLE');
        }
        $template['start'] = '';
        $template['end'] = '';
        $OTHERNEWS_STYLE = "\n\t\t<div style='padding:3px;width:100%'>\n\t\t<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>\n\t\t<tr>\n\t\t<td style='vertical-align:top;padding:3px;width:20px'>\n\t\t{NEWSCATICON}\n\t\t</td><td style='text-align:left;padding:3px;vertical-align:top'>\n\t\t{NEWSTITLELINK}\n\t\t</td></tr></table>\n\t\t</div>\n";
    }
Example #16
0
 /**
  * All possible parameters
  * {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM}
  * first parameter is always number of slides, default is 3
  * limit - (optional) total limit of pcitures to be shown
  * template - (optional) template - name of template to be used for parsing the slideshow item
  */
 function sc_gallery_slides($parm)
 {
     $tp = e107::getParser();
     $this->slideMode = TRUE;
     $parms = eHelper::scDualParams($parm);
     $amount = $parms[1] ? intval($parms[1]) : 3;
     // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
     $parms = $parms[2];
     $limit = (int) vartrue($parms['limit'], 16);
     $list = e107::getMedia()->getImages('gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit);
     $tmpl = e107::getTemplate('gallery', 'gallery');
     $tmpl = array_change_key_case($tmpl);
     // change template key to lowercase (BC fix)
     $tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
     $item_template = $tmpl[$tmpl_key];
     // e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
     $catList = e107::getMedia()->getCategories('gallery');
     $cat = $catList['gallery_' . $this->sliderCat];
     $count = 1;
     foreach ($list as $row) {
         $this->setVars($row)->addVars($cat);
         $inner .= $count == 1 ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : "";
         $inner .= "\n\t" . $tp->parseTemplate($item_template, TRUE) . "\n";
         $inner .= $count == $amount ? "\n</div>\n\n" : "";
         if ($count == $amount) {
             $count = 1;
             $this->slideCount++;
         } else {
             $count++;
         }
     }
     $inner .= $count != 1 ? "</div><!-- END SLIDES -->" : "";
     return $inner;
 }
Example #17
0
<?php

/**
 * Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
 * $Id$
 * 
 * News categories menu
 */
if (!defined('e107_INIT')) {
    exit;
}
$cacheString = 'nq_news_categories_menu_' . md5(serialize($parm));
$cached = e107::getCache()->retrieve($cacheString);
if (false === $cached) {
    e107::plugLan('news');
    if (is_string($parm)) {
        parse_str($parm, $parms);
    } else {
        $parms = $parm;
    }
    $ctree = e107::getObject('e_news_category_tree', null, e_HANDLER . 'news_class.php');
    $template = e107::getTemplate('news', 'news_menu', 'category');
    $cached = $ctree->loadActive()->render($template, $parms, true);
    e107::getCache()->set($cacheString, $cached);
}
echo $cached;
Example #18
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 #19
0
<?php

/*
 * Scrobbls - A Last.fm Display 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 . 'scrobbls/_class.php';
$pref = e107::pref('scrobbls');
$tp = e107::getParser();
$sc = e107::getScBatch('scrobbls', true);
$template = e107::getTemplate('scrobbls');
$lfm = new scrobblUser($pref['username'], $pref['apiKey']);
$sc->setVars($lfm->getInfo());
$text = $tp->parseTemplate($template['user_menu'], false, $sc);
e107::getRender()->tablerender('Scrobbls User Info', $text);
Example #20
0
function displayCategoryLinks($mode = '')
{
    global $lc, $cobj, $rowl, $qs, $linkspage_pref, $from, $link_shortcodes, $link_category_total;
    global $linkbutton_count, $link_category_total, $LINK_APPEND;
    $db2 = e107::getDb('sql2');
    $tp = e107::getParser();
    $mes = e107::getMessage();
    $template = e107::getTemplate('links_page', 'links_page');
    $order = $lc->getOrder();
    $number = $linkspage_pref["link_nextprev_number"] ? $linkspage_pref["link_nextprev_number"] : "20";
    $nextprevquery = $mode && $linkspage_pref["link_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : "";
    $cat = $mode ? " AND l.link_category='" . intval($mode) . "' " : "";
    $qry = "\n\tSELECT l.*, lc.*, COUNT(c.comment_id) AS link_comment\n\tFROM #links_page AS l\n\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\tLEFT JOIN #comments as c ON c.comment_item_id=l.link_id AND comment_type='links_page'\n\tWHERE l.link_active = 1 AND l.link_class REGEXP '" . e_CLASS_REGEXP . "' AND lc.link_category_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . "\n\tGROUP BY l.link_id\n\t" . $order . "\n\t" . $nextprevquery . "\n\t";
    $link_table_string = "";
    $link_total = $db2->count("links_page as l", "(*)", "WHERE l.link_class REGEXP '" . e_CLASS_REGEXP . "' " . $cat . " ");
    if (!$db2->gen($qry)) {
        $navigator = displayNavigator();
        $navigator .= displaySortOrder();
        $var = array('ERROR_MESSAGE' => LAN_LINKS_34);
        $error = $tp->simpleParse($template['LINK_ERROR_MESSAGE'], $var);
        $text = $navigator . $error;
        e107::getRender()->tablerender(LAN_LINKS_39, $text);
    } else {
        $linkbutton_count = 0;
        $list = $db2->rows();
        foreach ($list as $rowl) {
            $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count;
            if ($mode) {
                $cat_name = $rowl['link_category_name'];
                $cat_desc = $rowl['link_category_description'];
                $LINK_APPEND = $lc->parse_link_append($rowl);
                $link_table_string .= $tp->parseTemplate($template['LINK_TABLE'], FALSE, $link_shortcodes);
            } else {
                $arr[$rowl['link_category_id']][] = $rowl;
            }
        }
        if ($mode) {
            $link_category_total = $link_total;
            $link_table_start = $tp->parseTemplate($template['LINK_TABLE_START'], FALSE, $link_shortcodes);
            $link_table_end = $tp->parseTemplate($template['LINK_TABLE_END'], FALSE, $link_shortcodes);
            $text = $link_table_start . $link_table_string . $link_table_end;
            $caption = LAN_LINKS_32 . " " . $cat_name . " " . ($cat_desc ? " <i>[" . $cat_desc . "]</i>" : "");
            //number of links
            $caption .= " (<b title='" . (ADMIN ? LAN_LINKS_2 : LAN_LINKS_1) . "' >" . $link_total . "</b>" . (ADMIN ? "/<b title='" . (ADMIN ? LAN_LINKS_1 : "") . "' >" . $link_total . "</b>" : "") . ") ";
            $navigator = displayNavigator('cat');
            $navigator .= displaySortOrder('cat');
            $text = $navigator . $text;
            if (is_numeric($mode)) {
                $pagination = $lc->ShowNextPrev($from, $number, $link_total);
                $text = $text . $pagination;
            }
            e107::getRender()->tablerender($caption, $text);
        } else {
            $text = '';
            foreach ($arr as $key => $value) {
                $link_table_string = "";
                $linkbutton_count = 0;
                $i = 0;
                for ($i = 0; $i < count($value); $i++) {
                    $rowl = $value[$i];
                    $linkbutton_count = $rowl['link_button'] ? $linkbutton_count + 1 : $linkbutton_count;
                    $cat_name = $rowl['link_category_name'];
                    $cat_desc = $rowl['link_category_description'];
                    $LINK_APPEND = $lc->parse_link_append($rowl);
                    $link_table_string .= $tp->parseTemplate($template['LINK_TABLE'], FALSE, $link_shortcodes);
                }
                $link_category_total = count($value);
                $link_table_caption = $tp->parseTemplate($template['LINK_TABLE_CAPTION'], FALSE, $link_shortcodes);
                $link_table_start = $tp->parseTemplate($template['LINK_TABLE_START'], FALSE, $link_shortcodes);
                $link_table_end = $tp->parseTemplate($template['LINK_TABLE_END'], FALSE, $link_shortcodes);
                $text .= $link_table_start . $link_table_string . $link_table_end;
            }
            $navigator = displayNavigator();
            $navigator .= displaySortOrder();
            $text = $navigator . $text;
            e107::getRender()->tablerender($link_table_caption, $text);
        }
    }
    return;
}
Example #21
0
/*
 * Date+ - An advanced date display menu for e107
 *
 * Copyright (C) 2010-2015 Patrick Weaver (http://trickmod.com/)
 * For additional information refer to the README.mkd file.
 *
 */
if (!defined('e107_INIT')) {
    exit;
}
require_once e_PLUGIN . 'dateplus/_class.php';
$pref = e107::pref('dateplus');
$tp = e107::getParser();
$sc = e107::getScBatch('dateplus', true);
$template = e107::getTemplate('dateplus');
$curMonth = date('n');
$curDay = date('j');
$hs = hanukkahStart();
$he = hanukkahStart() + 691200;
$text = "";
$holidays = getHolidays($curMonth, $curDay);
foreach ($holidays as $holiday) {
    $holiray[] = array($holiday[0], $holiday[1], $holiday[2]);
}
if ($pref['enableUserdays'] == true) {
    $userdays = getUserdays($curMonth, $curDay);
    foreach ($userdays as $userday) {
        $holiray[] = array($userday[0], $userday[1], $userday[2]);
    }
}
Example #22
0
/**
 * Core NEXTPREV shortcode
 * Comma separated parameters are now deprecated.
 * Parameter string should be formatted as if it were the query string passed via a URL:
 * <code>$parm = 'total=10&amount=5&current=0&type=...'</code>
 *
 * Parameter list:
 * - total (integer) [required]: total records/pages
 * - amount (integer| string 'all') [required]: Records per page, always 1 when we counting pages (see 'type' parameter), ignored where tmpl_prefix is not set and 'old_np' pref is false
 * - current (integer)[required]: Current record/page
 * - type (string page|record) [optional]: What kind of navigation logic we need, default is 'record' (the old way)
 *
 * - url (rawurlencode'd string) [required]: URL template, will be rawurldecode'd after parameters are parsed to array, '--AMP--' strings will be replaced with '&amp;'
 * 	NOTE: URL should be DOUBLE encoded, which means you need to encode the query only of passed URL (W3C standards) and rawurlencode the whole URL string
 * The reason to do this is to not break the whole shortcode $parm string, shortcode itself is doing decode once, which means we'll end up with correct, W3C compliant URL string
 * 'url' now supports url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 and route::news/list/category::id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1 formats
 *
 * Preffered 'FROM' template is now '--FROM--' (instead '[FROM]')
 * - caption (rawurlencode'd string) [optional]: Label, rawurldecode'd after parameters are parsed to array, language constants are supported
 * - pagetitle (rawurlencode'd string) [optional]: Page labels, rawurldecode'd after parameters are parsed to array,
 * separated by '|', if present they will be used as lablels instead page numbers; language constants are supported
 * - plugin (string) [optional]: plugin name used for template loading
 * - tmpl_prefix (string) [optional]: template keys prefix; core supported are 'default' and 'dropdown', default depends on 'old_np' pref
 * - navcount (integer) [optional]: number of navigation items to be shown, minimal allowed value is 4, default is 10
 * - nonavcount (no value) [optional]: if is set it'll disable navigation counting (navcount will be ignored)
 * - bullet (string) [optional]: currently it should contain the markup to be prepended to the navigation item title
 *
 * WARNING: You have to do rawuldecode() on url, caption and title parameter values (before passing them to the shortcode)
 * or you'll break the whole script
 *
 * TODO - add create URL support when new URL handler is ready
 *
 * @param string $parm
 * @return string page navigation bar HTML
 */
function nextprev_shortcode($parm = '')
{
    $e107 = e107::getInstance();
    $pref = e107::getPref();
    $tp = e107::getParser();
    e107::coreLan('np');
    /**
     * The NEW way.
     * New parameter requirements formatted as a GET string.
     * Template support.
     */
    if (strpos($parm, 'total=') !== false) {
        parse_str($parm, $parm);
        // Calculate
        $total_items = intval($parm['total']);
        $check_render = true;
        if (vartrue($parm['glyphs']) && deftrue('BOOTSTRAP')) {
            $LAN_NP_FIRST = $tp->toGlyph("icon-fast-backward.glyph", false);
            $LAN_NP_PREVIOUS = $tp->toGlyph("icon-backward.glyph", false);
            $LAN_NP_NEXT = $tp->toGlyph("icon-forward.glyph", false);
            $LAN_NP_LAST = $tp->toGlyph("icon-fast-forward", false);
        } else {
            $LAN_NP_FIRST = LAN_NP_FIRST;
            $LAN_NP_PREVIOUS = LAN_NP_PREVIOUS;
            $LAN_NP_NEXT = LAN_NP_NEXT;
            $LAN_NP_LAST = LAN_NP_LAST;
        }
        // search for template keys - default_start, default_end etc.
        if (isset($parm['tmpl_prefix'])) {
            // forced
            $tprefix = vartrue($parm['tmpl_prefix'], 'default');
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } elseif (isset($parm['tmpl'])) {
            // forced
            $tprefix = vartrue($parm['tmpl'], 'default');
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } elseif ($pref['old_np']) {
            $tprefix = 'default';
            //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
        } else {
            $tprefix = 'dropdown';
            //$parm['amount'] = 'all';
        }
        if ($tprefix == 'default' && deftrue('BOOTSTRAP')) {
            $tprefix = 'bootstrap';
        }
        $tprefix .= '_';
        if ($parm['amount'] === 'all') {
            $perpage = 1;
            // amount is ignored
            $check_render = $total_items > 1;
        } else {
            $perpage = intval($parm['amount']);
        }
        if (!$check_render) {
            return '';
        }
        // TODO - rename old_np to something more meaningful
        $current_start = intval($parm['current']);
        $nptype = varset($parm['type'], 'record');
        switch ($nptype) {
            case 'page':
                $perpage = 1;
                $current_page = $current_start;
                $first_page = 1;
                $next_page = $current_page + 1;
                $prev_page = $current_page - 1;
                $total_pages = $last_page = $total_items;
                $index_add = 1;
                break;
            default:
                $total_pages = ceil($total_items / $perpage);
                $last_page = ceil($total_pages * $perpage) - $perpage;
                $current_page = $current_start / $perpage + 1;
                $next_page = $current_page * $perpage;
                $prev_page = $current_start - $perpage;
                $first_page = 0;
                $index_add = 0;
                break;
        }
        if ($total_pages <= 1) {
            return '';
        }
        // urldecoded once by parse_str()
        if (substr($parm['url'], 0, 7) == 'route::') {
            // New - use URL assembling engine
            // Format is: route::module/controller/action::urlParams::urlOptions
            // Example: route::news/list/category::id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1
            // WARNING - url parameter string have to be rawurlencode-ed BEFORE passed to the shortcode, or it'll break everything
            $urlParms = explode('::', str_replace('--AMP--', '&', $parm['url']));
            $url = str_replace('--FROM--', '[FROM]', $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3])));
        } elseif (substr($parm['url'], 0, 5) == 'url::') {
            // New - use URL assembling engine
            // Format is: url::module/controller/action?id=xxx--AMP--name=yyy--AMP--page=--FROM--::full=1
            // WARNING - url parameter string have to be rawurlencode-ed BEFORE passed to the shortcode, or it'll break everything
            $urlParms = explode('::', str_replace('--AMP--', '&', $parm['url']));
            $url = str_replace('--FROM--', '[FROM]', $e107->url->create($urlParms[1], array(), varset($urlParms[2])));
        } else {
            $url = str_replace(array('--FROM--', '--AMP--'), array('[FROM]', '&amp;'), $parm['url']);
        }
        // Simple parser vars
        $e_vars = new e_vars(array('total_pages' => $total_pages, 'current_page' => $current_page));
        // urldecoded by parse_str()
        if (!varset($parm['caption'])) {
            $e_vars->caption = 'LAN_NP_CAPTION';
        }
        // Advanced multilingual support: 'Page [x] of [y]' -> match the exact argument, result would be 'Page 1 of 20'
        $e_vars->caption = $tp->lanVars(defset($e_vars->caption, $e_vars->caption), array('x' => $current_page, 'y' => $total_pages));
        // sprintXX(defset($e_vars->caption, $e_vars->caption), $current_page, $total_pages);
        // urldecoded by parse_str()
        $pagetitle = explode('|', vartrue($parm['pagetitle']));
        // new - bullet support
        $bullet = vartrue($parm['bullet'], '');
        // no navigation counter
        if (isset($parm['nonavcount'])) {
            $navcount = $total_pages;
            $navmid = 0;
        } else {
            // navigation number settings
            $navcount = abs(intval(vartrue($parm['navcount'], 10)));
            // prevent infinite loop!
            if ($navcount < 4) {
                $navcount = 4;
            }
            $navmid = floor($navcount / 2);
        }
        // get template - nextprev_template.php, support for plugin template locations - myplug/templates/nextprev_template.php
        $tmpl = e107::getTemplate(varset($parm['plugin'], null), 'nextprev');
        // init advanced navigation visibility
        $show_first = $show_prev = $current_page != 1;
        $show_last = $show_next = $current_page != $total_pages;
        // Render
        // Parse via simpleParse()
        $tp = e107::getParser();
        // Nextprev navigation start
        $ret = $tp->simpleParse($tmpl[$tprefix . 'start'], $e_vars);
        // caption, e.g. 'Page 1 of 20' box
        if ($e_vars->caption) {
            $ret .= $tp->simpleParse($tmpl[$tprefix . 'nav_caption'], $e_vars);
        }
        $ret_array = array();
        // Show from 1 to $navcount || $total_pages
        if ($current_page <= $navmid || $total_pages <= $navcount) {
            $loop_start = 0;
            $loop_end = $navcount;
            $show_first = false;
            if ($navcount >= $total_pages) {
                $loop_end = $total_pages;
                $show_last = false;
            }
        } else {
            if ($current_page + $navmid >= $total_pages) {
                $loop_start = $total_pages - $navcount;
                if ($loop_start < 0) {
                    $loop_start = 0;
                }
                $loop_end = $total_pages;
                $show_last = false;
            } else {
                $loop_start = $current_page - $navmid;
                $loop_end = $current_page + ($navcount - $navmid);
                // odd/even $navcount support
                if ($loop_start < 0) {
                    $loop_start = 0;
                } elseif ($loop_end > $total_pages) {
                    $loop_end = $total_pages;
                    $show_last = false;
                }
            }
        }
        // Add 'first', 'previous' navigation
        if ($show_prev) {
            if ($show_first && !empty($tmpl[$tprefix . 'nav_first'])) {
                $e_vars->url = str_replace('[FROM]', $first_page, $url);
                $e_vars->label = $LAN_NP_FIRST;
                $e_vars->url_label = LAN_NP_URLFIRST;
                $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_first'], $e_vars);
            }
            if (!empty($tmpl[$tprefix . 'nav_prev'])) {
                $e_vars->url = str_replace('[FROM]', $prev_page, $url);
                $e_vars->label = $LAN_NP_PREVIOUS;
                $e_vars->url_label = LAN_NP_URLPREVIOUS;
                $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_prev'], $e_vars);
            }
        }
        $e_vars_loop = new e_vars();
        $e_vars_loop->bullet = stripslashes($bullet);
        // fix magicquotes
        $ret_items = array();
        for ($c = $loop_start; $c < $loop_end; $c++) {
            $label = '';
            if (varset($pagetitle[$c])) {
                $label = defset($pagetitle[$c], $pagetitle[$c]);
            }
            $e_vars_loop->url = str_replace('[FROM]', $perpage * ($c + $index_add), $url);
            $e_vars_loop->label = $label ? $tp->toHTML(stripslashes($label), false, 'TITLE') : $c + 1;
            //quick fix servers with magicquotes - stripslashes()
            if ($c + 1 == $current_page) {
                $e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_URLCURRENT;
                $ret_items[] = $tp->simpleParse($tmpl[$tprefix . 'item_current'], $e_vars_loop);
            } else {
                $e_vars_loop->url_label = $label ? $tp->toAttribute($label) : LAN_NP_GOTO;
                $e_vars_loop->url_label = str_replace("[x]", $c + 1, $e_vars_loop->url_label);
                $ret_items[] = $tp->simpleParse($tmpl[$tprefix . 'item'], $e_vars_loop);
            }
        }
        $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'items_start'], $e_vars) . implode($tmpl[$tprefix . 'separator'], $ret_items) . $tp->simpleParse($tmpl[$tprefix . 'items_end'], $e_vars);
        unset($ret_items, $e_vars_loop);
        if ($show_next) {
            if (!empty($tmpl[$tprefix . 'nav_next'])) {
                $e_vars->url = str_replace('[FROM]', $next_page, $url);
                $e_vars->label = $LAN_NP_NEXT;
                $e_vars->url_label = LAN_NP_URLNEXT;
                $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_next'], $e_vars);
            }
            if ($show_last && !empty($tmpl[$tprefix . 'nav_last'])) {
                $e_vars->url = str_replace('[FROM]', $last_page, $url);
                //$last_page
                $e_vars->label = $LAN_NP_LAST;
                $e_vars->url_label = LAN_NP_URLLAST;
                $ret_array[] = $tp->simpleParse($tmpl[$tprefix . 'nav_last'], $e_vars);
            }
        }
        $ret .= implode($tmpl[$tprefix . 'separator'], $ret_array);
        // Nextprev navigation end
        $ret .= $tp->simpleParse($tmpl[$tprefix . 'end'], $e_vars);
        unset($e_vars, $ret_array);
        return $ret;
    } else {
        $parm_count = substr_count($parm, ',');
        while ($parm_count < 5) {
            $parm .= ',';
            $parm_count++;
        }
        $p = explode(',', $parm, 6);
        $total_items = intval($p[0]);
        $perpage = intval($p[1]);
        // page number instead record start now supported
        if (is_numeric($p[2])) {
            $current_start = intval($p[2]);
            $current_page = $current_start / $perpage + 1;
            $total_pages = ceil($total_items / $perpage);
            $index_add = 0;
        } else {
            $perpage = 1;
            $current_start = intval(array_pop(explode(':', $p[2], 2)));
            $current_page = $current_start;
            $total_pages = $total_items;
            $index_add = 1;
        }
        if ($total_items < $perpage) {
            return '';
        }
        $url = trim($p[3]);
        $caption = trim($p[4]);
        $pagetitle = explode('|', trim($p[5]));
        $caption = !$caption || $caption == 'off' ? LAN_GOPAGE . '&nbsp;' : $caption;
        while (substr($url, -1) == '.') {
            $url = substr($url, 0, -1);
        }
    }
    if ($total_pages > 1) {
        if (vartrue($pref['old_np'])) {
            $NP_PRE_ACTIVE = '';
            $NP_POST_ACTIVE = '';
            $NP_STYLE = '';
            if (!defined('NEXTPREV_NOSTYLE') || NEXTPREV_NOSTYLE == FALSE) {
                $NP_PRE_ACTIVE = '[';
                $NP_POST_ACTIVE = '] ';
                $NP_STYLE = "style='text-decoration:underline'";
            }
            //	Use OLD nextprev method
            $nppage = '';
            $nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
            if ($total_pages > 10) {
                //$current_page = ($current_start/$perpage)+1;
                for ($c = 0; $c <= 2; $c++) {
                    if ($perpage * ($c + $index_add) == $current_start) {
                        $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n";
                    } else {
                        $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url);
                        $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n";
                    }
                }
                if ($current_page >= 3 && $current_page <= 5) {
                    for ($c = 3; $c <= $current_page; $c++) {
                        if ($perpage * ($c + $index_add) == $current_start) {
                            $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n";
                        } else {
                            $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url);
                            $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n";
                        }
                    }
                } else {
                    if ($current_page >= 6 && $current_page <= $total_pages - 5) {
                        $nppage .= " ... ";
                        for ($c = $current_page - 2; $c <= $current_page; $c++) {
                            if ($perpage * ($c + $index_add) == $current_start) {
                                $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n";
                            } else {
                                $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url);
                                $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n";
                            }
                        }
                    }
                }
                $nppage .= " ... ";
                if ($current_page + 5 > $total_pages && $current_page != $total_pages) {
                    $tmp = $current_page - 2;
                } else {
                    $tmp = $total_pages - 3;
                }
                for ($c = $tmp; $c <= $total_pages - 1; $c++) {
                    if ($perpage * ($c + $index_add) == $current_start) {
                        $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n";
                    } else {
                        $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url);
                        $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n";
                    }
                }
            } else {
                for ($c = 0; $c < $total_pages; $c++) {
                    if ($perpage * ($c + $index_add) == $current_start) {
                        $nppage .= $NP_PRE_ACTIVE . "<span class='nextprev_current' {$NP_STYLE} >" . ($c + 1) . "</span>" . $NP_POST_ACTIVE . "\n";
                    } else {
                        $link = str_replace("[FROM]", $perpage * ($c + $index_add), $url);
                        $nppage .= "<a class='nextprev_link' href='{$link}'>" . ($c + 1) . "</a> \n";
                    }
                }
            }
            $nppage .= "\n\n<!-- End of Next/Prev -->\n\n";
            return $caption . $nppage;
        }
        // Use NEW nextprev method
        $np_parm['template'] = "<span class='form-group form-inline'>[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]<span>";
        $np_parms['prev'] = '&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;';
        $np_parms['next'] = '&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;';
        $np_parms['np_class'] = 'tbox npbutton btn btn-default';
        $np_parms['dropdown_class'] = 'tbox npdropdown form-control';
        $caption = '';
        // legacy has no caption.
        if ($cached_parms = getcachedvars('nextprev')) {
            $tmp = $cached_parms;
            foreach ($tmp as $key => $val) {
                $np_parms[$key] = $val;
            }
        }
        $prev = '';
        $next = '';
        if ($current_page > 1) {
            $prevstart = $current_start - $perpage;
            if (substr($url, 0, 5) == 'url::') {
                $urlParms = explode('::', $url);
                $urlParms[2] = str_replace('[FROM]', $prevstart, $urlParms[2]);
                $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3]));
            } else {
                $link = str_replace('[FROM]', $prevstart, $url);
            }
            $prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
        }
        if ($current_page < $total_pages) {
            $nextstart = $current_start + $perpage;
            if (substr($url, 0, 5) == 'url::') {
                $urlParms = explode('::', $url);
                $urlParms[2] = str_replace('[FROM]', $nextstart, $urlParms[2]);
                $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3]));
            } else {
                $link = str_replace('[FROM]', $nextstart, $url);
            }
            $next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
        }
        $dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
        for ($i = 1; $i <= $total_pages; $i++) {
            $sel = '';
            if ($current_page == $i) {
                $sel = " selected='selected' ";
            }
            $newstart = ($i - 1 + $index_add) * $perpage;
            if (substr($url, 0, 5) == 'url::') {
                $urlParms = explode('::', $url);
                $urlParms[2] = str_replace('[FROM]', $newstart, $urlParms[2]);
                $link = $e107->url->create($urlParms[1], $urlParms[2], varset($urlParms[3]));
            } else {
                $link = str_replace('[FROM]', $newstart, $url);
            }
            $c = $i - 1 + $index_add;
            $title = isset($pagetitle[$c]) && $pagetitle[$c] ? $pagetitle[$c] : $i;
            $dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n";
        }
        $dropdown .= '</select>';
        $ret = $np_parm['template'];
        // Set default
        if (isset($np_parms['template']) && $np_parms['template']) {
            $ret = $np_parms['template'];
            // Use override
        }
        $ret = str_replace('[DROPDOWN]', $dropdown, $ret);
        $ret = str_replace('[PREV]', $prev, $ret);
        $ret = str_replace('[NEXT]', $next, $ret);
        return $caption . $ret;
    }
}
Example #23
0
    $sql->db_Mark_Time('News months menu');
    if (!$sql->db_Select("news", "news_id, news_datestamp", "news_class IN (" . USERCLASS_LIST . ") AND news_datestamp > " . intval($start) . " AND news_datestamp < " . intval($end) . " ORDER BY news_datestamp DESC")) {
        e107::getCache()->set($cString, '');
        return '';
    }
    while ($news = $sql->db_Fetch()) {
        $xmonth = date("n", $news['news_datestamp']);
        if (!isset($month_links[$xmonth]) || !$month_links[$xmonth]) {
            $xmonth_cnt[$xmonth] = 0;
            $month_links[$xmonth] = e107::getUrl()->create('news/list/month', 'id=' . newsFormatDate($req_year, $xmonth));
        }
        $xmonth_cnt[$xmonth]++;
    }
    // go over the link array and create the option fields
    $menu_text = array();
    $template = e107::getTemplate('news', 'news_menu', 'months');
    $bullet = defined('BULLET') ? THEME_ABS . 'images/' . BULLET : THEME_ABS . 'images/bullet2.gif';
    $vars = new e_vars(array('bullet' => $bullet));
    foreach ($month_links as $index => $val) {
        $vars->addData(array('active' => $index == $req_month ? " active" : '', 'url' => $val, 'month' => $marray[$index - 1], 'count' => $xmonth_cnt[$index]));
        $menu_text[] = $tp->simpleParse($template['item'], $vars);
    }
    $cached = $template['start'] . implode($template['separator'], $menu_text) . $template['end'];
    if ($cached) {
        if (!$parms['showarchive']) {
            $cached .= '<div class="e-menu-link archive"><a href="' . e_PLUGIN_ABS . 'blogcalendar_menu/archive.php">' . BLOGCAL_L2 . '</a></div>';
        }
        $cached = $ns->tablerender(BLOGCAL_L1 . $req_year, $cached, 'news_months_menu', true);
    }
    e107::getCache()->set($cString, $cached);
}
Example #24
0
 /**
  * Handle the Ajax quick-reply. 
  */
 function ajaxQuickReply()
 {
     $tp = e107::getParser();
     if (!isset($_POST['e_token'])) {
         $_POST['e_token'] = '';
     }
     if (!e107::getSession()->check(false) || !$this->checkPerm($_POST['post'], 'post')) {
         //$ret['status'] = 'ok';
         //	$ret['msg'] = "Token Error";
         //	echo json_encode($ret);
         exit;
     }
     if (varset($_POST['action']) == 'quickreply' && vartrue($_POST['text'])) {
         $postInfo = array();
         $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
         if (USER) {
             $postInfo['post_user'] = USERID;
         } else {
             $postInfo['post_user_anon'] = $_POST['anonname'];
         }
         $postInfo['post_entry'] = $_POST['text'];
         $postInfo['post_forum'] = intval($_POST['post']);
         $postInfo['post_datestamp'] = time();
         $postInfo['post_thread'] = intval($_POST['thread']);
         $postInfo['post_id'] = $this->postAdd($postInfo);
         // save it.
         $postInfo['user_name'] = USERNAME;
         $postInfo['user_email'] = USEREMAIL;
         $postInfo['user_image'] = USERIMAGE;
         $postInfo['user_signature'] = USERSIGNATURE;
         if ($_POST['insert'] == 1) {
             $tmpl = e107::getTemplate('forum', 'forum_viewtopic', 'replies');
             $sc = e107::getScBatch('view', 'forum');
             $sc->setScVar('postInfo', $postInfo);
             $ret['html'] = $tp->parseTemplate($tmpl, true, $sc) . "\n";
         } else {
             $ret['html'] = false;
         }
         $ret['status'] = 'ok';
         $ret['msg'] = "Your post has been added";
         //echo $ret;
         echo json_encode($ret);
     }
     e107::getSession()->reset();
     exit;
 }
Example #25
0
 /**
  * Retrieve template array by category
  * 
  * @param string $ctemplate
  * @return array
  */
 public function getFboxTemplate($ctemplate)
 {
     $tmpl = e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, 'front');
     if (!$tmpl && e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, false)) {
         $tmpl = e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, false);
         // plugin template
     } elseif (!$tmpl && e107::getTemplate('featurebox', 'featurebox_category', 'default')) {
         $tmpl = e107::getTemplate('featurebox', 'featurebox_category', 'default');
         // theme/plugin default template
     } elseif (!$tmpl) {
         $tmpl = e107::getTemplate('featurebox', 'featurebox_category', 'default', false);
         //plugin default
     }
     return $tmpl;
 }
Example #26
0
 public function actionAll()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     //global $FAQ_START, $FAQ_END, $FAQ_LISTALL_START,$FAQ_LISTALL_LOOP,$FAQ_LISTALL_END;
     $FAQ_START = e107::getTemplate('faqs', true, 'start');
     $FAQ_END = e107::getTemplate('faqs', true, 'end');
     $FAQ_LISTALL = e107::getTemplate('faqs', true, 'all');
     $FAQ_CAPTION = e107::getTemplate('faqs', true, 'caption');
     // request parameter based on filter (int match in this case, see $this->filter[all][category]) - SAFE to be used in a query
     $category = $this->getRequest()->getRequestParam('category');
     $where = array();
     if ($category) {
         $where[] = "f.faq_parent={$category}";
     }
     $tag = $this->getRequest()->getRequestParam('tag');
     if ($tag) {
         $where[] = "FIND_IN_SET ('" . $tp->toDB($tag) . "', f.faq_tags)";
     }
     if ($where) {
         $where = ' AND ' . implode(' AND ', $where);
     } else {
         $where = '';
     }
     $query = "\r\n\t\t\tSELECT f.*,cat.* FROM #faqs AS f \r\n\t\t\tLEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id \r\n\t\t\tWHERE cat.faq_info_class IN (" . USERCLASS_LIST . "){$where} ORDER BY cat.faq_info_order,f.faq_order ";
     $sql->gen($query, false);
     $prevcat = "";
     $sc = e107::getScBatch('faqs', true);
     $sc->counter = 1;
     $sc->tag = htmlspecialchars($tag, ENT_QUOTES, 'utf-8');
     $sc->category = $category;
     $text = $tp->parseTemplate($FAQ_START, true, $sc);
     while ($rw = $sql->db_Fetch()) {
         $sc->setVars($rw);
         if ($rw['faq_info_order'] != $prevcat) {
             if ($prevcat != '') {
                 $text .= $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc);
             }
             $text .= "\n\n<!-- FAQ Start " . $rw['faq_info_order'] . "-->\n\n";
             $text .= $tp->parseTemplate($FAQ_LISTALL['start'], true, $sc);
             $start = TRUE;
         }
         $text .= $tp->parseTemplate($FAQ_LISTALL['item'], true, $sc);
         $prevcat = $rw['faq_info_order'];
         $sc->counter++;
         if ($category) {
             $meta = $rw;
         }
     }
     $text .= $start ? $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc) : "";
     $text .= $tp->parseTemplate($FAQ_END, true, $sc);
     // add meta data if there is parent category
     if (!empty($meta)) {
         $response = $this->getResponse();
         if ($meta['faq_info_metad']) {
             $response->addMetaDescription($meta['faq_info_metad']);
         }
         if ($meta['faq_info_metak']) {
             $response->addMetaKeywords($meta['faq_info_metak']);
         }
     }
     $caption = $FAQ_CAPTION ? $FAQ_CAPTION : LAN_PLUGIN_FAQS_FRONT_NAME;
     $this->addTitle($caption);
     $this->addBody($text);
 }
Example #27
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;
Example #28
0
<?php

/*
 * Imggregator - An image aggregator 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 . 'imggregator/_class.php';
$pref = e107::pref('imggregator');
$tp = e107::getParser();
$sc = e107::getScBatch('imggregator', true);
$template = e107::getTemplate('imggregator');
$images = glob(e_PLUGIN . 'imggregator/images/*.{jpg,jpeg,gif,png}', GLOB_BRACE);
$sc->setVars(array('url' => $images[array_rand($images)], 'size' => $pref['thumbSize']));
$text = $tp->parseTemplate($template['menu'], false, $sc);
e107::getRender()->tablerender('Imggregator', $text);
Example #29
0
 }
 */
 if (!defined("DATEHEADERCLASS")) {
     define("DATEHEADERCLASS", "nextprev");
     // if not defined in the theme, default class nextprev will be used for new date header
 }
 // #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
 $param = array();
 $param['current_action'] = $action;
 // Get Correct Template
 // XXX we use $NEWSLISTSTYLE above - correct as we are currently in list mode - XXX No this is not NEWSLISTSTYLE - which provides only summaries.
 // TODO requires BC testing if we comment this one
 if (vartrue($NEWSSTYLE)) {
     $template = $NEWSSTYLE;
 } else {
     $tmp = e107::getTemplate('news', 'news', 'default');
     // default - we show the full items, except for the 'extended' part..
     $template = $tmp['item'];
     unset($tmp);
 }
 // NEW - news category title when in list
 if ($sub_action && 'list' == $action && vartrue($newsAr[1]['category_name'])) {
     // we know category name - pass it to the nexprev url
     $category_name = $newsAr[1]['category_name'];
     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);
Example #30
0
    	<h2>".LAN_PRINT_135.$news_title."</h2>
    	<br />
    	(".LAN_PRINT_86." ".$tp->toHTML($category_name,FALSE,"defs").")
    	<br />
    	".LAN_PRINT_94." ".$a_name."<br />
    	".$news_datestamp."
    	<br /><br />".
    	$news_body;
    
    	if (!empty($news_extended)){ $print_text .= "<br /><br />".$news_extended; }
    
    	if (!empty($news_extended)){ $print_text .= "<br /><br />".$news_extended; }
    	if (!empty($news_source)){ $print_text .= "<br /><br />".$news_source; }
    	if (!empty($news_url)){ $print_text .= "<br />".$news_url; }
    */
    $tmp = e107::getTemplate('news', 'news', 'view');
    $template = $tmp['item'];
    unset($tmp);
    //	ob_start();
    require_once e_HANDLER . "news_class.php";
    $ix = new news();
    $print_text = $ix->render_newsitem($row, 'return', '', $template, null);
    //$print_text = ob_get_flush();
    $print_text .= "<br /><br /><hr />" . LAN_PRINT_303 . "<b>" . SITENAME . "</b>\n\t<br />\n\t" . $newsUrl . "\n\t";
}
if (defined("TEXTDIRECTION") && TEXTDIRECTION == "rtl") {
    $align = 'right';
} else {
    $align = 'left';
}
// Header down here to give us a chance to set a page title