Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • osian/sucs-site
  • kais58/sucs-site
  • imranh/sucs-site
  • foshjedi2004/sucs-site
  • gigosaurus/sucs-site
  • matstn/sucs-site
  • ripp_/sucs-site
  • eggnog/sucs-site
  • sucssite/sucs-site
  • elbows/sucs-site
  • realitykiller/sucs-site
  • crox/sucs-site
  • vectre/sucs-site
  • welshbyte/sucs-site
  • paperclipman/sucs-site
15 results
Show changes
Showing
with 4300 additions and 1163 deletions
<?php
// number of recent planet entries we want to return
$num_entries = 5;
unset($result);
$planetposts = array();
$xmldata = file_get_contents("../htdocs/planet/atom.xml");
$simplexml = simplexml_load_string($xmldata);
$xml = $simplexml->children('http://www.w3.org/2005/Atom');
foreach ($xml->entry as $entry) {
$planetposts[] = array(
"post" => $entry->title,
"post_uri" => $entry->link->attributes()->href,
"user" => $entry->author->name,
"user_uri" => $entry->author->uri
);
}
$planetposts = array_slice($planetposts, 0, $num_entries);
$smarty->assign('planetposts', $planetposts);
$result = $smarty->fetch('planetposts.tpl');
?>
<?php
$res = $sucsDB->Execute("select username, sum(pages) as pages from printer where username != 'old' group by username order by sum(pages) desc");
$num = $res->RecordCount();
for ($i = 0; $i < $num; $i++) {
$row[$i] = $res->FetchRow();
if ($i < 12) {
$item[] = $row[$i]['username'];
$slice[] = $row[$i]['pages'];
} else {
$otherSize += $row[$i]['pages'];
}
}
// $itemName[]="Other";
// $sliceSize[]=$otherSize;
$slice = array_merge(array($otherSize), $slice);
$item = array_merge(array("Other"), $item);
/* echo "<pre>";
print_r($slice);
print_r($item);*/
include("../../lib/pieChart.php");
piechart("Top 12, Users of Printing", $slice, $item, 0)
?>
\ No newline at end of file
<?PHP
/******
* Printer Shame List
* Ported from old site by tswsl1989
*
*/
$max = 10; //Set this to number of users to display in chart
$timestamp = '2014-02-05 18:29:02+00'; //display printer stats since this time
$smarty->assign('title', "Printer Statistics");
// $out="<img src=\"/images/printer.graph.php\" alt=\"pie chart of top 12 printer users\"/>";
$table = "<table border=1 cellpadding=3>\n<tr>\n<th>Username</th>\n<th>Pages</th>\n<th>Projected Monthly Usage</th>\n<th>Printed This Month</th>\n<th>What it would cost in the library</th></tr>\n";
//pull in all the current users (ie not old) who have printed stuff
$res = $sucsDB->Execute("select username, sum(pages) as pages from printer where username != 'old' AND start > '" . $timestamp . "' group by username order by sum(pages) desc");
$num = $res->RecordCount();
//for each row stuff the infomation into an array, then free up the database resorces
for ($i = 0; $i < $num; $i++) {
$data[$i] = $res->FetchRow();
$data[$i]['month'] = 0;
}
$res->Close();
//get the second since epoch
$thisSecond = time();
//for each user who has printed stuff add the first printed time (since epoch) to the array
for ($i = 0; $i < $num; $i++) {
$res = $sucsDB->Execute("select date_part('epoch',start) as first from printer where username ='" . $data[$i]['username'] . "' order by start asc limit 1;");
$temp = $res->FetchRow();
$data[$i]['first'] = $temp['first'];
$res->Close();
}
$res = $sucsDB->Execute("select username, pages, start from printer where username != 'old'");
$datesnum = $res->RecordCount();//for each row stuff the infomation into an array, then free up the database resorces
for ($i = 0; $i < $datesnum; $i++) {
$dates[$i] = $res->FetchRow($res, $i);
}
$res->Close();
// get the current month
$theMonth = date("m");
$theYear = date("Y");
for ($i = 0; $i < $datesnum; $i++) {
$userMonth = substr($dates[$i]['start'], 5, 2);
$userYear = substr($dates[$i]['start'], 0, 4);
if (($userMonth == $theMonth) && ($userYear == $theYear)) {
for ($j = 0; $j < $num; $j++) {
if ($data[$j]['username'] == $dates[$i]['username']) {
$data[$j]['month'] += $dates[$i]['pages'];
}
}
}
}
//start the total counter
$total = 0;
//for each user.. print a row in the table
for ($i = 0; $i < $num; $i++) {
$table .= "<tr align=\"center\">\n";
$table .= "<td>{$data[$i]['username']}</td>\n";
$table .= "<td>{$data[$i]['pages']}</td>\n";
//avg pages per month = seconds in a month / (now - first print) * pages
$crazyGuess = round((2629743.83 / ($thisSecond - $data[$i]['first'])) * $data[$i]['pages']);
//if the user has only started printing in the last month its not sensible to give a guess of average useage
if ($thisSecond - $data[$i]['first'] <= 2629743.83) {
$table .= "<td>Not enough data</td>\n";
} //traffic lights for pinter useage, adjust values as required
elseif ($crazyGuess <= 25) {
$table .= "<td BGCOLOR=\"Green\">" . $crazyGuess . "</td>\n";
} elseif ($crazyGuess <= 33) {
$table .= "<td BGCOLOR=\"Orange\">" . $crazyGuess . "</td>\n";
} else {
$table .= "<td BGCOLOR=\"Red\">" . $crazyGuess . "</td>\n";
}
if ($data[$i]['month'] >= 300) {
$table .= "<td BGCOLOR=\"Red\">{$data[$i]['month']}</td>\n";
} else {
$table .= "<td>{$data[$i]['month']}</td>\n";
}
$table .= "<td>" . sprintf("£ %01.2f", round(0.05 * $data[$i]['pages'], 2)) . "</td>\n";
//add this users useage to the total
$total += $data[$i]['pages'];
$table .= "</tr>\n";
}
//get the first print date
$date['first'] = getdate("1391624942");
//get the last print date
$res = $sucsDB->Execute("select date_part('epoch',start) as last from printer order by start desc limit 1;");
$temp = $res->FetchRow();
$date['last'] = getdate($temp['last']);
$res->Close();
//get the number of pages printed by "old" users and add it to the total
$res = $sucsDB->Execute("select sum(pages) as pages from printer where username = 'old' group by username order by sum(pages) desc");
$old = $res->FetchRow();
$old = $old['pages'];
$res->Close();
$total += $old;
//Output two lines at the bottem of the table, one for "old" users and the other for the total
$table .= "<tr align=\"center\">\n\t<th>Old Users</th>\n\t<th>$old</th>\n\t<th>n/a</th>\n</tr>";
$table .= "<tr align=\"center\">\n\t<th>Total</th>\n\t<th>$total</th>\n\t<th>" . round((2629743.83 / ($thisSecond - $date['first'][0])) * $total) . "</th>\n</tr>";
$table .= "</table>\n";
//output the dates of the first and last prints recorded
$out .= "<script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>
<script type=\"text/javascript\">
google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'User');
data.addColumn('number', 'Pages Printed');
data.addRows(" . ($max + 2) . ");\n";
for ($i = 0; $i < ($max + 1); $i++) {
$out .= "data.setValue(" . ($i) . ", 0, '" . $data[$i]['username'] . "');\n";
$out .= "data.setValue(" . ($i) . ", 1," . $data[$i]['pages'] . ");\n";
}
$others = 0;
for ($i = $max; $i < count($data); $i++) {
$others += $data[$i]['pages'];
}
$out .= "data.setValue(" . ($max + 1) . ", 0, 'Others');\ndata.setValue(" . ($max + 1) . ",1, $others);\n";
$out .= "\t\tvar chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, {width: 500, height: 360, backgroundColor: 'none', is3D: true, title: 'Printer Usage'});
}
</script>";
$out .= "<div id=\"chart_div\" style=\"background: none;\"></div>";
$out .= "<p>First Data - " . $date['first'][weekday] . ", " . $date['first'][mday] . " " . $date['first'][month] . " " . $date['first'][year] . ", at " . sprintf("%02d:%02d:%02d", $date['first'][hours], $date['first'][minutes], $date['first'][seconds]) . "<br />";
$out .= "Last Data - " . $date['last'][weekday] . ", " . $date['last'][mday] . " " . $date['last'][month] . " " . $date['last'][year] . ", at " . sprintf("%02d:%02d:%02d", $date['last'][hours], $date['last'][minutes], $date['last'][seconds]) . "</p>";
//do some silly maths to work out lots of silly things
$paperarea = round(0.21 * 0.297 * $total, 3); //area of paper
$paperweight = round($paperarea * .08, 3); //how much that would weigh
$numtrees = round($paperweight / 730.296, 6); //*very* roughly how many trees that would be
$cost = sprintf("£%01.2f", round(0.05 * $total, 2));
$out .= "<p>That's " . $paperarea . "m<sup>2</sup> of paper, weighing " . $paperweight . "kg!<br>\n";
$out .= "This is equivalent to approximately " . $numtrees . " trees.<br>\n";
$out .= "That would have cost our members a grand total of " . $cost . " if it were printed in the library.. not bad for £5 each!";
//done
$out .= "<p>Note: The number of pages is the number spooled and may be more than the actual number printed</p>";
$out .= $table;
$sucsDB->Close();
$smarty->assign('body', $out);
?>
......@@ -4,34 +4,39 @@ $dirlist = scandir("/var/projects/trac");
$projects = array();
foreach ($dirlist as $file) {
if ($file[0]!=".") {
$object=array();
$object['filename'] = $file;
$ini_array = array();
$ini_data = file("/var/projects/trac/".$file."/conf/trac.ini");
$projectsection = FALSE;
foreach ($ini_data as $ini_line) {
if (trim($ini_line) == "[project]") {
$projectsection = TRUE;
} else if ($projectsection && (1 == preg_match("/^\[.*\]$/", trim($ini_line)))) {
$projectsection = FALSE;
} else if ($projectsection) {
list($key, $value) = split("=", $ini_line);
$ini_array[trim($key)] = trim($value);
}
}
if (isset($ini_array['public']) && ($ini_array['public'] == "true")) {
$object['name'] = $ini_array['name'];
if ($object['name']=="") $object['name'] = $file;
$object['descr'] = $ini_array['descr'];
$projects[$file]=$object;
}
}
if ($file[0] != ".") {
$object = array();
$object['filename'] = $file;
$ini_array = array();
$filepath = "/var/projects/trac/" . $file . "/conf/trac.ini";
// read trac.ini for this project
if (is_readable($filepath) && ($ini_data = file($filepath)) != FALSE) {
$projectsection = FALSE;
foreach ($ini_data as $ini_line) {
if (trim($ini_line) == "[project]") {
$projectsection = TRUE;
} else if ($projectsection && (1 == preg_match("/^\[.*\]$/", trim($ini_line)))) {
$projectsection = FALSE;
} else if ($projectsection) {
list($key, $value) = preg_split("/=/", $ini_line);
$ini_array[trim($key)] = trim($value);
}
}
// only list projects whose trac.ini sets public = true
if (isset($ini_array['public']) && ($ini_array['public'] == "true")) {
$object['name'] = $ini_array['name'];
if ($object['name'] == "") $object['name'] = $file;
$object['descr'] = $ini_array['descr'];
$projects[$file] = $object;
}
}
}
}
$smarty->assign("projects", $projects);
......
<?php
// Config options
$permission = "sucsstaff";
// TODO: DEV: UNSTICK THIS BEFORE DEPLOY
if (isset($session->groups[$permission])) {
$smarty->assign("staff", TRUE);
//get unused signup slips
$query = "SELECT signup.id, signup.sid, member_type.typename, members.username, signup.card";
$query .= " FROM signup LEFT JOIN member_type ON signup.type = member_type.id LEFT JOIN members ON signup.issuedby=members.uid";
$query .= " WHERE";
$query .= " signup.activated is NULL";
$query .= " or signup.username is NULL";
$query .= " ORDER BY signup.id";
$query .= ";";
$data = $sucsDB->GetAll($query);
// process responces
if (isset($_POST['command'])) {
if ($_POST['command'] == 'update') {
$changed = 0;
$upquery = "UPDATE signup";
$upquery .= " SET sid = ?";
$upquery .= " WHERE id = ?";
$upquery .= ";";
foreach ($data as $value) {
if (array_key_exists('sid:' . $value['id'], $_POST) && $_POST['sid:' . $value['id']] != $value['sid']) {
$uparray = array($_POST['sid:' . $value['id']], $value['id']);
$sucsDB->query($upquery, $uparray);
$changed++;
}
}
message_flash($changed . " record(s) updated");
}
}
$data = $sucsDB->GetAll($query);
//set smarty stuff
$smarty->assign("signups", $data);
$smarty->assign("self", $baseurl . $path . $getout);
}
$body = $smarty->fetch("signup-admin.tpl");
$smarty->assign('title', "Signup Slip Admin");
$smarty->assign('body', $body);
?>
This diff is collapsed.
<?php
require_once("../lib/validation.php");
// don't output the site template
$no_template = TRUE;
header("Content-type: text/plain");
if (isset($_GET['key'])) {
switch ($_GET['key']) {
case "sid":
$sid = $_GET['value'];
if (validSID($sid, false)) {
echo "OK:" . lookupSID($_GET['value']);
} else {
echo "ERROR:" . $error;
}
break;
case "postcode":
$postcode = validPostcode($_GET['value']);
if ($postcode != false) {
lookup_postcode($postcode);
}
break;
case "username":
$username = $_GET['value'];
if (validUsername($username)) {
echo "OK";
} else {
echo $error;
}
break;
case "realname":
$realname = $_GET['value'];
if (validName($realname, false)) {
echo "OK";
} else {
echo $error;
}
break;
case "socname":
$socname = $_GET['value'];
if (validName($socname, false)) {
echo "OK";
} else {
echo $error;
}
break;
case "address":
$address = $_GET['value'];
if (validAddress($address)) {
echo "OK";
} else {
echo $error;
}
break;
case "email":
$email = $_GET['value'];
if (validSignupEmail($email)) {
echo "OK";
} else {
echo $error;
}
break;
case "phone":
$phone = $_GET['value'];
if (validPhone($phone)) {
echo "OK";
} else {
echo $error;
}
break;
}
}
?>
......@@ -5,28 +5,29 @@ define('_LDAP_SERVER', 'ldap://silver');
// Connect and bind to ldap server
$conn = ldap_connect(_LDAP_SERVER);
$bind = ldap_bind($conn);
# ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
# $bind = ldap_bind($conn);
$search = ldap_search($conn, _BASE_DN, 'uid=*', array('uid', 'cn', 'homedirectory'));
// Sort By Username
ldap_sort($conn, $search, 'uid');
// Produce an array of usernames
$usernames = array();
$entryHandler = ldap_first_entry($conn, $search);
while($entryHandler) {
$username = ldap_get_values($conn, $entryHandler, 'uid');
$fullname = ldap_get_values($conn, $entryHandler, 'cn');
$homedir = ldap_get_values($conn, $entryHandler, 'homedirectory');
$homedir = $homedir[0];
$homedirArray = explode('/', $homedir);
if (($homedirArray[2]=="society") && file_exists( "$homedir/public_html")) {
$usernames[] = array( "username" => $username[0], "fullname" => $fullname[0]);
}
$entryHandler = ldap_next_entry($conn, $entryHandler);
}
// Sort By Username
ldap_sort($conn, $search, 'uid');
// Produce an array of usernames
$usernames = array();
$entryHandler = ldap_first_entry($conn, $search);
while ($entryHandler) {
$username = ldap_get_values($conn, $entryHandler, 'uid');
$fullname = ldap_get_values($conn, $entryHandler, 'cn');
$homedir = ldap_get_values($conn, $entryHandler, 'homedirectory');
$homedir = $homedir[0];
$homedirArray = explode('/', $homedir);
if (($homedirArray[2] == "society") && file_exists("$homedir/public_html")) {
$usernames[] = array("username" => $username[0], "fullname" => $fullname[0]);
}
$entryHandler = ldap_next_entry($conn, $entryHandler);
}
$smarty->assign("societies", $usernames);
......
......@@ -5,109 +5,114 @@
$permission = "html";
// Get the right filename...
$myfile = $base."static".$path.$language['file'].".txt";
$secondaryfile = $base."static".$path.$language['file']."-secondary.txt";
$myfile = $base . "static" . $path . $language['file'] . ".txt";
$secondaryfile = $base . "static" . $path . $language['file'] . "-secondary.txt";
if (!file_exists($myfile)) {
$myfile = $base."static$path.txt";
$secondaryfile = $base."static$path-secondary.txt";
// If the file doesn't exist...
if (!file_exists($myfile)) {
if (isset($session->groups[$permission]) && @$_REQUEST['action']=="create") {
// ...and we have permission and have been asked to, create it
$body = "foo";
} else {
$redirect_path = $DB->GetOne("SELECT to_uri FROM redirect where from_uri=?", array("/".$pathlist[1]));
if (isset($_SERVER['HTTPS'])) $proto = "https://";
else $proto = "http://";
if ($redirect_path!="") {
$variables = "";
for ($i=2;$i<count($pathlist);$i++) {
$variables .= "/".$pathlist[$i];
}
$redirect_uri = $proto.$_SERVER['SERVER_NAME'].$redirect_path.$variables;
if ($_SERVER['QUERY_STRING']!="") $redirect_uri.="?".$_SERVER['QUERY_STRING'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$redirect_uri);
} else {
// ...serve a 404 error
header("HTTP/1.1 404 Not Found");
$body = @file_get_contents($base."static/404.txt");
$smarty->assign("pathlist", array("", "Error"));
$title = "File not found";
$smarty->assign("title", $title);
$smarty->assign("body", $body);
// Give those with permission the chance to create the page
if (isset($session->groups[$permission])) $smarty->assign("creatable", TRUE);
}
return;
}
}
$myfile = $base . "static$path.txt";
$secondaryfile = $base . "static$path-secondary.txt";
// If the file doesn't exist...
if (!file_exists($myfile)) {
if (isset($session->groups[$permission]) && @$_REQUEST['action'] == "create") {
// ...and we have permission and have been asked to, create it
$body = "foo";
} else {
$redirect_path = $DB->GetOne("SELECT to_uri FROM redirect where from_uri=?", array("/" . $pathlist[1]));
if (isset($_SERVER['HTTPS'])) $proto = "https://";
else $proto = "http://";
if ($redirect_path != "") {
$variables = "";
for ($i = 2; $i < count($pathlist); $i++) {
$variables .= "/" . $pathlist[$i];
}
$redirect_uri = $proto . $_SERVER['SERVER_NAME'] . $redirect_path . $variables;
if ($_SERVER['QUERY_STRING'] != "") $redirect_uri .= "?" . $_SERVER['QUERY_STRING'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $redirect_uri);
} else {
// ...serve a 404 error
header("HTTP/1.1 404 Not Found");
$body = @file_get_contents($base . "static/404.txt");
$smarty->assign("pathlist", array("", "Error"));
$title = "File not found";
$smarty->assign("title", $title);
$smarty->assign("body", $body);
// Give those with permission the chance to create the page
if (isset($session->groups[$permission])) $smarty->assign("creatable", TRUE);
}
return;
}
}
}
// If we've got edit permission...
if (isset($session->groups[$permission])) {
switch (@$_REQUEST['action']) {
case "Save":
// ...save the file
$savesuccess = @file_put_contents($myfile, $_REQUEST['body'], LOCK_EX);
if (!$savesuccess) trigger_error("Write failed", E_USER_ERROR);
$id = $DB->GetOne("select id from static where path=?", array($path));
$record = array();
$record['summary'] = $_REQUEST['summary'];
$record['editor'] = $session->username;
$record['path'] = $path;
if ($id>0) {
$DB->AutoExecute("static", $record, 'UPDATE', "id = '".$id."'");
} else {
$DB->AutoExecute("static", $record, 'INSERT');
}
// probably need some error-handling here...
break;
case "Delete":
$deleted = unlink($myfile);
break;
}
switch (@$_REQUEST['action']) {
case "Save":
// ...save the file
$savesuccess = @file_put_contents($myfile, $_REQUEST['body'], LOCK_EX);
if (!$savesuccess) trigger_error("Write failed", E_USER_ERROR);
$id = $DB->GetOne("select id from static where path=?", array($path));
$record = array();
$record['summary'] = $_REQUEST['summary'];
$record['editor'] = $session->username;
$record['path'] = $path;
if ($id > 0) {
$DB->AutoExecute("static", $record, 'UPDATE', "id = '" . $id . "'");
} else {
$DB->AutoExecute("static", $record, 'INSERT');
}
// probably need some error-handling here...
break;
case "Delete":
$deleted = unlink($myfile);
break;
}
}
$title = end($pathlist);
if (file_exists($myfile)) {
$body = file_get_contents($myfile);
$modified = date("r", filectime($myfile));
$modifiedby = $DB->GetOne("select editor from static where path=?", array($path));
$body = file_get_contents($myfile);
$modified = date("r", filectime($myfile));
$modifiedby = $DB->GetOne("select editor from static where path=?", array($path));
}
if (file_exists($secondaryfile)) {
$secondary = file_get_contents($secondaryfile);
$smarty->assign("secondary", $secondary);
$secondary = file_get_contents($secondaryfile);
$smarty->assign("secondary", $secondary);
}
$smarty->assign("title", $title);
// include a widget for leaving feedback on this page if the user is logged in
if ($session->loggedin) {
// include("../lib/page-feedback.php");
}
$smarty->assign("title", str_replace("_", " ", $title));
// Editing static pages - does the user have permission?
if (isset($session->groups[$permission])) {
// display Edit link on page
$smarty->assign("editable", TRUE);
$smarty->assign("editable", TRUE);
switch (@$_REQUEST['action']) {
switch (@$_REQUEST['action']) {
// load the editing template
case "create":
if (!file_exists($myfile)) file_put_contents($myfile, "Page under construction\n", LOCK_EX);
case "edit":
$smarty->assign("editcontent", $body);
$record['summary'] = $DB->GetOne("select summary from static where path=?", array($path));
$smarty->assign("record", $record);
$smarty->assign("action", "edit");
$modified = NULL;
$body = $smarty->fetch('static_edit.tpl');
break;
case "delete-query":
$body = $smarty->fetch('static_delete.tpl').$body;
break;
case "Delete":
if ($deleted) $body = "File deleted";
break;
}
case "create":
if (!file_exists($myfile)) file_put_contents($myfile, "Page under construction\n", LOCK_EX);
case "edit":
$smarty->assign("editcontent", $body);
$record['summary'] = $DB->GetOne("select summary from static where path=?", array($path));
$smarty->assign("record", $record);
$smarty->assign("action", "edit");
$modified = NULL;
$body = $smarty->fetch('static_edit.tpl');
break;
case "delete-query":
$body = $smarty->fetch('static_delete.tpl') . $body;
break;
case "Delete":
if ($deleted) $body = "File deleted";
break;
}
}
$smarty->assign("body", $body);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="sucs.org" />
<allow-access-from domain="www.sucs.org" />
<allow-access-from domain="www.swansea-union.co.uk" />
<allow-access-from domain="swansea-union.co.uk" />
<allow-access-from domain="stream.sucs.org" />
<allow-access-from domain="www.fomore.com" />
</cross-domain-policy>
This diff is collapsed.
This diff is collapsed.
/* Serve gif images to IE/Win pre version 7 */
.i1, .i2 {
background-image:url('/images/borders.gif');
background-image: url('/images/borders.gif');
}
.bt, .bt div, .bb, .bb div {
background-image:url('/images/box.gif');
background-image: url('/images/box.gif');
}
/* Set a height to fix up some rendering issues. */
.i1, .i3 {
height:1px;
height: 1px;
}
This diff is collapsed.
This diff is collapsed.