Модуль создаёт блок кто сегодня именник!
Автор: Ualde
в базе сделать запрос
ALTER TABLE `dle_users` ADD `birthday` DATE NOT NULL;
index.php
перед
$tpl->set('{calendar}',calendar ());
добавить
$tpl->set('{birthday}',$birthdays);
engine/init.php
после
require_once ENGINE_DIR.'/modules/calendar.php';
добавить
require_once ENGINE_DIR.'/modules/birthdays.php';
engine/modules/profile.php
после
$fullname = $parse->safeSQL($parse->process($_POST['fullname']));
добавить
$birthday = $parse->safeSQL($parse->process($_POST['birthday']));
найти
$sql_user = "UPDATE " . PREFIX . "_users set fullname='$fullname', land='$land', icq='$icq', email='$email', info='$info', signature='$signature', password='$password1', allow_mail='$allow_mail', xfields='$filecontents', allowed_ip='$allowed_ip' where name='$user'";
} else {
$sql_user = "UPDATE " . PREFIX . "_users set fullname='$fullname', land='$land', icq='$icq', email='$email', info='$info', signature='$signature', allow_mail='$allow_mail', xfields='$filecontents', allowed_ip='$allowed_ip' where name='$user'";
заменить на
$sql_user = "UPDATE " . PREFIX . "_users set fullname='$fullname', land='$land', icq='$icq', email='$email', info='$info', signature='$signature', password='$password1', allow_mail='$allow_mail', xfields='$filecontents', allowed_ip='$allowed_ip', birthday='$birthday' where name='$user'";
} else {
$sql_user = "UPDATE " . PREFIX . "_users set fullname='$fullname', land='$land', icq='$icq', email='$email', info='$info', signature='$signature', allow_mail='$allow_mail', xfields='$filecontents', allowed_ip='$allowed_ip', birthday='$birthday' where name='$user'";
после
$tpl->set('{fullname}', stripslashes($row['fullname']));
добавить
$tpl->set('{birthday}', stripslashes($row['birthday']));
для стандартного шаблона... ну , а для своего по аналогии
templates/Default/main.tpl
после
<table width="100%">
<tr>
<td width="5"><img src="/templates/Simple/images/ltdt.png" width="5" height="50" border="0"></td>
<td background="/templates/Simple/images/bgtdt.png" class="ltitle" valign="top">Вход на сайт</td>
<td width="5"><img src="/templates/Simple/images/rtdt.png" width="5" height="50" border="0"></td>
</tr>
<tr>
<td background="/templates/Simple/images/ltd.gif"><img src="/templates/Simple/images/ltd.gif" width="5" border="0"></td>
<td class="copy">{login}</td>
<td background="/templates/Simple/images/rtd.gif"><img src="/templates/Simple/images/rtd.gif" width="5" border="0"></td>
</tr>
<tr>
<td><img src="/templates/Simple/images/ltdb.png" width="5" height="10" border="0"></td>
<td background="/templates/Simple/images/tdbbg.png"><img src="/templates/Simple/images/tdbbg.png" width="1" height="10" border="0"></td>
<td><img src="/templates/Simple/images/rtdb.png" width="5" height="10" border="0"></td>
</tr>
</table>
добавить
<table width="100%">
<tr>
<td width="5"><img src="/templates/Simple/images/ltdt.png" width="5" height="50" border="0"></td>
<td background="/templates/Simple/images/bgtdt.png" class="ltitle" valign="top">Дни рождения</td>
<td width="5"><img src="/templates/Simple/images/rtdt.png" width="5" height="50" border="0"></td>
</tr>
<tr>
<td background="/templates/Simple/images/ltd.gif"><img src="/templates/Simple/images/ltd.gif" width="5" border="0"></td>
<td class="stext">{birthdays}<br /></td>
<td background="/templates/Simple/images/rtd.gif"><img src="/templates/Simple/images/rtd.gif" width="5" border="0"></td>
</tr>
<tr>
<td><img src="/templates/Simple/images/ltdb.png" width="5" height="10" border="0"></td>
<td background="/templates/Simple/images/tdbbg.png"><img src="/templates/Simple/images/tdbbg.png" width="1" height="10" border="0"></td>
<td><img src="/templates/Simple/images/rtdb.png" width="5" height="10" border="0"></td>
</tr>
</table>
templates/Default/userinfo.tpl
после
<br>Номер ICQ: <span class=date>{icq}</span>
добавить
<br>День рождения: <span class=date>{birthday}</span>
после
<tr valign="middle">
<td width="120" height="25">Ваше Имя</td>
<td height="25"><input type="text" name="fullname" value="{fullname}" style="width:167px; height:20px; font-family:tahoma; font-size:11px; border:1px solid #E0E0E0 "></td>
</tr>
добавить
<tr valign="middle">
<td width="120" height="25">День рождения</td>
<td height="25"><input type="text" name="birthday" value="{birthday}" style="width:167px; height:20px; font-family:tahoma; font-size:11px; border:1px solid #E0E0E0 "></td>
</tr>
внимание! новый файл
engine/modules/birthdays.php
текст
<?php
/*
Файл: birthdays.php
-----------------------------------------------------
Назначение: вывод пользователей с текущим днем рождения
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
$today = date('Y-m-d');
$birthdays = "Сегодня день рождения у:<br>";
$sql_result = $db->query("SELECT name FROM " . PREFIX . "_users WHERE birthday='$today' ORDER BY name");
while ($row = $db->get_row($sql_result)) {
if ($config['allow_alt_url'] == "yes") $link = "<a href="".$config['http_home_url']."user/".urlencode($row['name'])."/">".$row['name']."</a>";
else $link = "<a href="$PHP_SELF?subaction=userinfo&user=".urlencode($row['name'])."">".$row['name']."</a>";
$birthdays .= "<li>$link</li>";
}
?>