Added 300 messages and defaulting url link to domain rendered

This commit is contained in:
Deon George 2014-06-25 14:33:54 +10:00
parent f64d1fbf75
commit a8f403f8fe
3 changed files with 21 additions and 1 deletions

View File

@ -46,6 +46,9 @@ class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 {
// Process our redirection options
if (preg_match('/^http[s]?:\/\//',$ro->redirect)) {
if ($ro->http_status == 300)
$response->body(View::factory('300')->set('redir',$ro->redirect));
$response->status($ro->http_status ? $ro->http_status : 302);
$response->headers('Location',$ro->redirect);

13
application/views/300.php Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="auto" lang="auto">
<head>
<title>Not Here Anymore</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
body { width: 100%; background: #fff; text-align: center; }
</style>
</head>
<body>
It's not here anymore - try <?php echo HTML::anchor($redir,'here'); ?>
</body>
</html>

View File

@ -3,7 +3,7 @@
<legend>Create New Short Cut</legend>
<select id="domain" class="span2" name="domain" class="input-medium">
<?php foreach ($domains as $do): ?>
<option><?php echo $do->domain; ?></option>
<option <?php echo ($do->domain == $_SERVER['HTTP_HOST']) ? 'selected="selected"' : '' ?>><?php echo $do->domain; ?></option>
<?php endforeach ?>
</select>
<label>/</label>
@ -15,4 +15,8 @@
<span class="help-block" id="help-url">To point to which URL?</span>
<button type="submit" class="btn" disabled>Submit</button>
</fieldset>
<br/>
<fieldset>
<legend>This domain may be for <a href="http://www.afternic.com/leenooks">sale</a>!</legend>
</fieldset>
</form>