Example #1
0
                 	}
                 }
                 */
                 $core->headerControl->internalFoward($str);
                 $core->action = "edit";
                 // if internalFoward is disabled
                 $pa_dealt = true;
             }
         case 4:
             // public
             $url = new CKTemplate($core->template);
             $url->tbreak($module->options[CONS_MODULE_PUBLIC]);
             $url = $url->techo($_POST);
             $url = CONS_INSTALL_ROOT . $url;
             $core->headerControl->internalFoward($url);
             list($core->context, $core->action, $core->original_action, $ext) = extractUri("", $url);
             $core->context_str = implode("/", $core->context);
             $pa_dealt = true;
             break;
     }
     if (!$pa_dealt) {
         $core->action = "list";
         $_REQUEST = array('module' => $_REQUEST['module']);
         // prevents filtering the list in the event of non-foward mode
         $core->headerControl->internalFoward("list.html?module=" . $_REQUEST['module']);
     }
 } else {
     # error, stays with no redirect, but remove keys if it were insertion
     if ($_POST['vaction'] == "add") {
         unset($_POST[$module->keys[0]]);
         # remove main key to force "create" pane
Example #2
0
 function domainLoad()
 {
     $uri = explode(":", isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']);
     $this->domain = strtolower(array_shift($uri));
     # removes protocol
     if (CONS_AUTOREMOVEWWW && substr($this->domain, 0, 4) == "www.") {
         $this->domain = substr($this->domain, 4);
     }
     if (CONS_SINGLEDOMAIN != '') {
         # single domain? use it
         $_SESSION["DOMAIN"] = $this->domain;
         $_SESSION['CODE'] = CONS_SINGLEDOMAIN;
     } else {
         if (!CONS_ONSERVER && CONS_SITESELECTOR) {
             # multiple domain, if on production and we can select domain manually ...
             if (isset($_REQUEST['nocache'])) {
                 $domainList = $this->builddomains();
             }
             if (isset($_REQUEST['changelocalsite']) && isset($_REQUEST['nosession']) && is_dir(CONS_PATH_PAGES . $_REQUEST['changelocalsite'])) {
                 # new domain arrived! switch everything to this domain
                 $_COOKIE['prescia_cls'] = $_REQUEST['changelocalsite'];
                 setcookie('prescia_cls', $_REQUEST['changelocalsite'], time() + 28800);
             } else {
                 if (!isset($_COOKIE['prescia_cls']) || isset($_REQUEST['prescia_cls']) && isset($_REQUEST['debugmode']) && isset($_REQUEST['nosession'])) {
                     # no domain selected or requested domain change, chose domain selector
                     include_once CONS_PATH_SYSTEM . "lazyload/cls.php";
                     die;
                 }
             }
             if (isset($_COOKIE['prescia_cls'])) {
                 # we have a domain set, use it
                 $_SESSION['CODE'] = $_COOKIE['prescia_cls'];
                 $_SESSION['DOMAIN'] = $this->domain;
                 setcookie('prescia_cls', $_COOKIE['prescia_cls'], time() + 3600);
                 // renew cookie for at least an hour
             }
         }
     }
     if (!isset($_SESSION['CODE']) || !isset($_SESSION['DOMAIN']) || $_SESSION['DOMAIN'] != $this->domain || isset($_REQUEST['nocache']) && !isset($_COOKIE['prescia_cls'])) {
         # no data, different domain or forced reload
         $errCode = 102;
         $hasFile = is_file(CONS_PATH_CACHE . "domains.dat");
         if ($hasFile) {
             $domainList = unserialize(cReadFile(CONS_PATH_CACHE . "domains.dat"));
         }
         if (isset($_REQUEST['nocache']) || !$hasFile || $domainList === false) {
             # This is a cached script. Performance is mandatory
             $errCode = 101;
             $domainList = $this->builddomains();
         }
         if (isset($domainList[$this->domain])) {
             $_SESSION['CODE'] = $domainList[$this->domain];
         }
         if (!isset($_SESSION['CODE']) || !is_file(CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/config.php")) {
             $this->log[] = "Registered domains: " . count($domainList);
             $this->errorControl->raise($errCode, $this->domain, "", !isset($_SESSION['CODE']) ? 'Domain not registered' : 'config.php not found (CODE: ' . $_SESSION['CODE'] . ")");
         }
         $_SESSION["DOMAIN"] = $this->domain;
         unset($_SESSION['CANONICAL']);
     }
     # Loads the selected domain/site configuration file
     require CONS_PATH_PAGES . $_SESSION['CODE'] . "/_config/config.php";
     # Checks parseRewrite (language and canonical)
     if (count($this->parseRewrite) > 0) {
         if (isset($this->parseRewrite[$this->domain])) {
             // language ?
             if (!isset($_SESSION[CONS_SESSION_LANG]) && $this->parseRewrite[$this->domain][0] != '') {
                 $_SESSION[CONS_SESSION_LANG] = $this->intlControl->loadLocale($this->parseRewrite[$this->domain][0]);
             }
         }
         if (!isset($_SESSION['CANONICAL'])) {
             // canonical?
             $_SESSION['CANONICAL'] = $this->domain;
             foreach ($this->parseRewrite as $domain => $settings) {
                 if ($settings[1]) {
                     $_SESSION['CANONICAL'] = $domain;
                     break;
                 }
             }
         }
     } else {
         $_SESSION['CANONICAL'] = $_SESSION["DOMAIN"];
     }
     if (CONS_USE_I18N) {
         # Checks which language we will serve control (IF ENABLED)
         if (isset($_REQUEST['lang']) && !isset($_POST['haveinfo']) && strpos(CONS_POSSIBLE_LANGS . ",", $_REQUEST['lang'] . ",") !== false) {
             $_SESSION[CONS_SESSION_LANG] = $_REQUEST['lang'];
         }
         $_SESSION[CONS_SESSION_LANG] = $this->intlControl->loadLocale(isset($_SESSION[CONS_SESSION_LANG]) ? $_SESSION[CONS_SESSION_LANG] : CONS_DEFAULT_LANG);
     } else {
         $_SESSION[CONS_SESSION_LANG] = CONS_DEFAULT_LANG;
     }
     # loads requested page and fills context/actions
     list($this->context, $this->action, $this->original_action, $this->original_ext) = extractUri(CONS_INSTALL_ROOT);
     $this->context_str = implode("/", $this->context) . "/";
     if ($this->context_str[0] != "/") {
         $this->context_str = "/" . $this->context_str;
     }
     if ($this->action == "") {
         $this->action = "index";
     }
     $this->original_context_str = $this->context_str;
     # storage of original call in case script redirects us, also used by stats
     # LAYOUT CONTROLER -- (need early for the bot control)
     # 0 = normal, 1 = no frame, 2 = ajax (.ajax or .xml to force), = mobile (.mob to force)
     $this->layout = isset($_REQUEST['layout']) ? (int) $_REQUEST['layout'] : 0;
     if ($this->original_ext == "ajax" || $this->original_ext == "xml") {
         $this->layout = 2;
     } else {
         if ($this->layout != 2 && ($this->original_ext == "mob" || CONS_BROWSER_ISMOB && !isset($_SESSION['NOMOBVER']))) {
             $this->layout = 3;
         }
     }
     if (!is_numeric($this->layout) || $this->layout < 0 || $this->layout > 3) {
         $this->layout = 0;
     }
     if ($this->layout == 3 && isset($_REQUEST['desktopversion'])) {
         $_SESSION['NOMOBVER'] = true;
         $this->layout = 0;
     }
     if ($this->layout == 0 && isset($_REQUEST['mobileversion'])) {
         unset($_SESSION['NOMOBVER']);
         $this->layout = 3;
     }
     # anti-bot (basically a anti-DOS tool)
     if (!CONS_ECONOMICMODE && CONS_BOTPROTECT && ($this->layout != 2 || !$this->noBotProtectOnAjax)) {
         require CONS_PATH_SYSTEM . "lazyload/botprotect.php";
     }
 }