[MOD] Smilie Categories Hack/gülücük kategorileri

EftelyA

Yaşayan Forum Efsanesi
22 Kas 2007
9,097
59
EsEs
bu modla smile kategorileri oluşturabilirsiniz ve kategorileri belli forumlara yada kullanıcı gruplarına atayabilirsiniz. ve yönetim panelinde daha birçok ayar seçeneği mevcut.
yazılanlara göre 2.0.21 ile uyumlu. ama bugün güncellenmiş bir mod yani büyük ihtimalle 2.0.22 ilede uyumludur.





#############################################################
## MOD Title: Smiley Categories MOD
## MOD Author: Afkamm < [email protected] > (N/A) https://tik.lat/ZW1xY
## MOD Description: Allows the forum Admin to organise the smilies by creating categories
## to put them in. Each category can be linked to forums/usergroups and
## is highly configurable.
##
## MOD Version: 2.0.4 (The "Salma Hayek" release)
## phpBB2 Version: 2.0.21
##
## Installation Level: Intermediate
## Installation Time: 20 minutes
##
## Files To Edit: 11
## modcp.php
## posting.php
## privmsg.php
## search.php
## viewtopic.php
## includes/bbcode.php
## includes/constants.php
## includes/functions_post.php
## includes/topic_review.php
## language/lang_english/lang_main.php
## templates/subSilver/posting_body.tpl
##
## Included Files: 20
## admin/admin_smilies.php
## admin/admin_smilies_config.php
## images/smiles/blank_icon.gif
## language/lang_english/lang_admin_smiley_categories.php
## language/lang_english/lang_admin_smiley_config.php
## templates/subSilver/posting_smilies.tpl
## templates/subSilver/admin/smile_catadd_body.tpl
## templates/subSilver/admin/smile_catedit_body.tpl
## templates/subSilver/admin/smile_catselect_body.tpl
## templates/subSilver/admin/smile_catview_body.tpl
## templates/subSilver/admin/smile_config_body.tpl
## templates/subSilver/admin/smile_export_body.tpl
## templates/subSilver/admin/smile_import_body.tpl
## templates/subSilver/admin/smile_main_body.tpl
## templates/subSilver/admin/smile_massedit_body.tpl
## templates/subSilver/admin/smile_perms_body.tpl
## templates/subSilver/admin/smile_popup_body.tpl
## templates/subSilver/admin/smile_smiley_body.tpl
## templates/subSilver/admin/smile_unused_body.tpl
## templates/subSilver/admin/smile_upload_body.tpl
##
## License: https://tik.lat/n6Mtp GNU General Public License v2
##############################################################
## Author Notes:
##
## This MOD was originally based on Ferny's Categorized Smilies MOD, but with
## more features. I initally wrote this for PNphpBB back in January '04, but
## then converted it to work with phpBB2 when people asked for it. The MOD has
## come a long way since its first release in April 2004. :)
##
## IMPORTANT:
## DO NOT install this MOD if you have already installed another type
## of smiley MOD on your board, or any MOD that alters the original phpBB2
## smiley code. Uninstall these first and make sure the original code
## is in place. If you're not sure, ask. :)
##
## This MOD does not work with Categories Hierarchy v2.1.6
##
## If this is the first time you are installing this MOD then
## backup your phpBB_smilies table *AND* create a *.PAK file as the
## original 'phpBB_smilies' table must be emptied.
##
## Feedback/problems/bugs can be emailed to me or posted on the forum. The
## details are at the top. :)
##
##############################################################
## Credits:
##
## Ferny < [email protected] > (Fernando Atanasio) https://tik.lat/pWBuz
## For his Categorized Smilies MOD. Without it this would not have been possible.
##
## Smartor < [email protected] > (Hoang Ngoc Tu) https://tik.lat/Fc1yo
## For his Configurable Smilies Table MOD.
##
## Bill Beardslee < [email protected] >
## For his Keep Em Moving MOD that keeps animated smilies moving when clicked.
##
## Nivisec < [email protected] > https://tik.lat/Rgd23
## For their Smilies List MOD. I didn't copy any code, just their idea. :)
##
## My thanks go out to Stoebi, trekclubs, WeckaMC, sirpimpmac, Anna, Laura and senyafin
## for their help testing and their ideas. Especially Stoebi for helping people on the
## forum and anyone else I missed. :)
##
##############################################################
## History:
##
## 2006-12-01 - version 2.0.4 (The "Salma Hayek" release)
## - Added usergroup association which can be turned on/off in smiley config
## to save a SQL query if the admin doesn't want it.
## - Fixed an SQL issue which was introduced in the last release.
## - Fixed an import/export issue. Didn't update the code with the last release.
##
## 2006-11-18 - version 2.0.3 (The "Emily Proctor" release)
## - Added a new category option which now makes them available outside of the forums.
##
## 2006-10-31 - version 2.0.2 (The "Hallow^w^w^ween" release)
## - The popup window can now display the smilies in a list with their code.
## - Small SQL table change due to the feature above.
## - Improved the upload code in the admin script.
## - Fixed a problem with the install file and the import page. (Thanks blincks :)
##
## 2006-10-16 - version 2.0.1 (The "Jennifer Love Hewitt" release)
## - When smilies are disabled, categories and the smiley
## block are now no longer shown.
## - 3 database changes as I've altered how the categories are linked
## to the forums and added a new category option.
## - Added 3 new smiley config options.
## - Rewrote the admin interface to be less overwhelming. :)
##
## 2006-01-05 - version 2.0.0 RC1 (The "It's after 4am!!!" release)
## - Added width/height/column options for each category so
## you can customize the popup window to suit the smilies.
## - Added viewable permissions. You can set who views the
## category and where it's available on the board.
## - Added category image icons. If you display buttons, you
## can choose to use the icon instead.
## - Added improved .pak support, (aka .pak2) which will store
## category information.
## - Lots of code improvements.
##
## 2005-08-25 - version 1.4.0
## - Added pagination to the smiley popup window and admin pages
## so you can set how many smilies appear per page.
## - Added the option for a dropdown menu instead of buttons.
## - Removed the generate_categories() function and merged the code
## with the generate_smilies() function. 1 less SQL query.
## - Moved the ******** of the categories to below the smilies.
##
## 2005-04-02 - version 1.1.1
## - Added category buttons to the popup window.
## - Fixed some hard coded English.
## - Fixed the javascript ordering bug in Firefox.
##
## 2005-03-01 - version 1.0.1
## - Fixed a few bugs, tidied some code, rewrote some english.
## - New improved db updater (thanks to www.phpbbhacks.com).
##
## 2005-02-20 - version 1.0.0
## - Initial release. No beta release as this is more or less the same as
## the version for PNphpBB which I released in 03/04/04. :)
##
###############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## This includes making a backup of your 'phpBB_smilies' table and exporting your current
## smilies as a *.pak file for importing afterwards into a category.
###############################################################

