Commit 10a8a4bd by Tobin

Merge branch 'jansa' into 'master'

Jansa See merge request !96
parents c5265aab be763f0b
...@@ -75,10 +75,10 @@ $query_builder = TRUE; ...@@ -75,10 +75,10 @@ $query_builder = TRUE;
$db['default'] = array( $db['default'] = array(
'dsn' => '', 'dsn' => '',
'hostname' => 'localhost', 'hostname' => '192.168.140.123',
'username' => 'nuvento_timeout', 'username' => 'root',
'password' => 'Golden_123', 'password' => 'Golden_123',
'database' => 'nuvento_timeout', 'database' => 'tobin_eventTimeOut',
'dbdriver' => 'mysqli', 'dbdriver' => 'mysqli',
'dbprefix' => '', 'dbprefix' => '',
'pconnect' => FALSE, 'pconnect' => FALSE,
......
...@@ -63,7 +63,6 @@ class Webservice extends CI_Controller { ...@@ -63,7 +63,6 @@ class Webservice extends CI_Controller {
} }
} }
public function check_email_availability() { public function check_email_availability() {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Webservice_model->availability($data); $res = $this->Webservice_model->availability($data);
...@@ -86,17 +85,17 @@ class Webservice extends CI_Controller { ...@@ -86,17 +85,17 @@ class Webservice extends CI_Controller {
} }
} }
public function get_events_list() { public function get_events_list() {
$data = $_GET; $data = $_GET;
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->discover($data); $res = $this->Webservice_model->discover($data);
if($res['status']!=0 && sizeof($res['data'])){ if($res['status']!=0 && sizeof($res['data'])){
$this->responseEventList($res['data']); $this->responseEventList($res['data']);
}elseif($res['status']!=0 && sizeof($res['data'] == 0)){ }elseif($res['status']!=0 && sizeof($res['data'] == 0)){
$this->response($res['data']); $this->response($res['data']);
}else{ }else{
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function events_details($event_id = null) { public function events_details($event_id = null) {
...@@ -134,8 +133,7 @@ class Webservice extends CI_Controller { ...@@ -134,8 +133,7 @@ class Webservice extends CI_Controller {
print json_encode($result); print json_encode($result);
} }
public function successResponse($data) {
public function successResponse($data) {
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
); );
...@@ -151,8 +149,7 @@ class Webservice extends CI_Controller { ...@@ -151,8 +149,7 @@ class Webservice extends CI_Controller {
print json_encode($result); print json_encode($result);
} }
public function get_category_list($query = null) {
public function get_category_list($query = null) {
$data['query'] = !empty($_GET['query']) ? $_GET['query'] : ''; $data['query'] = !empty($_GET['query']) ? $_GET['query'] : '';
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->get_category_list($data); $res = $this->Webservice_model->get_category_list($data);
...@@ -164,7 +161,7 @@ class Webservice extends CI_Controller { ...@@ -164,7 +161,7 @@ class Webservice extends CI_Controller {
} }
} }
public function add_favorites(){ public function add_favorites(){
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->add_favorites($data); $res = $this->Webservice_model->add_favorites($data);
...@@ -176,8 +173,7 @@ class Webservice extends CI_Controller { ...@@ -176,8 +173,7 @@ class Webservice extends CI_Controller {
} }
} }
public function get_cities_list() {
public function get_cities_list() {
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->get_cities_list($data); $res = $this->Webservice_model->get_cities_list($data);
if($res['status']!=0){ if($res['status']!=0){
...@@ -186,11 +182,9 @@ class Webservice extends CI_Controller { ...@@ -186,11 +182,9 @@ class Webservice extends CI_Controller {
else{ else{
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function update_city(){
public function update_city(){
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->update_city($data); $res = $this->Webservice_model->update_city($data);
...@@ -291,6 +285,7 @@ class Webservice extends CI_Controller { ...@@ -291,6 +285,7 @@ class Webservice extends CI_Controller {
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function cancel_booking() { public function cancel_booking() {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
...@@ -319,12 +314,12 @@ class Webservice extends CI_Controller { ...@@ -319,12 +314,12 @@ class Webservice extends CI_Controller {
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->bookedlist($data); $res = $this->Webservice_model->bookedlist($data);
if(sizeof($res['data']) && $res['status']!=0){ if(sizeof($res['data']) && $res['status']!=0){
$this->responseBookList($res['data']); $this->responseBookList($res['data']);
}elseif(sizeof($res['data'] == 0) && $res['status']!=0){ }elseif(sizeof($res['data'] == 0) && $res['status']!=0){
$this->response($res['data']); $this->response($res['data']);
}else{ }else{
$this->errorResponse($res['code'],$res['message']); $this->errorResponse($res['code'],$res['message']);
} }
} }
public function settings() { public function settings() {
...@@ -338,7 +333,7 @@ class Webservice extends CI_Controller { ...@@ -338,7 +333,7 @@ class Webservice extends CI_Controller {
} }
} }
public function forgot_password() { public function forgot_password() {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$res = $this->Webservice_model->forgot_password($data); $res = $this->Webservice_model->forgot_password($data);
if($res['status']!=0){ if($res['status']!=0){
...@@ -364,8 +359,7 @@ class Webservice extends CI_Controller { ...@@ -364,8 +359,7 @@ class Webservice extends CI_Controller {
} }
public function get_last_booking() { public function get_last_booking() {
$data['auth_token'] = $this->auth_token;
$data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->get_last_booking($data); $res = $this->Webservice_model->get_last_booking($data);
if($res['status']!=0){ if($res['status']!=0){
$this->response($res['data']); $this->response($res['data']);
...@@ -376,12 +370,12 @@ class Webservice extends CI_Controller { ...@@ -376,12 +370,12 @@ class Webservice extends CI_Controller {
} }
public function responseBookList($data) { public function responseBookList($data) {
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
'data' => array( 'data' => array(
'bookings' =>$data['bookings']), 'bookings' =>$data['bookings']),
'meta' =>$data['meta'] 'meta' =>$data['meta']
); );
print json_encode($result); print json_encode($result);
} }
...@@ -410,7 +404,6 @@ class Webservice extends CI_Controller { ...@@ -410,7 +404,6 @@ class Webservice extends CI_Controller {
public function get_app_version(){ public function get_app_version(){
$res = $this->Webservice_model->get_app_version(); $res = $this->Webservice_model->get_app_version();
if($res['status'] != 0) if($res['status'] != 0)
$this->response($res['data']); $this->response($res['data']);
else else
...@@ -421,7 +414,6 @@ class Webservice extends CI_Controller { ...@@ -421,7 +414,6 @@ class Webservice extends CI_Controller {
$data = (array) json_decode(file_get_contents('php://input')); $data = (array) json_decode(file_get_contents('php://input'));
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->logout($data); $res = $this->Webservice_model->logout($data);
if($res['status'] != 0) if($res['status'] != 0)
$this->successResponse($res); $this->successResponse($res);
else else
...@@ -435,7 +427,6 @@ class Webservice extends CI_Controller { ...@@ -435,7 +427,6 @@ class Webservice extends CI_Controller {
} }
$data = $_GET; $data = $_GET;
$data['auth_token'] = $this->auth_token; $data['auth_token'] = $this->auth_token;
$res = $this->Webservice_model->event_search($data); $res = $this->Webservice_model->event_search($data);
if($res['status']!=0){ if($res['status']!=0){
$this->response($res['data']); $this->response($res['data']);
...@@ -452,7 +443,6 @@ class Webservice extends CI_Controller { ...@@ -452,7 +443,6 @@ class Webservice extends CI_Controller {
empty($settings['currency_api'])){ empty($settings['currency_api'])){
return; return;
} }
$sourceCur = (!empty($settings['currency']))?$settings['currency']:'SAR'; $sourceCur = (!empty($settings['currency']))?$settings['currency']:'SAR';
$coma = ''; $coma = '';
$convertCur = ''; $convertCur = '';
...@@ -460,20 +450,16 @@ class Webservice extends CI_Controller { ...@@ -460,20 +450,16 @@ class Webservice extends CI_Controller {
$convertCur .= $coma.$curr['currency']; $convertCur .= $coma.$curr['currency'];
$coma = ','; $coma = ',';
} }
$params = 'currencies='.$convertCur; $params = 'currencies='.$convertCur;
$params .= '&source='.$sourceCur; $params .= '&source='.$sourceCur;
$params .= '&access_key='.$settings['currency_api']; $params .= '&access_key='.$settings['currency_api'];
$apiUrl = "http://apilayer.net/api/live?".$params; $apiUrl = "http://apilayer.net/api/live?".$params;
$ch = curl_init($apiUrl); $ch = curl_init($apiUrl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$json = curl_exec($ch); $json = curl_exec($ch);
curl_close($ch); curl_close($ch);
$exchangeRates = json_decode($json, true); $exchangeRates = json_decode($json, true);
if(empty($exchangeRates) || !isset($exchangeRates['quotes']) || empty($conversion = $exchangeRates['quotes'])){
if(empty($exchangeRates) || !isset($exchangeRates['quotes']) ||
empty($conversion = $exchangeRates['quotes'])){
return; return;
} }
foreach($conversion AS $curr => $rate) { foreach($conversion AS $curr => $rate) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment