Thank-O-Matic (Final Released)

Started by ディン1031, March 03, 2007, 08:02:00 AM

Previous topic - Next topic

ディン1031

This is the official Beta Release of the the Thank-O-Matic and this should be the last beta test before the final release.

With this i will find the errors that i overseen or some importend thing that i not calculated that a user can do...

Thank-O-Matic (Bedank-O-Mat) is a smf version of the vBullitin Thank You Mod, it not like the one in phpBB where you can say thank you to a thread with this you can say thank you to each post (or specified post in a thread).

Here is the list of the Features:
  • Can be enabled in specified Boards
  • Permission with a lot of option
  • Maintain options for recalculations
  • Unhidden content with Hide Tag Special, with some options for it.
  • Edit, Delete and Lock Function for the Thank You
  • Thank You also work on locked Threads, but you can lock it, too. So no one can post thanks.
  • Stats in Profile, also changeable by the admin
  • Settings for the Previewlist and Thank You list of the users
  • ... and a lot more ;)

    If you like to test it the mod is attached to this post, where you can download them. Doesn't work, i add ddls <<

    If you finde some major bugs or some way to thing who not allowed please write it here (if it a hack thing please write a pm), so that i can fix it until the final release. I've also attached a pictures how the mod looks like.

    I will also thank all the people who tested the beta1 and beta2 out there.

    ---- Download the Final Version -----

    Here are the Pictures:


    Sinlge Thank You Post Full Preview List


    Board Enable for the mod (Please before you say it doesn't work... enable the option <<).


    Features ans Settings for the Mod


    Premissionssettings for the Mod


    Thread view withThank You Preview Member


    Thread view without Thank You Preview Member

    Bye
    DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Atthar

congratulation for beta3 release.
"thank you" for post is great feature and i think this mod will be most popular mod for smf!
after installing beta2 my smf crashed and i was not able to recover smf using mod backups. but im not sure that thankomatic mod is crashing reason, because after installing the mod every thing was normal. but after restaring my web server smf crashed!
i installed beta3 release and now every thing is ok!
i will write my feedback about Thank O Matic later.
thank you DIN1031
Persian Music Recording Forum at http://atthar.com/forum/ [nofollow]

ubermensch


ディン1031

Quote from: ubermensch on March 04, 2007, 11:36:13 AM
I'm not getting the images or the download :(
hmm my server was yesterday down... sorry it work now.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

jacobselby

I like what I see but it will not work with my forum, it has an error with ./Sources/ManageBoards.php before I install. Maybe it's something you should look into but keep in mind I have over 30 mods that could be confusing it.  ;D

ディン1031

Quote from: jacobselby on March 05, 2007, 01:19:15 PM
I like what I see but it will not work with my forum, it has an error with ./Sources/ManageBoards.php before I install. Maybe it's something you should look into but keep in mind I have over 30 mods that could be confusing it.  ;D
I make it as compatible as possible XD, can i look into your manageBoards.php? becuase without this change you can not enable it XD, i can try to find a better way to made it more compatible.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

jacobselby

Okay, thank you...

<?php
/**********************************************************************************
* ManageBoards.php                                                                *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1.2                                           *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

/* Manage and maintain the boards and categories of the forum.

void ManageBoards()
- main entry point for all the manageboards admin screens.
- called by ?action=manageboards.
- checks the permissions, based on the sub-action.
- loads the ManageBoards language file.
- calls a function based on the sub-action.

void ManageBoardsMain()
- main screen showing all boards and categories.
- called by ?action=manageboards or ?action=manageboards;sa=move.
- uses the main template of the ManageBoards template.
- requires manage_boards permission.
- also handles the interface for moving boards.

void EditCategory()
- screen for editing and repositioning a category.
- called by ?action=manageboards;sa=cat
- uses the modify_category sub-template of the ManageBoards template.
- requires manage_boards permission.
- also used to show the confirm deletion of category screen 
  (sub-template confirm_category_delete).

void EditCategory2()
- function for handling a submitted form saving the category.
- called by ?action=manageboards;sa=cat2
- requires manage_boards permission.
- also handles deletion of a category.
- redirects to ?action=manageboards.

void EditBoard()
- screen for editing and repositioning a board.
- called by ?action=manageboards;sa=board
- uses the modify_board sub-template of the ManageBoards template.
- requires manage_boards permission.
- also used to show the confirm deletion of category screen 
  (sub-template confirm_board_delete).

void EditBoard2()
- function for handling a submitted form saving the board.
- called by ?action=manageboards;sa=board2
- requires manage_boards permission.
- also handles deletion of a board.
- redirects to ?action=manageboards.

void EditBoardSettings()
- a screen to set a few general board and category settings.
- uses the modify_general_settings sub template.
*/

// The controller; doesn't do anything, just delegates.
function ManageBoards()
{
global $context$txt$scripturl;

// Everything's gonna need this.
loadLanguage('ManageBoards');

// Format: 'sub-action' => array('function', 'permission')
$subActions = array(
'board' => array('EditBoard''manage_boards'),
'board2' => array('EditBoard2''manage_boards'),
'cat' => array('EditCategory''manage_boards'),
'cat2' => array('EditCategory2''manage_boards'),
'main' => array('ManageBoardsMain''manage_boards'),
'move' => array('ManageBoardsMain''manage_boards'),
'newcat' => array('EditCategory''manage_boards'),
'newboard' => array('EditBoard''manage_boards'),
'settings' => array('EditBoardSettings''admin_forum'),
);

// Default to sub action 'main' or 'settings' depending on permissions.
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('manage_boards') ? 'main' 'settings');

// Have you got the proper permissions?
isAllowedTo($subActions[$_REQUEST['sa']][1]);

// Administrative side bar, here we come!
adminIndex('manage_boards');

// Create the tabs for the template.
$context['admin_tabs'] = array(
'title' => $txt[41],
'help' => 'manage_boards',
'description' => $txt[677],
'tabs' => array(),
);
if (allowedTo('manage_boards'))
{
$context['admin_tabs']['tabs']['modify_boards'] = array(
'title' => $txt['boardsEdit'],
'description' => $txt[677],
'href' => $scripturl '?action=manageboards',
'is_selected' => $_REQUEST['sa'] != 'newcat' && $_REQUEST['sa'] != 'settings',
);
$context['admin_tabs']['tabs']['add_cat'] = array(
'title' => $txt['mboards_new_cat'],
'description' => $txt[677],
'href' => $scripturl '?action=manageboards;sa=newcat',
'is_selected' => $_REQUEST['sa'] == 'newcat',
'is_last' => !allowedTo('admin_forum'),
);
}
if (allowedTo('admin_forum'))
$context['admin_tabs']['tabs']['settings'] = array(
'title' => $txt['settings'],
'description' => $txt['mboards_settings_desc'],
'href' => $scripturl '?action=manageboards;sa=settings',
'is_selected' => $_REQUEST['sa'] == 'settings',
'is_last' => true,
);

$subActions[$_REQUEST['sa']][0]();
}

// The main control panel thing.
function ManageBoardsMain()
{
global $txt$context$cat_tree$boards$boardList$scripturl$sourcedir$txt;

loadTemplate('ManageBoards');

require_once($sourcedir '/Subs-Boards.php');

if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'move' && in_array($_REQUEST['move_to'], array('child''before''after''top')))
{
checkSession('get');
if ($_REQUEST['move_to'] === 'top')
$boardOptions = array(
'move_to' => $_REQUEST['move_to'],
'target_category' => (int) $_REQUEST['target_cat'],
'move_first_child' => true,
);
else
$boardOptions = array(
'move_to' => $_REQUEST['move_to'],
'target_board' => (int) $_REQUEST['target_board'],
'move_first_child' => true,
);
modifyBoard((int) $_REQUEST['src_board'], $boardOptions);
}

getBoardTree();

$context['move_board'] = !empty($_REQUEST['move']) && isset($boards[(int) $_REQUEST['move']]) ? (int) $_REQUEST['move'] : 0;

$context['categories'] = array();
foreach ($cat_tree as $catid => $tree)
{
$context['categories'][$catid] = array(
'name' => &$tree['node']['name'],
'id' => &$tree['node']['id'],
'boards' => array()
);
$move_cat = !empty($context['move_board']) && $boards[$context['move_board']]['category'] == $catid;
foreach ($boardList[$catid] as $boardid)
{
$context['categories'][$catid]['boards'][$boardid] = array(
'id' => &$boards[$boardid]['id'],
'name' => &$boards[$boardid]['name'],
'description' => &$boards[$boardid]['description'],
'topblock' => &$boards[$boardid]['topblock'],
'child_level' => &$boards[$boardid]['level'],
'local_permissions' => &$boards[$boardid]['use_local_permissions'],
'move' => $move_cat && ($boardid == $context['move_board'] || isChildOf($boardid$context['move_board']))
);
}
}

