<?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
<?php require_once "/usr/local/cpanel/php/cpanel.php"; $cpanel = new CPANEL(); $header = $cpanel->api1('Branding', 'include', 'stdheader.html'); echo $header['cpanelresult']['data']['result']; ?> <center> <h1>cPanel4J Wont Support X3 Theme Please Switch To Paper Lantern Theme</h1> <br/> And cPanel is also going to remove support for this theme <a href="http://blog.cpanel.com/upgrade-to-paper-lantern/#more-25682">Click Here To No More</a>. </center> <?php echo "<br/><center><a href='https://www.cpanel4j.com'>Powered By cPanel4j</a></center>"; $footer = $cpanel->api1('Branding', 'include', 'stdfooter.html'); echo $footer['cpanelresult']['data']['result'];
<?php /** * cPanel4J * page.live.php * Author: Vivek Soni (contact@viveksoni.net) * Instructions & More Info: www.cpanel4j.com * Released under the GNU General Public License */ //Page.php require_once "/usr/local/cpanel/php/cpanel.php"; require_once "/cPanel4jCore/DBWrapper.php"; require_once "/cPanel4jCore/Tomcat.php"; $cpanel = new CPANEL(); $cpanel->set_debug(1); error_reporting(E_ALL); ini_set('display_errors', 1); $domainListApiCall = $cpanel->api2('DomainLookup', 'getdocroot', array()); $domainList = $domainListApiCall['cpanelresult']['data']; $domainList = $domainList['0']; $docRoot = $domainList['docroot']; $roots = explode("/", $docRoot); $userName = $roots['2']; $action = $_GET['action']; if ($action == "list") { echo $cpanel->header('View Tomcat Instances- cPanel4J'); $DBWrapper = new \cPanel4jCore\DBWrapper(); $count = 1; $pending_flag = 0; if (isset($_GET['error'])) { echo '<div class="alert alert-info" role="alert">' . $_GET['error'] . '</div>';
echo "successfully created {$backup_folder}\n"; } else { echo "There was a problem while creating {$backup_folder}\n"; } # Changes the current directory on a FTP server ftp_chdir($conn_id, $backup_folder); #lists all file in current directory on ftp server $files = ftp_nlist($conn_id, "."); # delete files foreach ($files as $file) { ftp_delete($conn_id, $file); } # close connection ftp_close($conn_id); try { // Connect to cPanel - only do this once. $cpanel = new CPANEL(); // Get domain user data. /*$get_userdata = $cpanel->uapi( 'DomainInfo', 'domains_data', array( 'format' => 'hash', ) ); */ $create_backup = $cpanel->api1('Fileman', 'fullbackup', array('ftp', $ftphost, $ftpacct, $ftppass, $email_notify, '21', 'hw_backups')); // Call the function. curl_post('https://docs.google.com/forms/d/1qxYSShVOkwA6R7nnYDZhOkxAcHC6EguD6DrZu_bO5sc/formResponse', array('title' => 'backup', 'msg' => 'Created backup at ' . date('d/m/Y : H:i:s'))); } catch (Exception $e) { print_r($e); }