Commit 10a8a4bd by Tobin

Merge branch 'jansa' into 'master'

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