Converted all the hard-coded urls to site_url() function calls.

This commit is contained in:
Alex Tselegidis 2016-03-07 20:59:04 +01:00
parent b531885026
commit 635380512d
13 changed files with 30 additions and 45 deletions

View File

@ -417,25 +417,19 @@ class Appointments extends CI_Controller {
if ($post_data['manage_mode'] == FALSE) {
$customer_title = $this->lang->line('appointment_booked');
$customer_message = $this->lang->line('thank_you_for_appointment');
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
. $appointment['hash'];
$provider_title = $this->lang->line('appointment_added_to_your_plan');
$provider_message = $this->lang->line('appointment_link_description');
$provider_link = $this->config->item('base_url') . '/index.php/backend/index/'
. $appointment['hash'];
} else {
$customer_title = $this->lang->line('appointment_changes_saved');
$customer_message = '';
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
. $appointment['hash'];
$provider_title = $this->lang->line('appointment_details_changed');
$provider_message = '';
$provider_link = $this->config->item('base_url') . '/index.php/backend/index/'
. $appointment['hash'];
}
$customer_link = site_url('appointments/index/' . $appointment['hash']);
$provider_link = site_url('backend/index/' . $appointment['hash']);
$send_customer = filter_var($this->settings_model->get_setting('customer_notifications'),
FILTER_VALIDATE_BOOLEAN);

View File

@ -42,7 +42,7 @@ class Backend extends CI_Controller {
* appear when the page loads.
*/
public function index($appointment_hash = '') {
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/backend');
$this->session->set_userdata('dest_url', site_url('backend'));
if (!$this->has_privileges(PRIV_APPOINTMENTS)) return;
$this->load->model('appointments_model');
@ -92,7 +92,7 @@ class Backend extends CI_Controller {
* In this page the user can manage all the customer records of the system.
*/
public function customers() {
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/backend/customers');
$this->session->set_userdata('dest_url', site_url('backend/customers'));
if (!$this->has_privileges(PRIV_CUSTOMERS)) return;
$this->load->model('providers_model');
@ -126,7 +126,7 @@ class Backend extends CI_Controller {
* from the backend services page.
*/
public function services() {
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/backend/services');
$this->session->set_userdata('dest_url', site_url('backend/services'));
if (!$this->has_privileges(PRIV_SERVICES)) return;
$this->load->model('customers_model');
@ -156,7 +156,7 @@ class Backend extends CI_Controller {
* the page where the admin defines which service can each provider provide.
*/
public function users() {
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/backend/users');
$this->session->set_userdata('dest_url', site_url('backend/users'));
if (!$this->has_privileges(PRIV_USERS)) return;
$this->load->model('providers_model');
@ -191,7 +191,7 @@ class Backend extends CI_Controller {
* installation (core settings like company name, book timeout etc).
*/
public function settings() {
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/backend/settings');
$this->session->set_userdata('dest_url', site_url('backend/settings'));
if (!$this->has_privileges(PRIV_SYSTEM_SETTINGS, FALSE)
&& !$this->has_privileges(PRIV_USER_SETTINGS)) return;
@ -241,7 +241,7 @@ class Backend extends CI_Controller {
$user_id = $this->session->userdata('user_id');
if ($user_id == FALSE) { // User not logged in, display the login view.
if ($redirect) {
header('Location: ' . $this->config->item('base_url') . '/index.php/user/login');
header('Location: ' . site_url('user/login'));
}
return FALSE;
}
@ -251,7 +251,7 @@ class Backend extends CI_Controller {
$role_priv = $this->db->get_where('ea_roles', array('slug' => $role_slug))->row_array();
if ($role_priv[$page] < PRIV_VIEW) { // User does not have the permission to view the page.
if ($redirect) {
header('Location: ' . $this->config->item('base_url') . '/index.php/user/no_privileges');
header('Location: ' . site_url('user/no_privileges'));
}
return FALSE;
}

View File

@ -208,25 +208,17 @@ class Backend_api extends CI_Controller {
if (!$manage_mode) {
$customer_title = $this->lang->line('appointment_booked');
$customer_message = $this->lang->line('thank_you_for_appointment');
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
. $appointment['hash'];
$provider_title = $this->lang->line('appointment_added_to_your_plan');
$provider_message = $this->lang->line('appointment_link_description');
$provider_link = $this->config->item('base_url') . '/index.php/backend/index/'
. $appointment['hash'];
} else {
$customer_title = $this->lang->line('appointment_changes_saved');
$customer_message = '';
$customer_link = $this->config->item('base_url') . '/index.php/appointments/index/'
. $appointment['hash'];
$provider_title = $this->lang->line('appointment_details_changed');
$provider_message = '';
$provider_link = $this->config->item('base_url') . '/index.php/backend/index/'
. $appointment['hash'];
}
$customer_link = site_url('appointments/index/' . $appointment['hash']);
$provider_link = site_url('backend/index/' . $appointment['hash']);
$send_customer = $this->settings_model->get_setting('customer_notifications');

View File

@ -38,9 +38,9 @@ class Test extends CI_Controller {
public function index() {
// User must be logged in as an admin in order to run the tests.
$this->load->library('session');
$this->session->set_userdata('dest_url', $this->config->item('base_url') . '/index.php/test');
$this->session->set_userdata('dest_url', site_url('test'));
if ($this->session->userdata('role_slug') != DB_SLUG_ADMIN) {
header('Location: ' . $this->config->item('base_url') . '/index.php/user/login');
header('Location: ' . site_url('user/login'));
return;
}

View File

@ -39,7 +39,7 @@ class User extends CI_Controller {
* The default method will redirect the browser to the user/login URL.
*/
public function index() {
header('Location: ' . $this->config->item('base_url') . '/index.php/user/login');
header('Location: ' . site_url('user/login'));
}
/**
@ -52,7 +52,7 @@ class User extends CI_Controller {
$view['dest_url'] = $this->session->userdata('dest_url');
if (!$view['dest_url']) {
$view['dest_url'] = $view['base_url'] . '/index.php/backend';
$view['dest_url'] = site_url('backend');
}
$view['company_name'] = $this->settings_model->get_setting('company_name');

View File

@ -1,4 +1,4 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
@ -50,7 +50,7 @@ class Google_Sync {
$this->client->setClientId(Config::GOOGLE_CLIENT_ID);
$this->client->setClientSecret(Config::GOOGLE_CLIENT_SECRET);
$this->client->setDeveloperKey(Config::GOOGLE_API_KEY);
$this->client->setRedirectUri($this->CI->config->item('base_url') . '/index.php/google/oauth_callback');
$this->client->setRedirectUri(site_url('google/oauth_callback'));
$this->service = new Google_CalendarService($this->client);
}

View File

@ -141,8 +141,7 @@
</div>
<div class="col-xs-12 col-sm-2">
<form id="cancel-appointment-form" method="post"
action="' . $this->config->item('base_url')
. '/index.php/appointments/cancel/' . $appointment_data['hash'] . '">
action="' . site_url('appointments/cancel/' . $appointment_data['hash']) . '">
<input type="hidden" name="csrfToken" value="' . $this->security->get_csrf_hash() . '" />
<textarea name="cancel_reason" style="display:none"></textarea>
<button id="cancel-appointment" class="btn btn-default">' .
@ -381,7 +380,7 @@
CAPTCHA
<small class="glyphicon glyphicon-refresh"></small>
</h4>
<img class="captcha-image" src="<?php echo $this->config->item('base_url'); ?>/index.php/captcha">
<img class="captcha-image" src="<?php echo site_url('captcha'); ?>">
<input class="captcha-text" type="text" value="" />
<span id="captcha-hint" class="help-block" style="opacity:0">&nbsp;</span>
</div>
@ -423,7 +422,7 @@
</span>
<?php if ($this->session->userdata('user_id')): ?>
|
<a href="<?php echo $this->config->item('base_url'); ?>/index.php/backend">
<a href="<?php echo site_url('backend'); ?>">
<?php echo $this->lang->line('backend_section'); ?>
</a>
<?php endif; ?>

View File

@ -15,7 +15,7 @@
<?php echo ucfirst($this->config->item('language')); ?>
</span>
|
<a href="<?php echo $base_url; ?>/index.php/appointments">
<a href="<?php echo site_url('appointments'); ?>">
<?php echo $this->lang->line('go_to_booking_page') ?>
</a>
</div>

View File

@ -113,7 +113,7 @@
<?php echo $this->lang->line('book_appointment_title'); ?>
</a>
<a href="<?php echo $this->config->item('base_url'); ?>/index.php/backend" class="btn btn-danger btn-large">
<a href="<?php echo site_url('backend'); ?>" class="btn btn-danger btn-large">
<span class="glyphicon glyphicon-wrench"></span>
<?php echo $this->lang->line('backend_section'); ?>
</a>

View File

@ -100,7 +100,7 @@
$('.alert').removeClass('hidden alert-danger alert-success');
$('#get-new-password').prop('disabled', false);
if (!GeneralFunctions.handleAjaxExceptions(response)) return;
if (response == GlobalVariables.AJAX_SUCCESS) {
@ -138,7 +138,7 @@
<?php echo $this->lang->line('regenerate_password'); ?>
</button>
<a href="<?php echo $base_url; ?>/index.php/user/login" class="user-login">
<a href="<?php echo site_url('user/login'); ?>" class="user-login">
<?php echo $this->lang->line('go_to_login'); ?></a>
</form>
</div>

View File

@ -140,7 +140,7 @@
<br><br>
<a href="<?php echo $base_url; ?>/index.php/user/forgot_password" class="forgot-password">
<a href="<?php echo site_url('user/forgot_password'); ?>" class="forgot-password">
<?php echo $this->lang->line('forgot_your_password'); ?></a>
|
<span id="select-language" class="label label-success">

View File

@ -71,12 +71,12 @@
<br>
<a href="<?php echo $this->config->item('base_url'); ?>" class="btn btn-primary btn-large">
<a href="<?php echo site_url(); ?>" class="btn btn-primary btn-large">
<span class="glyphicon glyphicon-calendar"></span>
<?php echo $this->lang->line('book_appointment_title'); ?>
</a>
<a href="<?php echo $this->config->item('base_url'); ?>/index.php/backend" class="btn btn-danger btn-large">
<a href="<?php echo site_url('backend'); ?>" class="btn btn-danger btn-large">
<span class="glyphicon glyphicon-home"></span>
<?php echo $this->lang->line('backend_section'); ?>
</a>

View File

@ -70,7 +70,7 @@
<br>
<a href="<?php echo $this->config->item('base_url'); ?>/index.php/backend" class="btn btn-success btn-large">
<a href="<?php echo site_url('backend') ?>" class="btn btn-success btn-large">
<i class="icon-calendar icon-white"></i>
<?php echo $this->lang->line('backend_calendar'); ?>
</a>