Oh ja, sorry, war mir entfallen...
Code: Alles auswählen
<?php
/***************************************************************************
* functions_admin.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: functions_admin.php,v 1.5.2.3 2002/07/19 17:03:47 psotfx 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.
*
*
***************************************************************************/
//
// Simple version of jumpbox, just lists authed forums
//
function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
{
global $db, $userdata;
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$sql = "SELECT forum_id, forum_name
FROM " . FORUMS_TABLE . "
ORDER BY cat_id, forum_order";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$forum_list = '';
while( $row = $db->sql_fetchrow($result) )
{
if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
{
$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';
}
}
$forum_list = ( $forum_list == '' ) ? '<option value="-1">-- ! No Forums ! --</option>' : '<select name="' . $box_name . '">' . $forum_list . '</select>';
return $forum_list;
}
//
// Synchronise functions for forums/topics
//
function sync($type, $id = false)
{
global $db;
switch($type)
{
case 'all forums':
$sql = "SELECT forum_id
FROM " . FORUMS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get forum IDs', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
sync('forum', $row['forum_id']);
}
break;
case 'all topics':
$sql = "SELECT topic_id
FROM " . TOPICS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
}
while( $row = $db->sql_fetchrow($result) )
{
sync('topic', $row['topic_id']);
}
break;
case 'forum':
$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total
FROM " . POSTS_TABLE . "
WHERE forum_id = $id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$last_post = ( $row['last_post'] ) ? $row['last_post'] : 0;
$total_posts = ($row['total']) ? $row['total'] : 0;
}
else
{
$last_post = 0;
$total_posts = 0;
}
$sql = "SELECT COUNT(topic_id) AS total
FROM " . TOPICS_TABLE . "
WHERE forum_id = $id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get topic count', '', __LINE__, __FILE__, $sql);
}
$total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics
WHERE forum_id = $id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update forum', '', __LINE__, __FILE__, $sql);
}
break;
case 'topic':
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
FROM " . POSTS_TABLE . "
WHERE topic_id = $id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$sql = ( $row['total_posts'] ) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
}
}
break;
}
return true;
}
?>
Code: Alles auswählen
###############################################
## Hack Title: Move
## Hack Version: 3..0.0
## Author: Antony Bailey
## Description: Moves topics after a certain number of days without a new post.
## Compatibility: 2.0.4
##
## Installation Level: Easy
## Installation Time: 2 minutes
## Files To Edit: 1
## lang_admin.php
##
## Included Files: 5
## admin_forum_move.php
## move.php
## forum_move_body.tpl
## forum_move_select_body.tpl
## forum_move_result.tpl
##
## History:
## None
## 1.0.0: The pages were blank. :(
## 2.0.0: Got it loading, but a bit buggy.
## 3.0.0: Stable I guess
##
## Author Notes:
## None
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ©2003 Move 3.0.0 - Antony Bailey
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Move'] = 'Moving them topics';
$lang['Forum_Move'] = 'Move Topics';
$lang['Forum_Move_To'] = 'Move To';
$lang['Forum_Move_explain'] = 'This will move normal topics, that have not been posted to withing the selected number of days, not active polls or announcements.';
$lang['Do_Move'] = 'Move them';
$lang['Move_topics_not_posted'] = 'How many days without posts?';
$lang['Move_destination'] = 'Move topics were?';
$lang['Topics_moved'] = 'Topics moved';
$lang['Posts_moved'] = 'Posts moved';
$lang['Move_success'] = 'Moving of topics has been a success';
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Alles auswählen
###############################################
## Hack Title: Auto-Move add-on
## Hack Version: n/a
## Author: Freakin' Booty ;-P
## Description: This is an add-on to Antony's "Move". It offers to possibility to Auto-Move topics to another forum.
## Compatibility: 2.0.4 - 2.0.5
##
## Installation Level: Easy
## Installation Time: 15-20 minutes
## Files To Edit: 6
## admin/admin_forums.php
## includes/constants.php
## includes/move.php
## language/lang_english/lang_main.php
## viewforum.php
## templates/subSilver/admin/forum_edit_body.tpl
##
## Included Files: 1
## move_update.php
##
## History:
## None
##
## Author Notes:
## You will have to have "Pruning" enabled to make auto-move work! It's pretty pointless to add yet another option
## just for this add-on. So, just enable "pruning" in ACP => Configuration and that's it.
##
## Support: http://www.phpbbhacks.com/forums
## Copyright: ©2003 Auto-Move add-on - Freakin' Booty ;-P
##
###############################################
## You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
## Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
## This hack is released under the GPL License.
## This hack can be freely used, but not distributed, without permission.
## Intellectual Property is retained by the hack author(s) listed above.
###############################################
#
#-----[ COPY ]--------------------------------------------
#
move_update.php
#
#-----[ TO ]----------------------------------------------
#
# Make sure to run this file once as an administrator and then delete it immediately
#
move_update.php
#
#-----[ OPEN ]--------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]--------------------------------------------
#
//
// 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 = '';
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
//
// start forum move stuff.
//
if( $row['move_enable'] )
{
$move_enabled = "checked=\"checked\"";
$sql = "SELECT *
FROM " . MOVE_TABLE . "
WHERE forum_id = $forum_id";
if(!$mv_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Auto-Move: Couldn't read auto_move table.", __LINE__, __FILE__);
}
$mv_row = $db->sql_fetchrow($mv_result);
}
else
{
$move_enabled = '';
}
#
#-----[ FIND ]--------------------------------------------
#
$forum_id = '';
$prune_enabled = '';
#
#-----[ AFTER, ADD ]--------------------------------------
#
$move_enabled = '';
#
#-----[ FIND ]--------------------------------------------
#
$catlist = get_list('category', $cat_id, TRUE);
#
#-----[ AFTER, ADD ]--------------------------------------
#
$forumlist = make_forum_select('forum_dest', $forum_id);
#
#-----[ FIND ]--------------------------------------------
#
'S_PRUNE_ENABLED' => $prune_enabled,
#
#-----[ AFTER, ADD ]--------------------------------------
#
'S_MOVE_ENABLED' => $move_enabled,
'S_FORUM_LIST' => $forumlist,
#
#-----[ FIND ]--------------------------------------------
#
'L_DAYS' => $lang['Days'],
#
#-----[ AFTER, ADD ]--------------------------------------
#
'L_AUTO_MOVE' => $lang['Forum_moving'],
'L_MOVE_DAYS' => $lang['move_days'],
'L_MOVE_FREQ' => $lang['move_freq'],
'L_MOVE_DEST' => $lang['move_dest'],
#
#-----[ FIND ]--------------------------------------------
#
'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
#
#-----[ AFTER, ADD ]--------------------------------------
#
'MOVE_DAYS' => ( isset($mv_row['move_days']) ) ? $mv_row['move_days'] : 7,
'MOVE_FREQ' => ( isset($mv_row['move_freq']) ) ? $mv_row['move_freq'] : 1,
#
#-----[ FIND ]--------------------------------------------
#
$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 . ")";
#
#-----[ INLINE, FIND ]------------------------------------
#
, prune_enable
#
#-----[ AFTER, ADD ]--------------------------------------
#
, move_enable
#
#-----[ INLINE, FIND ]------------------------------------
#
, " . intval($HTTP_POST_VARS['prune_enable'])
#
#-----[ AFTER, ADD ]--------------------------------------
#
. ", " . intval($HTTP_POST_VARS['move_enable'])
#
#-----[ FIND ]--------------------------------------------
#
message_die(GENERAL_ERROR, "Couldn't insert row in prune table", "", __LINE__, __FILE__, $sql);
}
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
if( $HTTP_POST_VARS['move_enable'] )
{
if( $HTTP_POST_VARS['move_days'] == "" || $HTTP_POST_VARS['move_freq'] == "" || $HTTP_POST_VARS['forum_dest'] == "")
{
message_die(GENERAL_MESSAGE, $lang['Set_move_data']);
}
$sql = "INSERT INTO " . MOVE_TABLE . " (forum_id, forum_dest, move_days, move_freq)
VALUES('" . $next_id . "', " . intval($HTTP_POST_VARS['forum_dest']) . ", " . intval($HTTP_POST_VARS['move_days']) . ", " . intval($HTTP_POST_VARS['move_freq']) . ")";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert row in move table", "", __LINE__, __FILE__, $sql);
}
}
#
#-----[ FIND ]--------------------------------------------
#
$HTTP_POST_VARS['prune_enable'] = 0;
}
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
if( isset($HTTP_POST_VARS['move_enable']))
{
if( $HTTP_POST_VARS['move_enable'] != 1 )
{
$HTTP_POST_VARS['move_enable'] = 0;
}
}
#
#-----[ FIND ]--------------------------------------------
#
$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']) . "
#
#-----[ INLINE, FIND ]------------------------------------
#
, prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
#
#-----[ AFTER, ADD ]--------------------------------------
#
, move_enable = " . intval($HTTP_POST_VARS['move_enable']) . "
#
#-----[ FIND ]--------------------------------------------
#
message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
}
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
if( $HTTP_POST_VARS['move_enable'] == 1 )
{
if( $HTTP_POST_VARS['move_days'] == "" || $HTTP_POST_VARS['move_freq'] == "" || $HTTP_POST_VARS['forum_dest'] == "" )
{
message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
}
$sql = "SELECT *
FROM " . MOVE_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 Move Information","",__LINE__, __FILE__, $sql);
}
if( $db->sql_numrows($result) > 0 )
{
$sql = "UPDATE " . MOVE_TABLE . "
SET forum_dest = " . intval($HTTP_POST_VARS['forum_dest']) . ", move_days = " . intval($HTTP_POST_VARS['move_days']) . ", move_freq = " . intval($HTTP_POST_VARS['move_freq']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
}
else
{
$sql = "INSERT INTO " . MOVE_TABLE . " (forum_id, forum_dest, move_days, move_freq)
VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['forum_dest']) . ", " . intval($HTTP_POST_VARS['move_days']) . ", " . intval($HTTP_POST_VARS['move_freq']) . ")";
}
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't Update Forum Move Information","",__LINE__, __FILE__, $sql);
}
}
#
#-----[ FIND ]--------------------------------------------
#
$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);
}
#
#-----[ AFTER, ADD ]--------------------------------------
#
$sql = "DELETE FROM " . MOVE_TABLE . "
WHERE forum_id = $from_id";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete forum move information!", "", __LINE__, __FILE__, $sql);
}
#
#-----[ OPEN ]--------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]--------------------------------------------
#
define('GROUPS_TABLE', $table_prefix.'groups');
#
#-----[ AFTER, ADD ]--------------------------------------
#
define('MOVE_TABLE', $table_prefix.'forum_move');
#
#-----[ OPEN ]--------------------------------------------
#
includes/move.php
#
#-----[ FIND ]--------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------
#
function auto_move($forum_id = 0)
{
global $db, $lang;
$sql = "SELECT *
FROM " . MOVE_TABLE . "
WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not read auto_move table', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
if ( $row['move_freq'] && $row['move_days'] && $row['forum_dest'] )
{
$move_date = time() - ( $row['move_days'] * 86400 );
$next_move = time() + ( $row['move_freq'] * 86400 );
$forum_dest = $row['forum_dest'];
move($forum_id, $move_date, $forum_dest);
sync('forum', $forum_id);
sync('forum', $forum_dest);
$sql = "UPDATE " . FORUMS_TABLE . "
SET move_next = $next_move
WHERE forum_id = $forum_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update forum table', '', __LINE__, __FILE__, $sql);
}
}
}
return;
}
#
#-----[ OPEN ]--------------------------------------------
#
viewforum.php
#
#-----[ FIND ]--------------------------------------------
#
//
// Do the forum Prune
//
if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
{
if ( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] )
{
include($phpbb_root_path . 'includes/prune.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
auto_prune($forum_id);
}
}
//
// End of forum prune
//
#
#-----[ AFTER, ADD ]--------------------------------------
#
//
// Do the forum Move
//
if ( $is_auth['auth_mod'] && $board_config['prune_enable'] )
{
if ( $forum_row['move_next'] < time() && $forum_row['move_enable'] )
{
include($phpbb_root_path . 'includes/move.'.$phpEx);
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
auto_move($forum_id);
}
}
//
// End of forum move
//
#
#-----[ OPEN ]--------------------------------------------
#
# Be sure to edit this file for every language installed
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]--------------------------------------------
#
$lang['Move_success'] = 'Moving of topics has been a success';
#
#-----[ AFTER, ADD ]--------------------------------------
#
$lang['Forum_moving'] = 'Auto-moving';
$lang['move_days'] = 'Move topics that have not been posted to in ';
$lang['move_freq'] = 'Check for topic age every';
$lang['move_dest'] = 'Move topics to';
#
#-----[ OPEN ]--------------------------------------------
#
# Be sure to edit this file for every template installed
#
templates/subSilver/admin/forum_edit_body.tpl
#
#-----[ FIND ]--------------------------------------------
#
<td align="left" valign="middle"> <input class="post" type="text" name="prune_freq" value="{PRUNE_FREQ}" size="5" class="post" /> {L_DAYS}</td>
</tr>
</table>
#
#-----[ AFTER, ADD ]--------------------------------------
#
<tr>
<td class="row1">{L_AUTO_MOVE}</td>
<td class="row2"><table cellspacing="0" cellpadding="1" border="0">
<tr>
<td align="right" valign="middle">{L_ENABLED}</td>
<td align="left" valign="middle"><input type="checkbox" name="move_enable" value="1" {S_MOVE_ENABLED} /></td>
</tr>
<tr>
<td align="right" valign="middle">{L_MOVE_DAYS}</td>
<td align="left" valign="middle"> <input class="post" type="text" name="move_days" value="{MOVE_DAYS}" size="5" class="post" /> {L_DAYS}</td>
</tr>
<tr>
<td align="right" valign="middle">{L_MOVE_FREQ}</td>
<td align="left" valign="middle"> <input class="post" type="text" name="move_freq" value="{MOVE_FREQ}" size="5" class="post" /> {L_DAYS}</td>
</tr>
<tr>
<td align="right" valign="middle">{L_MOVE_DEST}</td>
<td align="left" valign="middle"> {S_FORUM_LIST}</td>
</tr>
</table></td>
</tr>
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
So, das wären also die entsprechenden Hacks, an und für sich habe ich alles richtig gemacht beim EInbau, auch das update der Datenbank war laut Ausgabe erfolgreich. Wo hab ich also den Bockmist gemacht?