Skip to content

Commit

Permalink
more get_text replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
zenbi committed Oct 29, 2015
1 parent e8986f2 commit c6beb10
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 64 deletions.
14 changes: 7 additions & 7 deletions get/user/karma/index.php
Expand Up @@ -46,21 +46,21 @@
print_header("Karma", [], [], [], ["Karma"], ["/karma/"]);
beg_main();

writeln('<h1>Current</h1>');
writeln('<div class="icon-32 ' . $icon . '-32">' . $description . ' (' . $karma . ')</div>');
writeln('<h1>' . get_text("Current") . '</h1>');
writeln('<div class="icon-32 ' . $icon . '-32">' . get_text($description) . ' (' . $karma . ')</div>');

$row = sql("select comment_vote.time, value, comment.comment_id, comment_vote.zid from comment inner join comment_vote on comment.comment_id = comment_vote.comment_id where comment.zid = ? and value <> 0 order by comment_vote.time desc limit $item_start, $items_per_page", $zid);
writeln('<h2>Log</h2>');
writeln('<table class="zebra">');
writeln(' <tr>');
writeln(' <th>Time</th>');
writeln(' <th class="center">Points</th>');
writeln(' <th>Comment</th>');
writeln(' <th>Voter</th>');
writeln(' <th>' . get_text("Time") . '</th>');
writeln(' <th class="center">' . get_text("Points") . '</th>');
writeln(' <th>' . get_text("Comment") . '</th>');
writeln(' <th>' . get_text("Voter") . '</th>');
writeln(' </tr>');
if (count($row) == 0) {
writeln(' <tr>');
writeln(' <td colspan="3">(none)</td>');
writeln(' <td colspan="3">(' . get_text("none") . ')</td>');
writeln(' </tr>');
}
for ($i = 0; $i < count($row); $i++) {
Expand Down
38 changes: 11 additions & 27 deletions include/common.php
Expand Up @@ -278,13 +278,6 @@ function print_user_nav($selected)
global $server_name;
global $zid;

// if ($auth_zid === $zid) {
// $section_name = array("overview", "karma", "comments", "journal", "topics", "feed", "reader", "stream");
// $section_link = array("", "karma/", "comments", "journal/", "topic", "feed/", "reader/", "stream/");
// } else {
// $section_name = array("overview", "journal", "stream", "comments", "feed", "karma");
// $section_link = array("", "journal/", "stream/", "comments", "feed/", "karma/");
// }
$section_name = array("journal");
$section_link = array("journal/");

Expand Down Expand Up @@ -328,36 +321,27 @@ function print_user_box()
$row = sql("select count(*) as mail_count from mail where zid = ? and location = 'Inbox'", $auth_zid);
$mail_count = (int) $row[0]["mail_count"];
if ($mail_count > 0) {
$mail = "Mail ($mail_count)";
$mail = nget_text("Mail ($1)", "Mail ($1)", $mail_count, [$mail_count]);
} else {
$mail = "Mail";
$mail = get_text("Mail");
}
$link = user_link($auth_zid);

writeln('<div class="dialog-title">' . $auth_zid . '</div>');
writeln('<div class="dialog-body">');
writeln('<table class="side-link-two">');
writeln(' <tr>');
//writeln(' <td><a href="' . $link . 'comments"><div class="chat-32">Comments</div></a></td>');
writeln(' <td><a class="news-32" href="' . $link . 'feed/">Feed</a></td>');
writeln(' <td><a class="notepad-32" href="' . $link . 'journal/">Journal</a></td>');
writeln(' <td><a class="news-32" href="' . $link . 'feed/">' . get_text("Feed") . '</a></td>');
writeln(' <td><a class="notepad-32" href="' . $link . 'journal/">' . get_text("Journal") . '</a></td>');
writeln(' </tr>');
// writeln(' <tr>');
// writeln(' <td><a class="news-32" href="' . $link . 'karma/"><div class="user-box-icon" style="background-image: url(/images/karma-good-32.png)">Karma</div></a></td>');
// writeln(' <td><a class="news-32" href="' . $link . '"><div class="user-box-icon" style="background-image: url(/images/news-32.png)">Feed</div></a></td>');
// writeln(' </tr>');
// writeln(' <tr>');
// writeln(' <td><a class="news-32" href="' . $link . 'comments"><div class="user-box-icon" style="background-image: url(/images/chat-32.png)">Comments</div></a></td>');
// writeln(' <td><a class="news-32" href="http://' . $auth_user["username"] . '.' . $server_name . '/friends/"><div class="user-box-icon" style="background-image: url(/images/users-32.png)">Friends</div></a></td>');
// writeln(' </tr>');
writeln(' <tr>');
writeln(' <td><a class="mail-32" href="' . $link . 'mail/">' . $mail . '</a></td>');
writeln(' <td><a class="tools-32" href="' . $link . 'settings">Settings</a></td>');
writeln(' <td><a class="tools-32" href="' . $link . 'settings">' . get_text("Settings") . '</a></td>');
writeln(' </tr>');
writeln(' <tr>');
writeln(' <td><a class="reader-32" href="' . $link . 'reader/">' . get_text("Reader") . '</a></td>');
writeln(' <td><a class="internet-32" href="' . $link . 'stream/">' . get_text("Stream") . '</a></td>');
writeln(' </tr>');
// writeln(' <tr>');
// writeln(' <td><a class="reader-32" href="' . $link . 'reader/">Reader</a></td>');
// writeln(' <td><a class="internet-32" href="' . $link . 'stream/">Stream</a></td>');
// writeln(' </tr>');
writeln('</table>');
writeln('</div>');
}
Expand Down Expand Up @@ -485,7 +469,7 @@ function page_footer($table, $items_per_page, $where = array())

$s = "";
if ($page > 1) {
$s .= "<a class=\"pages-left\" href=\"?page=" . ($page - 1) . "\" title=\"Back\"></a>";
$s .= "<a class=\"pages-left\" href=\"?page=" . ($page - 1) . "\" title=\"" . get_text("Back") . "\"></a>";
}
if ($pages_count > 10) {
if ($page > 5) {
Expand Down Expand Up @@ -519,7 +503,7 @@ function page_footer($table, $items_per_page, $where = array())
}
}
if ($page < $pages_count) {
$s .= "<a class=\"pages-right\" href=\"?page=" . ($page + 1) . "\" title=\"Next\"></a>";
$s .= "<a class=\"pages-right\" href=\"?page=" . ($page + 1) . "\" title=\"" . get_text("Next") . "\"></a>";
}

return array($item_start, "<div class=\"pages\">$s</div>");
Expand Down
20 changes: 0 additions & 20 deletions include/poll.php
Expand Up @@ -46,13 +46,10 @@ function vote_box($poll_id, $vote)
$aid = str_replace("-", "_", $aid);
writeln(' <tr>');
if ($type_id == 1) {
// $units = "votes";
writeln(' <td><input id="a_' . $aid . '" name="answer_id" value="' . $answer["answer_id"] . '" type="radio"></td>');
} else if ($type_id == 2) {
// $units = "votes";
writeln(' <td><input id="a_' . $aid . '" name="answer_id[]" value="' . $answer["answer_id"] . '" type="checkbox"></td>');
} else if ($type_id == 3) {
// $units = "points";
writeln(' <td><input id="a_' . $aid . '" name="answer_id[' . $answer["answer_id"] . ']" type="text"></td>');
} else {
fatal("Unknown poll type");
Expand Down Expand Up @@ -96,13 +93,6 @@ function vote_box($poll_id, $vote)
$votes[] = $row[0]["votes"];
$total += $row[0]["votes"];
}
//if ($total == 1) {
// $units = "votes";
//} else {
// $units = "votes";
//}
// $singular = "<b>$1</b> vote ($2%)";
// $plural = "<b>$1</b> votes ($2%)";
$total_tag = nget_text("<b>$1</b> vote", "<b>$1</b> votes", $total, [$total]);
} else if ($type_id == 3) {
for ($i = 0; $i < count($poll_answer); $i++) {
Expand All @@ -112,13 +102,6 @@ function vote_box($poll_id, $vote)
$votes[] = $row[0]["votes"];
$total += $row[0]["votes"];
}
//if ($total == 1) {
// $units = "points";
//} else {
// $units = "points";
//}
// $singular = "<b>$1</b> point ($2%)";
// $plural = "<b>$1</b> points ($2%)";
$total_tag = nget_text("<b>$1</b> point", "<b>$1</b> points", $total, [$total]);
}

Expand All @@ -139,14 +122,11 @@ function vote_box($poll_id, $vote)
writeln(' <td class="poll-answer">' . $answer["answer"] . '</td>');
writeln(' </tr>');
writeln(' <tr>');
//writeln(' <td><table class="poll-result"><tr><th style="width: ' . $percent . '%"></th><td style="width: ' . (100 - $percent) . '%">' . $votes[$i] . " $units ($percent%)" . '</td></tr></table></td>');
writeln(' <td><table class="poll-result"><tr><th style="width: ' . $percent . '%"></th><td style="width: ' . (100 - $percent) . '%">' . $tag . '</td></tr></table></td>');
writeln(' </tr>');
}
writeln(' </table>');

//$poll_code = crypt_crockford_encode($poll["poll_id"]);

writeln(' <div class="poll-footer">');
writeln(' <div><a href="/poll/' . $day . '/' . $clean . '">' . $comments["tag"] . '</a></div>');
writeln(' <div class="poll-short">(<a href="/' . $poll_code . '">#' . $poll_code . '</a>)</div>');
Expand Down
21 changes: 11 additions & 10 deletions include/story.php
Expand Up @@ -93,18 +93,19 @@ function print_story($story)
$a["actions"] = [];
$count = similar_count($story);
if ($count > 0) {
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/similar\" class=\"icon-16 news-16\">Similar</a>";
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/similar\" class=\"icon-16 news-16\">" . get_text("Similar") . "</a>";
}
if ($auth_user["editor"]) {
if ($twitter_enabled && $story["tweet_id"] == 0) {
if (is_file("$doc_root/www/images/tweet-16.png")) {
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/tweet\" class=\"icon-16 tweet-16\">Tweet</a>";
$icon = "tweet";
} else {
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/tweet\" class=\"icon-16 music-16\">Tweet</a>";
$icon = "music";
}
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/tweet\" class=\"icon-16 $icon-16\">" . get_text("Tweet") . "</a>";
}
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/image\" class=\"icon-16 picture-16\">Image</a>";
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/edit\" class=\"icon-16 notepad-16\">Edit</a>";
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/image\" class=\"icon-16 picture-16\">" . get_text("Image") . "</a>";
$a["actions"][] = "<a href=\"$protocol://$server_name/story/$story_code/edit\" class=\"icon-16 notepad-16\">" . get_text("Edit") . "</a>";
}

print_content($a);
Expand All @@ -126,10 +127,10 @@ function print_journal($journal_id)
$a["comments"] = count_comments($journal_id, TYPE_JOURNAL);

if ($zid == $auth_zid) {
$a["actions"][] = "<a href=\"/journal/$journal_code/edit\" class=\"icon-16 notepad-16\">Edit</a>";
$a["actions"][] = "<a href=\"/journal/$journal_code/media\" class=\"icon-16 clip-16\">Media</a>";
$a["actions"][] = "<a href=\"/journal/$journal_code/edit\" class=\"icon-16 notepad-16\">" . get_text("Edit") . "</a>";
$a["actions"][] = "<a href=\"/journal/$journal_code/media\" class=\"icon-16 clip-16\">" . get_text("Media") . "</a>";
if ($journal["publish_time"] == 0) {
$a["actions"][] = "<a href=\"/journal/$journal_code/publish\" class=\"icon-16 certificate-16\">Publish</a>";
$a["actions"][] = "<a href=\"/journal/$journal_code/publish\" class=\"icon-16 certificate-16\">" . get_text("Publish") . "</a>";
}
} else {
$a["actions"] = [];
Expand All @@ -152,7 +153,7 @@ function print_news_large($article)
$a["link"] = item_link(TYPE_ARTICLE, $article_id, $article);
$a["info"] = content_info($article, $feed);
//$a["comments"] = count_comments($article_id, TYPE_ARTICLE);
$a["view"] = "<a class=\"icon-16 globe-16\" href=\"" . $article["link"] . "\">View Site</a>";
$a["view"] = "<a class=\"icon-16 globe-16\" href=\"" . $article["link"] . "\">" . get_text("View Site") . "</a>";

if ($article["thumb_id"] > 0 && !string_has($a["body"], "<img ")) {
$image = "$protocol://$server_name/thumb/" . crypt_crockford_encode($article["thumb_id"]) . ".jpg";
Expand Down Expand Up @@ -224,7 +225,7 @@ function print_news($a)
writeln('</article>');
} else {
writeln('<article class="news-text">');
writeln(' <div class="article-preview">');
writeln(' <div class="article-preview">');
writeln(' <div class="article-link"><a href="' . $protocol . '://' . $server_name . '/article/' . $short_code . '">' . $a["title"] . '</a></div>');
writeln(' <div class="article-info">' . $info . '</div>');
writeln(' <div class="article-description">' . $a["description"] . '</div>');
Expand Down

0 comments on commit c6beb10

Please sign in to comment.