#
#-----[ COPY ]-------------------------------------------------
#
copy root/admin/admin_smilies.php to root/admin/admin_smilies.php
#
#-----[ COPY ]-------------------------------------------------
#
copy root/admin/admin_smilies_config.php to root/admin/admin_smilies_config.php
#
#-----[ COPY ]-------------------------------------------------
#
copy root/language/lang_english/lang_admin_smiley_categories.php to root/language/lang_english/lang_admin_smiley_categories.php
#
#-----[ COPY ]-------------------------------------------------
#
copy root/language/lang_english/lang_admin_smiley_config.php to root/language/lang_english/lang_admin_smiley_config.php
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/posting_smilies.tpl to root/templates/subSilver/posting_smilies.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_catadd_body.tpl to root/templates/subSilver/admin/smile_catadd_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_catedit_body.tpl to root/templates/subSilver/admin/smile_catedit_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_catselect_body.tpl to root/templates/subSilver/admin/smile_catselect_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_catview_body.tpl to root/templates/subSilver/admin/smile_catview_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_config_body.tpl to root/templates/subSilver/admin/smile_config_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_export_body.tpl to root/templates/subSilver/admin/smile_export_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_import_body.tpl to root/templates/subSilver/admin/smile_import_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_main_body.tpl to root/templates/subSilver/admin/smile_main_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_massedit_body.tpl to root/templates/subSilver/admin/smile_massedit_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_perms_body.tpl to root/templates/subSilver/admin/smile_perms_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_popup_body.tpl to root/templates/subSilver/admin/smile_popup_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_smiley_body.tpl to root/templates/subSilver/admin/smile_smiley_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_unused_body.tpl to root/templates/subSilver/admin/smile_unused_body.tpl
#
#-----[ COPY ]-------------------------------------------------
#
copy root/templates/subSilver/admin/smile_upload_body.tpl to root/templates/subSilver/admin/smile_upload_body.tpl

