Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
4n53
php-locator
Commits
57f43c28
Commit
57f43c28
authored
Jul 14, 2017
by
Comrade 4n53
Browse files
sample locator.php file; .projectStatus marker
parent
10304e42
Changes
2
Hide whitespace changes
Inline
Side-by-side
.projectStatus
0 → 100644
View file @
57f43c28
no remote repository yet
locator.php
0 → 100644
View file @
57f43c28
<?php
declare
(
strict_types
=
1
);
class
LOCATOR
{
public
static
$dirData
=
'e:/Mount/vida/dev/filesystem'
;
//$dirCall = dirname($_SERVER['SCRIPT_FILENAME']);
//$dirHere = __DIR__;
public
static
$urlServerFilesystemRelativity
=
'/..'
;
public
static
$urlServer
=
null
;
//public static $url = 'http://localhost:5141';
public
static
$dbs
=
[
'server'
=>
'localhost'
,
'username'
=>
'root'
,
'password'
=>
''
,
'dbname'
=>
'vida3_dev'
,
//prefix
];
public
static
$isNetless
=
false
;
public
static
$isLocal
=
true
;
public
static
$isLive
=
false
;
public
static
$isTesting
=
null
;
//to be resolved
public
static
$testing
=
[
'setup1'
=>
[
'dbs'
=>
[
'dbname'
=>
'vida3_test'
],
// 'geoIp_fail'=>true,
// 'geoIp_localOnly'=>true,
// 'geoIp_noData'=>true,
],
'setup2'
=>
[
'dbs'
=>
[
'dbname'
=>
'vida3_test'
],
// 'googleCapture_fail'=>true,
// 'googleCapture_shortcircuit'=>true,
],
];
public
static
$jsLocator
=
[
'LOCATOR = {};'
];
}
//class
LOCATOR
::
$urlServer
=
(
php_sapi_name
()
===
'cli'
)
?
'file:///'
.
urlencode
(
__DIR__
)
.
LOCATOR
::
$urlServerFilesystemRelativity
:
$_SERVER
[
'REQUEST_SCHEME'
]
.
'://'
.
$_SERVER
[
'HTTP_HOST'
]
.
':'
.
$_SERVER
[
'SERVER_PORT'
]
;
//require_once(__DIR__.'/../php/autoload.php');
require_once
(
__DIR__
.
'/../.composer/autoload.php'
);
require_once
(
__DIR__
.
'/../.composer/_ihde/php/autoload.php'
);
\
session_start
();
{
LOCATOR
::
$jsLocator
=
\
array_merge
(
LOCATOR
::
$jsLocator
,
[
'LOCATOR.isNetless = '
.
(
\
LOCATOR
::
$isNetless
?
'true;'
:
'false;'
),
'LOCATOR.isLocal = '
.
(
\
LOCATOR
::
$isLocal
?
'true;'
:
'false;'
),
'LOCATOR.isLive = '
.
(
\
LOCATOR
::
$isLive
?
'true;'
:
'false;'
),
'LOCATOR.urlServer = "'
.
\
LOCATOR
::
$urlServer
.
';'
,
]);
if
((
php_sapi_name
()
!==
'cli'
)
&&
\
strpos
(
$_SERVER
[
'REQUEST_URI'
],
'/test/'
)
===
0
)
{
LOCATOR
::
$isTesting
=
$_SERVER
[
'REQUEST_URI'
];
}
if
(
\
array_key_exists
(
'test'
,
$_COOKIE
))
{
LOCATOR
::
$isTesting
=
$_COOKIE
[
'test'
];
}
if
(
\
array_key_exists
(
'test'
,
$_GET
))
{
LOCATOR
::
$isTesting
=
$_GET
[
'test'
];
}
//override cascade
if
(
LOCATOR
::
$isTesting
!==
false
)
{
LOCATOR
::
$testing
=
LOCATOR
::
$testing
[
LOCATOR
::
$isTesting
];
LOCATOR
::
$dbs
=
\
array_merge
(
LOCATOR
::
$dbs
,
LOCATOR
::
$testing
[
'dbs'
]);
LOCATOR
::
$jsLocator
=
\
array_merge
(
LOCATOR
::
$jsLocator
,
[
''
.
'LOCATOR.testing = '
.
\
json_encode
(
\
LOCATOR
::
$testing
,
\
JSON_FORCE_OBJECT
|
\
JSON_PRETTY_PRINT
)
.
';'
]);
}
else
{
LOCATOR
::
$jsLocator
=
\
array_merge
(
LOCATOR
::
$jsLocator
,
[
''
.
'LOCATOR.testing = {};'
]);
}
LOCATOR
::
$jsLocator
.
=
\
implode
(
PHP_EOL
,
LOCATOR
::
$jsLocator
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment