Example #1
0
 /**
  * Parses a string url into an array. Parsed urls will result in an automatic
  * redirection
  *
  * @param string $url The url to parse
  * @return boolean False on failure
  */
 public function parse($url)
 {
     $params = parent::parse($url);
     if ($params === false) {
         return false;
     }
     $Domains = new Domains();
     $subdomain = $Domains->getSubdomain();
     $masterDomain = Configure::read('Domain.Master');
     $defaultRoute = Configure::read('Domain.DefaultRoute');
     $Tenant = new Tenant();
     if (!$Tenant->domainExists($subdomain) && $params != $defaultRoute) {
         if (!$this->response) {
             $this->response = new CakeResponse();
         }
         debug($this->response);
         die;
         $status = 307;
         $redirect = $defaultRoute;
         $this->response->header(array('Location' => Router::url($redirect, true)));
         $this->response->statusCode($status);
         $this->response->send();
         $this->_stop();
     }
     return $subdomain;
 }
Example #2
0
 public function tldSummaryPerMonth()
 {
     $NS = new Zend_Session_Namespace('Default');
     $registry = Shineisp_Registry::getInstance();
     $translation = $registry->Zend_Translate;
     $domains = array();
     if (!empty($NS->customer)) {
         $this->view->uri = "";
         $data = $NS->customer;
         // Get the data information
         $all_domains = Domains::getSummaryPerMonth($data['customer_id']);
         $autorenew_domains = Domains::getAutorenewSummaryPerMonth($data['customer_id']);
         for ($i = 1; $i <= 12; $i++) {
             $domains['months'][$i] = date('M', strtotime(date('Y/m/01/', strtotime("2012/12/1")) . " {$i} month"));
             $domains['autorenew'][$i] = 0;
             $domains['norenew'][$i] = 0;
             foreach ($autorenew_domains as $domain) {
                 if ($domain['monthid'] == $i) {
                     $domains['autorenew'][$i] = $domain['total'];
                 }
             }
             foreach ($all_domains as $domain) {
                 if ($domain['month_number'] == $i) {
                     $domains['norenew'][$i] = $domain['total'] - $domains['autorenew'][$i];
                 }
             }
         }
         $norenew = implode(",", $domains['norenew']);
         $autorenew = implode(",", $domains['autorenew']);
         $months = implode("|", $domains['months']);
         $max = max($domains['autorenew']);
         $this->view->uri = "http://chart.apis.google.com/chart?cht=bvg\n\t\t\t&chdlp=t\n\t\t\t&chtt=" . $translation->translate('Domain Summary per Month') . "\n\t\t\t&chdl=" . $translation->translate('Automatic Renewal') . "|" . $translation->translate('No Auto Renew') . "\n\t\t\t&chts=4d89f9,18\n\t\t\t&chs=550x300\n\t\t\t&chd=t:" . $autorenew . "|" . $norenew . "\n\t\t\t&chxt=x\n\t\t\t&chxl=0:|" . $months . "\n\t\t\t&chco=4d89f9,FF1F1F\n\t\t\t&chds=0," . $max . "\n\t\t\t&chm=N,000000,-1,,11|N,000000,0,,11\n\t\t\t&chbh=a";
     }
     return $this->view->render('partials/graph.phtml');
 }
