Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TimeOutAdmin
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TimeOut
TimeOutAdmin
Commits
095d9077
Commit
095d9077
authored
6 years ago
by
Tobin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'dev_production'
Master See merge request tobin/timeOut!2
parents
7ab2092b
d4a5f42d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
294 additions
and
0 deletions
+294
-0
Api.php
application/controllers/Api.php
+293
-0
Dashboard.php
application/controllers/Dashboard.php
+1
-0
No files found.
application/controllers/Api.php
0 → 100644
View file @
095d9077
<?php
defined
(
'BASEPATH'
)
OR
exit
(
'No direct script access allowed'
);
if
(
isset
(
$_SERVER
[
'HTTP_ORIGIN'
]))
{
header
(
"Access-Control-Allow-Origin:
{
$_SERVER
[
'HTTP_ORIGIN'
]
}
"
);
header
(
'Access-Control-Allow-Credentials: true'
);
header
(
'Access-Control-Max-Age: 86400'
);
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
==
'OPTIONS'
)
{
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_METHOD'
]))
header
(
"Access-Control-Allow-Methods: GET, POST, OPTIONS"
);
if
(
isset
(
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]))
header
(
"Access-Control-Allow-Headers:
{
$_SERVER
[
'HTTP_ACCESS_CONTROL_REQUEST_HEADERS'
]
}
"
);
exit
(
0
);
}
class
Api
extends
CI_Controller
{
var
$auth_token
;
public
function
__construct
()
{
parent
::
__construct
();
$this
->
load
->
model
(
'Api_model'
);
$this
->
load
->
model
(
'Validation_model'
);
$method
=
$this
->
router
->
fetch_method
();
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
if
(
$method
==
'profile'
)
{
$data
=
$_POST
;
}
if
(
isset
(
apache_request_headers
()[
'Auth'
]))
{
$this
->
auth_token
=
apache_request_headers
()[
'Auth'
];
$data
[
'auth_token'
]
=
$this
->
auth_token
;
}
$res
=
$this
->
Validation_model
->
validation_check
(
$method
,
$data
);
if
(
$res
[
'state'
]
==
1
)
{
$this
->
errorResponse
(
$res
[
'response'
][
'code'
],
$res
[
'response'
][
'message'
]);
die
;
}
}
public
function
index
()
{
$res
=
$this
->
Validation_model
->
validation_check
(
'login'
,
array
(
'email_id'
=>
'adarsh'
));
}
public
function
response
(
$data
)
{
$result
=
array
(
'code'
=>
1
,
'message'
=>
'Success'
,
'responseResult'
=>
$data
);
print
json_encode
(
$result
);
}
public
function
errorResponse
(
$errorCode
,
$errorDesc
)
{
$result
=
array
(
'code'
=>
0
,
'message'
=>
'Failure'
,
'errorCode'
=>
$errorCode
,
'errorDesc'
=>
$errorDesc
);
print
json_encode
(
$result
);
}
public
function
login
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$res
=
$this
->
Api_model
->
login
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
register
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$res
=
$this
->
Api_model
->
register
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
forgot
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$res
=
$this
->
Api_model
->
forgot
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
popular
()
{
$res
=
$this
->
Api_model
->
popular
();
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
category
()
{
$res
=
$this
->
Api_model
->
category
();
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
locality
()
{
$res
=
$this
->
Api_model
->
locality
();
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
favourite
(){
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
favourite
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
favouritelist
()
{
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
favouritelist
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
bookedlist
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
bookedlist
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
bookingdetails
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
bookingdetails
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
cancel
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
cancel
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
confirm
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
confirm
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
userinfo
()
{
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
userinfo
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
profile
()
{
$data
=
$_POST
;
if
(
isset
(
$_FILES
[
'profile_picture'
]))
{
$data
[
'file'
]
=
$_FILES
[
'profile_picture'
];
}
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
update_profile
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
tempbooking
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
tempbooking
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
recommend
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
recommend
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
discover
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
discover
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
event
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
event
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
public
function
search
()
{
$data
=
(
array
)
json_decode
(
file_get_contents
(
'php://input'
));
$data
[
'auth_token'
]
=
$this
->
auth_token
;
$res
=
$this
->
Api_model
->
search
(
$data
);
if
(
$res
[
'status'
]
!=
0
){
$this
->
response
(
$res
[
'data'
]);
}
else
{
$this
->
errorResponse
(
$res
[
'code'
],
$res
[
'message'
]);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
application/controllers/Dashboard.php
View file @
095d9077
...
@@ -11,6 +11,7 @@ class Dashboard extends CI_Controller {
...
@@ -11,6 +11,7 @@ class Dashboard extends CI_Controller {
if
(
!
$this
->
session
->
userdata
(
'logged_in'
))
{
if
(
!
$this
->
session
->
userdata
(
'logged_in'
))
{
redirect
(
base_url
(
'Login'
));
redirect
(
base_url
(
'Login'
));
}
}
redirect
(
base_url
(
'Event/listEvents'
));
}
}
public
function
index
()
{
public
function
index
()
{
...
...
This diff is collapsed.
Click to expand it.
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