本文整理汇总了PHP中date_str函数的典型用法代码示例。如果您正苦于以下问题:PHP date_str函数的具体用法?PHP date_str怎么用?PHP date_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: git_commitdiff
function git_commitdiff($projectroot, $project, $hash, $hash_parent)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
$git = new Git($projectroot . $project);
$hash = sha1_bin($hash);
if (isset($hash_parent)) {
$hash_parent = sha1_bin($hash_parent);
}
if (!$tpl->is_cached('commitdiff.tpl', $cachekey)) {
$co = git_read_commit($git, $hash);
$ad = date_str($co['author_epoch']);
$tpl->assign('committer', $co['committer']);
$tpl->assign('rfc2822', $ad['rfc2822']);
if (!isset($hash_parent) && isset($co['parent'])) {
$hash_parent = sha1_bin($co['parent']);
}
$a_tree = isset($hash_parent) ? $git->getObject($hash_parent)->getTree() : array();
$b_tree = $git->getObject(sha1_bin($co['tree']));
$difftree = GitTree::diffTree($a_tree, $b_tree);
$tpl->assign("hash", sha1_hex($hash));
$tpl->assign("tree", $co['tree']);
$tpl->assign("hashparent", sha1_hex($hash_parent));
$tpl->assign("title", $co['title']);
$refs = read_info_ref($git);
if (isset($refs[$hash])) {
$tpl->assign("commitref", $refs[$hash]);
}
$tpl->assign("comment", $co['comment']);
$difftreelines = array();
$status_map = array(GitTree::TREEDIFF_ADDED => "A", GitTree::TREEDIFF_REMOVED => "D", GitTree::TREEDIFF_CHANGED => "M");
foreach ($difftree as $file => $diff) {
$difftreeline = array();
$difftreeline["from_mode"] = decoct($diff->old_mode);
$difftreeline["to_mode"] = decoct($diff->new_mode);
$difftreeline["from_id"] = sha1_hex($diff->old_obj);
$difftreeline["to_id"] = sha1_hex($diff->new_obj);
$difftreeline["status"] = $status_map[$diff->status];
$difftreeline["file"] = $file;
$difftreeline["md5"] = md5($file);
$difftreeline["from_type"] = file_type($difftreeline["from_mode"]);
$difftreeline["to_type"] = file_type($difftreeline["to_mode"]);
if ($diff->status == GitTree::TREEDIFF_ADDED) {
$difftreeline['diffout'] = explode("\n", git_diff($git, null, "/dev/null", $diff->new_obj, "b/" . $file));
} else {
if ($diff->status == GitTree::TREEDIFF_REMOVED) {
$difftreeline['diffout'] = explode("\n", git_diff($git, $diff->old_obj, "a/" . $file, null, "/dev/null"));
} else {
if ($diff->status == GitTree::TREEDIFF_CHANGED && $diff->old_obj != $diff->new_obj) {
$difftreeline['diffout'] = explode("\n", git_diff($git, $diff->old_obj, "a/" . $file, $diff->new_obj, "b/" . $file));
}
}
}
$difftreelines[] = $difftreeline;
}
$tpl->assign("difftreelines", $difftreelines);
}
$tpl->display('commitdiff.tpl', $cachekey);
}
示例2: git_commitdiff_plain
function git_commitdiff_plain($projectroot, $project, $hash, $hash_parent)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
header("Content-type: text/plain; charset=UTF-8");
header("Content-disposition: inline; filename=\"git-" . $hash . ".patch\"");
if (!$tpl->is_cached('diff_plaintext.tpl', $cachekey)) {
$ret = prep_tmpdir();
if ($ret !== TRUE) {
echo $ret;
return;
}
$co = git_read_commit($projectroot . $project, $hash);
if (!isset($hash_parent)) {
$hash_parent = $co['parent'];
}
$diffout = git_diff_tree($projectroot . $project, $hash_parent . " " . $hash);
$difftree = explode("\n", $diffout);
$refs = read_info_ref($projectroot . $project, "tags");
$listout = git_read_revlist($projectroot . $project, "HEAD");
foreach ($listout as $i => $rev) {
if (isset($refs[$rev])) {
$tagname = $refs[$rev];
}
if ($rev == $hash) {
break;
}
}
$ad = date_str($co['author_epoch'], $co['author_tz']);
$tpl->assign("from", $co['author']);
$tpl->assign("date", $ad['rfc2822']);
$tpl->assign("subject", $co['title']);
if (isset($tagname)) {
$tpl->assign("tagname", $tagname);
}
$tpl->assign("url", script_url() . "?p=" . $project . "&a=commitdiff&h=" . $hash);
$tpl->assign("comment", $co['comment']);
$diffs = array();
foreach ($difftree as $i => $line) {
if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)\$/", $line, $regs)) {
if ($regs[5] == "A") {
$diffs[] = git_diff($projectroot . $project, null, "/dev/null", $regs[4], "b/" . $regs[6]);
} else {
if ($regs[5] == "D") {
$diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], null, "/dev/null");
} else {
if ($regs[5] == "M") {
$diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], $regs[4], "b/" . $regs[6]);
}
}
}
}
}
$tpl->assign("diffs", $diffs);
}
$tpl->display('diff_plaintext.tpl', $cachekey);
}
示例3: show_admin
function show_admin($user, $admin)
{
$admin_user = BoincUser::lookup_id($admin->userid);
$tokens = url_tokens($user->authenticator);
$date = date_str($admin->create_time);
echo "<tr>\n <td>" . user_links($admin_user) . "</td>\n <td>{$date}</td>\n <td>\n ";
show_button("team_admins.php?teamid={$admin->teamid}&action=remove&userid={$admin_user->id}" . $tokens, tra("Remove"), tra("Remove Team Admin status from this member"));
echo "</td></tr>\n ";
}
示例4: git_commitdiff_plain
function git_commitdiff_plain($projectroot, $project, $hash, $hash_parent)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
header("Content-type: text/plain; charset=UTF-8");
header("Content-disposition: inline; filename=\"git-" . $hash . ".patch\"");
$git = new Git($projectroot . $project);
$hash = sha1_bin($hash);
if (isset($hash_parent)) {
$hash_parent = sha1_bin($hash_parent);
}
if (!$tpl->is_cached('diff_plaintext.tpl', $cachekey)) {
$co = git_read_commit($git, $hash);
if (!isset($hash_parent) && isset($co['parent'])) {
$hash_parent = sha1_bin($co['parent']);
}
$a_tree = isset($hash_parent) ? $git->getObject($hash_parent)->getTree() : array();
$b_tree = $git->getObject(sha1_bin($co['tree']));
$difftree = GitTree::diffTree($a_tree, $b_tree);
// FIXME: simplified tagname search is not implemented yet
/*$refs = read_info_ref($git,"tags");
$listout = git_read_revlist($git, "HEAD");
foreach ($listout as $i => $rev) {
if (isset($refs[$rev]))
$tagname = $refs[$rev];
if ($rev == $hash)
break;
}*/
$ad = date_str($co['author_epoch'], $co['author_tz']);
$tpl->assign("from", $co['author']);
$tpl->assign("date", $ad['rfc2822']);
$tpl->assign("subject", $co['title']);
if (isset($tagname)) {
$tpl->assign("tagname", $tagname);
}
$tpl->assign("url", script_url() . "?p=" . $project . "&a=commitdiff&h=" . sha1_hex($hash));
$tpl->assign("comment", $co['comment']);
$diffs = array();
foreach ($difftree as $file => $diff) {
if ($diff->status == GitTree::TREEDIFF_ADDED) {
$diffs[] = git_diff($git, null, "/dev/null", $diff->new_obj, "b/" . $file);
} else {
if ($diff->status == GitTree::TREEDIFF_REMOVED) {
$diffs[] = git_diff($git, $diff->old_obj, "a/" . $file, null, "/dev/null");
} else {
if ($diff->status == GitTree::TREEDIFF_CHANGED) {
$diffs[] = git_diff($git, $diff->old_obj, "a/" . $file, $diff->new_obj, "b/" . $file);
}
}
}
}
$tpl->assign("diffs", $diffs);
}
$tpl->display('diff_plaintext.tpl', $cachekey);
}
示例5: git_log
function git_log($projectroot, $project, $hash, $page)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
$git = new Git($projectroot . $project);
if (!$tpl->is_cached('shortlog.tpl', $cachekey)) {
$head = git_read_head($git);
if (!isset($hash)) {
$hash = $head;
} else {
$hash = $git->revParse($hash);
}
if (!isset($page)) {
$page = 0;
}
$refs = read_info_ref($git);
$tpl->assign("hash", sha1_hex($hash));
$tpl->assign("head", sha1_hex($head));
if ($page) {
$tpl->assign("page", $page);
}
$revlist = git_read_revlist($git, $hash, 101, $page * 100);
$revlistcount = count($revlist);
$tpl->assign("revlistcount", $revlistcount);
if (!$revlist) {
$tpl->assign("norevlist", TRUE);
$co = git_read_commit($git, $hash);
$tpl->assign("lastchange", $co['age_string']);
}
$commitlines = array();
$commitcount = min(100, $revlistcount);
for ($i = 0; $i < $commitcount; ++$i) {
$commit = $revlist[$i];
$commithash = sha1_hex($commit->getName());
$commitline = array();
$co = git_read_commit($git, $commit->getName());
$ad = date_str($co['author_epoch']);
$commitline["project"] = $project;
$commitline["commit"] = $commithash;
if (isset($refs[$commit->getName()])) {
$commitline["commitref"] = $refs[$commit->getName()];
$commitline["commitclass"] = get_commit_class($refs[$commit->getName()]);
}
$commitline["agestring"] = $co['age_string'];
$commitline["title"] = $co['title'];
$commitline["authorname"] = $co['author_name'];
$commitline["rfc2822"] = $ad['rfc2822'];
$commitline["comment"] = $co['comment'];
$commitlines[] = $commitline;
}
$tpl->assign("commitlines", $commitlines);
}
$tpl->display('log.tpl', $cachekey);
}
示例6: show_bossa_app
function show_bossa_app($app, $i)
{
$j = $i % 2;
echo "<tr class=row{$j}>\n <td>Name: {$app->name}<br>\n Short name: {$app->short_name}<br>\n Description: {$app->description}<br>\n Created: " . date_str($app->create_time) . "\n </td>\n <td>\n ";
if ($app->hidden) {
show_button("bossa_admin.php?action=unhide&app_id={$app->id}", "Unhide", "Unhide this app");
} else {
show_button("bossa_admin.php?action=hide&app_id={$app->id}", "Hide", "Hide this app");
}
echo "<br>";
show_button("bossa_admin.php?action=show_batches&app_id={$app->id}", "Show batches", "Show batches");
}
示例7: show_course
function show_course($course)
{
$x = "<b>{$course->name}</b>\n\t\t\t<br>Description: {$course->description}\n\t\t\t<br>Created: " . date_str($course->create_time) . "\n\t";
$y = "<a href=bolt_map.php?course_id={$course->id}>Map</a>\n\t\t<br><a href=bolt_compare.php?course_id={$course->id}>Experiments</a>\n\t\t<br>\n\t";
row2_init($x, $y);
if ($course->hidden) {
show_button("bolt_admin.php?action=unhide&course_id={$course->id}", "Unhide", "Unhide this course");
} else {
show_button("bolt_admin.php?action=hide&course_id={$course->id}", "Hide", "Hide this course");
}
show_button("bolt_admin.php?action=clear_confirm&course_id={$course->id}", "Clear data", "Clear student data for this course");
echo "</td></tr>";
}
示例8: show_snap_form
function show_snap_form()
{
global $course_id;
admin_page_head("Data snapshot");
$s = read_map_snapshot($course_id);
if ($s) {
$end = date_str($s->time);
echo "\n\t\t\tA data snapshot exists for the {$s->dur} days prior to {$end}.\n\t\t";
show_button("bolt_map.php?action=map&course_id={$course_id}", "Use this snapshot", "Use this snapshot");
} else {
echo "There is currently no snapshot.";
}
echo "\n\t\t<form action=bolt_map.php>\n\t\t<input type=hidden name=action value=snap_action>\n\t\t<input type=hidden name=course_id value={$course_id}>\n\t\tCreate a new snapshot using data from the last\n\t\t<input name=dur value=7> days.\n\t\t<input type=submit value=OK>\n\t\t</form>\n\t";
admin_page_tail();
}
示例9: git_rss
function git_rss($projectroot, $project)
{
global $tpl;
header("Content-type: text/xml; charset=UTF-8");
$cachekey = sha1($project);
if (!$tpl->is_cached('rss.tpl', $cachekey)) {
$head = git_read_head($projectroot . $project);
$revlist = git_read_revlist($projectroot . $project, $head, GITPHP_RSS_ITEMS);
$tpl->assign("self", script_url());
$commitlines = array();
$revlistcount = count($revlist);
for ($i = 0; $i < $revlistcount; ++$i) {
$commit = $revlist[$i];
$co = git_read_commit($projectroot . $project, $commit);
if ($i >= 20 && time() - $co['committer_epoch'] > 48 * 60 * 60) {
break;
}
$cd = date_str($co['committer_epoch']);
$difftree = array();
$parent = '';
if (!empty($co['parent'])) {
$parent = $co['parent'];
}
$diffout = git_diff_tree($projectroot . $project, $parent . " " . $co['id']);
$tok = strtok($diffout, "\n");
while ($tok !== false) {
if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)\$/", $tok, $regs)) {
$difftree[] = $regs[7];
}
$tok = strtok("\n");
}
$commitline = array();
$commitline["cdmday"] = $cd['mday'];
$commitline["cdmonth"] = $cd['month'];
$commitline["cdhour"] = $cd['hour'];
$commitline["cdminute"] = $cd['minute'];
$commitline["title"] = $co['title'];
$commitline["author"] = $co['author'];
$commitline["cdrfc2822"] = $cd['rfc2822'];
$commitline["commit"] = $commit;
$commitline["comment"] = $co['comment'];
$commitline["difftree"] = $difftree;
$commitlines[] = $commitline;
}
$tpl->assign("commitlines", $commitlines);
}
$tpl->display('rss.tpl', $cachekey);
}
示例10: git_shortlog
function git_shortlog($projectroot, $project, $hash, $page)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
if (!$tpl->is_cached('shortlog.tpl', $cachekey)) {
$head = git_read_head($projectroot . $project);
if (!isset($hash)) {
$hash = $head;
}
if (!isset($page)) {
$page = 0;
}
$refs = read_info_ref($projectroot . $project);
$tpl->assign("hash", $hash);
$tpl->assign("head", $head);
if ($page) {
$tpl->assign("page", $page);
}
$revlist = git_read_revlist($projectroot . $project, $hash, 101, $page * 100);
$revlistcount = count($revlist);
$tpl->assign("revlistcount", $revlistcount);
$commitlines = array();
$commitcount = min(100, count($revlist));
for ($i = 0; $i < $commitcount; ++$i) {
$commit = $revlist[$i];
if (strlen(trim($commit)) > 0) {
$commitline = array();
if (isset($refs[$commit])) {
$commitline["commitref"] = $refs[$commit];
}
$co = git_read_commit($projectroot . $project, $commit);
$ad = date_str($co['author_epoch']);
$commitline["commit"] = $commit;
$commitline["agestringage"] = $co['age_string_age'];
$commitline["agestringdate"] = $co['age_string_date'];
$commitline["authorname"] = $co['author_name'];
$commitline["title_short"] = $co['title_short'];
if (strlen($co['title_short']) < strlen($co['title'])) {
$commitline["title"] = $co['title'];
}
$commitlines[] = $commitline;
}
}
$tpl->assign("commitlines", $commitlines);
}
$tpl->display('shortlog.tpl', $cachekey);
}
示例11: git_tag
function git_tag($projectroot, $project, $hash)
{
global $tpl;
$cachekey = sha1($project) . "|" . $hash;
if (!$tpl->is_cached('tag.tpl', $cachekey)) {
$head = git_read_head($projectroot . $project);
$tpl->assign("head", $head);
$tpl->assign("hash", $hash);
$tag = git_read_tag($projectroot . $project, $hash);
$tpl->assign("tag", $tag);
if (isset($tag['author'])) {
$ad = date_str($tag['epoch'], $tag['tz']);
$tpl->assign("datedata", $ad);
}
}
$tpl->display('tag.tpl', $cachekey);
}
示例12: show_admin_page
function show_admin_page($user, $team)
{
page_head(tra("Team administration for %1", $team->name));
echo "\n <ul>\n <li><a href=team_edit_form.php?teamid={$team->id}>" . tra("Edit team info") . "</a>\n <br><p class=\"text-muted\">" . tra("Change team name, URL, description, type, or country") . "</p>\n <li>\n " . tra("Member list:") . "\n <a href=team_email_list.php?teamid={$team->id}>" . tra("HTML") . "</a>\n · <a href=team_email_list.php?teamid={$team->id}&plain=1>" . tra("text") . "</a>\n <br><p class=\"text-muted\">" . tra("View member names and email addresses") . "</p>\n <li>" . tra("View change history:") . "\n <a href=team_delta.php?teamid={$team->id}>" . tra("HTML") . "</a>\n · <a href=team_delta.php?teamid={$team->id}&xml=1>" . tra("XML") . "</a>\n <br><p class=\"text-muted\">" . tra("See when members joined or quit this team") . "</p>\n ";
// founder-only stuff follows
//
if ($team->userid == $user->id) {
$tokens = url_tokens($user->authenticator);
if ($team->ping_user > 0) {
$user2 = BoincUser::lookup_id($team->ping_user);
$deadline = date_str(transfer_ok_time($team));
echo "<li>\n <a href=team_change_founder_form.php?teamid={$team->id}><font color=red><strong>" . tra("Respond to foundership request.") . "</strong></font></a> " . tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name);
}
echo "\n <li><a href=team_remove_inactive_form.php?teamid={$team->id}>" . tra("Remove members") . "</a>\n <br><p class=\"text-muted\">" . tra("Remove inactive or unwanted members from this team") . "</p>\n <li><a href=team_change_founder_form.php?teamid={$team->id}>" . tra("Change founder") . "</a>\n <br><p class=\"text-muted\">" . tra("Transfer foundership to another member") . "</p>\n <li><a href=team_admins.php?teamid={$team->id}>" . tra("Add/remove Team Admins") . "</a>\n <br><p class=\"text-muted\">" . tra("Give selected team members Team Admin privileges") . "</p>\n\n <li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>" . tra("Remove team") . "</a>\n <br><p class=\"text-muted\">" . tra("Allowed only if team has no members") . "</p>\n <li><a href=team_forum.php?teamid={$team->id}&cmd=manage>" . tra("Message board") . "</a>\n <br><p class=\"text-muted\">" . tra("Create or manage a team message board") . "</p>\n ";
}
echo "\n\n <p>\n <li>\n " . tra("To have this team created on all BOINC projects (current and future) you can make it into a %1BOINC-wide team%2.", "<a href=http://boinc.berkeley.edu/teams/>", "</a>") . "\n <li>\n " . tra("Team admins are encouraged to join and participate in the Google %1boinc-team-founders%2 group.", "<a href=http://groups.google.com/group/boinc-team-founders>", "</a>") . "\n </ul>\n ";
page_tail();
}
示例13: check_pending
function check_pending($user, $destuser)
{
$friend = BoincFriend::lookup($user->id, $destuser->id);
if ($friend) {
if ($friend->reciprocated) {
error_page(tra("Already friends"));
}
$notify = BoincNotify::lookup($destuser->id, NOTIFY_FRIEND_REQ, $user->id);
if ($notify) {
page_head(tra("Request pending"));
$t = date_str($friend->create_time);
echo tra("You requested friendship with %1 on %2.", $destuser->name, $t) . "\n <p>" . tra("This request is still pending confirmation.");
page_tail();
exit;
}
BoincFriend::delete($user->id, $destuser->id);
}
}
示例14: show_admin_page
function show_admin_page($user, $team)
{
page_head("Team administration for {$team->name}");
echo "\r\n\t\t<ul>\r\n\t\t<li><a href=team_edit_form.php?teamid={$team->id}>Edit team info</a>\r\n\t\t\t<br><span class=note>Change team name, URL, description, type, or country</span>\r\n\t\t<li>\r\n\t\t\tMember list:\r\n\t\t<a href=team_email_list.php?teamid={$team->id}>HTML</a>\r\n\t\t| <a href=team_email_list.php?teamid={$team->id}&plain=1>text</a>\r\n\t\t\t<br><span class=note> View member names and email addresses </span>\r\n\t\t<li>View change history:\r\n\t\t\t<a href=team_delta.php?teamid={$team->id}>HTML</a>\r\n\t\t\t| <a href=team_delta.php?teamid={$team->id}&xml=1>XML</a>\r\n\t\t\t<br><span class=note>See when members joined or quit this team</span>\r\n\t";
// founder-only stuff follows
//
if ($team->userid == $user->id) {
$tokens = url_tokens($user->authenticator);
if ($team->ping_user > 0) {
$user2 = BoincUser::lookup_id($team->ping_user);
$deadline = date_str(transfer_ok_time($team));
echo "<li>\r\n\t\t\t\t<a href=team_change_founder_form.php?teamid={$team->id}><font color=red><b>Respond to foundership request</b></font></a>. If you don't respond by {$deadline}, {$user2->name} may assume foundership of this team.\r\n\t\t\t";
}
echo "\r\n\t\t\t<li><a href=team_remove_inactive_form.php?teamid={$team->id}>Remove members</a>\r\n\t\t\t\t<br><span class=note>Remove inactive or unwanted members from this team</span>\r\n\t\t\t<li><a href=team_change_founder_form.php?teamid={$team->id}>Change founder</a>\r\n\t\t\t\t<br><span class=note>Transfer foundership to another member</span>\r\n\t\t\t<li><a href=team_admins.php?teamid={$team->id}>Add/remove Team Admins</a>\r\n\t\t\t\t<br><span class=note>Give selected team members Team Admin privileges</span>\r\n\r\n\t\t\t<li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>Remove team</a>\r\n\t\t\t\t<br><span class=note>Allowed only if team has no members</a>\r\n\t\t\t<li><a href=team_forum.php?teamid={$team->id}&cmd=manage>Message board</a>\r\n\t\t\t\t<br><span class=note>Create or manage team message board</span>\r\n\t\t";
}
echo "\r\n\r\n\t\t<p>\r\n\t\t<li>\r\n\t\t\tTo have this team created on all BOINC projects\r\n\t\t\t(current and future) you can make it into a\r\n\t\t\t<a href=http://boinc.berkeley.edu/teams/>BOINC-wide team</a>.\r\n\t\t<li>\r\n\t\t\tTeam admins are encouraged to join and participate in the Google\r\n\t\t\t<a href=http://groups.google.com/group/boinc-team-founders>boinc-team-founders</a> group.\r\n\t\t<li>\r\n\t\t\tOther resources for BOINC team admins\r\n\t\t\tare available from a third-party site,\r\n\t\t\t<a href=http://www.boincteams.com>www.boincteams.com</a>.\r\n\t</ul>\r\n\t";
page_tail();
}
示例15: git_rss
function git_rss($projectroot, $project)
{
global $tpl;
header("Content-type: text/xml; charset=UTF-8");
$cachekey = sha1($project);
$git = new Git($projectroot . $project);
if (!$tpl->is_cached('rss.tpl', $cachekey)) {
$head = git_read_head($git);
$revlist = git_read_revlist($git, $head, GITPHP_RSS_ITEMS);
$tpl->assign("self", script_url());
$commitlines = array();
$revlistcount = count($revlist);
for ($i = 0; $i < $revlistcount; ++$i) {
$commit = $revlist[$i];
$co = git_read_commit($git, $commit->getName());
if ($i >= 20 && time() - $co['committer_epoch'] > 48 * 60 * 60) {
break;
}
$cd = date_str($co['committer_epoch']);
$difftree = array();
$diffout = GitTree::diffTree(isset($commit->parent[0]) ? $commit->parent[0]->getTree() : null, $commit->getTree());
foreach ($diffout as $file => $diff) {
$difftree[] = $file;
}
$commitline = array();
$commitline["cdmday"] = $cd['mday'];
$commitline["cdmonth"] = $cd['month'];
$commitline["cdhour"] = $cd['hour'];
$commitline["cdminute"] = $cd['minute'];
$commitline["title"] = $co['title'];
$commitline["author"] = $co['author'];
$commitline["cdrfc2822"] = $cd['rfc2822'];
$commitline["commit"] = $commit;
$commitline["comment"] = $co['comment'];
$commitline["difftree"] = $difftree;
$commitlines[] = $commitline;
}
$tpl->assign("commitlines", $commitlines);
}
$tpl->display('rss.tpl', $cachekey);
}