Мод ИЗМЕНЕНИЕ ВРЕМЕНИ СООБЩЕНИЙ - Change Post Time
Мод позволяет изменять время создания сообщений.
Полезен при наведении порядка в темах
includes/mcp/mcp_post.php
case 'chgposter':
// MOD: change post time
case 'chgposttime':
if (!$auth->acl_get('m_chgposter', $post_info['forum_id']))
{
trigger_error('NOT_AUTHORISED');
}
$match = array();
$newtime = request_var('new_time', '');
preg_match('/\b([0-9]{2})-([0-9]{2})-([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})\b/', $newtime, $match);
array_shift($match); // we don't want $match[0], so lop it off, and don't complain about undefined $match[0]
list($month, $day, $year, $hour, $minute, $second) = $match;
// Time is given in moderator's local time. We must have GMT.
// we *subtract* the timezone offsets given by the $user object
$hour = $hour - ($user->timezone + $user->dst);
$update_time = mktime($hour, $minute, $second, $month, $day, $year);
// this could be a complicated dance. Yay for the sync function !
$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_time = ' . (int) $update_time .
' WHERE post_id = ' . (int) $post_id;
$db->sql_query($sql);
sync('topic', 'topic_id', $post_info['topic_id'], true);
sync('forum', 'forum_id', $post_info['forum_id'], true);
break;
// END MOD
language/en/mcp.php
));
?>
'CHANGE_POST_TIME' => 'Change Post Time',
'CHANGE_POST_TIME_FORMAT' => 'Use this format for dates: MM-DD-YYYY HH:MM:SS',
styles/subsilver2/template/mcp_post.html
<!-- IF S_CAN_CHGPOSTER -->
<tr>
<form method="post" name="mcp_chgposttime" action="{U_POST_ACTION}">
<td class="row1" valign="top"><b class="gen">{L_CHANGE_POST_TIME}</b><br /><span class="gensmall">{L_CHANGE_POST_TIME_FORMAT}</span></td>
<td class="row2"><input class="post" type="text" name="new_time" value="" /> <input class="btnmain" type="submit" value="{L_SUBMIT}" name="action[chgposttime]" /></td>
</form>
</tr>
styles/prosilver/template/mcp_post.html
<form method="post" id="mcp_chgposter" action="{U_POST_ACTION}">
<fieldset>
<dl>
<dt><label>{L_CHANGE_POST_TIME}:</label></dt>
<dd style="margin-top:3px;">
<input class="inputbox autowidth" type="text" name="new_time" value="" />
<input type="submit" class="button2" name="action[chgposttime]" value="{L_SUBMIT}" />
<br />
<span>{L_CHANGE_POST_TIME_FORMAT}</span>
</dd>
</dl>
</fieldset>
preg_match('/b([0-9]{2})-([0-9]{2})-([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})b/', $newtime, $match);
array_shift($match); // we don't want $match[0], so lop it off, and don't complain about undefined $match[0]
list($month, $day, $year, $hour, $minute, $second) = $match;
// Time is given in moderator's local time. We must have GMT.
// we *subtract* the timezone offsets given by the $user object
$hour = $hour - ($user->timezone + $user->dst);
$update_time = mktime(...)
if(preg_match('/b([0-9]{2})-([0-9]{2})-([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2})b/', $newtime, $match)){
$update_time = strtotime($newtime);
}else{
break;
}
DD-MM-YYYY HH:MM:SS
includes/mcp/mcp_post.php
case 'chgposter':
// MOD: change post time
case 'chgposttime':
if (!$auth->acl_get('m_chgposter', $post_info['forum_id']))
{
trigger_error('NOT_AUTHORISED');
}
$match = array();
$newtime = request_var('new_post_time', '');
$dt_elements = explode(' ',$newtime);
$date_elements = explode('.',$dt_elements[0]);
$time_elements = explode(':',$dt_elements[1]);
$update_time = mktime($time_elements[0], $time_elements[1],$time_elements[2], $date_elements[1],$date_elements[0], $date_elements[2]);
$sql = 'UPDATE ' . POSTS_TABLE . ' SET post_time = ' . (int) $update_time .
' WHERE post_id = ' . (int) $post_id;
$db->sql_query($sql);
sync('topic', 'topic_id', $post_info['topic_id'], true);
sync('forum', 'forum_id', $post_info['forum_id'], true);
break;
// END MOD
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '',
'NEW_POST_TIME' => date ('d.m.Y H:i:s'),
language/ru/mcp.php
));
?>
'CHANGE_POST_TIME' => 'Изменить время сообщения',
styles/prosilver/template/mcp_post.html
<form method="post" id="mcp_chgposter" action="{U_POST_ACTION}">
<fieldset>
<dl>
<dt><label>{L_CHANGE_POST_TIME}:</label></dt>
<dd style="margin-top:3px;">
<input class="inputbox autowidth" type="text" name="new_post_time" value="{NEW_POST_TIME}" />
<input type="submit" class="button2" name="action[chgposttime]" value="{L_SUBMIT}" />
</dd>
</dl>
</fieldset>
Вернуться в 450 модов движка форумов phpBB (до версии 3.0.14)