本文整理汇总了PHP中timestr函数的典型用法代码示例。如果您正苦于以下问题:PHP timestr函数的具体用法?PHP timestr怎么用?PHP timestr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timestr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testComments_preview
function testComments_preview()
{
global $t, $bx, $auth, $subject, $text;
$auth->set_uname('this is the username');
$subject = 'this is the subject';
$text = 'this is the text//\\//\\fubar[[]][*](?)';
$db_config = new mock_db_configure(1);
$db_config->add_query("SELECT email_usr FROM auth_user WHERE " . "username='" . $auth->auth["uname"] . "'");
$bx = $this->_create_default_box();
$this->capture_call('comments_preview', 983 + strlen(timestr(time())), array(''));
$this->_checkFor_a_box('Comment', '%s ' . stripslashes($subject));
$this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
$ps = array(0 => $this->_to_regexp(lib_nick($auth->auth['uname'])), 1 => $this->_to_regexp("<p>" . stripslashes($text) . "\n"));
$this->_testFor_patterns($ps, 2);
$this->_check_db($db_config);
}
示例2: testShow_consultants
function testShow_consultants()
{
global $db, $t, $bx;
$db_config = new mock_db_configure(2);
$db_q = array(0 => "SELECT * FROM consultants,auth_user WHERE " . "proid='%s' AND username=consultant ORDER " . "BY creation");
$dat = $this->_generate_records(array("proid"), 2);
$rows = $this->_generate_records(array("username", "status", "creation"), 3);
$db_config->add_query(sprintf($db_q[0], $dat[0]["proid"]), 0);
$db_config->add_query(sprintf($db_q[0], $dat[1]["proid"]), 1);
$db_config->add_num_row(0, 0);
$db_config->add_num_row(3, 1);
$db_config->add_record($rows[0], 1);
$db_config->add_record($rows[1], 1);
$db_config->add_record($rows[2], 1);
// first test: no data to list, print error message
$db = new DB_SourceAgency();
$bx = new box();
$this->set_msg("test 1");
$this->capture_call('show_consultants', 64, &$dat[0]);
$this->_testFor_pattern("No developers have offered " . "themselves as consultants yet");
// second test: three pieces of data
$db = new DB_SourceAgency();
$bx = $this->_create_default_box();
$this->set_msg('test 2');
$this->capture_call('show_consultants', 3573, &$dat[1]);
$this->_checkFor_a_box('Consultants');
$this->_checkFor_columns(4);
$this->_checkFor_column_titles(array("Number", "Username", "Status", "Creation"), '', '', '');
$colors = array(1 => 'gold', 0 => '#FFFFFF');
for ($idx = 1; $idx < 4; $idx++) {
$row = $rows[$idx - 1];
$this->set_msg("Test {$idx}");
$this->_testFor_box_next_row_of_columns();
$this->_checkFor_column_values(array('<b>' . $idx . '</b>', '<b>' . lib_nick($row['username']), '<b>' . show_status($row["status"]) . '</b>', '<b>' . timestr(mktimestamp($row["creation"])) . '</b>'), '', '', $colors[$idx % 2]);
}
$this->_check_db($db_config);
}
示例3: testCooperation_show
function testCooperation_show()
{
global $t, $bx, $db, $sess;
$qs = array(0 => "SELECT * FROM cooperation,auth_user WHERE devid='%s'" . " AND developer=username ORDER BY creation DESC", 1 => "SELECT * FROM comments,auth_user WHERE proid='%s' " . "AND type='%s' AND number='%s' AND ref='%s' AND " . "user_cmt=username ORDER BY creation_cmt ASC");
$db_config = new mock_db_configure(3);
$args = $this->_generate_records(array('proid', 'devid'), 10);
$dat = $this->_generate_records(array('creation', 'cost', 'status', 'developer'), 20);
// test one
$db_config->add_query(sprintf($qs[0], $args[0]['devid']), 0);
$db_config->add_num_row(0, 0);
// test two
$db_config->add_query(sprintf($qs[0], $args[1]['devid']), 1);
$db_config->add_num_row(1, 1);
$db_config->add_record($dat[0], 1);
$db_config->add_record(false, 1);
$db_config->add_query(sprintf($qs[1], $args[1]['proid'], 'Cooperation', $dat[0]['creation'], '0'), 2);
$db_config->add_num_row(0, 2);
// test one: no records
$db = new DB_SourceAgency();
$bx = $this->_create_default_box();
$this->capture_call('cooperation_show', 77, $args[0]);
$this->assertEquals("<p>There have not been posted any cooperation " . "proposals by any developer.<p>\n", $this->get_text());
// test two: one row of data
$db = new DB_SourceAgency();
$bx = $this->_create_default_box();
$this->capture_call('cooperation_show', 916, $args[1]);
$this->_checkFor_a_box('Cooperation');
$this->_testFor_lib_nick($dat[0]['developer']);
$str = ' - ' . timestr(mktimestamp($dat[0]['creation'])) . "</b>";
$this->_testFor_pattern($this->_to_regexp($str));
$str = '<p><b>Cost</b>: ' . $dat[0]['cost'] . " euro\n";
$this->_testFor_pattern($this->_to_regexp($str));
$str = '<br><b>Status</b>: ' . show_status($dat[0]['status']) . "\n";
$this->_testFor_pattern($this->_to_regexp($str));
$this->_testFor_lib_comment_it($args[1]['proid'], 'Cooperation', $dat[0]['creation'], 0, '', $t->translate('Comment This Cooperation!'));
$this->_check_db($db_config);
}
示例4: htmlp_link
echo "<tr><td align=right width=30%>" . $t->translate("Contact") . ":</td><td width=70%>";
$pquery["devname"] = $db->f("username");
htmlp_link("pmess_compose.php", $pquery, $t->translate("write Developer"));
}
if ($db->f("showemail") == "yes") {
echo "<tr><td align=right width=30%>" . $t->translate("E-Mail") . ":</td><td width=70%><a href=\"mailto:" . $db->f("email_usr") . "\">" . ereg_replace("@", " at ", htmlentities($db->f("email_usr"))) . "</a>\n";
}
echo "<tr><td align=right width=30%>" . $t->translate("Developer last modified") . ":</td><td width=70%>\n";
$timestamp = mktimestamp($db->f("modification_usr"));
echo timestr($timestamp) . "</td></tr>\n";
echo "<tr><td align=right width=30%>" . $t->translate("Developer created") . ":</td><td width=70%>\n";
$timestamp = mktimestamp($db->f("creation_usr"));
echo timestr($timestamp) . "</td></tr>\n";
echo "<tr><td align=right width=30%>" . $t->translate("Profile last modified") . ":</td><td width=70%>\n";
$timestamp = mktimestamp($db->f("creation"));
echo timestr($timestamp) . "</td></tr>\n";
$db2->query("SELECT devel_cnt FROM counter WHERE develid='{$develid}'");
$db2->next_record();
echo "<tr><td align=right width=30%>" . $t->translate("# of Visits") . ":</td><td width=70%>\n";
echo $db2->f("devel_cnt") . "</td></tr>\n";
echo "<tr><td align=right width=30%>" . $t->translate("Registration Number") . ":</td><td width=70%>\n";
echo printf("#%09d", $develid) . "</td></tr>\n";
echo "</table>\n";
$bx->box_body_end();
$bx->box_end();
$bx->box_begin();
$bx->box_title($t->translate("Professional Data"));
$bx->box_body_begin();
echo "<table border=0 width=100% align=center cellspacing=3 cellpadding=3>\n";
$profid = $db->f("profession");
$prof = get_profession($profid);
示例5: testSponsoring_preview
function testSponsoring_preview()
{
global $auth, $sponsoring_text, $budget, $valid_day, $valid_month, $valid_year, $begin_day, $begin_month, $begin_year, $finish_day, $finish_month, $finish_year, $bx, $t;
$auth->set_uname("this is the username");
$sponsoring_text = "this is the sponsoring text";
$budget = "this is the budget";
$valid_day = 3;
$begin_day = 4;
$finish_day = 5;
$valid_month = 4;
$begin_month = 5;
$finish_month = 6;
$valid_year = 2001;
$begin_year = 2002;
$finish_year = 2003;
$bx = $this->_create_default_box();
$this->capture_call('sponsoring_preview', 1196 + strlen(timestr(time())));
$this->set_msg('test 1');
$this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
$this->_checkFor_a_box('Sponsor Involvement');
$this->_testFor_lib_nick($auth->auth['uname']);
$v = array('Status' => 'Proposed', 'Validity' => timestr_middle(mktimestamp(date_to_timestamp($valid_day, $valid_month, $valid_year))), 'Finish before' => timestr_middle(mktimestamp(date_to_timestamp($finish_day, $finish_month, $finish_year))), 'Begin wished' => timestr_middle(mktimestamp(date_to_timestamp($begin_day, $begin_month, $begin_year))), 'Max. sum of money' => "{$budget} euros", 'Comments to the involvement' => "{$sponsoring_text}");
while (list($key, $val) = each($v)) {
$this->_testFor_pattern($this->_to_regexp('<b>' . $t->translate($key) . ':</b> ' . $val));
}
}
示例6: testShow_referees
function testShow_referees()
{
global $t, $bx, $db;
$db_config = new mock_db_configure(2);
$pid1 = "this sit he proid";
$pid2 = "this sit he proid two";
$q = $this->queries['show_referees'];
$db_config->add_query(sprintf($q, $pid1), 0);
$db_config->add_num_row(0, 0);
$db_config->add_num_row(0, 0);
$db_config->add_query(sprintf($q, $pid2), 1);
$dat = $this->_generate_records(array('username', 'status', 'creation'), 5);
$db_config->add_num_row(count($dat), 1);
$db_config->add_num_row(count($dat), 1);
for ($idx = 0; $idx < count($dat); $idx++) {
$db_config->add_record($dat[$idx], 1);
}
// test one, no record/data
$bx = $this->_create_default_box();
$db = new DB_SourceAgency();
capture_reset_and_start();
show_referees($pid1);
$this->set_text(capture_stop_and_get());
$this->push_msg("Test One");
$this->_testFor_string_length(72);
$msg = $t->translate("There are no developers that have " . "offered themselves as referees");
$this->_testFor_pattern($this->_to_regexp($msg));
$this->pop_msg();
// test two, data is defined
$bx = $this->_create_default_box();
$db = new DB_SourceAgency();
capture_reset_and_start();
show_referees($pid2);
$this->set_text(capture_stop_and_get());
$this->push_msg("Test Two");
$this->_testFor_string_length(4940);
$msg = $t->translate("There are no developers that have " . "offered themselves as referees");
$this->reverse_next_test();
$this->_testFor_pattern($this->_to_regexp($msg));
$this->_checkFor_a_box('Referees');
$this->_checkFor_columns(4);
$this->_checkFor_column_titles(array('Number', 'Username', 'Status', 'Creation'), '', '', '');
$colors = array(0 => '#FFFFFF', 1 => 'gold');
for ($idx = 0; $idx < count($dat); $idx++) {
$v = array("<b>" . ($idx + 1) . "</b>", '<b>' . lib_nick($dat[$idx]['username']) . '</b>', '<b>' . show_status($dat[$idx]['status']) . '</b>', '<b>' . timestr(mktimestamp($dat[$idx]['creation'])) . '</b>');
$this->push_msg("Test {$idx}");
$this->_checkFor_column_values($v, '', '', $colors[$idx % 2]);
$this->pop_msg();
}
$this->pop_msg();
$this->_check_db($db_config);
}
示例7: mktimestamp
"><input type="text" name="realname" size=12 maxlength=64 value="<?php
$db->p("realname");
?>
"></td>
<td bgcolor="<?php
echo $th_box_body_bgcolor;
?>
"><input type="text" name="email_usr" size=12 maxlength=32 value="<?php
$db->p("email_usr");
?>
"></td>
<?php
$time = mktimestamp($db->f("modification_usr"));
echo " <td bgcolor=\"{$th_box_body_bgcolor}\">" . timestr($time) . "</td>\n";
$time = mktimestamp($db->f("creation_usr"));
echo " <td bgcolor=\"{$th_box_body_bgcolor}\">" . timestr($time) . "</td>\n";
?>
<td bgcolor="<?php
echo $th_box_body_bgcolor;
?>
"><?php
print $perm->perm_sel("perms", $db->f("perms"));
?>
</td>
<td bgcolor="<?php
echo $th_box_body_bgcolor;
?>
" align=right>
<input type="hidden" name="u_id" value="<?php
echo $db->p("user_id");
?>
示例8: date
if (!isset($period)) {
$period = "daily";
}
if ($msg = nlmsg($period)) {
$subj = "{$sys_name} {$period} newsletter for " . date("l dS of F Y");
if (isset($send)) {
// Send newsletter
switch ($period) {
case "weekly":
mail($ml_weeklynewstoaddr, $subj, $msg, "From: {$ml_newsfromaddr}\nReply-To: {$ml_newsreplyaddr}\nX-Mailer: PHP");
$bx->box_full($t->translate("Weekly Newsletter"), $t->translate("Newsletter was sent at ") . timestr(time()));
break;
case "daily":
default:
mail($ml_newstoaddr, $subj, $msg, "From: {$ml_newsfromaddr}\nReply-To: {$ml_newsreplyaddr}\nX-Mailer: PHP");
$bx->box_full($t->translate("Daily Newsletter"), $t->translate("Newsletter was sent at ") . timestr(time()));
break;
}
}
$bx->box_full($subj, "<pre>\n" . htmlentities($msg) . "\n</pre>\n");
?>
<form method="get" action="<?php
$sess->pself_url();
?>
">
<?php
echo "<input type=\"hidden\" name=\"period\" value=\"{$period}\">\n";
echo "<center><p><input type=\"submit\" name=\"send\" value=\"" . $t->translate("Send newsletter") . "\"></center>\n";
echo "</form>\n";
} else {
$be->box_full($t->translate("Error"), $t->translate("No Document found") . ".");
示例9: page_open
# BerliOS DocsWell: http://docswell.berlios.de
# BerliOS - The OpenSource Mediator: http://www.berlios.de
#
# Login registrated users
#
# This program is free software. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 or later of the GPL.
######################################################################
require "./include/prepend.php3";
page_open(array("sess" => "DocsWell_Session", "auth" => "DocsWell_Auth", "perm" => "DocsWell_Perm"));
require "./include/header.inc";
$bx = new box("80%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_body_font_color, $th_box_body_align);
$be = new box("80%", $th_box_frame_color, $th_box_frame_width, $th_box_title_bgcolor, $th_box_title_font_color, $th_box_title_align, $th_box_body_bgcolor, $th_box_error_font_color, $th_box_body_align);
?>
<!-- content -->
<?php
if ($perm->have_perm("user_pending")) {
$be->box_full($t->translate("Error"), $t->translate("Access denied"));
$auth->logout();
} else {
$msg = $t->translate("You are logged in as") . " <b>" . $auth->auth["uname"] . "</b> " . $t->translate("with") . " " . "<b>" . $auth->auth["perm"] . "</b> " . $t->translate("permission") . "." . "<br>" . $t->translate("Your authentication is valid until") . " <b>" . timestr($auth->auth["exp"]) . "</b>";
$bx->box_full($t->translate("Welcome to {$sys_name}"), $msg);
}
?>
<!-- end content -->
<?php
require "./include/footer.inc";
@page_close();
示例10: mktimestamp
$db->p("password");
?>
"></td>
<td><input type="text" name="realname" size=12 maxlength=64 value="<?php
$db->p("realname");
?>
"></td>
<td><input type="text" name="email_usr" size=12 maxlength=32 value="<?php
$db->p("email_usr");
?>
"></td>
<?php
$time = mktimestamp($db->f("modification_usr"));
echo " <td>" . timestr($time) . "</td>\n";
$time = mktimestamp($db->f("creation_usr"));
echo " <td>" . timestr($time) . "</td>\n";
?>
<td><?php
print $perm->perm_sel("perms", $db->f("perms"));
?>
</td>
<td align=right>
<input type="hidden" name="u_id" value="<?php
echo $db->p("user_id");
?>
">
<?php
echo " <input type=\"submit\" name=\"u_kill\" value=\"" . $t->translate("Delete") . "\">\n";
echo " <input type=\"submit\" name=\"u_edit\" value=\"" . $t->translate("Change") . "\">\n";
?>
</td>
示例11: testConfigure_preview
function testConfigure_preview()
{
global $t, $bx, $auth, $quorum, $other_tech_contents, $other_developing_proposals, $consultants;
$args = $this->_generate_records(array('proid'), 32);
$uname = 'this is the username';
$auth->set_uname($uname);
$quorum = 'this is the quro';
$consultants = 'this is the consulatnts';
$other_tech_contents = 'this is the other tech contents';
$other_developing_proposals = 'this is the other tech proposals';
$db_config = new mock_db_configure(144);
$sinst = 0;
$mask = array();
$cf_mask = array();
for ($idx = 0; $idx < 32; $idx++) {
$cf_mask[0] = $mask[0] = ($idx & 0x1) > 0;
$cf_mask[1] = $mask[1] = ($idx & 0x2) > 0;
$cf_mask[2] = $mask[2] = ($idx & 0x4) > 0;
$mask[3] = ($idx & 0x8) > 0;
$mask[4] = ($idx & 0x10) > 0;
$cf_mask[3] = $mask[3] && $mask[4];
$this->set_msg('Test ' . $idx . " 0=>" . $mask[0] . " 1=>" . $mask[1] . " 2=>" . $mask[2] . " 3=>" . $mask[3] . " 4=>" . $mask[4]);
$len = 948 + ($cf_mask[0] ? 38 : 0) + ($cf_mask[1] ? 64 : 0) + ($cf_mask[2] ? 72 : 0) + ($cf_mask[3] ? 48 : 0);
$sinst = $this->_config__s_pi_d_s_pi__db($db_config, $sinst, $args[$idx]['proid'], $uname, $mask);
$bx = $this->_create_default_box();
$this->capture_call('configure_preview', $len + strlen(timestr(time())), $args[$idx]);
$this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
$this->_checkFor_a_box('Project Configuration');
$this->_configure_preview_checkfor_parts($cf_mask);
}
$this->_check_db($db_config);
}
示例12: html_input_password
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Password') . ':</b>');
$bx->box_column('left', '50%', '', html_input_password('password', 20, 32, $db->f('password')));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Confirm Password') . ':</b>');
$bx->box_column('left', '50%', '', html_input_password('cpassword', 20, 32, $db->f('password')));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Realname') . ':</b>');
$bx->box_column('left', '50%', '', html_input_text('realname', 20, 64, $db->f('realname')));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('E-mail') . ':</b>');
$bx->box_column('left', '50%', '', html_input_text('email_usr', 20, 128, $db->f('email_usr')));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Creation') . ':</b>');
$bx->box_column('left', '50%', '', timestr(mktimestamp($db->f('creation_usr'))));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Last Modification') . ':</b>');
$bx->box_column('left', '50%', '', timestr(mktimestamp($db->f('modification_usr'))));
$bx->box_next_row_of_columns();
$bx->box_column('right', '50%', '', '<b>' . $t->translate('Permission') . ':</b>');
$bx->box_column('left', '50%', '', $db->f('perms'));
$bx->box_next_row_of_columns();
$bx->box_colspan(2, 'center', '', html_form_submit($t->translate('Change'), 'u_edit'));
$bx->box_columns_end();
htmlp_form_hidden('u_id', $db->f('user_id'));
htmlp_form_end();
$bx->box_body_end();
$bx->box_end();
end_content();
require 'include/footer.inc';
@page_close();
示例13: testNews_preview
function testNews_preview()
{
global $subject, $text, $auth, $sess, $bx, $t;
$text = "this is the text";
$subject = "this is the subject";
$auth->set_uname("username");
$proid = 'fubar';
$bx = $this->_create_default_box();
capture_reset_and_start();
news_preview($proid);
$this->set_text(capture_stop_and_get());
$this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
$this->_checkFor_a_box('News', '%s: ' . $subject);
$this->_testFor_lib_nick($auth->auth['uname']);
$this->_testFor_string_length(947 + strlen(timestr(time())));
}
示例14: date
}
echo "<br>{$fusrnam2} (<a href=\"" . $sys_url . "showprofile.php?devname={$fusrnam2}\">" . $sys_url . "showprofile.php?devname={$fusrnam2}</a>)\n";
}
}
}
if (isset($notify) && $msg != "") {
$subj = "[" . $sys_name . "] Developers Watch for " . date("l dS of F Y") . "\n";
$msg .= "\nYou get this DevCounter Developers Watch Notification,\n";
$msg .= "because you have set a Developers Watch.\n";
$msg .= "To suppress this Notification visit\n";
$msg .= $sys_url . "watch.php\n";
$msg .= "and delete your Developers Watch.\n\n";
$msg .= " - The DevCounter crew\n";
// echo "<p>$msg";
mail($email, $subj, $msg, "From: {$ml_newsfromaddr}\nReply-To: {$ml_newsreplyaddr}\nX-Mailer: PHP");
$bx->box_full($t->translate("Developers Watch"), $t->translate("Developers Watch Notification was sent to") . " {$usrnam} <{$email}> " . timestr(time()));
}
}
?>
<form method="get" action="<?php
$sess->pself_url();
?>
">
<?php
echo "<input type=\"hidden\" name=\"notify\" value=\"send\">\n";
echo "<center><p><input type=\"submit\" name=\"send\" value=\"" . $t->translate("Send Watch Notifications") . "\"></center>\n";
echo "</form>\n";
}
?>
<!-- end content -->
示例15: testDeveloping_preview
function testDeveloping_preview()
{
global $t, $bx, $auth;
global $cost, $license, $cooperation, $valid_day, $valid_month, $valid_year, $start_day, $start_month, $start_year, $duration;
$proid = 'this is the proid';
$cost = 'ths is the cost';
$license = 'thsi is the license';
$cooperation = 'this is the coopeartion';
$valid_day = 'this is the valid_day';
$valid_month = 'thsi si the valid month';
$valid_year = 'this is the valid year';
$start_day = 'this is the start day';
$start_month = 'this is the start month';
$start_year = 'this is the start year';
$duration = 'this is the duration';
$slen = strlen(timestr(time())) + 1188;
$bx = $this->_create_default_box();
$this->capture_call('developing_preview', $slen, array($proid));
$this->_checkFor_a_box('PREVIEW', '<center><b>%s</b></center>');
$this->_checkFor_a_box('Developing Proposal');
$v = array('Cost' => $cost . " euros", 'License' => $license, 'Cooperation' => $cooperation, 'Status' => 'Proposed', 'Validity' => timestr_middle(mktimestamp(date_to_timestamp($valid_day, $valid_month, $valid_year))), 'Start possible' => timestr_middle(mktimestamp(date_to_timestamp($start_day, $start_month, $start_year))), 'Duration' => $duration . " weeks");
while (list($key, $val) = each($v)) {
$str = sprintf('<b>%s:</b> %s\\n', $t->translate($key), $val);
$this->_testFor_pattern('[<]..?[>]' . $this->_to_regexp($str));
}
}