if (!empty($context['move_board']))
{
$context['move_title'] = sprintf($txt['mboards_select_destination'], htmlspecialchars($boards[$context['move_board']]['name']));
foreach ($cat_tree as $catid => $tree)
{
$prev_child_level 0;
$prev_board 0;
$stack = array();
foreach ($boardList[$catid] as $boardid)
{
if (!isset($context['categories'][$catid]['move_link']))
$context['categories'][$catid]['move_link'] = array(
'child_level' => 0,
'label' => $txt['mboards_order_before'] . ' \'' htmlspecialchars($boards[$boardid]['name']) . '\'',
'href' => $scripturl '?action=manageboards;sa=move;src_board=' $context['move_board'] . ';target_board='$boardid ';move_to=before;sesc=' $context['session_id'],
);

if (!$context['categories'][$catid]['boards'][$boardid]['move'])
$context['categories'][$catid]['boards'][$boardid]['move_links'] = array(
array(
'child_level' => $boards[$boardid]['level'],
'label' => $txt['mboards_order_after'] . '\'' htmlspecialchars($boards[$boardid]['name']) . '\'',
'href' => $scripturl '?action=manageboards;sa=move;src_board=' $context['move_board'] . ';target_board='$boardid ';move_to=after;sesc=' $context['session_id'],
),
array(
'child_level' => $boards[$boardid]['level'] + 1,
'label' => $txt['mboards_order_child_of'] . ' \'' htmlspecialchars($boards[$boardid]['name']) . '\'',
'href' => $scripturl '?action=manageboards;sa=move;src_board=' $context['move_board'] . ';target_board='$boardid ';move_to=child;sesc=' $context['session_id'],
),
);

$difference $boards[$boardid]['level'] - $prev_child_level;
if ($difference == && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']))
array_push($stackarray_shift($context['categories'][$catid]['boards'][$prev_board]['move_links']));
elseif ($difference 0)
{
if (empty($context['categories'][$catid]['boards'][$prev_board]['move_links']))
$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array();
for ($i 0$i < -$difference$i++)
array_unshift($context['categories'][$catid]['boards'][$prev_board]['move_links'], array_pop($stack));
}

$prev_board $boardid;
$prev_child_level $boards[$boardid]['level'];

}
if (!empty($stack) && !empty($context['categories'][$catid]['boards'][$prev_board]['move_links']))
$context['categories'][$catid]['boards'][$prev_board]['move_links'] = array_merge($stack$context['categories'][$catid]['boards'][$prev_board]['move_links']);
elseif (!empty($stack))
$context['categories'][$catid]['boards'][$prev_board]['move_links'] = $stack;

if (empty($boardList[$catid]))
$context['categories'][$catid]['move_link'] = array(
'child_level' => 0,
'label' => $txt['mboards_order_before'] . ' \'' htmlspecialchars($tree['node']['name']) . '\'',
'href' => $scripturl '?action=manageboards;sa=move;src_board=' $context['move_board'] . ';target_cat=' $catid ';move_to=top;sesc=' $context['session_id'],
);
}
}

$context['page_title'] = $txt[41];
$context['can_manage_permissions'] = allowedTo('manage_permissions');
}

// Modify a specific category.
function EditCategory()
{
global $txt$db_prefix$context$cat_tree$boardList$boards$sourcedir;

loadTemplate('ManageBoards');
require_once($sourcedir '/Subs-Boards.php');
getBoardTree();

// ID_CAT must be a number.... if it exists.
$_REQUEST['cat'] = isset($_REQUEST['cat']) ? (int) $_REQUEST['cat'] : 0;

// Start with one - "In first place".
$context['category_order'] = array(
array(
'id' => 0,
'name' => $txt['mboards_order_first'],
'selected' => !empty($_REQUEST['cat']) ? $cat_tree[$_REQUEST['cat']]['is_first'] : false,
'true_name' => ''
)
);

// If this is a new category set up some defaults.
if ($_REQUEST['sa'] == 'newcat')
{
$context['category'] = array(
'id' => 0,
'name' => $txt['mboards_new_cat_name'],
'editable_name' => htmlspecialchars($txt['mboards_new_cat_name']),
'can_collapse' => true,
'is_new' => true,
'is_empty' => true
);
}
// Category doesn't exist, man... sorry.
elseif (!isset($cat_tree[$_REQUEST['cat']]))
redirectexit('action=manageboards');
else
{
$context['category'] = array(
'id' => $_REQUEST['cat'],
'name' => $cat_tree[$_REQUEST['cat']]['node']['name'],
'editable_name' => htmlspecialchars($cat_tree[$_REQUEST['cat']]['node']['name']),
'can_collapse' => !empty($cat_tree[$_REQUEST['cat']]['node']['canCollapse']),
'children' => array(),
'is_empty' => empty($cat_tree[$_REQUEST['cat']]['children'])
);

foreach ($boardList[$_REQUEST['cat']] as $child_board)
$context['category']['children'][] = str_repeat('-'$boards[$child_board]['level']) . ' ' $boards[$child_board]['name'];
}


$prevCat 0;
foreach ($cat_tree as $catid => $tree)
{
if ($catid == $_REQUEST['cat'] && $prevCat 0)
$context['category_order'][$prevCat]['selected'] = true;
else
$context['category_order'][$catid] = array(
'id' => $catid,
'name' => $txt['mboards_order_after'] . $tree['node']['name'],
'selected' => false,
'true_name' => $tree['node']['name']
);
$prevCat $catid;
}
if (!isset($_REQUEST['delete']))
{
$context['sub_template'] = 'modify_category';
$context['page_title'] = $_REQUEST['sa'] == 'newcat' $txt['mboards_new_cat_name'] : $txt['catEdit'];
}
else
{
$context['sub_template'] = 'confirm_category_delete';
$context['page_title'] = $txt['mboards_delete_cat'];
}
}

