File manager - Edit - /usr/local/cpanel/base/frontend/jupiter/cpguard/branding.php
Back
<?php if (!isset($argc)) { die('Command line usage only'); } echo "cPGuard cPanel interface customization\n"; do { echo "Enter custom name : "; $name = get_cli_input(); if (preg_match('/[^a-zA-Z\d\s\_\-]+/', $name)) { echo "Unsupported characters in name\n"; } else { break; } } while (1); do { echo "Enter path to icon (png 48x48) : "; $icon = verified_image(get_cli_input()); if ($icon === NULL) { echo "Path does not point to a valid png file\n"; } else if ($icon === false) { //file resolution 48*48 png only echo "File dimenstions should be width 48px and height 48px\n"; } else { break; } } while (1); //do { // echo "Enter custom ID : "; // $id = get_cli_input(); // if (preg_match('/[^a-zA-Z\d\_\-]+/', $id)) { // echo "Special characters are not allowed\n"; // } else { // break; // } //} while (1); $id = preg_replace('/[^A-Za-z0-9\-]/', '', $name); echo "ID generated : " . $id.PHP_EOL; copy($icon, "/usr/local/cpanel/base/frontend/jupiter/cpguard/cpanel/cpg_cpplug.png"); $install_json = json_decode(file_get_contents("/usr/local/cpanel/base/frontend/jupiter/cpguard/cpanel/install.json"), true); $install_json[0]['name'] = $name; $install_json[0]['id'] = $id; exec("/usr/local/cpanel/scripts/uninstall_plugin /usr/local/cpanel/base/frontend/jupiter/cpguard/cpanel"); file_put_contents("/usr/local/cpanel/base/frontend/jupiter/cpguard/cpanel/install.json", json_encode($install_json)); exec("/usr/local/cpanel/scripts/install_plugin /usr/local/cpanel/base/frontend/jupiter/cpguard/cpanel"); echo"Brand customization complete... :)\n"; function get_cli_input() { $handle = fopen("php://stdin", "r"); $line = fgets($handle); fclose($handle); return trim($line); } function verified_image($image) { if(!file_exists($image)){ return NULL; } $image_info = getimagesize($image); if($image_info === false || $image_info['mime'] != 'image/png'){ return NULL; } if($image_info[0] == 48 && $image_info[1] == 48){ return $image; } return false; }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings