mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 00:07:44 +02:00
Re-added GPL disclaimers
git-svn-id: file:///svn/phpbb/trunk@943 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -6,11 +6,20 @@
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
* email : support@phpbb.com
|
||||
*
|
||||
* $Id$
|
||||
* $Id$
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
if($setmodules==1)
|
||||
{
|
||||
$file = basename(__FILE__);
|
||||
@@ -21,11 +30,11 @@ if($setmodules==1)
|
||||
function check_forum_name($forumname)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$sql = "SELECT * from " . FORUMS_TABLE . "WHERE forum_name = '$forumname'";
|
||||
$result = $db->sql_query($sql);
|
||||
if( !$result )
|
||||
{
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't get list of Categories", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
if ($db->sql_numrows($result) > 0)
|
||||
@@ -57,7 +66,7 @@ function get_info($mode, $id)
|
||||
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 )
|
||||
@@ -86,14 +95,14 @@ function get_list($mode, $id, $select)
|
||||
default:
|
||||
message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM $table";
|
||||
if( $select == FALSE)
|
||||
{
|
||||
$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 = "";
|
||||
@@ -112,7 +121,7 @@ function get_list($mode, $id, $select)
|
||||
function renumber_order($mode, $cat=FALSE)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 'category':
|
||||
@@ -130,7 +139,7 @@ function renumber_order($mode, $cat=FALSE)
|
||||
default:
|
||||
message_die(GENERAL_ERROR, "Wrong mode for generating select list", "", __LINE__, __FILE__);
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM $table";
|
||||
if( $cat != FALSE)
|
||||
{
|
||||
@@ -138,24 +147,24 @@ function renumber_order($mode, $cat=FALSE)
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -185,12 +194,12 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$show_index = TRUE;
|
||||
break;
|
||||
case 'createforum': // Create a forum in the DB
|
||||
$sql = "SELECT
|
||||
$sql = "SELECT
|
||||
max(forum_order) as max_order
|
||||
FROM ".FORUMS_TABLE."
|
||||
FROM ".FORUMS_TABLE."
|
||||
WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'";
|
||||
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);
|
||||
@@ -198,7 +207,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$next_order = $max_order + 1;
|
||||
|
||||
// There is no problem having duplicate forum names so we won't check for it.
|
||||
$sql = "INSERT
|
||||
$sql = "INSERT
|
||||
INTO ".FORUMS_TABLE."(
|
||||
forum_name,
|
||||
cat_id,
|
||||
@@ -212,31 +221,31 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
'".$next_order."',
|
||||
'".$HTTP_POST_VARS['forumstatus']."')";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$show_index = TRUE;
|
||||
break;
|
||||
case 'modforum': // Modify a forum in the DB
|
||||
$sql = "UPDATE ".FORUMS_TABLE." SET
|
||||
$sql = "UPDATE ".FORUMS_TABLE." SET
|
||||
forum_name = '".$HTTP_POST_VARS['forumname']."',
|
||||
cat_id = '".$HTTP_POST_VARS['cat_id']."',
|
||||
forum_desc = '".$HTTP_POST_VARS['forumdesc']."',
|
||||
forum_status = '".$HTTP_POST_VARS['forumstatus']."'
|
||||
WHERE forum_id = '".$HTTP_POST_VARS['forum_id']."'";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$show_index = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
case 'addcat':
|
||||
$sql = "SELECT
|
||||
$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);
|
||||
@@ -250,7 +259,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
'".$HTTP_POST_VARS['catname']."',
|
||||
'".$next_order."')";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
$show_index = TRUE;
|
||||
@@ -262,7 +271,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
// $newmode determines if we are going to INSERT or UPDATE after posting?
|
||||
$newmode = 'modforum';
|
||||
$buttonvalue = 'Change';
|
||||
|
||||
|
||||
$forum_id = $HTTP_GET_VARS['forum_id'];
|
||||
|
||||
$row = get_info('forum', $forum_id);
|
||||
@@ -282,13 +291,13 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$forumstatus = FORUM_UNLOCKED;
|
||||
$forum_id = '';
|
||||
}
|
||||
|
||||
|
||||
$catlist = get_list('category', $cat_id, TRUE);
|
||||
|
||||
|
||||
$forumstatus == FORUM_LOCKED ? $forumlocked = "selected" : $forumunlocked = "selected";
|
||||
$statuslist = "<OPTION VALUE=\"".FORUM_UNLOCKED."\" $forumunlocked>Unlocked</OPTION>\n";
|
||||
$statuslist .= "<OPTION VALUE=\"".FORUM_LOCKED."\" $forumlocked>Locked</OPTION>\n";
|
||||
|
||||
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/forum_edit_body.tpl")
|
||||
);
|
||||
@@ -302,17 +311,17 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
'BUTTONVALUE' => $buttonvalue)
|
||||
);
|
||||
$template->pparse("body");
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case 'editcat':
|
||||
$newmode = 'modcat';
|
||||
$buttonvalue = 'Change';
|
||||
|
||||
|
||||
$cat_id = $HTTP_GET_VARS['cat_id'];
|
||||
$row = get_info('category', $catid);
|
||||
$cat_title = $row['cat_title'];
|
||||
|
||||
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/category_edit_body.tpl")
|
||||
);
|
||||
@@ -323,14 +332,14 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
'BUTTONVALUE' => $buttonvalue)
|
||||
);
|
||||
$template->pparse("body");
|
||||
|
||||
|
||||
break;
|
||||
case 'modcat':
|
||||
$sql = "UPDATE ".CATEGORIES_TABLE." SET
|
||||
$sql = "UPDATE ".CATEGORIES_TABLE." SET
|
||||
cat_title = '".$HTTP_POST_VARS['cat_title']."'
|
||||
WHERE cat_id = '".$HTTP_POST_VARS['cat_id']."'";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
|
||||
}
|
||||
print "Modforum: ". $HTTP_POST_VARS['forumname']." sql= <pre>$sql</pre>";
|
||||
@@ -340,19 +349,19 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$from_id = $HTTP_POST_VARS['from_id'];
|
||||
$to_id = $HTTP_POST_VARS['to_id'];
|
||||
$delete_old = $HTTP_POST_VARS['delete_old'];
|
||||
|
||||
|
||||
print "move '$from_id' to '$to_id'";
|
||||
|
||||
|
||||
$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__);
|
||||
}
|
||||
|
||||
|
||||
// Either delete or move all posts in a forum
|
||||
if($delete_old == 1)
|
||||
{
|
||||
@@ -361,62 +370,62 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "UPDATE ".TOPICS_TABLE." SET
|
||||
$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
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
$show_index = TRUE;
|
||||
break;
|
||||
case 'movedelcat':
|
||||
$from_id = $HTTP_POST_VARS['from_id'];
|
||||
$to_id = $HTTP_POST_VARS['to_id'];
|
||||
print "move '$from_id' to '$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
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
$show_index = TRUE;
|
||||
break;
|
||||
case 'deletecat':
|
||||
@@ -427,7 +436,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$newmode = 'movedelcat';
|
||||
$catinfo = get_info('category', $cat_id);
|
||||
$name = $catinfo['cat_title'];
|
||||
|
||||
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/forum_delete_body.tpl")
|
||||
);
|
||||
@@ -449,7 +458,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$newmode = 'movedelforum';
|
||||
$foruminfo = get_info('forum', $forum_id);
|
||||
$name = $foruminfo['forum_name'];
|
||||
|
||||
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/forum_delete_body.tpl")
|
||||
);
|
||||
@@ -468,7 +477,7 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$cat_id = $HTTP_GET_VARS['cat_id'];
|
||||
$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');
|
||||
@@ -479,10 +488,10 @@ if(isset($mode)) // Are we supposed to do something?
|
||||
$forum_id = $HTTP_GET_VARS['forum_id'];
|
||||
$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']);
|
||||
|
Reference in New Issue
Block a user