|
From: <chr...@us...> - 2019-04-28 16:27:50
|
Revision: 13400
http://sourceforge.net/p/xoops/svn/13400
Author: chronolabscoop
Date: 2019-04-28 16:27:43 +0000 (Sun, 28 Apr 2019)
Log Message:
-----------
Email API PHP version 1.1.11!
Modified Paths:
--------------
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/.htaccess
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/README.md
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/help.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/functions.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/version.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Precise (12.04)/smtp.html
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Trusty (14.04)/smtp.html
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/json.getconfig.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.mail_users.sql
Added Paths:
-----------
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/.~lock.csv-prop-spreedsheet.ods#
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/class/csv.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/generate-aliases-keys.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/new-alias-service.html
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/license.php
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.groups.sql
*.xoops.org (Subdomain APIs & Sites)/email.xoops.org/uploading.php
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/.htaccess
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/.htaccess 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/.htaccess 2019-04-28 16:27:43 UTC (rev 13400)
@@ -12,6 +12,7 @@
RewriteRule ^v([0-9]{1,2})/callback.api ./callback.php?version=$1&mode=callback [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-zA-Z])/callback.api ./callback.php?version=$1&mode=$2 [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-zA-Z])/([0-9a-z]{32})/callback.api ./callback.php?version=$1&mode=$2&key=$3 [L,NC,QSA]
+RewriteRule ^v([0-9]{1,2})/([0-9a-z]{32})/uploading.api ./uploading.php?version=$1&authkey=$2 [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/authkey.api ./index.php?version=$1&mode=authkey [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/pgpkey.api ./index.php?version=$1&mode=pgpkey [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-z]{32})/([0-9a-z])/activation.html ./activation.php?version=$1&mode=activation&emailkey=$2&actkey=$3 [L,NC,QSA]
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/README.md
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/README.md 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/README.md 2019-04-28 16:27:43 UTC (rev 13400)
@@ -2,9 +2,9 @@
# Emails/Aliases Account's Propogation REST API Services
-## Version: 1.0.7 (stable)
+## Version: 1.1.11 (stable)
-### Author: Dr. Simon Antony Roberts <si...@or...>
+### Author: Dr. Simon Antony Roberts <wis...@us...>
#### Demo: http://emails.snails.email
@@ -34,6 +34,7 @@
RewriteRule ^v([0-9]{1,2})/callback.api ./callback.php?version=$1&mode=callback [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-zA-Z])/callback.api ./callback.php?version=$1&mode=$2 [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-zA-Z])/([0-9a-z]{32})/callback.api ./callback.php?version=$1&mode=$2&key=$3 [L,NC,QSA]
+ RewriteRule ^v([0-9]{1,2})/([0-9a-z]{32})/uploading.api ./uploading.php?version=$1&authkey=$2 [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/authkey.api ./index.php?version=$1&mode=authkey [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/pgpkey.api ./index.php?version=$1&mode=pgpkey [L,NC,QSA]
RewriteRule ^v([0-9]{1,2})/([0-9a-z]{32})/([0-9a-z])/activation.html ./activation.php?version=$1&mode=activation&emailkey=$2&actkey=$3 [L,NC,QSA]
@@ -61,6 +62,7 @@
*/11 */7 * * * /usr/bin/php /var/www/emails.snails.email/crons/peer-services.php
*/11 */7 * * * /usr/bin/php /var/www/emails.snails.email/crons/get-spam-training.php
*/5 * * * * sh /var/www/emails.snails.email/crons/*.sh
+ */23 * * * * /usr/bin/php /var/www/emails.snails.email/crons/generate-alias-keys.php
## Licensing
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/.~lock.csv-prop-spreedsheet.ods#
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/.~lock.csv-prop-spreedsheet.ods# (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/.~lock.csv-prop-spreedsheet.ods# 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1 @@
+,antiquith,asquith,26.01.2019 02:31,file:///home/antiquith/.config/libreoffice/4;
\ No newline at end of file
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/.~lock.csv-prop-spreedsheet.ods#
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods
===================================================================
(Binary files differ)
Index: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods 2019-04-28 16:27:43 UTC (rev 13400)
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.ods
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx
===================================================================
(Binary files differ)
Index: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx 2019-04-28 16:27:43 UTC (rev 13400)
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/assets/docs/csv-prop-spreedsheet.xlsx
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/class/csv.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/class/csv.php (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/class/csv.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,93 @@
+<?php
+/**
+ * DNS Zone Propogation REST Services API
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original comment or credit authors.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @copyright Chronolabs Cooperative http://syd.au.snails.email
+ * @license ACADEMIC APL 2 (https://sourceforge.net/u/chronolabscoop/wiki/Academic%20Public%20License%2C%20version%202.0/)
+ * @license GNU GPL 3 (http://www.gnu.org/licenses/gpl.html)
+ * @package emails-api
+ * @since 1.0.3
+ * @author Dr. Simon Antony Roberts <si...@sn...>
+ * @version 1.0.3
+ * @description A REST API for the creation and management of emails/forwarders and domain name parks for email
+ * @link http://internetfounder.wordpress.com
+ * @link https://github.com/Chronolabs-Cooperative/Emails-API-PHP
+ * @link https://sourceforge.net/p/chronolabs-cooperative
+ * @link https://facebook.com/ChronolabsCoop
+ * @link https://twitter.com/ChronolabsCoop
+ *
+ */
+
+class CSV
+{
+ private $fp;
+ private $parse_header;
+ private $header;
+ private $delimiter;
+ private $length;
+
+ function __construct($file_name, $parse_header=false, $delimiter="\t", $length=8000)
+ {
+ $this->fp = fopen($file_name, "r");
+ $this->parse_header = $parse_header;
+ $this->delimiter = $delimiter;
+ $this->length = $length;
+ $this->lines = $lines;
+
+ if ($this->parse_header)
+ {
+ $this->header = fgetcsv($this->fp, $this->length, $this->delimiter);
+ }
+
+ }
+ //--------------------------------------------------------------------
+ function __destruct()
+ {
+ if ($this->fp)
+ {
+ fclose($this->fp);
+ }
+ }
+ //--------------------------------------------------------------------
+ function get($max_lines=0)
+ {
+ //if $max_lines is set to 0, then get all the data
+
+ $data = array();
+
+ if ($max_lines > 0)
+ $line_count = 0;
+ else
+ $line_count = -1; // so loop limit is ignored
+
+ while ($line_count < $max_lines && ($row = fgetcsv($this->fp, $this->length, $this->delimiter)) !== FALSE)
+ {
+ if ($this->parse_header)
+ {
+ foreach ($this->header as $i => $heading_i)
+ {
+ $row_new[$heading_i] = $row[$i];
+ }
+ $data[] = $row_new;
+ }
+ else
+ {
+ $data[] = $row;
+ }
+
+ if ($max_lines > 0)
+ $line_count++;
+ }
+ return $data;
+ }
+ //--------------------------------------------------------------------
+
+}
+?>
\ No newline at end of file
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/class/csv.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/generate-aliases-keys.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/generate-aliases-keys.php (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/generate-aliases-keys.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,173 @@
+<?php
+/**
+ * Email Account Propogation REST Services API
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original comment or credit authors.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @copyright Chronolabs Cooperative http://syd.au.snails.email
+ * @license ACADEMIC APL 2 (https://sourceforge.net/u/chronolabscoop/wiki/Academic%20Public%20License%2C%20version%202.0/)
+ * @license GNU GPL 3 (http://www.gnu.org/licenses/gpl.html)
+ * @package emails-api
+ * @since 1.1.11
+ * @author Dr. Simon Antony Roberts <si...@sn...>
+ * @version 1.1.11
+ * @description A REST API for the creation and management of emails/forwarders and domain name parks for email
+ * @link http://internetfounder.wordpress.com
+ * @link https://github.com/Chronolabs-Cooperative/Emails-API-PHP
+ * @link https://sourceforge.net/p/chronolabs-cooperative
+ * @link https://facebook.com/ChronolabsCoop
+ * @link https://twitter.com/ChronolabsCoop
+ *
+ */
+
+require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'apiconfig.php';
+require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'apimailer.php';
+
+$start = time();
+if ($staters = APICache::read('generate-aliases-keys'))
+{
+ $staters[] = $start;
+ sort($staters, SORT_ASC);
+ if (count($starters)>50)
+ unset($starters[0]);
+ sort($staters, SORT_ASC);
+ APICache::write('generate-aliases-keys', $staters, 3600 * 24 * 7 * 4 * 6);
+ $keys = array_key($starters);
+ $avg = array();
+ foreach($starters as $key => $starting) {
+ if (isset($keys[$key - 1])) {
+ $avg[] = abs($starting - $starters[$keys[$key - 1]]);
+ }
+ }
+ if (count($avg) > 0 ) {
+ foreach($avg as $average)
+ $seconds += $average;
+ $seconds = $seconds / count($avg);
+ } else
+ $seconds = 1800;
+} else {
+ APICache::write('generate-aliases-keys', array(0=>$start), 3600 * 24 * 7 * 4 * 6);
+ $seconds = 1800;
+}
+
+
+$result = $GLOBALS['APIDB']->queryF("SELECT DISTINCT `email_full` FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE `kid` = 0 ");
+$emails = $keyedemails = array();
+while($addy = $GLOBALS['APIDB']->fetchArray($result))
+ $emails[$addy['email_full']] = $addy['email_full'];
+
+$result = $GLOBALS['APIDB']->queryF($sql = "SELECT `email`, `kid` as `key` FROM `" . $GLOBALS['APIDB']->prefix('pgpkeys') . "` WHERE `email` IN ('" . implode("', '", $emails) . "')");
+while($addy = $GLOBALS['APIDB']->fetchArray($result))
+ foreach($emails as $key => $email)
+ if ($email == $addy['email']) {
+ $keyedemails[$key][$addy['key']] = $emails[$key];
+ unset($emails[$key]);
+ }
+
+echo "PGP Key Unassigned Addresses: " . print_r($emails, true) . "\n\n";
+foreach($emails as $key => $email) {
+ $domainid = 0;
+ $domainkey = '';
+ $parts = explode("@", $email);
+ $domain = $parts[1];
+ $domainpath = implode(DS, array_reverse(explode('.', $domain)));
+ $result = $GLOBALS['APIDB']->queryF("SELECT `domain`, `id`, md5(concat(`id`, '" . API_URL . "', 'domain')) as `key` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "`");
+ while($record = $GLOBALS['APIDB']->fetchArray($result)) {
+ if (empty($domainid) && empty($domainkey) && $record['domain'] == $domain)
+ {
+ $domainid = $record['id'];
+ $domainkey = $record['key'];
+ continue;
+ }
+ }
+ if (!is_dir(API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys'))
+ mkdir(API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys', 0777, true);
+
+ if (!file_exists(API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . "$email.diz") && !file_exists(API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . $email . ".asc")) {
+ writeRawFile($diz = API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . "$email.diz", str_replace('%name', $email, str_replace('%email', "$email", str_replace('%subbits', mt_rand(API_MINBITS_PGP_KEYS, API_MAXBITS_PGP_KEYS), str_replace('%bits', mt_rand(API_MINBITS_PGP_KEYS, API_MAXBITS_PGP_KEYS), file_get_contents(dirname(__DIR__) . DS . 'include' . DS . 'data' . DS . 'gen-key-script.diz'))))));
+ shell_exec($exe = "gpg --batch --gen-key \"$diz\"");
+ echo "Executed: $exe\n";
+ shell_exec($exe = "unlink \"$diz\"");
+ echo "Executed: $exe\n";
+ shell_exec($exe = "gpg --armor --export $email > \"" . API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . $email . ".asc\"");
+ echo "Executed: $exe\n";
+ foreach(file(dirname(__DIR__) . DS . 'include' . DS . 'data' . DS . 'keyservers-hostnames.diz') as $keyserver)
+ shell_exec($exe = "gpg --keyserver " . str_replace(array("\n", "\r", "\t"), "", trim($keyserver)) . " --send-key $email");
+ echo "Executed: $exe\n";
+ } elseif (file_exists($keyfile = API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . $email . ".asc")) {
+ $ctime = filectime($keyfile);
+ $sql = "INSERT INTO `" . $GLOBALS['APIDB']->prefix('pgpkeys') . "` (`typal`, `domainid`, `name`, `email`, `key`, `created`, `imported`) VALUES('internal', '$domainid', '" . $GLOBALS['APIDB']->escape($email) . "', '$email', '". $GLOBALS['APIDB']->escape($pgpkey = file_get_contents($keyfile)) . "', UNIX_TIMESTAMP(), '$ctime')";
+ if ($GLOBALS['APIDB']->queryF($sql))
+ echo "PGP Key Insert: " . $email . "\n\n";
+ }
+}
+
+$result = $GLOBALS['APIDB']->queryF("SELECT `email`, `kid` as `key` FROM `" . $GLOBALS['APIDB']->prefix('pgpkeys') . "` WHERE `email` IN ('" . implode("', '", $emails) . "')");
+while($addy = $GLOBALS['APIDB']->fetchArray($result))
+ foreach($emails as $key => $email)
+ if ($email == $addy['email']) {
+ $keyedemails[$key][$addy['key']] = $emails[$key];
+ unset($emails[$key]);
+ }
+
+echo "PGP Key Assigned Addresses: " . print_r($keyedemails) . "\n\n";
+foreach($keyedemails as $key => $kids)
+ foreach($kids as $kid => $email)
+ {
+ $domainid = 0;
+ $domainkey = '';
+ $parts = explode("@", $email);
+ $domain = $parts[1];
+ $domainpath = implode(DS, array_reverse(explode('.', $domain)));
+ $result = $GLOBALS['APIDB']->queryF("SELECT `domain`, `id`, md5(concat(`id`, '" . API_URL . "', 'domain')) as `key` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "`");
+ while($record = $GLOBALS['APIDB']->fetchArray($result)) {
+ if (empty($domainid) && empty($domainkey) && $record['domain'] == $domain)
+ {
+ $domainid = $record['id'];
+ $domainkey = $record['key'];
+ continue;
+ }
+ }
+ $keyfile = API_MAILDIR_PATH . DS . $domainpath . DS . '.pgp-keys' . DS . "$email.asc";
+ if (file_exists($keyfile)) {
+ list($numalias) = $GLOBALS['APIDB']->fetchRow($GLOBALS['APIDB']->queryF("SELECT COUNT(*) FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE `email_full` LIKE '$email'"));
+ $result = $GLOBALS['APIDB']->queryF("SELECT `id`, `callback`, `destination` FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE `kid` = 0 AND `emailed` = 0 AND `email_full` LIKE '$email' ORDER BY RAND() LIMIT 7");
+ while($alias = $GLOBALS['APIDB']->fetchArray($result))
+ {
+ $sql = "SELECT md5(concat(`id`, '" . API_URL . "', 'alias')) FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE `id` = '".$GLOBALS['APIDB']->getInsertId()."'";
+ list($aliaskey) = $GLOBALS['APIDB']->fetchRow($GLOBALS['APIDB']->queryF($sql));
+
+ $from = $GLOBALS['APIDB']->fetchArray($GLOBALS['APIDB']->queryF("SELECT * FROM `" . $GLOBALS['APIDB']->prefix('users') . "` WHERE `uid` = '" . API_PRIMARY_SYSOP_UID . "'"));
+ $to = array($alias['destination']);
+ $mailers = new APIMailer($from['email'], $from['name']);
+ $body = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'new-alias-service.html');
+ $body = str_replace("%apiurl", API_URL, $body);
+ $body = str_replace('%company', API_LICENSE_COMPANY, $body);
+ $body = str_replace('%domain', $domain, $body);
+ $body = str_replace('%fromname', $from['name'], $body);
+ $body = str_replace('%fromemail', $from['email'], $body);
+ $body = str_replace('%email', $email, $body);
+ $body = str_replace('%aliases', $numalias, $body);
+ $body = str_replace('%destination', $alias['destination'], $body);
+ $body = str_replace('%pgpkey', $pgpkey = file_get_contents($keyfile), $body);
+ if ($mailers->sendMail($to, array(), array($from['email']), "Your New Alias Address :: " . $email, $body, array($keyfile), array(), true))
+ {
+ if (!$GLOBALS['APIDB']->queryF($sql = "UPDATE `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` SET `emailed` = UNIX_TIMESTAMP(), `kid` = '$kid' WHERE `id` = " . $alias['id']))
+ die("SQL Failed: $sql;");
+ else
+ echo("\nSQL Success: $sql;");
+ } else {
+ echo "Failed to email: " . $alias['destination'] . " from " . $from['email'] . "\n";
+ }
+ if (strlen($alias['callback']) > 0)
+ addCallback($alias['callback'], array("op" => 'email-alias', "aliaskey" => $aliaskey, "email" => $email, "destination" => $alias['destination'], 'pgpkey' => $pgpkey));
+ }
+ }
+ }
+
+?>
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/generate-aliases-keys.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/new-alias-service.html
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/new-alias-service.html (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/new-alias-service.html 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,15 @@
+<center>
+ <img src="%apiurl/assets/images/logo_350x350.png" />
+</center>
+<p style="margin-top: 9px; font-weight: bold; font-size: 456%; text-align: center;">New Alias Address for you by %company</p>
+<p style="margin-top: 26px; font-weight: 500; font-size: 210%;">You are being contacted as the notification address for the email '%destination' and you're the contact for it an alias forwarder with PGP Key Encryption for ( <strong>%aliases</strong> ) total email contacts exist for the forwarder: %email!</p>
+<h1>Email Alias Details</h1>
+<pre style="margin-top: 13px; margin-left: 25px; font-weight: 300; font-size: 269%;">
+Address: %email
+Destination: %destination
+</pre>
+<h2>PGP Key (Attached Also)</h2>
+<p style="margin-top: 18px; font-size: 277%; font-weight: 600;">PGP Key For: "%email" <%email></p>
+<pre style="margin-top: 13px; margin-left: 25px; font-weight: 300; font-size: 169%;">
+%pgpkey
+</pre>
\ No newline at end of file
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/crons/new-alias-service.html
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/help.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/help.php 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/help.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -144,6 +144,15 @@
<pre style="max-height: 300px; overflow: scroll;">
<?php echo htmlspecialchars(getHTMLForm('newalias', $authkey)); ?>
</pre>
+ <h2>UPLOADING Document Output</h2>
+ <p>This is done with the <em>uploading.api</em> extension at the end of the url, you replace the example address with either a domain!</p>
+ <blockquote>
+ <?php echo getHTMLForm('uploadalias', $authkey); ?>
+ </blockquote>
+ <h3>This the HTML Code surrounding the api call</h3>
+ <pre style="max-height: 300px; overflow: scroll;">
+ <?php echo htmlspecialchars(getHTMLForm('uploadalias', $authkey)); ?>
+ </pre>
<h2>PGPKEY Document Output</h2>
<p>This is done with the <em>pgpkey.api</em> extension at the end of the url, you replace the example address with either a domain! You can also include PGP Keys with emailing the key in the body or as an attachment to: <strong><em><?php echo API_EMAIL_PGP_KEYS; ?></em></strong></p>
<blockquote>
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/functions.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/functions.php 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/functions.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -404,7 +404,7 @@
list($count) = $GLOBALS['APIDB']->fetchRow($GLOBALS['APIDB']->queryF($sql));
if ($count==0)
{
- $sql = "INSERT INTO `" . $GLOBALS['APIDB']->prefix('mail_users') . "` (`mode`, `name`, `email`, `username`, `notify`, `actkey`, `password`, `password_enc`, `uid`, `pid`, `homedir`, `maildir`, `postfix`, `domainid`, `pop3`, `imap`, `mboxsize`, `mboxonline`, `mboxoffline`, `created`, `callback`) VALUES ('new', '" . $GLOBALS['APIDB']->escape($name) . "', '$username@$domain', '$username@$domain', '$notify', '" . substr(sha1(microtime(true)), mt_rand(0, 34), mt_rand(4,6)) . "', DES_ENCRYPT('$password', '$username@$domain'), ENCRYPT('$password'), '" . $GLOBALS['uid'] . "', '$pid', '" . ($homedir = API_HOMEDIR_PATH . DS . $domainpath . DS . $username) . "', '" . ($maildir = API_MAILDIR_PATH . DS . $domainpath . DS . $username) . "', 'Y', '$domainid', 1, 1, '" . (API_INTIALISE_INBOX_SIZES * 1024 * 1024 * 1024) . "', '$bytessize', '" . (API_OFFLINE_INBOX_SIZES * 1024 * 1024 * 1024) . "', UNIX_TIMESTAMP(), '" . $GLOBALS['APIDB']->escape($callback) . "')";
+ $sql = "INSERT INTO `" . $GLOBALS['APIDB']->prefix('mail_users') . "` (`mode`, `name`, `email`, `username`, `notify`, `actkey`, `password`, `password_enc`, `uid`, `pid`, `homedir`, `maildir`, `postfix`, `domainid`, `pop3`, `imap`, `mboxsize`, `mboxonline`, `mboxoffline`, `created`, `callback`) VALUES ('new', '" . $GLOBALS['APIDB']->escape($name) . "', '" . $GLOBALS['APIDB']->escape("$username@$domain") ."', '" . $GLOBALS['APIDB']->escape("$username@$domain") ."', '" . $GLOBALS['APIDB']->escape($notify) . "', '" . substr(sha1(microtime(true)), mt_rand(0, 34), mt_rand(4,6)) . "', DES_ENCRYPT('$password', '" . $GLOBALS['APIDB']->escape("$username@$domain") . "'), ENCRYPT('$password'), '" . $GLOBALS['uid'] . "', '$pid', '" . ($homedir = API_HOMEDIR_PATH . DS . $domainpath . DS . $username) . "', '" . ($maildir = API_MAILDIR_PATH . DS . $domainpath . DS . $username) . "', 'Y', '$domainid', 1, 1, '" . (API_INTIALISE_INBOX_SIZES * 1024 * 1024 * 1024) . "', '$bytessize', '" . (API_OFFLINE_INBOX_SIZES * 1024 * 1024 * 1024) . "', UNIX_TIMESTAMP(), '" . $GLOBALS['APIDB']->escape($callback) . "')";
if ($GLOBALS['APIDB']->queryF($sql))
{
$sql = "SELECT md5(concat(`id`, '" . API_URL . "', 'email')) FROM `" . $GLOBALS['APIDB']->prefix('mail_users') . "` WHERE `id` = '".$GLOBALS['APIDB']->getInsertId()."'";
@@ -453,7 +453,7 @@
}
-if (!function_exists("addEmail")) {
+if (!function_exists("addAlias")) {
/**
* addEmail()
*
@@ -479,11 +479,11 @@
if (empty($return))
{
- $sql = "SELECT COUNT(*) FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE ((`email` LIKE '$username@$domain' OR `email_full` = '$username@$domain') AND `destination` = '$destination')";
+ $sql = "SELECT COUNT(*) FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE ((`email` LIKE '" . $GLOBALS['APIDB']->escape("$username@$domain") . "' OR `email_full` = '$username@$domain') AND `destination` = '" . $GLOBALS['APIDB']->escape($destination) . "')";
list($count) = $GLOBALS['APIDB']->fetchRow($GLOBALS['APIDB']->queryF($sql));
if ($count==0)
{
- $sql = "INSERT INTO `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` (`name`, `email`, `email_full`, `destination`, `domainid`, `uid`, `pid`, `created`, `callback`) VALUES ('" . $GLOBALS['APIDB']->escape($name) . "', '$username@$domain', '$username@$domain', '$destination', '$domainid', '" . $GLOBALS['uid'] . "', '$pid', UNIX_TIMESTAMP(), '" . $GLOBALS['APIDB']->escape($callback) . "')";
+ $sql = "INSERT INTO `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` (`name`, `email`, `email_full`, `destination`, `domainid`, `uid`, `pid`, `created`, `callback`) VALUES ('" . $GLOBALS['APIDB']->escape($name) . "', '" . $GLOBALS['APIDB']->escape("$username@$domain") . "', '" . $GLOBALS['APIDB']->escape("$username@$domain") . "', '" . $GLOBALS['APIDB']->escape($destination) . "', '$domainid', '" . $GLOBALS['uid'] . "', '$pid', UNIX_TIMESTAMP(), '" . $GLOBALS['APIDB']->escape($callback) . "')";
if ($GLOBALS['APIDB']->queryF($sql))
{
$sql = "SELECT md5(concat(`id`, '" . API_URL . "', 'alias')) FROM `" . $GLOBALS['APIDB']->prefix('mail_virtual') . "` WHERE `id` = '".$GLOBALS['APIDB']->getInsertId()."'";
@@ -525,10 +525,10 @@
$return = array('code' => 201, 'aliaskey' => $_SESSION['aliaskey'], 'errors' => array());
}
} else {
- $return = array('code' => 501, 'emailkey' => md5(NULL. 'email'), 'errors' => array('sql' => $sql, $GLOBALS['APIDB']->errno() => $GLOBALS['APIDB']->error()));
+ $return = array('code' => 501, 'aliaskey' => md5(NULL. 'email'), 'errors' => array('sql' => $sql, $GLOBALS['APIDB']->errno() => $GLOBALS['APIDB']->error()));
}
} else {
- $return = array('code' => 501, 'emailkey' => md5(NULL. 'email'), 'errors' => array('103' => 'Record Already Exists!!!'));
+ $return = array('code' => 501, 'aliaskey' => md5(NULL. 'email'), 'errors' => array('103' => 'Record Already Exists!!!'));
}
}
}
@@ -1517,7 +1517,7 @@
$form[] = "\t\t\t<td style='width: 320px;'>";
$form[] = "\t\t\t\t<input type='textbox' name='username' id='username' size='23' /> <strong style='font-size: 247%'>@</strong> ";
$form[] = "\t\t\t\t<select name='domain' id='format'/>";
- $result = $GLOBALS['APIDB']->queryF("SELECT md5(concat(`id`, '" . API_URL . "', 'domain')) as `key`, `domain` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "` WHERE `mxcover` < UNIX_TIMESTAMP() ORDER BY `domain` ASC");
+ $result = $GLOBALS['APIDB']->queryF("SELECT md5(concat(`id`, '" . API_URL . "', 'domain')) as `key`, `domain` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "` WHERE `mxcover` >= UNIX_TIMESTAMP() ORDER BY `domain` ASC");
while($row = $GLOBALS['APIDB']->fetchArray($result))
$form[] = "\t\t\t\t\t<option value='".$row['key']."'>".$row['domain']."</option>";
$form[] = "\t\t\t\t</select>";
@@ -1563,6 +1563,53 @@
$form[] = "\t</table>";
$form[] = "</form>";
break;
+ case "uploadalias":
+ $form[] = "<form name='upload-aliases' method=\"POST\" enctype=\"multipart/form-data\" action=\"" . API_URL . '/v1/'.$authkey.'/uploading.api">';
+ $form[] = "\t<table class='upload-aliases' id='auth-key' style='vertical-align: top !important; min-width: 98%;'>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t\t\t<td style='width: 320px;'>";
+ $form[] = "\t\t\t\t<label for='filename'>CSV List of Aliases: <font style='color: rgb(250,0,0); font-size: 139%; font-weight: bold'>*</font></label>";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t\t<td>";
+ $form[] = "\t\t\t\t<input type='file' name='filename' id='filename' size='21' /> ";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t\t<td> </td>";
+ $form[] = "\t\t</tr>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t\t\t<td style='width: auto; background-color: #feedcc; padding: 10px;' colspan='2'>";
+ $form[] = "\t\t\t\tThe CSV must be a standard excel or linux format and have the four captioned top row fields of: Name, Email, Alias, Domain!<br/><br/>There is two example spreedsheets with the titles in place you can populate you can download these from: <a href='" . API_URL . "/assets/docs/csv-prop-spreedsheet.xlsx' target='_blank'>csv-prop-spreedsheet.xlsx</a> or <a href='" . API_URL . "/assets/docs/csv-prop-spreedsheet.ods' target='_blank'>csv-prop-spreedsheet.ods</a>; thanks for using the example spreedsheets to generate the correct titled CSV in the right formating!";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t</tr>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t\t\t<td>";
+ $form[] = "\t\t\t\t<label for='format'>Output Format: <font style='color: rgb(250,0,0); font-size: 139%; font-weight: bold'>*</font></label>";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t\t<td style='width: 320px;'>";
+ $form[] = "\t\t\t\t<select name='format' id='format'/>";
+ $form[] = "\t\t\t\t\t<option value='raw'>RAW PHP Output</option>";
+ $form[] = "\t\t\t\t\t<option value='json' selected='selected'>JSON Output</option>";
+ $form[] = "\t\t\t\t\t<option value='serial'>Serialisation Output</option>";
+ $form[] = "\t\t\t\t\t<option value='xml'>XML Output</option>";
+ $form[] = "\t\t\t\t</select>";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t\t<td> </td>";
+ $form[] = "\t\t</tr>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t\t\t<td colspan='3' style='padding-left:64px;'>";
+ $form[] = "\t\t\t\t<input type='hidden' value='".$authkey."' name='authkey'>";
+ $form[] = "\t\t\t\t<input type='hidden' value='alias' name='mode'>";
+ $form[] = "\t\t\t\t<input type='submit' value='Upload *.csv and propogate email aliases!' name='submit' style='padding:11px; font-size:122%;'>";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t</tr>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t\t\t<td colspan='3' style='padding-top: 8px; padding-bottom: 14px; padding-right:35px; text-align: right;'>";
+ $form[] = "\t\t\t\t<font style='color: rgb(250,0,0); font-size: 139%; font-weight: bold;'>* </font><font style='color: rgb(10,10,10); font-size: 99%; font-weight: bold'><em style='font-size: 76%'>~ Required Field for Form Submission</em></font>";
+ $form[] = "\t\t\t</td>";
+ $form[] = "\t\t</tr>";
+ $form[] = "\t\t<tr>";
+ $form[] = "\t</table>";
+ $form[] = "</form>";
+ break;
case "newemail":
$form[] = "<form name='new-record' method=\"POST\" enctype=\"multipart/form-data\" action=\"" . API_URL . '/v1/' . $authkey . '/emails.api">';
$form[] = "\t<table class='new-record' id='auth-record' style='vertical-align: top !important; min-width: 98%;'>";
@@ -1582,7 +1629,7 @@
$form[] = "\t\t\t<td style='width: 320px;'>";
$form[] = "\t\t\t\t<input type='textbox' name='email[username]' id='email' size='23' /> <strong style='font-size: 247%'>@</strong> ";
$form[] = "\t\t\t\t<select name='email[domainkey]' id='format'/>";
- $result = $GLOBALS['APIDB']->queryF("SELECT md5(concat(`id`, '" . API_URL . "', 'domain')) as `key`, `domain` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "` WHERE `mxcover` < UNIX_TIMESTAMP() ORDER BY `domain` ASC");
+ $result = $GLOBALS['APIDB']->queryF("SELECT md5(concat(`id`, '" . API_URL . "', 'domain')) as `key`, `domain` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "` WHERE `mxcover` >= UNIX_TIMESTAMP() ORDER BY `domain` ASC");
while($row = $GLOBALS['APIDB']->fetchArray($result))
$form[] = "\t\t\t\t\t<option value='".$row['key']."'>".$row['domain']."</option>";
$form[] = "\t\t\t\t</select>";
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/license.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/license.php (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/license.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Email Account Propogation REST Services API
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original comment or credit authors.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @copyright Chronolabs Cooperative http://syd.au.snails.email
+ * @license ACADEMIC APL 2 (https://sourceforge.net/u/chronolabscoop/wiki/Academic%20Public%20License%2C%20version%202.0/)
+ * @license GNU GPL 3 (http://www.gnu.org/licenses/gpl.html)
+ * @package emails-api
+ * @since 1.1.11
+ * @author Dr. Simon Antony Roberts <si...@sn...>
+ * @version 1.1.11
+ * @description A REST API for the creation and management of emails/forwarders and domain name parks for email
+ * @link http://internetfounder.wordpress.com
+ * @link https://github.com/Chronolabs-Cooperative/Emails-API-PHP
+ * @link https://sourceforge.net/p/chronolabs-cooperative
+ * @link https://facebook.com/ChronolabsCoop
+ * @link https://twitter.com/ChronolabsCoop
+ *
+ */
+
+defined('API_ROOT_PATH') || exit('Restricted access');
+
+define('API_LICENSE_CODE', 'GPL');
+define('API_LICENSE_TEXT', 'GPL General Public License (GPL) (v. 2.0)');
+define('API_LICENSE_KEY', '27a75e-2569f0-82df1e-25b7d9-d6267c');
+define('API_LICENSE_COMPANY', 'Chronolabs Cooperative');
+define('API_LICENSE_UNAME', 'mynamesnot');
+define('API_LICENSE_EMAIL', 'si...@or...');
+define('API_LICENSE_PASSWORD', 'd41d8cd98f00b204e9800998ecf8427e');
+define('API_LICENSE_PROTOCOL', 'http');
+define('API_LICENSE_REALM', 'emails.localhost');
+define('API_LICENSE_PATH', '');
+define('API_LICENSE_TYPE', 'emails-api');
+
+
+
+
+/**
+ * Peering Services notified over cURL on installations:~
+ *
+ * Errored Announcing: http://peers.snails.email/v1/register/json.api
+ *
+ * Errored Announcing: http://peers.xortify.com/v1/register/json.api
+ *
+*/
\ No newline at end of file
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/license.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/version.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/version.php 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/include/version.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -41,5 +41,5 @@
/**
* Define API version
*/
-define('API_VERSION', 'Emails Propogation REST Services API 1.0.7');
+define('API_VERSION', 'Emails Propogation REST Services API 1.1.11');
define('API_TYPE', 'emails-api');
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Precise (12.04)/smtp.html
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Precise (12.04)/smtp.html 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Precise (12.04)/smtp.html 2019-04-28 16:27:43 UTC (rev 13400)
@@ -1,4 +1,3 @@
-
<article>
<section>
<div class="pushbot">
@@ -86,8 +85,8 @@
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf
smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual_sender_permissions.cf
-virtual_uid_maps = static:2000
-virtual_gid_maps = static:2000
+virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uid_maps.cf
+virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gid_maps.cf
# Local delivery settings
local_transport = local
@@ -132,7 +131,7 @@
password = %dbpassword
dbname = %dbname
hosts = %dbhost
-query = SELECT destination FROM %tablemailvirtual WHERE email = '%s' AND trim(destination) <> ''</textarea>
+query = SELECT `destination` FROM `%tablemailvirtual` WHERE email = '%s';</textarea>
</div>
<div class="pushbot">
@@ -152,7 +151,7 @@
password = %dbpassword
dbname = %dbname
hosts = %dbhost
-query = SELECT domain FROM %tablepaneldomains WHERE domain = '%s' AND isemaildomain = '1'</textarea>
+query = SELECT `domain` FROM `%tablepaneldomains` as `a` INNER JOIN `%tablemailusers` as `b` ON `a`.`id` = `b`.`domainid` WHERE `b`.`email` = '%s' AND `a`.`isemaildomain` = '1' AND `a`.`mxcheck` >= UNIX_TIMESTAMP();</textarea>
</div>
<div class="pushbot">
@@ -173,7 +172,7 @@
dbname = %dbname
expansion_limit = 1
hosts = %dbhost
-query = SELECT CONCAT(homedir,maildir) FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT `maildir` FROM %tablemailusers WHERE email = '%s'</textarea>
</div>
<div class="pushbot">
@@ -212,9 +211,15 @@
<textarea class="filecontent" rows="6" readonly>user = %dbuser
password = %dbpassword
dbname = %dbname
-expansion_limit = 1
hosts = %dbhost
-query = SELECT uid FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT `a`.`homedir` as `home`, (`a`.`id`+9999) as `uid`, `gid`,
+ CONCAT('*:bytes=', (mboxsize - (mboxsize * (`quotashot` / 100)))) AS `quota_rule`,
+ "/" AS "namespace/default/separator"
+ FROM `%tableemailusers` as `a`
+ INNER JOIN `%tablepaneldomains` as `b`
+ ON `a`.`domainid` = `b`.`id`
+ WHERE `a`.`username` LIKE '%s'
+ AND `b`.`mxcheck` >= UNIX_TIMESTAMP();</textarea>
</div>
<div class="pushbot">
@@ -235,7 +240,8 @@
dbname = %dbname
expansion_limit = 1
hosts = %dbhost
-query = SELECT gid FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT DISTINCT `a`.`id` as `gid` FROM `%tablegroups` as `a` INNER JOIN `%tablemailusers` as `b` ON `a`.`id` = `b`.`gid` WHERE `b`.`email` = '%s'
+</textarea>
</div>
<div class="pushbot">
@@ -299,7 +305,7 @@
</div>
<div class="pushbot">
<textarea class="shell" rows="2" readonly>newaliases
-/etc/init.d/postfix restart</textarea>
+service postfix restart</textarea>
</div>
</section>
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Trusty (14.04)/smtp.html
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Trusty (14.04)/smtp.html 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/assets/configs/Ubuntu Trusty (14.04)/smtp.html 2019-04-28 16:27:43 UTC (rev 13400)
@@ -85,8 +85,8 @@
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual_mailbox_domains.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual_alias_maps.cf
smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual_sender_permissions.cf
-virtual_uid_maps = static:2000
-virtual_gid_maps = static:2000
+virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uid_maps.cf
+virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gid_maps.cf
# Local delivery settings
local_transport = local
@@ -131,7 +131,7 @@
password = %dbpassword
dbname = %dbname
hosts = %dbhost
-query = SELECT destination FROM %tablemailvirtual WHERE email = '%s' AND trim(destination) <> ''</textarea>
+query = SELECT `destination` FROM `%tablemailvirtual` WHERE email = '%s';</textarea>
</div>
<div class="pushbot">
@@ -151,7 +151,7 @@
password = %dbpassword
dbname = %dbname
hosts = %dbhost
-query = SELECT domain FROM %tablepaneldomains WHERE domain = '%s' AND isemaildomain = '1'</textarea>
+query = SELECT `domain` FROM `%tablepaneldomains` as `a` INNER JOIN `%tablemailusers` as `b` ON `a`.`id` = `b`.`domainid` WHERE `b`.`email` = '%s' AND `a`.`isemaildomain` = '1' AND `a`.`mxcheck` >= UNIX_TIMESTAMP();</textarea>
</div>
<div class="pushbot">
@@ -172,7 +172,7 @@
dbname = %dbname
expansion_limit = 1
hosts = %dbhost
-query = SELECT CONCAT(homedir,maildir) FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT `maildir` FROM %tablemailusers WHERE email = '%s'</textarea>
</div>
<div class="pushbot">
@@ -211,9 +211,15 @@
<textarea class="filecontent" rows="6" readonly>user = %dbuser
password = %dbpassword
dbname = %dbname
-expansion_limit = 1
hosts = %dbhost
-query = SELECT uid FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT `a`.`homedir` as `home`, (`a`.`id`+9999) as `uid`, `gid`,
+ CONCAT('*:bytes=', (mboxsize - (mboxsize * (`quotashot` / 100)))) AS `quota_rule`,
+ "/" AS "namespace/default/separator"
+ FROM `%tableemailusers` as `a`
+ INNER JOIN `%tablepaneldomains` as `b`
+ ON `a`.`domainid` = `b`.`id`
+ WHERE `a`.`username` LIKE '%s'
+ AND `b`.`mxcheck` >= UNIX_TIMESTAMP();</textarea>
</div>
<div class="pushbot">
@@ -234,7 +240,8 @@
dbname = %dbname
expansion_limit = 1
hosts = %dbhost
-query = SELECT gid FROM %tablemailusers WHERE email = '%s'</textarea>
+query = SELECT DISTINCT `a`.`id` as `gid` FROM `%tablegroups` as `a` INNER JOIN `%tablemailusers` as `b` ON `a`.`id` = `b`.`gid` WHERE `b`.`email` = '%s'
+</textarea>
</div>
<div class="pushbot">
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/json.getconfig.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/json.getconfig.php 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/json.getconfig.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -45,6 +45,7 @@
$article = str_replace('%tablemailusers', '`' . $GLOBALS['APIDB']->prefix('mail_users') . '`', $article);
$article = str_replace('%tablemailvirtual', '`' . $GLOBALS['APIDB']->prefix('mail_virtual') . '`', $article);
$article = str_replace('%tablepaneldomains', '`' . $GLOBALS['APIDB']->prefix('domains') . '`', $article);
+$article = str_replace('%tablegroups', '`' . $GLOBALS['APIDB']->prefix('groups') . '`', $article);
$article = str_replace('%apidomain', parse_url(API_URL, PHP_URL_HOST), $article);
$article = str_replace('%licenseemail', API_LICENSE_EMAIL, $article);
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.groups.sql
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.groups.sql (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.groups.sql 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,63 @@
+-- phpMyAdmin SQL Dump
+-- version 4.6.6deb5
+-- https://www.phpmyadmin.net/
+--
+-- Host: localhost:3306
+-- Generation Time: Apr 23, 2019 at 08:37 PM
+-- Server version: 5.7.25-0ubuntu0.18.04.2
+-- PHP Version: 7.2.15-0ubuntu0.18.04.2
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `emails-snails-email`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `groups`
+--
+
+CREATE TABLE `groups` (
+ `id` int(8) UNSIGNED NOT NULL,
+ `name` varchar(128) NOT NULL DEFAULT '',
+ `created` int(12) UNSIGNED NOT NULL DEFAULT '0'
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+--
+-- Dumping data for table `groups`
+--
+
+INSERT INTO `groups` (`id`, `name`, `created`) VALUES
+(1000, 'Mail User', 1555767902);
+
+--
+-- Indexes for dumped tables
+--
+
+--
+-- Indexes for table `groups`
+--
+ALTER TABLE `groups`
+ ADD PRIMARY KEY (`id`);
+
+--
+-- AUTO_INCREMENT for dumped tables
+--
+
+--
+-- AUTO_INCREMENT for table `groups`
+--
+ALTER TABLE `groups`
+ MODIFY `id` int(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Modified: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.mail_users.sql
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.mail_users.sql 2018-11-27 00:19:12 UTC (rev 13399)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/install/sql/mysql.mail_users.sql 2019-04-28 16:27:43 UTC (rev 13400)
@@ -14,6 +14,7 @@
`username` varchar(255) NOT NULL DEFAULT '',
`password` tinyblob,
`password_enc` tinyblob,
+ `gid` int(8) unsigned NOT NULL DEFAULT '1000',
`uid` int(11) unsigned NOT NULL DEFAULT '0',
`pid` int(11) unsigned NOT NULL DEFAULT '0',
`kid` mediumint(32) unsigned NOT NULL DEFAULT '0',
Added: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/uploading.php
===================================================================
--- *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/uploading.php (rev 0)
+++ *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/uploading.php 2019-04-28 16:27:43 UTC (rev 13400)
@@ -0,0 +1,187 @@
+<?php
+/**
+ * DNS Zone Propogation REST Services API
+ *
+ * You may not change or alter any portion of this comment or credits
+ * of supporting developers from this source code or any supporting source code
+ * which is considered copyrighted (c) material of the original comment or credit authors.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @copyright Chronolabs Cooperative http://syd.au.snails.email
+ * @license ACADEMIC APL 2 (https://sourceforge.net/u/chronolabscoop/wiki/Academic%20Public%20License%2C%20version%202.0/)
+ * @license GNU GPL 3 (http://www.gnu.org/licenses/gpl.html)
+ * @package emails-api
+ * @since 1.0.3
+ * @author Dr. Simon Antony Roberts <si...@sn...>
+ * @version 1.0.3
+ * @description A REST API for the creation and management of emails/forwarders and domain name parks for email
+ * @link http://internetfounder.wordpress.com
+ * @link https://github.com/Chronolabs-Cooperative/Emails-API-PHP
+ * @link https://sourceforge.net/p/chronolabs-cooperative
+ * @link https://facebook.com/ChronolabsCoop
+ * @link https://twitter.com/ChronolabsCoop
+ *
+ */
+
+
+ require_once __DIR__ . DIRECTORY_SEPARATOR . 'apiconfig.php';
+ require_once __DIR__ . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'csv.php';
+
+ error_reporting(E_ALL);
+ ini_set('display_errors', true);
+ set_time_limit(3600*36*9*14*28);
+
+ /**
+ * URI Path Finding of API URL Source Locality
+ * @var unknown_type
+ */
+ $odds = $inner = array();
+ foreach($_GET as $key => $values) {
+ if (!isset($inner[$key])) {
+ $inner[$key] = $values;
+ } elseif (!in_array(!is_array($values) ? $values : md5(json_encode($values, true)), array_keys($odds[$key]))) {
+ if (is_array($values)) {
+ $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
+ } else {
+ $odds[$key][$inner[$key] = $values] = "$values--$key";
+ }
+ }
+ }
+
+ foreach($_POST as $key => $values) {
+ if (!isset($inner[$key])) {
+ $inner[$key] = $values;
+ } elseif (!in_array(!is_array($values) ? $values : md5(json_encode($values, true)), array_keys($odds[$key]))) {
+ if (is_array($values)) {
+ $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
+ } else {
+ $odds[$key][$inner[$key] = $values] = "$values--$key";
+ }
+ }
+ }
+
+ foreach(parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].(strpos($_SERVER['REQUEST_URI'], '?')?'&':'?').$_SERVER['QUERY_STRING'], PHP_URL_QUERY) as $key => $values) {
+ if (!isset($inner[$key])) {
+ $inner[$key] = $values;
+ } elseif (!in_array(!is_array($values) ? $values : md5(json_encode($values, true)), array_keys($odds[$key]))) {
+ if (is_array($values)) {
+ $odds[$key][md5(json_encode($inner[$key] = $values, true))] = $values;
+ } else {
+ $odds[$key][$inner[$key] = $values] = "$values--$key";
+ }
+ }
+ }
+
+ //echo "Processed Upload Form Fine<br/>";
+ $time = time();
+ $error = array();
+ if (isset($_FILES['filename']) || !empty($_FILES['filename'])) {
+ if (empty($_FILES['filename']['tmp_name']))
+ $error[] = 'No file uploaded in the correct field name of: "' . $inner['field'] . '"';
+ else {
+ if (strtolower(substr($_FILES['filename']['name'], strlen($_FILES['filename']['name']) - 3, 3)) != 'csv')
+ $error[] = 'The file extension type of <strong>'.$_FILES['filename']['name'].'</strong> is not valid you can only upload the following file types: <em>'.implode("</em> <em>*.", array('csv', 'CSV')).'</em>!';
+ else
+ $filetype = 'csv';
+ }
+ } else
+ $error[] = 'File uploaded field name not specified in the URL!';
+
+ $uploadpath = "/tmp/" . dirname(__DIR__) . '-' . microtime(true);
+ if (!is_dir($uploadpath)) {
+ if (!mkdir($uploadpath, 0777, true)) {
+ $error[] = 'Unable to make path: '."/tmp/" . dirname(__DIR__);
+ }
+ }
+
+ $data = $domainkeys = array();
+ $file = '';
+ if (empty($error))
+ switch ($filetype)
+ {
+ case "csv":
+ if (!move_uploaded_file($_FILES['filename']['tmp_name'], $file = $uploadpath . DIRECTORY_SEPARATOR . $_FILES['filename']['name'])) {
+ $error[] = 'The file type of <strong>'.$_FILES['filename']['name'].'</strong> could not be uploaded to the path of: $uploadpath!!';
+ break;
+ } else {
+ if (filesize($file)>0) {
+ $csv = array_map('str_getcsv', file($file));
+ array_walk($csv, function(&$a) use ($csv) {
+ $a = array_combine($csv[0], $a);
+ });
+ array_shift($csv);
+ $aliases = $csv;
+ unset($csv);
+ if (count($aliases)>0)
+ if (isset($aliases[0]['Name']) && isset($aliases[0]['Email']) && isset($aliases[0]['Alias']) && isset($aliases[0]['Domain'])) {
+ foreach($aliases as $alias) {
+ if (!empty($alias['Name']) && !empty($alias['Email']) && !empty($alias['Alias']) && !empty($alias['Domain'])) {
+ if (!isset($domainkeys[$alias['Domain']])) {
+ $result = $GLOBALS['APIDB']->queryF("SELECT md5(concat(`id`, '" . API_URL . "', 'domain')) as `key` FROM `" . $GLOBALS['APIDB']->prefix('domains') . "` WHERE `mxcover` < UNIX_TIMESTAMP() AND `domain` LIKE '" . $alias['Domain'] . "' ORDER BY `domain` ASC");
+ list($key) = $GLOBALS['APIDB']->fetchRow($result);
+ if (!empty($key))
+ $domainkeys[$alias['Domain']] = $key;
+ }
+ if (!empty($domainkeys[$alias['Domain']])) {
+ $result = addAlias($inner['authkey'], $alias['Name'], $alias['Alias'], $domainkeys[$alias['Domain']], $alias['Email'], $alias['Callback'], $inner['format']);
+ $data['code'] = $result['code'];
+ unset($result['code']);
+ $data['passed'][$alias['Alias']."@".$alias['Domain']][$alias['Name']][$alias['Email']] = $result;
+ }
+ } else {
+ $data['failed'][$alias['Alias']."@".$alias['Domain']][$alias['Name']] = $alias['Email'];
+ }
+ }
+
+ } else {
+ $error[] = 'The file extension type of <strong>*.csv</strong> is not valid you need to have the four required titles listed to import this file!';
+ break;
+ }
+
+ }
+ }
+ break;
+ }
+ if (!empty($error)) {
+ $data['errors'] = $error;
+ $data['code'] = 501;
+ }
+ shell_exec("rm -Rf '$uploadpath'");
+
+ /**
+ * Commences Execution of API Functions
+ */
+ if (function_exists("http_response_code"))
+ http_response_code((isset($data['code'])?$data['code']:200));
+ if (isset($data['code']))
+ unset($data['code']);
+
+ switch ($inner['format']) {
+ default:
+ echo '<pre style="font-family: \'Courier New\', Courier, Terminal; font-size: 0.77em;">';
+ echo var_dump($data, true);
+ echo '</pre>';
+ break;
+ case 'raw':
+ echo "<?php\n\n return " . var_export($data, true) . ";\n\n?>";
+ break;
+ case 'json':
+ header('Content-type: application/json');
+ echo json_encode($data);
+ break;
+ case 'serial':
+ header('Content-type: text/html');
+ echo serialize($data);
+ break;
+ case 'xml':
+ header('Content-type: application/xml');
+ $dom = new XmlDomConstruct('1.0', 'utf-8');
+ $dom->fromMixed(array('root'=>$data));
+ echo $dom->saveXML();
+ break;
+ }
+ exit(0);
+
+?>
\ No newline at end of file
Property changes on: *.xoops.org (Subdomain APIs & Sites)/email.xoops.org/uploading.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
|