function teknoromisidebarsag()
{
    global $boarddir, $modSettings, $txt, $context;
    require_once $boarddir . '/SSI.php';
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright']) && empty($context['current_action'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; margin-right:4px; overflow:auto;">';
        if (!empty($modSettings['sideright1'])) {
            echo '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>';
            echo '' . $modSettings['sideright1'] . '';
        }
        if (!empty($modSettings['siderightphp'])) {
            echo '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
            eval($modSettings['siderightphp']);
        }
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								', $news['icon'], '
								<h3><a href="', $news['href'], '">', $news['subject'], '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div><hr/>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '
		</tr></tbody></table>';
}
    /**
     * fetch_data.
     * Fetch Boards, Topics, Messages and Attaches.
     */
    function fetch_data()
    {
        global $context, $smcFunc, $modSettings, $boardurl, $txt;
        $this->boards = null;
        $this->attaches = null;
        $this->imgName = '';
        if (isset($this->cfg['config']['settings']['board']) && !empty($this->cfg['config']['settings']['board'])) {
            $this->posts = ssi_boardNews($this->cfg['config']['settings']['board'], $this->cfg['config']['settings']['total'], null, null, '');
            if (!empty($this->posts)) {
                $topics = null;
                $msgids = null;
                foreach ($this->posts as $id => $post) {
                    $topics[] = $post['id'];
                    $msgids[] = $post['message_id'];
                    // Rescale inline Images ?
                    if (!empty($this->cfg['config']['settings']['rescale']) || empty($this->cfg['config']['settings']['rescale']) && !is_numeric($this->cfg['config']['settings']['rescale'])) {
                        // find all images
                        if (preg_match_all('~<img[^>]*>~iS', $this->posts[$id]['body'], $matches) > 0) {
                            // remove smileys
                            foreach ($matches[0] as $i => $data) {
                                if (strpos($data, $modSettings['smileys_url']) !== false) {
                                    unset($matches[0][$i]);
                                }
                            }
                            // images found?
                            if (count($matches[0]) > 0) {
                                $this->imgName = $this->cfg['blocktype'] . '-' . $this->cfg['id'];
                                if (empty($this->cfg['config']['settings']['rescale'])) {
                                    $fnd = array('~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                } else {
                                    $fnd = array('~ width?=?"\\d+"~', '~ height?=?"\\d+"~', '~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                }
                                // modify the images for highslide
                                foreach ($matches[0] as $i => $data) {
                                    $datlen = strlen($data);
                                    preg_match('~src?=?"([^\\"]*\\")~i', $data, $src);
                                    $alt = substr(strrchr($src[1], '/'), 1);
                                    $alt = str_replace(array('_', '-'), ' ', strtoupper(substr($alt, 0, strrpos($alt, '.'))));
                                    $tmp = str_replace($src[0], ' class="' . $this->imgName . '" alt="' . $alt . '" ' . $src[0], preg_replace($fnd, '', $data));
                                    // highslide disabled?
                                    if (!empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], $tmp, strpos($this->posts[$id]['body'], $data), $datlen);
                                    } elseif (empty($this->cfg['config']['settings']['disableHSimg']) && empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], '<a href="' . $boardurl . '" class="' . $this->imgName . ' highslide" title="' . $txt['pmx_hs_expand'] . '" onclick="return hs.expand(this, {src: \'' . str_replace('"', '', $src[1]) . '\', align: \'center\', headingEval: \'this.thumb.alt\'})">' . $tmp . '</a>', strpos($this->posts[$id]['body'], $data), $datlen);
                                    } else {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], $tmp, strpos($this->posts[$id]['body'], $data), $datlen);
                                    }
                                }
                            }
                        }
                    } elseif (is_numeric($this->cfg['config']['settings']['rescale'])) {
                        $this->posts[$id]['body'] = PortaMx_revoveLinks($this->posts[$id]['body'], false, true);
                    }
                    // teaser enabled ?
                    if (!empty($this->cfg['config']['settings']['teaser'])) {
                        $this->posts[$id]['body'] = PortaMx_Tease_posts($this->posts[$id]['body'], $this->cfg['config']['settings']['teaser']);
                    }
                }
                // get attachments if show thumnails set
                $allow_boards = boardsAllowedTo('view_attachments');
                if (!empty($this->cfg['config']['settings']['thumbs']) && !empty($allow_boards)) {
                    $request = $smcFunc['db_query']('', '
						SELECT a.id_msg, a.id_attach, a.id_thumb, a.filename, m.id_topic
						FROM {db_prefix}attachments AS a
						LEFT JOIN {db_prefix}messages AS m ON (a.id_msg = m.id_msg)
						WHERE a.id_msg IN({array_int:messages}) AND a.mime_type LIKE {string:like}' . ($allow_boards === array(0) ? '' : (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' AND m.approved = 1 AND a.approved = 1') . ' AND m.id_board IN ({array_int:boards})') . '
						ORDER BY a.id_msg DESC, a.id_attach ASC', array('messages' => $msgids, 'like' => 'IMAGE%', 'boards' => $allow_boards));
                    $thumbs = array();
                    $msgcnt = array();
                    $saved = !empty($this->cfg['config']['settings']['thumbcnt']) ? $this->cfg['config']['settings']['thumbcnt'] : 0;
                    while ($row = $smcFunc['db_fetch_assoc']($request)) {
                        if (!in_array($row['id_attach'], $thumbs)) {
                            if (!empty($this->cfg['config']['settings']['thumbcnt'])) {
                                if (!in_array($row['id_msg'], $msgcnt)) {
                                    $saved = $this->cfg['config']['settings']['thumbcnt'];
                                } elseif (in_array($row['id_msg'], $msgcnt) && empty($saved)) {
                                    continue;
                                }
                            }
                            $saved--;
                            $msgcnt[] = $row['id_msg'];
                            $thumbs[] = $row['id_thumb'];
                            $this->attaches[$row['id_msg']][] = array('topic' => $row['id_topic'], 'image' => $row['id_attach'], 'thumb' => empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'], 'fname' => str_replace('_thumb', '', $row['filename']));
                        }
                    }
                    $smcFunc['db_free_result']($request);
                }
                // get boards and views
                $request = $smcFunc['db_query']('', '
					SELECT b.id_board, b.name, t.id_topic, t.num_views
						FROM {db_prefix}boards b
						LEFT JOIN {db_prefix}topics t ON (t.id_board = b.id_board)
					WHERE t.id_topic IN ({array_int:topics})
						AND t.approved = 1', array('topics' => $topics));
                $this->boards = null;
                while ($row = $smcFunc['db_fetch_assoc']($request)) {
                    $this->boards[$row['id_topic']] = array('id_board' => $row['id_board'], 'boardname' => $row['name'], 'views' => $row['num_views']);
                }
                $smcFunc['db_free_result']($request);
            }
        }
    }