#
#-----[ COPY ]-------------------------------------------------
#
# NOTE: The file 'blank_icon.gif' must be placed into the category icon folder.
# By default, it's the same folder as the smilies folder ('images/smiles').
# If you change its ******** then please copy the 'blank_icon.gif'
# file to this folder.
#
copy root/images/smiles/blank_icon.gif to root/images/smiles/blank_icon.gif

#
#-----[ SQL ]--------------------------------------------------
#
# NOTE: Change the phpbb_ prefix to that of your own if it's different.
#
CREATE TABLE phpbb_smilies_cat (
`cat_id` smallint(3) unsigned NOT NULL auto_increment,
`cat_name` varchar(50) NOT NULL default '',
`description` varchar(100) NOT NULL default '',
`cat_order` smallint(3) NOT NULL default '0',
`cat_perms` tinyint(2) NOT NULL default '10',
`cat_group` varchar(255) default NULL,
`cat_forum` mediumtext NOT NULL,
`cat_special` tinyint(1) NOT NULL default '-2',
`cat_open` tinyint(1) NOT NULL default '1',
`cat_icon_url` varchar(100) default NULL,
`smilies_popup` varchar(20) NOT NULL default '',
PRIMARY KEY (cat_id)
);

TRUNCATE phpbb_smilies;
ALTER TABLE phpbb_smilies ADD cat_id smallint(5) NOT NULL default '';
ALTER TABLE phpbb_smilies ADD smilies_order smallint(5) NOT NULL default '';

INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_columns', '4');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_rows', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_icon_path', 'images/smiles');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_posting', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_popup', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_buttons', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_random', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_removal1', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_removal2', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('smilie_usergroups', '0');

#
#-----[ OPEN ]-------------------------------------------------
#
modcp.php

#
#-----[ FIND ]-------------------------------------------------
#
if ( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message, $forum_id);
}
if( !$board_config['allow_smilies'] && $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}

#
#-----[ OPEN ]-------------------------------------------------
#
posting.php

#
#-----[ FIND ]-------------------------------------------------
#
if( $smilies_on )
{
if( $userdata['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}

$preview_message = smilies_pass($preview_message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $smilies_on )
{
if( $userdata['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig, $forum_id);
}

$preview_message = smilies_pass($preview_message, $forum_id);
}
else
{
if( $board_config['smilie_removal1'] )
{
$preview_message = smilies_code_removal($preview_message);
}
}

#
#-----[ FIND ]-------------------------------------------------
#
$smilies_status = $lang['Smilies_are_OFF'];

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['smilie_removal1'] )
{
$smilies_status = $lang['Smilies_are_REMOVED'];
}
else
{
$smilies_status = $lang['Smilies_are_OFF'];
}

#
#-----[ FIND ]-------------------------------------------------
#
generate_smilies('inline', PAGE_POSTING);

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] )
{
generate_smilies('inline', PAGE_POSTING, $forum_id);
}

#
#-----[ FIND ]-------------------------------------------------
#
topic_review($topic_id, true);

#
#-----[ REPLACE WITH ]-----------------------------------------
#
topic_review($topic_id, true, $forum_id);

#
#-----[ OPEN ]-------------------------------------------------
#
privmsg.php

#
#-----[ FIND ]-------------------------------------------------
#
if ( $board_config['allow_smilies'] && $privmsg['privmsgs_enable_smilies'] )
{
$private_message = smilies_pass($private_message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] && $privmsg['privmsgs_enable_smilies'] )
{
$private_message = smilies_pass($private_message);
}
else
{
if( $board_config['smilie_removal1'] )
{
$private_message = smilies_code_removal($private_message);
}
}

#
#-----[ FIND ]-------------------------------------------------
#
if ( $smilies_on )
{
$preview_message = smilies_pass($preview_message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $smilies_on )
{
$preview_message = smilies_pass($preview_message);
}
else
{
if( $board_config['smilie_removal1'] )
{
$preview_message = smilies_code_removal($preview_message);
}
}

#
#-----[ FIND ]-------------------------------------------------
#
$smilies_status = $lang['Smilies_are_OFF'];

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['smilie_removal1'] )
{
$smilies_status = $lang['Smilies_are_REMOVED'];
}
else
{
$smilies_status = $lang['Smilies_are_OFF'];
}

#
#-----[ FIND ]-------------------------------------------------
#
generate_smilies('inline', PAGE_PRIVMSGS);

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] )
{
generate_smilies('inline', PAGE_PRIVMSGS, $forum_id = '999');
}

#
#-----[ OPEN ]-------------------------------------------------
#
search.php

#
#-----[ FIND ]-------------------------------------------------
#
if ($board_config['allow_smilies'] && $searchset[$i]['enable_smilies'])
{
$message = smilies_pass($message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] && $searchset[$i]['enable_smilies'] )
{
$message = smilies_pass($message, $forum_id);
}
if( !$board_config['allow_smilies'] && $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}

#
#-----[ OPEN ]-------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]-------------------------------------------------
#
if ( $board_config['allow_smilies'] )
{
if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig);
}

if ( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message);
}
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] )
{
if( $postrow[$i]['user_allowsmile'] && $user_sig != '' )
{
$user_sig = smilies_pass($user_sig, $forum_id);
}

if( $postrow[$i]['enable_smilies'] )
{
$message = smilies_pass($message, $forum_id);
}
}
else
{
if( $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}
}

#
#-----[ OPEN ]-------------------------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]-------------------------------------------------
#
function smilies_pass($message)

#
#-----[ REPLACE WITH ]-----------------------------------------
#
function smilies_pass_old($message)

#
#-----[ FIND ]-------------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start - Smiley Categories MOD
function smilies_pass($message, $forum_id = FALSE)
{
global $board_config;

static $orig, $repl;

if (!isset($orig))
{
global $db, $userdata;
$orig = $repl = array();

$permissions = ( $userdata['session_logged_in'] ) ? (( $userdata['user_level'] == ADMIN ) ? '<= 40' : (( $userdata['user_level'] == MOD ) ? '<= 30' : (( $userdata['user_level'] == USER ) ? '<= 20' : '= 10'))) : '= 10';
$which_forum = ( $forum_id == '999' ) ? "c.cat_forum LIKE '%999%'" : ( $forum_id && $forum_id != '999' ) ? "c.cat_forum LIKE '%" . $forum_id . "%'" : "c.cat_open = 1";

if( $board_config['smilie_usergroups'] )
{
$sql = "SELECT g.group_id
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . "
AND ug.group_id = g.group_id
AND g.group_single_user <> " . TRUE;
if( $result = $db->sql_query($sql) )
{
$group_num = 0;
$array_groups = array();
while( $row = $db->sql_fetchrow($result) )
{
$array_groups[] = $row;
$group_num++;
}

for( $i=0; $i<$group_num; $i++ )
{
$which_forum .= " OR c.cat_group LIKE '%" . $array_groups[$i]['group_id'] . "%'";
}
}
}

$sql = "SELECT s.code, s.smile_url, s.emoticon
FROM " . SMILIES_CAT_TABLE . " c, " . SMILIES_TABLE . " s
WHERE c.cat_perms $permissions
AND $which_forum
AND c.cat_order = s.cat_id";

if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}

$smilies = $db->sql_fetchrowset($result);

if (count($smilies))
{
usort($smilies, 'smiley_sort');
}

for( $i=0; $i<count($smilies); $i++ )
{
$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$repl[] = '<img src="'. $board_config['smilies_path'] . '/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
}
}

if( count($orig) )
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}

if( $board_config['smilie_removal2'] )
{
$message = smilies_code_removal($message);
}

return $message;
}

function smilies_code_removal($message)
{
static $orig, $repl;

if (!isset($orig))
{
global $db, $userdata, $lang;
$orig = $repl = array();

$sql = "SELECT code
FROM " . SMILIES_TABLE;

if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain smilies data", "", __LINE__, __FILE__, $sql);
}

$smilies = $db->sql_fetchrowset($result);

for( $i=0; $i<count($smilies); $i++ )
{
$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$repl[] = $lang['smiley_code_replacement'];
}
}

if( count($orig) )
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}

return $message;
}
// End - Smiley Categories MOD

#
#-----[ OPEN ]-------------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]-------------------------------------------------
#
define('SMILIES_TABLE', $table_prefix.'smilies');

#
#-----[ AFTER, ADD ]-------------------------------------------
#
// Start - Smiley Categories MOD
define('SMILIES_CAT_TABLE', $table_prefix.'smilies_cat');
// End - Smiley Categories MOD

#
#-----[ OPEN ]-------------------------------------------------
#
includes/functions_post.php

#
#-----[ FIND ]-------------------------------------------------
#
function generate_smilies($mode, $page_id)

#
#-----[ REPLACE WITH ]-----------------------------------------
#
function generate_smilies_old($mode, $page_id)

#
#-----[ FIND ]-------------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start - Smiley Categories MOD
//
// The original function has been renamed to
// generate_smilies_old($mode, $page_id)
//
function generate_smilies($mode, $page_id, $forum_id = FALSE)
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
global $user_ip, $session_length, $starttime, $userdata, $HTTP_GET_VARS;

