Example #1
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'domain', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Simple'), 'label' => 'WWW.', 'class' => 'form-control www-input', 'placeholder' => 'yourdomain'));
     $this->addElement('select', 'tlds', array('label' => $translate->_('Tld'), 'decorators' => array('Simple'), 'class' => 'form-control www-select'));
     $this->getElement('tlds')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(DomainsTlds::getList());
     $this->addElement('submit', 'check', array('label' => $translate->_('GO')));
 }
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'domainame form-control', 'placeholder' => 'mycompany'));
     $this->addElement('select', 'tld', array('decorators' => array('Bootstrap'), 'class' => 'tld'));
     $this->getElement('tld')->setAllowEmpty(false)->setMultiOptions(DomainsTlds::getList(true));
     $this->addElement('submit', 'check', array('label' => $translate->_('Check'), 'class' => 'btn btn-default chkdomain'));
 }
Example #3
0
 /**
  * Save data
  * @param $customerID
  * @return Doctrine_Record
  */
 public static function add_domain($domainame, $tldid, $isavailable, $customerid = null, $authinfo = null)
 {
     $domain = new DomainsBulk();
     $data = DomainsTlds::find($tldid);
     $domain['domain'] = $domainame;
     $domain['startingdate'] = date('Y-m-d H:i:s');
     $domain['tld_id'] = $tldid;
     $domain['sessionid'] = Zend_Session::getId();
     $domain['isavailable'] = $isavailable;
     $domain['customer_id'] = $customerid;
     $domain['authinfo'] = $authinfo;
     $domain['price'] = $isavailable ? $data['registration_price'] : $data['transfer_price'];
     $domain['cost'] = $isavailable ? $data['registration_cost'] : $data['transfer_cost'];
     return $domain->trySave();
 }
Example #4
0
 /**
  * Save all the data
  * 
  * 
  * @param array $params
  */
 public static function saveAll(array $params, $locale)
 {
     if (!empty($params['tld_id'])) {
         $tld = self::find($params['tld_id']);
     } else {
         $tld = new DomainsTlds();
     }
     $tld['server_id'] = $params['server_id'];
     $tld['registration_price'] = $params['registration_price'];
     $tld['renewal_price'] = $params['renewal_price'];
     $tld['transfer_price'] = $params['transfer_price'];
     $tld['registration_cost'] = $params['registration_cost'];
     $tld['renewal_cost'] = $params['renewal_cost'];
     $tld['transfer_cost'] = $params['transfer_cost'];
     $tld['registrars_id'] = $params['registrars_id'];
     $tld['ishighlighted'] = $params['ishighlighted'];
     $tld['isrefundable'] = isset($params['isrefundable']) ? intval($params['isrefundable']) : 0;
     $tld['tax_id'] = $params['tax_id'];
     $tld['isp_id'] = Shineisp_Registry::get('ISP')->isp_id;
     if ($tld->trySave()) {
         if (is_numeric($tld['tld_id'])) {
             $record = self::getTranslation($tld['tld_id'], $locale);
             if ($record === false) {
                 $record = new DomainsTldsData();
             }
             // Save the page translation references
             $record->name = $params['name'];
             $record->description = $params['description'];
             $record->tags = $params['tags'];
             $record->tld_id = $tld['tld_id'];
             $record->language_id = $locale;
             $record->save();
         }
     }
     return $tld['tld_id'];
 }
 /**
  * Get all include for a tranche id
  * 
  * @param integer $trancheid
  */
 public static function getIncludeForTrancheId($trancheid)
 {
     $includes = Doctrine_Query::create()->select()->from('ProductsTranchesIncludes i')->where('i.tranche_id = ?', $trancheid)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $data = array();
     foreach ($includes as $include) {
         if ($include['type'] == 'domains') {
             if (!array_key_exists('domains', $data)) {
                 $data['domains'] = array();
             }
             $tlds = DomainsTlds::getbyID($include['include_id']);
             $name = $tlds['DomainsTldsData'][0]['name'];
             $data['domains'][] = $name;
         }
     }
     return $data;
 }
Example #6
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'domain', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Domain'), 'description' => $translate->_('Write down the name of the domain without any extension, white spaces, or symbols.'), 'class' => 'form-control updatechkdomain'));
     $this->addElement('select', 'tld_id', array('label' => $translate->_('TLD'), 'description' => $translate->_('Select the TLD from the list'), 'decorators' => array('Bootstrap'), 'class' => 'form-control updatechkdomain'));
     $this->getElement('tld_id')->setAllowEmpty(false)->setMultiOptions(DomainsTlds::getList())->setRequired(true);
     $this->addElement('select', 'registrars_id', array('label' => $translate->_('Registrar'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('registrars_id')->setAllowEmpty(true)->setMultiOptions(Registrars::getList());
     // Domain Ownership
     $this->addElement('select', 'owner', array('label' => $translate->_('Owner'), 'description' => $translate->_("If the domain owner's profile is not set, the domain customer information will be used."), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('owner')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true));
     $this->addElement('select', 'admin', array('label' => $translate->_('Admin-C'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('admin')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true));
     $this->addElement('select', 'tech', array('label' => $translate->_('Tech'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('tech')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true));
     $this->addElement('select', 'billing', array('label' => $translate->_('Billing'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('billing')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true));
     $this->addElement('text', 'creation_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Creation date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'expiring_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'authinfocode', array('filters' => array('StringTrim'), 'label' => $translate->_('AUTHINFO CODE'), 'description' => $translate->_('Write down the Authinfo code in order to transfer the domain to this ISP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('checkbox', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Auto renewal'), 'class' => 'form-control'));
     $this->addElement('select', 'customer_id', array('label' => $translate->_('Customer'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('customer_id')->setAllowEmpty(false)->setMultiOptions(Customers::getList())->setRequired(true);
     //
     $note = $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Private Notes'), 'class' => 'col-lg-12 form-control'));
     $note = $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Message'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $status = $this->addElement('select', 'status_id', array('label' => 'Status', 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     // DNS SECTION
     // ==============
     $this->addElement('text', 'subdomain', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subdomain'), 'class' => 'form-control'));
     $this->addElement('text', 'target', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Target'), 'class' => 'form-control'));
     $this->addElement('select', 'zone', array('label' => $translate->_('Zone'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('zone')->setAllowEmpty(false)->setMultiOptions(Dns_Zones_Types::getZones());
     $status = $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('domains'));
     $save = $this->addElement('submit', 'save', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn'));
     $id = $this->addElement('hidden', 'domain_id');
 }
Example #7
0
 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     $ns = new Zend_Session_Namespace();
     $uri = $this->getRequest()->getParam('uri');
     if (!empty($uri)) {
         $tld = DomainsTlds::getbyTld($uri, $ns->langid);
         // If the translation has been not found load the default language
         if (empty($tld['DomainsTldsData'][0])) {
             $tld = DomainsTlds::getbyTld($uri);
         }
     } else {
         $this->_redirect('index');
     }
     // Set the page title
     $this->view->headTitle()->prepend($this->translator->_('.%s domain registration', $tld['DomainsTldsData'][0]['name']));
     $this->view->headMeta()->setName('keywords', $this->translator->translate('domain registration') . ", " . $this->translator->_('%s domain', "." . $tld['DomainsTldsData'][0]['name']));
     $this->view->headMeta()->setName('description', $this->translator->_('.%s domain registration', $tld['DomainsTldsData'][0]['name']));
     $form = new Default_Form_DomainsinglecheckerForm(array('action' => '/domainschk/check', 'method' => 'post'));
     $form->populate(array('tld' => $tld['tld_id']));
     $this->view->form = $form;
     $this->view->tld = $tld;
     $this->view->tldslist = DomainsTlds::getList();
 }
Example #8
0
 public function checkdomainAction()
 {
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $request = $this->getRequest();
     try {
         if ($request->getPost()) {
             $params = $request->getPost();
             $available = Domains::check_availability($params['name'], $params['tld']);
             $data = DomainsTlds::getAllInfo($params['tld']);
             $tldName = $data['WhoisServers']['tld'];
             // Create the domain name
             $domain = $params['name'] . "." . $tldName;
             if ($available) {
                 $price = $data['registration_price'];
                 // Get the price of the product
             } else {
                 $price = $data['transfer_price'];
             }
             if (!empty($data['Taxes']['percentage']) && is_numeric($data['Taxes']['percentage'])) {
                 $formatPrice = $currency->toCurrency($price * ($data['Taxes']['percentage'] + 100) / 100, array('currency' => Settings::findbyParam('currency')));
             } else {
                 $formatPrice = $currency->toCurrency($price, array('currency' => Settings::findbyParam('currency')));
             }
             // Format the price number
             $strprice = $translator->translate('just') . " {$formatPrice}!";
             // Create the message
             $mex = $available ? $translator->translate('The domain is available for registration') : $translator->translate("The domain is unavailable for registration, but if you are the domain owner, you can transfer it!");
             // Reply with JSON code
             die(json_encode(array('available' => $available, 'name' => $params['name'], 'tld' => $params['tld'], 'price' => $strprice, 'domain' => $domain, 'mex' => $mex)));
         }
     } catch (Exception $e) {
         die(json_encode(array('mex' => $e->getMessage())));
     }
 }
Example #9
0
 /**
  * activateItems: activate one or more order items based on autosetup flag
  *
  * @param  orderId: order id to activate
  *         autosetup: autosetup value to manage
  * @return true|false
  */
 public static function activateItems($orderId, $autosetup = 0)
 {
     Shineisp_Commons_Utilities::logs(__METHOD__ . "(" . $orderId . ", " . $autosetup . ")");
     $autosetup = intval($autosetup);
     if ($autosetup === 0) {
         return true;
     }
     $activableItems = OrdersItems::getAllActivableItems($orderId);
     if (empty($activableItems)) {
         Shineisp_Commons_Utilities::logs(__METHOD__ . "(" . $orderId . ", " . $autosetup . "): no activable product");
         return true;
     }
     foreach ($activableItems as $item) {
         if (empty($item->parameters) && empty($item->callback_url)) {
             Shineisp_Commons_Utilities::logs(__METHOD__ . "(" . $orderId . ", " . $autosetup . "): product " . serialize($item) . " with no parameter set");
             // parameters are needed for both domains and hosting.
             continue;
         }
         // echo $item->Products->autosetup;
         // var_dump( isset($item->Products) && isset($item->Products->autosetup) && intval($item->Products->autosetup) === $autosetup );
         if (isset($item->Products) && isset($item->Products->autosetup) && intval($item->Products->autosetup) === intval($autosetup)) {
             Shineisp_Commons_Utilities::logs(__METHOD__ . "(" . $orderId . ", " . $autosetup . "): Hosting Detail Id #" . $item->detail_id . " start activation");
             OrdersItems::activate($item->detail_id);
         }
         if (isset($item->tld_id) && intval($item->tld_id) > 0 && DomainsTlds::getAutosetup($item->tld_id) === $autosetup) {
             Shineisp_Commons_Utilities::logs("Orders::activateItems(" . $orderId . ", " . $autosetup . "): Domain Detail Id " . $item->detail_id . " start activation");
             OrdersItems::activate($item->detail_id);
         }
     }
     Shineisp_Commons_Utilities::logs(__METHOD__ . "(" . $orderId . ", " . $autosetup . "). End activations");
 }
Example #10
0
 /**
  * saveAll
  * Save all the data
  * @param $params
  * @return Boolean
  */
 public static function saveAll($id, $params)
 {
     $date_end = null;
     if (!is_array($params)) {
         return false;
     }
     $details = Doctrine::getTable('OrdersItems')->find($id);
     // Generic price setting
     $rowtotal = $params['price'];
     $vat = 0;
     $percentage = null;
     // Get the taxes applied
     $tax = Taxes::getTaxbyProductID($params['product_id']);
     if (!empty($tax) && $tax['percentage'] > 0 && $params['price'] > 0) {
         $rowtotal = $params['price'] * (100 + $tax['percentage']) / 100;
         $vat = $params['price'] * $tax['percentage'] / 100;
         $percentage = $tax['percentage'];
     } else {
         if (!empty($params['parameters'])) {
             // it is a domain
             $domainparams = json_decode($params['parameters'], true);
             if (!empty($domainparams['domain']['tld'])) {
                 $tax = Taxes::getTaxbyTldID($domainparams['domain']['tld']);
                 $tldInfo = DomainsTlds::getbyID($domainparams['domain']['tld']);
                 if (!empty($domainparams['action']) && $domainparams['action'] == "transferDomain") {
                     $params['price'] = $tldInfo['transfer_price'];
                 } elseif (!empty($domainparams['action']) && $domainparams['action'] == "renewalDomain") {
                     $params['price'] = $tldInfo['renewal_price'];
                 } elseif (!empty($domainparams['action']) && $domainparams['action'] == "registerDomain") {
                     $params['price'] = $tldInfo['registration_price'];
                 }
                 // if the price is negative the tax MUST not be refunded
                 // because already payed by the hoster
                 if ($tax['percentage'] > 0 && $params['price'] > 0) {
                     $vat = $params['price'] * $tax['percentage'] / 100;
                     $percentage = $tax['percentage'];
                     $rowtotal = $params['price'] * (100 + $tax['percentage']) / 100;
                 }
             }
         }
     }
     if (!empty($params['billing_cycle_id'])) {
         $months = BillingCycle::getMonthsNumber($params['billing_cycle_id']);
     }
     if ($months > 0 && is_numeric($params['product_id']) && $params['product_id'] > 0) {
         // only for the product and services. Domains excluded
         $rowtotal = $rowtotal * $months;
     }
     $params['date_end'] = Shineisp_Commons_Utilities::add_date($params['date_start'], null, $months);
     $details->quantity = $params['quantity'];
     $details->date_start = Shineisp_Commons_Utilities::formatDateIn($params['date_start']);
     $details->date_end = Shineisp_Commons_Utilities::formatDateIn($params['date_end']);
     $details->billing_cycle_id = !empty($params['billing_cycle_id']) ? $params['billing_cycle_id'] : null;
     $details->price = $params['price'];
     $details->vat = $vat;
     $details->percentage = $percentage;
     $details->cost = $params['cost'];
     $details->product_id = is_numeric($params['product_id']) && $params['product_id'] > 0 ? $params['product_id'] : NULL;
     $details->setupfee = $params['setupfee'];
     $details->discount = $params['discount'];
     $details->subtotal = $rowtotal * $params['quantity'];
     $details->status_id = $params['status_id'];
     $details->description = $params['description'];
     $details->parameters = $params['parameters'];
     if ($details->trySave()) {
         OrdersItems::setAutorenew($id, $params['autorenew']);
         // Remove all domains
         OrdersItemsDomains::removeAllDomains($id);
         if ($params['domains_selected']) {
             foreach ($params['domains_selected'] as $domain) {
                 OrdersItemsDomains::addDomain($details['order_id'], $domain);
             }
         }
         return true;
     }
     return false;
 }
Example #11
0
 /**
  * Get a record by domain name
  * @param $domain
  * @return integer
  */
 public static function findRegistrarIDbyDomain($domainname)
 {
     // Get the domain and tld extension from the domain name
     $arrdomain = Shineisp_Commons_Utilities::getTld($domainname);
     if (!empty($arrdomain[0]) && !empty($arrdomain[1])) {
         $domain = $arrdomain[0];
         $tld = $arrdomain[1];
     } else {
         throw new Exception('It was not possible get the tld extension from the domain name', "666");
     }
     // Get the code of the tld domain
     $tld = DomainsTlds::getbyTld($tld);
     if (empty($tld)) {
         throw new Exception("Tld extension has not been found or the name of the domain is malformed", "666");
     }
     $registrar = Doctrine_Query::create()->from('Registrars r')->leftJoin('r.Domains d ON d.registrars_id = r.registrars_id')->where("d.domain = ?", $domain)->andWhere('d.tld_id = ?', $tld['tld_id'])->andWhere('r.active = ?', true)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if (!empty($registrar[0]['registrars_id']) && is_numeric($registrar[0]['registrars_id'])) {
         return $registrar[0]['registrars_id'];
     } else {
         return false;
     }
 }
Example #12
0
 /**
  * Add a domain in the cart
  * 
  * @param string $domain
  * @param integer $tld_id
  * @param string $action [registerDomain, transferDomain]
  * @return CartItem or Null
  */
 public function addDomain($domain, $tld_id, $action = "registerDomain", $authcode = null)
 {
     if (!empty($domain)) {
         // Get the price information for the domain product
         $priceInfo = DomainsTlds::getPrice($tld_id, $action);
         // Add the domain in the cart
         $domainitem = new CartItem();
         $domainitem->setName($domain)->setId($tld_id)->setType('domain')->setTaxId($priceInfo['tax_id'])->setCost($priceInfo['cost'])->setUnitprice($priceInfo['price'])->setSetupfee($priceInfo['setupfee'])->addOption('domain', array('name' => $domain, 'tld' => $tld_id, 'action' => $action, 'authcode' => $authcode));
         $this->addItem($domainitem);
         return $domainitem;
     }
     return NULL;
 }
Example #13
0
 public function checkdomainAction()
 {
     try {
         $session = new Zend_Session_Namespace('Default');
         // Get all the params sent by the customer
         $params = $this->getRequest()->getParams();
         // redirect the customer to the contact form
         if (!empty($params['mode']) && $params['mode'] == "nothing") {
             $this->_helper->redirector('contacts');
             return true;
         }
         if (empty($params['domain']) || empty($params['tlds'])) {
             $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is a mandatory field. Choose a domain name.', 'status' => 'danger'));
         }
         // Get the product (tld) selected by the customer
         $tldInfo = DomainsTlds::getAllInfo($params['tlds']);
         // Check if the parameter exists in our database
         if (isset($tldInfo['tld_id'])) {
             // If the owner of the domain wants to transfer the domain ...
             if (!empty($params['mode']) && $params['mode'] == "link") {
                 if (!empty($tldInfo)) {
                     // create the domain name
                     $domain = trim(strtolower($params['domain'])) . "." . $tldInfo['DomainsTldsData'][0]['name'];
                     // get the hosting item added in the cart
                     $hostingItem = $session->cart->getHostingItem();
                     // attach the domain name to the hosting plan
                     if ($hostingItem) {
                         $session->cart->attachDomain($hostingItem, $domain, $tldInfo['tld_id'], "transferDomain");
                     }
                     // redirect the customer to the contact form
                     $this->_helper->redirector('contacts');
                 }
             } else {
                 // If the domain is still free and the customer needs to register it then ...
                 $strDomain = $params['domain'] . "." . $tldInfo['DomainsTldsData'][0]['name'];
                 // Check if the domain is still free
                 $result = Domains::isAvailable($params['domain'] . "." . $tldInfo['DomainsTldsData'][0]['name']);
                 if ($result) {
                     // If it is free
                     // create the domain name
                     $domain = trim(strtolower($params['domain'])) . "." . $tldInfo['DomainsTldsData'][0]['name'];
                     // get the hosting item added in the cart
                     $hostingItem = $session->cart->getHostingItem();
                     // attach the domain name to the hosting plan
                     if ($hostingItem) {
                         $session->cart->attachDomain($hostingItem, $domain, $tldInfo['tld_id'], "registerDomain");
                     }
                     // Redirect the user to the
                     $this->_helper->redirector('contacts', 'cart', 'default', array('mex' => 'The domain is available for registration', 'status' => 'success'));
                 } else {
                     // If not redirect the customer to choose another name
                     $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is not available for registration. Choose another domain name.', 'status' => 'danger'));
                 }
             }
         }
         $this->_helper->redirector('domain', 'cart', 'default', array('mex' => 'The domain is available for registration', 'status' => 'success'));
     } catch (Exception $e) {
         $this->_helper->redirector('index', 'index', 'default', array('mex' => $e->getMessage()));
     }
 }
Example #14
0
 /**
  * Create the tld list
  */
 private function createTldMenu()
 {
     $ns = new Zend_Session_Namespace();
     $items = DomainsTlds::getHighlighted($ns->langid);
     $currency = Shineisp_Registry::get('Zend_Currency');
     $html = "";
     if (!empty($items)) {
         $html = "<li class=\"dropdown\">";
         $html .= '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' . $this->translator->translate('Domains') . '</a>';
         $html .= "<ul class=\"dropdown-menu\">";
         foreach ($items as $item) {
             if (!empty($item['DomainsTldsData'][0]['name'])) {
                 $item['registration_price'] = $currency->toCurrency($item['registration_price'], array('currency' => Settings::findbyParam('currency')));
                 $html .= '<li class="dropdown"><a title="' . Shineisp_Commons_Utilities::truncate(strip_tags($item['DomainsTldsData'][0]['description']), 150, "...", false, true) . '" href="/tlds/' . $item['DomainsTldsData'][0]['name'] . '.html">.<b>' . strtoupper($item['DomainsTldsData'][0]['name']) . "</b> - " . $item['registration_price'] . " (" . $this->translator->translate('Tax excluded') . ")</a></li>";
             }
         }
         $html .= "</ul>";
         $html .= "</li>";
     }
     return $html;
 }
Example #15
0
 /**
  * Check the domain availability
  * @param $name
  * @param $tldid
  * @return boolean
  */
 public static function check_availability($name, $tldid)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $dchecker = new Shineisp_Commons_DomainChecker();
     if (!empty($name)) {
         $record = DomainsTlds::getAllInfo($tldid);
         if (!empty($record)) {
             if (!empty($record['name'])) {
                 $domain = $name . "." . $record['name'];
                 if (Shineisp_Commons_Utilities::is_valid_domain_name($domain)) {
                     if ($dchecker->checkDomainAvailability($domain)) {
                         return true;
                     } else {
                         return false;
                     }
                 }
             } else {
                 throw new Exception($translator->_('TLD name have been not set in the administration panel yet'));
             }
             throw new Exception($translator->_('Domain name is not correct: %s', $domain));
         }
         throw new Exception($translator->translate("TLD {$tldid} has been not found!"));
     }
     throw new Exception($translator->translate('Domain name is empty!'));
 }
Example #16
0
 /**
  * Check all the tld domain extensions
  * 
  * @param string $name
  * @param array $exluded (exclude a tld extension)
  */
 private function chktlds($name, $exluded = "")
 {
     $result = array();
     $currency = Shineisp_Registry::getInstance()->Zend_Currency;
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $tlds = DomainsTlds::getAll();
     foreach ($tlds as $tld) {
         if (!in_array($tld['tld_id'], $exluded)) {
             $available = Domains::check_availability($name, $tld['tld_id']);
             // Create the domain name
             $domain = $name . "." . $tld['DomainsTldsData'][0]['name'];
             // Domain Price
             $price = $available ? $tld['registration_price'] : $tld['transfer_price'];
             $taxpercent = $tld['Taxes']['percentage'];
             // Format the price number
             $strprice = $currency->toCurrency($price * ($taxpercent + 100) / 100, array('currency' => Settings::findbyParam('currency')));
             // Create the message
             $mex = $available ? $translator->translate('The domain is available for registration') : $translator->translate("The domain is unavailable for registration, but if you are the domain owner, you can transfer it!");
             $result[] = array('available' => $available, 'name' => $name, 'tld' => $tld['tld_id'], 'price' => $strprice, 'domain' => $domain, 'mex' => $mex);
         }
     }
     return $result;
 }
Example #17
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $i = 0;
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/domainstlds/process");
     $request = $this->getRequest();
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainstlds/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainstlds/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('list', 'domainstlds', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         $id = DomainsTlds::saveAll($request->getPost(), $this->session->langid);
         $redirector->gotoUrl("/admin/domainstlds/edit/id/{$id}");
     } else {
         $this->view->form = $form;
         $this->view->title = $this->translator->translate("Domain Tlds");
         $this->view->description = $this->translator->translate("Check the tlds data");
         return $this->render('applicantform');
     }
 }
Example #18
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Product name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'nickname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Product Nickname'), 'description' => $translate->_('This is the short name of the product'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'label' => $translate->_('URI'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'sku', array('filters' => array('StringTrim'), 'label' => $translate->_('SKU'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'shortdescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Short Description'), 'id' => 'shortdescription', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'metakeywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'metadescription', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Description'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('select', 'category_id', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsCategories::getList());
     $this->addElement('select', 'welcome_mail_id', array('label' => $translate->_('Welcome E-Mail'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('welcome_mail_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(EmailsTemplates::getList());
     $this->addElement('select', 'server_group_id', array('label' => $translate->_('Server group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('server_group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ServersGroups::getList(true));
     $this->addElement('select', 'autosetup', array('label' => $translate->_('Automatic setup'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('autosetup')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'Do not automatically setup this product', '1' => 'Automatically setup the product as soon as an order is placed', '2' => 'Automatically setup the product as soon as the first payment is received', '3' => 'Automatically setup the product when you manually accept a pending order', '4' => 'Automatically setup the product as soon as the payment is complete'));
     $this->addElement('multiselect', 'related', array('label' => $translate->_('Related Products'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->addElement('multiselect', 'upgrade', array('label' => $translate->_('Product Upgrades'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('related')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
     $this->getElement('upgrade')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
     $this->addElement('select', 'tax_id', array('label' => 'Tax', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('tax_id')->setAllowEmpty(false)->setMultiOptions(Taxes::getList(true));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'price_1', array('filters' => array('StringTrim'), 'label' => $translate->_('Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup Fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('XML Setup Configuration. See the manual'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('select', 'enabled', array('label' => $translate->_('Enabled'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'Disabled', '1' => 'Active')));
     $this->addElement('select', 'ishighlighted', array('label' => $translate->_('Is Highlighted'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'isrefundable', array('label' => $translate->_('Is Refundable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'default', array('label' => $translate->_('Default Image'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'iscomparable', array('label' => $translate->_('Is Comparable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'showonrss', array('label' => $translate->_('Publish on RSS Feed'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'downgradable', array('label' => $translate->_('Allow downgrades'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'type', array('label' => $translate->_('Product Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('generic' => $translate->_('Generic'), 'domain' => $translate->_('Domain'), 'hosting' => $translate->_('Hosting'))));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $this->addElement('text', 'filedescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         $file->addValidator('Extension', false, $filetypes)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     }
     $this->addElement('multiselect', 'wikipages', array('label' => $translate->_('Wiki Pages'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('wikipages')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Wiki::getList());
     $this->addElement('select', 'tranche_billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('tranche_billing_cycle_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(BillingCycle::getList());
     $this->addElement('text', 'tranche_qty', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_measure', array('filters' => array('StringTrim'), 'label' => $translate->_('Measurement label'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_price', array('filters' => array('StringTrim'), 'label' => $translate->_('Unit Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('multiselect', 'tranche_includes_domains', array('isArray' => true, 'label' => $translate->_('Domain included'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('tranche_includes_domains')->setAllowEmpty(true)->setRegisterInArrayValidator(false)->setMultiOptions(DomainsTlds::getList());
     $this->addElement('select', 'group_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Attribute Group'), 'required' => true, 'class' => 'form-control'));
     $this->getElement('group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsAttributesGroups::getList());
     $this->addElement('text', 'position', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Position'), 'class' => 'form-control'));
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'label' => $translate->_('Blocks'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('hidden', 'product_id');
 }