Example #1
0
logiksRequestPreboot();
include_once SERVICE_ROOT . "ServiceAuthEngine.inc";
include_once SERVICE_ROOT . "api.php";
include_once ROOT . "api/configurator.php";
loadConfigs([ROOT . "config/basic.cfg", ROOT . "config/php.cfg", ROOT . "config/system.cfg", ROOT . "config/developer.cfg", ROOT . "config/services.cfg", ROOT . "config/errorlog.cfg", ROOT . "config/security.cfg", ROOT . "config/others.cfg", ROOT . "config/xtras.cfg", ROOT . "config/folders.cfg"]);
LogiksConfig::fixPHPINIConfigs();
define('SiteLocation', 'http' . (_server('HTTPS') ? 's' : '') . '://' . "{_server('HTTP_HOST')}/" . InstallFolder);
require_once ROOT . "api/libs/errorLogs/boot.php";
logiksServiceBoot();
header("X-Powered-By: Logiks [http://openlogiks.org]", false);
header("SESSION-KEY:" . session_id(), false);
header("Access-Control-Allow-Origin:*");
//Origin
//Access-Control-Allow-Methods:OPTIONS,GET,POST,PUT,DELETE
//Access-Control-Allow-Headers:Content-Type, Authorization, X-Requested-With
//header("Access-Control-Allow-Headers", "access-control-allow-origin, accept, access-control-allow-methods, access-control-allow-headers, x-random-shit");
//header("X-Powered-By: ".Framework_Title." [".Framework_Site."]",false);
//print_r($GLOBALS['LOGIKS']["_SERVER"]);exit();
include_once ROOT . "api/libs/logiksCache/boot.php";
include_once ROOT . "api/libs/loaders/boot.php";
include_once ROOT . "api/system.php";
include_once ROOT . "api/security.php";
include_once ROOT . "api/app.php";
include_once ROOT . "api/libs/logiksUser/boot.php";
include_once ROOT . "api/libs/logiksTemplate/boot.php";
include_once SERVICE_ROOT . "ServiceController.inc";
_envData("SESSION", 'SERVICE', true);
_envData("SESSION", 'SESS_ACTIVE_SITE', SITENAME);
ini_set("error_reporting", getConfig("SERVICE_ERROR_REPORTING"));
loadHelpers(array("urltools", "hooks", "mobility", "formatprint", "shortfuncs"));
runHooks("serviceInit");
Example #2
0
 function _env($var, $value = null)
 {
     if ($value == null) {
         $data = LogiksSession::getInstance()->data('ENV');
         if (isset($data[$var])) {
             return $data[$var];
         }
     } else {
         _envData("ENV", $var, $value);
         return $value;
     }
 }
Example #3
0
 function logiksServiceBoot()
 {
     if (LogiksSingleton::funcCheckout("logiksServiceBoot")) {
         $dm = new DomainMap();
         $dm->detect();
         if (!defined("SITENAME")) {
             trigger_error("SITE NOT DEFINED", E_USER_ERROR);
         }
         if (!isset($_REQUEST['scmd'])) {
             $rURI = explode("?", _server('REQUEST_URI'));
             $rURI = explode(".", $rURI[0]);
             if (isset($rURI[1])) {
                 $_REQUEST['format'] = $rURI[1];
             }
             $scmdArr = explode("services/", $rURI[0]);
             if (count($scmdArr) > 1) {
                 array_shift($scmdArr);
             }
             $scmdArr = explode("/", $scmdArr[0]);
             $_REQUEST['scmd'] = $scmdArr[0];
             if (isset($scmdArr[1])) {
                 $_REQUEST['action'] = $scmdArr[1];
             }
             if (count($scmdArr) > 2) {
                 array_shift($scmdArr);
                 $_REQUEST['actionslug'] = implode("-", $scmdArr);
                 $_REQUEST['slug'] = $scmdArr;
             }
         }
         if (!isset($_REQUEST['action'])) {
             //TODO : GET, POST, PUT, DELETE, PURGE, VIEW
             //		PATCH, COPY, HEAD, OPTIONS, LINK, UNLINK, LOCK, UNLOCK, PROPFIND,
             $_REQUEST['action'] = "";
         }
         if (!isset($_REQUEST['actionslug'])) {
             $_REQUEST['slugpath'] = $_REQUEST['action'];
         }
         if (!isset($_REQUEST['slug'])) {
             $_REQUEST['slug'] = array();
         }
         $_REQUEST['site'] = SITENAME;
         //Handling Encoded/Encrypted QUERY_STRINGS
         if (isset($_REQUEST['encoded'])) {
             $query = $_REQUEST['encoded'];
             $queryo = decryptURL($query);
             $query = explode("&", $queryo);
             foreach ($query as $q) {
                 $q = explode("=", $q);
                 if (count($q) == 0) {
                 } elseif (count($q) == 1) {
                     $_REQUEST[$q[0]] = "";
                 } else {
                     $qs = $q[0];
                     unset($q[0]);
                     $qv = implode("=", $q);
                     $_REQUEST[$qs] = $qv;
                 }
             }
             _envData("SERVER", 'QUERY_STRING', "&{$queryo}");
         }
         $cmdFormat = explode(",", SUPPORTED_OUTPUT_FORMATS);
         if (!isset($_REQUEST['format'])) {
             $_REQUEST['format'] = getConfig("DEFAULT_OUTPUT_FORMAT");
         } else {
             $_REQUEST['format'] = strtolower($_REQUEST['format']);
             if (!in_array($_REQUEST['format'], $cmdFormat)) {
                 trigger_logikserror(902, E_USER_ERROR);
             } else {
                 $_GET['format'] = $_REQUEST['format'];
             }
         }
     }
 }