$inline_columns = $board_config['smilie_columns'];
$inline_rows = $board_config['smilie_rows'];
$cat_posting = $board_config['smilie_posting']; // 2 = dropdown, 1 = buttons, 0 = nothing.
$cat_popup = $board_config['smilie_popup']; // 2 = dropdown, 1 = buttons, 0 = nothing.
$cat_buttons = $board_config['smilie_buttons']; // 2 = icon, 1 = name, 0 = number.
$randomise = $board_config['smilie_random']; // 1 = yes, 0 = no.
$cat_id = ( isset($HTTP_GET_VARS['scid']) ) ? intval($HTTP_GET_VARS['scid']) : FALSE;
$forum_id = ( isset($HTTP_GET_VARS['fid']) ) ? intval($HTTP_GET_VARS['fid']) : $forum_id;
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; // For pagination.

if( $mode == 'window' )
{
$userdata = session_pagestart($user_ip, $page_id);
init_userprefs($userdata);
$gen_simple_header = TRUE;
$page_title = $lang['Emoticons'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'smiliesbody' => 'posting_smilies.tpl')
);
$sql_select = 'cat_name, cat_order, smilies_popup';
}
else
{
$sql_select = 'cat_name, description, cat_order, cat_icon_url';
}

if( !($userdata['session_logged_in']) && ($forum_id == '999') ) { message_die(GENERAL_MESSAGE, $lang['Login_check_pm']); }

$permissions = ( $userdata['session_logged_in'] ) ? (( $userdata['user_level'] == ADMIN ) ? 'cat_perms <= 40' : (( $userdata['user_level'] == MOD ) ? 'cat_perms <= 30' : (( $userdata['user_level'] == USER ) ? 'cat_perms <= 20' : 'cat_perms = 10'))) : 'cat_perms = 10';
$which_forum = ( $forum_id == '999' ) ? "cat_forum LIKE '%999%'" : ( $forum_id && $forum_id != '999' ) ? "cat_forum LIKE '%" . $forum_id . "%'" : "cat_open = 1";

if( $board_config['smilie_usergroups'] )
{
$sql = "SELECT g.group_id
FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . "
AND ug.group_id = g.group_id
AND g.group_single_user <> " . TRUE;
if( $result = $db->sql_query($sql) )
{
$group_num = 0;
$array_groups = array();
while( $row = $db->sql_fetchrow($result) )
{
$array_groups[] = $row;
$group_num++;
}

for( $i=0; $i<$group_num; $i++ )
{
$which_forum .= " OR cat_group LIKE '%" . $array_groups[$i]['group_id'] . "%'";
}
}
}

$which_forum .= ( $forum_id && $forum_id != '999' ) ? (( $userdata['session_logged_in'] ) ? (( $userdata['user_level'] == ADMIN ) ? '' : (( $userdata['user_level'] == MOD ) ? ' AND (cat_special = ' . $userdata['user_level'] . ' OR cat_special = -2)' : (( $userdata['user_level'] == USER ) ? ' AND (cat_special = ' . $userdata['user_level'] . ' OR cat_special = -2)' : ' AND cat_special = -2'))) : ' AND cat_special = -2') : '';

$sql = "SELECT $sql_select
FROM " . SMILIES_CAT_TABLE . "
WHERE $permissions
AND $which_forum
ORDER BY cat_order
ASC";
if( $result = $db->sql_query($sql) )
{
if( $total_cats = $db->sql_numrows($result) )
{
$cat_count = 0;
$rowset = array();
$array_order = array();
while( $row1 = $db->sql_fetchrow($result) )
{
$array_order[$row1['cat_order']] = $cat_count;
$rowset[$cat_count]['cat_name'] = htmlspecialchars(str_replace("'", "\\'", str_replace('\\', '\\\\', $row1['cat_name'])));
$rowset[$cat_count]['cat_order'] = $row1['cat_order'];

if( $mode == 'window' )
{
$rowset[$cat_count]['smilies_popup'] = $row1['smilies_popup'];
}
if( $mode == 'inline' )
{
if( $cat_buttons == 2 )
{
$rowset[$cat_count]['cat_icon_url'] = $row1['cat_icon_url'];
}
if( $cat_posting )
{
$rowset[$cat_count]['description'] = htmlspecialchars(str_replace("'", "\\'", str_replace('\\', '\\\\', $row1['description'])));
}
}
$cat_count++;
}

if( $cat_id )
{ // If $cat_id exists, check the user has permission else use 1st default category.
for( $i=0; $i<$cat_count; $i++ )
{
if( $rowset[$i]['cat_order'] == $cat_id )
{
$cat = $cat_id;
break;
}
}
if( !$cat )
{
$cat = $rowset[0]['cat_order'];
}
}
else
{
$cat = $rowset[0]['cat_order'];
}

$sql2 = "SELECT code, smile_url, emoticon
FROM " . SMILIES_TABLE . "
WHERE cat_id = $cat
ORDER BY smilies_order
ASC";
if( $result2 = $db->sql_query($sql2) )
{
$num_smilies = 0;
$rowset2 = array();
$rowset3 = array();
while( $row2 = $db->sql_fetchrow($result2) )
{
if( empty($rowset3[$row2['smile_url']]) )
{
$rowset3[$row2['smile_url']] = $row2['smile_url'];

$rowset2[$num_smilies]['smile_url'] = $row2['smile_url'];
$rowset2[$num_smilies]['code'] = str_replace("'", "\\'", str_replace('\\', '\\\\', $row2['code']));
$rowset2[$num_smilies]['emoticon'] = $row2['emoticon'];

$num_smilies++;
}
}
unset($rowset3);

list($width, $height, $group_columns, $list_columns, $smiley_group, $smilies_per_page) = explode("|", $rowset[$array_order[$cat]]['smilies_popup']);

if( $num_smilies )
{
// Calculations for pagination.
if ( ($mode == 'inline') || ($smilies_per_page == 0) )
{
$per_page = $num_smilies;
$smiley_start = 0;
$smiley_stop = $num_smilies;
}
else
{
$per_page = ( $smilies_per_page > $num_smilies ) ? $num_smilies : $smilies_per_page;
$page_num = ( $start <= 0 ) ? 1 : ($start / $per_page) + 1;
$smiley_start = ($per_page * $page_num) - $per_page;
$smiley_stop = ( ($per_page * $page_num) > $num_smilies ) ? $num_smilies : $smiley_start + $per_page;
}
if( $mode == 'inline' )
{
if( $randomise )
{
shuffle($rowset2);
}
$smilies_split_row = $inline_columns - 1;
$inline = TRUE;
}
else
{
if( $smiley_group && $list_columns != 0 )
{
$template->assign_block_vars('smiley_list', array());
$group = 'smiley_list.';
$smilies_split_row = $list_columns - 1;
}
else
{
$template->assign_block_vars('smiley_group', array());
$group = 'smiley_group.';
$smilies_split_row = $group_columns - 1;
}
$inline = FALSE;
}

$s_colspan = 0;
$row = 0;
$col = 0;

for( $i=$smiley_start; $i<$smiley_stop; $i++ )
{ // Start outputting the smilies.
if( !$col )
{
$template->assign_block_vars($group . 'smilies_row', array());
}

$template->assign_block_vars($group . 'smilies_row.smilies_col', array(
'SMILEY_CODE' => $rowset2[$i]['code'],
'SMILEY_CODE2' => str_replace("\\", "", $rowset2[$i]['code']),
'SMILEY_IMG' => $board_config['smilies_path'] . '/' . $rowset2[$i]['smile_url'],
'SMILEY_DESC' => $rowset2[$i]['emoticon'])
);

$s_colspan = max($s_colspan, $col + 1);

if( $col == $smilies_split_row )
{
if( ($inline && $row == $inline_rows - 1) || (!$inline && $row == $per_page) )
{
break;
}
$col = 0;
$row++;
}
else
{
$col++;
}

}
if( !$inline && $smiley_group && ($list_columns != 0) && ($col != '0') && ($col < $per_page) && ($row != '0') )
{
$template->assign_block_vars('smiley_list.smilies_row.smilies_odd', array(
'S_SMILIES_ODD_COLSPAN' => ($list_columns - $col) * 2)
);
}
}

$template->assign_vars(array(
'L_EMOTICONS' => $lang['Emoticons'],
'S_SMILIES_COLSPAN' => ( $num_smilies ) ? $s_colspan : 1)
);
} // End - $result2 = $db->sql_query($sql2)

if( ($cat_posting && ($mode == 'inline') && ($cat_count != 1)) || ($cat_popup && ($mode == 'window') && ($cat_count != 1)) )
{ // Display the categories.
$template->assign_block_vars('smiley_category', array());

$template->assign_vars(array(
'L_SMILEY_CATEGORIES' => $lang['smiley_categories'])
);

if( (($cat_posting == 1) && ($mode == 'inline')) || (($cat_popup == 1) && ($mode == 'window')) )
{ // Do buttons.
for( $i=0; $i<$cat_count; $i++ )
{
$j = $i+1;
if( $mode == 'inline' )
{
$template->assign_block_vars('category_help', array(
'NAME' => 'cat' . $j,
'HELP' => $rowset[$i]['description'])
);
}
// What to put on the buttons, a number or a name or an image?
$value = ( $cat_buttons == 0 ) ? 'value=" ' . $j . ' "' : (( $cat_buttons == 1 ) ? 'value="' . $rowset[$i]['cat_name'] . '"' : ( $cat_buttons == 2 ) ? (( $rowset[$i]['cat_icon_url'] ) ? 'src="' . $phpbb_root_path . $board_config['smilie_icon_path'] . '/' . $rowset[$i]['cat_icon_url'] . '"' : $value = 'value="' . $rowset[$i]['cat_name'] . '"') : 'value=" ' . $j . ' "');
$type = ( ($cat_buttons == 0) || ($cat_buttons == 1) || ($cat_buttons == 2 && !$rowset[$i]['cat_icon_url']) ) ? 'type="button" class="button" title="' . $rowset[$i]['description'] . '"' : 'type="image" title="' . $rowset[$i]['description'] . '"';

$template->assign_block_vars('smiley_category.buttons', array(
'VALUE' => $value,
'TYPE' => $type,
'NAME' => 'cat' . $j,
'CAT_MORE_SMILIES' => ( $forum_id ) ? append_sid("posting.$phpEx?mode=smilies&scid=" . $rowset[$i]['cat_order'] . "&fid=" . $forum_id) : append_sid("posting.$phpEx?mode=smilies&scid=" . $rowset[$i]['cat_order']))
);
}
}
else if( (($cat_posting == 2) && ($mode == 'inline')) || (($cat_popup == 2) && ($mode == 'window')) )
{ // Do dropdown menu.
if( $mode == 'inline' )
{
$template->assign_block_vars('category_help', array(
'NAME' => 'smile_cats',
'HELP' => $lang['smiley_help'])
);
}

$select_menu = ( $mode == 'inline' ) ? '<select name="cat" onChange="window.open(this.options[this.selectedIndex].value, \'_phpbbsmilies\', \'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=410\'); return false;" onMouseOver="helpline(\'smile_cats\')">' : '<select name="cat" onChange="********.href=this.options[this.selectedIndex].value;">';
$select_menu .= ( $forum_id ) ? '<option value="' . append_sid("posting.$phpEx?mode=smilies&scid=" . $cat . "&fid=" . $forum_id) . '">' . $lang['Select'] . '</option>' : '<option value="' . append_sid("posting.$phpEx?mode=smilies&scid=" . $cat) . '">' . $lang['Select'] . '</option>';

for( $i=0; $i<$cat_count; $i++ )
{
$selected = ( $rowset[$i]['cat_order'] == $cat_id ) ? ' selected="selected"' : '';
$select_menu .= ( $forum_id ) ? '<option value="' . append_sid("posting.$phpEx?mode=smilies&scid=" . $rowset[$i]['cat_order'] . "&fid=" . $forum_id) . '"' . $selected . '>' . $rowset[$i]['cat_name'] . '</option>' : '<option value="' . append_sid("posting.$phpEx?mode=smilies&scid=" . $rowset[$i]['cat_order']) . '"' . $selected . '>' . $rowset[$i]['cat_name'] . '</option>';
}

$select_menu .= '</select>';

$template->assign_block_vars('smiley_category.dropdown', array(
'OPTIONS' => $select_menu)
);
}
}
else
{ // Don't display any categories.
if( $mode == 'inline')
{ // If categories for posting are 'off' then display 'more emoticons' text link,
// but only if categories for the popup window are 'on' or total smilies is greater
// than what is displayed in the inline block.
if( $cat_popup || ($num_smilies > $inline_rows * $inline_columns) )
{
$template->assign_block_vars('switch_smilies_extra', array());

$template->assign_vars(array(
'L_MORE_SMILIES' => $lang['More_emoticons'],
'U_MORE_SMILIES' => ( $forum_id ) ? append_sid("posting.$phpEx?mode=smilies&scid=" . $cat . "&fid=" . $forum_id) : append_sid("posting.$phpEx?mode=smilies&scid=" . $cat))
);
}
}
} // End - displaying categories.

if( $mode == 'window' )
{
$pagination = ( $num_smilies ) ? (( $forum_id ) ? generate_pagination("posting.$phpEx?mode=smilies&scid=$cat&fid=$forum_id", $num_smilies, $per_page, $start, FALSE) : generate_pagination("posting.$phpEx?mode=smilies&scid=$cat", $num_smilies, $per_page, $start, FALSE)) : '';

$template->assign_vars(array(
'COPYRIGHT' => '<a href="http://mods.afkamm.co.uk" target="_blank" class="copyright">Smiley Categories MOD</a> © 2004, 2006 Afkamm',
'L_CLOSE_WINDOW' => $lang['Close_window'],
'S_WIDTH' => $width,
'S_HEIGHT' => $height,
'PAGINATION' => $pagination)
);

$template->pparse('smiliesbody');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}

} // End - if( $total_cats )
else
{
$template->assign_vars(array(
'L_EMOTICONS' => $lang['Emoticons'],
'S_SMILIES_COLSPAN' => 1)
);
}
} // End - $result = $db->sql_query($sql)
}
// End - Smiley Categories MOD

