本文整理汇总了PHP中Client::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::Load方法的具体用法?PHP Client::Load怎么用?PHP Client::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnStartForking
public function OnStartForking()
{
// Initialization
$Db = Core::GetDBInstance();
$DbDomain = DBDomain::GetInstance();
$Whois = JWhois::GetInstance();
// Grep TLDs
$data = $Db->GetAll("SELECT TLD FROM tlds WHERE modulename = 'Verisign' AND isactive = 1");
foreach ($data as $row) {
$tlds[] = "'{$row['TLD']}'";
}
$tlds = join(',', $tlds);
// Grep domains
$domain_data = $Db->GetAll("\r\n\t\t\t\tSELECT name, TLD FROM domains \r\n\t\t\t\tWHERE\r\n\t\t\t\t-- TLD in matching list\r\n\t\t\t\tTLD IN ({$tlds})\r\n\t\t\t\t-- Today is anniversary of registration\r\n\t\t\t\tAND ((MONTH(NOW()) = MONTH(start_date) AND DAY(NOW()) = DAY(start_date))\r\n\t\t\t\t-- Today is 28/02 and domain was registered 29/02 at leap year \r\n\t\t\t\tOR (MONTH(NOW()) = 2 AND DAY(NOW()) = 28 AND MONTH(start_date) = 2 AND DAY(start_date) = 29))\r\n\t\t\t");
foreach ($domain_data as $row) {
try {
$Domain = $DbDomain->LoadByName($row['name'], $row['TLD']);
$Client = Client::Load($Domain->UserID);
// Send notice
$emlvars = array('whois' => $Whois->Whois($Domain->GetHostName()), 'Client' => $Client);
mailer_send("wdrp_notice.eml", $emlvars, $Client->Email, $Client->Name);
} catch (Exception $e) {
Log::Log(sprintf("Failed to sent notice about %s. %s", "{$row['name']}.{$row['TLD']}", $e->getMessage()), E_ERROR);
}
}
}
示例2: __construct
function __construct()
{
parent::__construct();
$this->eppdrs = new EppDrs_Api_Client_Service(array("url" => "http://localhost/api/20111014", "key" => CONFIG::$API_KEY, "keyId" => CONFIG::$API_KEY_ID));
$client = Client::Load(42);
$this->eppdrs2 = new EppDrs_Api_Client_Service(array("url" => "http://localhost/api/20111014", "key" => $client->GetSettingValue(ClientSettings::API_KEY), "keyId" => $client->GetSettingValue(ClientSettings::API_KEY_ID)));
}
示例3: defaultAction
public function defaultAction()
{
if ($this->user->getType() == Scalr_Account_User::TYPE_SCALR_ADMIN) {
$this->response->page('ui/dashboard/admin.js');
} else {
if ($this->user->getType() == Scalr_Account_User::TYPE_FIN_ADMIN) {
self::loadController('Dashboard', 'Scalr_UI_Controller_Admin_Analytics')->defaultAction();
} else {
$loadJs = array('ui/dashboard/columns.js');
$scope = $this->request->getScope();
$cloudynEnabled = \Scalr::config('scalr.cloudyn.master_email') ? true : false;
$billingEnabled = \Scalr::config('scalr.billing.enabled') ? true : false;
$panel = $this->user->getDashboard($this->getEnvironmentId(true));
if (empty($panel['configuration'])) {
// default configurations
$client = Client::Load($this->user->getAccountId());
if ($client->GetSettingValue(CLIENT_SETTINGS::DATE_FARM_CREATED)) {
// old customer
if ($scope == 'account') {
$panel['configuration'] = array(array(array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5))), array(array('name' => 'dashboard.environments')));
if ($this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
array_unshift($panel['configuration'], array(array('name' => 'dashboard.billing')));
}
} else {
$panel['configuration'] = array(array(array('name' => 'dashboard.status'), array('name' => 'dashboard.addfarm')), array(array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5))), array(array('name' => 'dashboard.lasterrors', 'params' => array('errorCount' => 10))));
}
} else {
if ($scope == 'account') {
// new customer
$panel['configuration'] = array(array(array('name' => 'dashboard.newuser')), array(array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5))));
if ($this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
array_unshift($panel['configuration'][1], array('name' => 'dashboard.billing'));
}
} else {
// new customer
$panel['configuration'] = array(array(array('name' => 'dashboard.addfarm')), array(array('name' => 'dashboard.newuser')), array(array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5))));
}
}
$this->user->setDashboard($this->getEnvironmentId(true), $panel);
$panel = $this->user->getDashboard($this->getEnvironmentId(true));
}
// section for adding required widgets
if ($scope == 'environment') {
if ($cloudynEnabled && !in_array('cloudynInstalled', $panel['flags']) && !in_array('dashboard.cloudyn', $panel['widgets']) && !!$this->environment->isPlatformEnabled(SERVER_PLATFORMS::EC2)) {
if (!isset($panel['configuration'][0])) {
$panel['configuration'][0] = array();
}
array_unshift($panel['configuration'][0], array('name' => 'dashboard.cloudyn'));
$panel['flags'][] = 'cloudynInstalled';
$this->user->setDashboard($this->getEnvironmentId(), $panel);
$panel = $this->user->getDashboard($this->getEnvironmentId());
}
}
$panel = $this->fillDash($panel);
$conf = $this->getContainer()->config->get('scalr.load_statistics.connections.plotter');
$monitoringUrl = "{$conf['scheme']}://{$conf['host']}:{$conf['port']}";
$this->response->page('ui/dashboard/view.js', array('panel' => $panel, 'flags' => array('cloudynEnabled' => $cloudynEnabled, 'billingEnabled' => $billingEnabled), 'params' => array('monitoringUrl' => $monitoringUrl)), $loadJs, array('ui/dashboard/view.css', 'ui/analytics/analytics.css'));
}
}
}
示例4: run
function run()
{
$mediator = Scalr_Integration_ZohoCrm_Mediator::getDefaultMediator();
if (!$mediator) {
throw new Scalr_Integration_Exception("No default mediator configured");
}
switch ($this->operation) {
case self::OP_CREATE_CLIENT:
$client = Client::Load($this->params["clientId"]);
$mediator->addClient($client);
break;
case self::OP_UPDATE_CLIENT:
$client = Client::Load($this->params["clientId"]);
$mediator->updateClient($client, $this->params["skipRelations"]);
break;
case self::OP_DELETE_CLIENT:
$mediator->deleteClient($this->params["deletedClient"]);
break;
case self::OP_ADD_PAYMENT:
$client = Client::Load($this->params["clientId"]);
$mediator->addPayment($client, $this->params["invoiceId"]);
break;
default:
throw new Scalr_Integration_Exception("No handler for operation '{$this->operation}'");
}
}
示例5: RenewDomain
/**
* Renew domain
* @param $params = array(
* name string
* period int
* userId int User ID (In admin mode)
* noBilling bool Disable billing for domain opeartion (In admin mode)
* )
* @return object
*/
function RenewDomain($params = null)
{
// Check params
if ($this->access_mode == self::ACCESS_MODE_ADMIN) {
if (!$params["userId"]) {
throw new Exception(sprintf("'%s' parameter is required", "userId"));
}
} else {
// Reset user disabled params
$params["noBilling"] = false;
}
$user_id = $this->user_id ? $this->user_id : $params["userId"];
if (!$params["name"]) {
throw new Exception(sprintf("'%s' parameter is required", "name"));
}
$period = (int) $params["period"] ? (int) $params["period"] : 1;
list($name, $tld) = explode(".", $params["name"], 2);
$registry = $this->registry_factory->GetRegistryByExtension($tld);
$domain = DBDomain::GetInstance()->LoadByName($name, $tld);
$domain->Period = $period;
if (!$params["noBilling"]) {
// Check that enougth money
$client = Client::Load($user_id);
$balance = DBBalance::GetInstance()->LoadClientBalance($user_id);
$invoice = new Invoice(INVOICE_PURPOSE::DOMAIN_RENEW, $domain, $domain->UserID);
$invoice->Description = sprintf(_("%s domain name renewal for %s year(s)"), $domain->GetHostName(), $period);
$this->CheckEnoughtMoney($client, $balance, $invoice);
$invoice->ItemID = $domain->ID;
$this->MakePayment($client, $balance, $invoice);
}
$registry->RenewDomain($domain, array('period' => $domain->Period));
return new stdClass();
}
示例6: GetAmazonRDSClientObject
/**
* Return new instance of AmazonRDS object
*
* @return AmazonRDS
*/
private function GetAmazonRDSClientObject($region)
{
// Get ClientID from database;
$clientid = $this->DB->GetOne("SELECT clientid FROM farms WHERE id=?", array($this->FarmID));
// Get Client Object
$Client = Client::Load($clientid);
$RDSClient = AmazonRDS::GetInstance($Client->AWSAccessKeyID, $Client->AWSAccessKey);
$RDSClient->SetRegion($region);
return $RDSClient;
}
示例7: defaultAction
public function defaultAction()
{
if ($this->user->getType() == Scalr_Account_User::TYPE_SCALR_ADMIN) {
$this->response->page('ui/dashboard/admin.js');
} else {
$loadJs = array('ui/dashboard/columns.js');
$cloudynEnabled = \Scalr::config('scalr.cloudyn.master_email') ? true : false;
$billingEnabled = \Scalr::config('scalr.billing.enabled') ? true : false;
$panel = $this->user->getDashboard($this->getEnvironmentId());
if (empty($panel['configuration'])) {
// default configurations
$client = Client::Load($this->user->getAccountId());
if ($client->GetSettingValue(CLIENT_SETTINGS::DATE_FARM_CREATED)) {
// old customer
$panel['configuration'] = array(array(array('name' => 'dashboard.status')), array(array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5)), array('name' => 'dashboard.usagelaststat', 'params' => array('farmCount' => 5))), array(array('name' => 'dashboard.lasterrors', 'params' => array('errorCount' => 10))));
if ($this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
array_unshift($panel['configuration'][0], array('name' => 'dashboard.billing'));
}
} else {
// new customer
$panel['configuration'] = array(array(array('name' => 'dashboard.tutorapp')), array(array('name' => 'dashboard.tutordns')), array(array('name' => 'dashboard.tutorfarm'), array('name' => 'dashboard.announcement', 'params' => array('newsCount' => 5))));
if ($this->user->getType() == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
$panel['configuration'][1][] = array('name' => 'dashboard.billing');
}
}
$this->user->setDashboard($this->getEnvironmentId(), $panel);
$panel = $this->user->getDashboard($this->getEnvironmentId());
}
// section for adding required widgets
if ($cloudynEnabled && !in_array('cloudynInstalled', $panel['flags']) && !in_array('dashboard.cloudyn', $panel['widgets']) && !!$this->environment->isPlatformEnabled(SERVER_PLATFORMS::EC2)) {
if (!isset($panel['configuration'][0])) {
$panel['configuration'][0] = array();
}
array_unshift($panel['configuration'][0], array('name' => 'dashboard.cloudyn'));
$panel['flags'][] = 'cloudynInstalled';
$this->user->setDashboard($this->getEnvironmentId(), $panel);
$panel = $this->user->getDashboard($this->getEnvironmentId());
}
$panel = $this->fillDash($panel);
$this->response->page('ui/dashboard/view.js', array('panel' => $panel, 'flags' => array('cloudynEnabled' => $cloudynEnabled, 'billingEnabled' => $billingEnabled)), $loadJs, array('ui/dashboard/view.css'));
}
}
示例8: OnIssued
public function OnIssued(Invoice $Invoice)
{
if ($Invoice->Purpose != INVOICE_PURPOSE::BALANCE_DEPOSIT) {
Log::Log("BalanceInvoiceObserver::OnIssued(InvoiceID={$Invoice->ID})", E_USER_NOTICE);
try {
$Client = Client::Load($_SESSION["userid"] ? $_SESSION["userid"] : $Invoice->UserID);
if ($Client->GetSettingValue(ClientSettings::AUTO_PAY_FROM_BALANCE)) {
if ($Client->GetSettingValue(ClientSettings::AUTO_PAY_NO_RENEW) && $Invoice->Purpose == INVOICE_PURPOSE::DOMAIN_RENEW) {
return;
}
$Balance = DBBalance::GetInstance()->LoadClientBalance($Client->ID);
$Operation = $Balance->CreateOperation(BalanceOperationType::Withdraw, $Invoice->GetTotal());
$Operation->InvoiceID = $Invoice->ID;
$Balance->ApplyOperation($Operation);
$Invoice->MarkAsPaid(null);
}
} catch (Exception $e) {
Log::Log("BalanceInvoiceObserver::OnIssued() thrown exception: {$e->getMessage()}", E_USER_ERROR);
}
Log::Log("BalanceInvoiceObserver::OnIssued Successfully completed.", E_USER_NOTICE);
}
}
示例9: catch
}
$Domain = $Registry->NewDomainInstance();
$Domain->Name = $domain_name;
$Domain->UserID = $_SESSION['userid'];
try {
$res = $Registry->DomainCanBeRegistered($Domain)->Result;
} catch (Exception $e) {
throw new ApplicationException(sprintf(_("Cannot check availability of %s. %s")));
}
if ($res == true) {
throw new ApplicationException(sprintf(_("Domain %s not registered"), $Domain->GetHostName()));
}
// Save expiration date
$Domain->CreateDate = strtotime($expiredate);
// See if we have to issue invoice for this client
if (Client::Load($_SESSION['userid'])->GetSettingValue('bill_for_domain_preorder') != 1) {
$Domain->Status = DOMAIN_STATUS::AWAITING_PREREGISTRATION;
DBDomain::GetInstance()->Save($Domain);
} else {
$Domain->Status = DOMAIN_STATUS::AWAITING_PAYMENT;
$Domain = DBDomain::GetInstance()->Save($Domain);
$Invoice = new Invoice(INVOICE_PURPOSE::PREREGISTRATION_DROPCATCHING, $Domain->ID, $_SESSION['userid']);
$Invoice->Description = sprintf(_("Domain name %s pre-registration"), $Domain->GetHostName());
$invoices[] = $Invoice->Save()->ID;
}
if (count($err) == 0) {
if (count($invoices) != 0) {
$okmsg = _("Please pay the generated invoices below to add domains to pre-registration queue");
CoreUtils::Redirect("checkout.php?string_invoices=" . implode(",", $invoices));
} else {
$okmsg = _("Domain successfully added to pre-registration queue");
示例10: COUNT
/*
Query
*/
$statement = $database->prepare("SELECT COUNT(*) FROM tickets");
$statement->execute();
$totalNumRows = $statement->fetch(PDO::FETCH_NUM);
$statement = $database->prepare("SELECT SQL_CALC_FOUND_ROWS " . implode(",", $aColumns) . " FROM tickets " . $sWhere . " " . $sOrder . " " . $sLimit);
$statement->execute();
$statement2 = $database->prepare("SELECT FOUND_ROWS()");
$statement2->execute();
$filteredNumRows = $statement2->fetch(PDO::FETCH_NUM);
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
$rowCount = count($rows);
for ($i = 0; $i < $rowCount; $i++) {
$row = $rows[$i];
$color = "";
if ($q == -1) {
$color = " danger";
$rows[$i] = array($row["id"], Client::Load($row["cid"])->GetUsername(), DisplayDatetime($row["creation_date"]), DisplayLimited($row["description"]));
} else {
$sid = $row["sid"];
$status = $row["status"];
if ($sid == $me->GetID()) {
$color = " " . ($status == STATUS_OPENED ? "danger" : "success");
}
$rows[$i] = array($row["id"], $status == STATUS_OPENED ? "Opened" : "Closed", Client::Load($row["cid"])->GetUsername(), DisplayDatetime($row["creation_date"]), DisplayLimited($row["description"]), implode(", ", json_decode($row["tags"], true)), Staff::Load($sid)->GetUsername(), DisplayDatetime($row["closed_date"]));
}
$rows[$i]["DT_RowClass"] = "linkrow" . $color;
}
$output = array("sEcho" => intval($_GET['sEcho']), "iTotalRecords" => $totalNumRows[0], "iTotalDisplayRecords" => $filteredNumRows[0], "aaData" => $rows);
echo json_encode($output);
示例11: strlen
}
$phoneNumber = "+" . $phoneNumber;
if ($phoneNumber === $_REQUEST['From']) {
$correct = $staff;
break;
}
}
}
if ($correct === null) {
exit;
}
$lastTicket = Ticket::GetByStaffIDOrderSingle($staff->GetID(), "last_modified_date", "DESC");
if (!$lastTicket->IsValid()) {
exit;
}
$client = Client::Load($lastTicket->GetClientID());
if (!$client->IsValid()) {
exit;
}
$body = "Client Information\nID: " . $client->GetUsername() . "\nName: " . $client->GetName() . "\nCommunity: " . Building::GetCommunity($client->GetBuilding()) . "\nBuilding: " . $client->GetBuilding() . "\nRoom: " . $client->GetLocation();
$remaining = 255 - strlen($body);
if ($remaining > 50) {
$body .= "\nDescription: ";
$remaining = 255 - strlen($body);
$body .= DisplayLimited($lastTicket->GetDescription());
}
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Sms><?php
示例12:
}
}
// Post actions
if ($_POST)
{
if ($post_action == "del")
{
// Delete users
$i = 0;
foreach ((array)$post_id as $k=>$v)
{
$i++;
try
{
$Client = Client::Load($v);
$Client->Delete();
}
catch(Exception $e)
{
$err[] = $e;
}
Application::FireEvent('ClientDeleted', $Client);
}
if (!$err)
{
$okmsg = "{$i} users deleted";
CoreUtils::Redirect("users_view.php");
}
示例13: defaultAction
public function defaultAction()
{
$userType = $this->user->getType();
if ($userType == Scalr_Account_User::TYPE_FIN_ADMIN) {
self::loadController('Dashboard', 'Scalr_UI_Controller_Admin_Analytics')->defaultAction();
} else {
$js = ['ui/dashboard/columns.js'];
$css = ['ui/dashboard/view.css'];
$envId = $this->getEnvironmentId(true);
$panel = $this->user->getDashboard($envId);
$scope = $this->request->getScope();
$isNewCustomer = false;
//flags, parameters, additional stylesheets, etc
if ($scope === 'scalr') {
$flags = [];
$params = [];
} else {
$client = Client::Load($this->user->getAccountId());
$isNewCustomer = !$client->GetSettingValue(CLIENT_SETTINGS::DATE_FARM_CREATED);
$cloudynEnabled = \Scalr::config('scalr.cloudyn.master_email') ? true : false;
$billingEnabled = \Scalr::config('scalr.billing.enabled') ? true : false;
$plotter = $this->getContainer()->config->get('scalr.load_statistics.connections.plotter');
$monitoringUrl = $plotter['scheme'] . '://' . $plotter['host'] . ':' . $plotter['port'];
$css[] = 'ui/analytics/analytics.css';
$flags = ['cloudynEnabled' => $cloudynEnabled, 'billingEnabled' => $billingEnabled];
$params = ['monitoringUrl' => $monitoringUrl];
}
if (empty($panel['configuration'])) {
if ($scope === 'scalr') {
$panel['configuration'] = [[['name' => 'dashboard.scalrhealth']], [['name' => 'dashboard.gettingstarted']]];
} elseif ($isNewCustomer) {
if ($scope === 'account') {
$panel['configuration'] = [[['name' => 'dashboard.newuser']], [['name' => 'dashboard.announcement', 'params' => ['newsCount' => 8]]]];
if ($userType == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
array_unshift($panel['configuration'][1], ['name' => 'dashboard.billing']);
}
} else {
$panel['configuration'] = [[['name' => 'dashboard.addfarm']], [['name' => 'dashboard.newuser']], [['name' => 'dashboard.announcement', 'params' => ['newsCount' => 8]]]];
}
} else {
if ($scope === 'account') {
$panel['configuration'] = [[['name' => 'dashboard.announcement', 'params' => ['newsCount' => 8]]], [['name' => 'dashboard.environments']]];
if ($userType == Scalr_Account_User::TYPE_ACCOUNT_OWNER && $billingEnabled) {
array_unshift($panel['configuration'], [['name' => 'dashboard.billing']]);
}
} else {
$panel['configuration'] = [[['name' => 'dashboard.status'], ['name' => 'dashboard.addfarm']], [['name' => 'dashboard.announcement', 'params' => ['newsCount' => 8]]], [['name' => 'dashboard.lasterrors', 'params' => ['errorCount' => 10]]]];
}
}
$this->user->setDashboard($envId, $panel);
$panel = $this->user->getDashboard($envId);
}
//required widgets
$panelChanged = false;
if ($scope === 'scalr') {
if (!in_array('dashboard.scalrhealth', $panel['widgets'])) {
if (!isset($panel['configuration'][0])) {
$panel['configuration'][0] = [];
}
array_unshift($panel['configuration'][0], ['name' => 'dashboard.scalrhealth']);
$panelChanged = true;
}
} elseif ($scope === 'environment') {
if ($cloudynEnabled && !in_array('cloudynInstalled', $panel['flags']) && !in_array('dashboard.cloudyn', $panel['widgets']) && !!$this->environment->isPlatformEnabled(SERVER_PLATFORMS::EC2)) {
if (!isset($panel['configuration'][0])) {
$panel['configuration'][0] = [];
}
array_unshift($panel['configuration'][0], ['name' => 'dashboard.cloudyn']);
$panel['flags'][] = 'cloudynInstalled';
$panelChanged = true;
}
}
if ($panelChanged) {
$this->user->setDashboard($envId, $panel);
$panel = $this->user->getDashboard($envId);
}
$panel = $this->fillDash($panel);
$this->response->page('ui/dashboard/view.js', ['panel' => $panel, 'flags' => $flags, 'params' => $params], $js, $css);
}
}
示例14: object
<?
require_once('src/prepend.inc.php');
$display["TLDs"] = $TLDs;
$Client = Client::Load($_SESSION["userid"]);
// Complete domain registration (postpaid)
if ($req_action == "complete")
{
Log::Log("domain_reg.php?action=complete", E_USER_NOTICE);
// Get domain info
try
{
$Domain = DBDomain::GetInstance()->Load($req_id);
}
catch(Exception $e)
{
Log::Log("Cannot get domain object (id={$req_id}), error: {$e->getMessage()}", E_USER_WARNING);
$errmsg = $e->getMessage();
}
Log::Log("DomainName = {$Domain->GetHostName()}", E_USER_NOTICE);
if (!$errmsg && $Domain->UserID != $_SESSION['userid'])
{
Log::Log("UserID != Domain->UserID", E_USER_WARNING);
$errmsg = _("You don't have permissions to manage this domain");
}
// Check domain status
if (!$errmsg && ($Domain->Status != DOMAIN_STATUS::PENDING || $Domain->IncompleteOrderOperation != INCOMPLETE_OPERATION::DOMAIN_CREATE))
示例15: GetClient
/**
*
* @return Client
*/
public function GetClient()
{
if (!$this->client) {
$this->client = Client::Load($this->clientId);
}
return $this->client;
}