1 (edited by elbekko 2006-04-08 20:08)

Topic: Clan CMS integrated with PunBB

Hey all,

I'v been working on a clan CMS for the last week and have a version that can be quite used smile
You can see it running here: link
I coded all the extra things myself, like the miniportal.
Many thanks go out to Alecks, who created the skin I used, DarkBlue.
The name of the clan hasn't been decided yet, so yes, the logo is only temporary =P
I also drastically changed userlist.php (saved under members.php) to show users a little fancier smile

Any comments are welcome.

-- Bekko

Re: Clan CMS integrated with PunBB

looks nice!

~James
FluxBB - Less is more

Re: Clan CMS integrated with PunBB

elbekko, can we get a copy of that members.php? kewl site..
i almost got a only store complete.. just need  few thing stweaked and a paypal guru to fix something..
keep it up!
Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

4 (edited by elbekko 2006-04-10 19:37)

Re: Clan CMS integrated with PunBB

Sure, the members.php is only some changed HTML (and something extra to the query, to retrieve the CS nick, which replaces Jabber) smile


EDIT:

Here's the code smile

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';


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


// Load the userlist.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/userlist.php';

// Load the search.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/search.php';


// Determine if we are allowed to view post counts
$show_post_count = ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) ? true : false;

$username = (isset($_GET['username']) && $pun_user['g_search_users'] == '1') ? $_GET['username'] : '';
$show_group = (!isset($_GET['show_group']) || intval($_GET['show_group']) < -1 && intval($_GET['show_group']) > 2) ? -1 : intval($_GET['show_group']);
$sort_by = (!isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'registered' && ($_GET['sort_by'] != 'num_posts' || !$show_post_count)) ? 'username' : $_GET['sort_by'];
$sort_dir = (!isset($_GET['sort_dir']) || $_GET['sort_dir'] != 'ASC' && $_GET['sort_dir'] != 'DESC') ? 'ASC' : strtoupper($_GET['sort_dir']);


$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['User list'];
if ($pun_user['g_search_users'] == '1')
    $focus_element = array('userlist', 'username');

define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

?>
<div class="blockform">
    <h2><span><?php echo $lang_search['User search'] ?></span></h2>
    <div class="box">
    <form id="userlist" method="get" action="members.php">
        <div class="inform">
            <fieldset>
                <legend><?php echo $lang_ul['User find legend'] ?></legend>
                <div class="infldset">
<?php if ($pun_user['g_search_users'] == '1'): ?>                    <label class="conl"><?php echo $lang_common['Username'] ?><br /><input type="text" name="username" value="<?php echo pun_htmlspecialchars($username) ?>" size="25" maxlength="25" /><br /></label>
<?php endif; ?>                    <label class="conl"><?php echo $lang_ul['User group']."\n" ?>
                    <br /><select name="show_group">
                        <option value="-1"<?php if ($show_group == -1) echo ' selected="selected"' ?>><?php echo $lang_ul['All users'] ?></option>
<?php

$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());

while ($cur_group = $db->fetch_assoc($result))
{
    if ($cur_group['g_id'] == $show_group)
        echo "\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
    else
        echo "\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
}

?>
                    </select>
                    <br /></label>
                    <label class="conl"><?php echo $lang_search['Sort by']."\n" ?>
                    <br /><select name="sort_by">
                        <option value="username"<?php if ($sort_by == 'username') echo ' selected="selected"' ?>><?php echo $lang_common['Username'] ?></option>
                        <option value="registered"<?php if ($sort_by == 'registered') echo ' selected="selected"' ?>><?php echo $lang_common['Registered'] ?></option>
<?php if ($show_post_count): ?>                        <option value="num_posts"<?php if ($sort_by == 'num_posts') echo ' selected="selected"' ?>><?php echo $lang_ul['No of posts'] ?></option>
<?php endif; ?>                    </select>
                    <br /></label>
                    <label class="conl"><?php echo $lang_search['Sort order']."\n" ?>
                    <br /><select name="sort_dir">
                        <option value="ASC"<?php if ($sort_dir == 'ASC') echo ' selected="selected"' ?>><?php echo $lang_search['Ascending'] ?></option>
                        <option value="DESC"<?php if ($sort_dir == 'DESC') echo ' selected="selected"' ?>><?php echo $lang_search['Descending'] ?></option>
                    </select>
                    <br /></label>
                    <p class="clearb"><?php echo $lang_ul['User search info'] ?></p>
                </div>
            </fieldset>
        </div>
        <p><input type="submit" name="search" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
    </form>
    </div>
</div>
<?php


// Create any SQL for the WHERE clause
$where_sql = array();
$like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';

if ($pun_user['g_search_users'] == '1' && $username != '')
    $where_sql[] = 'u.username '.$like_command.' \''.$db->escape(str_replace('*', '%', $username)).'\'';
if ($show_group > -1)
    $where_sql[] = 'u.group_id='.$show_group;

// Fetch user count
$result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'users AS u'.(!empty($where_sql) ? ' WHERE u.id>1 AND '.implode(' AND ', $where_sql) : '')) or error('Unable to fetch user list count', __FILE__, __LINE__, $db->error());
$num_users = $db->result($result);


// Determine the user offset (based on $_GET['p'])
$num_pages = ceil($num_users / 50);

$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
$start_from = 50 * ($p - 1);

// Generate paging links
$paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'members.php?username='.urlencode($username).'&show_group='.$show_group.'&sort_by='.$sort_by.'&sort_dir='.strtoupper($sort_dir));


?>
<div class="linkst">
    <div class="inbox">
        <p class="pagelink"><?php echo $paging_links ?></p>
    </div>
</div>

<div id="users1" class="blocktable">
    <h2><span><?php echo $lang_common['User list'] ?></span></h2>
    <div class="box">
        <div class="inbox">
<?php