#
#-----[ OPEN ]-------------------------------------------------
#
includes/topic_review.php

#
#-----[ FIND ]-------------------------------------------------
#
function topic_review($topic_id, $is_inline_review)

#
#-----[ REPLACE WITH ]-----------------------------------------
#
function topic_review($topic_id, $is_inline_review, $forum_id = FALSE)

#
#-----[ FIND ]-------------------------------------------------
#
if ( $board_config['allow_smilies'] && $row['enable_smilies'] )
{
$message = smilies_pass($message);
}

#
#-----[ REPLACE WITH ]-----------------------------------------
#
if( $board_config['allow_smilies'] && $row['enable_smilies'] )
{
$message = smilies_pass($message, $forum_id);
}
if( !$board_config['allow_smilies'] && $board_config['smilie_removal1'] )
{
$message = smilies_code_removal($message);
}

#
#-----[ OPEN ]-------------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]-------------------------------------------------
#
$lang['More_emoticons'] = 'View more Emoticons';

#
#-----[ AFTER, ADD ]-------------------------------------------
#
// Start - Smiley Categories MOD
$lang['smiley_categories'] = 'Smiley Categories';
$lang['smiley_help'] = 'Select the category that you wish to have appear in the popup window.';
$lang['smiley_code_replacement'] = '(smiley)'; // If you wish to replace the code with a word, enter it here, or leave empty.
$lang['Smilies_are_REMOVED'] = 'Smilies are <u>REMOVED</u>';
// End - Smiley Categories MOD

