this mod is one system for dices RPG
mod works modifying in the Control Panel the following thing: to allow HTML TAGS TASG HTML: table, td, tr after this it goes I cosay:
- Code: Select all
###############################################################
##Mod Title: Dices for RPG
##Author: .::HELL::.< hell_ssbc@hotmail.com > <cesar rodriguez>
##Mod description: A coupple of Dices por RPG game.
##Mod version: 1.0
##
##Installation level: easy
##Installation time: 5 minutes
##Files to edit: 6
## posting.php
## viewtopic.php
## admin/admin_board.php
## language/lang_xxx/lang_admin.php
## language/lang_xxx/lang_main.php
##Included Files: 1
## posting_dices_body.tpl
##License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
###############################################################
##
## Author notes:
##
##
##2005:
##
## solucionated conflicts primarys by mod dados for rpg by teiwaz
##
##############################################################
## MOD History:
##
## YYYY-MM-DD - Version x.x.x
## - version notes go here
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ MYSQL ]------------------------------------------
#
INSERT INTO `phpbb_config` (`config_name`, `config_value`) VALUES ('allow_dices', '0');
INSERT INTO `phpbb_config` (`config_name`, `config_value`) VALUES ('allow_dices_forums', '0');
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
if ( $post_info['poster_id'] != $userdata['user_id'] && !$is_auth['auth_mod'] )
{
$message = ( $delete || $mode == 'delete' ) ?
$lang['Delete_own_posts'] : $lang['Edit_own_posts'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
#
#-----[ ADD BEFORE ]-------------------------------------
#
//Dices MOD
if (strpos($postrow[$i]['post_text'], "<table align=\"center\" ><td valign=\"top\"><table width=\"20%\" border=\"1\" align=\"center\">
<tr>
<td align=\"center\" colspan=\"2\"><b><i>")!=false && $post_info['poster_id'] = $userdata['user_id'] && !$is_auth['auth_mod'] )
{
$message = ( $delete || $mode == 'delete' ) ?
$lang['Delete_own_posts'] : $lang['Edit_own_posts'];
$message .= '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
#
#-----[ FIND ]------------------------------------------
#
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
#
#-----[ ADD BEFORE ]------------------------------------------
#
//Dices MOD
if (!empty($HTTP_POST_VARS['distances']) && !empty($HTTP_POST_VARS['faces']))
{
$message= $message ."<table align=\"center\" >";
$html_on = 1;
$message= $message . "<td valign=\"top\">" . dices($HTTP_POST_VARS['distances'],$HTTP_POST_VARS['faces'], $HTTP_POST_VARS['namedistances']) . "</td>" ;
if (!empty($HTTP_POST_VARS['distances2']))
{
$message= $message . "<td valign=\"top\">" . dados($HTTP_POST_VARS['distances2'],$HTTP_POST_VARS['faces2'], $HTTP_POST_VARS['namedistances2']) . "</td>" ;
}
if (!empty($HTTP_POST_VARS['distances3']))
{
$message= $message . "<td valign=\"top\">" . dices($HTTP_POST_VARS['distances3'],$HTTP_POST_VARS['faces3'], $HTTP_POST_VARS['namedistances3']) . "</td>" ;
}
$message= $message ."</table>";
}
#
#-----[ FIND ]------------------------------------------
#
$html_status = $lang['HTML_is_OFF'];
}
#
#-----[ ADD BELLOW ]------------------------------------------
#
//Dados Mod:
$forums_dices = split(',', $board_config['allow_dices_forums']); for($i = 0; $i < sizeof($foros_dices); $i++)
{
$forum_finded = trim($forums_dices[$i]);
if ( $forum_id==$forum_finded)
{
$template->assign_block_vars('switch_dados_checkbox', array());
}
}
#
#-----[ FIND ]------------------------------------------
#
'pollbody' => 'posting_poll_body.tpl',
#
#-----[ ADD BELLOW ]------------------------------------------
#
'dadosbody' => 'posting_dices_body.tpl',
#
#-----[ FIND ]------------------------------------------
#
'U_REVIEW_TOPIC' => ( $mode == 'reply' ) ? append_sid("posting.$phpEx?mode=topicreview&" . POST_TOPIC_URL . "=$topic_id") : '',
#
#-----[ ADD BELLOW ]------------------------------------------
#
'L_ADD_A_DICES' => $lang['Add_dices'],
'L_ADD_DICES_EXPLAIN' => $lang['Add_dices_explain'],
'L_DADOS_DISTANCES' => $lang['Dados_distances'],
'L_DICES_1' => $lang['Dices_1'],
'L_DICES_2' => $lang['Dices_2'],
'L_DICES_3' => $lang['Dices_3'],
#
#-----[ FIND ]------------------------------------------
#
'S_HIDDEN_FORM_FIELDS' => $hidden_form_fields)
);
#
#-----[ ADD BELLOW ]------------------------------------------
#
// Dices Mod:
$template->assign_var_from_handle('DICESBOX', 'dICESbody');
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
{
#
#-----[ ADD BELLOW ]------------------------------------------
#
//Dados Mod:
if ( $userdata['user_id'] == $poster_id && strpos($postrow[$i]['post_text'], "<table align=\"center\" ><td valign=\"top\"><table width=\"20%\" border=\"1\" align=\"center\"><tr><td align=\"center\" colspan=\"2\"><b><i>")!=false)
{
$edit_img = '';
$edit = '';
}
else
{
$temp_url = append_sid("posting.$phpEx?mode=editpost&" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
$edit_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>';
$edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>';
}
#
#-----[ FIND ]------------------------------------------
#
if ( !$board_config['allow_html'] )
#
#-----[ REPLACE WITH ]------------------------------------------
#
//Dices Mod:
if ( !$board_config['allow_html'] && !$board_config['allow_dados'])
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
$html_tags = $new['allow_html_tags'];
#
#-----[ ADD BELLOW ]------------------------------------------
#
//Dices Mod:
$dices_forums = $new['allow_dices_forums'];
#
#-----[ FIND ]------------------------------------------
#
$html_no = ( !$new['allow_html'] ) ? "checked=\"checked\"" : "";
#
#-----[ ADD BELLOW ]------------------------------------------
#
//Dices Mod:
$dices_yes = ( $new['allow_dices'] ) ? "checked=\"checked\"" : "";
$dices_no = ( !$new['allow_dices'] ) ? "checked=\"checked\"" : "";
#
#-----[ FIND ]------------------------------------------
#
"L_ALLOW_HTML" => $lang['Allow_HTML'],
#
#-----[ ADD BELLOW ]------------------------------------------
#
"L_ALLOW_DICES" => $lang['Allow_Dices'],
#
#-----[ FIND ]------------------------------------------
#
"L_ALLOWED_TAGS_EXPLAIN" => $lang['Allowed_tags_explain'],
#
#-----[ ADD BELLOW ]------------------------------------------
#
"L_ALLOWED_FORUMS" => $lang['Allowed_forums'],
"L_ALLOWED_FORUMS_EXPLAIN" => $lang['Allowed_forums_explain'],
#
#-----[ FIND ]------------------------------------------
#
"HTML_NO" => $html_no,
#
#-----[ ADD BELLOW ]------------------------------------------
#
"DICES_FORUMS" => $dices_forums,
"DICES_YES" => $dices_yes,
"DICES_NO" => $dices_no,
#
#-----[ OPEN ]------------------------------------------
#
includes/funtions.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ ADD BEFORE ]------------------------------------------
#
//
//Dados Mod:
//
function dices ($multiplicator, $dice, $namedistance) { $b=""; $i=1; $sum=0; $a= "<table width=\"20%\" border=\"1\" align=\"center\">" . "<tr>" ."<td align=\"center\" colspan=\"2\">" . "<b><i>$namedistance</i></b>" . "</td>" . "</tr>" . "<tr>" . "<td align=\"center\" colspan=\"2\">" . "<b>$multiplicator d $dice</b>" . "</td>" . "<tr>" . "<td align=\"center\">" . "<b>Distance</b>" . "</td>". "<td align=\"center\">" . "<b>Result</b>". "</td>" . "</tr>"; srand((double)microtime()*1000000); while ($i !=$multiplicator + 1) { $result=rand (1,$dice ); $sum=$sum + $result; $b= $b."<tr>" . "<td align=\"center\">$i" . "</td>" . "<td align=\"right\">" . "$result</td>" . "</tr>"; $i++;
}
$c= "<tr>" . "<td align=\"center\">" . "<b>TOTAL</b>" . "</td>" . "<td align=\"right\">" . "<b>$sum</b>" . "</td>" . "</tr>" . "</table>"; return "$a $b $c";
}
#
#-----[ OPEN ]------------------------------------------
#
language/lang_xxx/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['Allow_HTML'] = 'Allow HTML';
#
#-----[ ADD BELLOW ]------------------------------------------
#
$lang['Allow_Dices'] = 'Allow Dices';
#
#-----[ FIND ]------------------------------------------
#
$lang['Allowed_tags_explain'] = 'Separate tags with commas';
#
#-----[ ADD BELLOW ]------------------------------------------
#
$lang['Allowed_forums'] = "Forums where Dices will be use";
$lang['Allowed_forums_explain'] = "Separate Forums ID with commas";
#
#-----[ OPEN ]------------------------------------------
#
language/lang_xxx/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ ADD BEFORE ]------------------------------------------
#
// Dices Mod:
$lang['Add_dices']="Add distance of dices";
$lang['Add_dices_explain']="You can make up to three different distances";
$lang['Dices_distance']="Name of distance";
$lang['Dices_1']="Distance 1";
$lang['Dices_2']="Distance 2";
$lang['Dices_3']="Distance 3";
#
#-----[ OPEN ]------------------------------------------
#
templates/xxx/posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
</tr>
{POLLBOX}
<tr>
#
#-----[ ADD BELLOW ]------------------------------------------
#
</tr>
{DICESBOX}
<tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/xxx/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_ALLOWED_TAGS}<br /><span class="gensmall">{L_ALLOWED_TAGS_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="30" maxlength="255" name="allow_html_tags" value="{HTML_TAGS}" /></td>
</tr>
#
#-----[ ADD BELLOW ]------------------------------------------
#
<tr>
<td class="row1">{L_ALLOW_DICES}</td>
<td class="row2"><input type="radio" name="allow_dices" value="1" {DICES_YES} /> {L_YES}<input type="radio" name="allow_dices" value="0" {DICES_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_ALLOWED_FORUMS}<br /><span class="gensmall">{L_ALLOWED_FORUMS_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" size="30" maxlength="255" name="allow_dices_forums" value="{DICES_FORUMS}" /></td>
</tr>
#
#-----[ UPLOAD ]------------------------------------------
#
posting_dices_body.tpl to templates templates/xxx
#-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
# EoM
posting_dices_body.tpl:
- Code: Select all
<!-- BEGIN switch_dados_checkbox -->
<tr>
<th class="thHead" colspan="2" >{L_ADD_A_DICES}</th>
</tr>
<tr>
<td class="row1" colspan="2" ><span class="gensmall">{L_ADD_DICES_EXPLAIN}</span></td>
</tr>
<tr>
<td class="row1" ></td>
<td class="row1" ><span class="gen"><b>{L_DADOS_DISTANCE}</b></span></td>
</tr>
<tr>
<td class="row1" ><span class="gen"><b>{L_DICES_1}</b></span></td>
<td class="row2" ><input name="namedistances" type="text" size="20" maxlength="20">
<input name="distances" type="text" size="2" maxlength="2"><b>d</b><select name="faces">
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="20">20</option>
<option value="100">100</option>
</select></td>
</tr>
<tr>
<td class="row1" ><span class="gen"><b>{L_DICES_2}</b></span></td>
<td class="row2" ><input name="namedistances2" type="text" size="20" maxlength="20">
<input name="distances2" type="text" size="2" maxlength="2"><b>d</b><select name="faces2">
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="20">20</option>
<option value="100">100</option>
</select></td>
</tr>
<tr>
<td class="row1" ><span class="gen"><b>{L_DICES_3}</b></span></td>
<td class="row2" ><input name="namedistances3" type="text" size="20" maxlength="20">
<input name="distances3" type="text" size="2" maxlength="2"><b>d</b><select name="faces3">
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="20">20</option>
<option value="100">100</option>
</select></td>
</tr>
<!-- END switch_dados_checkbox -->
I am new programming phpBB jeje, any thing my mail is hell_ssbc@hotmail.com
greetings