From a297fa5b5098117b5c85f567743311fad238c569 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Mon, 3 Oct 2016 16:31:19 +0100 Subject: [PATCH 01/13] fix suapi --- lib/suapiv2.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/suapiv2.php b/lib/suapiv2.php index 4bf5db8..b11c5fb 100644 --- a/lib/suapiv2.php +++ b/lib/suapiv2.php @@ -31,8 +31,10 @@ $membership_data = $formated_raw_data["table1"]["table1_Product_Collection"]["ta // make a new array that just contains *every* member no matter what they bought $just_members = array(); -foreach ($membership_data["Detail_Collection"]["Detail"] as $member) { - array_push($just_members, $member["@attributes"]); +foreach ($membership_data as $typeOfMember) { + foreach ($typeOfMember["Detail_Collection"]["Detail"] as $member) { + array_push($just_members, $member["@attributes"]); + } } /* You can now use $just_members to probe member detials. It's an array of arrays which each contain: -- GitLab From 2d1b2e2b19ac22722e979fad30b52b8fc48e6054 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Mon, 3 Oct 2016 19:50:27 +0100 Subject: [PATCH 02/13] Write a function to work around broken msl shit --- lib/suapiv2.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/suapiv2.php b/lib/suapiv2.php index b11c5fb..ea04bfb 100644 --- a/lib/suapiv2.php +++ b/lib/suapiv2.php @@ -31,12 +31,29 @@ $membership_data = $formated_raw_data["table1"]["table1_Product_Collection"]["ta // make a new array that just contains *every* member no matter what they bought $just_members = array(); -foreach ($membership_data as $typeOfMember) { - foreach ($typeOfMember["Detail_Collection"]["Detail"] as $member) { - array_push($just_members, $member["@attributes"]); + +function filter_array($data){ + global $just_members; + // we have more than one type of member if this is true + if (count($data[0]["Detail_Collection"]["Detail"][0]["@attributes"]) == 7){ + //split them up then feed them back + foreach ($data as $membershipType){ + filter_array($membershipType); + } + // we have more then 1 of the same type of member if this is true + } else if (count($data["Detail_Collection"]["Detail"][0]["@attributes"]) == 7) { + //wack them onto the used array + foreach ($data["Detail_Collection"]["Detail"] as $member) { + array_push($just_members, $member["@attributes"]); + } + // we have 1 member :( + } else if (count($data["Detail_Collection"]["Detail"]["@attributes"]) == 7) { + array_push($just_members, $data["Detail_Collection"]["Detail"]["@attributes"]); } } +filter_array($membership_data); + /* You can now use $just_members to probe member detials. It's an array of arrays which each contain: * transaction_id (recepit id) * purchaser (full name) -- GitLab From 8bf3ac4bb5dc23df2ba154e3ab29bdc189b53e15 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Thu, 13 Oct 2016 10:47:11 +0100 Subject: [PATCH 03/13] Fix old student members coming back with the same student id after thier account has been deleted and they paid via the su --- components/susignup.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/susignup.php b/components/susignup.php index 4d7d4b8..6566f26 100755 --- a/components/susignup.php +++ b/components/susignup.php @@ -40,19 +40,18 @@ 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 they aren't in the SUCS DB, then bootstrap signup process } else if ($tmpresult->fields == false && $signuptmpresult->fields == false) { $mode = "form"; $pass = make_password(); -- GitLab From ff57595761944ee38896b3cbabf57348c107a447 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Thu, 13 Oct 2016 10:50:04 +0100 Subject: [PATCH 04/13] It's not my morning... --- components/susignup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/susignup.php b/components/susignup.php index 6566f26..1e3393a 100755 --- a/components/susignup.php +++ b/components/susignup.php @@ -47,7 +47,7 @@ if (!empty($_REQUEST['sid']) && !empty($_REQUEST['transactionID'])) { // 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 - } else if ($tmpresult->fields == false && $signuptmpresult->fields["sid"] == $sid && $signuptmpresult->fields["activated"] != NULL) { + } 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"]); -- GitLab From 7eee2a8fb9959649af1e892975cfc85165889fcc Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Thu, 13 Oct 2016 14:13:53 +0100 Subject: [PATCH 05/13] Don't need to check if they aren't in the singup table if we know they aren't in the members table --- components/susignup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/susignup.php b/components/susignup.php index 1e3393a..f33cdb4 100755 --- a/components/susignup.php +++ b/components/susignup.php @@ -52,7 +52,7 @@ if (!empty($_REQUEST['sid']) && !empty($_REQUEST['transactionID'])) { $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) { + } 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")); -- GitLab From e9f4c2f21cff702c13197425c2fa6fd03b6a6c7d Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:35:30 +0100 Subject: [PATCH 06/13] Switch to using debian jessie docker image --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index df19a98..ae16b4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ # specify what docker image # go with the default image for now and mangle it -#image: ruby:2.1 +image: debian:jessie stages: - test -- GitLab From f02fdd0a8d6a41424434c2c5158d3bc6d5c97b1d Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:37:47 +0100 Subject: [PATCH 07/13] That didn't work so lets go back to using the default ruby image and test php against php7 --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae16b4e..e58fac6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ # specify what docker image # go with the default image for now and mangle it -image: debian:jessie +#image: debian:jessie stages: - test @@ -14,7 +14,7 @@ php-syntax-check: script: - apt-get clean - apt-get update - - apt-get install -y php5-cli + - 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 -- GitLab From 264f2e520176db5022de9722769c5b56c9ee7afe Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:43:38 +0100 Subject: [PATCH 08/13] npm is part of nodejs --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e58fac6..7b8777d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ js-syntax-check: script: - apt-get clean - apt-get update - - apt-get install -y npm + - apt-get install -y nodejs - ln -s /usr/bin/nodejs /usr/bin/node - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab From c37b71d17a2bcf5f59d0afac8dcd6abdf9e2b217 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:46:42 +0100 Subject: [PATCH 09/13] install nodejs from the main site, debian stable packages are screweed up --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b8777d..1436ce9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,8 +25,9 @@ js-syntax-check: script: - apt-get clean - apt-get update - - apt-get install -y nodejs - - ln -s /usr/bin/nodejs /usr/bin/node +# - apt-get install -y nodejs +# - ln -s /usr/bin/nodejs /usr/bin/node + - curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab From 5f3d26d1f9ea7dfe19754841ac81cf89d54c2ea5 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:48:51 +0100 Subject: [PATCH 10/13] need curl, doh! --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1436ce9..e92303c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,8 @@ js-syntax-check: - apt-get update # - apt-get install -y nodejs # - ln -s /usr/bin/nodejs /usr/bin/node - - curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - + - apt-get install curl + - curl -sL https://deb.nodesource.com/setup_8.x | bash - - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab From 270d22086010a0b166604a3946278f3ea6333f43 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:50:36 +0100 Subject: [PATCH 11/13] forgot a -y --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e92303c..d79bcbd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ js-syntax-check: - apt-get update # - apt-get install -y nodejs # - ln -s /usr/bin/nodejs /usr/bin/node - - apt-get install curl + - apt-get install -y curl - curl -sL https://deb.nodesource.com/setup_8.x | bash - - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab From cfc7787611156358604ae613331a89a82d8a3f8f Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:53:31 +0100 Subject: [PATCH 12/13] nodejs install that is supposed to install deps doesn't actually do so, install gnupg manually --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d79bcbd..7d0a717 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ js-syntax-check: - apt-get update # - apt-get install -y nodejs # - ln -s /usr/bin/nodejs /usr/bin/node - - apt-get install -y curl + - apt-get install -y curl gnupg - curl -sL https://deb.nodesource.com/setup_8.x | bash - - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab From 43ea7d60369d9dec7112abbca50a9ae4475f9199 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Fri, 30 Jun 2017 12:59:07 +0100 Subject: [PATCH 13/13] the script to install nodejs DOESN'T INSTALL NODEJS! --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d0a717..0dbc258 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,7 @@ js-syntax-check: # - ln -s /usr/bin/nodejs /usr/bin/node - apt-get install -y curl gnupg - curl -sL https://deb.nodesource.com/setup_8.x | bash - + - apt-get install -y nodejs - npm install -g jshint - find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose -- GitLab