Esempio n. 1
0
 public static function login($view)
 {
     $user_session = new Container('user');
     //if already login, redirect to success page
     if ($view->getAuthService()->hasIdentity()) {
         $user_session->message = '';
         if ($view->getAuthService()->getPublisherInfoID() != null) {
             return $view->redirect()->toRoute('publisher');
         } else {
             return $view->redirect()->toRoute('private-exchange');
         }
     }
     $logo_url = null;
     $http_host = @$_SERVER['HTTP_HOST'];
     if ($http_host != null) {
         $PrivateExchangeVanityDomainFactory = \_factory\PrivateExchangeVanityDomain::get_instance();
         $params = array();
         $params["VanityDomain"] = strtolower($http_host);
         $PrivateExchangeVanityDomain = $PrivateExchangeVanityDomainFactory->get_row($params);
         if ($PrivateExchangeVanityDomain != null) {
             $theme_path = '/vdomain/' . $PrivateExchangeVanityDomain->UserID . '/theme.css';
             if ($PrivateExchangeVanityDomain->UseLogo == 1) {
                 $logo_url = '/vdomain/' . $PrivateExchangeVanityDomain->UserID . '/logo-lg.png';
             }
         }
     }
     $viewModel = new ViewModel(array('messages' => $user_session->message, 'center_class' => 'centerj', 'logo_url' => $logo_url, 'dashboard_view' => 'login'));
     return $viewModel->setTemplate('dashboard-manager/auth/login.phtml');
 }
Esempio n. 2
0
 /**
  * Display the signup index page.
  * 
  * @return \Zend\View\Model\ViewModel
  */
 public function indexAction()
 {
     $auth = $this->getServiceLocator()->get('AuthService');
     if ($auth->hasIdentity()) {
         $initialized = $this->initialize();
         if ($initialized === true) {
             return $this->redirect()->toRoute($this->dashboard_home);
         }
     }
     $http_host = @$_SERVER['HTTP_HOST'];
     if ($http_host != null) {
         $PrivateExchangeVanityDomainFactory = \_factory\PrivateExchangeVanityDomain::get_instance();
         $params = array();
         $params["VanityDomain"] = strtolower($http_host);
         $PrivateExchangeVanityDomain = $PrivateExchangeVanityDomainFactory->get_row($params);
         if ($PrivateExchangeVanityDomain != null) {
             return \util\AuthHelper::login($this);
         }
     }
     $view = new ViewModel(array('dashboard_view' => 'signup', 'vertical_map' => \util\DeliveryFilterOptions::$vertical_map));
     return $view;
 }
Esempio n. 3
0
 public function newvanitydomainAction()
 {
     $initialized = $this->initialize();
     if ($initialized !== true) {
         return $initialized;
     }
     $assets_dir = 'public/vdomain/' . $this->auth->getUserID() . '/';
     $theme_colors = $this->config_handle['themes']['default_colors'];
     $vanity_domain = $this->getRequest()->getPost("vanity-domain");
     $vd_enabled = $this->getRequest()->getPost("vd-enabled");
     $logo_enabled = $this->getRequest()->getPost("logo-enabled");
     $reset = $this->getRequest()->getPost("B2");
     if ($reset != "Reset Colors") {
         foreach ($this->getRequest()->getPost() as $key => $value) {
             if (isset($theme_colors[$key]) && strpos($value, '#') == 0 && strlen($value) <= 7) {
                 $theme_colors[$key] = $value;
             }
         }
     }
     $serialized_colors = serialize($theme_colors);
     $PrivateExchangeVanityDomainFactory = \_factory\PrivateExchangeVanityDomain::get_instance();
     $PrivateExchangeThemeFactory = \_factory\PrivateExchangeTheme::get_instance();
     $params = array();
     $params["UserID"] = $this->auth->getUserID();
     $PrivateExchangeTheme = $PrivateExchangeThemeFactory->get_row($params);
     $params = array();
     $params["UserID"] = $this->auth->getUserID();
     $_PrivateExchangeTheme = $PrivateExchangeThemeFactory->get_row($params);
     $PrivateExchangeTheme = new \model\PrivateExchangeTheme();
     $PrivateExchangeTheme->UserID = $this->auth->getUserID();
     $PrivateExchangeTheme->ThemeParamsSerialized = $serialized_colors;
     if ($_PrivateExchangeTheme != null) {
         $PrivateExchangeThemeFactory->updatePrivateExchangeTheme($PrivateExchangeTheme);
     } else {
         $PrivateExchangeThemeFactory->insertPrivateExchangeTheme($PrivateExchangeTheme);
     }
     if ($vd_enabled == 1) {
         if (empty($vanity_domain)) {
             die("Missing Vanity Domain: CODE 107");
         }
         $vanity_domain = trim(strtolower(str_replace(array('https://', 'http://'), array('', ''), $vanity_domain)));
         $site_url = $this->config_handle['delivery']['site_url'];
         $site_url = trim(strtolower(str_replace(array('https://', 'http://'), array('', ''), $site_url)));
         if (empty($vanity_domain) || $vanity_domain == $site_url) {
             die("Illegal Vanity Domain, try another domain: CODE 108");
         }
         if (!file_exists($assets_dir)) {
             mkdir($assets_dir, 0755, true);
         }
         $css = file_get_contents('public/css/colorscheme/theme.css.template');
         foreach ($theme_colors as $key => $value) {
             $css = str_replace($key, $value, $css);
         }
         $fh = fopen($assets_dir . "theme.css", "w");
         fwrite($fh, $css);
         fclose($fh);
         $params = array();
         $params["UserID"] = $this->auth->getUserID();
         $_PrivateExchangeVanityDomain = $PrivateExchangeVanityDomainFactory->get_row($params);
         $PrivateExchangeVanityDomain = new \model\PrivateExchangeVanityDomain();
         $PrivateExchangeVanityDomain->UserID = $this->auth->getUserID();
         $PrivateExchangeVanityDomain->VanityDomain = $vanity_domain;
         $PrivateExchangeVanityDomain->UseLogo = $logo_enabled == 1 ? 1 : 0;
         if ($_PrivateExchangeVanityDomain != null) {
             $PrivateExchangeVanityDomainFactory->updatePrivateExchangeVanityDomain($PrivateExchangeVanityDomain);
         } else {
             $PrivateExchangeVanityDomainFactory->insertPrivateExchangeVanityDomain($PrivateExchangeVanityDomain);
         }
     } else {
         $PrivateExchangeVanityDomainFactory->deletePrivateExchangeVanityDomain($this->auth->getUserID());
     }
     return $this->redirect()->toUrl('/private-exchange/edittheme?success=true');
 }