Example #3
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Creation date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Message'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Note'), 'description' => $translate->_('Write here a note. An email will be sent to the ISP staff.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup Configuration'), 'description' => $translate->_('Here you can read the service configuration written by the ISP modules. These information are read-only.'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12'));
     $this->addElement('select', 'order_id', array('label' => $translate->_('Orders'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('order_id')->setAllowEmpty(false)->setMultiOptions(Orders::getList(true));
     $this->addElement('multiselect', 'domains', array('label' => $translate->_('Available domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 tmpitems'));
     $this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList());
     $this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control col-lg-12 items'));
     $this->getElement('domains_selected')->setRegisterInArrayValidator(false);
     // Disable the Validator in order to manage a dynamic list.
     $this->addElement('select', 'product_id', array('label' => $translate->_('Products'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true));
     $this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(true));
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders', false, true));
     $this->addElement('select', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'description' => $translate->_('Enable or disable the automatic renewal of the service'), 'class' => 'form-control'));
     $this->getElement('autorenew')->setAllowEmpty(false)->setMultiOptions(array('1' => $translate->_('Yes, I would like to renew the service at the expiration date.'), '0' => $translate->_('No, I am not interested in the service renew.')));
     $this->addElement('hidden', 'detail_id');
 }
Example #4
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fees'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'discount', array('filters' => array('StringTrim'), 'label' => $translate->_('Discount'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'product_id', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Products'), 'class' => 'form-control'));
     $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true));
     $this->addElement('text', 'price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(true));
     $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Start Date'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'class' => 'form-control'));
     $this->addElement('textarea', 'parameters', array('filters' => array('StringTrim'), 'label' => $translate->_('Service Panel Configuration'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'description' => $translate->_('Parameters model accepted: {"domain":{"name":"domain.com","tld":"2","action":"renewDomain","authcode":null}}'), 'class' => 'form-control'));
     $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
     $this->addElement('select', 'autorenew', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'class' => 'form-control', 'multioptions' => array(0 => 'NO', 1 => 'YES')));
     $this->addElement('multiselect', 'domains', array('label' => $translate->_('Available Domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control tmpitems'));
     $this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList());
     $this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control items'));
     $this->getElement('domains_selected')->setRegisterInArrayValidator(false);
     // Disable the Validator in order to manage a dynamic list.
     $this->addElement('hidden', 'detail_id');
 }
Example #5
0
 public function init()
 {
     $NS = new Zend_Session_Namespace('Default');
     $translate = Shineisp_Registry::get('Zend_Translate');
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $this->addElement('select', 'domain_id', array('decorators' => array('Bootstrap'), 'required' => false, 'label' => $translate->_('Domain'), 'description' => $translate->_('Choose the domain name reference'), 'class' => 'form-control large-input'));
     $this->getElement('domain_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList(true, $NS->customer['customer_id']));
     $this->addElement('text', 'subject', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'title' => $translate->_('Write here a subject of the issue.'), 'label' => $translate->_('Subject'), 'description' => $translate->_('Write here the domain name or a simple description of the problem.'), 'class' => 'form-control large-input'));
     $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Body Message'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Write here all the information.'), 'rows' => '8', 'class' => 'form-control wysiwyg-simple'));
     $this->addElement('select', 'status', array('filters' => array('StringTrim'), 'label' => $translate->_('Set the issue status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input', 'multioptions' => array('' => '', Statuses::id("solved", "tickets") => $translate->_('Solved'), Statuses::id("closed", "tickets") => $translate->_('Closed'))));
     $this->addElement('select', 'category_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Category'), 'description' => 'Select a category.', 'class' => 'form-control large-input'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(TicketsCategories::getList(true));
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $MBlimit = Settings::findbyParam('useruploadlimit');
         $Types = Settings::findbyParam('useruploadfiletypes');
         if (empty($MBlimit)) {
             $MBlimit = 1;
         }
         if (empty($Types)) {
             $Types = "zip,jpg";
         }
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $Types, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit))));
         $file->addValidator('Extension', false, $Types)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     } else {
         $this->addElement('hidden', 'attachments');
     }
     $this->addElement('submit', 'submit', array('label' => $translate->_('Send help request'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
     $this->addElement('hidden', 'ticket_id');
 }
Example #6
0
 private static function _initDomain()
 {
     self::$cookies = array();
     // Take domain from configuration to allow multiple subdomain compatibility with cookies.
     self::$domain = Domains::getInstance()->getDomain();
     self::$path = '/';
 }
Example #7
0
 public function __construct()
 {
     $this->working_instance = Config::getInstance()->getInstanceName();
     $this->instance_static_host = Domains::getInstance()->getStaticHost();
     // Contents will be accessible by static server under this path:
     $this->generated_files_public_path = $this->media_type . '/generated';
     // Packed contents will be stored under this filesystem path. You can overwrite this property:
     $this->generated_files_folder = ROOT_PATH . '/instances/' . $this->working_instance . '/public/static/' . $this->generated_files_public_path;
 }
Example #8
0
 /**
  * DomainsExpiration
  * List of all the domains near the expiring date
  * @return array
  */
 public function DomainsExpiration()
 {
     $ns = new Zend_Session_Namespace();
     if (!empty($ns->customer)) {
         $data = $ns->customer;
         return array('records' => Domains::getExpiringDomains($data['customer_id']), 'actions' => array('/domains/edit/id/' => 'Show'), 'pager' => true);
     } else {
         return null;
     }
 }
Example #9
0
 /**
  * Returns tha contents in cache or false.
  *
  * @return mixed
  */
 protected function grabCache()
 {
     if (Domains::getInstance()->getDevMode() && (FilterCookie::getInstance()->getInteger('rebuild_all') || FilterGet::getInstance()->getInteger('rebuild'))) {
         return false;
     }
     $cache_key = $this->parseCache();
     // Controller does not use cache:
     if (!$cache_key) {
         return false;
     }
     $cache = new CacheDisk();
     $content = $cache->get($cache_key['name']);
     return $content ? $content : false;
 }
Example #10
0
 /**
  * getList
  * Get all the records for the select objects
  * @param $domain_name, $tld, $fields="*", $retarray=false
  * @return Doctrine Record
  */
 public static function getList($id = null)
 {
     $items = array();
     if ($id) {
         $order_items = Doctrine::getTable('OrdersItemsDomains')->findby('orderitem_id', $id)->toArray();
     } else {
         $order_items = Doctrine::getTable('OrdersItemsDomains')->findAll()->toArray();
     }
     foreach ($order_items as $item) {
         $domain = Domains::find($item['domain_id']);
         $items[$item['domain_id']] = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld'];
     }
     return $items;
 }
Example #11
0
function main(&$errors)
{
    global $config, $_SERWEB;
    $dh =& Domains::singleton();
    if (false === ($domains = $dh->get_all_dids())) {
        return false;
    }
    foreach ($domains as $did) {
        if (false === update_domain_dir($did)) {
            return false;
        }
    }
    /* update vhosts dir */
    if ($config->apache_vhosts_dir) {
        $target = realpath($_SERWEB["serwebdir"]);
        $local_links = array();
        /* get list of local symlinks */
        $d = dir($config->apache_vhosts_dir);
        while (false !== ($entry = $d->read())) {
            if (is_link($config->apache_vhosts_dir . $entry) and realpath(readlink($config->apache_vhosts_dir . $entry)) == $target) {
                $local_links[] = $entry;
            }
            /* this is need for testing on windows
              			if ($entry != "." and $entry != ".."){
            				$local_links[] = substr($entry, 0, -4);
            			}
             */
        }
        $d->close();
        /* get list of domain names */
        $dom_names = array();
        if (false === ($domains = $dh->get_domains())) {
            return false;
        }
        foreach ($domains as $k => $v) {
            $dom_names[] = $k;
        }
        /* synchronize links in vhosts dir with DB */
        $d_lnk = array_diff($local_links, $dom_names);
        $c_lnk = array_diff($dom_names, $local_links);
        foreach ($d_lnk as $v) {
            remove_vhost_symlink($v);
        }
        foreach ($c_lnk as $v) {
            create_vhost_symlink($v);
        }
    }
    return true;
}
Example #12
0
 private function __construct()
 {
     // Init session cookie domain to allow sharing session
     // across multiple subdomains.
     ini_set('session.cookie_domain', '.' . Domains::getInstance()->getDomain());
     if (!isset($_SESSION)) {
         if (headers_sent()) {
             trigger_error("Session: The session was not started before the sending of the headers.");
             return false;
         } else {
             // Session init.
             session_start();
         }
     }
 }
Example #13
0
 /**
  * Get metadata. It uses the metadata key or path to return the metadata.
  *
  * @return array
  */
 public static function get()
 {
     $metadata_info = self::_getMetadataInformation();
     $metadata_raw = Config::getInstance()->getConfig('lang/metadata_' . Domains::getInstance()->getLanguage());
     $metadata = $metadata_raw['default'];
     if (isset($metadata_info['metadata_key'])) {
         $metadata = $metadata_raw[$metadata_info['metadata_key']];
     } else {
         $reversal_path = Router::getReversalRoute(Urls::getInstance(Bootstrap::$instance)->getPath());
         if ($reversal_path && isset($metadata_raw[$reversal_path])) {
             $metadata = $metadata_raw[$reversal_path];
         }
     }
     return self::_replaceVars($metadata, $metadata_info);
 }
Example #14
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'action', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Action'), 'class' => 'form-control'));
     $this->addElement('text', 'startdate', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Start'), 'class' => 'form-control'));
     $this->addElement('text', 'enddate', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('End'), 'class' => 'form-control'));
     $this->addElement('textarea', 'log', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Log'), 'class' => 'form-control'));
     $this->addElement('select', 'status_id', array('required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Status'), 'class' => 'form-control'));
     $this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('domains_tasks'));
     $this->addElement('select', 'domain_id', array('required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Domain'), 'class' => 'form-control'));
     $this->getElement('domain_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList());
     $this->addElement('select', 'registrars_id', array('required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Registrar'), 'class' => 'form-control'));
     $this->getElement('registrars_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Registrars::getList());
     $this->addElement('hidden', 'task_id');
 }
Example #15
0
 /**
  * Connect to redis and return a redis object to start passing commands.
  *
  * If no profile is passed, default connection stated in domains.config.php is taken. Otherwise, profile
  * will be searched in redis.config.php.
  *
  * @param string $profile Connection profile.
  * @return \Predis\Client
  */
 public function connect($profile = null)
 {
     if (!isset(self::$connected_client[$profile])) {
         PredisAutoloader::register();
         if (null == $profile) {
             try {
                 // Load "default" profile from redis.config.php:
                 $db_params = Config::getInstance()->getConfig('redis', 'default');
             } catch (Exception_Configuration $e) {
                 // Connection taken from domains.config.php:
                 $db_params = Domains::getInstance()->getParam('redis');
             }
         } else {
             $db_params = Config::getInstance()->getConfig('redis', $profile);
         }
         self::$connected_client[$profile] = new \Predis\Client($db_params);
         $this->profile = $profile;
     }
     return self::$connected_client[$profile];
 }
Example #16
0
 /**
  * Sets the controller and view properties and executes the controller, sending the output buffer.
  *
  * @param string $controller Dispatches a specific controller.
  */
 public static function dispatch($controller)
 {
     // Set Timezone as required by php 5.1+
     date_default_timezone_set('Europe/Madrid');
     try {
         $config = Config::getInstance(self::$instance);
         $domain = Domains::getInstance();
         self::$language = 'en_US';
         // This is the controller to use:
         $ctrl = self::invokeController($controller);
         $ctrl->build();
         // Debug:
         if (Domains::getInstance()->getDebugMode()) {
             $ctrl_debug = self::invokeController('DebugCommandLineDebug');
             $ctrl_debug->build();
         }
     } catch (\Exception $e) {
         echo $e->getMessage() . "\n" . $e->getTraceAsString();
         die;
     }
 }
Example #17
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 #18
0
<?php

require_once __DIR__ . '/includes/includes.php';
if (empty($_SESSION['user'])) {
    header("Location: login.php");
    die("Redirecting to login.php");
}
$d = new Domains();
$r = new Registrars();
// check if we're deleting a registrar
if (isset($_GET['id']) && $_GET['id'] != '') {
    if (isset($_POST['action']) && $_POST['action'] == 'delete') {
        $confirmed = true;
    } else {
        $confirmed = false;
    }
    $id = $_GET['id'];
} else {
    $id = -1;
}
pageHead();
?>
<body>
<?php 
headerHere('Delete', 'Make sure you know what you are doing');
?>
    <div class="container" style="margin-top: 30px;">
        <div class="row">
            <div class="span3">
                <ul class="nav nav-tabs nav-stacked sidebar">
                    <li class=""><a href="index.php"><i class="icon-home"></i> Home</a></li>
Example #19
0
 /**
  * Magic method to retrieve table names from a configuration file.
  *
  * @param string $attribute
  *
  * @return string
  */
 public function __get($attribute)
 {
     $tablenames = Config::getInstance()->getConfig('tablenames');
     $domain = Domains::getInstance()->getDomain();
     if (isset($tablenames['names'][$domain][$attribute])) {
         return $tablenames['names'][$domain][$attribute];
     } elseif (isset($tablenames['names']['default'][$attribute])) {
         return $tablenames['names']['default'][$attribute];
     }
     return $attribute;
 }
 function to_smarty()
 {
     global $config;
     $f =& $config->data_sql->credentials->flag_values;
     $dh =& Domains::singleton();
     if (false === ($domainname = $dh->get_domain_name($this->get_did()))) {
         return false;
     }
     return array("uid" => $this->uid, "uname" => $this->uname, "did" => $this->get_did(), "domainname" => $domainname, "realm" => $this->realm, "password" => $this->password, "ha1" => $this->ha1, "ha1b" => $this->ha1b, "for_ser" => $this->flags & $f['DB_LOAD_SER'], "for_serweb" => $this->flags & $f['DB_FOR_SERWEB']);
 }
Example #21
0
 public static function getDomainsFromOrder($orderID)
 {
     $domains = array();
     $i = 0;
     $items = OrdersItems::getAllDetails($orderID, null, true);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $params = json_decode($item['parameters'], true);
             if (!empty($params['domain'])) {
                 $domains[$i]['orderitem_id'] = $item['detail_id'];
                 $domains[$i]['customer_id'] = $item['Orders']['Customers']['customer_id'];
                 $domains[$i]['action'] = !empty($params['action']) ? $params['action'] : "registerDomain";
                 $domains[$i]['domain'] = trim(strtolower($params['domain']));
                 $domains[$i]['authinfocode'] = !empty($params['authinfocode']) ? trim($params['authinfocode']) : "";
                 $domains[$i]['tld_id'] = Domains::getDomainIDbyName($domains[$i]['domain']);
                 $domains[$i]['registrar_id'] = Domains::getRegistrarsIDbyName($params['domain']);
                 $i++;
             }
         }
     }
     return $domains;
 }
Example #22
0
 /**
  *	Get domain id of domain 
  *	
  *	@static
  *	@param	string	$realm		
  *	@param	array	$opt		
  *	@return	string				domain ID, FALSE on error
  */
 function find_out_did($realm, $opt)
 {
     global $config;
     if (!$config->multidomain) {
         return $config->default_did;
     }
     $dh =& Domains::singleton();
     if (false === ($did = $dh->get_did($realm))) {
         return false;
     }
     if (is_null($did)) {
         return null;
     }
     return $did;
     /*	
     	global $data_auth, $lang_str, $config;
     
     	$data_auth->add_method('get_did_by_realm');
     	
     	$opt = array('check_disabled_flag' => false);
     	if (false === $did = $data_auth->get_did_by_realm($realm, $opt)) return false;
     
     	if (is_null($did)){
     		sw_log("find_out_did: domain id for realm '".$realm."' not found", PEAR_LOG_INFO);
     		ErrorHandler::add_error($lang_str['domain_not_found']);
     		return false;
     	}
     	
     	return $did;
     */
 }
