HEX
Server: LiteSpeed
System: Linux srv1.dhviews.com 5.14.0-570.23.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 24 11:27:16 EDT 2025 x86_64
User: bdedition (1723)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //opt/cpvendor/bin/packages
#!/usr/local/emps/bin/php
<?php

$ret['data'] = [];
$ret['metadata']['result'] = 'ok';

include_once(__DIR__.'/inc.php');

// Get the parameters for data
$args = getopt('o:', ['owner:']);

$owner = $args['owner'];
$owner = empty($args['o']) ? $args['owner'] : $args['o'];

foreach (glob($globals['plans_path'].'/*') as $file){
	
	$plan = @json_decode(file_get_contents($file), true);
	
	if(empty($plan)){
		continue;
	}
	
	$plan_owner = (empty($plan['plan_owner']) ? 'root' : $plan['plan_owner']);
	
	if(!empty($owner) && $plan_owner != $owner){
		continue;
	}
	
	$ret['data'][] = [
		'name' => $plan['slug'], 
		'owner' => $plan_owner
	];
	
}

echo json_encode($ret, JSON_PRETTY_PRINT)."\n";