# HG changeset patch # User Matti Hamalainen # Date 1382468112 -10800 # Node ID eecac02579c4d44c30d03ec590571fe88091f3f7 # Parent 3ed09527e34869fdc4a6ff7ab4ab16c2549714de Move stChop() to site module and rename it to stStrChop(). diff -r 3ed09527e348 -r eecac02579c4 msite.inc.php --- a/msite.inc.php Tue Oct 22 21:50:02 2013 +0300 +++ b/msite.inc.php Tue Oct 22 21:55:12 2013 +0300 @@ -540,4 +540,17 @@ return stChkSetting("allowRegister") && ($maxAttendeesHard <= 0 || $numAttendees < $maxAttendeesHard); } + + +function stStrChop($str, $len) +{ + if (strlen($str) > $len) + $s = substr($str, 0, $len - 3)."..."; + else + $s = $str; + return sprintf("%-".$len."s", $s); +} + + + ?> \ No newline at end of file diff -r 3ed09527e348 -r eecac02579c4 results.inc.php --- a/results.inc.php Tue Oct 22 21:50:02 2013 +0300 +++ b/results.inc.php Tue Oct 22 21:55:12 2013 +0300 @@ -3,15 +3,6 @@ $showResults = stGetSetting("showResults"); $showAuthors = stGetSetting("showResAuthors"); -function stChop($str, $len) -{ - if (strlen($str) > $len) - $s = substr($str, 0, $len - 3)."..."; - else - $s = $str; - return sprintf("%-".$len."s", $s); -} - echo "

Results

\n"; @@ -84,8 +75,8 @@ $prev = $entry["votesum"]; printf(" %s by %s (%d pts)\n", - chentities(stChop($entry["name"], 30)), - chentities(stChop($showAuthors ? $entry["author"] : "-", 30)), + chentities(stStrChop($entry["name"], 30)), + chentities(stStrChop($showAuthors ? $entry["author"] : "-", 30)), $entry["votesum"]); }