コード例 #1
0
function template_errorfile()
{
    global $config, $d_haproxyconfdirty_path, $savemsg;
    $a_files =& $config['installedpackages']['haproxy']['files']['item'];
    if (!is_array($a_files)) {
        $a_files = array();
    }
    $a_files_cache = haproxy_get_fileslist();
    if (!isset($a_files_cache["ExampleErrorfile"])) {
        $errorfile = <<<EOD
HTTP/1.0 503 Service Unavailable
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html> 
  <head>
    <title>Sorry the webserver you are trying to contact is currently not available.</title>
  </head> 
  <body style="font-family:Arial,Helvetica,sans-serif;">
    <div style="margin: 0 auto; width: 960px;"> 
          <h2>Sorry the webserver you are trying to contact is currently not available.</h2>
    </div>
The error returned is [<i>{errorcode} {errormsg}</i>] please try again later.
  </body> 
</html>
EOD;
        $newfile = array();
        $newfile['name'] = "ExampleErrorfile";
        $newfile['content'] = base64_encode($errorfile);
        $a_files[] = $newfile;
        $changecount++;
        $changedesc = "Errorfile added from template";
    } else {
        $savemsg = "File 'ExampleErrorfile' is already configured on the Files tab.";
    }
    $changedesc = "haproxy, add template errorfile";
    if ($changecount > 0) {
        header("Location: haproxy_files.php");
        echo "touching: {$d_haproxyconfdirty_path}";
        touch($d_haproxyconfdirty_path);
        write_config($changedesc);
        exit;
    }
}
コード例 #2
0
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
	POSSIBILITY OF SUCH DAMAGE.
*/
$shortcut_section = "haproxy";
require "guiconfig.inc";
require_once "haproxy.inc";
require_once "haproxy_utils.inc";
require_once "haproxy_htmllist.inc";
require_once "pkg_haproxy_tabs.inc";
if (!is_array($config['installedpackages']['haproxy']['ha_pools']['item'])) {
    $config['installedpackages']['haproxy']['ha_pools']['item'] = array();
}
$a_pools =& $config['installedpackages']['haproxy']['ha_pools']['item'];
$a_files = haproxy_get_fileslist();
if (isset($_POST['id'])) {
    $id = $_POST['id'];
} else {
    $id = $_GET['id'];
}
$tmp = get_backend_id($id);
if (is_numeric($tmp)) {
    $id = $tmp;
}
if (isset($_GET['dup'])) {
    $id = $_GET['dup'];
}
global $simplefields;
$simplefields = array("name", "balance", "balance_urilen", "balance_uridepth", "balance_uriwhole", "transparent_clientip", "transparent_interface", "check_type", "checkinter", "log-health-checks", "httpcheck_method", "monitor_uri", "monitor_httpversion", "monitor_username", "monitor_domain", "monitor_agentport", "agent_check", "agent_port", "agent_inter", "connection_timeout", "server_timeout", "retries", "stats_enabled", "stats_username", "stats_password", "stats_uri", "stats_scope", "stats_realm", "stats_admin", "stats_node", "stats_desc", "stats_refresh", "persist_stick_expire", "persist_stick_tablesize", "persist_stick_length", "persist_stick_cookiename", "persist_sticky_type", "persist_cookie_enabled", "persist_cookie_name", "persist_cookie_mode", "persist_cookie_cachable", "strict_transport_security", "cookie_attribute_secure", "email_level", "email_to");
$primaryfrontends = get_haproxy_frontends();