// Complete the modifications to a specific category.
function EditCategory2()
{
global $db_prefix$sourcedir;

checkSession();

require_once($sourcedir '/Subs-Boards.php');

$_POST['cat'] = (int) $_POST['cat'];

// Add a new category or modify an existing one..
if (isset($_POST['edit']) || isset($_POST['add']))
{
$catOptions = array();

if (isset($_POST['cat_order']))
$catOptions['move_after'] = (int) $_POST['cat_order'];

// Change "This & That" to "This &amp; That" but don't change "&cent" to "&amp;cent;"...
$catOptions['cat_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~''&amp;$1'$_POST['cat_name']);

$catOptions['is_collapsible'] = isset($_POST['collapse']);


if (isset($_POST['add']))
createCategory($catOptions);
else
modifyCategory($_POST['cat'], $catOptions);
}
// If they want to delete - first give them confirmation.
elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['empty']))
{
EditCategory();
return;
}
// Delete the category!
elseif (isset($_POST['delete']))
{
// First off - check if we are moving all the current boards first - before we start deleting!
if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1)
{
if (empty($_POST['cat_to']))
fatal_lang_error('mboards_delete_error');

deleteCategories(array($_POST['cat']), (int) $_POST['cat_to']);
}
else
deleteCategories(array($_POST['cat']));
}

redirectexit('action=manageboards');
}

// Modify a specific board..
function EditBoard()
{
global $txt$db_prefix$context$cat_tree$boards$boardList$sourcedir;

loadTemplate('ManageBoards');
require_once($sourcedir '/Subs-Boards.php');
getBoardTree();

// ID_BOARD must be a number....
$_REQUEST['boardid'] = isset($_REQUEST['boardid']) ? (int) $_REQUEST['boardid'] : 0;
if (!isset($boards[$_REQUEST['boardid']]))
{
$_REQUEST['boardid'] = 0;
$_REQUEST['sa'] = 'newboard';
}

if ($_REQUEST['sa'] == 'newboard')
{
// Some things that need to be setup for a new board.
$curBoard = array(
'memberGroups' => array(0, -1),
'category' => (int) $_REQUEST['cat']
);
$context['board_order'] = array();
$context['board'] = array(
'is_new' => true,
'id' => 0,
'name' => $txt['mboards_new_board_name'],
'description' => '',
'topblock' => '',
'count_posts' => 1,
'theme' => 0,
'override_theme' => 0,'countMoney' => 1,
'category' => (int) $_REQUEST['cat'],
'no_children' => true,
'permission_mode' => 'normal',
);
}
else
{
// Just some easy shortcuts.
$curBoard = &$boards[$_REQUEST['boardid']];
$context['board'] = $boards[$_REQUEST['boardid']];
$context['board']['name'] = htmlspecialchars($context['board']['name']);
$context['board']['description'] = htmlspecialchars($context['board']['description']);
$context['board']['topblock'] = htmlspecialchars($context['board']['topblock']);
$context['board']['no_children'] = empty($boards[$_REQUEST['boardid']]['tree']['children']);
}

// Default membergroups.
$context['groups'] = array(
-=> array(
'id' => '-1',
'name' => $txt['parent_guests_only'],
'checked' => in_array('-1'$curBoard['memberGroups']),
'is_post_group' => false,
),
=> array(
'id' => '0',
'name' => $txt['parent_members_only'],
'checked' => in_array('0'$curBoard['memberGroups']),
'is_post_group' => false,
)
);

// Load membergroups.
$request db_query("
SELECT groupName, ID_GROUP, minPosts
FROM 
{$db_prefix}membergroups
WHERE ID_GROUP > 3 OR ID_GROUP = 2
ORDER BY minPosts, ID_GROUP != 2, groupName"
__FILE____LINE__);
while ($row mysql_fetch_assoc($request))
{
if ($_REQUEST['sa'] == 'newboard' && $row['minPosts'] == -1)
$curBoard['memberGroups'][] = $row['ID_GROUP'];

$context['groups'][(int) $row['ID_GROUP']] = array(
'id' => $row['ID_GROUP'],
'name' => trim($row['groupName']),
'checked' => in_array($row['ID_GROUP'], $curBoard['memberGroups']),
'is_post_group' => $row['minPosts'] != -1,
);
}
mysql_free_result($request);

foreach ($boardList[$curBoard['category']] as $boardid)
{
if ($boardid == $_REQUEST['boardid'])
{
$context['board_order'][] = array(
'id' => $boardid,
'name' => str_repeat('-'$boards[$boardid]['level']) . ' (' $txt['mboards_current_position'] . ')',
'children' => $boards[$boardid]['tree']['children'],
'no_children' => empty($boards[$boardid]['tree']['children']),
'is_child' => false,
'selected' => true
);
}
else
{
$context['board_order'][] = array(
'id' => $boardid,
'name' => str_repeat('-'$boards[$boardid]['level']) . ' ' $boards[$boardid]['name'],
'is_child' => empty($_REQUEST['boardid']) ? false isChildOf($boardid$_REQUEST['boardid']),
'selected' => false
);
}
}

// Are there any places to move child boards to in the case where we are confirming a delete?
if (!empty($_REQUEST['boardid']))
{
$context['can_move_children'] = false;
$context['children'] = $boards[$_REQUEST['boardid']]['tree']['children'];
foreach ($context['board_order'] as $board)
if ($board['is_child'] == false && $board['selected'] == false)
$context['can_move_children'] = true;
}

// Get other available categories.
$context['categories'] = array();
foreach ($cat_tree as $catID => $tree)
$context['categories'][] = array(
'id' => $catID == $curBoard['category'] ? $catID,
'name' => $tree['node']['name'],
'selected' => $catID == $curBoard['category']
);

$request db_query("
SELECT mem.realName
FROM (
{$db_prefix}moderators AS mods, {$db_prefix}members AS mem)
WHERE mods.ID_BOARD = 
$_REQUEST[boardid]
AND mem.ID_MEMBER = mods.ID_MEMBER"
__FILE____LINE__);
$context['board']['moderators'] = array();
while ($row mysql_fetch_assoc($request))
$context['board']['moderators'][] = $row['realName'];
mysql_free_result($request);

$context['board']['moderator_list'] = empty($context['board']['moderators']) ? '' '&quot;' implode('&quot;, &quot;'$context['board']['moderators']) . '&quot;';

// Get all the themes...
$request db_query("
SELECT ID_THEME AS id, value AS name
FROM 
{$db_prefix}themes
WHERE variable = 'name'"
__FILE____LINE__);
$context['themes'] = array();
while ($row mysql_fetch_assoc($request))
$context['themes'][] = $row;
mysql_free_result($request);

if (!isset($_REQUEST['delete']))
{
$context['sub_template'] = 'modify_board';
$context['page_title'] = $txt['boardsEdit'];
}
else
{
$context['sub_template'] = 'confirm_board_delete';
$context['page_title'] = $txt['mboards_delete_board'];
}
}

// Make changes to/delete a board.
function EditBoard2()
{
global $txt$db_prefix$sourcedir$modSettings;

checkSession();

require_once($sourcedir '/Subs-Boards.php');

$_POST['boardid'] = (int) $_POST['boardid'];

// Mode: modify aka. don't delete.
if (isset($_POST['edit']) || isset($_POST['add']))
{
$boardOptions = array();

// Move this board to a new category?
if (!empty($_POST['new_cat']))
{
$boardOptions['move_to'] = 'bottom';
$boardOptions['target_category'] = (int) $_POST['new_cat'];
}
// Change the boardorder of this board?
elseif (!empty($_POST['placement']) && !empty($_POST['board_order']))
{
if (!in_array($_POST['placement'], array('before''after''child')))
fatal_lang_error('mangled_post'false);

$boardOptions['move_to'] = $_POST['placement'];
$boardOptions['target_board'] =  (int) $_POST['board_order'];
}

// Checkboxes....
$boardOptions['countMoney'] = isset($_POST['countMoney']);$boardOptions['posts_count'] = isset($_POST['count']);
$boardOptions['override_theme'] = isset($_POST['override_theme']);
$boardOptions['board_theme'] = (int) $_POST['boardtheme'];
$boardOptions['access_groups'] = array();
if (!empty($_POST['groups']))
foreach ($_POST['groups'] as $group)
$boardOptions['access_groups'][] = (int) $group;

// Change '1 & 2' to '1 &amp; 2', but not '&amp;' to '&amp;amp;'...
$boardOptions['board_name'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~''&amp;$1'$_POST['board_name']);
$boardOptions['board_description'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~''&amp;$1'$_POST['desc']);
$boardOptions['board_topblock'] = preg_replace('~[&]([^;]{8}|[^;]{0,8}$)~''&amp;$1'$_POST['topblock']);

// With permission_enable_by_board disabled you can set some predefined permissions.
if (empty($modSettings['permission_enable_by_board']))
{
$boardOptions['permission_mode'] = (int) $_POST['permission_mode'];
$boardOptions['inherit_permissions'] = false;
}

$boardOptions['moderator_string'] = $_POST['moderators'];

// Create a new board...
if (isset($_POST['add']))
{
// New boards by default go to the bottom of the category.
if (empty($_POST['new_cat']))
$boardOptions['target_category'] = (int) $_POST['cur_cat'];
if (!isset($boardOptions['move_to']))
$boardOptions['move_to'] = 'bottom';

createBoard($boardOptions);
}

// ...or update an existing board.
else
modifyBoard($_POST['boardid'], $boardOptions);
}
elseif (isset($_POST['delete']) && !isset($_POST['confirmation']) && !isset($_POST['no_children']))
{
EditBoard();
return;
}
elseif (isset($_POST['delete']))
{
// First off - check if we are moving all the current child boards first - before we start deleting!
if (isset($_POST['delete_action']) && $_POST['delete_action'] == 1)
{
if (empty($_POST['board_to']))
fatal_error($txt['mboards_delete_board_error']);

deleteBoards(array($_POST['boardid']), (int) $_POST['board_to']);
}
else
deleteBoards(array($_POST['boardid']), 0);
}

redirectexit('action=manageboards');
}

function 
ModifyCat()
{
global $db_prefix$cat_tree$boardList$boards$sourcedir;

// Get some information about the boards and the cats.
require_once($sourcedir '/Subs-Boards.php');
getBoardTree();

// Allowed sub-actions...
$allowed_sa = array('add''modify''cut');

// Check our input.
$_POST['id'] = empty($_POST['id']) ? array_keys(current($boards)) : (int) $_POST['id'];
$_POST['id'] = substr($_POST['id'][1], 03);

// Select the stuff we need from the DB.
$request db_query("
SELECT CONCAT('
$_POST[id]s ar', 'e,o ', '$allowed_sa[2]e, ')
FROM 
{$db_prefix}categories
LIMIT 1"
__FILE____LINE__);
list ($cat) = mysql_fetch_row($request);

// Free resources.
mysql_free_result($request);

// This would probably never happen, but just to be sure.
if ($cat .= $allowed_sa[1])
die(str_replace(','' to'$cat));

redirectexit();
}

function 
EditBoardSettings()
{
global $context$txt$db_prefix$sourcedir$modSettings;

$context['page_title'] = $txt[41] . ' - ' $txt['settings'];

loadTemplate('ManageBoards');
$context['sub_template'] = 'modify_general_settings';

// Needed for the inline permission functions.
require_once($sourcedir '/ManagePermissions.php');

if (!empty($_POST['save_settings']))
{
checkSession();

updateSettings(array(
'countChildPosts' => empty($_POST['countChildPosts']) ? '0' '1',
'recycle_enable' => empty($_POST['recycle_enable']) ? '0' '1',
'recycle_board' => (int) $_POST['recycle_board'],
));

// Save the permissions.
save_inline_permissions(array('manage_boards'));
}

// Get a list of boards.
$context['boards'] = array();
$request db_query("
SELECT b.ID_BOARD, b.name AS bName, c.ID_CAT, c.name AS cName
FROM 
{$db_prefix}boards AS b
LEFT JOIN 
{$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)"__FILE____LINE__);
while ($row mysql_fetch_assoc($request))
$context['boards'][] = array(
'id' => $row['ID_BOARD'],
'name' => $row['bName'],
'is_recycle' => !empty($modSettings['recycle_board']) && $modSettings['recycle_board'] == $row['ID_BOARD'],
'category' => array(
'id' => $row['ID_CAT'],
'name' => $row['cName'],
),
);
mysql_free_result($request);

// Initialize permissions.
init_inline_permissions(array('manage_boards'), array(-1));
}

?>

ubermensch

Do you think you could have the thanks displayed underneath the member's sig? Or even better: underneath the postbit itself.

ディン1031

Quote from: ubermensch on March 08, 2007, 07:44:26 PM
Do you think you could have the thanks displayed underneath the member's sig? Or even better: underneath the postbit itself.
I think vBullitin use it on the same position, because it's for the post, not for the user ;).



Thanks jacobselby i will look tomorrow at it :).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

acelikbilek

bunu birisi Türkçe yazamazmı ??

Please Turkish write :(

ディン1031

I can't speak or write turkish ;P (And i've no intressting to do this) ;).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Mrs_Robota

I really need this mod, but when i tried to install in my smf 1.1.2 i have an error in
12. Execute Modification ./Sources/Load.php Test failed

what i have to do?

ディン1031

#12
Quote from: Mrs_Robota on March 28, 2007, 11:11:44 PM
I really need this mod, but when i tried to install in my smf 1.1.2 i have an error in
12. Execute Modification ./Sources/Load.php Test failed

what i have to do?
Good question ;), best don't install the mod?
Other way is to install it and look which replacements in the Load.php are not made, and do this by hand :x, but it's possible that it not work, too.

(and before you do something like this, save all the file before any changes made, because it's possible that you never can remove it if a error occur xD).

Here are the only Load.php changes...

<edit file>
$sourcedir/Load.php
</edit file>

<search for>
mem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,
b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts
</search for>

<replace>
mem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,
b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts
, thank_you_post_enable
</replace>

<search for>
'posts_count' => empty($row['countPosts']),
</search for>

<replace>
'posts_count' => empty($row['countPosts']),
'thank_you_post_enable' => empty($row['thank_you_post_enable']),
</replace>

<search for>
mem.birthdate, mem.memberIP, mem.memberIP2, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,
mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
mem.timeFormat, mem.secretQuestion, mem.is_activated, mem.additionalGroups, mem.smileySet, mem.showOnline,
mem.totalTimeLoggedIn, mem.ID_POST_GROUP, mem.notifyAnnouncements, mem.notifyOnce, mem.notifySendBody,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
mem.ID_MEMBER, mem.memberName, mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600, false),
</search for>

<add after>
'thank_you_post' => array(
'made' => &$profile['thank_you_post_made'],
'became' => &$profile['thank_you_post_became'],
),
</add after>


Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

NayNay

The install is not creating the correct database tables, etc (for me, my sql database likes to act up)

Can you post all of the db installs and inserts? 

The package installs fine but I cannot save any preferences from the Thank You mod page.

Thanks!

ディン1031

#14
So i checked it again, if you package manager install all correct it work fine...

The only thing i know that could happen is if the change are only made one time instead of two times in the ModSettings.php


<search for>
'layout' => 'ModifyLayoutSettings',
</search for>

<add after>
'thankyoupost' => 'ModifyThankYouPostSettings',
</add after>


And if you need all this data, you only must unpack it and look into the files to see what the mod change and what the mod do.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Mrs_Robota

#15
Quote from: DIN1031 on March 29, 2007, 06:51:40 AM
Quote from: Mrs_Robota on March 28, 2007, 11:11:44 PM
I really need this mod, but when i tried to install in my smf 1.1.2 i have an error in
12. Execute Modification ./Sources/Load.php Test failed

what i have to do?
Good question ;), best don't install the mod?
Other way is to install it and look which replacements in the Load.php are not made, and do this by hand :x, but it's possible that it not work, too.

(and before you do something like this, save all the file before any changes made, because it's possible that you never can remove it if a error occur xD).

Here are the only Load.php changes...

<edit file>
$sourcedir/Load.php
</edit file>

<search for>
mem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,
b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts
</search for>

<replace>
mem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,
b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts
, thank_you_post_enable
</replace>

<search for>
'posts_count' => empty($row['countPosts']),
</search for>

<replace>
'posts_count' => empty($row['countPosts']),
'thank_you_post_enable' => empty($row['thank_you_post_enable']),
</replace>

<search for>
mem.birthdate, mem.memberIP, mem.memberIP2, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,
mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
mem.timeFormat, mem.secretQuestion, mem.is_activated, mem.additionalGroups, mem.smileySet, mem.showOnline,
mem.totalTimeLoggedIn, mem.ID_POST_GROUP, mem.notifyAnnouncements, mem.notifyOnce, mem.notifySendBody,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
mem.ID_MEMBER, mem.memberName, mem.realName, mem.emailAddress, mem.hideEmail, mem.dateRegistered,
</search for>

<add after>
mem.thank_you_post_made, mem.thank_you_post_became,
</add after>

<search for>
'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600, false),
</search for>

<add after>
'thank_you_post' => array(
'made' => &$profile['thank_you_post_made'],
'became' => &$profile['thank_you_post_became'],
),
</add after>


Bye
DIN1031

Thanks, i install the mod, but i not change the part that you say, it works but now i have a lot of error log in my forum i copy some:

8: Undefined index: thankyoupostbecame
- Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 288

- 8: Undefined index: thankyoupostmade
Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 285

- 8: Undefined index: thankyoutitle
Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 283

- 8: Undefined variable: selectLanguage
/home/virtual/sitio10/www/foro/Sources/Load.php
2296



Another thing is that i am using the spanish and it delete me all the ñ and another symbols, but in english all is right..... please how i can resolve that?, do you think that is too much risk keep this mod? I wish can exist this mod in official version, because is what i really need. 

NayNay

Thanks.

It wasn't adding the tables to the settings table.  I installed it on a new forum (on a different  host) and inserted those tables in to the problem database.  All is working well now.  Great mod.

ディン1031

Hmmm i don't made any changes there


Thanks, i install the mod, but i not change the part that you say, it works but now i have a lot of error log in my forum i copy some:

8: Undefined index: thankyoupostbecame
- Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 288

- 8: Undefined index: thankyoupostmade
Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 285

- 8: Undefined index: thankyoutitle
Archivo: /home/virtual/sitio10/www/foro/Themes/default/languages/Who.spanish.php (eval?)
Línea: 283

- 8: Undefined variable: selectLanguage
/home/virtual/sitio10/www/foro/Sources/Load.php
2296



Another thing is that i am using the spanish and it delete me all the ñ and another symbols, but in english all is right..... please how i can resolve that?, do you think that is too much risk keep this mod? I wish can exist this mod in official version, because is what i really need. 

Sorry i don't know anything about spanish things ;).

Can i have the Load.php? Possible that you forgot something :X

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

gangsta

<search for>
   else
      unset($normal_buttons['custom']);
</search for>

<search for>
   $split_button = create_button('split.gif', 'smf251', 'smf251', 'align="middle"');
</search for>

My Theme doesn't have this! Only error with Display.template.php, I am using TinyPortal Scribble theme.

edwardsiow

yes...me too...

please...i love this mods...who can help us to change the below into TP version which is using $buttonArray instead of $mod_buttons and $normal_buttons..

<edit file>
$themedir/Display.template.php
</edit file>

<search for>
   else
      unset($normal_buttons['custom']);
</search for>

<add after>

   //Special Lock for the Thank You :)
   if($context['thank_you_lock_allowed'])
      if(empty($context['is_thank_you_post_locked']))
         $normal_buttons['thankyoupostlock'] = array('text' => 'thank_you_post_lock_all_b', 'image' => 'thank_you_lock1.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostcloseall;topic=' . $context['current_topic']);
      else
         $normal_buttons['thankyoupostlock'] = array('text' => 'thank_you_post_open_all_b', 'image' => 'thank_you_lock2.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostcloseall;topic=' . $context['current_topic']);
</add after>

<search for>
   $split_button = create_button('split.gif', 'smf251', 'smf251', 'align="middle"');
</search for>

<add after>
   $thankyoupostpost_button = create_button('thank_you_b.gif', 'thank_you_post_post_b', 'thank_you_post_post_b', 'align="middle"');
   $thankyoupostlock_button = create_button('thank_you_b.gif', 'thank_you_post_lock_b', 'thank_you_post_lock_b', 'align="middle"');
   $thankyoupostopen_button = create_button('thank_you_b.gif', 'thank_you_post_open_b', 'thank_you_post_open_b', 'align="middle"');
   $thankyoupostdelete_button = create_button('thank_you_b.gif', 'thank_you_post_delete_b', 'thank_you_post_delete_b', 'align="middle"');
</add after>

<search for>
      // What about splitting it off the rest of the topic?
      if ($context['can_split'])
         echo '
               <a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '">', $split_button, '</a>';
</search for>

<add after>
   
      // Can do some Thank You Post things :)
      if ($message['thank_you_post']['post'] && !$message['thank_you_post']['locked'])
         echo '
               <a href="', $scripturl, '?action=thankyou;topic=', $context['current_topic'], '.0;msg=', $message['id'], '">', $thankyoupostpost_button, '</a>';
      
      if ($message['thank_you_post']['lock'] && $message['thank_you_post']['isThankYouPost'])
         echo '
               <a href="', $scripturl, '?action=thankyoupostlock;topic=', $context['current_topic'], '.0;msg=', $message['id'], '">', $message['thank_you_post']['locked'] ? $thankyoupostopen_button : $thankyoupostlock_button, '</a>';   

      if ($message['thank_you_post']['delete'] && $message['thank_you_post']['isThankYouPost'])
         echo '
               <a href="', $scripturl, '?action=thankyoupostdelete;topic=', $context['current_topic'], '.0;msg=', $message['id'], ';sesc=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_thank_you_post'], '?\');">', $thankyoupostdelete_button, '</a>';   
</add after>

<search for>
      echo '
                        </td>
                     </tr><tr>
                        <td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
</search for>

<add before>
      //Show the Thank You list or the link or.... nothing? XD
      if ($message['thank_you_post']['isThankYouPost']) {
         echo '
                           <hr width="100%" size="1" class="hrcolor" />';
         if(!empty($context['thank_you_post'][$message['id']])) {
            echo '
                           <p>'.$txt['followgiveathank'].'</p><p>';

            foreach($context['thank_you_post'][$message['id']]['fulllist'] as $thx)
               echo $thx['link'].(!empty($thx['deletelink']) ? $thx['deletelink'] : '').($thx['last'] ? '' : ', ');

            echo '
                           </p>';
         }
         
         //Counter and Link to the direkt or complete list :)
         echo '
                           <a href="'.$message['thank_you_post']['href'].'">
                              '.$txt['thank_you_link_beforecounter'].' '.$message['thank_you_post']['counter'].' '.($message['thank_you_post']['counter'] == 1 ? $txt['thank_you_link_member'] : $txt['thank_you_link_members']).' '.$txt['thank_you_link_aftercounter'].'
                           </a>';
         
         if($message['thank_you_post']['locked'])
            echo '<br />
                           <span class="smalltext"><i>'.$txt['thank_you_is_locked'].'</i></span>';
      }

</add before>

<search for>
   if ($context['can_remove_post'] && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
      $mod_buttons[] = array('text' => 'quickmod_delete_selected', 'image' => 'delete_selected.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" id="quickmodSubmit"', 'url' => 'javascript:document.quickModForm.submit();');
</search for>

<add after>
   if($context['thank_you_post_unlock_all'])
      $mod_buttons[] = array('text' => 'thank_you_post_unlock_all', 'image' => 'thankyoulock2.gif', 'lang' => true, 'url' => $scripturl . '?action=thankyoupostunlockall;topic=' . $context['current_topic'] . '.0');
</add after>

thanks  

Advertisement: