Иконки для сообщений на форуме для PHP-Fusion
Модификация дает возможность выбрать иконку для первого сообщения на форуме. В архиве можно скачать картинки и измененные файлы под версию 7.02.xx, они же скорее всего подойдут и под 7.хх.
Приступим к изменению файлов
Файл viewforum.php
Найти
$threadsubject = "<a href='viewthread.php?thread_id=".$tdata['thread_id']."'>".$tdata['thread_subject']."</a>";
Заменить на
/* thread icons */
if($tdata['thread_icon']) $icon = "<img src='".IMAGES."post_icons/".$tdata['thread_icon']."' style='vertical-align: middle; border: 0;' /> "; else $icon = "";
$threadsubject = $icon."<a href='viewthread.php?thread_id=".$tdata['thread_id']."'>".$tdata['thread_subject']."</a>";
/* thread icons */
Файл viewthread.php
Найти
$result = dbquery(
"SELECT p.forum_id, p.thread_id, p.post_id, p.post_message, p.post_showsig, p.post_smileys, p.post_author,
p.post_datestamp, p.post_ip, p.post_ip_type, p.post_edituser, p.post_edittime, p.post_editreason,
u.user_id, u.user_name, u.user_status, u.user_avatar, u.user_level, u.user_posts, u.user_groups, u.user_joined,
".($user_field['user_sig'] ? " u.user_sig," : "").($user_field['user_web'] ? " u.user_web," : "")."
u2.user_name AS edit_name, u2.user_status AS edit_status
FROM ".DB_POSTS." p
LEFT JOIN ".DB_USERS." u ON p.post_author = u.user_id
LEFT JOIN ".DB_USERS." u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'
WHERE p.thread_id='".$_GET['thread_id']."' AND post_hidden='0'
ORDER BY post_datestamp LIMIT ".$_GET['rowstart'].",$posts_per_page"
);
Заменить на
/* thread icons */
$result = dbquery(
"SELECT p.forum_id, p.thread_id, p.post_id, p.post_message, p.post_showsig, p.post_smileys, p.post_author,
p.post_datestamp, p.post_ip, p.post_ip_type, p.post_edituser, p.post_edittime, p.post_editreason, t.thread_icon,
u.user_id, u.user_name, u.user_status, u.user_avatar, u.user_level, u.user_posts, u.user_groups, u.user_joined,
".($user_field['user_sig'] ? " u.user_sig," : "").($user_field['user_web'] ? " u.user_web," : "")."
u2.user_name AS edit_name, u2.user_status AS edit_status
FROM ".DB_POSTS." p
LEFT JOIN ".DB_THREADS." t ON p.thread_id=t.thread_id
LEFT JOIN ".DB_USERS." u ON p.post_author = u.user_id
LEFT JOIN ".DB_USERS." u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'
WHERE p.thread_id='".$_GET['thread_id']."' AND post_hidden='0'
ORDER BY post_datestamp LIMIT ".$_GET['rowstart'].",$posts_per_page"
);
/* thread icons */
Найти
echo "<div style='position:absolute' class='forum_thread_title'><!--forum_thread_title--><strong>".$fdata['thread_subject']."</strong></div>\n</td>\n</tr>\n";
Заменить на
/* thread icons */
if($fdata['thread_icon'] != "0") $icon = "<img src='".IMAGES."post_icons/".$fdata['thread_icon']."' style='vertical-align: middle; border: 0;' /> "; else $icon = "";
echo "<div style='position:absolute' class='forum_thread_title'><!--forum_thread_title-->".$icon."<strong>".$fdata['thread_subject']."</strong></div>\n</td>\n</tr>\n";
/* thread icons */
Файл postnewthread.php
Найти
$subject = trim(stripinput(censorwords($_POST['subject'])));
Ниже добавить
$icons = stripinput($_POST['icons']); /* thread icons */
Найти
echo "<td colspan='2' class='tbl2'><strong>".$subject."</strong></td>\n</tr>\n";
Заменить на
/* thread icons */
if($icons != "0") $pre_icon = "<img src='".IMAGES."post_icons/".$icons."' style='vertical-align: middle; border: 0;' /> "; else $pre_icon = "";
echo "<td colspan='2' class='tbl2'>".$pre_icon."<strong>".$subject."</strong></td>\n</tr>\n";
/* thread icons */
Найти
$subject = trim(stripinput(censorwords($_POST['subject'])));
Ниже добавить
$icons = stripinput($_POST['icons']); /* thread icons */
Найти
$result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject, thread_author, thread_views, thread_lastpost, thread_lastpostid, thread_lastuser, thread_postcount, thread_poll, thread_sticky, thread_locked) VALUES('".$_GET['forum_id']."', '$subject', '".$userdata['user_id']."', '0', '".time()."', '0', '".$userdata['user_id']."', '1', '".$thread_poll."', '".$sticky_thread."', '".$lock_thread."')");
Заменить на
/* thread icons */
$result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject, thread_icon, thread_author, thread_views, thread_lastpost, thread_lastpostid, thread_lastuser, thread_postcount, thread_poll, thread_sticky, thread_locked) VALUES('".$_GET['forum_id']."', '$subject', '".$icons."', '".$userdata['user_id']."', '0', '".time()."', '0', '".$userdata['user_id']."', '1', '".$thread_poll."', '".$sticky_thread."', '".$lock_thread."')");
/* thread icons */
Найти
$subject = "";
Ниже добавить
$icons = ""; /* thread icons */
Найти
echo "<td class='tbl1'><input type='text' name='subject' value='".$subject."' class='textbox' maxlength='255' style='width: 250px' /></td>\n";
echo "</tr>\n<tr>\n";
Ниже добавить
/* thread icons */
echo "<td valign='top' width='145' class='tbl2'>Иконка:</td>\n";
echo "<td class='tbl1'>";
$iconlist = makefilelist(IMAGES."post_icons", ".|..|index.php|Thumbs.db", true);
$icon_list = "";
for ($i = 0; $i < count($iconlist); $i++) {
$checked = ($icons == $iconlist[$i] ? " checked='checked'" : "");
$icon_list .= "<label><input type='radio' name='icons' value='".$iconlist[$i]."'".$checked." /><img src='".IMAGES."post_icons/".$iconlist[$i]."' style='border: 0;' /></label> ";
}
if(!$icons) $icons = "checked='checked'";
$icon_list .= "<label>без<input type='radio' name='icons' value='0' ".$icons." /></label>";
echo $icon_list;
echo "</td>\n";
echo "</tr>\n<tr>\n";
/* thread icons */
Файл postedit.php
Найти
$subject = isset($_POST['subject']) ? trim(stripinput(censorwords($_POST['subject']))) : $tdata['thread_subject'];
Ниже добавить
$icons = stripinput($_POST['icons']); /* thread icons */
Найти
echo "<td colspan='2' class='tbl2'><strong>".$subject."</strong></td>\n</tr>\n";
Заменить на
/* thread icons */
if($icons != "0") $pre_icon = "<img src='".IMAGES."post_icons/".$icons."' style='vertical-align: middle; border: 0;' /> "; else $pre_icon = "";
echo "<td colspan='2' class='tbl2'>".$pre_icon."<strong>".$subject."</strong></td>\n</tr>\n";
/* thread icons */
Найти
$subject = trim(stripinput(censorwords($_POST['subject'])));
Ниже добавить
$icons = stripinput($_POST['icons']); /* thread icons */
Найти
$result = dbquery("UPDATE ".DB_THREADS." SET thread_subject='".$subject."' WHERE thread_id='".$_GET['thread_id']."'");
Заменить на
/* thread icons */
$result = dbquery("UPDATE ".DB_THREADS." SET thread_subject='".$subject."', thread_icon='".$icons."' WHERE thread_id='".$_GET['thread_id']."'");
/* thread icons */
Найти
$subject = $pdata['thread_subject'];
Ниже добавить
/* thread icons */
$thread_icon = dbarray(dbquery("SELECT thread_icon FROM ".DB_THREADS." WHERE thread_id='".$_GET['thread_id']."'"));
$icons = $thread_icon['thread_icon'];
/* thread icons */
Найти
echo "<td class='tbl2'><input type='text' name='subject' value='".$subject."' class='textbox' maxlength='255' style='width:250px' /></td>\n";
echo "</tr>\n<tr>\n";
Ниже добавить
/* thread icons */
echo "<td valign='top' width='145' class='tbl2'>Иконка:</td>\n";
echo "<td class='tbl1'>";
$iconlist = makefilelist(IMAGES."post_icons", ".|..|index.php|Thumbs.db", true);
$icon_list = "";
for ($i = 0; $i < count($iconlist); $i++) {
$checked = ($icons == $iconlist[$i] ? " checked='checked'" : "");
$icon_list .= "<label><input type='radio' name='icons' value='".$iconlist[$i]."'".$checked." /><img src='".IMAGES."post_icons/".$iconlist[$i]."' style='border: 0;' /></label> ";
}
if(!$icons) $icons = "checked='checked'";
$icon_list .= "<label>без<input type='radio' name='icons' value='0' ".$icons." /></label>";
echo $icon_list;
echo "</td>\n";
echo "</tr>\n<tr>\n";
/* thread icons */
Так же не забываем установить мод, через файл install_icon.php.
Скачать:
20.06.2015, 18:38 -
Категория: Web-скрипты » PHP-Fusion