// Grab the users
$result = $db->query('SELECT u.id, u.username, u.use_avatar, u.title, u.num_posts, u.registered, u.jabber, g.g_id, g.g_user_title, g.g_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
    while ($user_data = $db->fetch_assoc($result))
    {
        if ($pun_config['o_avatars'] == '1' && $user_data['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$user_data['id'].'.gif'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$user_data['id'].'.gif" '.$img_size[3].' alt="" style="float: left" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$user_data['id'].'.jpg'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$user_data['id'].'.jpg" '.$img_size[3].' alt="" style="float: left" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$user_data['id'].'.png'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$user_data['id'].'.png" '.$img_size[3].' alt="" style="float: left" />';
        }
        else
            $user_avatar = '';    
    
        $user_title_field = get_title($user_data);

?>        
        <div style="margin:5px">
        <h2><a href="<?php echo "profile.php?id=" . $user_data['id'] . '">' . $user_data['username']; ?></a></h2>
        <p style="float:right"><?php echo "<b>" . $lang_common['Registered'] . "</b>: " . format_time($user_data['registered'], true); ?></p>
        <?php echo $user_avatar; ?>
        <?php 
        // The CS nick is stored in the Jabber column. Who uses that anyways? :P
        $cs_nick = ($user_data['jabber']) ? $user_data['jabber'] : "None";
        echo "<b>" . $lang_common['Title'] . "</b>: " . $user_title_field . "<br />\n<b>" . $lang_common['Jabber'] . "</b>: " . $cs_nick . "<br />\n<b>" . $lang_common['Group'] . "</b>: " . $user_data['g_title'] . "<br />\n<b>" . $lang_common['Posts'] . "</b>: " . $user_data['num_posts']; ?>
        </div>
        <div class="clearer"></div>
<?php

    }
}
else
    echo "\t\t\t".'<tr>'."\n\t\t\t\t\t".'<td class="tcl" colspan="'.(($show_post_count) ? 4 : 3).'">'.$lang_search['No hits'].'</td></tr>'."\n";

?>
        </div>
    </div>
</div>

<div class="linksb">
    <div class="inbox">
        <p class="pagelink"><?php echo $paging_links ?></p>
    </div>
</div>
<?php

require PUN_ROOT.'footer.php';
?>

Re: Clan CMS integrated with PunBB

Very nice...

I am currently working on something very simliar to this.

6 (edited by quaker 2006-04-11 05:02)

Re: Clan CMS integrated with PunBB

how can we get it to pull the members avatars?
http://nalan.org/members.php


ops it works..
how can i break it down in 10 per page?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

Ehm, change
$num_pages = ceil($num_users / 50);
to
$num_pages = ceil($num_users / 10);
and
$start_from = 50 * ($p - 1);
to
$start_from = 10 * ($p - 1);

Think that should do it =/

Re: Clan CMS integrated with PunBB

well tht did do it but the page 1 still has all the members.
cause i only got 28 members. and i do see page 1,2,3 next.
http://nalan.org/members u might have to log in as demo/demo to see member page
ty

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

Seems I forgot something tongue

Change

$result = $db->query('SELECT u.id, u.username, u.use_avatar, u.title, u.num_posts, u.registered, u.jabber, g.g_id, g.g_user_title, g.g_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());

to

$result = $db->query('SELECT u.id, u.username, u.use_avatar, u.title, u.num_posts, u.registered, u.jabber, g.g_id, g.g_user_title, g.g_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 10') or error('Unable to fetch user list', __FILE__, __LINE__, $db->error());

10

Re: Clan CMS integrated with PunBB

Snap that it!
do u do any moding?
i got an online stats that tells me when people are on line. well i would like it to record the ip either to a log.txt or list them in the online stats page. so that i can view ips.
can that be done?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

IPs are inserted in the DB for everyone who's online. A plugin to view that would be quite easy then smile

12

Re: Clan CMS integrated with PunBB

even guest?

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

13 (edited by elbekko 2006-04-11 15:38)

Re: Clan CMS integrated with PunBB

Think so yes. Do you have phpMyAdmin? Then check the online table smile

14

Re: Clan CMS integrated with PunBB

what am i looking for? haha.. im not a sql person...

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

Click on Browse and you'll see everything that's stored in it smile

16

Re: Clan CMS integrated with PunBB

just shows one ip
210.5.87.72
that it..
can my online stats be moded to print the username and the ip to that page or another one?
guest--->ip 192.168.0.1
and so on

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

That's most likely your IP then. Err... I'll look into it when I can access my dev machine tongue

18

Re: Clan CMS integrated with PunBB

mine start with 69.xx

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

Quaker: http://www.punres.org/viewtopic.php?id=1327 big_smile

20

Re: Clan CMS integrated with PunBB

sweet do u know anything about paypal api or ibn?? hehe

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

21

Re: Clan CMS integrated with PunBB

i get this error

Warning: file_get_contents(log.txt): failed to open stream: No such file or directory in /home/nalan1/public_html/include/common.php on line 124

Warning: fopen(log.txt): failed to open stream: Permission denied in /home/nalan1/public_html/include/common.php on line 129

Warning: fwrite(): supplied argument is not a valid stream resource in /home/nalan1/public_html/include/common.php on line 131

Warning: fclose(): supplied argument is not a valid stream resource in /home/nalan1/public_html/include/common.php on line 132

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

22 (edited by quaker 2006-04-11 22:26)

Re: Clan CMS integrated with PunBB

ok fixed it
you need to add a log.txt file to the zip..
haha
and make chmod to 777


quick mod to that.
it displays
admin           69.xx.            Today 17:18:22
admin           69.xx.            Today 17:19:23
admin           69.xx.            Today 17:19:33

can it not be like
admin            69.xx     2 visit         today,yesterday,yr ago(last log in)
only if the user log in different ip that it adds another line.

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Clan CMS integrated with PunBB

Oh right, I tested it on windows, where there are no filesystem restrictions =/

And for the request... that harder tongue

24

Re: Clan CMS integrated with PunBB

Quaker could you share the stuff you used to make your image gallery?

25

Re: Clan CMS integrated with PunBB

sure it is on my site in the uploads !

http://nalan.org

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!