#
#-----[ OPEN ]-------------------------------------------------
#
templates/subSilver/posting_body.tpl

#
#-----[ FIND ]-------------------------------------------------
#
f_help = "{L_BBCODE_F_HELP}";

#
#-----[ AFTER, ADD ]-------------------------------------------
#
// Start - Smiley Categories MOD
<!-- BEGIN category_help -->
{category_help.NAME}_help = "{category_help.HELP}";
<!-- END category_help -->
// End - Smiley Categories MOD

#
#-----[ FIND ]-------------------------------------------------
#
<!-- BEGIN smilies_col -->
<td><a href="javascript:emoticon('{smilies_row.smilies_col.SMILEY_CODE}')"><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>
<!-- END smilies_col -->

#
#-----[ REPLACE WITH ]-----------------------------------------
#
<!-- BEGIN smilies_col -->
<td><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('{smilies_row.smilies_col.SMILEY_CODE}');" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></td>
<!-- END smilies_col -->

#
#-----[ FIND ]-------------------------------------------------
#
<!-- END switch_smilies_extra -->
</table>
</td>
</tr>

#
#-----[ AFTER, ADD ]-------------------------------------------
#
<!-- BEGIN smiley_category -->
<tr>
<td align="center" class="gensmall"><br /><b>{L_SMILEY_CATEGORIES}</b></td>
</tr>
<!-- BEGIN buttons -->
<tr><td align="center"><input {smiley_category.buttons.TYPE} name="_phpbbsmilies" {smiley_category.buttons.VALUE} onClick="window.open('{smiley_category.buttons.CAT_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=410'); return false;" onMouseOver="helpline('{smiley_category.buttons.NAME}')" /></td></tr>
<!-- END buttons -->
<!-- BEGIN dropdown -->
<tr><td align="center">{smiley_category.dropdown.OPTIONS}</td></tr>
<!-- END dropdown -->
<!-- END smiley_category -->

#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------
#
# EoM
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.