From 9bfa80efbc72c4632e299df9d2b010178322b8b0 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 12:19:40 -0500 Subject: [PATCH 1/7] separate config --- .gitignore | 4 ++-- accounts/index.php | 2 +- comments/index.php | 2 +- {library => config}/connections-backup.php | 0 form/index.php | 2 +- index.php | 2 +- readme.md | 2 +- users/index.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) rename {library => config}/connections-backup.php (100%) diff --git a/.gitignore b/.gitignore index b095899..bca07fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -library/connections.php +config/connections.php .DS_Store vendor mail/mailConfig.php library/mailFunctions.php -library/connections-*.php +config/connections-*.php diff --git a/accounts/index.php b/accounts/index.php index f4dde68..7ed77d4 100644 --- a/accounts/index.php +++ b/accounts/index.php @@ -11,7 +11,7 @@ } $GLOBALS['root'] = "../"; // Get the database connection file -require_once '../library/connections.php'; +require_once '../config/connections.php'; require_once '../library/functions.php'; // Get the acme model for use as needed require_once '../model/accounts-model.php'; diff --git a/comments/index.php b/comments/index.php index a64b6df..40151ff 100644 --- a/comments/index.php +++ b/comments/index.php @@ -5,7 +5,7 @@ } $GLOBALS['root'] = "../"; // Get the database connection file -require_once '../library/connections.php'; +require_once '../config/connections.php'; require_once '../library/functions.php'; require_once '../model/reviews-model.php'; require_once '../model/accounts-model.php'; diff --git a/library/connections-backup.php b/config/connections-backup.php similarity index 100% rename from library/connections-backup.php rename to config/connections-backup.php diff --git a/form/index.php b/form/index.php index 6cb4e64..c0e0d4f 100644 --- a/form/index.php +++ b/form/index.php @@ -6,7 +6,7 @@ } $GLOBALS['root'] = "../"; // Get the database connection file -require_once '../library/connections.php'; +require_once '../config/connections.php'; require_once '../library/functions.php'; require_once '../model/form-model.php'; require_once '../library/error_responses.php'; diff --git a/index.php b/index.php index 65c6ad1..4a35426 100644 --- a/index.php +++ b/index.php @@ -10,7 +10,7 @@ } $GLOBALS['root'] = ""; // Get the database connection file -require_once 'library/connections.php'; +require_once 'config/connections.php'; require_once 'library/functions.php'; // Build a navigation bar using the $categories array diff --git a/readme.md b/readme.md index 5f8d237..3aeb69b 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,7 @@ * run `sql/acme-db.sql` CAREFUL TO NOT RESET EXISTING DATA against chosen mysql db * may want to change the admin user w/ your email * copy all most files excluding `assets,rest,mail` folders -* copy `cp ./library/connections-backup.php ./library/connections.php` +* copy `cp ./config/connections-backup.php ./config/connections.php` * fill out database settings, mail provider, jwt secret * test working mail form server in `mail` folder * copy `mailConfig-back.php mailConfig.php` diff --git a/users/index.php b/users/index.php index d79c6ef..e6cdeb3 100644 --- a/users/index.php +++ b/users/index.php @@ -5,7 +5,7 @@ } $GLOBALS['root'] = "../"; // Get the database connection file -require_once '../library/connections.php'; +require_once '../config/connections.php'; require_once '../library/functions.php'; // require_once '../library/jwt/ValidatesJWT.php'; From 705347742f565338b70494a168b2f7ae60b11908 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 12:24:06 -0500 Subject: [PATCH 2/7] finished config movfe --- config/connections-backup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/connections-backup.php b/config/connections-backup.php index b0f44cf..76c937a 100644 --- a/config/connections-backup.php +++ b/config/connections-backup.php @@ -5,7 +5,7 @@ // change document root if serving from somewhere else such as / // copy this file to connections.php w/ proper info $GLOBALS['documentRoot'] = '/'; -require_once 'Core.php'; +require_once $GLOBALS['root'] .'library/Core.php'; // require '../vendor/autoload.php'; define('Allowed_Origins','*'); From 7b3ba160b043df2acd01227e0959f1537bd9ff94 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 13:20:51 -0500 Subject: [PATCH 3/7] ignore sso for now --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bca07fb..7776f4d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ vendor mail/mailConfig.php library/mailFunctions.php config/connections-*.php +library/sso \ No newline at end of file From ec258bd62b3683b2f32bda0ce48ed4f16c0f76e2 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 13:24:51 -0500 Subject: [PATCH 4/7] fix account form model --- accounts/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/accounts/index.php b/accounts/index.php index 7ed77d4..2473d35 100644 --- a/accounts/index.php +++ b/accounts/index.php @@ -14,6 +14,7 @@ require_once '../config/connections.php'; require_once '../library/functions.php'; // Get the acme model for use as needed +require_once '../model/form-model.php'; require_once '../model/accounts-model.php'; require_once '../model/pages-model.php'; require_once '../model/reviews-model.php'; From 9115b494449547739aac0a24a14d301d267b09f6 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 14:02:02 -0500 Subject: [PATCH 5/7] contact form --- examples/js/vue.js | 6 +++-- examples/vue.html | 55 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/examples/js/vue.js b/examples/js/vue.js index 0ff6d37..ce3037a 100644 --- a/examples/js/vue.js +++ b/examples/js/vue.js @@ -24,10 +24,12 @@ var app = new Vue({ pageSlug: "test", newComment: {}, comments: [], - loading: false, + example: "comments", + form: {}, loading: { general: false, - comments: false + comments: false, + form: false }, userForm: {}, modal: { diff --git a/examples/vue.html b/examples/vue.html index a0b2b74..88f23fb 100644 --- a/examples/vue.html +++ b/examples/vue.html @@ -35,20 +35,45 @@

Comment Press Vue Example

{{ errors }}
-
Use Social Network
- +
+ From 91c5ade9102ec68da9355b97e81139c4d5860c6f Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 14:09:10 -0500 Subject: [PATCH 6/7] submit form example --- examples/js/vue.js | 29 +++++++++++++++++++++++++++++ examples/vue.html | 11 ++++++++++- form/index.php | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/examples/js/vue.js b/examples/js/vue.js index ce3037a..2f5c637 100644 --- a/examples/js/vue.js +++ b/examples/js/vue.js @@ -25,6 +25,7 @@ var app = new Vue({ newComment: {}, comments: [], example: "comments", + status: null, form: {}, loading: { general: false, @@ -52,6 +53,34 @@ var app = new Vue({ logout() { this.userData = null this.isGuest = false + }, + submitMessage() { + if (this.loading.form) { + return; + } + this.errors = null; + this.status = null; + let request = JSON.parse(JSON.stringify(this.form)); + this.loading.form = true; + this.$http.post("/form/?action=submit", request).then((response) => { + this.loading.form = false; + console.log(response) + // this.message = response.data.message; + if (response.status == 201) { + this.form = {}; + console.log(response.data); + this.status = "Message Sent" + } else { + this.errors = "Failed to submit message" + } + }).catch((error) => { + this.errors = error.data + console.log(error) + this.loading.form = null; + + }); + + }, addComment() { // don't run if not logged in or loading diff --git a/examples/vue.html b/examples/vue.html index 88f23fb..e6d58f9 100644 --- a/examples/vue.html +++ b/examples/vue.html @@ -35,8 +35,17 @@

Comment Press Vue Example

{{ errors }}
+
+ {{ status }} +

Contact Form Example

+ @@ -49,7 +58,7 @@

Contact Form Example



-
diff --git a/form/index.php b/form/index.php index c0e0d4f..215685a 100644 --- a/form/index.php +++ b/form/index.php @@ -34,7 +34,7 @@ $checkEmail = checkEmail($email); if (empty($checkEmail)) { - $errorStatus->response(400, "Please provide valid email" . $email); + $errorStatus->response(400, "Please provide valid email:" . $email); } if (empty($email) || empty($body) || empty($subject)) { From a4b86421b08e82e2e3724bca9de3bf92c8ed8e54 Mon Sep 17 00:00:00 2001 From: lastlink Date: Sat, 6 Mar 2021 14:09:27 -0500 Subject: [PATCH 7/7] v 7 --- library/Core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Core.php b/library/Core.php index 1348ed9..c6df484 100644 --- a/library/Core.php +++ b/library/Core.php @@ -1,6 +1,6 @@