-
Notifications
You must be signed in to change notification settings - Fork 0
/
https.php
43 lines (42 loc) · 837 Bytes
/
https.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
*
* HTTPS Redirect plugin
*
* @package Https Plugins
* @author Steve Williamson
*
*/
class Plugin_Https extends Plugin
{
/**
* redirect
*
* Usage:
* {{ https:redirect }}
*
* Uses admin setting to determine whether or not to redirect to https
*/
function redirect()
{
if ($this->settings->admin_force_https and strtolower(substr(current_url(), 4, 1)) != 's')
{
redirect(str_replace('http:', 'https:', current_url()).'?session='.session_id());
}
}
/**
* force
*
* Usage:
* {{ https:force }}
*
* Redirects to https if not viewing securely
*/
function force()
{
if (strtolower(substr(current_url(), 4, 1)) != 's')
{
redirect(str_replace('http:', 'https:', current_url()).'?session='.session_id());
}
}
}