本文整理汇总了PHP中VirtualHost类的典型用法代码示例。如果您正苦于以下问题:PHP VirtualHost类的具体用法?PHP VirtualHost怎么用?PHP VirtualHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VirtualHost类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
//$this->setCountry("Earth");
$this->setEndpointUrl("http://maps.google.com/maps/geo?");
//API Key will be collected from the database in future
if (!($vhost = VirtualHost::getCurrentVirtualHost())) {
$this->setAPIKey("0");
} else {
$this->setAPIKey($vhost->getGoogleAPIKey());
}
}
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:11,代码来源:GeocoderGoogleGlobal.php
示例2: setAllowedContext
/**
* Set allowed context of concrete directive
*/
protected function setAllowedContext()
{
$this->allowedContext = [VirtualHost::getFullName()];
}
开发者ID:ltd-beget,项目名称:apache-configurator,代码行数:7,代码来源:VHostCGIPrivs.php
示例3: getDefaultNetwork
/**
* Get the default network
*
* @return object A Network object, NEVER returns null.
*
* @static
* @access public
*/
public static function getDefaultNetwork()
{
$retval = null;
$vhost = VirtualHost::getCurrentVirtualHost();
if ($vhost == null) {
$vhost = VirtualHost::getDefaultVirtualHost();
}
return $vhost->getDefaultNetwork();
}
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:17,代码来源:Network.php
示例4: removeParkedDomain
/**
* Remove a parked domain from the current virtual host
* @param string $domainName Parked domain name to remove
* @return boolean
*/
public function removeParkedDomain($domainName)
{
// Load parked domain object
$vhost = new VirtualHost($this->db);
$vhost->domainName = $domainName;
$rc = $vhost->get();
if ($rc === false) {
Log::error('Unknown parked domain');
return false;
}
// Make sure this is a parked domain and not a virtual host
if ($vhost->parkedUnder == '') {
Log::error('The domain \'' . $vhost->domainName . '\' is not a parked domain, but a virtual host');
return false;
}
Log::debug('Delete parked domain: ' . $domainName);
// Full home directory path
$home = $this->home . '/' . $this->unixName;
// Delete etc
$etcDir = $home . '/etc/' . $domainName;
if (is_dir($etcDir)) {
exec('/usr/bin/rm -rf ' . escapeshellarg($etcDir) . ' 2>/dev/null');
}
// Delete mail
$mailDir = $home . '/mail/' . $domainName;
if (is_dir($mailDir)) {
exec('/usr/bin/rm -rf ' . escapeshellarg($mailDir) . ' 2>/dev/null');
}
// Delete NSD configuration and zone files
if (is_file(Config::read('nsd|directoryConfD') . '/' . $domainName . '.conf')) {
unlink(Config::read('nsd|directoryConfD') . '/' . $domainName . '.conf');
}
if (is_file(Config::read('nsd|directoryConfD') . '/' . $domainName . '.zone')) {
unlink(Config::read('nsd|directoryConfD') . '/' . $domainName . '.zone');
}
// Delete vhost directory
if (is_link('/etc/dovecot/vhost/' . $domainName)) {
unlink('/etc/dovecot/vhost/' . $domainName);
}
// Delete Apache virtual host file
if (is_file(Config::read('apache|directoryConfD') . '/' . $domainName . '.conf')) {
unlink(Config::read('apache|directoryConfD') . '/' . $domainName . '.conf');
}
// Delete Apache log files
if (is_file('/var/log/httpd/' . $domainName)) {
unlink('/var/log/httpd/' . $domainName);
}
if (is_file('/var/log/httpd/' . $domainName . '-bytes_log')) {
unlink('/var/log/httpd/' . $domainName . '-bytes_log');
}
if (is_file('/var/log/httpd/' . $domainName . '-ssl_log')) {
unlink('/var/log/httpd/' . $domainName . '-ssl_log');
}
// Remove from database
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHostMx` WHERE VirtualHost_ID=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting mail exchange server from the database table: virtualHostMx');
return false;
}
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHostNs` WHERE VirtualHost_ID=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting name server from the database table: virtualHostNs');
return false;
}
// Prepare statement
$preped = $this->db->conn->prepare("DELETE FROM `virtualHost` WHERE Id=:id");
// Bind parameter
$preped->bindParam(':id', $vhost->id);
// Execute prepared statement
$rc = $preped->execute();
if ($rc === false) {
Log::error('Error while deleting parked domain from the database table: virtualHost');
return false;
}
return true;
}
开发者ID:noumenia,项目名称:aetolos,代码行数:91,代码来源:virtualhost.inc.php
示例5: die
*
* @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
* @license GNU GPL v3.0
* @package aetolos
* @subpackage parkeddomainsmanager
*/
// No direct access - loadable only
if (!defined('AET_IN')) {
die("No Access");
}
// Check for parameter
if (!isset($cmdParameters['modify-virtualhost'])) {
Log::error('Missing parameter');
exit(9);
}
$vhost = new VirtualHost($db);
$vhost->domainName = $cmdParameters['modify-virtualhost'];
$rc = $vhost->get();
if ($rc === false) {
Log::error('Unknown virtual host');
exit(9);
}
if (isset($cmdParameters['add-pdomain'])) {
// Set parameters - name server(s)
if (isset($cmdParameters['ns']) && is_array($cmdParameters['ns'])) {
$ns = $cmdParameters['ns'];
} elseif (isset($cmdParameters['ns'])) {
$ns = array($cmdParameters['ns']);
} else {
$ns = array();
}
开发者ID:noumenia,项目名称:aetolos,代码行数:31,代码来源:parkeddomainsmanager.inc.php
示例6: implode
// Convert array back to string
$d = implode(':', $d);
}
// Convert array back to string
$data = implode("\n", $data);
// Save to passwd file
$rc = file_put_contents($passwd, $data);
if ($rc === false) {
return false;
} else {
return true;
}
}
Log::debug('Import virtual host from: ' . $cmdParameters['import']);
// Create virtual host object
$vhost = new VirtualHost($db);
// Set parameters - home directory and unix name
$vhost->home = trim(tarReadFile($cmdParameters['import'], 'homedir_paths', true));
$pos = mb_strrpos($vhost->home, '/');
if ($pos === false) {
Log::error('Could not parse home directory from the file: homedir_paths');
exit(9);
}
$vhost->unixName = mb_substr($vhost->home, $pos + 1);
$vhost->home = mb_substr($vhost->home, 0, $pos);
// Load generic config
$cpConfig = trim(tarReadFile($cmdParameters['import'], 'cp/' . $vhost->unixName));
// Set parameters - domain name
$rc = preg_match('/DNS=(.*)/', $cpConfig, $matches);
if ($rc === 1 && isset($matches[1]) && $matches[1] != '') {
$vhost->domainName = $matches[1];
开发者ID:noumenia,项目名称:aetolos,代码行数:31,代码来源:import.inc.php
示例7: die
/**
* Aetolos - Add a new virtual host
*
* Add a new virtual host and generate all required configuration files.
*
* @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
* @license GNU GPL v3.0
* @package aetolos
* @subpackage addvirtualhost
*/
// No direct access - loadable only
if (!defined('AET_IN')) {
die("No Access");
}
// Create virtual host object
$vhost = new VirtualHost($db);
// Set parameters - domain name
$vhost->domainName = $cmdParameters['add-virtualhost'];
// Set parameters - ip address
if (isset($cmdParameters['ipaddress'])) {
$vhost->ipAddress = $cmdParameters['ipaddress'];
}
// Set parameters - home directory
if (isset($cmdParameters['home'])) {
$vhost->home = $cmdParameters['home'];
}
// Set parameters - administrator/owner email address
if (isset($cmdParameters['admin-email'])) {
$vhost->adminEmail = $cmdParameters['admin-email'];
}
// Set parameters - account quota
开发者ID:noumenia,项目名称:aetolos,代码行数:31,代码来源:addvirtualhost.inc.php
示例8: setDefaultVirtualHost
/**
* Set as the default server
*
* @param VirtualHost $vhost
*
* @return bool True on success, false on failure
*/
public function setDefaultVirtualHost(VirtualHost $vhost)
{
$db = AbstractDb::getObject();
$vhostIdStr = $db->escapeString($vhost->getId());
// Init values
$_retVal = false;
if ($vhostIdStr != VirtualHost::getDefaultVirtualHost()->getId()) {
$sql = "UPDATE server SET default_virtual_host = '{$vhostIdStr}';\n";
$_retVal = $db->execSqlUpdate($sql, false);
$this->refresh();
}
return $_retVal;
}
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:20,代码来源:Server.php
示例9: die
/**
* Aetolos - Remove an existing virtual host
*
* Completely remove an existing virtual host from the system, optionally remove home directory.
*
* @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
* @license GNU GPL v3.0
* @package aetolos
* @subpackage removevirtualhost
*/
// No direct access - loadable only
if (!defined('AET_IN')) {
die("No Access");
}
// Create virtual host object
$vhost = new VirtualHost($db);
// Set parameters
if (isset($cmdParameters['keep-home'])) {
$keepHome = true;
} else {
$keepHome = false;
}
// Delete from database
$rc = $vhost->delete($cmdParameters['remove-virtualhost'], $keepHome);
if ($rc === false) {
echo "[ERROR] Error while deleting virtual host.\n";
exit(9);
}
// Postfix
$feature = new Postfix();
$rc = $feature->exportVirtualHosts($db);
开发者ID:noumenia,项目名称:aetolos,代码行数:31,代码来源:removevirtualhost.inc.php
示例10: define
*/
/* This section deals with PATHs used in URLs and local content
* BASE_SSL_PATH should be used to enter SSL mode (if available)
* BASE_NON_SSL_PATH should be used to break out of SSL mode of when we
* explicitely do not want someting to be referenced over http
* BASE_URL_PATH should be used in all other cases to avoid needless SSL warning
*
* */
require_once 'classes/VirtualHost.php';
/**
* Check for SSL support
*/
try {
$vhost = VirtualHost::getCurrentVirtualHost();
if ($vhost == null) {
$vhost = VirtualHost::getDefaultVirtualHost();
}
if ($vhost->isSSLAvailable()) {
/**
* @ignore
*/
define("SSL_AVAILABLE", true);
} else {
/**
* @ignore
*/
define("SSL_AVAILABLE", false);
}
} catch (Exception $e) {
//Leave this catch here, in case the schema update hasn't yet been done.
define("SSL_AVAILABLE", false);
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:31,代码来源:path_defines_url_content.php
示例11: Exception
// Init ALL smarty values
$smarty->assign('DEPRECATEDisSuperAdmin', false);
$smarty->assign('selectNetworkUI', null);
/**
* Define user security levels for the template
*
* These values are used in the default template of WiFoDog but could be used
* in a customized template to restrict certain links to specific user
* access levels.
*/
$smarty->assign('DEPRECATEDisSuperAdmin', $currentUser && $currentUser->DEPRECATEDisSuperAdmin());
/*
* Header JavaScripts
*/
// Add Google Maps JavaScript (must set config values)
if (!($vhost = VirtualHost::getCurrentVirtualHost())) {
throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname"));
}
$html_headers = "<script src='http://maps.google.com/maps?file=api&v=2&&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>";
$html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>";
$html = null;
/*
* Main content
*/
// Set section of Smarty template
$smarty->assign('sectionMAINCONTENT', true);
// Set network selector
$preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork();
//$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();"));
$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();"));
$smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:31,代码来源:hotspots_map.php
示例12: die
*
* @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
* @license GNU GPL v3.0
* @package aetolos
* @subpackage emailmanager
*/
// No direct access - loadable only
if (!defined('AET_IN')) {
die("No Access");
}
// Check for parameter
if (!isset($cmdParameters['modify-virtualhost'])) {
Log::error('Missing parameter');
exit(9);
}
$vhost = new VirtualHost($db);
$vhost->domainName = $cmdParameters['modify-virtualhost'];
$rc = $vhost->get();
if ($rc === false) {
Log::error('Unknown virtual host');
exit(9);
}
$emailManager = new EmailManager($vhost);
if (isset($cmdParameters['add-email'])) {
if (!isset($cmdParameters['password'])) {
if (isset($cmdParameters['password-file'])) {
if (!is_file($cmdParameters['password-file'])) {
Log::error('Error while opening the password file');
exit(9);
}
$cmdParameters['password'] = file_get_contents($cmdParameters['password-file']);
开发者ID:noumenia,项目名称:aetolos,代码行数:31,代码来源:emailmanager.inc.php
示例13: elseif
*/
/**
* Load common include file
*/
require_once 'admin_common.php';
require_once 'classes/Node.php';
require_once 'classes/Network.php';
require_once 'classes/AbstractGeocoder.php';
require_once 'classes/MainUI.php';
require_once 'classes/Server.php';
$ui = MainUI::getObject();
$ui->setTitle(_("Hotspot location map"));
if (!empty($_REQUEST['node_id'])) {
$node = Node::getObject($_REQUEST['node_id']);
// Add Google Maps JavaScript ( must set config values )
$html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=" . VirtualHost::getCurrentVirtualHost()->getGoogleAPIKey() . "\" type=\"text/javascript\"></script>";
$ui->appendHtmlHeadContent($html_headers);
// Create HTML body
$html = _("Click anywhere on the map to extract the GIS location, then click on the button to save the data.") . "<br>";
$html .= "<div id=\"map_frame\"></div>\n";
$html .= "<input type='button' value='" . _("Use these coordinates") . "' onClick='setLocationInOriginalWindow();'>\n";
$ui->addContent('main_area_middle', $html);
if (($gisLocation = $node->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} elseif (($gisLocation = $node->getNetwork()->getGisLocation()) !== null && $gisLocation->getLatitude() != null) {
} else {
$html .= "<div class='error'>" . _("Error: You need to set the GIS coordinates of the center of your network") . "</div\n";
$gisLocation = null;
}
if ($gisLocation !== null) {
//pretty_print_r($gisLocation);
$lat = $gisLocation->getLatitude();
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:31,代码来源:hotspot_location_map.php
示例14: setAllowedContext
/**
* Set allowed context of concrete directive
*/
protected function setAllowedContext()
{
$this->allowedContext = [ConfigurationFile::SERVER_CONFIG, VirtualHost::getFullName(), Directory::getFullName(), ConfigurationFile::HTACCESS];
}
开发者ID:ltd-beget,项目名称:apache-configurator,代码行数:7,代码来源:RewriteOptions.php
示例15: isDefaultVirtualHost
/**
* Is this vhost the server's default?
*
* @return bool True or false
*/
public function isDefaultVirtualHost()
{
// Init values
$retVal = false;
if (VirtualHost::getDefaultVirtualHost()->getId() == $this->getId()) {
$retVal = true;
}
return $retVal;
}
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:14,代码来源:VirtualHost.php
示例16: GetRelationQueries
/**
* Placeholder for backward compatibility (iTop <= 2.1.0)
* in case an extension attempts to redefine this function...
*/
public static function GetRelationQueries($sRelCode)
{
return parent::GetRelationQueries($sRelCode);
}
开发者ID:leandroborgeseng,项目名称:bhtm,代码行数:8,代码来源:model.itop-virtualization-mgmt.php
示例17: GetRelationQueries
public static function GetRelationQueries($sRelCode)
{
switch ($sRelCode) {
case "impacts":
$aRels = array();
return array_merge($aRels, parent::GetRelationQueries($sRelCode));
break;
case 'depends on':
$aRels = array("Hypervisor" => array("sQuery" => "SELECT Hypervisor WHERE farm_id = :this->id", "bPropagate" => true, "iDistance" => 10));
return array_merge($aRels, parent::GetRelationQueries($sRelCode));
break;
default:
return parent::GetRelationQueries($sRelCode);
}
}
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:15,代码来源:model.itop-virtualization-mgmt.php
注:本文中的VirtualHost类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论