Included WebKlex PHP-IMAP Library in plugins folder to allow for future use when we convert IMAP to allow OAUTH2

This commit is contained in:
johnnyq
2024-01-11 12:51:11 -05:00
parent 9520148d4d
commit 625a6cac6c
63 changed files with 13259 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: AuthFailedException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class AuthFailedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class AuthFailedException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: ConnectionFailedException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class ConnectionFailedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class ConnectionFailedException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: EventNotFoundException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class EventNotFoundException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class EventNotFoundException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: FolderFetchingException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class FolderFetchingException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class FolderFetchingException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: GetMessagesFailedException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class GetMessagesFailedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class GetMessagesFailedException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: ImapBadRequestException.php
* Category: Exception
* Author: S. Janaczek
* Created: 08.09.22 08:39
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class GetMessagesFailedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class ImapBadRequestException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: ImapServerErrorException.php
* Category: Exception
* Author: S. Janaczek
* Created: 08.09.22 08:39
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class GetMessagesFailedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class ImapServerErrorException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: InvalidMessageDateException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 10.03.19 04:31
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class InvalidMessageDateException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class InvalidMessageDateException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: InvalidWhereQueryCriteriaException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 21.07.18 19:04
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class InvalidWhereQueryCriteriaException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class InvalidWhereQueryCriteriaException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MaskNotFoundException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MaskNotFoundException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MaskNotFoundException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageContentFetchingException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageContentFetchingException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageContentFetchingException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageFlagException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 02.01.21 02:47
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageFlagException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageFlagException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageHeaderFetchingException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageHeaderFetchingException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageHeaderFetchingException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageNotFoundException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 25.01.21 18:19
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageNotFoundException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageNotFoundException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageSearchValidationException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageSearchValidationException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageSearchValidationException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MessageSizeFetchingException.php
* Category: Exception
* Author: D. Malli
* Created: 24.02.23 17:55
* Updated: -
*
* Description: Exception thrown if fetching size for a message failed.
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MessageSizeFetchingException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MessageSizeFetchingException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MethodNotFoundException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MethodNotFoundException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MethodNotFoundException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: MethodNotSupportedException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 05.03.18 23:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class MethodNotSupportedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class MethodNotSupportedException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: RuntimeException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class NotSupportedCapabilityException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class NotSupportedCapabilityException extends Exception {
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: ProtocolNotSupportedException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class ProtocolNotSupportedException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class ProtocolNotSupportedException extends Exception {
}

View File

@@ -0,0 +1,91 @@
<?php
/*
* File: ResponseException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
use Webklex\PHPIMAP\Connection\Protocols\Response;
/**
* Class ResponseException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class ResponseException extends Exception {
/**
* Make a new ResponseException instance
* @param Response $response
* @param false|boolean $debug
* @param Exception|null $exception
*
* @return ResponseException
*/
public static function make(Response $response, bool $debug = false, ?Exception $exception = null): ResponseException {
$message = "Command failed to process:\n";
$message .= "Causes:\n";
foreach($response->getErrors() as $error) {
$message .= "\t- $error\n";
}
if(!$response->data()) {
$message .= "\t- Empty response\n";
}
if ($debug) {
$message .= self::debug_message($response);
}
foreach($response->getStack() as $_response) {
$exception = self::make($_response, $debug, $exception);
}
return new self($message."Error occurred", 0, $exception);
}
/**
* Generate a debug message containing all commands send and responses received
* @param Response $response
*
* @return string
*/
protected static function debug_message(Response $response): string {
$commands = $response->getCommands();
$message = "Commands send:\n";
if ($commands) {
foreach($commands as $command) {
$message .= "\t".str_replace("\r\n", "\\r\\n", $command)."\n";
}
}else{
$message .= "\tNo command send!\n";
}
$responses = $response->getResponse();
$message .= "Responses received:\n";
if ($responses) {
foreach($responses as $_response) {
if (is_array($_response)) {
foreach($_response as $value) {
$message .= "\t".str_replace("\r\n", "\\r\\n", "$value")."\n";
}
}else{
$message .= "\t".str_replace("\r\n", "\\r\\n", "$_response")."\n";
}
}
}else{
$message .= "\tNo responses received!\n";
}
return $message;
}
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* File: RuntimeException.php
* Category: Exception
* Author: M. Goldenbaum
* Created: 19.01.17 22:21
* Updated: -
*
* Description:
* -
*/
namespace Webklex\PHPIMAP\Exceptions;
use \Exception;
/**
* Class RuntimeException
*
* @package Webklex\PHPIMAP\Exceptions
*/
class RuntimeException extends Exception {
}