Jail MOD - Väznica – Krok za Krokom
1. Tak začneme, stiahneme si mod a to napríklad pomocou tohto odkazu:
Kód:
http://www.phpbb.cz/modules.php?name=Downloads&d_op=getit&lid=195
2. Rozbalíme si archív s modom.
3. Uploadneme potrebné súbory do priečinka fóra:
Kód:
root/cell.php do cell.php
root/cell_install.php do cell_install.php
root/courthouse.php do courthouse.php
root/admin/admin_cell.php do admin/admin_cell.php
root/admin/admin_cell_general.php do admin/admin_cell_general.php
root/images/cell.gif do images/cell.gif
root/includes/functions_jail.php do includes/functions_jail.php
root/language/lang_english/lang_jail.php do language/lang_english/lang_jail.php
root/templates/subSilver/cell_body.tpl do templates/subSilver/cell_body.tpl
root/templates/subSilver/cell_courthouse_body.tpl do templates/subSilver/cell_courthouse_body.tpl
root/templates/subSilver/cell_courthouse_judge_body.tpl do templates/subSilver/cell_courthouse_judge_body.tpl
root/templates/subSilver/cell_courthouse_list_body.tpl do templates/subSilver/cell_courthouse_list_body.tpl
root/templates/subSilver/images/icon_justice.gif do templates/subSilver/images/icon_justice.gif
root/templates/subSilver/images/icon_mini_justice.gif do templates/subSilver/images/icon_mini_justice.gif
root/templates/subSilver/admin/config_cell_body.tpl do templates/subSilver/admin/config_cell_body.tpl
root/templates/subSilver/admin/config_cell_general_body.tpl do templates/subSilver/admin/config_cell_general_body.tpl
root/templates/subSilver/admin/config_cell_users_body.tpl do templates/subSilver/admin/config_cell_users_body.tpl
4. Databáza
Spustime si phpMyAdmina otvoríme si databázu fóra. Potom hore v menu klikneme na SQL a do okna napíšeme:
Kód:
ALTER TABLE phpbb_users ADD user_cell_time INT(11) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_time_judgement INT(11) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_caution INT(8) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_sentence TEXT DEFAULT '';
ALTER TABLE phpbb_users ADD user_cell_enable_caution INT(8) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_enable_free INT(8) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_celleds INT(8) DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_users ADD user_cell_punishment TINYINT(1) DEFAULT '0' NOT NULL;
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_allow_display_bars', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_allow_display_celleds', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_allow_user_caution', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_allow_user_judge', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_allow_user_blank', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_amount_user_blank', '5000');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_user_judge_voters', '10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cell_user_judge_posts', '2');
CREATE TABLE phpbb_jail_users (
celled_id int(8) NOT NULL default '0',
user_id int(8) NOT NULL default '0',
user_cell_date int(11) NOT NULL default '0',
user_freed_by int(8) NOT NULL default '0',
user_sentence text,
user_caution int(8) NOT NULL default '0',
user_time int(11) NOT NULL default '0',
PRIMARY KEY (celled_id)
) TYPE=MyISAM;
CREATE TABLE phpbb_jail_votes (
vote_id mediumint(8) NOT NULL default '0',
voter_id mediumint(8) NOT NULL default '0',
vote_result mediumint(8) NOT NULL default '0',
KEY vote_id (vote_id),
KEY voter_id (voter_id)
) TYPE=MyISAM;
5. A ideme na úpravu súborov tento krát budeme upravovať tieto súbory
Kód:
posting.php
viewtopic.php
includes/constants.php
includes/page_header.php
includes/usercp_viewprofile.php
language/lang_english/lang_admin.php
language/lang_english/lang_main.php
templates/subSilver/overall_header.tpl
templates/subSilver/profile_view_body.tpl
templates/subSilver/subSilver.cfg
templates/subSilver/viewtopic_body.tpl
6. Otvoríme si súbor posting.php
A v ňom nájdeme
Kód:
init_userprefs($userdata);
//
// End session management
//
6.1 Do ďalšieho riadku pod to napíšeme:
Kód:
if ( $userdata['user_cell_time'] > 0 && !defined('CELL') && $userdata['session_logged_in'] && $userdata['user_level'] != ADMIN && ( $userdata['user_cell_punishment'] == 2 || $userdata['user_cell_punishment'] == 3 ))
{
redirect(append_sid("cell.$phpEx", true));
}
7. Otvoríme si súbor viewtopic.php
A v ňom nájdeme
Kód:
init_userprefs($userdata);
//
// End session management
//
7.1 Do ďalšieho riadku pod to napíšeme:
Kód:
if ( $userdata['user_cell_time'] > 0 && !defined('CELL') && $userdata['session_logged_in'] && $userdata['user_level'] != ADMIN && $userdata['user_cell_punishment'] == 3 )
{
redirect(append_sid("cell.$phpEx", true));
}
7.2 Ďalej Hľadáme:
Kód:
$sql = "SELECT u.username
7.3 V tomto riadku najdeme
Kód:
p.*
7.4 A V tom istom riadku pridame pred:
Kód:
u.user_cell_time, u.user_cell_celleds,
7.4 Ďalej Hľadáme:
Kód:
$poster_avatar = '';
7.5 Pred riadok napiseme
Kód:
$celleds = ( $board_config['cell_allow_display_celleds'] && $postrow[$i]['user_cell_celleds'] ) ? sprintf('<br />'.$lang['Celleds_time'].'<a href="' . append_sid("courthouse.$phpEx?from=celleds_list") . '">'.$postrow[$i]['user_cell_celleds'].'</a>') : '';
7.6 Ďalej Hľadáme:
Kód:
case USER_AVATAR_UPLOAD:
$poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
7.7 Pod to pridáme:
Kód:
$poster_avatar = ( ($postrow[$i]['user_cell_time'] > 0) && $board_config['cell_allow_display_bars'] ) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $poster_avatar ;
7.8 Ďalej Hľadáme:
Kód:
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
7.9 Pod to pridáme:
Kód:
$poster_avatar = ( ($postrow[$i]['user_cell_time'] > 0) && $board_config['cell_allow_display_bars']) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $postrow[$i]['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $poster_avatar ;
7.10 Ďalej Hľadáme:
Kód:
case USER_AVATAR_GALLERY:
$poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
7.11 Pod to pridáme:
Kód:
$poster_avatar = ( ($postrow[$i]['user_cell_time'] > 0) && $board_config['cell_allow_display_bars']) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $poster_avatar ;
7.12 Ďalej Hľadáme:
Kód:
'DELETE' => $delpost,
7.13 Pod to pridáme:
Kód:
'CELLEDS' => $celleds,
8. Otvoríme si súbor includes/constants.php
A v ňom nájdeme:
Kód:
?>
Pred to napíšeme:
Kód:
define('JAIL_USERS_TABLE', $table_prefix.'jail_users');
define('JAIL_VOTES_TABLE', $table_prefix.'jail_votes');
9. Otvoríme si súbor includes/page_header.php
A v ňom nájdeme:
Kód:
'U_MEMBERLIST' => append_sid('memberlist.'.$phpEx),
Pod to pridáme:
Kód:
'U_COURTHOUSE' => append_sid('courthouse.'.$phpEx),
'I_COURTHOUSE' => $images['icon_mini_justice'],
'L_COURTHOUSE' => $lang['Cell_courthouse'],
9.1 Ďalej Hľadáme:
Kód:
$template->pparse('overall_header');
Pred to pridáme:
Kód:
if ( $userdata['user_cell_time'] > 0 && !defined('CELL') && $userdata['session_logged_in'] && $userdata['user_level'] != ADMIN && $userdata['user_cell_punishment'] == 1 )
{
redirect(append_sid("cell.$phpEx", true));
}
10. Otvoríme si súbor includes/usercp_viewprofile.php
A v ňom nájdeme:
Kód:
$avatar_img = '';
Pod to pridáme:
Kód:
if ( $board_config['cell_allow_display_celleds'] && $profiledata['user_cell_celleds'] )
{
$template->assign_block_vars('celleds', array());
}
10.1 Ďalej Hľadáme:
Kód:
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
10.2 Pod to pridáme:
Kód:
$avatar_img = ( ($profiledata['user_cell_time'] > 0) && $board_config['cell_allow_display_bars']) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $avatar_img ;
10.3 Ďalej Hľadáme:
Kód:
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
10.4 Pred to pridáme:
Kód:
$avatar_img = ( ($profiledata['user_cell_time'] > 0) && $board_config['cell_allow_display_bars'] ) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $profiledata['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $avatar_img ;
10.5 Ďalej Hľadáme:
Kód:
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
10.6 Pred to pridáme:
Kód:
$avatar_img = ( ($profiledata['user_cell_time'] > 0) && $board_config['cell_allow_display_bars'] ) ? '<div style="position:absolute;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:1;"><IMG src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" border=0 width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div><div style="position:relative;padding:0px;width:'.$board_config['avatar_max_width'].'px;height:'.$board_config['avatar_max_height'].'px;z-index:2;"><IMG src="images/cell.gif" border=0 STYLE="filter:alpha(opacity=65)" width="'.$board_config['avatar_max_width'].'" height="'.$board_config['avatar_max_height'].'"></div>' : $avatar_img ;
10.7 Ďalej Hľadáme:
Kód:
'YIM' => $yim,
10.8 Pred to pridáme:
Kód:
'CELLEDS' => $profiledata['user_cell_celleds'],
'L_CELLEDS' => $lang['Celleds_time'],
'U_CELLEDS' => append_sid("courthouse.$phpEx?from=celleds_list"),
11. Otvoríme si súbor language/lang_english/lang_admin.php
A v ňom nájdeme:
Kód:
?>
11. Pred to pridáme:
Kód:
$lang['Jail']='Jail';
$lang['Jail_settings']='General settings';
12. Otvoríme si súbor language/lang_english/lang_main.php
A v ňom nájdeme:
Kód:
?>
Pred to pridáme:
Kód:
$lang['Cell_courthouse']='Courthouse';
$lang['Celleds_time']='Imprisonments : ';
13. Otvoríme si súbor templates/subSilver/overall_header.tpl
A v ňom nájdeme:
Kód:
<td align="center" valign="top" nowrap="nowrap">
V riadku nájdeme:
Kód:
L_USERGROUPS}</a>
Za timto napiseme
Kód:
<a href="{U_COURTHOUSE}" class="mainmenu"><img src="{I_COURTHOUSE}" width="12" height="13" border="0" alt="{L_COURTHOUSE}" hspace="3" />{L_COURTHOUSE}</a>
14. Otvoríme si súbor templates/subSilver/profile_view_body.tpl
V ňom nájdeme:
Kód:
<td> <b><span class="gen">{INTERESTS}</span></b></td>
</tr>
Pod to pridáme:
Kód:
<!-- BEGIN celleds -->
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_CELLEDS}</span></td>
<td><span class="gen"><a href="{U_CELLEDS}">{CELLEDS}</a></span></td>
</tr>
<!-- END celleds -->
15. Otvoríme si súbor templates/subSilver/subSilver.cfg
V ňom nájdeme:
Kód:
?>
Pred to pridáme:
Kód:
$images['icon_justice'] = "$current_template_images/icon_justice.gif";
$images['icon_mini_justice'] = "$current_template_images/icon_mini_justice.gif";
16. Otvoríme si súbor templates/subSilver/viewtopic_body.tpl
V ňom nájdeme:
Kód:
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}">
V tomto riadku najdeme:
Kód:
{postrow.POSTER_FROM}
Za týmto pridáme:
Kód:
{postrow.CELLEDS}
Bude to vyzerať asi takto:
Kód:
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}{postrow.CELLEDS}">
17. Odosleme to vsetko na server.
ULOZIME a ZAVRIEME všetky súbory
Tak a máme to za sebou bolelo to?
Vytvoril DjLefo