File size: 4.18Kb
<?
/*
=======================================
Праздники для Dcms-Social
Автор: Искатель
---------------------------------------
Контакты
ICQ: 587863132
http://dcms-social.ru
=======================================
*/
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/adm_check.php';
include_once '../../sys/inc/user.php';
only_reg();
function str_date($month = 0)
{
if ($month == '1')$month = 'января';
elseif ($month == '2')$month = 'февраля';
elseif ($month == '3')$month = 'марта';
elseif ($month == '4')$month = 'апреля';
elseif ($month == '5')$month = 'мая';
elseif ($month == '6')$month = 'июня';
elseif ($month == '7')$month = 'июля';
elseif ($month == '8')$month = 'августа';
elseif ($month == '9')$month = 'сентября';
elseif ($month == '10')$month = 'октября';
elseif ($month == '11')$month = 'ноября';
elseif ($month == '12')$month = 'декабря';
return $month;
}
// Текущий месяц
$month = date('m');
// Текущий день
$day = date('d');
// Помечаем прочитанными
mysql_query("update `holidays` set `read` = '0' where `id_user` = '$user[id]'");
if (!isset($_SESSION['holidays']))
{
// Назначаем текущую сессию чтоб больше не выполнять запрос
$_SESSION['holidays'] = true;
}
$set['title'] = 'Праздники';
include_once '../../sys/inc/thead.php';
title();
err();
aut();
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `holidays` WHERE `id_user` = '$user[id]' "),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `holidays` WHERE `id_user` = '$user[id]' ORDER BY `d` ASC LIMIT $start, $set[p_str]");
if ($k_post == 0)
{
echo '<div class="mess">';
echo 'Нет новых событий';
echo '</div>';
}
while ($post = mysql_fetch_assoc($q))
{
$type = $post['type'];
/*
===============================
Значение переменной $name для
определенного типа сообщения
===============================
*/
if ($type == 'birthdays') // дневники
{
$name = 'День рожденье';
}
else
{
$name = null;
}
// Лесенка дивов
if ($num == 0)
{
echo '<div class="nav1">';
$num = 1;
}
elseif ($num == 1)
{
echo '<div class="nav2">';
$num = 0;
}
/*
* День рожденья друзей
*/
if ($type = 'birtdays')
{
$ank = get_user($post['id_object']);
echo '<table>';
echo '<tr>';
echo '<td style="width:50px; vertical-align:top;">';
echo status($ank['id']);
echo '</td>';
echo '<td style="width:auto; vertical-align:top;">';
echo group($ank['id']);
echo '<a href="/info.php?id=' . $ank['id'] . '">' . $ank['nick'] . '</a> ';
echo medal($ank['id']);
echo online($ank['id']) . '<br />';
echo '<img src="img/bd3.png" /> ' . $name;
echo '</td>';
echo '<td style="width:50px; vertical-align:top; text-align:center;">';
if ($day == $post['d'])
echo '<font style="color:red; font-size:x-small;">сегодня</font>';
else
echo '<font style="font-size:x-small;">' . $post['d'] . ' ' . str_date($post['m']) . '</font>';
echo '<br /><a href="/user/gift/categories.php?id=' . $ank['id'] . '"><img src="img/gift.png" /></a>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
echo '</div>';
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
echo '<div class="nav1">';
echo '<img src="/style/icons/str2.gif" alt="*"> <a href="/info.php?id=' . $user['id'] . '">' . $user['nick'] . '</a> | ';
echo '<b>Праздники</b>';
echo '</div>';
include_once '../../sys/inc/tfoot.php';
?>