/home/wowzahosting.com/public_html/app/modules/Product/Api/Guest.php
* @throws \FOSSBilling\Exception
*/
public function get($data)
{
if (!isset($data['id']) && !isset($data['slug'])) {
throw new \FOSSBilling\Exception('Product ID or slug is missing');
}
$id = $data['id'] ?? null;
$slug = $data['slug'] ?? null;
$service = $this->getService();
if ($id) {
$model = $service->findOneActiveById($id);
} else {
$model = $service->findOneActiveBySlug($slug);
}
if (!$model instanceof \Model_Product) {
throw new \FOSSBilling\Exception('Product not found');
}
return $service->toApiArray($model);
}
/**
* Get paginated list of product categories.
*
* @return array
*/
public function category_get_list($data)
{
$data['status'] = 'enabled';
$service = $this->getService();
[$sql, $params] = $service->getProductCategorySearchQuery($data);
$per_page = $data['per_page'] ?? $this->di['pager']->getPer_page();
$pager = $this->di['pager']->getAdvancedResultSet($sql, $params, $per_page);
foreach ($pager['list'] as $key => $item) {
$category = $this->di['db']->getExistingModelById('ProductCategory', $item['id'], 'Product category not found');
$pager['list'][$key] = $this->getService()->toProductCategoryApiArray($category, true, $this->getIdentity());
Arguments
/home/wowzahosting.com/public_html/app/library/Api/Handler.php
}
$bb_mod = $this->di['mod']($mod);
$api->setDi($this->di);
$api->setMod($bb_mod);
$api->setIdentity($this->identity);
$api->setIp($this->di['request']->getClientAddress());
if ($bb_mod->hasService()) {
$api->setService($this->di['mod_service']($mod));
}
if (!method_exists($api, $method_name) || !is_callable([$api, $method_name])) {
$reflector = new ReflectionClass($api);
if (!$reflector->hasMethod('__call')) {
throw new FOSSBilling\Exception(':type API call :method does not exist in module :module', [':type' => ucfirst($this->type), ':method' => $method_name, ':module' => $mod], 740);
}
}
return $api->{$method_name}($arguments);
}
}
/home/wowzahosting.com/public_html/app/modules/Order/Controller/Client.php
}
public function register(\Box_App &$app)
{
$app->get('/order', 'get_products', [], static::class);
$app->get('/order/service', 'get_orders', [], static::class);
$app->get('/order/:id', 'get_configure_product', ['id' => '[0-9]+'], static::class);
$app->get('/order/:slug', 'get_configure_product_by_slug', ['slug' => '[a-z0-9-]+'], static::class);
$app->get('/order/service/manage/:id', 'get_order', ['id' => '[0-9]+'], static::class);
}
public function get_products(\Box_App $app)
{
return $app->render('mod_order_index');
}
public function get_configure_product_by_slug(\Box_App $app, $slug)
{
$api = $this->di['api_guest'];
$product = $api->product_get(['slug' => $slug]);
$tpl = 'mod_service' . $product['type'] . '_order';
if ($api->system_template_exists(['file' => $tpl . '.html.twig'])) {
return $app->render($tpl, ['product' => $product]);
}
return $app->render('mod_order_product', ['product' => $product]);
}
public function get_configure_product(\Box_App $app, $id)
{
$api = $this->di['api_guest'];
$product = $api->product_get(['id' => $id]);
$tpl = 'mod_service' . $product['type'] . '_order';
if ($api->system_template_exists(['file' => $tpl . '.html.twig'])) {
return $app->render($tpl, ['product' => $product]);
}
return $app->render('mod_order_product', ['product' => $product]);
}
/home/wowzahosting.com/public_html/app/library/Box/App.php
{
$this->debugBar['time']->startMeasure('executeShared', 'Reflecting module controller (shared mapping)');
$class = new $classname();
if ($class instanceof InjectionAwareInterface) {
$class->setDi($this->di);
}
$reflection = new ReflectionMethod($class::class, $methodName);
$args = [];
$args[] = $this; // first param always app instance
foreach ($reflection->getParameters() as $param) {
if (isset($params[$param->name])) {
$args[$param->name] = $params[$param->name];
} elseif ($param->isDefaultValueAvailable()) {
$args[$param->name] = $param->getDefaultValue();
}
}
$this->debugBar['time']->stopMeasure('executeShared');
return $reflection->invokeArgs($class, $args);
}
protected function execute($methodName, $params, $classname = null): string
{
$this->debugBar['time']->startMeasure('execute', 'Reflecting module controller');
$reflection = new ReflectionMethod(static::class, $methodName);
$args = [];
foreach ($reflection->getParameters() as $param) {
if (isset($params[$param->name])) {
$args[$param->name] = $params[$param->name];
} elseif ($param->isDefaultValueAvailable()) {
$args[$param->name] = $param->getDefaultValue();
}
}
$this->debugBar['time']->stopMeasure('execute');
return $reflection->invokeArgs($this, $args);
/home/wowzahosting.com/public_html/app/library/Box/App.php
$exc = new FOSSBilling\InformationException('The system is undergoing maintenance. Please try again later', [], 503);
$apiController = new Box\Mod\Api\Controller\Client();
$apiController->setDi($this->di);
return $apiController->renderJson(null, $exc);
} else {
return $this->render('mod_system_maintenance');
}
}
}
$this->debugBar['time']->startMeasure('sharedMapping', 'Checking shared mappings');
$sharedCount = count($this->shared);
for ($i = 0; $i < $sharedCount; ++$i) {
$mapping = $this->shared[$i];
$url = new Box_UrlHelper($mapping[0], $mapping[1], $mapping[3], $this->url);
if ($url->match) {
$this->debugBar['time']->stopMeasure('sharedMapping');
return $this->executeShared($mapping[4], $mapping[2], $url->params);
}
}
$this->debugBar['time']->stopMeasure('sharedMapping');
// this class mappings
$this->debugBar['time']->startMeasure('mapping', 'Checking mappings');
$mappingsCount = count($this->mappings);
for ($i = 0; $i < $mappingsCount; ++$i) {
$mapping = $this->mappings[$i];
$url = new Box_UrlHelper($mapping[0], $mapping[1], $mapping[3], $this->url);
if ($url->match) {
$this->debugBar['time']->stopMeasure('mapping');
return $this->execute($mapping[2], $url->params);
}
}
$this->debugBar['time']->stopMeasure('mapping');
$e = new FOSSBilling\InformationException('Page :url not found', [':url' => $this->url], 404);
/home/wowzahosting.com/public_html/app/library/Box/App.php
public function delete(string $url, string $methodName, ?array $conditions = [], string $class = null): void
{
$this->event('delete', $url, $methodName, $conditions, $class);
}
public function run(): string
{
$this->debugBar['time']->startMeasure('registerModule', 'Registering module routes');
$this->registerModule();
$this->debugBar['time']->stopMeasure('registerModule');
$this->debugBar['time']->startMeasure('init', 'Initializing the app');
$this->init();
$this->debugBar['time']->stopMeasure('init');
$this->debugBar['time']->startMeasure('checkperm', 'Checking access to module');
$this->checkPermission();
$this->debugBar['time']->stopMeasure('checkperm');
return $this->processRequest();
}
/**
* @param string $path
*/
public function redirect($path): never
{
$location = $this->di['url']->link($path);
header("Location: $location");
exit;
}
public function render($fileName, $variableArray = []): string
{
return 'Rendering ' . $fileName;
}
public function sendFile($filename, $contentType, $path): false|int
{
header("Content-type: $contentType");
/home/wowzahosting.com/public_html/app/index.php
// If HTTP error code has been passed, handle it.
if (!is_null($http_err_code)) {
switch ($http_err_code) {
case '404':
$e = new FOSSBilling\Exception('Page :url not found', [':url' => $url], 404);
echo $app->show404($e);
break;
default:
$http_err_code = intval($http_err_code);
http_response_code($http_err_code);
$e = new FOSSBilling\Exception('HTTP Error :err_code occurred while attempting to load :url', [':err_code' => $http_err_code, ':url' => $url], $http_err_code);
echo $app->render('error', ['exception' => $e]);
}
exit;
}
// If no HTTP error passed, run the app.
echo $app->run();
exit;