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
Commits on Source (276)
Showing with 129 additions and 94 deletions
# specify what docker image
# go with the default image for now and mangle it
#image: debian:jessie
stages:
- test
- deploy
#before_script:
php-syntax-check:
stage: test
image: php:7.0-cli-jessie
script:
# - apt-get clean
# - apt-get update
# - apt-get install -y php-cli
- php -l htdocs/index.php
- find components -name *.php | xargs -n 1 php -l
- find plugins -name *.php | xargs -n 1 php -l
- find lib -name *.php | xargs -n 1 php -l
js-syntax-check:
stage: test
image:
name: node:16
#entrypoint: ["/bin/bash", "-c"]
script:
- npm install -g jshint
- find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose
deploy-beta:
stage: deploy
script:
- apt update
- apt install -y curl
- curl https://beta.sucs.org/pull.php
only:
- beta
environment: beta
deploy-live:
stage: deploy
script:
- apt update
- apt install -y curl
- curl https://sucs.org/pull.php
only:
- sucs-site
environment: live
2008-01-29 - Version 0.3 "Logged Out"
Sessions now last a lot longer and are more secure to boot (chckens)
Library admin component allows adding books (chckens, eventually)
Bananas component shelved in favour of Members component for most things (chckens)
Fixes:
Don't list societies with no website in the societies website list (chckens)
Pastebin now redirects to url of pasted item to prevent confusion (chckens)
News article summary can now deal with new lines in the first paragraph (chckens)
2007-10-28 - Version 0.2 "Oktoberfest"
Options component now allows users to change their hackergotchi (aeternus)
Pastebin now lets you view a plaintext version of pastes (aeternus)
Simple password security checks added to hopefully prevent weak passwords (chckens)
Members page now displays this academic year's banana leaderboard (chckens)
2007-09-25 - Version 0.1 "Ferocious Freshers"
First actual version with a number, below are some recent changes:
New member options component!
- MAC registration, contact details editing (aeternus)
- Password changing (chckens)
- Groups display, hackergotchi display (dez)
Beginnings of generic error handling support (chckens)
Fixes:
Improved usability of ShortURI interface (patch from davea)
Layout tweaks to defend against long titles (dez)
Fix calculation for banana summaries on Member pages (chckens)
# SUCS Site
[![build status](https://projects.sucs.org/ci/projects/2/status.png?ref=master)](https://projects.sucs.org/ci/projects/2?ref=master)
---
## Project Structure
<br>
......
......@@ -24,6 +24,8 @@ if (count($members->memberView($who)) > 0) {
header("Location: https://$preferred_hostname$baseurl/Community/Members/$who");
} else {
// banana admin bits
// Tell the banana library that the person/organisation/thing we're dealing with isn't a SUCS member
$isnonmember = true;
if ($mode == "detail") {
if ($session->loggedin) {
include("../lib/banana-admin.php");
......@@ -37,7 +39,6 @@ if (count($members->memberView($who)) > 0) {
if (isset($who))
$smarty->assign('who', "$who");
$smarty->assign('mode', "$mode");
$smarty->assign('users', $users);
......
<?
<?php
exec("/usr/local/bin/shame.py -a", $Shame);
for ($i = 1; $i < (count($Shame) - 1); $i++) {
list($space, $place, $user, $size) = preg_split("/ +/", $Shame[$i]);
......
<? exec("/usr/local/bin/shame.py -a", $Shame);
<?php exec("/usr/local/bin/shame.py -a", $Shame);
$max = 10; //SET to number of users to display
$smarty->assign('title', "The SUCS Hall of Shame");
//$o="<div style='text-align: center;'><img src=\"/images/disk.graph.php\" alt=\"pie chart of top 12 disk users\"/></div>";
......
......@@ -9,7 +9,7 @@ if (!$session->loggedin) {
$output = file_get_contents("../static/fragments/Join.txt");
} else {
$output = "<div class=\"cbb\"><h3>You are logged in</h3><p>If you would like to contribute to the site or report a bug, please contact imranh.</p></div>";
$output = "<div class=\"cbb\"><h3>You are logged in</h3><p style=\"text-align: center;\">Why not join our <a href=\"#\" onclick=\"window.open('/mw/','Milliways','height=600,width=800,menubar=no,resizable=yes,location=no,directories=no,scrollbars=yes,status=no,toolbar=no')\" style=\"font-size: 150%; font-weight: bold; color: #ffc62b;\">Live Chat</a>?</p></div>";
$output = "<div class=\"cbb\"><h3>You are logged in</h3><p style=\"text-align: center;\">Why not join our <a href=\"https://chat.sucs.org\" target=\"_blank\">Live Chat</a>?</p></div>";
//include('users.php');
//$output .= $result;
include('electionreminder.php');
......
<?
<?php
$out = exec("/usr/bin/id");
$smarty->assign("body", $out);
?>
......@@ -32,7 +32,9 @@ if ($session->loggedin) {
if (count($usernames) == 1) {
$smarty->assign('who', $usernames[0]['uid']);
// Add banana widget to the sidebar
$who = $usernames[0]['uid'];
$who = $usernames[0]['uid'];
//Tell the banana library that we're dealing with a real member
$isnonmember = false;
include("../lib/banana-admin.php");
// Needs Redirection
if ($uid) {
......@@ -46,11 +48,11 @@ if ($session->loggedin) {
$homedir = explode('/', $usernames[0]['homedir']);
$usernames[0]['acctype'] = ucfirst($homedir[2]);
// Project
if (file_exists($usernames[0]['homedir'] . '/.project')) {
if (file_exists($usernames[0]['homedir'] . '/.project') && ! is_link($usernames[0]['homedir'] . '/.project')) {
$usernames[0]['project'] = file_get_contents($usernames[0]['homedir'] . '/.project');
}
// Plan
if (file_exists($usernames[0]['homedir'] . '/.plan')) {
if (file_exists($usernames[0]['homedir'] . '/.plan') && ! is_link($usernames[0]['homedir'] . '/.plan')) {
$usernames[0]['plan'] = file_get_contents($usernames[0]['homedir'] . '/.plan');
}
// Website
......
......@@ -3,16 +3,22 @@ $motd_file = "/etc/motd";
function decode_entities($text, $quote_style = ENT_COMPAT)
{
if (function_exists('html_entity_decode')) {
$text = html_entity_decode($text, $quote_style, 'ISO-8859-1'); // NOTE: UTF-8 does not work!
} else {
$trans_tbl = get_html_translation_table(HTML_ENTITIES, $quote_style);
$trans_tbl = array_flip($trans_tbl);
$text = strtr($text, $trans_tbl);
}
$text = html_entity_decode($text, $quote_style, 'ISO-8859-1'); // NOTE: UTF-8 does not work!
$text = preg_replace('~&ndash\;~i', '-', $text);
$text = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $text);
$text = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $text);
$text = preg_replace_callback('~&#x([0-9a-f]+);~i',
function ($matches) {
foreach ($matches as $match) {
return chr(hexdec($match));
}
},
$text);
$text = preg_replace_callback('~&#([0-9]+);~',
function ($matches) {
foreach ($matches as $match) {
return chr($match);
}
},
$text);
return $text;
}
......@@ -52,7 +58,12 @@ for ($i = count($news) - 1; $i > -1; $i--) {
$body = str_replace("&hellip;", "...", $body);
$body = str_replace("&apos;", "'", $body);
// remove hyperlinks, collect to display later
$body = preg_replace(":<a href=['\"](.+?)['\"].*?>(.*?)</a>:e", "'\\2['.linkcounter('\\1').']'", $body);
$body = preg_replace_callback(":<a href=['\"](.+?)['\"].*?>(.*?)</a>:",
function ($matches) {
$i = linkcounter($matches[1]);
return $matches[0]."[".$i."]";
},
$body);
$body = strip_tags($body);
$body = decode_entities($body);
$body = wordwrap($body, 75, "\n ", 1);
......@@ -76,9 +87,11 @@ for ($i = count($news) - 1; $i > -1; $i--) {
}
$motd .= "---------------------------- [ http://sucs.org/ ] -----------------------------\n";
//print($motd);
//if (time()-filemtime($motd_file) < 86000 && $poemmode == 1) { //86000 to allow a little slack depending on when cron runs
// print "MOTD too recent to replace with a poem!\n";
//} else {
file_put_contents($motd_file, $motd);
//}
?>
?>
\ No newline at end of file
......@@ -4,9 +4,9 @@ require("/var/www/sucssite/htdocs/settings.php");
require("/usr/share/php/adodb/adodb.inc.php");
$dbname = 'sucssite';
$dbuser = 'apache';
$dbuser = 'sucs_site_user';
$DB = NewADOConnection('postgres8');
$DB = NewADOConnection('postgres9');
$DB->Connect('dbname=' . $dbname . ' user=' . $dbuser);
$DB->SetCharSet('utf8');
$DB->SetFetchMode(ADODB_FETCH_ASSOC);
......
<?
<?php
// guard against corrupt folder data
define("TOOBIG", 102400);
......
......@@ -5,6 +5,8 @@ require_once("../lib/validation.php");
require_once("Net/MAC.php");
include_once("../lib/date.php");
// password hash, renewal functions
include_once("../lib/member_functions.php");
// Some Constants
// These could possibly be moved somewhere saner?
......@@ -47,7 +49,7 @@ function changePassword($oldpass, $newpass1, $newpass2)
// if everything looks OK, attempt to make the change
$success = ldap_mod_replace($ldap, "uid=" . $session->username . ",ou=People,dc=sucs,dc=org",
array('userpassword' => "{SHA}" . base64_encode(pack("H*", sha1($newpass1)))));
array('userpassword' => "{CRYPT}" . cryptPassword($newpass1)));
ldap_close($ldap);
return $success;
......@@ -214,7 +216,6 @@ function updateRenew()
return FALSE;
}
include_once("../lib/member_functions.php");
renew_membership($member['username']);
$sucsDB->Execute("update signup set activated=NOW(), username=? where id=?", array($member['username'], $signup['id']));
return TRUE;
......
<?
<?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();
......
......@@ -98,7 +98,7 @@ $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[0];
$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
......
......@@ -50,6 +50,10 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
// pass on the id and passwd and id the validation is overridable
$smarty->assign("signupid", $signupid);
$smarty->assign("signuppw", $signuppw);
// pass on the student id if it exists
if (isset($_REQUEST['signupsid'])) {
$smarty->assign("signupsid", $_REQUEST['signupsid']);
}
$smarty->assign("overridable", $overridable);
$smarty->assign("usertype", $row[type]);
// if accepting the form
......@@ -80,18 +84,18 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
$errors['address'] = $error;
}
$fields['address'] = sanitizeAddress($_POST['address']);
if (!validRealName($_REQUEST['realname'], $override)) {
if (!validName($_REQUEST['realname'], $override)) {
$valid = false;
$errors['realname'] = $error;
}
$fields['realname'] = $_REQUEST['realname'];
} else {
if (!(validRealName($_REQUEST['contact'], false) || $override)) {
if (!(validName($_REQUEST['contact'], false) || $override)) {
$valid = false;
$errors['contact'] = $error;
}
$fields['contact'] = $_REQUEST['contact'];
if (!validSocName($_REQUEST['realname'], $override)) {
if (!validName($_REQUEST['realname'], $override)) {
$valid = false;
$errors['realname'] = $error;
}
......@@ -128,16 +132,8 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
);
$failed = true;
} else {
// determine the uid range
if ($row[type] == 2) {
$baseuid = 8;
} else {
$baseuid = 29;
}
$minuid = $baseuid * 1000;
$maxuid = $minuid + 999;
//get the new uid
$uid = findUid($minuid, $maxuid);
//generate the new uid
$uid = generateUid();
// make a password
$password = make_password();
// make the ldif
......@@ -171,7 +167,7 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
mail(
$error_email,
"Signup Error",
"User " . $fields['username'] . " already exists in the databse, THIS SHOULD NEVER HAPPEN\n Love the signup system.\n\nP.S. the signup id is: " . $signupid,
"User " . $fields['username'] . " already exists in the database, THIS SHOULD NEVER HAPPEN\n Love, the signup system.\n\nP.S. the signup id is: " . $signupid,
"From: \"SUCS Admin\" <admin@sucs.org>"
);
$failed = true;
......@@ -255,16 +251,10 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
if ($override) {
$logsmessage .= "User " . $session->username . " overrode validation.\n";
}
$logsmessage .= "Love The Signup System";
$logsmessage .= "Love, The Signup System";
// DEV: CHANGE THIS EMAIL ADDRESS
mail(
"logs@sucs.org",
"User '" . $fields['username'] . "' Created on SUCS",
$logsmessage,
"From: \"SUCS Admin\" <admin@sucs.org>"
);
mail(
"treasurer@sucs.org",
"logs@sucs.org,treasurer@sucs.org",
"User '" . $fields['username'] . "' Created on SUCS",
$logsmessage,
"From: \"SUCS Admin\" <admin@sucs.org>"
......@@ -339,7 +329,7 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
foreach ($errorreparray as $key => $value) {
$errorreport .= $key . ": " . $value . "\n";
}
$errorreport .= "\nLove from the Signup System";
$errorreport .= "\nLove, the Signup System";
mail(
$error_email,
"Signup system error report",
......
<?
<?php
require_once("../lib/validation.php");
// don't output the site template
$no_template = TRUE;
......@@ -14,7 +14,10 @@ if (isset($_GET['key'])) {
}
break;
case "postcode":
echo lookup_postcode($_GET['value']);
$postcode = validPostcode($_GET['value']);
if ($postcode != false) {
lookup_postcode($postcode);
}
break;
case "username":
$username = $_GET['value'];
......@@ -26,7 +29,7 @@ if (isset($_GET['key'])) {
break;
case "realname":
$realname = $_GET['value'];
if (validRealName($realname, false)) {
if (validName($realname, false)) {
echo "OK";
} else {
echo $error;
......@@ -34,7 +37,7 @@ if (isset($_GET['key'])) {
break;
case "socname":
$socname = $_GET['value'];
if (validSocName($socname, false)) {
if (validName($socname, false)) {
echo "OK";
} else {
echo $error;
......
......@@ -38,16 +38,19 @@ if (isset($session->groups[$permission])) {
$smarty->assign("error_text", "Search term doesn't look like a valid student ID");
} else {
// they have given us a valid sid lets check to see if they have paid
$sid = $_REQUEST['sid'];
// make sure the user/admin/exec isn't an idiot
// check if they are already signed up and tell them so
$tmpresult = $sucsDB->Execute("SELECT * FROM members WHERE sid=?", array($_REQUEST['sid']));
if ($tmpresult->fields["sid"] == $sid && $tmpresult->fields["paid"] == paidUntil(time())) {
// let them know they are already signed up and renewed
$mode = 'error';
message_flash("You are a numpty and have already signed up and paid for this year.");
// else if check to see if they have signedup and paid for the new year but haven't renewed
} else if ($tmpresult->fields["sid"] == $sid && $tmpresult->fields["paid"] != paidUntil(time())) {
// renew them!
$mode = 'error';
renew_membership($tmpresult->fields["username"]);
// let them know that their account has been renewed
message_flash("Your SUCS account has been renewed.");
......@@ -177,7 +180,7 @@ function get_renewable_members()
function admin_renew_member($renew_name, $admin_name)
{
global $sucsDB;
renew_member($renew_name);
renew_membership($renew_name);
$q = "SELECT email, typename FROM members, member_type WHERE username=? AND type=member_type.id;";
$r = $sucsDB->Execute($q, array($renew_name));
$message = "Account Renewal notification\n\n";
......
......@@ -40,26 +40,27 @@ if (!empty($_REQUEST['sid']) && !empty($_REQUEST['transactionID'])) {
if ($tmpresult->fields["sid"] == $sid && $tmpresult->fields["paid"] == paidUntil(time())) {
// let them know they are already signed up and renewed
message_flash("You are a numpty and have already signed up and paid for this year.");
// else if check to see if they have signedup and paid for the new year but haven't renewed
// else if check to see if they have signedup and paid for the new year but haven't renewed
} else if ($tmpresult->fields["sid"] == $sid && $tmpresult->fields["paid"] != paidUntil(time())) {
// renew them!
renew_membership($tmpresult->fields["username"]);
// let them know that their account has been renewed
message_flash("Your SUCS account has been renewed.");
// else if they aren't in the SUCS DB but have a signup slip, take them back to that part of signup
// I don't know how you would end up in a state like this but the old code dealt with it so I will as well
} else if ($tmpresult->fields == false && $signuptmpresult->fields["sid"] == $sid) {
// else if they aren't in the SUCS DB but have a signup slip, take them back to that part of signup
} else if ($tmpresult->fields == false && $signuptmpresult->fields["sid"] == $sid && $signuptmpresult->fields["activated"] == NULL) {
$mode = "form";
$smarty->assign("id", $signuptmpresult->fields["id"]);
$smarty->assign("pass", $signuptmpresult->fields["password"]);
// else if they aren't in the SUCS DB, then bootstrap signup process
} else if ($tmpresult->fields == false && $signuptmpresult->fields == false) {
$smarty->assign("sid", $signuptmpresult->fields["sid"]);
// else if they aren't in the SUCS DB, then bootstrap signup process
} else if ($tmpresult->fields == false) {
$mode = "form";
$pass = make_password();
$iddata = $sucsDB->Execute("insert into signup (password,sid,issuedby) values( ?, ?, ?) returning id", array($pass, $sid, "99999"));
$id = $iddata->fields['id'];
$smarty->assign("id", $id);
$smarty->assign("pass", $pass);
$smarty->assign("sid", $sid);
} else {
// they should never get here
die("You'll see this if there has been a database error. Someone probably knows and is trying to fix it. Sorry.");
......
......@@ -204,6 +204,7 @@ CREATE TABLE election_votes (
treasurer text,
secretary text,
publicity text,
gaming text,
ipaddress text
);
 
......@@ -2100,7 +2101,7 @@ COPY menu (id, title, parent, menuorder, target, title_cy, permission) FROM stdi
19 Members 16 1 /Community/Members Aelodau \N
20 Societies 16 2 /Community/Societies Cymdeithasau \N
33 Desktop on Demand 8 5 /Tools/Desktop on Demand \N \N
34 Projects 16 8 /Community/Projects \N \N
34 Projects 16 8 https://projects.sucs.org/explore \N \N
3 About \N 2 /About Amdano \N
16 Community \N 4 /Community Cymuned \N
37 Talks 16 5 /Community/Talks \N \N
......