Example #4
0
 public function __construct()
 {
     if (!_server('HTTP_USER_AGENT')) {
         _envData("SERVER", 'HTTP_USER_AGENT', "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19");
     }
     $this->userAgent = _server('HTTP_USER_AGENT');
     //$this->userAgent = "(iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML  like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5,CGI/1.1,HTTP/1.0,GET,219.91.184.34";
     if (_server('HTTP_ACCEPT')) {
         $this->accept = _server('HTTP_ACCEPT');
     } else {
         $this->accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
     }
     if (_server('HTTP_X_WAP_PROFILE') || _server('HTTP_PROFILE')) {
         $this->isMobile = true;
     } elseif (strpos($this->accept, 'text/vnd.wap.wml') > 0 || strpos($this->accept, 'application/vnd.wap.xhtml+xml') > 0) {
         $this->isMobile = true;
     } else {
         foreach ($this->devices as $device => $regexp) {
             if ($this->isDevice($device)) {
                 $this->isMobile = true;
             }
         }
     }
     if ($this->isBlackberrytablet()) {
         $this->isTablet = true;
         $this->isMobile = false;
     } elseif ($this->isAndroidtablet()) {
         $this->isTablet = true;
         $this->isMobile = false;
     } elseif ($this->isIpad()) {
         $this->isTablet = true;
         $this->isMobile = false;
     }
 }
Example #5
0
function startNewSession($userid, $domain, $dbLink, $params = array())
{
    session_regenerate_id();
    $data = $_ENV['AUTH-DATA'];
    //printArray($data);exit();
    $_SESSION['SESS_USER_ID'] = $data['userid'];
    $_SESSION['SESS_PRIVILEGE_ID'] = $data['privilege'];
    $_SESSION['SESS_ACCESS_ID'] = $data['access'];
    $_SESSION['SESS_GUID'] = $data['guid'];
    $_SESSION['SESS_PRIVILEGE_NAME'] = $data['privilege_name'];
    $_SESSION['SESS_ACCESS_NAME'] = $data['master'];
    $_SESSION['SESS_ACCESS_SITES'] = $data['sitelist'];
    $_SESSION['SESS_USER_NAME'] = $data['name'];
    $_SESSION['SESS_USER_EMAIL'] = $data['email'];
    $_SESSION['SESS_USER_CELL'] = $data['mobile'];
    $_SESSION['SESS_USER_AVATAR'] = $data['avatar_type'] . "::" . $data['avatar'];
    $_SESSION['SESS_LOGIN_SITE'] = $domain;
    $_SESSION['SESS_ACTIVE_SITE'] = $domain;
    _envData("SESSION", 'SESS_ACTIVE_SITE', $domain);
    $_SESSION['SESS_TOKEN'] = session_id();
    $_SESSION['SESS_SITEID'] = SiteID;
    $_SESSION['SESS_LOGIN_TIME'] = time();
    $_SESSION['MAUTH_KEY'] = generateMAuthKey();
    if ($data['privilege'] <= 3) {
        $_SESSION["SESS_FS_FOLDER"] = ROOT;
        $_SESSION["SESS_FS_URL"] = SiteLocation;
    } else {
        $_SESSION["SESS_FS_FOLDER"] = ROOT . APPS_FOLDER . $domain . "/";
        $_SESSION["SESS_FS_URL"] = SiteLocation . APPS_FOLDER . $domain . "/";
    }
    if (strlen($_SESSION['SESS_USER_NAME']) <= 0) {
        $_SESSION['SESS_USER_NAME'] = $_SESSION['SESS_USER_ID'];
    }
    header_remove("SESSION-KEY");
    header("SESSION-KEY:" . session_id(), false);
    $q1 = $dbLink->_insertQ1(_dbTable("log_login", true), array("date" => date("Y-m-d"), "user" => $userid, "site" => $domain, "login_time" => date('H:i:s'), "sys_spec" => _server('REMOTE_ADDR'), "token" => $_SESSION['SESS_TOKEN'], "mauth_key" => $_SESSION['MAUTH_KEY'], "status" => 'LOGGED IN', "msg" => '', "persistant" => $data['persistant'], "client" => _server('REMOTE_ADDR'), "user_agent" => _server('HTTP_USER_AGENT'), "device" => $data['device']));
    $dbLink->executeQuery($q1);
    setcookie("LOGIN", "true", time() + 36000);
    setcookie("USER", $_SESSION['SESS_USER_ID'], time() + 36000);
    setcookie("TOKEN", $_SESSION['SESS_TOKEN'], time() + 36000);
    setcookie("SITE", $_SESSION['SESS_LOGIN_SITE'], time() + 36000);
    if ($data['persistant'] == "true") {
        $q1 = $dbLink->_insertQ1(_dbTable("log_sessions", true), array("sessionid" => $_SESSION['SESS_TOKEN'], "timestamp" => date("Y-m-d H:i:s"), "last_updated" => date("Y-m-d H:i:s"), "user" => $userid, "site" => $domain, "session_data" => json_encode($_SESSION), "global_data" => json_encode($GLOBALS), "client" => _server('REMOTE_ADDR'), "user_agent" => _server('HTTP_USER_AGENT'), "device" => $data['device']));
        $dbLink->executeQuery($q1);
    }
    gotoSuccessLink();
}