* Email notification options
* @{
*/
-define('NOTIFY_INTRO', 1);
define('NOTIFY_CONFIRM', 2);
define('NOTIFY_WALL', 4);
define('NOTIFY_COMMENT', 8);
$hsitelink = sprintf($sitelink, '<a href="'.$siteurl.'">'.$sitename.'</a>');
}
- if ($params['type'] == NOTIFY_INTRO) {
+ if ($params['type'] == Notify\Type::INTRO) {
$itemlink = $params['link'];
$subject = $l10n->t('[Friendica:Notify] Introduction received');
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
+use Friendica\Model\Notify\Type;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Module\Security\Login;
if (!$auto_confirm) {
notification([
- 'type' => NOTIFY_INTRO,
+ 'type' => Type::INTRO,
'notify_flags' => $r[0]['notify-flags'],
'language' => $r[0]['language'],
'to_name' => $r[0]['username'],
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
+use Friendica\Model\Notify\Type;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
use Friendica\Util\Proxy as ProxyUtils;
AND NOT (`notify`.`type` IN (%d, %d))
AND $seensql `notify`.`seen` ORDER BY `notify`.`date` $order LIMIT %d, 50",
intval($uid),
- intval(NOTIFY_INTRO),
+ intval(Type::INTRO),
intval(NOTIFY_MAIL),
intval($offset)
);
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Group;
+use Friendica\Model\Notify\Type;
use Friendica\Model\User;
use Friendica\Module\Security\Login;
use Friendica\Protocol\Email;
'$h_not' => DI::l10n()->t('Notification Settings'),
'$lbl_not' => DI::l10n()->t('Send a notification email when:'),
- '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''],
+ '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & Type::INTRO), NOTIFY_INTRO, ''],
'$notify2' => ['notify2', DI::l10n()->t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''],
'$notify3' => ['notify3', DI::l10n()->t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''],
'$notify4' => ['notify4', DI::l10n()->t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''],
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Model\Notify\Type;
use Friendica\Network\Probe;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
- if (($user['notify-flags'] & NOTIFY_INTRO) &&
+ if (($user['notify-flags'] & Type::INTRO) &&
in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL])) {
notification([
- 'type' => NOTIFY_INTRO,
+ 'type' => Type::INTRO,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],
--- /dev/null
+<?php
+
+namespace Friendica\Model\Notify;
+
+/**
+ * Enum for different types of the Notify
+ */
+class Type
+{
+ /** @var int Introduction notifications */
+ const INTRO = 1;
+}
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
+use Friendica\Model\Notify\Type;
use Friendica\Model\User;
use Friendica\Network\HTTPException\ForbiddenException;
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->user['nickname']);
- $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], NOTIFY_INTRO, NOTIFY_MAIL];
+ $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Type::INTRO, NOTIFY_MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
$notifications = DBA::count('notify', $condition, $params);