Пример #1
0
                    include "../include/ghost.php";
                    $db_settings = databaseSettings($_POST['db_id']);
                    if ($db_settings !== false) {
                        ghostSetDatabase($_REQUEST['id'], $db_settings);
                        $message = "Database settings should be set properly.";
                    } else {
                        $message = "Failed to find database settings for the specified database service.";
                    }
                } else {
                    if ($_POST['action'] == "channeldb" && isset($_POST['db_id'])) {
                        include "../include/database.php";
                        include "../include/channel.php";
                        $db_settings = databaseSettings($_POST['db_id']);
                        if ($db_settings !== false) {
                            channelSetDatabase($_REQUEST['id'], $db_settings);
                            $message = "Database settings should be set properly.";
                        } else {
                            $message = "Failed to find database settings for the specified database service.";
                        }
                    }
                }
            }
        }
        header("Location: service.php?id={$service_id}&message=" . urlencode($message));
    }
    $service = getService($service_id);
    $parameters = getServiceParams($service_id);
    get_page("service", "admin", array('id' => $service_id, 'service' => $service, 'parameters' => $parameters, 'message' => $message));
} else {
    header("Location: ./");
}
Пример #2
0
function getServiceParam($service_id, $key)
{
    global $db, $config;
    $service_id = escape($service_id);
    $key = escape($key);
    //check parameter cache
    if (isset($GLOBALS['paramcache'][$service_id])) {
        if (isset($GLOBALS['paramcache'][$service_id][$key])) {
            return $GLOBALS['paramcache'][$service_id][$key];
        } else {
            return false;
        }
    }
    //if slave, then cache all service parameters in global variable to make it faster
    if ($config['slave_enabled']) {
        getServiceParams($service_id);
        if (isset($GLOBALS['paramcache'][$service_id][$key])) {
            return $GLOBALS['paramcache'][$service_id][$key];
        } else {
            return false;
        }
    } else {
        $result = $db->query("SELECT v FROM service_params WHERE service_id = '{$service_id}' AND k = '{$key}'");
        $row = $result->fetch_array();
        $result->close();
        if ($row) {
            return $row[0];
        } else {
            return false;
        }
    }
}