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 (259)
Showing with 187 additions and 63 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
# 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;
......@@ -29,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;
......@@ -37,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;
......
......@@ -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
......
<!DOCTYPE html>
<html lang="en">
<head>
<title>SUCS 3 Step Signup</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="plaster-files/css/3step.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<body>
<div class="jumbotron jumbotron-fluid text-center">
<!--h1>Swansea University Computer Society</h1-->
<img src="https://sucs.org/~imranh/img/sucslogo_trans_white.png"/>
<!--p>1. Pay, 2. Create, 3. Enjoy</p-->
</div>
<div class="container text-center">
<div class="row d-flex justify-content-center">
<div class="col-8">
<div class="card mb-4">
<div class="card-body">
<h4 class="card-title">💳</h4>
<p class="card-text">1. Pay for membership</p>
<a href="https://sucs.org/join" target="_blank" rel="noopener noreferrer" class="btn btn-primary">Pay Online</a>
</div>
</div>
</div>
</div>
<div class="row d-flex justify-content-center">
<div class="col-8">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">👤</h5>
<p class="card-text">2. Create your username</p>
<a href="https://sucs.org/susignup" target="_blank" rel="noopener noreferrer" class="btn btn-primary">Create Username</a>
</div>
</div>
</div>
</div>
<div class="row d-flex justify-content-center">
<div class="col-8">
<div class="card mb-4">
<div class="card-body">
<h5 class="card-title">💬</h5>
<p class="card-text">3. Join the conversation</p>
<a href="https://chat.sucs.org" target="_blank" rel="noopener noreferrer" class="btn btn-primary">Join Discord</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -3,8 +3,9 @@
-------------------------------------------------- */
body {
background: #fff;
background: #fff0cd;
min-width: 600px;
margin: 0px;
}
hr {
......@@ -34,12 +35,12 @@ a:hover {
/* --------------------------------------------------
Page corners
-------------------------------------------------- */
#branding, #brandingC {
/*#branding, #brandingC {
border-top-left-radius: 15px;
border-top-right-radius: 15px;
-moz-border-radius-topleft: 15px;
-moz-border-radius-topright: 15px;
}
}*/
#footer {
border-bottom-left-radius: 15px;
......@@ -110,7 +111,7 @@ a:hover {
background: #fff0cd;
padding: 0;
clear: both;
border: 2px solid #e76808;
/*border: 2px solid #e76808;*/
border-top: 0;
border-bottom: 0;
}
......@@ -264,6 +265,7 @@ ul#valid {
margin: 0;
margin-bottom: 0.5em;
background: url('/images/orangefade-bottom.png') top repeat-x #ffc62b;
visibility: hidden;
}
#footer p {
......