<?php use DirectAdmin\LetsEncrypt\Lib\Account; use DirectAdmin\LetsEncrypt\Lib\Challenges; use DirectAdmin\LetsEncrypt\Lib\Config; use DirectAdmin\LetsEncrypt\Lib\Domain; use DirectAdmin\LetsEncrypt\Lib\Logger; define('CRON', true); require_once dirname(__DIR__) . '/includes/bootstrap.php'; $log = new Logger(); $config = new Config(); $usersPath = '/usr/local/directadmin/data/users/'; // Get all users $users = scandir($usersPath); // Loop through all users foreach ($users as $user) { // Check if it's not some junk thingy if (in_array($user, ['.', '..']) || empty($user)) { continue; } // Create account object $account = new Account($user, null, $config->config('server')); // Is there a config file present? if (!$account->existsInStorage('config.json')) { $log->log('Skipped user ' . $account->getUsername()); continue; } $log->log('Processing user ' . $account->getUsername()); if (!$account->loadKeys()) { $log->log('No keys present at user ' . $account->getUsername()); continue;
<?php global $_POST, $_GET; use DirectAdmin\LetsEncrypt\Lib\Logger; require_once dirname(__DIR__) . '/vendor/autoload.php'; $servers = ['live' => 'https://acme-v01.api.letsencrypt.org/directory', 'staging' => 'https://acme-staging.api.letsencrypt.org/directory']; if (!defined('CRON')) { parse_str(getenv('QUERY_STRING'), $_GET); parse_str(getenv('POST'), $_POST); if (!isset($_SERVER['SESSION_SELECTED_DOMAIN']) || empty($_SERVER['SESSION_SELECTED_DOMAIN'])) { if ($_SERVER['RUNNING_AS'] != 'admin') { $log = new Logger(); $log->error('Please select a domain first at the DirectAdmin homepage.'); } } }