Быстрый лёгкий надёжный форумный движок
Вы не вошли.
Страницы 1
Мод на основе похожего мода. Портировал для версии 1.4.4 и добавил возможность менять иконку при редактировании темы.
Делаем бэкап базы данных, залить install_mod.php в корень форума, запустить, а затем удалить этот файл.
Открыть post.php
Найти:
// If it's a new topic
else if ($fid)
{
$stick_fp = ($is_admmod && isset($_POST['stickfp'])) ? 1 : 0; // StickFP - Visman
// Create the topic
$db->query('INSERT INTO '.$db->prefix.'topics (stick_fp, poster, subject, posted, last_post, last_poster, sticky, forum_id) VALUES('.$stick_fp.', \''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$stick_topic.', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
Заменить на:
// If it's a new topic
else if ($fid)
{
$stick_fp = ($is_admmod && isset($_POST['stickfp'])) ? 1 : 0; // StickFP - Visman
$icon_topic = $_POST['icon_topic'];
// Create the topic
$db->query('INSERT INTO '.$db->prefix.'topics (stick_fp, poster, subject, posted, last_post, last_poster, sticky, forum_id, icon_topic) VALUES('.$stick_fp.', \''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$stick_topic.', '.$fid.', '.$icon_topic.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
Найти:
if ($fid): ?>
Заменить на:
if ($fid):
$d = dir(PUN_ROOT.'img/icons');
while (($entry = $d->read()) !== false) {
if (substr($entry, strlen($entry)-4) == '.gif') {
$icons_topic[] = substr($entry, 0, strlen($entry)-4);
}
}
$d->close();
sort($icons_topic);
if (count($icons_topic) > 1) {
for ($i = 0; $i < count($icons_topic); $i++) {
echo '<input type="radio" name="icon_topic" value="'.($i+1).'" /> <img src="./img/icons/'.$icons_topic[$i].'.gif" alt="'.$i.'" /> ';
}
echo '<input type="radio" name="icon_topic" value="0" checked="checked" /> ';
}
?>
Открыть edit.php
Найти:
// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.stick_fp, t.subject, t.posted, t.first_post_id, t.sticky, t.closed, t.poll_type, t.poll_time, t.poll_term, t.poll_kol, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted as pposted, p.edit_post, w.message AS warning FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'warnings AS w ON p.id=w.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
Заменить на:
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.stick_fp, t.subject, t.posted, t.first_post_id, t.sticky, t.closed, t.icon_topic, t.poll_type, t.poll_time, t.poll_term, t.poll_kol, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted as pposted, p.edit_post, w.message AS warning FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'warnings AS w ON p.id=w.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
Найти:
// Start with a clean slate
$errors = array();
Добавить после:
$icon_topic = $cur_post['icon_topic'];
Найти:
if ($is_modified) {
// Update the post
$db->query('UPDATE '.$db->prefix.'posts SET message=\''.$db->escape($message).'\', hide_smilies='.$hide_smilies.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
}
Добавить после:
if ($_POST['icon_topic'] != null && $icon_topic != $_POST['icon_topic']) {
$icon_topic = $_POST['icon_topic'];
$db->query('UPDATE '.$db->prefix.'topics SET icon_topic=\''.$icon_topic.'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
}
Найти:
$db->query('UPDATE '.$db->prefix.'topics SET stick_fp='.$stick_fp.', subject=\''.$db->escape($subject).'\', sticky='.$stick_topic.' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
Заменить на:
$db->query('UPDATE '.$db->prefix.'topics SET stick_fp='.$stick_fp.', subject=\''.$db->escape($subject).'\', icon_topic=\''.$icon_topic.'\', sticky='.$stick_topic.' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
Добавить до:
$icon_topic = $_POST['icon_topic'];
Найти модуль с BB-кодом:
<input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
<?php endif; ?>
Заменить на:
<input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
<?php
/* редактирование иконок */
$d = dir(PUN_ROOT.'img/icons');
while (($entry = $d->read()) !== false) {
if (substr($entry, strlen($entry)-4) == '.gif') {
$icons_topic[] = substr($entry, 0, strlen($entry)-4);
}
}
$d->close();
sort($icons_topic);
if (count($icons_topic) > 1) {
/*while (list(, $temp) = @each($icons_topic)) {*/
for ($i = 0; $i < count($icons_topic); $i++) {
if ($icon_topic == $i+1)
echo '<input type="radio" name="icon_topic" value="'.($i+1).'" checked="checked" /> <img src="./img/icons/'.$icons_topic[$i].'.gif" alt="'.($i+1).'" /> ';
else
echo '<input type="radio" name="icon_topic" value="'.($i+1).'" /> <img src="./img/icons/'.$icons_topic[$i].'.gif" alt="'.($i+1).'" /> ';
}
if ($icon_topic == 0)
echo '<input type="radio" name="icon_topic" value="0" checked="checked" /> ';
else
echo '<input type="radio" name="icon_topic" value="0" /> ';
}
endif;
?>
Открыть viewforum.php
Найти:
// Without "the dot"
$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, poll_type FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $topic_ids).') ORDER BY sticky DESC, '.$sort_by.', id DESC';
}
else
{
// With "the dot"
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN('.implode(',', $topic_ids).') GROUP BY t.id'.($db_type == 'pgsql' ? ', t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id' : '').' ORDER BY t.sticky DESC, t.'.$sort_by.', t.id DESC';
}
Заменить на:
// Without "the dot"
$sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, poll_type, icon_topic FROM '.$db->prefix.'topics WHERE id IN('.implode(',', $topic_ids).') ORDER BY sticky DESC, '.$sort_by.', id DESC';
}
else
{
// With "the dot"
$sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.poll_type, t.icon_topic FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN('.implode(',', $topic_ids).') GROUP BY t.id'.($db_type == 'pgsql' ? ', t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id' : '').' ORDER BY t.sticky DESC, t.'.$sort_by.', t.id DESC';
}
Найти:
if ($cur_topic['poll_type'] > 0)
{
$item_status .= ' ipoll';
$status_text[] = '<span class="polltext">'.$lang_forum['Poll'].'</span>';
}
Добавить после:
if ($cur_topic['icon_topic'] != 0)
{
$icon_topic = '<img src="./img/icons/'.$cur_topic['icon_topic'].'.gif" alt="" />';
$subject = $icon_topic.' '.$subject;
}
Залить иконки в img/icons (названы должны быть 1.gif, 2.gif...)
Необходимые файлы: http://rghost.ru/4766655
Удачного использования
Редактировался kordum (2011-03-14 22:53:32)
Offline
Найти:
if ($cur_topic['poll_type'] > 0) { $item_status .= ' ipoll'; $status_text[] = '<span class="polltext">'.$lang_forum['Poll'].'</span>'; }
Добавить после:
if ($cur_topic['icon_topic'] != 0) { $icon_topic = '<img src="./img/icons/'.$cur_topic['icon_topic'].'.gif" alt="" />'; $subject = $icon_topic.' '.$subject; }
в стандартном этот шаг пропустить?
Редактировался ket4up (2011-04-18 14:08:00)
Offline
Ребят если у кого нибудь остался данный мод, перезалейте пожалуйста!
получится ли его прикрутить к сборке Visman 1.5.10?
Редактировался Makssssssss (2017-03-19 03:10:36)
Offline
Страницы 1