Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Photogram Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rizwanudeen K
Photogram Project
Commits
1eea79e6
Commit
1eea79e6
authored
2 years ago
by
Aditya
Browse files
Options
Downloads
Patches
Plain Diff
basic functions simplified
parent
931b9b55
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/load.php
+34
-34
34 additions, 34 deletions
libs/load.php
with
34 additions
and
34 deletions
libs/load.php
+
34
−
34
View file @
1eea79e6
<?php
<?php
include_once
'includes/Session.class.php'
;
include_once
'includes/Session.class.php'
;
include_once
'includes/Mic.class.php'
;
include_once
'includes/User.class.php'
;
include_once
'includes/User.class.php'
;
include_once
'includes/Database.class.php'
;
include_once
'includes/Database.class.php'
;
include_once
'includes/UserSession.class.php'
;
include_once
'includes/UserSession.class.php'
;
global
$__site_config
;
function
load_template
(
$template
)
{
// global $__base_path;
$templatePath
=
__DIR__
.
"/../_templates/
$template
.php"
;
//Note: Change this path if you run this code outside lab.
if
(
file_exists
(
$templatePath
))
{
/*
include
"
$templatePath
"
;
Note: Location of configuration
}
else
{
in lab : /home/user/phtogramconfig.json
die
(
"Template not found:
$templatePath
"
);
in server: /var/www/photogramconfig.json
}
*/
};
$__site_config_path
=
dirname
(
is_link
(
$_SERVER
[
'DOCUMENT_ROOT'
])
?
readlink
(
$_SERVER
[
'DOCUMENT_ROOT'
])
:
$_SERVER
[
'DOCUMENT_ROOT'
])
.
'/photogramconfig.json'
;
$__site_config
=
file_get_contents
(
$__site_config_path
);
// $__base_path = get_config('base_path');
Session
::
start
();
function
get_config
(
$key
,
$default
=
null
)
function
get_config
(
$key
){
{
$configPath
=
__DIR__
.
"/../photogramconfig.json"
;
global
$__site_config
;
$json
=
file_get_contents
(
$configPath
);
$array
=
json_decode
(
$__site_config
,
true
);
if
(
file_exists
(
$configPath
)){
if
(
isset
(
$array
[
$key
]))
{
$array
=
json_decode
(
$json
,
true
);
return
$array
[
$key
];
if
(
isset
(
$array
[
$key
]))
{
}
else
{
return
$array
[
$key
];
return
$default
;
}
else
{
}
return
false
;
}
}
}
else
{
die
(
"File Not Found:
$configPath
"
);
}
function
load_template
(
$name
)
{
include
$_SERVER
[
'DOCUMENT_ROOT'
]
.
get_config
(
'base_path'
)
.
"_templates/
$name
.php"
;
//not consistant.
}
function
validate_credentials
(
$username
,
$password
)
}
{
function
validate_credentials
(
$username
,
$password
){
if
(
$username
==
"sibi@selfmade.ninja"
and
$password
==
"password"
)
{
if
(
$username
==
"sibi@selfmade.ninja"
and
$password
==
"password"
)
{
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment