1

Topic: Portal for a sqlite punbb forum

Hi,

I know that the current portals may not work for a sqlite based punbb forum..
I have a test setup of sqlite based punbb forum here: http://proshots.110mb.com/punbb/index.php

So I have decided to make a portal kind of webpage for my site.. I have ran into some complications. (lol.. I don't know much about programming - I more of a hardware kind of person than software..)..


This is the portal that I have done so far.. I have taken some of the code of index.php of punbb and put it as shown below.

http://proshots.110mb.com/index.php

<?php

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './punbb/');
require FORUM_ROOT.'include/common.php';

($hook = get_hook('in_start')) ? eval($hook) : null;

if ($forum_user['g_read_board'] == '0')
    message($lang_common['No view']);

// Load the index.php language file
require FORUM_ROOT.'lang/'.$forum_user['language'].'/index.php';


// Get list of forums and topics with new posts since last visit
if (!$forum_user['is_guest'])
{
    $query = array(
        'SELECT'    => 't.forum_id, t.id, t.last_post',
        'FROM'        => 'topics AS t',
        'JOINS'        => array(
            array(
                'INNER JOIN'    => 'forums AS f',
                'ON'            => 'f.id=t.forum_id'
            ),
            array(
                'LEFT JOIN'        => 'forum_perms AS fp',
                'ON'            => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
            )
        ),
        'WHERE'        => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$forum_user['last_visit'].' AND t.moved_to IS NULL'
    );

    ($hook = get_hook('in_qr_get_new_topics')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

    $new_topics = array();
    while ($cur_topic = $forum_db->fetch_assoc($result))
        $new_topics[$cur_topic['forum_id']][$cur_topic['id']] = $cur_topic['last_post'];

    $tracked_topics = get_tracked_topics();
}

// Setup main heading
$forum_page['main_title'] = forum_htmlencode($forum_config['o_board_title']);

($hook = get_hook('in_pre_header_load')) ? eval($hook) : null;

define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'index');
require FORUM_ROOT.'header.php';


require FORUM_ROOT.'footer.php';

Now please tell me how to proceed from here.. say for example if I need to add some html text to that page..

Re: Portal for a sqlite punbb forum

Binil wrote:

if I need to add some html text to that page..

What are you trying to integrate?
Do you have the html already?

If you can't code you're better off downloading a CMS and integrating a forum...IMO

3

Re: Portal for a sqlite punbb forum

The thing is that I use a free hosting account which doesn't have mysql. So I use sqlite - Now this means that most portal systems may not work with sqlite. I believe coders make portals based on mysql and not for sqlite. Not their fault since most people have mysql and not sqlite.

I just need to have a portal for my site. I don't need the full use of a cms in my site. So what I tried to do is make a home page based on the index page of punbb. If someone could provide a solution, this could be a good thing and for people like me who use sqlite.

Re: Portal for a sqlite punbb forum

And this one doesn't work you say? http://punbb.informer.com/forums/topic/ … -by-daris/

Re: Portal for a sqlite punbb forum

The only thing wrong with Portal by daris is that it must be in the same folder as the forum. This one can be on the homepage of the domain name and Punbb in the usual  folder "forums".

6

Re: Portal for a sqlite punbb forum

The portal by daris won't work in a sqlite based punbb forum since most coders test their extension on mysql only. No offense to daris - he is a great coder.

7 (edited by Binil 2010-09-13 19:04)

Re: Portal for a sqlite punbb forum

Modified again...The code is a mess.. lol..  It would be nice if someone could suggest something to make this better.. See http://proshots.110mb.com/index.php

<?php

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './punbb/');
require FORUM_ROOT.'include/common.php';

($hook = get_hook('in_start')) ? eval($hook) : null;

if ($forum_user['g_read_board'] == '0')
    message($lang_common['No view']);

// Load the index.php language file
require FORUM_ROOT.'lang/'.$forum_user['language'].'/index.php';


