function OnAppElasticUsers_ConfigOptions() { $data = new stdClass(); $data->errors = $data->warnings = new stdClass(); $module = new OnAppElasticUsersModule(); $data->lang = $module->loadLang()->Admin; if (!file_exists(ONAPP_WRAPPER_INIT)) { $data->error = $data->lang->WrapperNotFound . ' ' . ROOTDIR . '/includes/wrapper'; goto end; } $serverGroup = isset($_GET['servergroup']) ? $_GET['servergroup'] : (int) $GLOBALS['servergroup']; $sql = 'SELECT srv.`id`, srv.`name`, srv.`ipaddress`, srv.`secure`, srv.`hostname`, srv.`username`, srv.`password` FROM `tblservers` AS srv LEFT JOIN `tblservergroupsrel` AS rel ON srv.`id` = rel.`serverid` LEFT JOIN `tblservergroups` AS grp ON grp.`id` = rel.`groupid` WHERE grp.`id` = :servergroup AND srv.`type` = ":moduleName" AND srv.`disabled` = 0'; $sql = str_replace(':servergroup', $serverGroup, $sql); $sql = str_replace(':moduleName', OnAppElasticUsersModule::MODULE_NAME, $sql); $res = full_query($sql); if (mysql_num_rows($res)) { $data->servers = new stdClass(); while ($serverConfig = mysql_fetch_object($res)) { # error if server IP or hostname are not set if (empty($serverConfig->ipaddress) && empty($serverConfig->hostname)) { $data->error .= $serverConfig->name . ': ' . $data->lang->HostAddressNotFound . PHP_EOL; continue; } $serverConfig->password = decrypt($serverConfig->password); $module = new OnAppElasticUsersModule($serverConfig); $data->servers->{$serverConfig->id} = null; $data->servers->{$serverConfig->id} = $module->getData(); $data->servers->{$serverConfig->id}->Name = $serverConfig->name; } if ($data->servers) { # get additional data # timezones $data->TimeZones = file_get_contents(__DIR__ . '/includes/php/tzs.json'); $data->TimeZones = json_decode($data->TimeZones); $data->productOptions = $GLOBALS['packageconfigoption'] ?: []; if (!empty($data->productOptions[1])) { $data->productSettings = json_decode($data->productOptions[24])->{$data->productOptions[1]}; $data->productSettingsJSON = htmlspecialchars($GLOBALS['packageconfigoption'][24]); } } } else { $data->error = $data->lang->ServersNone; } end: return ['' => ['Description' => $module->buildHTML($data)]]; }