<?php // Get timezone offset from client if (isset($_GET['timezone'])) { $timezone = intval($_GET['timezone']); } if (!isset($_GET['timezone'])) { die('<script>window.location.href = "?timezone=" + new Date().getTimezoneOffset();</script>'); } require_once '/usr/local/cpanel/php/cpanel.php'; require_once 'settings.php'; $cpanel = new CPANEL(); if (strpos($_SERVER['REMOTE_USER'], '@') === false) { // cPanel users, give them access to their domains $domains_res = $cpanel->uapi('Email', 'list_mail_domains'); $domains = array(); foreach ($domains_res['cpanelresult']['result']['data'] as $data) { $domains[] = $data['domain']; } if (empty($domains)) { die("No domains"); } $access = array('domain' => $domains); } else { // Webmail users, give them access to their email addresses $addresses_res = $cpanel->uapi('Email', 'list_pops'); $addresses = array(); foreach ($addresses_res['cpanelresult']['result']['data'] as $data) { $addresses[] = $data['email']; } if (empty($addresses)) {
ini_set('display_startup_errors', 1); error_reporting(-1); /** * Created by PhpStorm. * PHP Version 5 * @author NeXt I.T. - Mikel Bitson <*****@*****.**> * @license http://opensource.org/licenses/MIT MIT License * @link http://github-for-cpanel.mbitson.com * Date: 5/19/2015 */ // Default plugin path define('GHCP_PLUGIN_PATH', '/usr/local/cpanel/base/frontend/paper_lantern/github_for_cpanel/'); // Include the composer autoloader & live.php file for integration require_once GHCP_PLUGIN_PATH . 'vendor/autoload.php'; // I would like to do this in a better way... // but for now I've got to load in the cPanel // userdata in a .live.php file and make it // globally accessible. // Save user's data to the global var require_once "/usr/local/cpanel/php/cpanel.php"; // Create new cpanel object to integrate. $cpanel = new \CPANEL(); // Request this user's domain info. $userdata = $cpanel->uapi('DomainInfo', 'domains_data', array('format' => 'hash')); // Select only the main domain $userdata = $userdata['cpanelresult']['result']['data']['main_domain']; // Init our plugin $plugin = new GHCP\Plugin($cpanel); // Output header, connect, page, footer, disconnect $plugin->run(); // End of file index.php