Example #23
0
 /**
  * activate
  * Activate an order item
  * @param $orderItemId
  * @return true|false
  */
 public static function activate($orderItemId)
 {
     Shineisp_Commons_Utilities::log(__METHOD__ . " - Activate Detail ID #" . $orderItemId);
     $orderItemId = intval($orderItemId);
     if ($orderItemId < 1) {
         // missing order item id from arguments
         return false;
     }
     // Get OrderItem
     $ordersItem = self::find($orderItemId);
     $ordersItem = $ordersItem->toArray();
     $OrderItem = array_shift($ordersItem);
     if (!$OrderItem) {
         // order item not found
         return false;
     }
     // Get customerId related to this order
     $customerId = Orders::getCustomer($OrderItem['order_id']);
     /*
      * START ACTIVATIONS CODE
      */
     $upgrade = Orders::isUpgrade($OrderItem['order_id']);
     $upgrade_uuid = false;
     if ($upgrade !== false) {
         $orderItem = OrdersItems::getDetail($upgrade);
         Shineisp_Commons_Utilities::logs(__METHOD__ . " - OITEM::" . print_r($orderItem, true));
         $oldOrderId = $orderItem['order_id'];
         Orders::set_status($oldOrderId, Statuses::id("changed", "orders"));
         // Close the old order ::status changed
         OrdersItems::set_status($upgrade, Statuses::id("changed", "orders"));
         $upgrade_uuid = $orderItem['uuid'];
         // log
         Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order changed from #" . $oldOrderId . " to #" . $OrderItem['order_id']);
     }
     if (empty($OrderItem['parameters'])) {
         Shineisp_Commons_Utilities::logs(__METHOD__ . " - Order items setup parameters empty");
         return false;
     }
     // Is this an hosting? execute panel task
     // TODO: this should call an hook or an even bound to the panel
     if (isset($OrderItem['Products']) && isset($OrderItem['Products']['type']) && $OrderItem['Products']['type'] == 'hosting') {
         Shineisp_Commons_Utilities::logs(__METHOD__ . " Hosting task queued");
         PanelsActions::AddTask($customerId, $OrderItem['detail_id'], "fullProfile", $OrderItem['parameters']);
         return true;
     }
     // Is this a domain? execute domain task
     if (isset($OrderItem['tld_id']) && intval($OrderItem['tld_id']) > 0) {
         $parameters = json_decode($OrderItem['parameters']);
         if (empty($parameters->domain)) {
             Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain has been not set in the order detail #{$orderItemId}");
             return false;
         }
         // Create the domain record
         $domain = Domains::Create($parameters->domain, intval($OrderItem['tld_id']), intval($customerId), $orderItemId);
         // Create the domain task
         if (!empty($parameters->domain) && !empty($parameters->action)) {
             $domains[] = array('domain' => $parameters->domain, 'action' => $parameters->action);
             $retval = DomainsTasks::AddTasks($domains);
             Shineisp_Commons_Utilities::logs(__METHOD__ . " Domain task queued");
         }
         return $retval;
     }
 }
Example #24
0
<?php

require_once __DIR__ . '/includes/includes.php';
if (empty($_SESSION['user'])) {
    header("Location: login.php");
    die("Redirecting to login.php");
}
$d = new Domains();
$r = new Registrars();
if (isset($_GET['id']) && $_GET['id'] != '') {
    $id = $_GET['id'];
} else {
    $id = -1;
}
pageHead();
?>
<body>
<?php 
headerHere('Registrars', 'Here you can oversee the registrars, edit their details or add a new one');
?>
    <div class="container top30">
        <div class="row">
            <div class="span3">
                <ul class="nav nav-tabs nav-stacked sidebar">
                    <li class=""><a href="index.php"><i class="icon-home"></i> Home</a></li>
                    <li class=""><a href="domains.php"><i class="icon-briefcase"></i> Domains<span class="badge badge-info"><?php 
echo $d->numTotal();
?>
</span></a></li>
                    <li class="active"><a href="registrars.php"><i class="icon-folder-open"></i> Registrars<span class="badge badge-info"><?php 
echo $r->getTotal();
Example #25
0
 private function __construct($instance_name)
 {
     $domains = Domains::getInstance($instance_name);
     $filter_server = FilterServer::getInstance();
     $language = $domains->getLanguage();
     $clean_host = preg_replace('/^' . $domains->getSubdomain() . '\\./', '', $domains->getDomain());
     if ($filter_server->getString('HTTPS')) {
         self::$scheme = 'https';
     }
     if (true === $domains->www_mode) {
         self::$main_url = 'http://www.' . $clean_host;
     } else {
         self::$main_url = 'http://' . $clean_host;
     }
     // E.g: http://domain.com/folder1/subfolder1/subfolder11
     self::$base_url = self::$scheme . '://' . $filter_server->getString('HTTP_HOST');
     self::$url_definition = Config::getInstance($instance_name)->getConfig('url_definition');
     // Default url.config for all languages.
     self::$url_config = Config::getInstance($instance_name)->getConfig('url');
     $original_path = $filter_server->getString('REQUEST_URI');
     $query_string = $filter_server->getString('QUERY_STRING');
     $path = urldecode(str_replace('?' . $query_string, '', $original_path));
     // E.g: http://subdomain.domain.com/folder1_param:x:value:y:value?utm_campaign=enloquecer_al_larry
     self::$actual_url = self::$base_url . $original_path;
     // If url ends in slash, remove it and redirect:
     if (strlen($path) > 1 && substr($path, -1) == '/') {
         $path = trim($path, '/');
         header('HTTP/1.0 Moved Permanently 301');
         header('Location: ' . $this->getBaseUrl() . "/{$path}");
     }
     $path = ltrim($path, '/');
     // Separate parameters from URL:
     $params_parts = explode(self::$url_definition['params_separator'], $path);
     // Path is the first part of the explode, rest are parameters.
     self::$path = array_shift($params_parts);
     if (count($params_parts) > 0) {
         self::$params = $params_parts;
     } else {
         self::$params = array();
     }
     self::$path_parts = explode(self::$url_definition['context_separator'], self::$path);
 }