// Get list of forums and topics with new posts since last visit
if (!$forum_user['is_guest'])
{
    $query = array(
        'SELECT'    => 't.forum_id, t.id, t.last_post',
        'FROM'        => 'topics AS t',
        'JOINS'        => array(
            array(
                'INNER JOIN'    => 'forums AS f',
                'ON'            => 'f.id=t.forum_id'
            ),
            array(
                'LEFT JOIN'        => 'forum_perms AS fp',
                'ON'            => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
            )
        ),
        'WHERE'        => '(fp.read_forum IS NULL OR fp.read_forum=1) AND t.last_post>'.$forum_user['last_visit'].' AND t.moved_to IS NULL'
    );

    ($hook = get_hook('in_qr_get_new_topics')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

    $new_topics = array();
    while ($cur_topic = $forum_db->fetch_assoc($result))
        $new_topics[$cur_topic['forum_id']][$cur_topic['id']] = $cur_topic['last_post'];

    $tracked_topics = get_tracked_topics();
}

// Setup main heading
$forum_page['main_title'] = forum_htmlencode($forum_config['o_board_title']);

($hook = get_hook('in_pre_header_load')) ? eval($hook) : null;

define('FORUM_ALLOW_INDEX', 1);
define('FORUM_PAGE', 'index');

require FORUM_ROOT.'header.php';




// START SUBST - <!-- forum_info -->
ob_start();

($hook = get_hook('in_info_output_start')) ? eval($hook) : null;

// Collect some statistics from the database
$query = array(
    'SELECT'    => 'COUNT(u.id) - 1',
    'FROM'        => 'users AS u',
    'WHERE'        => 'u.group_id != '.FORUM_UNVERIFIED
);

($hook = get_hook('in_stats_qr_get_user_count')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$stats['total_users'] = $forum_db->result($result);

$query = array(
    'SELECT'    => 'u.id, u.username',
    'FROM'        => 'users AS u',
    'WHERE'        => 'u.group_id != '.FORUM_UNVERIFIED,
    'ORDER BY'    => 'u.registered DESC',
    'LIMIT'        => '1'
);

($hook = get_hook('in_stats_qr_get_newest_user')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$stats['last_user'] = $forum_db->fetch_assoc($result);

$query = array(
    'SELECT'    => 'SUM(f.num_topics), SUM(f.num_posts)',
    'FROM'        => 'forums AS f'
);

($hook = get_hook('in_stats_qr_get_post_stats')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
list($stats['total_topics'], $stats['total_posts']) = $forum_db->fetch_row($result);

$stats_list['no_of_users'] = '<li class="st-users"><span>'.sprintf($lang_index['No of users'], '<strong>'.forum_number_format($stats['total_users']).'</strong>').'</span></li>';
$stats_list['newest_user'] = '<li class="st-users"><span>'.sprintf($lang_index['Newest user'], '<strong>'.($forum_user['g_view_users'] == '1' ? '<a href="'.forum_link($forum_url['user'], $stats['last_user']['id']).'">'.forum_htmlencode($stats['last_user']['username']).'</a>' : forum_htmlencode($stats['last_user']['username'])).'</strong>').'</span></li>';
$stats_list['no_of_topics'] = '<li class="st-activity"><span>'.sprintf($lang_index['No of topics'], '<strong>'.forum_number_format($stats['total_topics']).'</strong>').'</span></li>';
$stats_list['no_of_posts'] = '<li class="st-activity"><span>'.sprintf($lang_index['No of posts'], '<strong>'.forum_number_format($stats['total_posts']).'</strong>').'</span></li>';

($hook = get_hook('in_stats_pre_info_output')) ? eval($hook) : null;

?>

<div id="brd-stats" class="gen-content">
    <h2 class="hn"><span>Thiis is a examplle</span></h2>

</div>


<?php

($hook = get_hook('in_stats_end')) ? eval($hook) : null;
($hook = get_hook('in_users_online_start')) ? eval($hook) : null;

if ($forum_config['o_users_online'] == '1')
{
    // Fetch users online info and generate strings for output
    $query = array(
        'SELECT'    => 'o.user_id, o.ident',
        'FROM'        => 'online AS o',
        'WHERE'        => 'o.idle=0',
        'ORDER BY'    => 'o.ident'
    );

    ($hook = get_hook('in_users_online_qr_get_online_info')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $forum_page['num_guests'] = $forum_page['num_users'] = 0;
    $users = array();

    while ($forum_user_online = $forum_db->fetch_assoc($result))
    {
        ($hook = get_hook('in_users_online_add_online_user_loop')) ? eval($hook) : null;

        if ($forum_user_online['user_id'] > 1)
        {
            $users[] = ($forum_user['g_view_users'] == '1') ? '<a href="'.forum_link($forum_url['user'], $forum_user_online['user_id']).'">'.forum_htmlencode($forum_user_online['ident']).'</a>' : forum_htmlencode($forum_user_online['ident']);
            ++$forum_page['num_users'];
        }
        else
            ++$forum_page['num_guests'];
    }

    $forum_page['online_info'] = array();
    $forum_page['online_info']['guests'] = ($forum_page['num_guests'] == 0) ? $lang_index['Guests none'] : sprintf((($forum_page['num_guests'] == 1) ? $lang_index['Guests single'] : $lang_index['Guests plural']), forum_number_format($forum_page['num_guests']));
    $forum_page['online_info']['users'] = ($forum_page['num_users'] == 0) ? $lang_index['Users none'] : sprintf((($forum_page['num_users'] == 1) ? $lang_index['Users single'] : $lang_index['Users plural']), forum_number_format($forum_page['num_users']));

    ($hook = get_hook('in_users_online_pre_online_info_output')) ? eval($hook) : null;
?>
<div id="brd-online" class="gen-content">
    <h3 class="hn"><p><b>Proshots</b> is the utlimate site in getting the best photos avaialable on the net.. This is where we make wonders.. </p>
<br><br>
<p> This page is integrated with punbb to develop this site.. This is another attempt to get a new site in order. This site is dedicated to pictures.. My endeavor with web sites started about 2 years ago.. I started it as fun, but slowly I got a little bit of ideas..</p>
<p>I have a thing for modifying web sites. I have done it in the past many times and I seem to be getting better and better as time passes by..</p>

</h3>

</div>
<?php

    ($hook = get_hook('in_users_online_end')) ? eval($hook) : null;
}

($hook = get_hook('in_info_end')) ? eval($hook) : null;

$tpl_temp = forum_trim(ob_get_contents());
$tpl_main = str_replace('<!-- forum_info -->', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <!-- forum_info -->


require FORUM_ROOT.'footer.php';