aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-03-13 10:59:21 +0100
committerGitHub <noreply@github.com>2018-03-13 10:59:21 +0100
commit790660e61264ed884a8c600f407cf75893ffe977 (patch)
tree8fb3e4263cd7cdf4b34e0d7bb859c2f290c8ab39 /Zotlabs/Lib
parent2bcfa0c12687d47c11e8c445a5a38ffe96d5c135 (diff)
parent53c1d3775cc140ecda50d837752adac851d9e0b2 (diff)
downloadvolse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.gz
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.bz2
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.zip
Merge pull request #18 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/DReport.php55
-rw-r--r--Zotlabs/Lib/Enotify.php17
-rw-r--r--Zotlabs/Lib/ProtoDriver.php19
-rw-r--r--Zotlabs/Lib/Verify.php63
-rw-r--r--Zotlabs/Lib/ZotDriver.php30
5 files changed, 131 insertions, 53 deletions
diff --git a/Zotlabs/Lib/DReport.php b/Zotlabs/Lib/DReport.php
new file mode 100644
index 000000000..a68d6c18f
--- /dev/null
+++ b/Zotlabs/Lib/DReport.php
@@ -0,0 +1,55 @@
+<?php
+namespace Zotlabs\Lib;
+
+class DReport {
+
+ private $location;
+ private $sender;
+ private $recipient;
+ private $message_id;
+ private $status;
+ private $date;
+
+ function __construct($location,$sender,$recipient,$message_id,$status = 'deliver') {
+ $this->location = $location;
+ $this->sender = $sender;
+ $this->recipient = $recipient;
+ $this->message_id = $message_id;
+ $this->status = $status;
+ $this->date = datetime_convert();
+ }
+
+ function update($status) {
+ $this->status = $status;
+ $this->date = datetime_convert();
+ }
+
+ function addto_recipient($name) {
+ $this->recipient = $this->recipient . ' ' . $name;
+ }
+
+ function addto_update($status) {
+ $this->status = $this->status . ' ' . $status;
+ }
+
+
+ function set($arr) {
+ $this->location = $arr['location'];
+ $this->sender = $arr['sender'];
+ $this->recipient = $arr['recipient'];
+ $this->message_id = $arr['message_id'];
+ $this->status = $arr['status'];
+ $this->date = $arr['date'];
+ }
+
+ function get() {
+ return array(
+ 'location' => $this->location,
+ 'sender' => $this->sender,
+ 'recipient' => $this->recipient,
+ 'message_id' => $this->message_id,
+ 'status' => $this->status,
+ 'date' => $this->date
+ );
+ }
+}
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index c5bc706c2..61c98c881 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -63,7 +63,9 @@ class Enotify {
$thanks = t('Thank You,');
$sitename = get_config('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
-
+ $opt_out1 = sprintf( t('This email was sent by %1$s at %2$s.'), t('$Projectname'), \App::get_hostname());
+ $opt_out2 = sprintf( t('To stop receiving these messages, please adjust your Notification Settings at %s'), z_root() . '/settings');
+ $hopt_out2 = sprintf( t('To stop receiving these messages, please adjust your %s.'), '<a href="' . z_root() . '/settings' . '">' . t('Notification Settings') . '</a>');
$sender_name = $product;
$hostname = \App::get_hostname();
if(strpos($hostname,':'))
@@ -136,7 +138,7 @@ class Enotify {
$itemlink = $params['link'];
- $action = 'commented on';
+ $action = t('commented on');
if(array_key_exists('item',$params) && in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
@@ -147,10 +149,10 @@ class Enotify {
}
if(activity_match($params['verb'], ACTIVITY_LIKE))
- $action = 'liked';
+ $action = t('liked');
if(activity_match($params['verb'], ACTIVITY_DISLIKE))
- $action = 'disliked';
+ $action = t('disliked');
}
@@ -613,6 +615,9 @@ class Enotify {
$datarray['titemlink'] = $itemlink;
$datarray['thanks'] = $thanks;
$datarray['site_admin'] = $site_admin;
+ $datarray['opt_out1'] = $opt_out1;
+ $datarray['opt_out2'] = $opt_out2;
+ $datarray['hopt_out2'] = $hopt_out2;
$datarray['title'] = stripslashes($title);
$datarray['htmlversion'] = $htmlversion;
$datarray['textversion'] = $textversion;
@@ -670,6 +675,8 @@ class Enotify {
'$hitemlink' => $datarray['hitemlink'],
'$thanks' => $datarray['thanks'],
'$site_admin' => $datarray['site_admin'],
+ '$opt_out1' => $datarray['opt_out1'],
+ '$opt_out2' => $datarray['hopt_out2'],
'$title' => $datarray['title'],
'$htmlversion' => $datarray['htmlversion'],
));
@@ -690,6 +697,8 @@ class Enotify {
'$titemlink' => $datarray['titemlink'],
'$thanks' => $datarray['thanks'],
'$site_admin' => $datarray['site_admin'],
+ '$opt_out1' => $datarray['opt_out1'],
+ '$opt_out2' => $datarray['opt_out2'],
'$title' => $datarray['title'],
'$textversion' => $datarray['textversion'],
));
diff --git a/Zotlabs/Lib/ProtoDriver.php b/Zotlabs/Lib/ProtoDriver.php
deleted file mode 100644
index daf887dbb..000000000
--- a/Zotlabs/Lib/ProtoDriver.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php /** @file */
-
-namespace Zotlabs\Lib;
-
-/*
- * Abstraction class for dealing with alternate networks (which of course do not exist, hence the abstraction)
- */
-
-
-abstract class ProtoDriver {
- abstract protected function discover($channel,$location);
- abstract protected function deliver($item,$channel,$recipients);
- abstract protected function collect($channel,$connection);
- abstract protected function change_permissions($permissions,$channel,$recipient);
- abstract protected function acknowledge_permissions($permissions,$channel,$recipient);
- abstract protected function deliver_private($item,$channel,$recipients);
- abstract protected function collect_private($channel,$connection);
-
-}
diff --git a/Zotlabs/Lib/Verify.php b/Zotlabs/Lib/Verify.php
new file mode 100644
index 000000000..8703e29e6
--- /dev/null
+++ b/Zotlabs/Lib/Verify.php
@@ -0,0 +1,63 @@
+<?php
+
+namespace Zotlabs\Lib;
+
+
+class Verify {
+
+ function create($type,$channel_id,$token,$meta) {
+ return q("insert into verify ( vtype, channel, token, meta, created ) values ( '%s', %d, '%s', '%s', '%s' )",
+ dbesc($type),
+ intval($channel_id),
+ dbesc($token),
+ dbesc($meta),
+ dbesc(datetime_convert())
+ );
+ }
+
+ function match($type,$channel_id,$token,$meta) {
+ $r = q("select id from verify where vtype = '%s' and channel = %d and token = '%s' and meta = '%s' limit 1",
+ dbesc($type),
+ intval($channel_id),
+ dbesc($token),
+ dbesc($meta)
+ );
+ if($r) {
+ q("delete from verify where id = %d",
+ intval($r[0]['id'])
+ );
+ return true;
+ }
+ return false;
+ }
+
+ function get_meta($type,$channel_id,$token) {
+ $r = q("select id, meta from verify where vtype = '%s' and channel = %d and token = '%s' limit 1",
+ dbesc($type),
+ intval($channel_id),
+ dbesc($token)
+ );
+ if($r) {
+ q("delete from verify where id = %d",
+ intval($r[0]['id'])
+ );
+ return $r[0]['meta'];
+ }
+ return false;
+ }
+
+ /**
+ * @brief Purge entries of a verify-type older than interval.
+ *
+ * @param string $type Verify type
+ * @param string $interval SQL compatible time interval
+ */
+ function purge($type, $interval) {
+ q("delete from verify where vtype = '%s' and created < %s - INTERVAL %s",
+ dbesc($type),
+ db_utcnow(),
+ db_quoteinterval($interval)
+ );
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Lib/ZotDriver.php b/Zotlabs/Lib/ZotDriver.php
deleted file mode 100644
index e14cc7f35..000000000
--- a/Zotlabs/Lib/ZotDriver.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php /** @file */
-
-namespace Zotlabs\Lib;
-
-
-class ZotDriver extends ProtoDriver {
-
- protected function discover($channel,$location) {
-
- }
- protected function deliver($item,$channel,$recipients) {
-
- }
- protected function collect($channel,$connection) {
-
- }
- protected function change_permissions($permissions,$channel,$recipient) {
-
- }
- protected function acknowledge_permissions($permissions,$channel,$recipient) {
-
- }
- protected function deliver_private($item,$channel,$recipients) {
-
- }
- protected function collect_private($channel,$connection) {
-
- }
-
-}