本文整理汇总了PHP中format_timestamp函数的典型用法代码示例。如果您正苦于以下问题:PHP format_timestamp函数的具体用法?PHP format_timestamp怎么用?PHP format_timestamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_timestamp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: mail_read
function mail_read()
{
global $smarty;
$mail_id = (int) $_REQUEST['mail_id'];
$db_query = "\n\t\t\tSELECT \n\t\t\t\t`players`.`name` as 'from', \n\t\t\t\t`mail`.`mail_id`, \n\t\t\t\t`mail`.`from_player_id`, \n\t\t\t\t`mail`.`body`, \n\t\t\t\t`mail`.`subject`, \n\t\t\t\t`mail`.`time`, \n\t\t\t\t`mail`.`status` \n\t\t\tFROM `mail` \n\t\t\tLEFT JOIN `players` ON `players`.`player_id` = `mail`.`from_player_id` \n\t\t\tWHERE \n\t\t\t\t`mail`.`round_id` = '" . $_SESSION['round_id'] . "' AND \n\t\t\t\t`mail`.`mail_id` = '" . $mail_id . "' AND \n\t\t\t\t`mail`.`to_player_id` = '" . $_SESSION['player_id'] . "' AND \n\t\t\t\t`mail`.`status` != '" . MAILSTATUS_DELETED . "'\n\t\t\tORDER BY `time` ASC \n\t\t\tLIMIT 30";
$db_result = mysql_query($db_query);
if (mysql_num_rows($db_result) == 0) {
$status[] = 'That mail does not exist or you do not have permission to view it.';
$smarty->append('status', $status);
mail_list();
exit;
}
$mail = mysql_fetch_array($db_result, MYSQL_ASSOC);
$mail['time'] = format_timestamp($mail['time'] + 3600 * $_SESSION['preferences']['timezone']);
$mail['subject'] = htmlentities($mail['subject']);
$mail['body'] = nl2br(htmlentities($mail['body']));
if ($mail['from_player_id'] == 0) {
$mail['from'] = 'Administration';
}
$bbtags = array('b' => array('Name' => 'b', 'HtmlBegin' => '<span style="font-weight: bold;">', 'HtmlEnd' => '</span>'), 'i' => array('Name' => 'i', 'HtmlBegin' => '<span style="font-style: italic;">', 'HtmlEnd' => '</span>'), 'u' => array('Name' => 'u', 'HtmlBegin' => '<span style="text-decoration: underline;">', 'HtmlEnd' => '</span>'), 's' => array('Name' => 's', 'HtmlBegin' => '<span style="text-decoration: line-through;">', 'HtmlEnd' => '</span>'), 'quote' => array('Name' => 'quote', 'HasParam' => true, 'HtmlBegin' => '<b>Quote %%P%%:</b><div class="mailquote">', 'HtmlEnd' => '</div>'));
require_once dirname(__FILE__) . '/includes/bbcode.php';
$bbcode = new bbcode();
$bbcode->add_tag($bbtags['b']);
$bbcode->add_tag($bbtags['i']);
$bbcode->add_tag($bbtags['u']);
$bbcode->add_tag($bbtags['s']);
$bbcode->add_tag($bbtags['quote']);
$mail['body'] = $bbcode->parse_bbcode($mail['body']);
if ($mail['status'] == 1) {
$db_query = "UPDATE `mail` SET `status` = '2' WHERE `mail_id` = '" . $mail_id . "' LIMIT 1";
$db_result = mysql_query($db_query);
}
$smarty->assign('mail', $mail);
$smarty->display('mail_read.tpl');
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:35,代码来源:mail.php
示例2: help_status
function help_status()
{
global $smarty;
$db_query = "\n\t\t\tSELECT \n\t\t\t\t`round_id`, \n\t\t\t\t`round_engine`, \n\t\t\t\t`name`, \n\t\t\t\t`description`, \n\t\t\t\t`starttime`, \n\t\t\t\t`stoptime`, \n\t\t\t\t`starsystems`, \n\t\t\t\t`planets`, \n\t\t\t\t`resistance`, \n\t\t\t\t`speed`, \n\t\t\t\t`resourcetick`, \n\t\t\t\t`combattick` \n\t\t\tFROM `rounds` \n\t\t\tWHERE `round_id` = '" . $_SESSION['round_id'] . "' \n\t\t\tLIMIT 1";
$db_result = mysql_query($db_query);
$round = mysql_fetch_array($db_result, MYSQL_ASSOC);
$round['speed'] /= 1000;
// Dynamic attack limit based on elapsed time of current round
$end_time = 3456000 * $_SESSION['round_speed'];
$current_time = microfloat() - $round['starttime'];
$attack_limit = 1 - $current_time / $end_time;
if ($attack_limit < 0) {
$attack_limit = 0;
}
$round['attack_limit'] = round($attack_limit * 100, 2);
$round['description'] = nl2br($round['description']);
$round['starttime'] = format_timestamp($round['starttime']);
$round['stoptime'] = format_timestamp($round['stoptime']);
$round['resistance'] = format_number($round['resistance']);
$round['resourcetick'] = format_time(timeparser($round['resourcetick'] / 1000));
$round['combattick'] = format_time(timeparser($round['combattick'] / 1000));
$smarty->assign('round', $round);
$smarty->display('help_status.tpl');
exit;
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:25,代码来源:help.php
示例3: add_news_entry
function add_news_entry($type, $information)
{
global $sql, $smarty;
require_once dirname(__FILE__) . '/news_resource.php';
$sql->select(array('news_entries', 'news_entry_id'));
$sql->where(array('news_entries', 'type', $type));
$sql->raw(array('orderby', 'RAND(' . microfloat() . ')'));
$sql->limit(1);
$db_result = $sql->execute();
$db_row = mysql_fetch_array($db_result, MYSQL_ASSOC);
$news_entry_id = $db_row['news_entry_id'];
$posted = $information['posted'];
$information['posted'] = format_timestamp($information['posted']);
foreach ($information as $key => $value) {
$smarty->assign($key, $value);
}
$smarty->fetch('news:' . $news_entry_id);
$entry_subject = $smarty->get_template_vars('subject');
$entry_body = $smarty->get_template_vars('body');
$news_insert = array('round_id' => $_SESSION['round_id'], 'type' => $type, 'subject' => $entry_subject, 'body' => $entry_body, 'posted' => $posted);
$fields = array('kingdom_id', 'player_id', 'planet_id');
foreach ($fields as $value) {
if (!empty($information[$value])) {
$news_insert[$value] = $information[$value];
}
}
$sql->execute('news', $news_insert);
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:28,代码来源:functions.php
示例4: format_message
function format_message($row)
{
$msg = irc_split_message($row['data']);
extract($msg);
switch ($command) {
case 'PRIVMSG':
if ($message[0] == "") {
$o = "* " . format_nick($origin) . " " . str_replace("ACTION", '', $message);
} else {
$o = "<" . format_nick($origin) . "> {$message}";
}
break;
case 'NICK':
$o = format_nick($origin) . " is now known as\n\t\t\t\t" . format_nick($message);
break;
case 'JOIN':
$o = format_nick($origin) . " has joined {$dest}";
break;
case 'QUIT':
$o = format_nick($origin) . " has quit ({$message})";
break;
default:
$o = $row['data'];
}
return format_timestamp($row['timestamp']) . " {$o}<br />";
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:26,代码来源:read.php
示例5: print_welcome_block
function print_welcome_block($block = true, $config = "", $side, $index)
{
global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES;
$id = "user_welcome";
$title = $pgv_lang["welcome"] . " " . getUserFullName(PGV_USER_ID);
$content = "<table class=\"blockcontent\" cellspacing=\"0\" cellpadding=\"0\" style=\" width: 100%; direction:ltr;\"><tr>";
$content .= "<td class=\"tab_active_bottom\" colspan=\"3\" ></td></tr><tr>";
if (get_user_setting(PGV_USER_ID, 'editaccount') == 'Y') {
$content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"edituser.php\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["mygedview"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["myuserdata"] . "\" title=\"" . $pgv_lang["myuserdata"] . "\" /><br />" . $pgv_lang["myuserdata"] . "</a></td>";
}
if (PGV_USER_GEDCOM_ID) {
$content .= "<td class=\"center details2\" style=\" width: 34%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("pedigree.php?rootid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_pedigree"] . "\" title=\"" . $pgv_lang["my_pedigree"] . "\" /><br />" . $pgv_lang["my_pedigree"] . "</a></td>";
$content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("individual.php?pid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_indi"] . "\" title=\"" . $pgv_lang["my_indi"] . "\" /><br />" . $pgv_lang["my_indi"] . "</a></td>";
}
$content .= "</tr><tr><td class=\"center\" colspan=\"3\">";
$content .= print_help_link("mygedview_customize_help", "qm", "", false, true);
$content .= "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name=" . PGV_USER_NAME . "&ctype=user") . "', '_blank', 'top=50,left=10,width=600,height=350,scrollbars=1,resizable=1');\">" . $pgv_lang["customize_page"] . "</a>";
$content .= "<br />" . format_timestamp(client_time());
$content .= "</td>";
$content .= "</tr></table>";
global $THEME_DIR;
if ($block) {
require $THEME_DIR . 'templates/block_small_temp.php';
} else {
require $THEME_DIR . 'templates/block_main_temp.php';
}
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:27,代码来源:user_welcome.php
示例6: getBlock
public function getBlock($block_id, $template = true, $cfg = null)
{
global $ctype;
switch (WT_Filter::get('action')) {
case 'deletenews':
$news_id = WT_Filter::getInteger('news_id');
if ($news_id) {
deleteNews($news_id);
}
break;
}
$block = get_block_setting($block_id, 'block', true);
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
}
$usernews = getUserNews(WT_USER_ID);
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = '';
$title .= $this->getTitle();
$content = '';
if (count($usernews) == 0) {
$content .= WT_I18N::translate('You have not created any journal items.');
}
foreach ($usernews as $key => $news) {
$day = date('j', $news['date']);
$mon = date('M', $news['date']);
$year = date('Y', $news['date']);
$content .= "<div class=\"journal_box\">";
$content .= "<div class=\"news_title\">" . $news['title'] . '</div>';
$content .= "<div class=\"news_date\">" . format_timestamp($news['date']) . '</div>';
if ($news["text"] == strip_tags($news["text"])) {
// No HTML?
$news["text"] = nl2br($news["text"], false);
}
$content .= $news["text"] . "<br><br>";
$content .= "<a href=\"#\" onclick=\"window.open('editnews.php?news_id='+" . $key . ", '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Edit') . "</a> | ";
$content .= "<a href=\"index.php?action=deletenews&news_id={$key}&ctype={$ctype}\" onclick=\"return confirm('" . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . "</a><br>";
$content .= "</div><br>";
}
if (WT_USER_ID) {
$content .= "<br><a href=\"#\" onclick=\"window.open('editnews.php?user_id='+WT_USER_ID, '_blank', indx_window_specs); return false;\">" . WT_I18N::translate('Add a new journal entry') . "</a>";
}
if ($template) {
if ($block) {
require WT_THEME_DIR . 'templates/block_small_temp.php';
} else {
require WT_THEME_DIR . 'templates/block_main_temp.php';
}
} else {
return $content;
}
}
开发者ID:brambravo,项目名称:webtrees,代码行数:57,代码来源:module.php
示例7: print_user_news
/**
* Prints a user news/journal
*
*/
function print_user_news($block = true, $config = "", $side, $index)
{
global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION, $ctype;
$usernews = getUserNews(PGV_USER_ID);
$id = "user_news";
$title = print_help_link("mygedview_myjournal_help", "qm", "", false, true);
$title .= $pgv_lang["my_journal"];
$content = "";
if (count($usernews) == 0) {
$content .= $pgv_lang["no_journal"] . ' ';
}
foreach ($usernews as $key => $news) {
$day = date("j", $news["date"]);
$mon = date("M", $news["date"]);
$year = date("Y", $news["date"]);
$content .= "<div class=\"person_box\">";
$ct = preg_match("/#(.+)#/", $news["title"], $match);
if ($ct > 0) {
if (isset($pgv_lang[$match[1]])) {
$news["title"] = str_replace($match[0], $pgv_lang[$match[1]], $news["title"]);
}
}
$content .= "<span class=\"news_title\">" . PrintReady($news["title"]) . "</span><br />";
$content .= "<span class=\"news_date\">" . format_timestamp($news["date"]) . "</span><br /><br />";
if (preg_match("/#(.+)#/", $news["text"], $match)) {
if (isset($pgv_lang[$match[1]])) {
$news["text"] = str_replace($match[0], $pgv_lang[$match[1]], $news["text"]);
}
}
if (preg_match("/#(.+)#/", $news["text"], $match)) {
if (isset($pgv_lang[$match[1]])) {
$news["text"] = str_replace($match[0], $pgv_lang[$match[1]], $news["text"]);
}
if (isset(${$match}[1])) {
$news["text"] = str_replace($match[0], ${$match}[1], $news["text"]);
}
}
$trans = get_html_translation_table(HTML_SPECIALCHARS);
$trans = array_flip($trans);
$news["text"] = strtr($news["text"], $trans);
$news["text"] = nl2br($news["text"]);
$content .= PrintReady($news["text"]) . "<br /><br />";
$content .= "<a href=\"javascript:;\" onclick=\"editnews('{$key}'); return false;\">" . $pgv_lang["edit"] . "</a> | ";
$content .= "<a href=\"" . encode_url("index.php?action=deletenews&news_id={$key}&ctype={$ctype}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_journal_delete"] . "');\">" . $pgv_lang["delete"] . "</a><br />";
$content .= "</div><br />";
}
if (PGV_USER_ID) {
$content .= "<br /><a href=\"javascript:;\" onclick=\"addnews('" . PGV_USER_ID . "'); return false;\">" . $pgv_lang["add_journal"] . "</a>";
}
global $THEME_DIR;
if ($block) {
require $THEME_DIR . 'templates/block_small_temp.php';
} else {
require $THEME_DIR . 'templates/block_main_temp.php';
}
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:60,代码来源:user_blog.php
示例8: print_gedcom_block
function print_gedcom_block($block = true, $config = "", $side, $index)
{
global $hitCount, $pgv_lang, $SHOW_COUNTER;
$id = "gedcom_welcome";
$title = PrintReady(get_gedcom_setting(PGV_GED_ID, 'title'));
$content = "<div class=\"center\">";
$content .= "<br />" . format_timestamp(client_time()) . "<br />\n";
if ($SHOW_COUNTER) {
$content .= $pgv_lang["hit_count"] . " " . $hitCount . "<br />\n";
}
$content .= "\n<br />";
if (PGV_USER_GEDCOM_ADMIN) {
$content .= "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name=" . PGV_GEDCOM . "&ctype=gedcom") . "', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1'); return false;\">" . $pgv_lang["customize_gedcom_page"] . "</a><br />\n";
}
$content .= "</div>";
global $THEME_DIR;
require $THEME_DIR . 'templates/block_main_temp.php';
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:18,代码来源:gedcom_block.php
示例9: news
function news()
{
global $smarty, $sql, $data;
$scores = news_scores();
$smarty->assign('scores', $scores);
$players = news_players();
$smarty->assign('players', $players);
$smarty->assign('kingdom_id', $_SESSION['kingdom_id']);
$playerstats = news_playerstats();
$smarty->assign('playerstats', $playerstats);
// $type_news = array(
// 'military' => array(NEWS_WAR, NEWS_PEACE, NEWS_ALLY, NEWS_PLANETCONQUERED, NEWS_PLAYERCAPTURED, NEWS_KINGDOMDEFEATED),
// 'infrastructure' => array(NEWS_FIRSTRESEARCH, NEWS_RESEARCH, NEWS_BUILDING, NEWS_COMMISSION));
$global_news = array(NEWS_WAR, NEWS_PEACE, NEWS_ALLY, NEWS_FIRSTRESEARCH, NEWS_PLANETCONQUERED, NEWS_PLAYERCAPTURED, NEWS_KINGDOMDEFEATED, NEWS_EXECUTION, NEWS_GAMEANNOUNCEMENT);
$kingdom_news = array(NEWS_RESEARCH);
$player_news = array(NEWS_BUILDING, NEWS_COMMISSION);
$news = array();
if (!empty($_REQUEST['news_id'])) {
$news_id = abs((int) $_REQUEST['news_id']);
$sql->where(array('news', 'news_id', $news_id));
$db_result = $sql->execute();
$db_row = mysql_fetch_array($db_result, MYSQL_ASSOC);
if (in_array($db_row['type'], $global_news) || in_array($db_row['type'], $kingdom_news) && $db_row['kingdom_id'] == $_SESSION['kingdom_id'] || in_array($db_row['type'], $player_news) && $db_row['player_id'] == $_SESSION['player_id']) {
$news[] = $db_row;
}
}
if (empty($news)) {
$db_query = "\n\t\t\t\tSELECT * \n\t\t\t\tFROM `news` \n\t\t\t\tWHERE \n\t\t\t\t\t`round_id` = '" . $_SESSION['round_id'] . "' AND \n\t\t\t\t\t(\n\t\t\t\t\t\t`type` IN ('" . implode("', '", $global_news) . "')";
$player = $data->player($_SESSION['player_id']);
if ($player['rank'] > 0) {
$db_query .= " OR \n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t`type` IN ('" . implode("', '", $kingdom_news) . "') AND \n\t\t\t\t\t\t\t`kingdom_id` = '" . $_SESSION['kingdom_id'] . "'\n\t\t\t\t\t\t) OR\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t`type` IN ('" . implode("', '", $player_news) . "') AND \n\t\t\t\t\t\t\t`kingdom_id` = '" . $_SESSION['kingdom_id'] . "' AND \n\t\t\t\t\t\t\t`player_id` = '" . $_SESSION['player_id'] . "'\n\t\t\t\t\t\t)";
}
$db_query .= "\n\t\t\t\t\t)\n\t\t\t\tORDER BY `posted` DESC \n\t\t\t\tLIMIT 20";
$db_result = mysql_query($db_query);
while ($db_row = mysql_fetch_array($db_result, MYSQL_ASSOC)) {
$db_row['posted'] = format_timestamp($db_row['posted']);
$news[] = $db_row;
}
}
$smarty->assign('news', $news);
$smarty->display('news.tpl');
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:42,代码来源:news.php
示例10: escapeshellarg
$rev['count']++;
}
}
if ($rev['count']) {
$rev['type'] = 'svn';
}
}
if (!$rev['count'] && is_executable($config['git'])) {
$cmd_dir = escapeshellarg(dirname($device_config_file));
$git_dir = escapeshellarg(dirname($device_config_file) . '/.git');
$gitlogs = external_exec($config['git'] . ' --git-dir=' . $git_dir . ' --work-tree=' . $cmd_dir . ' log --pretty=format:"%h %ci" ' . $cmd_file);
foreach (explode("\n", $gitlogs) as $line) {
// b6989b9 2014-11-10 00:16:53 +0100
// 66840ee 2014-11-02 23:34:18 +0100
if (preg_match('/(?<rev>\\w+) (?<date>[\\d\\-]+ [\\d:]+ [\\+\\-]?\\d+)/', $line, $matches)) {
$rev['list'][] = array('rev' => $matches['rev'], 'date' => format_timestamp($matches['date']));
$rev['count']++;
}
}
if ($rev['count']) {
$rev['type'] = 'git';
}
}
$navbar['options']['latest']['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig'));
$navbar['options']['latest']['class'] = 'active';
if ($rev['count']) {
$rev_active_index = 0;
foreach ($rev['list'] as $i => $entry) {
$rev_name = $rev['type'] == 'svn' ? 'r' . $entry['rev'] : $entry['rev'];
if ($i > 9) {
break;
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:showconfig.inc.php
示例11: encode_url
$output .= '<td class="list_label">GEDCOM</td>';
$output .= '<td class="list_label">' . $pgv_lang['undo'] . '</td>';
$output .= '</tr>';
}
if ($i == count($changes) - 1) {
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"" . encode_url("edit_changes.php?action=accept&cid={$cid}") . "\">" . $pgv_lang['accept'] . "</a></td>";
} else {
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"> </td>";
}
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><b>" . $pgv_lang[$change['type']] . "</b></td>";
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"javascript:;\" onclick=\"return reply('" . $change['user'] . "', '" . $pgv_lang['review_changes'] . "')\" alt=\"" . $pgv_lang['message'] . "\">";
if ($user_id = get_user_id($change['user'])) {
$output .= PrintReady(getUserFullName($user_id));
}
$output .= PrintReady(" (" . $change['user'] . ")") . "</a></td>";
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\">" . format_timestamp($change['time']) . "</td>";
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\">" . $change['gedcom'] . "</td>";
if ($i == count($changes) - 1) {
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"><a href=\"" . encode_url("edit_changes.php?action=undo&cid={$cid}&index={$i}") . "\">" . $pgv_lang['undo'] . "</a></td>";
} else {
$output .= "<td class=\"list_value {$TEXT_DIRECTION}\"> </td>";
}
$output .= '</tr>';
if ($i == count($changes) - 1) {
$output .= '</table></div><br />';
}
}
}
$output .= "</td></tr></table>";
//-- Now for the global Action bar:
$output2 = "<br /><table class=\"list_table\">";
开发者ID:rathervague,项目名称:phpgedview,代码行数:31,代码来源:edit_changes.php
示例12: reports_view
function reports_view()
{
global $smarty, $sql;
if (!empty($_REQUEST['combatreport_id'])) {
$combatreport_id = abs((int) $_REQUEST['combatreport_id']);
}
$sql->select(array('combatreports', 'report'));
$sql->where(array(array('combatreports', 'combatreport_id', $combatreport_id), array('combatreports', 'round_id', $_SESSION['round_id']), array('combatreports', 'kingdom_id', $_SESSION['kingdom_id'])));
$sql->limit(1);
$db_result = $sql->execute();
if (!$db_result || mysql_num_rows($db_result) == 0) {
error(__FILE__, __LINE__, 'INVALID_COMBATREPORT', 'Invalid combat report specified.');
}
$db_row = mysql_fetch_array($db_result, MYSQL_ASSOC);
$combatreport = unserialize($db_row['report']);
$combatreport['header']['date'] = format_timestamp($combatreport['header']['date']);
foreach ($combatreport['names'] as $category => $names) {
if ($category == 'kingdoms' || $category == 'weapons') {
foreach ($names as $id => $name) {
$combatreport['names'][$category][$id] = strshort($name, 20, '<span title="' . $name . '">...</span>');
}
} else {
foreach ($names as $type => $more_names) {
foreach ($more_names as $id => $name) {
$combatreport['names'][$category][$type][$id] = strshort($name, 20, '<span title="' . $name . '">...</span>');
}
}
}
}
// Format all the numbers
foreach ($combatreport['details'] as $kingdom_id => $types) {
foreach ($types as $type => $groups) {
foreach ($groups as $group_id => $units) {
foreach ($units as $unit_id => $weapons) {
foreach ($weapons as $weapon_id => $target) {
foreach ($target as $detail_id => $details) {
$combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['hits'] = format_number($combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['hits'], true);
$combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['damage'] = format_number($combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['damage'], true);
$combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['kills'] = format_number($combatreport['details'][$kingdom_id][$type][$group_id][$unit_id][$weapon_id][$detail_id]['kills'], true);
}
}
}
}
}
}
$smarty->assign('combatreport', $combatreport);
$smarty->display('reports_view.tpl');
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:48,代码来源:military.php
示例13: getBlock
public function getBlock($block_id, $template = true, $cfg = null)
{
global $ctype, $WEBTREES_EMAIL;
$changes = WT_DB::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending'" . " LIMIT 1")->fetchOne();
$days = get_block_setting($block_id, 'days', 1);
$sendmail = get_block_setting($block_id, 'sendmail', true);
$block = get_block_setting($block_id, 'block', true);
if ($cfg) {
foreach (array('days', 'sendmail', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
}
if ($changes && $sendmail == 'yes') {
// There are pending changes - tell moderators/managers/administrators about them.
if (WT_TIMESTAMP - WT_Site::getPreference('LAST_CHANGE_EMAIL') > 60 * 60 * 24 * $days) {
// Which users have pending changes?
foreach (User::all() as $user) {
if ($user->getSetting('contactmethod') !== 'none') {
foreach (WT_Tree::getAll() as $tree) {
if (exists_pending_change($user, $tree)) {
WT_I18N::init($user->getSetting('language'));
WT_Mail::systemMessage($tree, $user, WT_I18N::translate('Pending changes'), WT_I18N::translate('There are pending changes for you to moderate.') . WT_Mail::EOL . WT_MAIL::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '</a>');
WT_I18N::init(WT_LOCALE);
}
}
}
}
WT_Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP);
}
if (WT_USER_CAN_EDIT) {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
$title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
$title .= $this->getTitle() . help_link('review_changes', $this->getName());
$content = '';
if (WT_USER_CAN_ACCEPT) {
$content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . WT_I18N::translate('There are pending changes for you to moderate.') . "</a><br>";
}
if ($sendmail == "yes") {
$content .= WT_I18N::translate('Last email reminder was sent ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>";
$content .= WT_I18N::translate('Next email reminder will be sent after ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL') + 60 * 60 * 24 * $days) . "<br><br>";
}
$changes = WT_DB::prepare("SELECT xref" . " FROM `##change`" . " WHERE status='pending'" . " AND gedcom_id=?" . " GROUP BY xref")->execute(array(WT_GED_ID))->fetchAll();
foreach ($changes as $change) {
$record = WT_GedcomRecord::getInstance($change->xref);
if ($record->canShow()) {
$content .= '<b>' . $record->getFullName() . '</b>';
$content .= $block ? '<br>' : ' ';
$content .= '<a href="' . $record->getHtmlUrl() . '">' . WT_I18N::translate('View the changes') . '</a>';
$content .= '<br>';
}
}
if ($template) {
if ($block) {
require WT_THEME_DIR . 'templates/block_small_temp.php';
} else {
require WT_THEME_DIR . 'templates/block_main_temp.php';
}
} else {
return $content;
}
}
}
}
开发者ID:jacoline,项目名称:webtrees,代码行数:70,代码来源:module.php
示例14: foreach
foreach ($tasks as $i => $task) {
?>
<tr class="<?php
echo fmod($i, 2) ? 'even' : 'odd';
?>
">
<td><?php
echo link_to($task, 'backlogtask_show', $task);
?>
</td>
<td class="center"><?php
echo format_priority($task->getPriority());
?>
</td>
<td class="center"><?php
echo format_timestamp($task->getEstimate());
?>
</td>
<td class="center">
<?php
echo edit_link_to('backlogtask_edit', $task);
?>
<?php
echo delete_link_to('backlogtask_delete', $task);
?>
</td>
</tr>
<?php
}
?>
</tbody>
开发者ID:nubee,项目名称:nubee,代码行数:31,代码来源:_list.php
示例15: format_timestamp
"><?php
echo format_timestamp($task->getCurrentEstimate(), 'h');
?>
</td>
</tr>
<tr>
<th>Effort spent</th>
<td><?php
echo format_timestamp($task->getEffortSpent(), 'h');
?>
</td>
</tr>
<tr>
<th>Effort left</th>
<td><?php
echo format_timestamp($task->getEffortLeft(), 'h');
?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h2>
Working Units
</h2>
<?php
if ($task->getCurrentEstimate() == 0) {
?>
开发者ID:nubee,项目名称:nubee,代码行数:31,代码来源:showSuccess.php
示例16: print_syslogs
//.........这里部分代码省略.........
case 'timestamp_from':
$where .= ' AND `timestamp` > ?';
$param[] = $value;
break;
case 'timestamp_to':
$where .= ' AND `timestamp` < ?';
$param[] = $value;
break;
}
}
}
// Show events only for permitted devices
$query_permitted = generate_query_permitted();
$query = 'FROM `syslog` ';
$query .= $where . $query_permitted;
$query_count = 'SELECT COUNT(`seq`) ' . $query;
$query = 'SELECT * ' . $query;
$query .= ' ORDER BY `seq` DESC ';
$query .= "LIMIT {$start},{$pagesize}";
// Query syslog messages
$entries = dbFetchRows($query, $param);
// Query syslog count
if ($pagination && !$short) {
$count = dbFetchCell($query_count, $param);
} else {
$count = count($entries);
}
if (!$count) {
// There have been no entries returned. Print the warning.
print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.
See <a href="http://www.observium.org/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="http://www.observium.org/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
} else {
// Entries have been returned. Print the table.
$list = array('device' => FALSE, 'priority' => TRUE);
// For now (temporarily) priority always displayed
if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
$list['device'] = TRUE;
}
if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
$list['priority'] = TRUE;
}
$string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
if (!$short) {
$string .= ' <thead>' . PHP_EOL;
$string .= ' <tr>' . PHP_EOL;
$string .= ' <th>Date</th>' . PHP_EOL;
if ($list['device']) {
$string .= ' <th>Device</th>' . PHP_EOL;
}
if ($list['priority']) {
$string .= ' <th>Priority</th>' . PHP_EOL;
}
$string .= ' <th>Message</th>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
$string .= ' </thead>' . PHP_EOL;
}
$string .= ' <tbody>' . PHP_EOL;
foreach ($entries as $entry) {
$string .= ' <tr>';
if ($short) {
$string .= ' <td class="syslog" style="white-space: nowrap">';
$timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
$string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
} else {
$string .= ' <td width="160">';
$string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
}
if ($list['device']) {
$dev = device_by_id_cache($entry['device_id']);
$device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'syslog');
$string .= ' <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
}
if ($list['priority']) {
if (!$short) {
$string .= ' <td style="color: ' . $priorities[$entry['priority']]['color'] . '; white-space: nowrap;">' . nicecase($priorities[$entry['priority']]['name']) . ' (' . $entry['priority'] . ')</td>' . PHP_EOL;
}
}
$entry['program'] = empty($entry['program']) ? '[[EMPTY]]' : $entry['program'];
if ($short) {
$string .= ' <td class="syslog">';
$string .= '<strong style="color: ' . $priorities[$entry['priority']]['color'] . ';">' . $entry['program'] . '</strong> : ';
} else {
$string .= ' <td>';
$string .= '<strong>' . $entry['program'] . '</strong> : ';
}
$string .= htmlspecialchars($entry['msg']) . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>' . PHP_EOL;
// Print pagination header
if ($pagination && !$short) {
$string = pagination($vars, $count) . $string . pagination($vars, $count);
}
// Print syslog
echo $string;
}
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:101,代码来源:syslogs.inc.php
示例17: generate_link
$show_menu .= generate_link('Latest', array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig'));
$show_menu .= '</span>';
} else {
$show_menu .= generate_link('Latest', array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig'));
}
if (check_extension_exists('svn')) {
$sep = ' | ';
$svnlogs = svn_log($device_config_file, SVN_REVISION_HEAD, NULL, 8);
$revlist = array();
foreach ($svnlogs as $svnlog) {
$show_menu .= $sep;
$revlist[] = $svnlog['rev'];
if ($vars['rev'] == $svnlog['rev']) {
$show_menu .= '<span class="pagemenu-selected">';
}
$linktext = 'r' . $svnlog['rev'] . ' <small>' . format_timestamp($svnlog['date']) . '</small>';
$show_menu .= generate_link($linktext, array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig', 'rev' => $svnlog['rev']));
if ($vars['rev'] == $svnlog['rev']) {
$show_menu .= '</span>' . PHP_EOL;
}
}
}
echo $show_menu;
print_optionbar_end();
if (check_extension_exists('svn') && in_array($vars['rev'], $revlist)) {
list($diff, $errors) = svn_diff($device_config_file, $vars['rev'] - 1, $device_config_file, $vars['rev']);
if (!$diff) {
$text = '没有区别';
} else {
$text = '';
while (!feof($diff)) {
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:showconfig.inc.php
示例18: review_changes_block
-
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1291|2022-08-30
-
OpenTeknik LLC OSSN OPEN SOURCE SOCIAL NETWORK v6.3 LTS was discovered to contai
阅读:867|2022-07-29
-
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1205|2022-08-17
-
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:1002|2022-11-06
-
一、电脑软硬件基础知识 1、CPU型号怎么看? CPU是一台电脑的核心,而目前笔记本市场
阅读:802|2022-07-30
-
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1404|2022-08-18
-
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:519|2022-08-16
-
当数据集已处于插入状态时,如何确定数据感知组件字段是否已被修改?我想知道一个字段
阅读:621|2022-07-18
-
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:669|2022-11-06
-
A vulnerability has been identified in Mendix Excel Importer Module (Mendix 8 co
阅读:787|2022-07-29
|
请发表评论