/** * Initialize Page */ public function init() { parent::init(); // Supply the module to the template $this->CPModule = ModuleRegistry::getModuleRegistry()->getModule("cpanel"); $this->smarty->assign_by_ref("CPModule", $this->CPModule); }
/** * Initialize View Server Page */ function init() { parent::init(); // Set URL Field $this->setURLField("server", $this->get['server']->getID()); if (isset($this->session['tab'])) { $this->smarty->assign("tab", $this->session['tab']); } // Store Server DBO in session $this->session['server_dbo'] =& $this->get['server']; // Set this page's Nav Vars $this->setNavVar("id", $this->get['server']->getID()); $this->setNavVar("hostname", $this->get['server']->getHostName()); // Setup the IP table $ipField = $this->forms['view_server_ips']->getField("ips"); $ipField->getWidget()->setServerID($this->get['server']->getID()); // Setup the Services table $hsField = $this->forms['view_server_services']->getField("services"); $hsField->getWidget()->setServerID($this->get['server']->getID()); // Provide the control panel config page if (null != ($moduleName = $this->get['server']->getCPModule())) { $registry = ModuleRegistry::getModuleRegistry(); $CPModule = $registry->getModule($moduleName); $this->smarty->assign("ServerConfigPage", $CPModule->getServerConfigPage()); } }
/** * Create Module Registry * * @param string $modulePath Path to the directory where modules are installed */ public static function createModuleRegistry($modulePath) { if (!isset(self::$registry)) { self::$registry = new ModuleRegistry($modulePath); } return self::$registry; }
/** * Initialize the Page */ function init() { parent::init(); $registry = ModuleRegistry::getModuleRegistry(); $this->asianpayModule = $registry->getModule("Asianpay"); $this->smarty->assign("accountid", $this->asianpayModule->getAccountid()); $this->smarty->assign("receiverid", $this->asianpayModule->getReceiverid()); $this->smarty->assign("secretcode", $this->asianpayModule->getSecretcode()); $this->smarty->assign("receiveremail", $this->asianpayModule->getReceiveremail()); }
/** * Initialize the Page */ function init() { parent::init(); // Load the form values with Module settings $registry = ModuleRegistry::getModuleRegistry(); $this->aaimModule = $registry->getModule("authorizeaim"); $this->smarty->assign("delimiter", $this->aaimModule->getDelimiter()); $this->smarty->assign("loginid", $this->aaimModule->getLoginID()); $this->smarty->assign("transactionkey", $this->aaimModule->getTransactionKey()); $this->smarty->assign("transactionurl", $this->aaimModule->getURL()); }
/** * Save Settings */ protected function save() { // Update settings in DB $module = ModuleRegistry::getModuleRegistry()->getModule("enom"); $module->setUsername($this->post['username']); $module->setPassword($this->post['password']); $module->setAPIURL($this->post['url']); $module->saveSettings(); $this->setMessage(array("type" => "[ENOM_CONFIG_SAVED]")); $this->reload(); }
/** * Initialize the Page */ function init() { parent::init(); // Load the form values with Module settings $registry = ModuleRegistry::getModuleRegistry(); $this->ppModule = $registry->getModule('paypalwps'); $this->smarty->assign("account", $this->ppModule->getAccount()); $this->smarty->assign("cartURL", $this->ppModule->getCartURL()); $this->smarty->assign("idToken", $this->ppModule->getIdToken()); $this->smarty->assign("currency", $this->ppModule->getCurrencyCode()); }
/** * Initialize the Table * * @param array $params Parameters from the {form_table} tag */ public function init($params) { global $conf; parent::init($params); // Build the table $registry = ModuleRegistry::getModuleRegistry(); foreach ($registry->getAllModules() as $modulename => $module) { // Put the row into the table $this->data[] = array("name" => $modulename, "configpage" => $module->getConfigPage(), "type" => $module->getType(), "description" => $module->getDescription()); } }
/** * Get Data * * @param array $config Field configuration * @return array value => description */ public function getData() { $registry = ModuleRegistry::getModuleRegistry(); $modules = isset($this->type) ? $registry->getModulesByType($this->type) : $registry->getAllModules(); $results = array(); foreach ($modules as $modulename => $module) { if ($module->isEnabled()) { $results[$modulename] = $modulename; } } return $results; }
/** * Get Data * * @param array $config Field configuration * @return array value => description */ public function getData() { $registry = ModuleRegistry::getModuleRegistry(); $modules = $registry->getModulesByType("payment_gateway"); $paymentModules = array(); foreach ($modules as $modulename => $module) { if ($module->isEnabled()) { $paymentModules[$modulename] = $modulename; } } return $paymentModules; }
/** * Get Data * * @param array $config Field configuration * @return array value => description */ function getData() { $registry = ModuleRegistry::getModuleRegistry(); $modules = $registry->getModulesByType("registrar"); $moduleNames = array(); foreach ($modules as $modulename => $module) { if ($module->isEnabled()) { $moduleNames[$modulename] = $module->getShortDescription(); } } return empty($moduleNames) ? array("[NO_REGISTRAR_MODULES]") : $moduleNames; }
/** * Initialize the Page */ function init() { parent::init(); $registry = ModuleRegistry::getModuleRegistry(); $this->ppModule = $registry->getModule('paypalwps'); $this->smarty->assign("account", $this->ppModule->getAccount()); $this->smarty->assign("cartURL", $this->ppModule->getCartURL()); $this->smarty->assign("currencyCode", $this->ppModule->getCurrencyCode()); $this->smarty->assign("orderid", $_SESSION['order']->getID()); // Dump the cart contents into a Smarty variable. The Paypal cart upload // form will be generated by the template. $this->smarty->assign("paypalCart", $this->dumpCart()); }
/** * Validate a Module * * Verifies that a module exists. * * @param string $data Field data * @return ModuleDBO Module DBO for this Module ID * @throws RecordNotFoundException */ public function validate($data) { global $conf; $data = parent::validate($data); try { $module = ModuleRegistry::getModuleRegistry()->getModule($data); if (isset($this->type) && $module->getType() != $this->type) { throw new FieldException("Invalid module type"); } } catch (ModuleDoesNotExistException $e) { throw new RecordNotFoundException("Module"); } return $module; }
/** * Initialize Page */ public function init() { parent::init(); // Access the registrar module for the selected TLD $moduleName = $this->get['tld']->getModuleName(); $registrar = ModuleRegistry::getModuleRegistry()->getModule($moduleName); $fqdn = $this->get['domain'] . '.' . $this->get['tld']->getTLD(); $this->smarty->assign("fqdn", $fqdn); if (!$registrar->checkAvailability($fqdn)) { $this->setTemplate("unavailable"); } else { $this->setURLField("domain", $this->get['domain']); $this->setURLField("tld", $this->get['tld']->getTLD()); } }
/** * Initialize the Page */ function init() { parent::init(); // Load the form values with Module settings $registry = ModuleRegistry::getModuleRegistry(); $this->rcModule = $registry->getModule('resellerclub'); $this->smarty->assign("rcusername", $this->rcModule->getUsername()); $this->smarty->assign("password", $this->rcModule->getPassword()); $this->smarty->assign("resellerid", $this->rcModule->getResellerID()); $this->smarty->assign("parentid", $this->rcModule->getParentID()); $this->smarty->assign("role", $this->rcModule->getRole()); $this->smarty->assign("langpref", $this->rcModule->getLangPref()); $this->smarty->assign("serviceurl", $this->rcModule->getServiceURL()); $this->smarty->assign("debug", $this->rcModule->getDebug()); $this->smarty->assign("defaultcustomerpassword", $this->rcModule->getDefaultCustomerPassword()); }
/** * Get Data * * @param array $config Field configuration * @return array value => description */ public function getData() { global $conf; $registry = ModuleRegistry::getModuleRegistry(); $modules = array_merge($registry->getModulesByType("payment_gateway"), $registry->getModulesByType("payment_processor")); $methods = array(); foreach ($modules as $modulename => $module) { if ($module->isEnabled()) { $methods[$modulename] = $module->getShortDescription(); } } if ($conf['order']['accept_checks']) { $methods['Check'] = "[CHECK_OR_MONEY_ORDER]"; } return $methods; }
/** * Validate a Payment Method * * To be valid, the payment method must exist and be enabled * * @param string $data Field data * @return mixed The value is not altered by this function * @throws InvalidChoiceException */ public function validate($data) { // Check is the only native option if ($data == "Check") { return $data; } // Search payment modules $registry = ModuleRegistry::getModuleRegistry(); $modules = array_merge($registry->getModulesByType("payment_gateway"), $registry->getModulesByType("payment_processor")); foreach ($modules as $moduleName => $module) { if ($data == $moduleName && $module->isEnabled()) { return $data; } } // No matches found throw new InvalidChoiceException(); }
/** * Initialize the Page */ function init() { parent::init(); if (!isset($_GET['tx'])) { // Expected a TX value from Paypal fatal_error("PSOReturnPage::init()", "Missing TX value. Make sure PDT is turned on for the store's Paypal account."); } $registry = ModuleRegistry::getModuleRegistry(); $this->ppModule = $registry->getModule('paypalwps'); // Process the PDT $pdtData = $this->ppModule->processPDT($_GET['tx']); $this->smarty->assign("paymentStatus", $pdtData['payment_status']); $this->smarty->assign("amount", $pdtData['payment_gross']); // Complete the order $_SESSION['order']->complete(); // Show receipt $this->gotoPage("receipt"); }
/** * Process a new service purchase */ protected function process() { // Verify that the user entered a domain name and TLD if (!isset($this->post['domainname'])) { throw new FieldMissingException("domainname"); } // Build an order item for the domain purchase $domainItem = new OrderDomainDBO(); $domainItem->setPurchasable($this->post['domaintld']); $domainItem->setTerm($this->post['domainterm']->getTermLength()); $domainItem->setDomainName($this->post['domainname']); $fqdn = sprintf("%s.%s", $this->post['domainname'], $this->post['domaintld']->getTLD()); // Access the registrar module for the selected TLD $moduleName = $this->post['domaintld']->getModuleName(); $registrar = ModuleRegistry::getModuleRegistry()->getModule($moduleName); switch ($this->post['domainoption']) { case "New": // Register a new domain // Check the domain availability if (!$registrar->checkAvailability($fqdn)) { throw new SWUserException("[ERROR_DOMAIN_NOT_AVAILABLE]", array($fqdn)); } $domainItem->setType("New"); break; case "Transfer": // Transfer a domain // Check the domain transfer-ability if (!$registrar->isTransferable($fqdn)) { throw new SWUserException("[ERROR_DOMAIN_TRANSFER_NO_DOMAIN]"); } $domainItem->setType("Transfer"); break; } // Add the domain item to the order $_SESSION['order']->addItem($domainItem); // Proceed to the cart page $this->gotoPage("cart"); }
/** * Update the Modules Enabled/Disabled flag */ function updateModules() { if (!isset($this->post['modules'])) { $this->post['modules'] = array(); } // Enable all the Modules with checks, disable the ones without $modules = ModuleRegistry::getModuleRegistry()->getAllModules(); foreach ($modules as $module) { if (!$module->isEnabled() && in_array($module, $this->post['modules'])) { // Enable this module $moduleDBO = load_ModuleDBO($module->getName()); $moduleDBO->setEnabled("Yes"); update_ModuleDBO($moduleDBO); } elseif ($module->isEnabled() && !in_array($module, $this->post['modules'])) { // Disable this module $moduleDBO = load_ModuleDBO($module->getName()); $moduleDBO->setEnabled("No"); update_ModuleDBO($moduleDBO); } } $this->setMessage(array("type" => "[MODULES_UPDATED]")); $this->reload(); }
/** * Execute Registration */ function executeRegistration() { // Load the registrar module and verify that it is enabled $this->serviceDBO = load_DomainServiceDBO($this->purchaseDBO->getTLD()); $registry = ModuleRegistry::getModuleRegistry(); $module = $registry->getModule($this->purchaseDBO->getModuleName()); // Set the time of purchase $this->purchaseDBO->setDate(DBConnection::format_datetime(time())); // Prepare contact info $contacts['admin'] = new ContactDBO($this->accountDBO->getContactName(), $this->accountDBO->getBusinessName(), $this->accountDBO->getContactEmail(), $this->accountDBO->getAddress1(), $this->accountDBO->getAddress2(), null, $this->accountDBO->getCity(), $this->accountDBO->getState(), $this->accountDBO->getPostalCode(), $this->accountDBO->getCountry(), $this->accountDBO->getPhone(), null, $this->accountDBO->getFax()); $contacts['tech'] = $contacts['admin']; $contacts['billing'] = $contacts['admin']; // Execute the registration at the Registrar $module->registerNewDomain($this->purchaseDBO->getDomainName(), $this->purchaseDBO->getTLD(), intval($this->purchaseDBO->getTerm() / 12), $contacts, $this->accountDBO); // Store the purchase in database add_DomainServicePurchaseDBO($this->purchaseDBO); // Registration complete $this->setMessage(array("type" => "[DOMAIN_REGISTERED]", "args" => array($this->purchaseDBO->getFullDomainName()))); $this->gotoPage("domains_browse", null, null); }
/** * Initialize the Page */ function init() { parent::init(); $registry = ModuleRegistry::getModuleRegistry(); $this->ppModule = $registry->getModule('paypalwps'); }
/** * Renew Domain * * Set the DomainServucePurchase date to the date provided in the form, then update * the DomainServicePurchaseDBO in the database */ function renew_domain() { $registry = ModuleRegistry::getModuleRegistry(); if (!($module = $registry->getModule($this->get['dpurchase']->getModuleName()))) { throw new SWException("Failed to load registrar module: " . $this->get['dpurchase']->getModuleName()); } // Update DBO $this->get['dpurchase']->setDate(DBConnection::format_datetime($this->post['date'])); $this->get['dpurchase']->setTerm($this->post['term'] ? $this->post['term']->getTermLength() : null); update_DomainServicePurchaseDBO($this->get['dpurchase']); // Update Registrar (but only if the "contact registrar" box was checked) if ($this->post['registrar']) { $module->renewDomain($this->get['dpurchase'], $this->get['dpurchase']->getTerm()); } // Success! $this->setMessage(array("type" => "[DOMAIN_RENEWED]")); $this->goback(); }
/** * Register this Domain * * @param AccountDBO $accountDBO The account registering this domain * @return boolean True for success */ function registerDomain($accountDBO) { // Verify that the registrar module is enabled $serviceDBO = load_DomainServiceDBO($this->getTLD()); $registry = ModuleRegistry::getModuleRegistry(); $module = $registry->getModule($serviceDBO->getModuleName()); // Make sure the domain is available if (!$module->checkAvailability($this->getFullDomainName())) { log_error("OrderDomainDBO::registerDomain()", "Attempted to register a domain that is not available: " . $this->getFullDomainName()); return false; } // Prepare contact info $contacts['admin'] = $this->getAdminContact(); $contacts['billing'] = $this->getBillingContact(); $contacts['tech'] = $this->getTechContact(); // Register the domain $module->registerNewDomain($this->getDomainName(), $this->getTLD(), intval($this->getTerm() / 12), $contacts, $accountDBO); return true; }
/** * Void Payment * * This method can only be used on payment's authorized through a payment_gateway * module. It attempts to contact the gateway and void payment for a previously * authorized transaction. * * @return boolean True for success */ function void() { global $conf; if (!($this->getModuleType() == "payment_gateway" && $this->getStatus() == "Authorized")) { // This payment cannot be voided return false; } $registry = ModuleRegistry::getModuleRegistry(); $module = $registry->getModule($this->getModule()); return $module->void($this); }
/** * Get Config Page * * @return string The name of the configuration page (from the global config var) */ function getConfigPage() { $registry = ModuleRegistry::getModuleRegistry(); return $registry->getModule($this->getName())->getConfigPage(); }
/** * Verify the Domain is Eligible to be Transfered */ function verifyTransferEligible() { $registry = ModuleRegistry::getModuleRegistry(); $module = $registry->getModule($this->post['servicetld']->getModuleName()); $fqdn = sprintf("%s.%s", $this->post['domainname'], $this->post['servicetld']->getTLD()); if (!$module->isTransferable($fqdn)) { // Domain is not eligible for transfer throw new SWUserException("[DOMAIN_NOT_TRANSFERABLE]", array($fqdn)); } // Domain can be transfered $this->purchaseDBO = new DomainServicePurchaseDBO(); $this->purchaseDBO->setPurchasable($this->post['servicetld']); $this->purchaseDBO->setDomainName($this->post['domainname']); $this->purchaseDBO->setSecret($this->post['secret']); $this->setMessage(array("type" => "[DOMAIN_IS_ELIGIBLE]", "args" => array($fqdn))); $this->setTemplate("transfer"); }
/** * Process a new service purchase */ protected function process() { // Build an order item for the hosting service $hostingItem = new OrderHostingDBO(); $hostingItem->setPurchasable($this->post['hostingservice']); $hostingItem->setTerm($this->post['hostingterm']->getTermLength()); switch ($this->post['domainoption']) { case "New": // Register a new domain for use with this hosting service // Verify that the user entered a domain name and TLD if (!isset($this->post['registerdomainname'])) { throw new FieldMissingException("registerdomainname"); } if (!isset($this->post['registerdomaintld'])) { throw new FieldMissingException("registerdomaintld"); } $fqdn = sprintf("%s.%s", $this->post['registerdomainname'], $this->post['registerdomaintld']->getTLD()); // Check the domain availability $moduleName = $this->post['registerdomaintld']->getModuleName(); $registrar = ModuleRegistry::getModuleRegistry()->getModule($moduleName); if (!$registrar->checkAvailability($fqdn)) { throw new SWUserException("[ERROR_DOMAIN_NOT_AVAILABLE]"); } // Place the domain name in the hosting item $hostingItem->setDomainName($fqdn); // Create another order item for the domain purchase $domainItem = new OrderDomainDBO(); $domainItem->setType("New"); $domainItem->setDomainName($this->post['registerdomainname']); $domainItem->setPurchasable($this->post['registerdomaintld']); $domainItem->setTerm($this->post['registerdomainterm']->getTermLength()); break; case "Transfer": // Transfer a domain for use with this hosting service // Verify that the user entered a domain name and TLD if (!isset($this->post['transferdomainname'])) { throw new FieldMissingException("transferdomainname"); } if (!isset($this->post['transferdomaintld'])) { throw new FieldMissingException("transferdomaintld"); } $fqdn = sprintf("%s.%s", $this->post['transferdomainname'], $this->post['transferdomaintld']->getTLD()); // Check the domain transfer-ability $moduleName = $this->post['registerdomaintld']->getModuleName(); $registrar = ModuleRegistry::getModuleRegistry()->getModule($moduleName); if (!$registrar->isTransferable($fqdn)) { throw new SWUserException("[ERROR_DOMAIN_TRANSFER_NO_DOMAIN]"); } // Place the domain name in the hosting item $hostingItem->setDomainName($fqdn); // Create another order item for the domain purchase $domainItem = new OrderDomainDBO(); $domainItem->setType("Transfer"); $domainItem->setDomainName($this->post['transferdomainname']); $domainItem->setPurchasable($this->post['transferdomaintld']); $domainItem->setTerm($this->post['transferdomainterm']->getTermLength()); break; case "InCart": // Use a domain that is in the customer's cart // Verify that the user selected a domain if (!isset($this->post['incartdomain'])) { throw new FieldMissingException("incartdomain"); } $hostingItem->setDomainName($this->post['incartdomain']); break; case "Existing": // Use an existing domain for this hosting service // Verify that the user entered a domain name if (!isset($this->post['existingdomainname'])) { throw new FieldMissingException("existingdomainname"); } $hostingItem->setDomainName($this->post['existingdomainname']); break; default: if ($this->post['hostingservice']->isDomainRequired()) { throw new FieldMissingException("domainoption"); } break; } // Add the item(s) to the order $_SESSION['order']->addItem($hostingItem); if (isset($domainItem)) { $_SESSION['order']->addItem($domainItem); } // Proceed to the cart page $this->gotoPage("cart"); }
/** * Remove Missing Module's from Database */ function removeMissingModules() { $modules = ModuleRegistry::getModuleRegistry()->getAllModules(); try { $moduleDBOArray = load_array_ModuleDBO(); foreach ($moduleDBOArray as $moduleDBO) { // Remove from the database any modules that are not installed anymore if (!array_key_exists($moduleDBO->getName(), $modules)) { delete_ModuleDBO($moduleDBO); } } } catch (DBNoRowsFoundException $e) { } }
/** * Check Out */ function checkout() { // The module must have been picked if this is not an existing customer if ($this->session['order']->getAccountType() == "New Account" && !isset($this->post['module'])) { throw new SWUserException("[YOU_MUST_SELECT_PAYMENT]"); } // If required, make sure that the TOS box was checked if ($this->conf['order']['tos_required'] && !isset($this->post['accept_tos'])) { throw new SWUserException("[YOU_MUST_ACCEPT_THE_TERMS_OF_SERVICE]"); } $this->session['order']->setRemoteIP(ip2long($_SERVER['REMOTE_ADDR'])); $this->session['order']->setDateCreated(DBConnection::format_datetime(time())); $this->session['order']->setAcceptedTOS($this->post['accept_tos'] == "true" ? "Yes" : "No"); /* if ( $this->session['order']->getAccountType() == "Existing Account" ) { // Send existing accounts off to the receipt page $this->session['order']->complete(); $this->gotoPage( "receipt" ); } */ // Register the new user if ($this->session['order']->getAccountType() == "New Account") { $order = $this->session['order']; $user_dbo = new UserDBO(); // User-defined data $user_dbo->setUsername($order->getUsername()); $user_dbo->setPassword($order->getPassword()); $user_dbo->setContactName($order->getContactName()); $user_dbo->setEmail($order->getContactEmail()); // Admin-defined data $user_dbo->setType("Client"); $user_dbo->setLanguage("english"); // could change to user-defined $user_dbo->setTheme("default"); add_UserDBO($user_dbo); // Add account info to accountDBO $account_dbo = new AccountDBO(); $account_dbo->setStatus("Active"); $account_dbo->setType("Individual Account"); $account_dbo->setBillingStatus("Bill"); $account_dbo->setBillingDay(1); $account_dbo->setBusinessName($order->getBusinessName()); $account_dbo->setContactName($order->getContactName()); $account_dbo->setContactEmail($order->getContactEmail()); $account_dbo->setAddress1($order->getAddress1()); $account_dbo->setAddress2($order->getAddress2()); $account_dbo->setCity($order->getCity()); $account_dbo->setState($order->getState()); $account_dbo->setCountry($order->getCountry()); $account_dbo->setPostalCode($order->getPostalCode()); $account_dbo->setPhone($order->getPhone()); $account_dbo->setMobilePhone($order->getMobilePhone()); $account_dbo->setFax($order->getFax()); $account_dbo->setUsername($order->getUsername()); add_AccountDBO($account_dbo); $this->session['order']->setAccountID($account_dbo->getID()); } // If the order does not have an ID already, save it to the database if ($this->session['order']->getID() == null) { add_OrderDBO($this->session['order']); } if ($this->session['review']['module'] == "Check") { // Record the promise to pay by check $checkPayment = new PaymentDBO(); $checkPayment->setOrderID($this->session['order']->getID()); $checkPayment->setAmount($this->session['order']->getTotal()); $checkPayment->setStatus("Pending"); $checkPayment->setDate(DBConnection::format_datetime(time())); $checkPayment->setType("Check"); add_PaymentDBO($checkPayment); // Goto the receipt page $this->session['order']->complete(); $this->gotoPage("receipt", null, "payByCheck=1"); } // Collect Payment $registry = ModuleRegistry::getModuleRegistry(); $paymentModule = $registry->getModule($this->post['module']); $checkoutPage = $paymentModule->getType() == "payment_processor" ? $paymentModule->getOrderCheckoutPage() : "ccpayment"; // Redirect to the module's checkout page $_SESSION['module'] = $paymentModule; $this->gotoPage($checkoutPage); }