Server IP : 184.154.167.98 / Your IP : 18.118.151.112 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/mesa/include/ |
Upload File : |
<?php require_once INCLUDE_DIR . 'class.email.php'; class EmailAjaxAPI extends AjaxController { function access() { global $thisstaff; if (!$thisstaff || !$thisstaff->isAdmin()) Http::response(403, 'Access Denied'); return true; } function stashFormData($id) { if (!($email=Email::lookup($id))) Http::response(404, 'Unknown Email'); $email->stashFormData($_POST ?: []); Http::response(201, 'Form Stashed Maybe!'); } function configureAuth($id, $type, $auth) { if (!($email=Email::lookup($id))) Http::response(404, 'Unknown Email'); if (!($account=$email->getAuthAccount($type))) Http::response(404, 'Unknown Authentication Type'); if (!($form=$account->getAuthConfigForm($auth, $_POST ?: null))) Http::response(404, 'Unknown Authentication Provider'); $info = $errors = []; if ($_POST && $account->saveAuth($auth, $form, $errors)) { if ($account->isOAuthAuth() && $account->shouldAuthorize()) { Http::response(201, JsonDataEncoder::encode([ 'redirect' => sprintf('emails.php?id=%d&do=autho&bk=%s', $email->getId(), $account->getBkId())]), 'application/json'); } else { Http::response(201, __('Successfully Updated Credentials.')); } } // Passible types are basic or oauth2 list($authtype, $provider) = explode(':', $auth); $template = sprintf('email-%sauth.tmpl.php', $authtype); include INCLUDE_DIR . "staff/templates/$template"; } /* * Delete the OAuth2 token */ function deleteToken($id, $type) { // Check to make sure the email exists if (!($email=Email::lookup($id))) Http::response(404, 'Unknown Email'); // Get the authentication account if (!($account=$email->getAuthAccount($type))) Http::response(404, 'Unknown Authentication Type'); // Destory the account config which will delete the token if ($account->destroyConfig()) Http::response(201, __('Token Deleted Successfully.')); // Couldn't delete the Token Http::response(404, 'Unable to delete token.'); } }