Example #3
0
function template_boardindex_outer_below()
{
    global $modSettings;
    // Info center collapse object.
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; overflow:hidden;">
				', empty($modSettings['sideright1']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>' . $modSettings['sideright1'] . '', '
				', empty($modSettings['siderightphp']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
        eval($modSettings['siderightphp']);
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								
								<h3><a href="', $news['href'], '"><span class="generic_icons sort_up"></span> ', shorten_subject($news['subject'], 30), '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '</td>
		</tr></tbody></table>';
    template_info_center();
}
function template_homepage_sample1_php()
{
    global $txt;
    $topics = ssi_recentTopics(8, null, null, 'array');
    foreach ($topics as $topic) {
        echo '
			<li><a href="', $topic['href'], '">', $topic['subject'], '</a> ', $txt['by'], ' ', $topic['poster']['link'], '</li>';
    }
    unset($topics);
    echo '

		</ul><br />

		<h3>Online Users</h3>';
    ssi_logOnline();
    echo '
	</div>

	<div id="content">';
    ssi_welcome();
    echo '
		<br /><br />

		<h2>News</h2>';
    ssi_boardNews();
    echo '
	</div>';
}
<?php

require "SSI.php";
?>
<html>
<link rel="stylesheet" type="text/css" href="http://openmeridian.org/forums/Themes/blackrain_202/css/index.css?fin20" />
<link rel="stylesheet" type="text/css" href="http://openmeridian.org/forums/Themes/blackrain_202/css/webkit.css" />
<?php 
$array = ssi_boardNews(16.0, 5, null, null, 'array');
foreach ($array as $news) {
    echo '
                        <table border="0" width="100%" align="center" class="ssi_table">
                                <tr>
                                        <td ><a href="', $news['comment_href'], '">', $news['subject'], '</a></td>
                                        <td width="20%" >', $news['time'], ' by ', $news['poster']['link'], '</td>
                                </tr>
                                <tr>
                                        <td >', $news['body'], '<br /><br /> Full Thread: ', $news['link'], '</td>
                                </tr>
                        </table>
                        <br />';
    if (!$news['is_last']) {
        echo '
                        <hr hr style="height:4px;width:100%;background-color:#222222" />
                        ';
    }
}
?>
</html>
Example #6
0
function BlogView()
{
    global $context, $scripturl, $txt, $smcFunc, $modSettings;
    // Do we have an alias?
    if (!empty($_GET['name'])) {
        // Make sure the alias only has valid characters in it.
        $name = strtolower(preg_replace('/[^A-Za-z0-9\\-_]/', '', $_GET['name']));
        // Let's try to get information on this blog.
        $result = $smcFunc['db_query']('', '
			SELECT 
				id_board, name, description, is_blog, blog_alias
			FROM {db_prefix}boards
			WHERE blog_alias = {string:name}', array('name' => $name));
    } elseif (!empty($_GET['id'])) {
        // Make sure ID is numeric.
        $id = (int) $_GET['id'];
        // Get some information on this blog board.
        $result = $smcFunc['db_query']('', '
			SELECT 
				id_board, name, description, is_blog, blog_alias
			FROM {db_prefix}boards
			WHERE id_board = {int:id}', array('id' => $id));
    } else {
        redirectexit('action=blog');
    }
    // Doesn't exist?
    if ($smcFunc['db_num_rows']($result) == 0) {
        fatal_lang_error('blog_error_not_exist');
    }
    $row = $smcFunc['db_fetch_assoc']($result);
    $smcFunc['db_free_result']($result);
    // Make sure it's a blog.
    if ($row['is_blog'] == false) {
        fatal_lang_error('blog_error_not_blog');
    }
    // Link tree....
    // Are we using an alias?
    if (!empty($_GET['name'])) {
        $context['linktree'][] = array('url' => $scripturl . '?action=blog;sa=view_blog;name=' . $_GET['name'], 'name' => $row['name']);
    } elseif (!empty($_GET['id'])) {
        $context['linktree'][] = array('url' => $scripturl . '?action=blog;sa=view_blog;id=' . $_GET['id'], 'name' => $row['name']);
    }
    // Set some data that we use.
    $context['blog'] = array('name' => $row['name'], 'description' => $row['description'], 'alias' => $row['blog_alias'], 'posts' => array());
    // Get the number of posts in this board.
    $result = $smcFunc['db_query']('', '
		SELECT 
			COUNT(id_topic)
		FROM {db_prefix}topics
		WHERE id_board = {int:id_of_board}', array('id_of_board' => (int) $row['id_board']));
    list($post_count) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Construct a page index.
    $context['blog']['pageindex'] = constructPageIndex($scripturl . '?action=blog;sa=view_blog;name=' . $row['blog_alias'] . ';start=%d', $_REQUEST['start'], $post_count, $modSettings['blog_posts_perpage'], true);
    // Get all the recent posts.
    $context['blog']['posts'] = ssi_boardNews($row['id_board'], $modSettings['blog_posts_perpage'], null, null, array());
    // Use the "view" template.
    $context['sub_template'] = 'view';
}
 /**
  * Short description
  *
  * Long description
  *
  * @param
  * @return
  */
 protected function show_boardNews()
 {
     try {
         $this->loadSSI();
     } catch (Exception $e) {
         throw new \Exception($e->getMessage());
     }
     if ('echo' == $this->output_method) {
         ob_start();
         ssi_boardNews($this->board, $this->limit, $this->start, $this->length, $this->output_method);
         $this->data = ob_get_contents();
         ob_end_clean();
     } else {
         $this->data = ssi_boardNews($this->board, $this->limit, $this->start, $this->length, $this->output_method);
     }
 }
Example #8
0
flush();
?>

		<hr />

			<h3>News Function: &lt;?php ssi_news(); ?&gt;</h3>
			<?php 
ssi_news();
flush();
?>

		<hr />

			<h3>Board News Function: &lt;?php ssi_boardNews(); ?&gt;</h3>
			<?php 
ssi_boardNews();
flush();
?>

		<hr />

			<h3>Menubar Function: &lt;?php ssi_menubar(); ?&gt;</h3>
			<?php 
ssi_menubar();
flush();
?>

		<hr />

			<h3>Quick Search Function: &lt;?php ssi_quickSearch(); ?&gt;</h3>
			<?php