Оценяване на теми/мнения/потребители
Автор: bucata
Необходими файлове – оставил съм и оригиналния файл , ако някой инсталира модовете с easyMod.
Мода е иключително полезен, зощото от администраторския панел можете да настройвате всичко.Да се показват ли точките , да се оценяват само темите/мненията/потребтелите….Най-долу съм дал снимка на админ панела и демо сайт.
#################################################################
## Име: Беше ли това мнение/тема полезно
## Автор: Wicher < N/A > (N/A) http://www.detecties.com/modforum
## Описание: Това е много полезен мод с помоща на който може да гласуване
## за мнение или за тема
## Точки се дават както на темата така и на отделния потребител
## чиито мнение ви е помогнало най-много
##
##
##
## MOD Version: 1.0.1
##
## Трудност: лесно
## Време: 20 минути
##
## Файлове за промяна:
## - memberlist.php
## - viewtopic.php
## - viewforum.php
## - admin/admin_board.php
## - includes/constants.php
## - includes/prune.php
## - includes/usercp_viewprofile.php
## - language/lang_english/lang_main.php
## - templates/вашия темплейт/memberlist_body.tpl
## - templates/вашия темплейтr/subSilver.cfg
## - templates/вашия темплейт/profile_view_body.tpl
## - templates/вашия темплейт/viewtopic_body.tpl
## - templates/вашия темплейт/viewforum_body.tpl
## - templates/вашия темплейт/admin/board_config_body.tpl
##
## Файлове за добавяне
## - admin/admin_helpful.php
## - templates/вашия темплейт/admin/helpful_config_body.tpl
## - templates/вашия темплейт/images/lang_english/yes.gif
## - templates/вашия темплейт/images/lang_english/no.gif
## - templates/вашия темплейт/images/gradiation_start-end.gif
## - templates/вашия темплейт/images/gradiation_green.gif
## - templates/вашия темплейт/images/gradiation_red.gif
## - templates/вашия темплейт/images/gradiation_trans.gif
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##
##############################################################
##############################################################
## Задължително направете копия на файловете които ще променяте
##############################################################
#
#-----Добавете в база данни ------------------------------------------
#
CREATE TABLE `phpbb_helpful_postvotes` (
`vote_id` mediumint(8) NOT NULL auto_increment,
`user_id` mediumint(8) NOT NULL default '0',
`post_id` mediumint(8) NOT NULL default '0',
`vote_time` int(11) NOT NULL default '0',
`min_plus` varchar(4) NOT NULL default '',
PRIMARY KEY (`vote_id`),
KEY `user_id` (`user_id`)
);
CREATE TABLE `phpbb_helpful_topicvotes` (
`vote_id` mediumint(8) NOT NULL auto_increment,
`user_id` mediumint(8) NOT NULL default '0',
`topic_id` mediumint(8) NOT NULL default '0',
`vote_time` int(11) NOT NULL default '0',
`min_plus` varchar(4) NOT NULL default '0',
PRIMARY KEY (`vote_id`),
KEY `user_id` (`user_id`)
);
ALTER TABLE phpbb_users ADD user_helpfulpoints INT(10) NOT NULL DEFAULT 0;
ALTER TABLE phpbb_topics ADD topic_helpfulpoints INT(10) NOT NULL DEFAULT 0;
ALTER TABLE phpbb_posts ADD helpful_points INT(10) NOT NULL DEFAULT 0;
INSERT INTO phpbb_config(config_name, config_value) VALUES('helpful_topic_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('helpful_post_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('helpful_vf_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('helpful_vfg_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('helpful_vfp_on_off', '0');
INSERT INTO phpbb_config(config_name, config_value) VALUES('tg_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('pg_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('tp_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('pp_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('up_on_off', '1');
INSERT INTO phpbb_config(config_name, config_value) VALUES('hm_time_window', '86400');
INSERT INTO phpbb_config(config_name, config_value) VALUES('hm_guest_allow', '0');
INSERT INTO phpbb_config(config_name, config_value) VALUES('hm_guest_visable', '0');
#
#-----[ Копирайте ]------------------------------------------
#
Копирайте root/admin/admin_helpful.php to admin/admin_helpful.php
Копирайте root/templates/subSilver/admin/helpful_config_body.tpl to templates/вашия темплейт/admin/helpful_config_body.tpl
Копирайте root/templates/subSilver/images/gradiation_start-end.gif to templates/вашия темплейт/images/gradiation_start-end.gif
Копирайте root/templates/subSilver/images/gradiation_green.gif to templates/вашия темплейт/images/gradiation_green.gif
Копирайте root/templates/subSilver/images/gradiation_red.gif to templates/вашия темплейт/images/gradiation_red.gif
Копирайте root/templates/subSilver/images/gradiation_trans.gif to templates/вашия темплейт/images/gradiation_trans.gif
Копирайте root/templates/subSilver/images/lang_english/helpful_yes.gif to templates/вашия темплейт/images/lang_english/helpful_yes.gif
Копирайте root/templates/subSilver/images/lang_english/helpful_no.gif to templates/вашия темплейт/images/lang_english/helpful_no.gif
Копирайте root/templates/subSilver/images/lang_english/helpful_points_back.gif to templates/вашия темплейт/images/lang_english/helpful_points_back.gif
#
#-----[ Oтворете ]------------------------------------------
#
memberlist.php
#
#-----[ Намерете ]------------------------------------------
#
$mode_types_text = array($lang['Sort_Joined']
#
#-----[ На същия ред намерете ]------------------------------------------
#
, $lang['Sort_Top_Ten']
#
#-----[ Точно след него добавете ]------------------------------------------
#
, $lang['Points']
#
#-----[ Намерете ]------------------------------------------
#
$mode_types = array('joined'
#
#-----[ На същия ред намерете ]------------------------------------------
#
, 'topten'
#
#-----[ Точно след него добавете ]------------------------------------------
#
, 'points'
#
#-----[ Намерете ]------------------------------------------
#
'L_POSTS' => $lang['Posts'],
#
#-----[ След него добавете ]------------------------------------------
#
'L_POINTS' => $lang['Points'],
#
#-----[ Намерете ]------------------------------------------
#
case 'topten':
$order_by = "user_posts $sort_order LIMIT 10";
break;
#
#-----[ След него добавете ]------------------------------------------
#
case 'points':
$order_by = "user_helpfulpoints $sort_order LIMIT $start, " . $board_config['topics_per_page'];
break;
#
#-----[ Намерете ]------------------------------------------
#
$sql = "SELECT username, user_id
#
#-----[ На същия ред намерете ]------------------------------------------
#
, user_allowavatar
#
#-----[ Точно след него добавете ]------------------------------------------
#
, user_helpfulpoints
#
#-----[ Намерете ]------------------------------------------
#
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
#
#-----[ След него добавете ]------------------------------------------
#
$points = ( $row['user_helpfulpoints'] ) ? $row['user_helpfulpoints'] : 0;
#
#-----[ Намерете ]------------------------------------------
#
'POSTS' => $posts,
#
#-----[ След него добавете ]------------------------------------------
#
'POINTS' => $points,
#
#-----[ Отворете ]------------------------------------------
#
viewtopic.php
#
#-----[ Намерете ]------------------------------------------
#
$sql = "SELECT t.topic_id, t.topic_title
#
#-----[ На същия ред намерете ]------------------------------------------
#
, t.topic_title
#
#-----[ Точно след него добавете ]------------------------------------------
#
, topic_poster, topic_helpfulpoints
#
#-----[ Намерете ]------------------------------------------
#
//
// End session management
//
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
if ((!$userdata['session_logged_in'] && $board_config['hm_guest_allow']) || ($userdata['session_logged_in']))
{
$allow_vote = 1;
$add_mess = '';
}
else
{
$allow_vote = 0;
$redirect = ($post_id) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
$redirect .= ($start) ? "&start=$start" : '';
$add_mess = $lang['or1'] . '<a href="' . append_sid("login.".$phpEx) . '?redirect=viewtopic.'.$phpEx.'&'.$redirect . '">' . $lang['Login'] . '</a>' . $lang['or2'];
}
$startat = ($start) ? "&start=$start" : '';
if ( isset($HTTP_GET_VARS['helpful']) )
{
if ($board_config['hm_time_window'] == 60){$hm_time = $lang['1minute'];}
if ($board_config['hm_time_window'] == 300){$hm_time = $lang['5minutes'];}
if ($board_config['hm_time_window'] == 1800){$hm_time = $lang['30minutes'];}
if ($board_config['hm_time_window'] == 3600){$hm_time = $lang['60minutes'];}
if ($board_config['hm_time_window'] == 86400){$hm_time = $lang['24hours'];}
if ($board_config['hm_time_window'] == 604800){$hm_time = $lang['7days'];}
if ($board_config['hm_time_window'] == 2630880){$hm_time = $lang['1month'];}
if ($board_config['hm_time_window'] == 31570560){$hm_time = $lang['1year'];}
if ($board_config['hm_time_window'] == 3157056000){$hm_time = $lang['1century'];}
if ($post_id)
{
$min_plus = htmlspecialchars($HTTP_GET_VARS['helpful']);
$posterid = intval($HTTP_GET_VARS['posterid']);
if ($posterid != $userdata['user_id'])
{
// 1sec, 1 minute, 1 hour, 1 day, 1 week, 1 month, 1 year, 1 century
// 1, 60, 3600, 86400, 604800, 2630880, 31570560, 3157056000
$sql = "DELETE FROM " . HELPFUL_POST_TABLE . "
WHERE vote_time < " . (time() - $board_config['hm_time_window']);
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete helpful vote data", '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT * FROM " . HELPFUL_POST_TABLE . "
WHERE post_id = " . $post_id . "
AND user_id = " . $userdata['user_id'] . "
AND vote_time > " . (time() - $board_config['hm_time_window']) . "
ORDER BY vote_time DESC LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain helpful vote data", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$this_post_voted = intval($row['vote_time']);
}
if (!$this_post_voted && $allow_vote)
{
if ($min_plus == 'plus')
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_helpfulpoints = user_helpfulpoints + 1
WHERE user_id = " . $posterid;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update users points', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . POSTS_TABLE . "
SET helpful_points = helpful_points + 1
WHERE post_id = " . $post_id;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update post points', '', __LINE__, __FILE__, $sql);
}
}
if ($min_plus == 'min')
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_helpfulpoints = user_helpfulpoints - 1
WHERE user_id = " . $posterid;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update users points', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . POSTS_TABLE . "
SET helpful_points = helpful_points - 1
WHERE post_id = " . $post_id;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update post points', '', __LINE__, __FILE__, $sql);
}
}
$sql = "INSERT INTO " . HELPFUL_POST_TABLE . " (user_id, post_id, vote_time, min_plus)
VALUES (" . $userdata['user_id'] . ", " . $post_id . ", " . time() . ", '$min_plus')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert helpful data for posts", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['postpoints_given'].$hm_time.'.<br />'.$lang['Click'].' <a href="' . append_sid("viewtopic.".$phpEx."?".POST_POST_URL."=".$post_id) . $startat . '#' . $post_id . '">'.$lang['here'].'</a> '.$lang['return_post']);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['cannot_post'] . $lang['Click'] . ' <a href="' . append_sid("viewtopic.".$phpEx."?".POST_POST_URL."=".$post_id) . $startat . '#' . $post_id . '">'.$lang['here'].'</a> '.$lang['return_post']);
}
}
else
{
$min_plus = htmlspecialchars($HTTP_GET_VARS['helpful']);
$topic_poster_id = intval($forum_topic_data['topic_poster']);
if ($topic_poster_id != $userdata['user_id'])
{
// 1sec, 1 minute, 1 hour, 1 day, 1 week, 1 month, 1 year, 1 century
// 1, 60, 3600, 86400, 604800, 2630880, 31570560, 3157056000
$sql = "DELETE FROM " . HELPFUL_TOPIC_TABLE . "
WHERE vote_time < " . (time() - $board_config['hm_time_window']);
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not delete helpful vote data", '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT * FROM " . HELPFUL_TOPIC_TABLE . "
WHERE topic_id = " . $topic_id . "
AND user_id = " . $userdata['user_id'] . "
AND vote_time > " . (time() - $board_config['hm_time_window']) . "
ORDER BY vote_time DESC LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not obtain helpful vote data", '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$this_topic_voted = intval($row['vote_time']);
}
if (!$this_topic_voted && $allow_vote)
{
if ($min_plus == 'plus')
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_helpfulpoints = topic_helpfulpoints + 1
WHERE topic_id = " . $topic_id;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update topic points', '', __LINE__, __FILE__, $sql);
}
$forum_topic_data['topic_helpfulpoints'] = $forum_topic_data['topic_helpfulpoints'] + 1;
}
if ($min_plus == 'min')
{
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_helpfulpoints = topic_helpfulpoints - 1
WHERE topic_id = " . $topic_id;
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not update topic points', '', __LINE__, __FILE__, $sql);
}
$forum_topic_data['topic_helpfulpoints'] = $forum_topic_data['topic_helpfulpoints'] - 1;
}
$sql = "INSERT INTO " . HELPFUL_TOPIC_TABLE . " (user_id, topic_id, vote_time, min_plus)
VALUES (" . $userdata['user_id'] . ", " . $topic_id . ", " . time() . ", '$min_plus')";
if ( !$db->sql_query($sql, END_TRANSACTION) )
{
message_die(GENERAL_ERROR, "Could not insert helpful data for topics", "", __LINE__, __FILE__, $sql);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['topicpoints_given'].$hm_time.'.'.$add_mess.'<br />'.$lang['Click'].' <a href="' . append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id) . $startat . '">'.$lang['here'].'</a> '.$lang['return_topic']);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['cannot_topic'].$lang['Click'].' <a href="' . append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id) . $startat . '">'.$lang['here'].'</a> '.$lang['return_topic']);
}
}
}
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website
#
#-----[ На същия ред намерете ]------------------------------------------
#
, u.user_allowsmile
#
#-----[ Точно след него добавете ]------------------------------------------
#
, u.user_helpfulpoints
#
#-----[ Намерете ]------------------------------------------
#
//
// Send vars to template
//
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
$topic_helpfulpoints = intval($forum_topic_data['topic_helpfulpoints']);
if ($topic_helpfulpoints > 0)
{
$topic_gradient_img = $images['gradient_green'];
if ($topic_helpfulpoints > 100)
{
$topic_gradient_width = 100;
}
else
{
$topic_gradient_width = $topic_helpfulpoints;
}
}
else if ($topic_helpfulpoints < 0)
{
$topic_gradient_img = $images['gradient_red'];
if ($topic_helpfulpoints < -99)
{
$topic_gradient_width = 100;
}
else
{
$topic_gradient_width = 100-($topic_helpfulpoints + 100);
}
}
else
{
$topic_gradient_img = $images['gradient_trans'];
$topic_gradient_width = 0;
}
$topic_gradient_trans_width = 100 - $topic_gradient_width;
$startat = ($start) ? "&start=$start" : '';
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
'S_WATCH_TOPIC_IMG' => $s_watching_topic_img,
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
'HELPFUL_YES_IMG' => $images['helpful_yes'],
'HELPFUL_NO_IMG' => $images['helpful_no'],
'HELPFUL_POINTS_BACK_IMG' => $images['helpful_points_back'],
'L_TOPIC_HELPFUL_POINTS' => $lang['topic_helpful_points'],
'U_HELPFUL_PLUS_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=".$topic_id).'&helpful=plus'.$startat,
'U_HELPFUL_MIN_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=".$topic_id).'&helpful=min'.$startat,
'L_WAS_HELPFUL' => $lang['was_helpful'],
'L_POST_POINTS' => $lang['this_post_points'],
'L_WAS_TOPIC_HELPFUL' => $lang['was_topic_helpful'],
'HELPFUL_TOPIC_POINTS' => intval($forum_topic_data['topic_helpfulpoints']),
'L_TOPIC_GRADIENT' => $lang['topic_gradient'],
'L_POST_GRADIENT' => $lang['post_gradient'],
'GRADIENT_START_END_IMG' => $images['gradient_start_end'],
'GRADIENT_TRANS_IMG' => $images['gradient_trans'],
'GRADIENT_IMG' => $topic_gradient_img,
'GRADIENT_WIDTH' => $topic_gradient_width,
'GRADIENT_TRANS_WIDTH' => $topic_gradient_trans_width,
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
$template->assign_block_vars('postrow', array(
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
$helpful_points = intval($postrow[$i]['helpful_points']);
if ($helpful_points > 0)
{
$post_gradient_img = $images['gradient_green'];
if ($helpful_points > 100)
{
$post_gradient_width = 100;
}
else
{
$post_gradient_width = $helpful_points;
}
}
else if ($helpful_points < 0)
{
$post_gradient_img = $images['gradient_red'];
if ($helpful_points < -99)
{
$post_gradient_width = 100;
}
else
{
$post_gradient_width = 100-($helpful_points+100);
}
}
else
{
$post_gradient_img = $images['gradient_trans'];
$post_gradient_width = 0;
}
$post_gradient_trans_width = 100 - $post_gradient_width;
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
'POSTER_AVATAR' => $poster_avatar,
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
'POST_POINTS' => $postrow[$i]['helpful_points'],
'HELPFUL_POINTS' => $postrow[$i]['user_helpfulpoints'],
'L_USERS_POINTS' => ($poster_id != $userdata['user_id']) ? $lang['this_user_points'] : $lang['your_points'],
'GRADIENT_IMG' => $post_gradient_img,
'GRADIENT_WIDTH' => $post_gradient_width,
'GRADIENT_TRANS_WIDTH' => $post_gradient_trans_width,
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
'U_MINI_POST' => $mini_post_url,
'U_POST_ID' => $postrow[$i]['post_id'])
);
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
if ((!$userdata['session_logged_in'] && $board_config['hm_guest_visable']) || ($userdata['session_logged_in']))
{
$allow_view = 1;
}
else
{
$allow_view = 0;
}
if ($board_config['helpful_post_on_off'] && $allow_view)
{
$template->assign_block_vars('postrow.switch_helpful_on', array() );
if ($poster_id != $userdata['user_id'])
{
if ($allow_view)
{
$startat = ($start) ? "&start=$start" : '';
$template->assign_block_vars('postrow.switch_helpful_buttons', array(
'U_HELPFUL_PLUS_POST' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=".$postrow[$i]['post_id']).'&helpful=plus&posterid='.$poster_id.$startat.'#'.$postrow[$i]['post_id'],
'U_HELPFUL_MIN_POST' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=".$postrow[$i]['post_id']).'&helpful=min&posterid='.$poster_id.$startat.'#'.$postrow[$i]['post_id'],
'L_WAS_HELPFUL' => $lang['was_helpful'])
);
}
}
if ($board_config['pg_on_off'] && $allow_view)
{
$template->assign_block_vars('postrow.switch_pg_on_off', array(
'GRADIENT_IMG' => $post_gradient_img,
'GRADIENT_WIDTH' => $post_gradient_width,
'GRADIENT_TRANS_WIDTH' => $post_gradient_trans_width)
); // post gradient
}
if ($board_config['pp_on_off'] && $allow_view)
{
$template->assign_block_vars('postrow.switch_pp_on_off', array(
'POST_POINTS' => $postrow[$i]['helpful_points'])
); // post points
}
if ($board_config['up_on_off'] && $allow_view)
{
$template->assign_block_vars('postrow.switch_up_on_off', array(
'HELPFUL_POINTS' => $postrow[$i]['user_helpfulpoints'],
'L_USERS_POINTS' => ($poster_id != $userdata['user_id']) ? $lang['this_user_points'] : $lang['your_points'])
); // user points
}
}
else
{
$template->assign_block_vars('postrow.switch_helpful_off', array() );
}
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
$template->pparse('body');
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
if ((!$userdata['session_logged_in'] && $board_config['hm_guest_visable']) || ($userdata['session_logged_in']))
{
$allow_view = 1;
}
else
{
$allow_view = 0;
}
if ($board_config['helpful_topic_on_off'] && $allow_view)
{
$template->assign_block_vars('switch_helpful_on_off', array()); // mod on/off
if ($board_config['tg_on_off'])
{
$template->assign_block_vars('switch_tg_on_off', array()); // topic gradient
}
if ($board_config['tp_on_off'])
{
$template->assign_block_vars('switch_tp_on_off', array()); // topic points
}
}
// Was This Post/Topic Helpful By Wicher
#
#-----[ Отворете ]------------------------------------------
#
viewforum.php
#
#-----[ Намерете ]------------------------------------------
#
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
'L_TOPIC_HELPFUL_POINTS' => $lang['topic_helpful_points'],
'HELPFUL_POINTS_BACK_IMG' => $images['helpful_points_back'],
'GRADIENT_START_END_IMG' => $images['gradient_start_end'],
'GRADIENT_TRANS_IMG' => $images['gradient_trans'],
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
$template->assign_block_vars('topicrow', array(
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
$topic_helpfulpoints = intval($topic_rowset[$i]['topic_helpfulpoints']);
if ($topic_helpfulpoints > 0)
{
$topic_gradient_img = $images['gradient_green'];
if ($topic_helpfulpoints > 100)
{
$topic_gradient_width = 100;
}
else
{
$topic_gradient_width = $topic_helpfulpoints;
}
}
else if ($topic_helpfulpoints < 0)
{
$topic_gradient_img = $images['gradient_red'];
if ($topic_helpfulpoints < -99)
{
$topic_gradient_width = 100;
}
else
{
$topic_gradient_width = 100-($topic_helpfulpoints + 100);
}
}
else
{
$topic_gradient_img = $images['gradient_trans'];
$topic_gradient_width = 0;
}
$topic_gradient_trans_width = 100 - $topic_gradient_width;
// Was This Post/Topic Helpful By Wicher
#
#-----[ Намерете ]------------------------------------------
#
'U_VIEW_TOPIC' => $view_topic_url)
);
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
if ((!$userdata['session_logged_in'] && $board_config['hm_guest_visable']) || ($userdata['session_logged_in']))
{
$allow_view = 1;
}
else
{
$allow_view = 0;
}
if ($board_config['helpful_vfp_on_off'] && $allow_view)
{
$template->assign_block_vars('topicrow.switch_helpful_vfp', array(
'HELPFUL_TOPIC_POINTS' => $topic_helpfulpoints)
); // points
}
if ($board_config['helpful_vfg_on_off'] && $allow_view)
{
$template->assign_block_vars('topicrow.switch_helpful_vfg', array(
'GRADIENT_IMG' => $topic_gradient_img,
'GRADIENT_WIDTH' => $topic_gradient_width,
'GRADIENT_TRANS_WIDTH' => $topic_gradient_trans_width)
); // gradient
}
// Was This Post/Topic Helpful By Wicher
#
#-----[ Отворете ]------------------------------------------
#
includes/constants.php
#
#-----[ Намерете ]------------------------------------------
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
define('HELPFUL_POST_TABLE', $table_prefix.'helpful_postvotes');
define('HELPFUL_TOPIC_TABLE', $table_prefix.'helpful_topicvotes');
#
#-----[ Отворете ]------------------------------------------
#
includes/prune.php
#
#-----[ Намерете ]------------------------------------------------
#
remove_search_post($sql_post);
#
#-----[ Преди него добавете ]------------------------------------------------
#
// Was This Post/Topic Helpful By Wicherl
$sql = "DELETE FROM " . HELPFUL_TOPIC_TABLE . "
WHERE topic_id IN ($sql_topics)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete topicvotes during prune', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . HELPFUL_POST_TABLE . "
WHERE post_id IN ($sql_post)";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete postvotes during prune', '', __LINE__, __FILE__, $sql);
}
// Was This Post/Topic Helpful By Wicherl
#
#-----[ Отворете ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ Намерете ]------------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ След него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicher
'L_POSTING_POINTS' => $lang['posting_points'],
'POINTS' => $profiledata['user_helpfulpoints'],
// Was This Post/Topic Helpful By Wicher
#
#-----[ Отворете ]------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ Намерете ]------------------------------------------
#
?>
#
#-----[ Преди него добавете ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicherl
$lang['Helpful_Config'] = 'Полезност:Настройки';
$lang['Helpful_Config_explain'] = 'Тук може да конфигурирате мода.';
$lang['Click_return_helpful_config'] = 'Натиснете %sHere%s за да се врнете Helpful MOD конфигурацията';
$lang['helpful_mod_settings'] = 'Полезност:Настройки';
$lang['helpful_topic_On_Off'] = 'Пусни / спри мода за Теми';
$lang['helpful_topic_On_Off_explain'] = 'Ако изключите това, не е нужно да нагласяте настройките на Темите.';
$lang['helpful_post-On_Off'] = 'Пусни / спри мода за Мненията ';
$lang['helpful_post_On_Off_explain'] = 'Ако изключите това, не е нужно да нагласяте настройките на Мненията.';
$lang['viewforum_gradient'] = 'Използвай Gradient за темите';
$lang['viewforum_points'] = 'Използвай точки за темите';
$lang['usetopic_gradient'] = 'Използвай Gradient за темите';
$lang['usepost_gradient'] = 'Използвай Gradient за мнения';
$lang['usetopic_points'] = 'Използвай точки за темите';
$lang['usepost_points'] = 'Използвай точки за мненията';
$lang['useuser_points'] = 'Използвай точки за потребителите';
$lang['viewtopic_settings'] = 'Настрпйки на темите';
$lang['viewforumsettings'] = 'Настройки на форумите';
$lang['global_settings'] = 'Общи настройки';
$lang['time_window'] = 'Потребителите не могат да дават точки за една и съща тема/мнение поне:';
$lang['1minute'] = '1 минута';
$lang['5minutes'] = '5 минути';
$lang['30minutes'] = '30 минути';
$lang['60minutes'] = '60 минути';
$lang['24hours'] = '24 часа';
$lang['7days'] = '7 дни';
$lang['1month'] = '1 месец';
$lang['1year'] = '1 година';
$lang['1century'] = '1 десетилетие';
$lang['hm_guests_allow'] = 'Позволи на гостите да дават точки.<br />ако това е включено ,тогава и ботове като на Google ще могат да дават точки на темите и мненията';
$lang['hm_guest_visable'] = 'Гостите да виждат точките.<br />.';
#
#-----[ Отвори]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ Намери ]------------------------------------------
#
?>
#
#-----[ Преди това добави ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicherl
$lang['was_helpful'] = 'Беше ли ви полезно това мнениеl?';
$lang['this_post_points'] = 'Точки';
$lang['this_user_points'] = 'Точки на потребителя';
$lang['your_points'] = 'Вашите точки';
$lang['was_topic_helpful'] = 'Беше ли ви полезна тази тема?';
$lang['topic_helpful_points'] = 'Точки за тази тема';
$lang['topic_gradient'] = 'Topic gradiation';
$lang['post_gradient'] = 'Post gradiation';
$lang['1minute'] = '1 минута';
$lang['5minutes'] = '5 минути';
$lang['30minutes'] = '30 минути';
$lang['60minutes'] = '60 минути';
$lang['24hours'] = '24 часа';
$lang['7days'] = '7 дни';
$lang['1month'] = 'Месец';
$lang['1year'] = 'Година';
$lang['1century'] = 'Century';
$lang['posting_points'] = 'Posting Points';
$lang['or1'] = '<br /><br />или<br /><br /> не сте влезнали с акаунта си.<br />Please ';
$lang['or2'] = ' и след това дайде точка<br /><br />или<br />';
$lang['postpoints_given'] = 'вече сте оценили това мнение ';
$lang['topicpoints_given'] = 'вече сте оценили тази тема ';
$lang['cannot_post'] = 'не можете да оцените собственото си мнение<br />';
$lang['cannot_topic'] = 'не можете да оцените собствената си тема.<br />';
$lang['Click'] = 'Натисни';
$lang['here'] = 'тук';
$lang['return_post'] = 'за да се върнеш на мнението.';
$lang['return_topic'] = 'за да се врнеш на темата.';
$lang['Points'] = 'Точки:';
#
#-----[ Отвори ]------------------------------------------
#
templates/вашия темплейт/memberlist_body.tpl
#
#-----[ Намери ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_POSTS}</th>
#
#-----[ След него добави ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_POINTS}</th>
#
#-----[ Намери ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POSTS}</span></td>
#
#-----[ След него добави ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gen">{memberrow.POINTS}</span></td>
#
#-----[ Намери ]------------------------------------------
# Look for rowspan=" and add 1 to the number after the "
<td class="catBottom" colspan="{%:1}" height="28"> </td>
#
#-----[ Увеличи ]--------------------------------
#
%:1 +1
#
#-----[ Отвори ]------------------------------------------
#
templates/вашия темплейт/вашия темплейт.cfg
#
#-----[ Намери ]------------------------------------------
#
?>
#
#-----[ Преди това добави ]------------------------------------------
#
// Was This Post/Topic Helpful By Wicherl
$images['helpful_yes'] = "$current_template_images/{LANG}/helpful_yes.gif";
$images['helpful_no'] = "$current_template_images/{LANG}/helpful_no.gif";
$images['helpful_points_back'] = "$current_template_images/{LANG}/helpful_points_back.gif";
$images['gradient_start_end'] = "$current_template_images/gradiation_start-end.gif";
$images['gradient_trans'] = "$current_template_images/gradiation_trans.gif";
$images['gradient_green'] = "$current_template_images/gradiation_green.gif";
$images['gradient_red'] = "$current_template_images/gradiation_red.gif";
#
#-----[ Отвори ]------------------------------------------
#
templates/вашия темплейт/profile_view_body.tpl
#
#-----[ Намери ]------------------------------------------
#
<td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed">[{POST_PERCENT_STATS} / {POST_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed">{L_SEARCH_USER_POSTS}</a></span></td>
</tr>
#
#-----[ След това добавете ]------------------------------------------
#
<tr>
<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_POSTING_POINTS}:</span></td>
<td> <b><span class="gen">{POINTS}</span></b></td>
</tr>
#
#-----[ Отворете ]------------------------------------------
#
templates/вашия темплейт/viewtopic_body.tpl
#
#-----[ Намерете ]------------------------------------------
#
<td align="left" valign="middle" width="100%"><span class="nav"> <a href="{U_INDEX}" class="nav">{L_INDEX}</a>
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ След това добавете ]------------------------------------------
#
<!-- // Was This Post/Topic Helpful By Wicher -->
<!-- BEGIN switch_helpful_on_off -->
<td align="right" valign="bottom" nowrap="nowrap">
<!-- END switch_helpful_on_off -->
<!-- BEGIN switch_helpful_on_off -->
<span class="gensmall">{L_WAS_TOPIC_HELPFUL} <a href="{U_HELPFUL_PLUS_TOPIC}"><img src="{HELPFUL_YES_IMG}" border="0" /></a> <a href="{U_HELPFUL_MIN_TOPIC}"><img src="{HELPFUL_NO_IMG}" border="0" /></a></span>
<!-- END switch_helpful_on_off -->
<!-- BEGIN switch_tp_on_off -->
<br /><table height="14" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap"><span class="gensmall">{L_TOPIC_HELPFUL_POINTS}: </span></td><td width="43" valign="top" align="center" background="{HELPFUL_POINTS_BACK_IMG}" nowrap="nowrap"><span class="gensmall">{HELPFUL_TOPIC_POINTS}</span></td><tr></table>
<!-- END switch_tp_on_off -->
<!-- BEGIN switch_tg_on_off -->
<table height="14" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap"><span class="gensmall">{L_TOPIC_GRADIENT}: </span></td><td width="100" align="center" nowrap="nowrap"><table width="100%" height="14" cellpadding="0" cellspacing="0"><td><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /><img src="{GRADIENT_IMG}" width="{GRADIENT_WIDTH}" height="13" /></td><td><img src="{GRADIENT_TRANS_IMG}" width="{GRADIENT_TRANS_WIDTH}" height="13" /><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /></td></tr></table></td><tr></table>
<!-- END switch_tg_on_off -->
<!-- BEGIN switch_helpful_on_off -->
</td>
<!-- END switch_helpful_on_off -->
<!-- // Was This Post/Topic Helpful By Wicher -->
#
#-----[ Намерете ]------------------------------------------
#
<td width="150" align="left" valign="top" class="{postrow.ROW_CLASS}"><span class="name"><a name="{postrow.U_POST_ID}"></a><b>{postrow.POSTER_NAME}</b></span><br /><span class="postdetails">{postrow.POSTER_RANK}<br />{postrow.RANK_IMAGE}{postrow.POSTER_AVATAR}<br /><br />{postrow.POSTER_JOINED}<br />{postrow.POSTER_POSTS}<br />{postrow.POSTER_FROM}</span><br /></td>
#
#-----[ на същия ред намерете ]------------------------------------------
#
{postrow.POSTER_FROM}</span><br /></td>
#
#-----[ заменете го с ]------------------------------------------
#
{postrow.POSTER_FROM}
#
#-----[ след това добавете ]------------------------------------------
#
<!-- // Was This Post/Topic Helpful By Wicher -->
<!-- BEGIN switch_helpful_off -->
</span><br /></td>
<!-- END switch_helpful_off -->
<!-- BEGIN switch_helpful_on -->
<br />
<!-- END switch_helpful_on -->
<!-- BEGIN switch_helpful_buttons -->
<br />{postrow.switch_helpful_buttons.L_WAS_HELPFUL}</span>
<br/><a href="{postrow.switch_helpful_buttons.U_HELPFUL_PLUS_POST}"><img src="{HELPFUL_YES_IMG}" border="0" /></a> <a href="{postrow.switch_helpful_buttons.U_HELPFUL_MIN_POST}"><img src="{HELPFUL_NO_IMG}" border="0" /></a><br />
<!-- END switch_helpful_buttons -->
<!-- BEGIN switch_up_on_off -->
<span class="postdetails">{postrow.switch_up_on_off.L_USERS_POINTS}:</span><table width="43" height="13" cellpadding="0" cellspacing="0" background="{HELPFUL_POINTS_BACK_IMG}"><tr><td valign="top" align="center"><span class="gensmall">{postrow.switch_up_on_off.HELPFUL_POINTS}</span></td><tr></table>
<!-- END switch_up_on_off -->
<!-- BEGIN switch_pp_on_off -->
<span class="postdetails">{L_POST_POINTS}:</span><table width="43" height="13" cellpadding="0" cellspacing="0" background="{HELPFUL_POINTS_BACK_IMG}"><tr><td valign="top" align="center"><span class="gensmall">{postrow.switch_pp_on_off.POST_POINTS}</span></td><tr></table>
<!-- END switch_pp_on_off -->
<!-- BEGIN switch_pg_on_off -->
<span class="postdetails">{L_POST_GRADIENT}:</span><table width="102" height="14" cellpadding="0" cellspacing="0"><td><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /><img src="{postrow.switch_pg_on_off.GRADIENT_IMG}" width="{postrow.switch_pg_on_off.GRADIENT_WIDTH}" height="13" /></td><td><img src="{GRADIENT_TRANS_IMG}" width="{postrow.switch_pg_on_off.GRADIENT_TRANS_WIDTH}" height="13" /><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /></td></tr></table>
<!-- END switch_pg_on_off -->
<!-- BEGIN switch_helpful_on -->
</td>
<!-- END switch_helpful_on -->
<!-- // Was This Post/Topic Helpful By Wicher -->
#
#-----[ Намерете ]------------------------------------------
#
<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}
#
#-----[ На същия ред намерете ]------------------------------------------
#
valign="middle"
#
#-----[ заменете го с ]------------------------------------------
#
valign="top"
#
#-----[ Намерете ]------------------------------------------
#
<td align="left" valign="middle" width="100%"><span class="nav"> <a href="{U_INDEX}" class="nav">{L_INDEX}</a>
#
#-----[ на същия ред намерете ]------------------------------------------
#
valign="middle"
#
#-----[ заменете го с ]------------------------------------------
#
valign="top"
#
#-----[ Намерете ]------------------------------------------
#
<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span>
#
#-----[ След него добавете ]------------------------------------------
#
<!-- // Was This Post/Topic Helpful By Wicher -->
<!-- BEGIN switch_helpful_on_off -->
<br /><span class="gensmall">{L_WAS_TOPIC_HELPFUL} <a href="{U_HELPFUL_PLUS_TOPIC}"><img src="{HELPFUL_YES_IMG}" border="0" /></a> <a href="{U_HELPFUL_MIN_TOPIC}"><img src="{HELPFUL_NO_IMG}" border="0" /></a></span><br />
<!-- END switch_helpful_on_off -->
<!-- BEGIN switch_tp_on_off -->
<table height="14" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap"><span class="gensmall">{L_TOPIC_HELPFUL_POINTS}: </span></td><td width="43" valign="top" align="center" background="{HELPFUL_POINTS_BACK_IMG}" nowrap="nowrap"><span class="gensmall">{HELPFUL_TOPIC_POINTS}</span></td><tr></table>
<!-- END switch_tp_on_off -->
<!-- BEGIN switch_tg_on_off -->
<table height="14" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap"><span class="gensmall">{L_TOPIC_GRADIENT}: </span></td><td width="102"><table width="100%" height="14" cellpadding="0" cellspacing="0"><td><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /><img src="{GRADIENT_IMG}" width="{GRADIENT_WIDTH}" height="13" /></td><td><img src="{GRADIENT_TRANS_IMG}" width="{GRADIENT_TRANS_WIDTH}" height="13" /><img src="{GRADIENT_START_END_IMG}" width="1" height="13" /></td></tr></table></td></tr></table>
<!-- END switch_tg_on_off -->
<!-- // Was This Post/Topic Helpful By Wicher -->
#
#-----[ Отворете ]------------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ Намерете ]------------------------------------------
#
{topicrow.GOTO_PAGE}</span></td>
#
#-----[ на същия ред намерете ]------------------------------------------
#
</span></td>
#
#-----[ заменете го с ]------------------------------------------
#
</span>
#
#-----[ след това добавете ]------------------------------------------
#
<!-- // Was This Post/Topic Helpful By Wicher -->
<!-- BEGIN switch_helpful_vfg -->
<table width="100" height="9" cellpadding="0" cellspacing="0"><td><img src="{GRADIENT_START_END_IMG}" width="1" height="8" /><img src="{topicrow.switch_helpful_vfg.GRADIENT_IMG}" width="{topicrow.switch_helpful_vfg.GRADIENT_WIDTH}" height="8" /></td><td><img src="{GRADIENT_TRANS_IMG}" width="{topicrow.switch_helpful_vfg.GRADIENT_TRANS_WIDTH}" height="8" /><img src="{GRADIENT_START_END_IMG}" width="1" height="8" /></td></tr></table>
<!-- END switch_helpful_vfg -->
<!-- BEGIN switch_helpful_vfp -->
<table height="14" cellpadding="0" cellspacing="0"><tr><td nowrap="nowrap"><span class="gensmall">{L_TOPIC_HELPFUL_POINTS}: </span></td><td width="43" valign="top" align="center" background="{HELPFUL_POINTS_BACK_IMG}" nowrap="nowrap"><span class="gensmall">{topicrow.switch_helpful_vfp.HELPFUL_TOPIC_POINTS}</span></td><tr></table>
<!-- END switch_helpful_vfp -->
</td>
<!-- // Was This Post/Topic Helpful By Wicher -->
#
#-----[ Запазете/Затворете всички файлове ]------------------------------------------
#
# EoMgradiation – не съм го превел (нещо като сотношение, статистика , но всеки да си го преведе както му харесва)


