Browse Source

Provides an interface to an email connector.

Define a url for an email connector that will connect to an email list.
The url can be a server:port, program, etc.
Name (First, Last) email address, and connector password will be sent to the connector.

The purpose of email connectors is to provide autonomy in the choice
of email services and programs.  E.g. mailman, googlegroups
See ./examples for an example connector
devel
Jonathan Rosenbaum 10 years ago
parent
commit
e51d5a1c89
  1. 56
      Connections/database_functions.php
  2. 4
      Connections/waiver.txt
  3. 4
      contact_add_edit.php
  4. 29
      examples/cert.pem
  5. 11
      js/contact.js
  6. 29
      json/contact.php

56
Connections/database_functions.php

@ -1,6 +1,27 @@
<?php
require_once('YBDB.php');
/*
Choose your timezone from http://php.net/manual/en/timezones.php
Eastern ........... America/New_York
Central ........... America/Chicago
Mountain .......... America/Denver
Mountain no DST ... America/Phoenix
Pacific ........... America/Los_Angeles
Alaska ............ America/Anchorage
Hawaii ............ America/Adak
Hawaii no DST ..... Pacific/Honolulu
*/
define("TIMEZONE", "America/New_York");
/*******
CONTACTS
********/
// Allow waiver (recommended) in Add/Edit Contacts; 1 = yes, 0 = no
// Waiver text may be modified in Connections/waiver.txt
define("WAIVER", 1);
@ -8,13 +29,32 @@ define("WAIVER", 1);
// Allow email_list option in Add/Edit Contacts; 1 = yes, 0 = no
define("EMAIL_LIST", 1);
// Define a url for an email connector that will connect to an email list.
// The url can be a server:port, program, etc.
// Name (First, Last) email address, and connector password will be sent to the connector.
//
// The purpose of email connectors is to provide autonomy in the choice
// of email services and programs. E.g. mailman, googlegroups
// See ./examples for an example connector
define("EMAIL_LIST_CONNECTOR","https://wvcompletestreets.org:9987");
// Define the password that is unique to the connector.
define("EMAIL_LIST_CONNECTOR_PASSWORD","bikebike");
// If a self-signed ssl certificate that is associated with the email connector is being provided,
// designate an absolute path, if not, change to false.
define("SSL_CERTIFICATE", "/var/www/html/examples/cert.pem");
/***********
TRANSACTIONS
************/
// User defined constants - read sql/populate.sql for an explanation
define("STORAGE_PERIOD", 14);
define("ACCOUNTING_GROUP", "Sales");
define("DEFAULT_TRANSACTION_TYPE", "Sale - Used Parts");
define("DEFAULT_SHOP_USER", "Volunteer");
/* Change Fund - A specific amount of money for the purpose of making change.
The amount on hand should remain the same at all times;
therefore a change funds does not require replenishment.
@ -26,20 +66,6 @@ define("CHANGE_FUND", 20);
// shop will be current shop for the 24hr day yyyy-mm-dd (currently no check for hrs, only date)
define("SHOP_HOURS_LENGTH", 10);
/*
Choose your timezone from http://php.net/manual/en/timezones.php
Eastern ........... America/New_York
Central ........... America/Chicago
Mountain .......... America/Denver
Mountain no DST ... America/Phoenix
Pacific ........... America/Los_Angeles
Alaska ............ America/Anchorage
Hawaii ............ America/Adak
Hawaii no DST ..... Pacific/Honolulu
*/
define("TIMEZONE", "America/New_York");
/* If you elect to keep records for non-shop hours, decide which shop should be used for that purpose.
The first shop created, 1, makes sense. A link will show in start_shop.php.

4
Connections/waiver.txt

@ -1,6 +1,6 @@
I, and my heirs, in consideration of my participation in the Positive Spin Community
Bike Project's Open Workshop hereby release Positive Spin,
its officers, employees and agents, and any other people officially connected with this
its officers, directors and agents, and any other people officially connected with this
organization, from any and all liability for damage to or loss of personal
property, sickness, or injury from whatever source, legal entanglements, imprisonment,
death, or loss of money, which might occur while participating in said event/activity/class.
@ -13,4 +13,4 @@
activity and exertion, as is sometimes the case when working in a mechanical environment.
I understand that participation in this program is strickly voluntary and I
freely chose to participate. I understand Positive Spin does not provide medical coverage for me.
I verify that I will be responsible for any medical costs I incur as a result of my participation.
I verify that I will be responsible for any medical costs I incur as a result of my participation.

4
contact_add_edit.php

@ -6,7 +6,6 @@ require_once('Connections/database_functions.php');
$waiver = WAIVER;
$email_list = EMAIL_LIST;
if($_GET['shop_id']>0){
$shop_id = $_GET['shop_id'];
} else {
@ -210,7 +209,8 @@ $totalRows_Recordset1 = mysql_num_rows($Recordset1);
<?php } ?>
<tr>
<td></td>
<td><br /><input id="submit_contact" type="submit" value="Submit"></td>
<td><br />
<input id="submit_contact" type="submit" value="Submit"></td>
</tr>
</table>

29
examples/cert.pem

@ -0,0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TCB2oAUInR5tk/rYlen8upg946/tgGG4N6hgbakgbMwgbAxCzAJBgNV
BAYTAlVTMQswCQYDVQQIEwJXVjETMBEGA1UEBxMKTW9yZ2FudG93bjEeMBwGA1UE
ChMVRnJlZSBTb2Z0d2FyZSBQQywgTExDMR4wHAYDVQQLExV3dmNvbXBsZXRlc3Ry
ZWV0cy5vcmcxHjAcBgNVBAMTFXd2Y29tcGxldGVzdHJlZXRzLm9yZzEfMB0GCSqG
SIb3DQEJARYQZ251c2VyQGdtYWlsLmNvbYIJAP6Z46+0uNaRMAwGA1UdEwQFMAMB
Af8wDQYJKoZIhvcNAQEFBQADggEBAGa/KR/RjYSFiZNOeckjMr+rWtYPaGYFdXGS
SciRBTZUqHYBfeHJ7vvDdodgjx02lZZFiE3Mg94dNyjPgwvMRlPGsIsmfDvyJbkC
aOCWXUNhbeS8GM+/deI6KxpfsWwGOQ/JYjlKBtTivGKg2GD7dP/c3FdxXR/kGX6C
1un/8udfhkx+xfngVPCsMTcYbfwW54K6m8DyykJiEjAVZMg4M8CvwDxd4vIBDfFb
soCSzGGZvQWkwier2o+uPcBgiQlOQjI7Lj4r3h9Od1gfBfS6GW7GVeU5L+Q/SFUd
Q2yPGyDiqiTE3Ym0rue8wvAWdlnpkvN9YyodaD3UAH1s8835i94=
-----END CERTIFICATE-----

11
js/contact.js

@ -89,7 +89,7 @@ $(function(){
if ((err0 + err1 + err2 + err3 + err4 + err5) > 0 ) {
} else {
//e.preventDefault();
e.preventDefault();
dfd.resolve("Success");
}
@ -116,7 +116,14 @@ $(function(){
} else if (waiver === false) {
waiver = 0;
}
$.post("json/contact.php", {contact_id: contact_id, email_list: email_list , waiver: waiver });
// update receive_newsletter and waiver in the database
$.post("json/contact.php", {contact_id: contact_id, email_list: email_list, waiver: waiver });
// email subscribe
if (email_list == 1) {
$.post("json/contact.php", {email_list_connector: 1, email: email.val(),
first_name: first_name.val(), last_name: last_name.val()});
}
}

29
json/contact.php

@ -3,6 +3,9 @@
require_once('../Connections/database_functions.php');
require_once('../Connections/YBDB.php');
mysql_select_db($database_YBDB, $YBDB);
$email_list_connector = EMAIL_LIST_CONNECTOR;
$email_list_connector_password = EMAIL_LIST_CONNECTOR_PASSWORD;
$ssl_certificate = SSL_CERTIFICATE;
// update waiver
if( isset($_POST['waiver']) ) {
@ -45,5 +48,31 @@ mysql_select_db($database_YBDB, $YBDB);
}
// send data to connector (local or remote)
if (isset($_POST['email_list_connector'])) {
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => $email_list_connector . '/api/parsetime',
CURLOPT_POST => true,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => array(
'password' => $email_list_connector_password,
),
);
if ($ssl_certificate) {
$curlConfig[CURLOPT_CAINFO] = $ssl_certificate;
}
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
?>
Loading…
Cancel
Save