本文整理汇总了PHP中Domain类的典型用法代码示例。如果您正苦于以下问题:PHP Domain类的具体用法?PHP Domain怎么用?PHP Domain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Domain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveToClient
function moveToClient()
{
global $gbl, $sgbl, $login, $ghtml;
$login->loadAllObjects('ftpuser');
$l = $login->getList('ftpuser');
foreach ($l as $b) {
if (csb($b->parent_clname, 'web-')) {
list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
$d = new Domain(null, null, $parentname);
$d->get();
$b->parent_clname = $d->parent_clname;
$w = $d->getObject('web');
$b->directory = "{$w->docroot}/{$b->directory}";
$b->directory = remove_extra_slash($b->directory);
$b->setUpdateSubaction();
$b->write();
}
}
$login->loadAllObjects('mysqldb');
$l = $login->getList('mysqldb');
foreach ($l as $b) {
if (csb($b->parent_clname, 'domain-')) {
list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
$d = new Domain(null, null, $parentname);
$d->get();
$b->parent_clname = $d->parent_clname;
$b->setUpdateSubaction();
$b->write();
}
}
}
示例2: saveEmailAddress
/**
* @param string $emailAddress
* @return mixed if true integer otherwise null
*/
public static function saveEmailAddress($emailAddress)
{
$emailID = null;
$parseEmail = explode('@', strtolower(trim($emailAddress)));
if (count($parseEmail) == 2) {
$domain = Domain::model()->findByAttributes(array('name' => $parseEmail[1]));
if (!$domain) {
$domain = new Domain();
$domain->name = $parseEmail[1];
}
if ($domain->save()) {
$email = new Email();
$email->username = $parseEmail[0];
$email->domainID = $domain->ID;
if ($email->save()) {
$emailID = $email->ID;
} else {
if ($domain->isNewRecord) {
Domain::model()->deleteByPk($domain->ID);
}
}
}
}
return $emailID;
}
示例3: AddDomain
public static function AddDomain($uDomain)
{
global $sUser;
global $sDefaultIP;
global $user_ssh;
global $user_sftp;
global $database;
// Filter Domain
$uDomain = preg_replace("/[^a-z0-9_ .-]/i", "", $uDomain);
$uDomain = str_replace("www.", "", $uDomain);
$sDomain = str_replace("http://", "", $uDomain);
$result = $database->CachedQuery("SELECT * FROM domains WHERE `domain_name` = :Domain", array(':Domain' => $sDomain), 5);
if (empty($result)) {
// Validate path information
$sUser->sRootDir = '/home/' . $sUser->sUsername . '/';
$sValidate = new PathValidator($sUser->sRootDir . $sDomain);
if ($sValidate->ValidatePath($sUser->sRootDir)) {
// Connect to server
if (!$user_ssh->login($sUser->sUsername, $_SESSION['password'])) {
exit('User Connection To Server Failed!');
}
if (!$user_sftp->login($sUser->sUsername, $_SESSION['password'])) {
exit('User Connection To Server Failed!');
}
// Create folders for domain & logs
$sPublic = $sUser->sRootDir . $sDomain . "/public_html/";
$sLogs = $sUser->sRootDir . "/logs/";
$sCreateFolder = $user_ssh->exec("mkdir " . escapeshellarg($sUser->sRootDir . $sDomain) . ";mkdir " . escapeshellarg($sPublic) . ";mkdir " . escapeshellarg($sLogs) . ";");
// Generate configs
$sReplace = array("domain_name" => $sDomain, "username" => $sUser->sUsername);
$sConfig = file_get_contents('./includes/configs/nginx.default.conf');
foreach ($sReplace as $key => $value) {
$sConfig = str_replace($key, $value, $sConfig);
}
$sFileContent = $user_sftp->put('/etc/nginx/sites-enabled/' . $sDomain . '.conf', $sConfig);
$sTestConfig = $user_ssh->exec("nginx -t -c /etc/nginx/nginx.conf");
if (strpos($sTestConfig, 'failed') !== false) {
$sDeleteConfig = $user_ssh->exec("rm -rf /etc/nginx/sites-enabled/" . $sDomain . ".conf");
die("Seems to be a problem setting up the config.");
}
$sReload = $user_ssh->exec("/etc/init.d/nginx reload");
$sReload = $user_ssh->exec("/etc/init.d/pdns reload");
// Insert Domain Into Database
$sCreateDomain = new Domain(0);
$sCreateDomain->uName = $uDomain;
$sCreateDomain->uOwner = $sUser->sId;
$sCreateDomain->uActive = 1;
$sCreateDomain->InsertIntoDatabase();
// Add DNS Records
$sResultOne = $database->CachedQuery("INSERT INTO dns.domains (name, type) VALUES(:Domain, 'NATIVE')", array(':Domain' => $sDomain));
$sDomainId = $database->lastInsertId();
$sResultTwo = $database->CachedQuery("INSERT INTO dns.records (domain_id, name, content, type, ttl, prio) VALUES(:Id, :Domain, :IPAddress, 'A', '120', 'NULL')", array(':Id' => $sDomainId, ':Domain' => $sDomain, ':IPAddress' => $sDefaultIP->sValue));
return true;
} else {
return false;
}
} else {
return false;
}
}
示例4: saveDomain
private function saveDomain($domain, $grade, $image)
{
$model = new Domain();
$model->domain = $domain;
$model->image = $image . '.png';
$model->grade = $grade;
$model->save(false);
}
示例5: setDomainResults
/**
* Helper to set results for all the users on a domain to a specific value
*
* @param array $users Array of users (usernames)
* @param Domain $domain The domain
* @param int $val Value to set 1 or 0 ( Valid,Invalid )
* @param String $info Optional , can be used to give additional information about the result
*/
public function setDomainResults($users, Domain $domain, $val, $info = '')
{
if (!is_array($users)) {
$users = (array) $users;
}
foreach ($users as $user) {
$this->results[$user . '@' . $domain->getDomain()] = array('result' => $val, 'info' => $info);
}
}
示例6: OnDomainCreated
public function OnDomainCreated(Domain $domain)
{
if ($domain->IsManagedDNSEnabled) {
$userinfo = $this->DB->GetRow("SELECT * FROM users WHERE id=?", array($domain->UserID));
$SOA_owner = str_replace("@", ".", $userinfo["email"]);
$this->DB->Execute("INSERT INTO zones (\t`zone`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_owner`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_ttl`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_parent`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_serial`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_refresh`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_retry`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_expire`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`min_ttl`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`isupdated`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\r\n\t \t\t\t\t\t\t\t\t VALUES (?,?,'14400',?,?,'14400','7200','3600000','86400',0)", array($domain->GetHostName(), $SOA_owner, CONFIG::$NS1, date("Ymd") . "01"));
$zoneid = $this->DB->Insert_ID();
$this->DB->Execute("INSERT INTO records (id, zoneid, rtype, ttl, rpriority, rvalue, rkey) \r\n\t\t\t\t\t\t\t SELECT null, '{$zoneid}', rtype, ttl, rpriority, rvalue, rkey FROM records \r\n\t\t\t\t\t\t\t WHERE zoneid='0'\r\n\t\t\t\t\t\t\t ");
}
}
示例7: save
public function save()
{
try {
$model = new Domain();
$this->data->domain->entry = 'dom_' . $this->data->domain->entry;
$model->setData($this->data->domain);
$model->save();
$this->renderPrompt('information', 'OK', "editEntry('{$this->data->domain->entry}');");
} catch (\Exception $e) {
$this->renderPrompt('error', $e->getMessage());
}
}
示例8: webpage_select
public function webpage_select($domain_id)
{
//取出domain list
$this->load->library('kals_resource/Domain');
$all_domains = $this->domain->find_all();
$domain = new Domain($domain_id);
$all_webpages = $domain->get_webpages();
$title = 'webpage_select';
$this->load->view('admin_apps/header', array('title' => $title));
$this->load->view('admin_apps/domain_select', array('all_domains' => $all_domains, 'selected_domain' => $domain));
$this->load->view('admin_apps/webpage_select', array('all_webpages' => $all_webpages));
$this->load->view('admin_apps/footer');
}
示例9: getHTML
function getHTML($id)
{
$U = new mUserdata();
$U = $U->getUDValue("selectedDomain");
if ($U == null) {
$t = new HTMLTable(1);
$t->addRow("Sie haben keine Domain ausgewählt.<br /><br />Bitte wählen Sie eine Domain im Domain-Plugin, indem Sie auf das graue Kästchen in der Liste auf der rechten Seite klicken.");
return $t->getHTML();
}
$Domain = new Domain($U);
$Domain->loadMe();
$variables = array("domainTemplate", "contentTemplate", "naviTemplate", "pageTemplate");
$variables["domainTemplate"] = array("TITLE", "DESCRIPTION", "NAVIGATION", "HEADER", "PAGE");
$variables["contentTemplate"] = array("TEXT", "IMAGE", "DOWNLOADS", "CONTENTID", "HANDLER");
$variables["naviTemplate"] = array("LINK", "URL", "TEXT");
$variables["pageTemplate"] = array("HEADER", "CONTENT", "DOMAIN");
$variables["dlTemplate"] = array("TEXT", "DOWNLOADS");
#$this->setParser("html","Util::base64Parser");
if ($this->A == null and $id != -1) {
$this->loadMe();
}
if ($id == -1) {
$this->A = $this->newAttributes();
}
$gui = new HTMLGUI();
$gui->setObject($this);
$gui->setName("Template");
$TG = new TemplatesGUI();
$options = $TG->getAvailableCategories();
$gui->setType("templateType", "select");
$gui->setOptions("templateType", array_keys($options), array_values($options));
$gui->setInputJSEvent("templateType", "onchange", "CMSTemplate.updateVariables(this);");
$gui->setInputJSEvent("templateType", "onkeyup", "CMSTemplate.updateVariables(this);");
$gui->setLabel("templateType", "Typ");
$gui->setType("html", "TextEditor64");
$gui->setType("TemplateDomainID", "radio");
$gui->setLabel("TemplateDomainID", "Domain");
$gui->setOptions("TemplateDomainID", array("0", $U), array("alle", "nur " . $Domain->getA()->title));
$gui->hideAttribute("TemplateID");
$gui->setType("aktiv", "hidden");
$gui->setStandardSaveButton($this, "Templates");
$vars = "";
foreach ($variables as $k => $v) {
if (is_array($variables[$k])) {
$vars .= "<p id=\"{$k}Variables\" style=\"" . ($this->A->templateType == $k ? "" : "display:none;") . "\">%%%" . implode("%%%<br />%%%", $variables[$k]) . "%%%</p>";
}
}
$html = "\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tnew Draggable('TBVarsContainer',{handle:'TBVarsHandler', zindex: 2000});\n\t\t\t\toldVarSelected = '" . ($this->A->templateType != null ? $this->A->templateType : "null") . "';\n\t\t\t</script>\n\t\t\t<div \n\t\t\t\tstyle=\"position:absolute;z-index:2000;left:450px;width:200px;border-width:1px;border-style:solid;" . (isset($variables[$this->A->templateType]) ? "" : "display:none;") . "\"\n\t\t\t\tclass=\"backgroundColor0 borderColor1\"\n\t\t\t\tid=\"TBVarsContainer\"\n\t\t\t>\n\t\t\t<div class=\"cMHeader backgroundColor1\" id=\"TBVarsHandler\">Variablen:</div>\n\t\t\t<div>\n\t\t\t\t<p><small>Sie können folgende Variablen in Ihrem HTML verwenden (bitte beachen Sie Groß- und Kleinschreibung):</small></p>\n\t\t\t\t{$vars}\n\t\t\t</div>\n\t\t\t</div>";
return $html . $gui->getEditHTML();
}
示例10: doEdit
function doEdit()
{
if (isset($_POST['submit'])) {
$domain_id = $_POST['domain_id'];
$domainname = $_POST['domainname'];
$description = $_POST['description'];
$sector = $_POST['psector'];
$domain = new Domain();
$domain->domain_id = $domain_id;
$domain->domain_name = $domainname;
$domain->description = $description;
$domain->sector_id = $sector;
}
if ($domain_id == "") {
message('Domain ID is required!', "error");
redirect('index.php?view=edit&id=' . $domain_id);
} elseif ($domainname == "") {
message('Domain Name is required!', "error");
redirect('index.php?view=edit&id=' . $domain_id);
} elseif ($description == "") {
message('Description is required!', "error");
redirect('index.php?view=edit&id=' . $domain_id);
} elseif ($sector == "") {
message('Sector is required!', "error");
redirect('index.php?view=edit&id=' . $domain_id);
} else {
$domain->update($_GET['id']);
message('Domain infomation updated successfully!', "info");
redirect('index.php');
}
}
示例11: byDomain
public static function byDomain($domain)
{
if (Domain::is($domain)) {
return self::$DOMAIN_LAYOUTS[$domain];
}
return self::DEFAULT_LAYOUT;
}
示例12: dcp
public function dcp()
{
$domain = Domain::whereDomain(Request::getHttpHost())->first();
//$domain = Domain::whereDomain(Request::server("SERVER_NAME"))->first();
$cookie = Cookie::make('domain_hash', $domain->id);
return Redirect::to('/')->withCookie($cookie);
}
示例13: DiscardWhere
/**
* Discard all entities matching the supplied criterion.
*
* @param ICriterion $Criterion The criterion to discard by
*/
public function DiscardWhere(ICriterion $Criterion)
{
if (!$this->Domain->HasEntityMap($Criterion->GetEntityType())) {
throw $this->TypeMismatch('criterion', $Criterion->GetEntityType());
}
$this->DiscardedCriteria[spl_object_hash($Criterion)] = $Criterion;
}
示例14: Run
/**
* Executor
*
* @throws UpdateDomainContactTask_Exception
*/
public function Run($userid = null)
{
try {
$Factory = RegistryModuleFactory::GetInstance();
$Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
$Manifest = $Registry->GetManifest();
if ($userid && $this->Domain->UserID != $userid) {
throw new UpdateDomainContactAction_Exception(_("You don't have permissions for manage this domain"), UpdateDomainContactAction_Exception::DOMAIN_NOT_BELONGS_TO_USER);
}
$OldContact = $this->Domain->GetContact($this->contact_type);
if ($this->NewContact && $this->NewContact->UserID != $this->Domain->UserID) {
throw new UpdateDomainContactAction_Exception(_("You don't have permissions for using this contact"), UpdateDomainContactAction_Exception::CONTACT_NOT_BELONGS_TO_USER);
}
$trade = $Manifest->GetRegistryOptions()->ability->trade == '1';
if ($this->contact_type != CONTACT_TYPE::REGISTRANT || !$trade) {
try {
$Registry->UpdateDomainContact($this->Domain, $this->contact_type, $OldContact, $this->NewContact);
return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
} catch (Exception $e) {
throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
}
} else {
// Execute trade when:
// - Trade invoice is paid
// - Previous trade failed
if ($this->Domain->IncompleteOrderOperation == INCOMPLETE_OPERATION::DOMAIN_TRADE || $this->Invoice && $this->Invoice->Status == INVOICE_STATUS::PAID) {
$this->Domain->SetContact($this->NewContact, CONTACT_TYPE::REGISTRANT);
$this->Domain->IncompleteOrderOperation = null;
$extra["requesttype"] = "ownerChange";
try {
$trade = $Registry->ChangeDomainOwner($this->Domain, 1, $extra);
return $this->Domain->HasPendingOperation(Registry::OP_TRADE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
} catch (Exception $e) {
$this->Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_TRADE;
if ($this->Invoice) {
$this->Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
$this->Invoice->ActionFailReason = $e->getMessage();
}
throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
}
} else {
// Issue an invoice for trade operation
$invoiceid = $this->Db->GetOne("SELECT * FROM invoices WHERE status=? AND itemid=? AND purpose=?", array(INVOICE_STATUS::PENDING, $this->Domain->ID, INVOICE_PURPOSE::DOMAIN_TRADE));
if (!$invoiceid) {
$this->Domain->SetExtraField("NewRegistrantCLID", $this->NewContact->CLID);
DBDomain::GetInstance()->Save($this->Domain);
$Invoice = new Invoice(INVOICE_PURPOSE::DOMAIN_TRADE, $this->Domain->ID, $userid);
$Invoice->Description = sprintf(_("%s domain name trade"), $this->Domain->GetHostName());
$Invoice->Save();
$this->Invoice = $Invoice;
return UpdateDomainContactAction_Result::INVOICE_GENERATED;
} else {
throw new UpdateDomainContactAction_Exception(_("Another domain trade is already initiated"));
}
}
}
} catch (Exception $e) {
throw new UpdateDomainContactAction_Exception($e->getMessage());
}
}
示例15: attemptDetails
public function attemptDetails($id)
{
$attempt = Attempt::find($id);
$category = Category::find($attempt->category_id) ? Category::find($attempt->category_id)->name : 'N/A';
$similar_domains = Domain::where('url', 'LIKE', '%' . $attempt->url . '%')->get();
return View::make('admin.attempt_details')->with(compact('attempt', 'category', 'similar_domains'));
}