Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 94 lines (74 sloc) 3.38 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
<?php

// Receive an array of log events
$lines = gather_log();

?><h2><?php echo _("Log"); ?></h2>

<div style="width: 650px;">
<p><?php printf(_("Actions on the website during the last %d days."), 7); ?></p>

<ul class="history">
<?php

if(is_array($lines) && !empty($lines)) {
foreach($lines as $line) {

// empty datetime?
// Try to get rid of these already at the query...
if(!empty($line["datetime"])){

// Icon
if($line["log_type"] == "comment") $icon = 'comment';
elseif($line["log_type"] == "place") $icon = 'map';
elseif($line["log_type"] == "waitingtime") $icon = 'time';
elseif($line["log_type"] == "rating") $icon = 'chart_bar2';
elseif($line["log_type"] == "description") $icon = 'pencil';
elseif($line["log_type"] == "public_transport") $icon = 'underground';
elseif($line["log_type"] == "user") $icon = 'user';
else $icon = 'tag';

// START
echo '<li id="log-'.$line["log_type"].'-'.$line["id"].'" class="log_'.$line["id"].' icon '.$icon.'">';

// Place
$place = (!empty($line["fk_point"])) ? place_name($line["fk_point"], true): false;

// Who
$who = (!empty($line["fk_user"])) ? '<strong>'.username($line["fk_user"], true).'</strong>': _("Anonymous");

// What
if($line["log_type"] == "place") {
echo sprintf(_('%s added a new place'), $who);
}
elseif($line["log_type"] == "comment") {
echo sprintf(_("%s commented place"), $who);
echo '<br /><small><em class="bubble">'.Markdown($line["log_entry"]).'</em></small>';
}
elseif($line["log_type"] == "waitingtime") {
echo sprintf(_('%1$s waited for a ride in here for %2$s'), $who, nicetime($line["log_entry"]));
}
elseif($line["log_type"] == "rating") {
echo sprintf(_('%1$s rated "%2$s" for this place'), $who, hitchability2textual($line["log_entry"]));
}
elseif($line["log_type"] == "description") {
echo sprintf("%s added or edited a description of the place", $who);
#echo sprintf(_("%s added or edited a description of the place"), $who);
if(!empty($line["log_meta"])) echo '<br /><small title="'._("Language").'">'._("Language").': '._($settings["languages_in_english"][$line["log_meta"]]).'</small>';
echo '<br /><small><em class="bubble">'.Markdown(utf8_decode($line["log_entry"])).'</em></small>';
}
elseif($line["log_type"] == "public_transport") {
echo sprintf(_('%1$s added a link to the public transportation catalog for %2$s'), $who, '<b>'.ISO_to_country($line["log_entry"]).'</b>');
}
elseif($line["log_type"] == "user") {
echo sprintf(_("%s started using Maps"), $who);
}

// Start meta
echo '<br /><small>';

// Place
if($place !== false && !empty($place)) echo $place.'<br />';

// When
echo '<a href="./?page=place_history&amp;place='.$place["id"].'#log-'.$line["log_type"].'-'.$line["id"].'" title="'.date(DATE_RFC822,strtotime($line["datetime"])).'">'.date("j.n.Y H:i",strtotime($line["datetime"])).'</a>';

// IP for Admins
if($user["admin"] === true && !empty($line["ip"])) echo ' &mdash; <a href="http://ip-lookup.net/?'.$line["ip"].'" title="IP">'.$line["ip"].'</a>';

// End meta
echo '</small>';

// END
echo '</li>';

// empty datetime?
}

}
// Is $lines array?
} else echo '<li><br /><br />'.info_sign(_("Oh! Nothing has changed. Only the desert wind is moving some bits around..."),false).'<br /><br /></li>';
?>
</ul>

</div>
Something went wrong with that request. Please try again.