Файл: modules/obmen/inc/file_form.php
Строк: 122
<?php
/* Мод "Обменник"
* Версия v0.0.1
* Дата последнего редактирования 21.04.2015
* Двиг DCMS Special
* Модифицировал densnet
* Файл file_form.php
* Описание:
*/
if ((user::access('obmen_file_delete') || $user['id'] == $file_id['id_user']) && isset($_GET['act']) && $_GET['act'] == 'edit') {
echo "<div class = 'comm'>" . img('folder_wrench.png', '') . " Параметры <a style = 'float:right;color: grey;' href = '?showinfo'><small>Закрыть</small></a></div>";
echo "<form method = 'post' class = 'comm' action = '?showinfo&act=edit&ok'>";
echo "<b>Название</b><br />";
echo "<input type = 'text' name = 'name' value = '$file_id[name]' maxlength = '512' /><br />";
echo "<b>Описание</b><br />";
echo "<textarea name = 'opis'>$file_id[opis]</textarea><br />";
echo "Формат: <font color = 'green'>$file_id[ras]</font><br />";
echo "<button name = 'save' class = 'flat blue md'>Сохранить</button>";
echo "</form>";
}
if ((user::access('obmen_file_delete') || $user['id'] == $file_id['id_user']) && isset($_GET['act']) && $_GET['act'] == 'parol') {
echo "<div class = 'comm'>" . img('folder_lock.png', '') . " Новый пароль<a style = 'float:right;color: grey;' href = '?showinfo'><small>Закрыть</small></a></div>";
echo "<form method = 'post' class = 'comm' action = '?showinfo&act=parol&ok'>";
echo "<b>Пароль</b><br />";
echo "<input type = 'text' name = 'parol' value = '$file_id[parol]' maxlength = '512' /><br />";
echo "<button name = 'save' class = 'flat blue md'>Сохранить</button>";
echo "</form>";
}
if (user::access('obmen_file_delete') && isset($_GET['act']) && $_GET['act'] == 'blokk') {
echo "<div class = 'comm'>" . img('folder_error.png', '') . " Блокировка<a style = 'float:right;color: grey;' href = '?showinfo'><small>Закрыть</small></a></div>";
echo "<form method='post' class = 'comm' action='?showinfo&act=blok&ok'>n";
echo "<b>Причина блокировки</b> <br />";
echo "<input type = 'text' name = 'blok' value = '' maxlength = '5102' /><br />n";
echo "<button name = 'save' class = 'flat blue md'>Сохранить</button>";
echo "</form>";
}
if (user::access('obmen_file_delete') && isset($_GET['act']) && $_GET['act'] == 'delete') {
echo "<div class = 'comm'>" . img('folder_delete.png', '') . " Удаление <a style = 'float:right;color: grey;' href = '?showinfo'><small>Закрыть</small></a></div>";
echo "<div class = 'comm'>";
echo "Удалить файл " . text::toOutput($file_id['name']) . "?<br /><br />";
echo "<a class = 'add' href = '?showinfo&act=delete&ok'>Да</a> ";
echo "<a class = 'add' href = '?showinfo'>Нет</a>";
echo "</div>";
}
if (user::access('obmen_file_delete')) {
echo "<div class = 'comm'>";
echo "<a href = '?showinfo&act=edit'>" . img('set_mini.png', '') . " Параметры</a><br />";
echo "<a href = '?showinfo&act=delete'>" . img('del.png', '') . " Удалить файл</a>";
if ($file_id['parol'] != NULL && $file_id['blok'] == NULL) {
echo "<br /><a href = '?showinfo&act=parol'>" . img('lock-small.png', '') . " Изменить пароль</a> ";
echo "<br /><a href = '?showinfo&act=paroll&ok'>" . img('lock-small.png', '') . " Убрать пароль</a>";
} else if ($file_id['blok'] == NULL) {
echo "<br /><a href = '?showinfo&act=parol'>" . img('lock-small.png', '') . " Поставить пароль</a>";
}
if ($file_id['blok'] != NULL) {
echo "<br /><a href='?showinfo&act=blokk&ok'>" . img('bl.png', '') . " Разблокировать файл</a>";
} else {
echo "<br /><a href='?showinfo&act=blokk'>" . img('bl.png', '') . " Заблокировать файл</a>";
}
echo "</div>n";
} elseif (isset($user) && $user['id'] == $file_id['id_user']) {
echo "<div class = 'comm'>";
echo "<a href = '?showinfo&act=edit'>" . img('set_mini.png', '') . " Параметры</a><br />";
echo "<a href = '?showinfo&act=delete'>" . img('del.png', '') . " Удалить файл</a><br />";
if ($file_id['parol'] != NULL && $file_id['blok'] == NULL) {
echo "<br /><a href = '?showinfo&act=parol'>" . img('lock-small.png', '') . " Изменить пароль</a> ";
echo "<a href = '?showinfo&act=paroll&ok'>" . img('lock-small.png', '') . " Убрать пароль</a><br />n";
} else if ($file_id['blok'] == NULL) {
echo "<br /><a href = '?showinfo&act=parol'>" . img('lock-small.png', '') . " Поставить пароль</a><br />n";
}
echo "</div>n";
}
if (isset($user)) {
if (isset($_GET['idd']) && $user['id'] != @$_GET['id']) {
$q_user = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='" . mysql_real_escape_string($_GET['idd']) . "'"));
echo "<form class = 'comm' method="post" name='message' action="?showinfo&mess&uidd=$q_user[id]">n";
} else {
echo "<form class = 'comm' method="post" name='message' action="?showinfo&mess">n";
}
if (isset($_GET['idd']) && isset($user) && $user['id'] != @$_GET['id']) {
$q_user = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`='" . mysql_real_escape_string($_GET['idd']) . "'"));
echo "<b>Комментарий</b> <a href = '/modules/smiles/'>" . img('smile.png', '16') . "</a><br />";
echo text::auto_bb("message", "msg");
echo "<textarea name = 'msg'>$q_user[nick], </textarea><br />";
} else {
echo "<b>Комментарий</b> <a href = '/modules/smiles/'>" . img('smile.png', '16') . "</a><br />";
echo text::auto_bb("message", "msg");
echo "<textarea name = 'msg'></textarea><br />n";
}
echo "<button class = 'flat blue md'>Добавить</button>";
echo "</form>n";
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `obmennik_komm` WHERE `id_file` = '$file_id[id]'"), 0);
$k_page = k_page($k_post, 5);
$page = page($k_page);
$start = 5 * $page - 5;
if ($k_post == 0) {
echo "<div class = 'errs'>";
echo img('error.png', '16') . " Нет результатов";
echo "</div>";
}
$q = mysql_query("SELECT * FROM `obmennik_komm` WHERE `id_file` = '$file_id[id]' ORDER BY `id` DESC LIMIT $start, 5");
while ($post = mysql_fetch_assoc($q)) {
$ank = user::get_user($post['id_user']);
echo "<table class = 'comm'><tr><td class = 'icon14'>";
avatar($ank['id'], '30');
echo "</td><td class = 'null'>";
echo "<div style = 'float:right;' id = 'hide'>";
if ($ank['id'] != $user['id']) {
echo "<a href = '?showinfo&mess&page=$page&idd=$post[id_user]' title = 'Ответить'>" . img('set.png', '') . "</a> ";
}
if (user::access('obmen_komm_del')) {
echo "<a href = '?showinfo&mess&page=$page&del_post=$post[id]' title = 'Удалить'>" . img('delete.png', '') . "</a>";
}
echo "</div>";
echo user($ank['id']);
echo "<br /><small>" . img('time_mini.png', '') . " " . date::times($post['time']) . "</small>";
echo "</td></tr><tr><td colspan = '2'>";
echo text::toOutput($post['msg']) . "<br />n";
echo "</td></tr></table>";
}
if ($k_page > 1) {
str('?showinfo&', $k_page, $page);
} // Вывод страниц