function indexAction()
 {
     $this->view->title = ___('Fix aMember Pro License Key');
     $this->view->msg = Am_License::getInstance()->check();
     $form = new Am_Form_Admin_FixLicense();
     $form->setDataSources(array($this->getRequest(), $form->getDsDefaults()));
     if ($form->isSubmitted() && $form->validate()) {
         $vars = $form->getValue();
         Am_Config::saveValue('license', $vars['license']);
         Am_Config::saveValue('root_url', $vars['root_url']);
         Am_Config::saveValue('root_surl', $vars['root_surl']);
         return $this->redirectLocation($this->getFullUrl());
     }
     $this->view->form = $form;
     $this->view->display('admin/fixlicense.phtml');
 }
 protected function getRedirectUrl($url)
 {
     $redirect_url = parse_url($url);
     if (!is_array($redirect_url)) {
         return;
     }
     if (array_key_exists('host', $redirect_url) && !$this->getDi()->config->get('other_domains_redirect')) {
         $match = false;
         foreach (array(ROOT_URL, ROOT_SURL) as $u) {
             $amember_url = parse_url($u);
             if (Am_License::getMinDomain($amember_url['host']) == Am_License::getMinDomain($redirect_url['host'])) {
                 $match = true;
             }
         }
     } else {
         $match = true;
     }
     if ($match) {
         return $url;
     }
 }
Beispiel #3
0
 public function setSessionCookieDomain()
 {
     if (ini_get('session.cookie_domain') != '') {
         return;
     }
     // already configured
     $domain = @$_SERVER['HTTP_HOST'];
     $domain = strtolower(trim(preg_replace('/(\\:\\d+)$/', '', $domain)));
     if (!$domain) {
         return;
     }
     if ($domain == 'localhost') {
         return;
     }
     if (preg_match('/\\.(dev|local)$/', $domain)) {
         @ini_set('session.cookie_domain', ".{$domain}");
         return;
     }
     /*
      *  If domain is valid IP address do not change session.cookie_domain;
      */
     if (filter_var($domain, FILTER_VALIDATE_IP)) {
         return $domain;
     }
     try {
         $min = Am_License::getMinDomain($domain);
     } catch (Exception $e) {
         return;
     }
     @ini_set('session.cookie_domain', ".{$min}");
 }
Beispiel #4
0
 private static function _getCookieDomain($d)
 {
     if ($d === null || $d == 'localhost') {
         return null;
     }
     if (preg_match('/\\.(dev|local)$/', $d)) {
         return null;
     }
     try {
         $d = '.' . Am_License::getMinDomain($d);
     } catch (Exception $e) {
     }
     return $d;
 }
Beispiel #5
0
 public function setSessionCookieDomain()
 {
     if (ini_get('session.cookie_domain') != '') {
         return;
     }
     // already configured
     $domain = @$_SERVER['HTTP_HOST'];
     $domain = strtolower(trim(preg_replace('/(\\:\\d+)$/', '', $domain)));
     if (!$domain) {
         return;
     }
     if ($domain == 'localhost') {
         return $domain;
     }
     if (preg_match('/\\.(dev|local)$/', $domain)) {
         return $domain;
     }
     try {
         $min = Am_License::getMinDomain($domain);
     } catch (Exception $e) {
         return;
     }
     @ini_set('session.cookie_domain', ".{$min}");
 }
Beispiel #6
0
 private static function _getCookieDomain($d)
 {
     if ($d === null) {
         return null;
     }
     $d = strtolower(trim(preg_replace('/(\\:\\d+)$/', '', $d)));
     if ($d == 'localhost') {
         return null;
     }
     if (preg_match('/\\.(dev|local)$/', $d)) {
         return null;
     }
     if (filter_var($d, FILTER_VALIDATE_IP)) {
         return null;
     }
     try {
         $d = '.' . Am_License::getMinDomain($d);
     } catch (Exception $e) {
     }
     return $d;
 }