Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Installation Help
Author Message
Psycho
Worker
Worker


Joined: May 27, 2006
Posts: 157

PostPosted: Fri Jun 16, 2006 1:30 pm Reply with quote

My forum admin page wont show. When i click on the admin link in the panel for "Forums" i get a blank page. When i click on forums on home page it takes me to forums fine. just admin page is blank for forum admin. Confused

Thanks! Razz
 
View user's profile Send private message Send e-mail
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6792
Location: Ha Noi, Viet Nam

PostPosted: Fri Jun 16, 2006 3:19 pm Reply with quote

If this is a new install, re-upload your forum files.
If it is an existing site, you may need to back tracke on whatever changes you have made. 99.9% of the time this error is caused by failed ftp creating corrupt files or a typo when editing files.
You may want to use the forum search facility as this particular problem has been discussed many times before.
 
View user's profile Send private message Send e-mail
Psycho
PostPosted: Sat Jun 17, 2006 4:05 am Reply with quote

i did reload the files several times but it still doesn't work!
 
jaded
Theme Guru


Joined: Nov 01, 2003
Posts: 1006

PostPosted: Sat Jun 17, 2006 7:18 pm Reply with quote

please search for forum admin blank or forum and blank or forums blank or forums white page. You will most likely find the answer. I have seen this answered many times. It also helps to turn error reporting on in your config file.

_________________
Themes BB Skins Only registered users can see links on this board! Get registered or login!
Graphic Tees Only registered users can see links on this board! Get registered or login!
Paranormal Tees Only registered users can see links on this board! Get registered or login!
Ghost Stories & More Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Sat Jun 17, 2006 7:51 pm Reply with quote

also if by chance ur search turns up no results...like guardian stated...it was probably an edit...what might have u installed lately?

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Psycho
PostPosted: Sun Jun 18, 2006 5:12 pm Reply with quote

all ive done basically is installed php nuke on my web space and the admuin forum page is blank.
 
Guardian2003
PostPosted: Sun Jun 18, 2006 5:38 pm Reply with quote

Which version of nuke are you using.
 
gregexp
PostPosted: Sun Jun 18, 2006 8:08 pm Reply with quote

well if thats all u did was install nuke...then i think u need to install somethin better ...could i make a sudjestion....raven nuke is nice...REALLY nice.
 
Psycho
PostPosted: Mon Jun 19, 2006 12:33 pm Reply with quote

thats the one i meant. rwsRavenNuke76_v2.02.02_FULL. from this site.
 
Psycho
PostPosted: Mon Jun 19, 2006 1:04 pm Reply with quote

Only registered users can see links on this board! Get registered or login! is the address of the page. that is right ye?
i entered:

ALTER TABLE nuke_users ADD COLUMN user_login_tries smallint(5) UNSIGNED DEFAULT '0' NOT NULL;
ALTER TABLE nuke_users ADD COLUMN user_last_login_try int(11) DEFAULT '0' NOT NULL;

into my SQL.
and the page is still blank. please help?
 
Guardian2003
PostPosted: Mon Jun 19, 2006 8:09 pm Reply with quote

Do you get the same thing with the default fisubice theme?

The correct url should be /admin/php?op-forums
which will take you to the url you posted.
 
Psycho
PostPosted: Tue Jun 20, 2006 12:16 pm Reply with quote

yes the same thing happens with the default theme (fisubice)
 
jaded
PostPosted: Tue Jun 20, 2006 5:03 pm Reply with quote

Only registered users can see links on this board! Get registered or login! is the address of the page. that is right ye?
i entered:

no, this is the wrong url as guardian stated.
 
gregexp
PostPosted: Tue Jun 20, 2006 5:11 pm Reply with quote

try gettin into it from ur admin panel instead of direct link

although i have no problems gettin to that link myself.(on mysite)
 
fkelly
Former Moderator in Good Standing


Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Tue Jun 20, 2006 5:20 pm Reply with quote

Can you go into PHPmyadmin and just list out the definition (a.k.a. structure) of your nuke_users table? If you can capture that and post it here it might help. I have a sneaking suspicion that maybe your alter table statements didn't take. They can be mighty finicky.
 
View user's profile Send private message Visit poster's website
Psycho
PostPosted: Wed Jun 21, 2006 6:07 am Reply with quote

@ darklord: I do try to access it from the admin panel, not from the link.

@ jaded: I also tried the link that guardian2003 suggested and get the same thing.

@fkelly: do you want me to write out the entire table and post it in here?
 
fkelly
PostPosted: Wed Jun 21, 2006 7:17 am Reply with quote

@psycho

No need, I just bought up PHPmyadmin and here's the table. Take yours and compare it to this line by line or use a file comparison tool.

Code:
CREATE TABLE `nuke_users` (

  `user_id` int(11) NOT NULL auto_increment,
  `name` varchar(60) NOT NULL default '',
  `username` varchar(25) NOT NULL default '',
  `user_email` varchar(255) NOT NULL default '',
  `femail` varchar(255) NOT NULL default '',
  `user_website` varchar(255) NOT NULL default '',
  `user_avatar` varchar(255) NOT NULL default '',
  `user_regdate` varchar(20) NOT NULL default '',
  `user_icq` varchar(15) default NULL,
  `user_occ` varchar(100) default NULL,
  `user_from` varchar(100) default NULL,
  `user_interests` varchar(150) NOT NULL default '',
  `user_sig` varchar(255) default NULL,
  `user_viewemail` tinyint(2) default NULL,
  `user_theme` int(3) default NULL,
  `user_aim` varchar(18) default NULL,
  `user_yim` varchar(25) default NULL,
  `user_msnm` varchar(25) default NULL,
  `user_password` varchar(40) NOT NULL default '',
  `storynum` tinyint(4) NOT NULL default '10',
  `umode` varchar(10) NOT NULL default '',
  `uorder` tinyint(1) NOT NULL default '0',
  `thold` tinyint(1) NOT NULL default '0',
  `noscore` tinyint(1) NOT NULL default '0',
  `bio` tinytext NOT NULL,
  `ublockon` tinyint(1) NOT NULL default '0',
  `ublock` tinytext NOT NULL,
  `theme` varchar(255) NOT NULL default '',
  `commentmax` int(11) NOT NULL default '4096',
  `counter` int(11) NOT NULL default '0',
  `newsletter` int(1) NOT NULL default '0',
  `user_posts` int(10) NOT NULL default '0',
  `user_attachsig` int(2) NOT NULL default '0',
  `user_rank` int(10) NOT NULL default '0',
  `user_level` int(10) NOT NULL default '1',
  `broadcast` tinyint(1) NOT NULL default '1',
  `popmeson` tinyint(1) NOT NULL default '0',
  `user_active` tinyint(1) default '1',
  `user_session_time` int(11) NOT NULL default '0',
  `user_session_page` smallint(5) NOT NULL default '0',
  `user_lastvisit` int(11) NOT NULL default '0',
  `user_timezone` tinyint(4) NOT NULL default '10',
  `user_style` tinyint(4) default NULL,
  `user_lang` varchar(255) NOT NULL default 'english',
  `user_dateformat` varchar(14) NOT NULL default 'D M d, Y g:i a',
  `user_new_privmsg` smallint(5) unsigned NOT NULL default '0',
  `user_unread_privmsg` smallint(5) unsigned NOT NULL default '0',
  `user_last_privmsg` int(11) NOT NULL default '0',
  `user_emailtime` int(11) default NULL,
  `user_allowhtml` tinyint(1) default '1',
  `user_allowbbcode` tinyint(1) default '1',
  `user_allowsmile` tinyint(1) default '1',
  `user_allowavatar` tinyint(1) NOT NULL default '1',
  `user_allow_pm` tinyint(1) NOT NULL default '1',
  `user_allow_viewonline` tinyint(1) NOT NULL default '1',
  `user_notify` tinyint(1) NOT NULL default '0',
  `user_notify_pm` tinyint(1) NOT NULL default '0',
  `user_popup_pm` tinyint(1) NOT NULL default '0',
  `user_avatar_type` tinyint(4) NOT NULL default '3',
  `user_sig_bbcode_uid` varchar(10) default NULL,
  `user_actkey` varchar(32) default NULL,
  `user_newpasswd` varchar(32) default NULL,
  `points` int(10) default '0',
  `last_ip` varchar(15) NOT NULL default '0',
  PRIMARY KEY  (`user_id`),
  KEY `uname` (`username`),
  KEY `user_session_time` (`user_session_time`)
) TYPE=MyISAM AUTO_INCREMENT=3351 ;


Well I'll be darned. user_login_tries and user_last_login_try are NOT in my table on my production system either. Yet they are in the load program for Ravennuke in the INSTALLATION/sql directory. And the login.php program in the /modules/forums directory refers to them and if you run that program you sure as shooting will get an SQL error behind the scenes and a white screen in front of the scenes. I looked at an earlier load program from Ravennuke 2.02 and the user_login_tries and user_last_login_tries were NOT in there and that was what I used.

So, I just stayed in phpmyadmin and CAREFULLY added the fields using the definitions from the latest rn76_core_pl32.sql file. Then I retested Forums admin. It works, but it worked before. That means I must have the login function disabled (as per evaders earlier post).

Bottom line: you need to go into the database and MAKE SURE those fields are there. IF they aren't and your login.php runs on entry to Forums admin then you will get the white screen that started this thread. You don't need to post the field definitions here, just let us know whether they are there.
 
Psycho
PostPosted: Wed Jun 21, 2006 10:04 am Reply with quote

rofl i didnt understand a word i read. although i will check that sql stuff you have quoted against mine and let u know if there are any differences!

Thanks Fkelly
 
Psycho
PostPosted: Wed Jun 21, 2006 10:08 am Reply with quote

ok i don't know how to bring up that data u quoted. sorry:)
 
Psycho
PostPosted: Wed Jun 21, 2006 10:10 am Reply with quote

