#!/usr/bin/env php
<?php
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'e::ay';
$longoptions = array('email=', 'all', 'yes');
if (have_option('e', 'email')) {
$email = get_option_value('e', 'email');
- $ca = Confirm_address::getAddress($email, 'email');
- if (!$ca instanceof Confirm_address) {
- print "Can't find email $email in confirm_address table.\n";
+ try {
+ $ca = Confirm_address::getByAddress($email, 'email');
+ } catch (NoResultException $e) {
+ print sprintf("Can't find %s address %s in %s table.\n", $e->obj->address_type, $e->obj->address, $e->obj->tableName());
exit(1);
}
} elseif (have_option('a', 'all')) {
{
try {
$user = User::getByID($ca->user_id);
+ $profile = $user->getProfile();
+ if ($profile->isSilenced()) {
+ $ca->delete();
+ return;
+ }
if ($user->email === $ca->address) {
throw new AlreadyFulfilledException('User already has identical confirmed email address.');
}