Example #26
0
 public static function AddTask($domain, $action)
 {
     $task = new DomainsTasks();
     $task->startdate = date('Y-m-d H:i:s');
     $task->action = $action;
     $task->domain_id = Domains::getDomainIDbyName($domain);
     $task->registrars_id = Registrars::findRegistrarIDbyDomain($domain);
     $task->status_id = Statuses::id('active', 'domains_tasks');
     //Domains Task Status;
     return $task->trySave();
 }
Example #27
0
<?php

require_once __DIR__ . '/includes/includes.php';
if (empty($_SESSION['user'])) {
    header("Location: login.php");
    die("Redirecting to login.php");
}
$d = new Domains();
$r = new Registrars();
// check if we're deleting a domain
if (isset($_GET['id']) && $_GET['id'] != '') {
    if (isset($_POST['action']) && $_POST['action'] == 'delete') {
        $confirmed = true;
    } else {
        $confirmed = false;
    }
    $id = $_GET['id'];
} else {
    $id = -1;
}
pageHead();
?>
<body>
<?php 
headerHere('Delete', 'Make sure you know what you are doing');
?>
    <div class="container top30">
        <div class="row">
            <div class="span3">
                <ul class="nav nav-tabs nav-stacked sidebar">
                    <li class=""><a href="index.php"><i class="icon-home"></i> Home</a></li>
Example #28
0
<?php

ob_start();
include "set.php";
?>

<?php 
if (isset($_GET['name'])) {
    $name = $_GET['name'];
    $page = $_GET['page'];
    $domain = Domains::find_by_name($name);
    $domain->hits = $domain->hits + 1;
    $domain->save();
    $hit = Hits::make($domain->id, $page);
    $hit->save();
}
?>

<?php 
//include($dir_public.'update.php');
?>

Example #29
0
 /**
  * updateDomain
  * Update the domain information
  * @param unknown_type $customerID
  */
 public function updateDomain($domainID)
 {
     // Connection to the SOAP system
     $soap = $this->Connect();
     if (empty($this->session)) {
         throw new Exception('SOAP connection system error');
     }
     // Get the domain information
     $domain = Domains::find($domainID);
     if (!empty($domain[0])) {
         $domain_name = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld'];
         try {
             $retval = $soap->domainInfo($this->session['id'], $domain_name);
             $info['domain'] = $retval->domain;
             $info['creation'] = $retval->creation;
             $info['modification'] = $retval->modification;
             $info['expiration'] = $retval->expiration;
             $info['nichandle'] = $retval->nicowner;
             $info['authinfocode'] = $retval->authinfo;
             return Domains::updateDomain($domainID, $info);
         } catch (Exception $e) {
             throw new Exception($e->getMessage());
         }
     }
     throw new Exception('Domain ID not found.');
 }
Example #30
0
 /**
  * Create a new widget for the dashboard
  */
 public function widgetsAction()
 {
     $auth = Zend_Auth::getInstance();
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $auth->setStorage(new Zend_Auth_Storage_Session('admin'));
     $id = $this->getRequest()->getParam('id', 'widget_' . rand());
     $icon = $this->getRequest()->getParam('icon', 'fa fa-file');
     $type = $this->getRequest()->getParam('type');
     $title = $this->getRequest()->getParam('title');
     $buttons = array();
     if (!empty($id)) {
         $widget = new Shineisp_Commons_Widgets();
         $widget->setId($id);
         // Ajax load of the widgets
         // Get only the new orders
         if ($type == "new_order_widget") {
             $records = Orders::Last(array(Statuses::id("tobepaid", "orders")));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get all the pending, processing, and paid orders to be complete
         } elseif ($type == 'processing_order_widget') {
             $statuses = array(Statuses::id("processing", "orders"), Statuses::id("pending", "orders"), Statuses::id("paid", "orders"));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $records = Orders::Last($statuses);
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get all the services / order items next to the expiration date from -10 days to 30 days
         } elseif ($type == 'recurring_services_widget') {
             $records = OrdersItems::getServices();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/ordersitems/edit/id/%d"));
             $widget->setBasepath('/admin/ordersitems/')->setIdxfield($records['index'])->setButtons($buttons);
             // Get the last 5 tickets opened by the customers
         } elseif ($type == 'last_tickets_widget') {
             $records = Tickets::Last(null, 5);
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/tickets/edit/id/%d"));
             $widget->setBasepath('/admin/tickets/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last domain tasks to be executed
         } elseif ($type == 'last_domain_tasks_widget') {
             $records = DomainsTasks::Last();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domainstasks/edit/id/%d"));
             $widget->setBasepath('/admin/domainstasks/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last ISP panel tasks to be executed
         } elseif ($type == 'last_panel_tasks_widget') {
             $records = PanelsActions::Last();
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/panelsactions/edit/id/%d"));
             $widget->setBasepath('/admin/panelsactions/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the domains next the expiration date
         } elseif ($type == 'expiring_domain_widget') {
             // Create the header table columns
             $records['fields'] = array('expiringdate' => array('label' => $translator->translate('Expiry Date')), 'domains' => array('label' => $translator->translate('Domain')), 'days' => array('label' => $translator->translate('Days left')));
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domains/edit/id/%d"));
             $records['data'] = Domains::getExpiringDomains(null, 107, -1, 5);
             $records['index'] = "domain_id";
             $widget->setBasepath('/admin/domains/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the messages/notes posted by the customers within the orders
         } elseif ($type == 'order_messages_widget') {
             $records = Messages::Last('orders');
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/orders/edit/id/%d"));
             $widget->setBasepath('/admin/orders/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the messages/notes posted by the customers within the domain
         } elseif ($type == 'domain_messages_widget') {
             $records = Messages::Last('domains');
             $buttons = array('edit' => array('label' => $translator->translate('Edit'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/domains/edit/id/%d"));
             $widget->setBasepath('/admin/domains/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the list of your best customers
         } elseif ($type == 'customers_parade_widget') {
             $buttons = array('edit' => array('label' => $translator->translate('Show'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/customers/edit/id/%d"));
             $records = Customers::Hitparade();
             $widget->setBasepath('/admin/customers/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the customer status summary
         } elseif ($type == 'customer_summary_widget') {
             $records = Customers::summary();
             // get the tickets summary
         } elseif ($type == 'ticket_summary_widget') {
             $records = Tickets::summary();
             // get the domains summary
         } elseif ($type == 'summary_domains_widget') {
             $records = Domains::summary();
             // get the product reviews stats
         } elseif ($type == 'product_reviews_widget') {
             $records = Reviews::summary();
             // get the bestseller product stats
         } elseif ($type == 'bestseller_widget') {
             $buttons = array('edit' => array('label' => $translator->translate('Show'), 'cssicon' => 'glyphicon glyphicon-pencil', 'action' => "/admin/products/edit/id/%d"));
             $records = Products::summary();
             $widget->setBasepath('/admin/products/')->setIdxfield($records['index'])->setButtons($buttons);
             // get the last ISP notes
         } elseif ($type == 'notes_widget') {
             $user = $auth->getIdentity();
             $records = Notes::summary($user['user_id']);
             $widget->setBasepath('/admin/notes/');
         } else {
             die('No widget type has been selected: ' . $type);
         }
         // Records Builtin columns. The code get the field names as header column name
         if (!empty($records['fields'])) {
             foreach ($records['fields'] as $field => $column) {
                 $column['alias'] = !empty($column['alias']) ? $column['alias'] : $field;
                 $widget->setColumn($field, $column);
             }
         }
         if (!empty($records['data'])) {
             $widget->setIcon($icon)->setLabel($title)->setRecords($records['data']);
             die($widget->create());
         }
     }
     die;
 }