Reformatted PHP files

This commit is contained in:
alext 2017-09-23 01:30:22 +02:00
parent 17fd69cce6
commit c424c0bc6d
19 changed files with 182 additions and 91 deletions

View file

@ -134,7 +134,8 @@ class Appointments extends CI_Controller {
'provider_data' => $provider,
'customer_data' => $customer
];
} catch (Exception $exc)
}
catch (Exception $exc)
{
$view['exceptions'][] = $exc;
}
@ -201,7 +202,8 @@ class Appointments extends CI_Controller {
$this->google_sync->refresh_token($google_token->refresh_token);
$this->google_sync->delete_appointment($provider, $appointment['id_google_calendar']);
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$exceptions[] = $exc;
}
@ -233,11 +235,13 @@ class Appointments extends CI_Controller {
new Text($this->input->post('cancel_reason')));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$exceptions[] = $exc;
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
// Display the error message to the customer.
$exceptions[] = $exc;
@ -374,7 +378,8 @@ class Appointments extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode($available_hours));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -478,7 +483,8 @@ class Appointments extends CI_Controller {
$service, $customer, $company_settings);
}
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
log_message('error', $exc->getMessage());
log_message('error', $exc->getTraceAsString());
@ -527,7 +533,8 @@ class Appointments extends CI_Controller {
$service, $customer, $company_settings, $provider_title,
$provider_message, $provider_link, new Email($provider['email']));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
log_message('error', $exc->getMessage());
log_message('error', $exc->getTraceAsString());
@ -538,7 +545,8 @@ class Appointments extends CI_Controller {
->set_output(json_encode([
'appointment_id' => $appointment['id']
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -615,7 +623,8 @@ class Appointments extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($unavailable_dates));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -323,7 +323,8 @@ class Backend extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -144,7 +144,8 @@ class Backend_api extends CI_Controller {
}
$this->output->set_output(json_encode($response));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output->set_output(json_encode([
'exceptions' => [exceptionToJavaScript($exc)]
@ -228,7 +229,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($response));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -331,7 +333,8 @@ class Backend_api extends CI_Controller {
$service, $customer, $company_settings);
}
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = exceptionToJavaScript($exc);
}
@ -378,7 +381,8 @@ class Backend_api extends CI_Controller {
$provider_message, $provider_link, new Email($provider['email']));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = exceptionToJavaScript($exc);
}
@ -394,7 +398,8 @@ class Backend_api extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(['warnings' => $warnings]));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -463,7 +468,8 @@ class Backend_api extends CI_Controller {
$this->google_sync->refresh_token($google_token->refresh_token);
$this->google_sync->delete_appointment($provider, $appointment['id_google_calendar']);
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = exceptionToJavaScript($exc);
}
@ -493,7 +499,8 @@ class Backend_api extends CI_Controller {
$service, $customer, $company_settings, new Email($customer['email']),
new Text($this->input->post('delete_reason')));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = exceptionToJavaScript($exc);
}
@ -510,7 +517,8 @@ class Backend_api extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(['warnings' => $warnings]));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -552,7 +560,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -615,7 +624,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($customers));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -678,7 +688,8 @@ class Backend_api extends CI_Controller {
$google_event = $this->google_sync->update_unavailable($provider, $unavailable);
}
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = $exc;
}
@ -695,7 +706,8 @@ class Backend_api extends CI_Controller {
->set_output(json_encode(AJAX_SUCCESS));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -739,7 +751,8 @@ class Backend_api extends CI_Controller {
$this->google_sync->refresh_token($google_token->refresh_token);
$this->google_sync->delete_unavailable($provider, $unavailable['id_google_calendar']);
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$warnings[] = $exc;
}
@ -756,7 +769,8 @@ class Backend_api extends CI_Controller {
->set_output(json_encode(AJAX_SUCCESS));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -793,7 +807,8 @@ class Backend_api extends CI_Controller {
'status' => AJAX_SUCCESS,
'id' => $customer_id
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -822,7 +837,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -859,7 +875,8 @@ class Backend_api extends CI_Controller {
'status' => AJAX_SUCCESS,
'id' => $service_id
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -889,7 +906,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -925,7 +943,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($services));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -964,7 +983,8 @@ class Backend_api extends CI_Controller {
'status' => AJAX_SUCCESS,
'id' => $category_id
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -992,7 +1012,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1025,7 +1046,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($categories));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1063,7 +1085,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($admins));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1106,7 +1129,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($response));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1137,7 +1161,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1175,7 +1200,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($providers));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1224,7 +1250,8 @@ class Backend_api extends CI_Controller {
'status' => AJAX_SUCCESS,
'id' => $provider_id
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1255,7 +1282,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1293,7 +1321,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($secretaries));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1334,7 +1363,8 @@ class Backend_api extends CI_Controller {
'status' => AJAX_SUCCESS,
'id' => $secretary_id
]));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1366,7 +1396,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1414,7 +1445,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1442,7 +1474,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($is_valid));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1486,7 +1519,8 @@ class Backend_api extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1533,7 +1567,8 @@ class Backend_api extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(AJAX_FAILURE));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -1568,7 +1603,8 @@ class Backend_api extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($result ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -198,7 +198,8 @@ class Google extends CI_Controller {
$this->appointments_model->add($appointment);
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
// Appointment not found on gcal, delete from e!a.
$this->appointments_model->delete($appointment['id']);
@ -235,7 +236,8 @@ class Google extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -126,7 +126,8 @@ class Installation extends CI_Controller {
->set_content_type('application/json')
->set_output(json_encode(AJAX_SUCCESS));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -142,7 +142,8 @@ class User extends CI_Controller {
->set_output(json_encode(AJAX_FAILURE));
}
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')
@ -192,7 +193,8 @@ class User extends CI_Controller {
$this->output
->set_content_type('application/json')
->set_output(json_encode($new_password != FALSE ? AJAX_SUCCESS : AJAX_FAILURE));
} catch (Exception $exc)
}
catch (Exception $exc)
{
$this->output
->set_content_type('application/json')

View file

@ -49,7 +49,8 @@ class API_V1_Controller extends CI_Controller {
$password = new NonEmptyText($_SERVER['PHP_AUTH_PW']);
$authorization = new \EA\Engine\Api\V1\Authorization($this);
$authorization->basic($username, $password);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}

View file

@ -68,7 +68,8 @@ class Admins extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Admins extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Admins extends API_V1_Controller {
$batch = $this->admins_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Admins extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -68,7 +68,8 @@ class Appointments extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -98,7 +99,8 @@ class Appointments extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -132,7 +134,8 @@ class Appointments extends API_V1_Controller {
$batch = $this->appointments_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -155,7 +158,8 @@ class Appointments extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}

View file

@ -74,7 +74,8 @@ class Availabilities extends API_V1_Controller {
->set_content_type('application/json')
->set_output(json_encode($availableHours));
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}

View file

@ -68,7 +68,8 @@ class Categories extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Categories extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Categories extends API_V1_Controller {
$batch = $this->services_model->get_all_categories('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Categories extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -68,7 +68,8 @@ class Customers extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Customers extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Customers extends API_V1_Controller {
$batch = $this->customers_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Customers extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -68,7 +68,8 @@ class Providers extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Providers extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Providers extends API_V1_Controller {
$batch = $this->providers_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Providers extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -68,7 +68,8 @@ class Secretaries extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Secretaries extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Secretaries extends API_V1_Controller {
$batch = $this->secretaries_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Secretaries extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -68,7 +68,8 @@ class Services extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -98,7 +99,8 @@ class Services extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -132,7 +134,8 @@ class Services extends API_V1_Controller {
$batch = $this->services_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}
@ -155,7 +158,8 @@ class Services extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
$this->_handleException($exception);
}

View file

@ -86,7 +86,8 @@ class Settings extends API_V1_Controller {
->singleEntry($name)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -113,7 +114,8 @@ class Settings extends API_V1_Controller {
]
]);
$response->encode($this->parser)->singleEntry($name)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -136,7 +138,8 @@ class Settings extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}

View file

@ -68,7 +68,8 @@ class Unavailabilities extends API_V1_Controller {
->singleEntry($id)
->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -98,7 +99,8 @@ class Unavailabilities extends API_V1_Controller {
$response = new Response($batch);
$status = new NonEmptyText('201 Created');
$response->encode($this->parser)->singleEntry(TRUE)->output($status);
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -132,7 +134,8 @@ class Unavailabilities extends API_V1_Controller {
$batch = $this->appointments_model->get_batch('id = ' . $id);
$response = new Response($batch);
$response->encode($this->parser)->singleEntry($id)->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}
@ -155,7 +158,8 @@ class Unavailabilities extends API_V1_Controller {
]);
$response->output();
} catch (\Exception $exception)
}
catch (\Exception $exception)
{
exit($this->_handleException($exception));
}

View file

@ -244,7 +244,8 @@ class Google_Sync {
try
{
$this->service->events->delete($provider['settings']['google_calendar'], $google_event_id);
} catch (Exception $ex)
}
catch (Exception $ex)
{
// Event was not found on Google Calendar.
}
@ -322,7 +323,8 @@ class Google_Sync {
try
{
$this->service->events->delete($provider['settings']['google_calendar'], $google_event_id);
} catch (Exception $ex)
}
catch (Exception $ex)
{
// Event was not found on Google Calendar.
}

View file

@ -463,7 +463,8 @@ class Services_Model extends CI_Model {
}
return TRUE;
} catch (Exception $exc)
}
catch (Exception $exc)
{
return FALSE;
}