ALTER TABLE `nuke_users` ADD FULLTEXT (
`user_id` ,
`name` ,
`username` ,
`user_email` ,
`femail` ,
`user_website` ,
`user_avatar` ,
`user_regdate` ,
`user_icq` ,
`user_occ` ,
`user_from` ,
`user_interests` ,
`user_sig` ,
`user_viewemail` ,
`user_theme` ,
`user_aim` ,
`user_yim` ,
`user_msnm` ,
`user_password` ,
`storynum` ,
`umode` ,
`uorder` ,
`thold` ,
`noscore` ,
`bio` ,
`ublockon` ,
`ublock` ,
`theme` ,
`commentmax` ,
`counter` ,
`newsletter` ,
`user_posts` ,
`user_attachsig` ,
`user_rank` ,
`user_level` ,
`broadcast` ,
`popmeson` ,
`user_active` ,
`user_session_time` ,
`user_session_page` ,
`user_lastvisit` ,
`user_timezone` ,
`user_style` ,
`user_lang` ,
`user_dateformat` ,
`user_new_privmsg` ,
`user_unread_privmsg` ,
`user_last_privmsg` ,
`user_emailtime` ,
`user_allowhtml` ,
`user_allowbbcode` ,
`user_allowsmile` ,
`user_allowavatar` ,
`user_allow_pm` ,
`user_allow_viewonline` ,
`user_notify` ,
`user_notify_pm` ,
`user_popup_pm` ,
`user_avatar_type` ,
`user_sig_bbcode_uid` ,
`user_actkey` ,
`user_newpasswd` ,
`points` ,
`last_ip` ,
`user_login_tries` ,
`user_last_login_try`
);

is that what im supposed to see?
 
fkelly
PostPosted: Wed Jun 21, 2006 11:49 am Reply with quote

Yes, what you are looking at indicates that you probably have those two fields, user_login_tries and user_last_login_try.

Let's step back for a second. Where do you host your site? Do you have Phpmyadmin available to look at your database? If so, you just need to point it at the database and click on the Nuke_users table. You should see a structure view of the table and you should be able to scroll down and confirm for sure whether the fields are there. You can get a listing like the one I posted by going to the export function for the users table (export is a button along the top line) and picking structure only (by unclicking export data). But you really just need to confirm the two fields and you can do that without exporting anything.

I'm not sure where that listing you posted came from. While the field names are there the attributes aren't.
 
jaded
PostPosted: Wed Jun 21, 2006 1:51 pm Reply with quote

well, this is almost to the point of rediculous now. Your must be fed up. If this is a brand new site and you would like, I would be willing to go into the site and look at things for you. I am sure we can get it sorted. The info that I would need emailed is ftp, cpanel(link and login) and the sites God admin name and pass as well as your domain name. You can send that, if interested, to Only registered users can see links on this board! Get registered or login!
 
Psycho
PostPosted: Thu Jun 22, 2006 2:08 am Reply with quote

why is it getting to the point of ridiculus? i'm learning php nuke and flkelly is helping me. if i can't manage i'll be sure to take you up on your offer.
 
Psycho
PostPosted: Thu Jun 22, 2006 2:19 am Reply with quote

i have not got those 2 fields in the table but they are in that export structure thing as:
`user_login_tries` smallint(5) unsigned NOT NULL default '0',
`user_last_login_try` int(11) NOT NULL default '0',
 
Psycho
PostPosted: Thu Jun 22, 2006 12:08 pm Reply with quote

Code:
<?php

/***************************************************************************
 *                             admin_forums.php
 *                            -------------------
 *   begin                : Thursday, Jul 12, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : Only registered users can see links on this board! Get registered or login!
 *
 *   Id: admin_forums.php,v 1.40.2.13 2006/03/09 21:55:09 grahamje Exp $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program 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.
 *
 ***************************************************************************/

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
        $file = basename(__FILE__);
        $module['Forums']['Manage'] = $file;
        return;
}

//
// Load default header
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include("../../../includes/functions_admin.php");

$forum_auth_ary = array(
        "auth_view" => AUTH_ALL,
        "auth_read" => AUTH_ALL,
   "auth_post" => AUTH_REG,
   "auth_reply" => AUTH_REG,
        "auth_edit" => AUTH_REG,
        "auth_delete" => AUTH_REG,
        "auth_sticky" => AUTH_MOD,
        "auth_announce" => AUTH_MOD,
        "auth_vote" => AUTH_REG,
        "auth_pollcreate" => AUTH_REG
);

//
// Mode setting
//
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
        $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
        $mode = htmlspecialchars($mode);
}
else
{
        $mode = "";
}

// ------------------
// Begin function block
//
function get_info($mode, $id)
{
        global $db;

        switch($mode)
        {
                case 'category':
                        $table = CATEGORIES_TABLE;
                        $idfield = 'cat_id';
                        $namefield = 'cat_title';
                        break;

                case 'forum':
                        $table = FORUMS_TABLE;
                        $idfield = 'forum_id';
                        $namefield = 'forum_name';
                        break;

                default:
                        message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
                        break;
        }
        $sql = "SELECT count(*) as total
                FROM $table";
        if( !$result = $db->sql_query($sql) )
        {
                message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
        }
        $count = $db->sql_fetchrow($result);
        $count = $count['total'];

        $sql = "SELECT *
                FROM $table
                WHERE $idfield = $id";

        if( !$result = $db->sql_query($sql) )
        {
                message_die(GENERAL_ERROR, "Couldn't get Forum/Category information", "", __LINE__, __FILE__, $sql);
        }

        if( $db->sql_numrows($result) != 1 )
        {
                message_die(GENERAL_ERROR, "Forum/Category doesn't exist or multiple forums/categories with ID $id", "", __LINE__, __FILE__);
        }

        $return = $db->sql_fetchrow($result);
        $return['number'] = $count;
        return $return;
}

function get_list($mode, $id, $select)
{
        global $db;

        switch($mode)
        {
                case 'category':
                        $table = CATEGORIES_TABLE;
                        $idfield = 'cat_id';
                        $namefield = 'cat_title';
                        break;

                case 'forum':
                        $table = FORUMS_TABLE;
                        $idfield = 'forum_id';
                        $namefield = 'forum_name';
                        break;

                default:
                        message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
                        break;
        }

        $sql = "SELECT *
                FROM $table";
        if( $select == 0 )
        {
                $sql .= " WHERE $idfield <> $id";
        }

        if( !$result = $db->sql_query($sql) )
        {
                message_die(GENERAL_ERROR, "Couldn't get list of Categories/Forums", "", __LINE__, __FILE__, $sql);
        }

        $cat_list = "";

        while( $row = $db->sql_fetchrow($result) )
        {
                $s = "";
                if ($row[$idfield] == $id)
                {
                        $s = " selected=\"selected\"";
                }
                $catlist .= "<option value=\"$row[$idfield]\"$s>" . $row[$namefield] . "</option>\n";
        }

        return($catlist);
}

function renumber_order($mode, $cat = 0)
{
        global $db;

        switch($mode)
        {
                case 'category':
                        $table = CATEGORIES_TABLE;
                        $idfield = 'cat_id';
                        $orderfield = 'cat_order';
                        $cat = 0;
                        break;

                case 'forum':
                        $table = FORUMS_TABLE;
                        $idfield = 'forum_id';
                        $orderfield = 'forum_order';
                        $catfield = 'cat_id';
                        break;

                default:
                        message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
                        break;
        }

        $sql = "SELECT * FROM $table";
        if( $cat != 0)
        {
                $sql .= " WHERE $catfield = $cat";
        }
        $sql .= " ORDER BY $orderfield ASC";


        if( !$result = $db->sql_query($sql) )
        {
                message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
        }

        $i = 10;
        $inc = 10;

        while( $row = $db->sql_fetchrow($result) )
        {
                $sql = "UPDATE $table
                        SET $orderfield = $i
                        WHERE $idfield = " . $row[$idfield];
                if( !$db->sql_query($sql) )
                {
                        message_die(GENERAL_ERROR, "Couldn't update order fields", "", __LINE__, __FILE__, $sql);
                }
                $i += 10;
        }

}
//
// End function block
// ------------------

//
// Begin program proper
//
if( isset($HTTP_POST_VARS['addforum']) || isset($HTTP_POST_VARS['addcategory']) )
{
        $mode = ( isset($HTTP_POST_VARS['addforum']) ) ? "addforum" : "addcat";

        if( $mode == "addforum" )
        {
                list($cat_id) = each($HTTP_POST_VARS['addforum']);
      $cat_id = intval($cat_id);
                //
                // stripslashes needs to be run on this because slashes are added when the forum name is posted
                //
                $forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]);
        }
}

if( !empty($mode) )
{
        switch($mode)
        {
                case 'addforum':
                case 'editforum':
                        //
                        // Show form to create/modify a forum
                        //
                        if ($mode == 'editforum')
                        {
                                // $newmode determines if we are going to INSERT or UPDATE after posting?

                                $l_title = $lang['Edit_forum'];
                                $newmode = 'modforum';
                                $buttonvalue = $lang['Update'];

                                $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

                                $row = get_info('forum', $forum_id);

                                $cat_id = $row['cat_id'];
                                $forumname = $row['forum_name'];
                                $forumdesc = $row['forum_desc'];
                                $forumstatus = $row['forum_status'];

                                //
                                // start forum prune stuff.
                                //
                                if( $row['prune_enable'] )
                                {
                                        $prune_enabled = "checked=\"checked\"";
                                        $sql = "SELECT *
                                       FROM " . PRUNE_TABLE . "
                                       WHERE forum_id = $forum_id";
                                        if(!$pr_result = $db->sql_query($sql))
                                        {
                                                 message_die(GENERAL_ERROR, "Auto-Prune: Couldn't read auto_prune table.", __LINE__, __FILE__);
                                }

                                        $pr_row = $db->sql_fetchrow($pr_result);
                                }
                                else
                                {
                                        $prune_enabled = '';
                                }
                        }
                        else
                        {
                                $l_title = $lang['Create_forum'];
                                $newmode = 'createforum';
                                $buttonvalue = $lang['Create_forum'];

                                $forumdesc = '';
                                $forumstatus = FORUM_UNLOCKED;
                                $forum_id = '';
                                $prune_enabled = '';
                        }

                        $catlist = get_list('category', $cat_id, TRUE);

                        $forumstatus == ( FORUM_LOCKED ) ? $forumlocked = "selected=\"selected\"" : $forumunlocked = "selected=\"selected\"";

                        // These two options ($lang['Status_unlocked'] and $lang['Status_locked']) seem to be missing from
                        // the language files.
                        $lang['Status_unlocked'] = isset($lang['Status_unlocked']) ? $lang['Status_unlocked'] : 'Unlocked';
                        $lang['Status_locked'] = isset($lang['Status_locked']) ? $lang['Status_locked'] : 'Locked';

                        $statuslist = "<option value=\"" . FORUM_UNLOCKED . "\" $forumunlocked>" . $lang['Status_unlocked'] . "</option>\n";
                        $statuslist .= "<option value=\"" . FORUM_LOCKED . "\" $forumlocked>" . $lang['Status_locked'] . "</option>\n";

                        $template->set_filenames(array(
                                "body" => "admin/forum_edit_body.tpl")
                        );

                        $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode .'" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />';

                        $template->assign_vars(array(
                                'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
                                'S_HIDDEN_FIELDS' => $s_hidden_fields,
                                'S_SUBMIT_VALUE' => $buttonvalue,
                                'S_CAT_LIST' => $catlist,
                                'S_STATUS_LIST' => $statuslist,
                                'S_PRUNE_ENABLED' => $prune_enabled,

                                'L_FORUM_TITLE' => $l_title,
                                'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'],
                                'L_FORUM_SETTINGS' => $lang['Forum_settings'],
                                'L_FORUM_NAME' => $lang['Forum_name'],
                                'L_CATEGORY' => $lang['Category'],
                                'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
                                'L_FORUM_STATUS' => $lang['Forum_status'],
                                'L_AUTO_PRUNE' => $lang['Forum_pruning'],
                                'L_ENABLED' => $lang['Enabled'],
                                'L_PRUNE_DAYS' => $lang['prune_days'],
                                'L_PRUNE_FREQ' => $lang['prune_freq'],
                                'L_DAYS' => $lang['Days'],

                                'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
                                'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
                                'FORUM_NAME' => $forumname,
                                'DESCRIPTION' => $forumdesc)
                        );
                        $template->pparse("body");
                        break;

                case 'createforum':
                        //
                        // Create a forum in the DB
                        //
                        if( trim($HTTP_POST_VARS['forumname']) == "" )
                        {
                                message_die(GENERAL_ERROR, "Can't create a forum without a name");
                        }

                        $sql = "SELECT MAX(forum_order) AS max_order
                                FROM " . FORUMS_TABLE . "
                                WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
                        }
                        $row = $db->sql_fetchrow($result);

                        $max_order = $row['max_order'];
                        $next_order = $max_order + 10;

                        $sql = "SELECT MAX(forum_id) AS max_id
                                FROM " . FORUMS_TABLE;
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
                        }
                        $row = $db->sql_fetchrow($result);

                        $max_id = $row['max_id'];
                        $next_id = $max_id + 1;

                        //
                        // Default permissions of public ::
                        //
                        $field_sql = "";
                        $value_sql = "";
                        while( list($field, $value) = each($forum_auth_ary) )
                        {
                                $field_sql .= ", $field";
                                $value_sql .= ", $value";

                        }

                        // There is no problem having duplicate forum names so we won't check for it.
                        $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
                                VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
                        }

                        if( $HTTP_POST_VARS['prune_enable'] )
                        {

                                if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "")
                                {
                                        message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
                                }

                                $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
                                        VALUES('" . $next_id . "', " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql);
                                }
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'modforum':
                        // Modify a forum in the DB
                        if( isset($HTTP_POST_VARS['prune_enable']))
                        {
                                if( $HTTP_POST_VARS['prune_enable'] != 1 )
                                {
                                        $HTTP_POST_VARS['prune_enable'] = 0;
                                }
                        }

                        $sql = "UPDATE " . FORUMS_TABLE . "
                                SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
                                WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
                        }

                        if( $HTTP_POST_VARS['prune_enable'] == 1 )
                        {
                                if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
                                {
                                        message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
                                }

                                $sql = "SELECT *
                                        FROM " . PRUNE_TABLE . "
                                        WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql);
                                }

                                if( $db->sql_numrows($result) > 0 )
                                {
                                        $sql = "UPDATE " . PRUNE_TABLE . "
                                                SET        prune_days = " . intval($HTTP_POST_VARS['prune_days']) . ",        prune_freq = " . intval($HTTP_POST_VARS['prune_freq']) . "
                                                 WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
                                }
                                else
                                {
                                        $sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
                                                VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
                                }

                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
                                }
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'addcat':
                        // Create a category in the DB
                        if( trim($HTTP_POST_VARS['categoryname']) == '')
                        {
                                message_die(GENERAL_ERROR, "Can't create a category without a name");
                        }

                        $sql = "SELECT MAX(cat_order) AS max_order
                                FROM " . CATEGORIES_TABLE;
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql);
                        }
                        $row = $db->sql_fetchrow($result);

                        $max_order = $row['max_order'];
                        $next_order = $max_order + 10;

                        //
                        // There is no problem having duplicate forum names so we won't check for it.
                        //
                        $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
                                VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'editcat':
                        //
                        // Show form to edit a category
                        //
                        $newmode = 'modcat';
                        $buttonvalue = $lang['Update'];

                        $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

                        $row = get_info('category', $cat_id);
                        $cat_title = $row['cat_title'];

                        $template->set_filenames(array(
                                "body" => "admin/category_edit_body.tpl")
                        );

                        $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '" />';

                        $template->assign_vars(array(
                                'CAT_TITLE' => $cat_title,

                                'L_EDIT_CATEGORY' => $lang['Edit_Category'],
                                'L_EDIT_CATEGORY_EXPLAIN' => $lang['Edit_Category_explain'],
                                'L_CATEGORY' => $lang['Category'],

                                'S_HIDDEN_FIELDS' => $s_hidden_fields,
                                'S_SUBMIT_VALUE' => $buttonvalue,
                                'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"))
                        );

                        $template->pparse("body");
                        break;

                case 'modcat':
                        // Modify a category in the DB
                        $sql = "UPDATE " . CATEGORIES_TABLE . "
                                SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "'
                                WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'deleteforum':
                        // Show form to delete a forum
                        $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

                        $select_to = '<select name="to_id">';
                        $select_to .= "<option value=\"-1\"$s>" . $lang['Delete_all_posts'] . "</option>\n";
                        $select_to .= get_list('forum', $forum_id, 0);
                        $select_to .= '</select>';

                        $buttonvalue = $lang['Move_and_Delete'];

                        $newmode = 'movedelforum';

                        $foruminfo = get_info('forum', $forum_id);
                        $name = $foruminfo['forum_name'];

                        $template->set_filenames(array(
                                "body" => "admin/forum_delete_body.tpl")
                        );

                        $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $forum_id . '" />';

                        $template->assign_vars(array(
                                'NAME' => $name,

                                'L_FORUM_DELETE' => $lang['Forum_delete'],
                                'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'],
                                'L_MOVE_CONTENTS' => $lang['Move_contents'],
                                'L_FORUM_NAME' => $lang['Forum_name'],

                                "S_HIDDEN_FIELDS" => $s_hidden_fields,
                                'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
                                'S_SELECT_TO' => $select_to,
                                'S_SUBMIT_VALUE' => $buttonvalue)
                        );

                        $template->pparse("body");
                        break;

                case 'movedelforum':
                        //
                        // Move or delete a forum in the DB
                        //
                        $from_id = intval($HTTP_POST_VARS['from_id']);
                        $to_id = intval($HTTP_POST_VARS['to_id']);
                        $delete_old = intval($HTTP_POST_VARS['delete_old']);

                        // Either delete or move all posts in a forum
                        if($to_id == -1)
                        {
                                // Delete polls in this forum
                                $sql = "SELECT v.vote_id
                                        FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t
                                        WHERE t.forum_id = $from_id
                                                AND v.topic_id = t.topic_id";
                                if (!($result = $db->sql_query($sql)))
                                {
                                        message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql);
                                }

                                if ($row = $db->sql_fetchrow($result))
                                {
                                        $vote_ids = '';
                                        do
                                        {
                                                $vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id'];
                                        }
                                        while ($row = $db->sql_fetchrow($result));

                                        $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
                                                WHERE vote_id IN ($vote_ids)";
                                        $db->sql_query($sql);

                                        $sql = "DELETE FROM " . VOTE_RESULTS_TABLE . "
                                                WHERE vote_id IN ($vote_ids)";
                                        $db->sql_query($sql);

                                        $sql = "DELETE FROM " . VOTE_USERS_TABLE . "
                                                WHERE vote_id IN ($vote_ids)";
                                        $db->sql_query($sql);
                                }
                                $db->sql_freeresult($result);

                                include("../../../includes/prune.php");
                                prune($from_id, 0, true); // Delete everything from forum
                        }
                        else
                        {
                                $sql = "SELECT *
                                        FROM " . FORUMS_TABLE . "
                                        WHERE forum_id IN ($from_id, $to_id)";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql);
                                }

                                if($db->sql_numrows($result) != 2)
                                {
                                        message_die(GENERAL_ERROR, "Ambiguous forum ID's", "", __LINE__, __FILE__);
                                }
                                $sql = "UPDATE " . TOPICS_TABLE . "
                                        SET forum_id = $to_id
                                        WHERE forum_id = $from_id";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't move topics to other forum", "", __LINE__, __FILE__, $sql);
                                }
                                $sql = "UPDATE " . POSTS_TABLE . "
                                        SET        forum_id = $to_id
                                        WHERE forum_id = $from_id";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't move posts to other forum", "", __LINE__, __FILE__, $sql);
                                }
                                sync('forum', $to_id);
                        }

                        // Alter Mod level if appropriate - 2.0.4
                        $sql = "SELECT ug.user_id
                                FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
                                WHERE a.forum_id <> $from_id
                                        AND a.auth_mod = 1
                                        AND ug.group_id = a.group_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
                        }

                        if ($row = $db->sql_fetchrow($result))
                        {
                                $user_ids = '';
                                do
                                {
                                        $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
                                }
                                while ($row = $db->sql_fetchrow($result));

                                $sql = "SELECT ug.user_id
                                        FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
                                        WHERE a.forum_id = $from_id
                                                AND a.auth_mod = 1
                                                AND ug.group_id = a.group_id
                                                AND ug.user_id NOT IN ($user_ids)";
                                if( !$result2 = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't obtain moderator list", "", __LINE__, __FILE__, $sql);
                                }

                                if ($row = $db->sql_fetchrow($result2))
                                {
                                        $user_ids = '';
                                        do
                                        {
                                                $user_ids .= (($user_ids != '') ? ', ' : '' ) . $row['user_id'];
                                        }
                                        while ($row = $db->sql_fetchrow($result2));

                                        $sql = "UPDATE " . USERS_TABLE . "
                                                SET user_level = " . USER . "
                                                WHERE user_id IN ($user_ids)
                                                        AND user_level <> " . ADMIN;
                                        $db->sql_query($sql);
                                }
                                $db->sql_freeresult($result);

                        }
                        $db->sql_freeresult($result2);

                        $sql = "DELETE FROM " . FORUMS_TABLE . "
                                WHERE forum_id = $from_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
                        }

                        $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
                                WHERE forum_id = $from_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't delete forum", "", __LINE__, __FILE__, $sql);
                        }

                        $sql = "DELETE FROM " . PRUNE_TABLE . "
                                WHERE forum_id = $from_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't delete forum prune information!", "", __LINE__, __FILE__, $sql);
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'deletecat':
                        //
                        // Show form to delete a category
                        //
                        $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

                        $buttonvalue = $lang['Move_and_Delete'];
                        $newmode = 'movedelcat';
                        $catinfo = get_info('category', $cat_id);
                        $name = $catinfo['cat_title'];

                        if ($catinfo['number'] == 1)
                        {
                                $sql = "SELECT count(*) as total
                                        FROM ". FORUMS_TABLE;
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't get Forum count", "", __LINE__, __FILE__, $sql);
                                }
                                $count = $db->sql_fetchrow($result);
                                $count = $count['total'];

                                if ($count > 0)
                                {
                                        message_die(GENERAL_ERROR, $lang['Must_delete_forums']);
                                }
                                else
                                {
                                        $select_to = $lang['Nowhere_to_move'];
                                }
                        }
                        else
                        {
                                $select_to = '<select name="to_id">';
                                $select_to .= get_list('category', $cat_id, 0);
                                $select_to .= '</select>';
                        }

                        $template->set_filenames(array(
                                "body" => "admin/forum_delete_body.tpl")
                        );

                        $s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="from_id" value="' . $cat_id . '" />';

                        $template->assign_vars(array(
                                'NAME' => $name,

                                'L_FORUM_DELETE' => $lang['Forum_delete'],
                                'L_FORUM_DELETE_EXPLAIN' => $lang['Forum_delete_explain'],
                                'L_MOVE_CONTENTS' => $lang['Move_contents'],
                                'L_FORUM_NAME' => $lang['Forum_name'],

                                'S_HIDDEN_FIELDS' => $s_hidden_fields,
                                'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
                                'S_SELECT_TO' => $select_to,
                                'S_SUBMIT_VALUE' => $buttonvalue)
                        );

                        $template->pparse("body");
                        break;

                case 'movedelcat':
                        //
                        // Move or delete a category in the DB
                        //
                        $from_id = intval($HTTP_POST_VARS['from_id']);
                        $to_id = intval($HTTP_POST_VARS['to_id']);

                        if (!empty($to_id))
                        {
                                $sql = "SELECT *
                                        FROM " . CATEGORIES_TABLE . "
                                        WHERE cat_id IN ($from_id, $to_id)";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql);
                                }
                                if($db->sql_numrows($result) != 2)
                                {
                                        message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__);
                                }

                                $sql = "UPDATE " . FORUMS_TABLE . "
                                        SET cat_id = $to_id
                                        WHERE cat_id = $from_id";
                                if( !$result = $db->sql_query($sql) )
                                {
                                        message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql);
                                }
                        }

                        $sql = "DELETE FROM " . CATEGORIES_TABLE ."
                                WHERE cat_id = $from_id";

                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
                        }

                        $message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

                        message_die(GENERAL_MESSAGE, $message);

                        break;

                case 'forum_order':
                        //
                        // Change order of forums in the DB
                        //
                        $move = intval($HTTP_GET_VARS['move']);
                        $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

                        $forum_info = get_info('forum', $forum_id);

                        $cat_id = $forum_info['cat_id'];

                        $sql = "UPDATE " . FORUMS_TABLE . "
                                SET forum_order = forum_order + $move
                                WHERE forum_id = $forum_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
                        }

                        renumber_order('forum', $forum_info['cat_id']);
                        $show_index = TRUE;

                        break;

                case 'cat_order':
                        //
                        // Change order of categories in the DB
                        //
                        $move = intval($HTTP_GET_VARS['move']);
                        $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

                        $sql = "UPDATE " . CATEGORIES_TABLE . "
                                SET cat_order = cat_order + $move
                                WHERE cat_id = $cat_id";
                        if( !$result = $db->sql_query($sql) )
                        {
                                message_die(GENERAL_ERROR, "Couldn't change category order", "", __LINE__, __FILE__, $sql);
                        }

                        renumber_order('category');
                        $show_index = TRUE;

                        break;

                case 'forum_sync':
                        sync('forum', intval($HTTP_GET_VARS[POST_FORUM_URL]));
                        $show_index = TRUE;

                        break;

                default:
                        message_die(GENERAL_MESSAGE, $lang['No_mode']);
                        break;
        }

        if ($show_index != TRUE)
        {
                include('./page_footer_admin.'.$phpEx);
                exit;
        }
}

//
// Start page proper
//
$template->set_filenames(array(
        "body" => "admin/forum_admin_body.tpl")
);

$template->assign_vars(array(
        'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
        'L_FORUM_TITLE' => $lang['Forum_admin'],
        'L_FORUM_EXPLAIN' => $lang['Forum_admin_explain'],
        'L_CREATE_FORUM' => $lang['Create_forum'],
        'L_CREATE_CATEGORY' => $lang['Create_category'],
        'L_EDIT' => $lang['Edit'],
        'L_DELETE' => $lang['Delete'],
        'L_MOVE_UP' => $lang['Move_up'],
        'L_MOVE_DOWN' => $lang['Move_down'],
        'L_RESYNC' => $lang['Resync'])
);

$sql = "SELECT cat_id, cat_title, cat_order
        FROM " . CATEGORIES_TABLE . "
        ORDER BY cat_order";
if( !$q_categories = $db->sql_query($sql) )
{
        message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
}

if( $total_categories = $db->sql_numrows($q_categories) )
{
        $category_rows = $db->sql_fetchrowset($q_categories);

        $sql = "SELECT *
                FROM " . FORUMS_TABLE . "
                ORDER BY cat_id, forum_order";
        if(!$q_forums = $db->sql_query($sql))
        {
                message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
        }

        if( $total_forums = $db->sql_numrows($q_forums) )
        {
                $forum_rows = $db->sql_fetchrowset($q_forums);
        }

        //
        // Okay, let's build the index
        //
        $gen_cat = array();

        for($i = 0; $i < $total_categories; $i++)
        {
                $cat_id = $category_rows[$i]['cat_id'];

                $template->assign_block_vars("catrow", array(
                        'S_ADD_FORUM_SUBMIT' => "addforum[$cat_id]",
                        'S_ADD_FORUM_NAME' => "forumname[$cat_id]",

                        'CAT_ID' => $cat_id,
                        'CAT_DESC' => $category_rows[$i]['cat_title'],

                        'U_CAT_EDIT' => append_sid("admin_forums.$phpEx?mode=editcat&amp;" . POST_CAT_URL . "=$cat_id"),
                        'U_CAT_DELETE' => append_sid("admin_forums.$phpEx?mode=deletecat&amp;" . POST_CAT_URL . "=$cat_id"),
                        'U_CAT_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=cat_order&amp;move=-15&amp;" . POST_CAT_URL . "=$cat_id"),
                        'U_CAT_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=cat_order&amp;move=15&amp;" . POST_CAT_URL . "=$cat_id"),
                        'U_VIEWCAT' => ("../../../modules.php?name=Forums&file=index&c=$cat_id"))
                );

                for($j = 0; $j < $total_forums; $j++)
                {
                        $forum_id = $forum_rows[$j]['forum_id'];

                        if ($forum_rows[$j]['cat_id'] == $cat_id)
                        {

                                $template->assign_block_vars("catrow.forumrow",        array(
                                        'FORUM_NAME' => $forum_rows[$j]['forum_name'],
                                        'FORUM_DESC' => $forum_rows[$j]['forum_desc'],
                                        'ROW_COLOR' => $row_color,
                                        'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
                                        'NUM_POSTS' => $forum_rows[$j]['forum_posts'],

                                        'U_VIEWFORUM' => ("../../../modules.php?name=Forums&file=viewforum&f=$forum_id"),
                                        'U_FORUM_EDIT' => append_sid("admin_forums.$phpEx?mode=editforum&amp;" . POST_FORUM_URL . "=$forum_id"),
                                        'U_FORUM_DELETE' => append_sid("admin_forums.$phpEx?mode=deleteforum&amp;" . POST_FORUM_URL . "=$forum_id"),
                                        'U_FORUM_MOVE_UP' => append_sid("admin_forums.$phpEx?mode=forum_order&amp;move=-15&amp;" . POST_FORUM_URL . "=$forum_id"),
                                        'U_FORUM_MOVE_DOWN' => append_sid("admin_forums.$phpEx?mode=forum_order&amp;move=15&amp;" . POST_FORUM_URL . "=$forum_id"),
                                        'U_FORUM_RESYNC' => append_sid("admin_forums.$phpEx?mode=forum_sync&amp;" . POST_FORUM_URL . "=$forum_id"))
                                );

                        }// if ... forumid == catid

                } // for ... forums

        } // for ... categories

}// if ... total_categories

$template->pparse("body");

include('./page_footer_admin.'.$phpEx);

?>


thats my admin_forums.php found in modules/admin/

if it helps..
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Installation Help

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©