Sync repo with current state of code on prod (circa 2011)

This commit is contained in:
Daniel Lo Nigro 2017-10-05 22:13:15 +11:00
parent 19c4644f31
commit 249630593c
12 changed files with 42 additions and 7 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
application/logs/
favicons/
forum/
old/
application/cache/

View File

@ -40,7 +40,7 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
/**
* Set the production status based on domain
*/
define('IN_PRODUCTION', !in_array($_SERVER['HTTP_HOST'], array('dev.zurl.ws:82', 'customzurltest.local', 'customzurltest2.local')));
define('IN_PRODUCTION', $_SERVER['HTTP_HOST'] != 'dev.zurl.ws:82');
//-- Configuration and initialization -----------------------------------------
@ -59,9 +59,9 @@ define('IN_PRODUCTION', !in_array($_SERVER['HTTP_HOST'], array('dev.zurl.ws:82',
*/
Kohana::init(array
(
'base_url' => 'http://dev.zurl.ws:82/',
'base_url' => 'http://zurl.ws/',
'index_file' => '',
'profiling' => !IN_PRODUCTION,
'profile' => !IN_PRODUCTION,
'caching' => IN_PRODUCTION,
));

0
application/cache/.gitkeep vendored Normal file
View File

View File

@ -69,6 +69,7 @@ class Controller_Account extends Controller_Template
$page->errors = array();
$page->values = array('username' => '', 'email' => '');
/* Shutdown Registration Temporarily
// Did the user post the form?
if ($_POST)
{
@ -103,7 +104,7 @@ class Controller_Account extends Controller_Template
// Let's grab the errors
$page->errors = $user->validate()->errors('register');
$page->values = $user->validate();
}
}*/
}
public function action_check_username()

View File

@ -12,6 +12,10 @@ class Controller_Url extends Controller_Template
public function action_index()
{
if ($_SERVER['HTTP_HOST'] === 'dl.vc')
{
$this->request->redirect('http://dan.cx/');
}
// Wrong domain? Redirect to the correct one.
if (!in_array($_SERVER['HTTP_HOST'], array('zurl.ws', 'www.zurl.ws', 'dev.zurl.ws', 'dev.zurl.ws:82', 'staging.zurl.ws', 'pre.zurl.ws')))
$this->request->redirect('http://zurl.ws' . $_SERVER['REQUEST_URI']);
@ -345,6 +349,8 @@ Number of complaints: ' . $url->complaints;
*/
private static function exceeded_rate_limit()
{
return true; // Temporary, to prevent spam
if (!Session::instance()->get('passed_captcha', false))
return true;

View File

@ -0,0 +1,11 @@
<?php
defined('SYSPATH') or die('No direct script access.');
class Validate extends Kohana_Validate
{
public static function uribl_check()
{
return false;
}
}
?>

View File

View File

@ -3,7 +3,16 @@ defined('SYSPATH') or die('No direct script access.');
Form::show_errors($errors);
?>
<?php echo form::open('url/shorten', array('id' => 'shorten')); ?>
<?php echo form::open('url/shorten', array('id' => 'shorten')); ?>
<?php
// Temporary hack until stricter spam management is in place!
if (!$logged_in) : ?>
Due to spam, users are now required to create an account to use zURL. Sorry for the inconvenience.
<?php else: ?>
<p>
<input type="hidden" name="token" value="<?php echo csrf::token(); ?>" />
<label for="url">Enter a long URL to make short:</label><br />
@ -57,4 +66,5 @@ Form::show_errors($errors);
<input type="submit" id="shorten" value="Shorten!" />
</p>
<?php endif; ?>
<?php endif; // Spam notice ?>
</form>

View File

@ -2,7 +2,7 @@
<!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="en" lang="en">
<head>
<base href="<?php echo URL::base('', 'http'); ?>" />
<base href="<?php echo URL::base('', 'https'); ?>" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="res/layout.css" />
<link rel="stylesheet" type="text/css" href="res/style.css" />

0
favicons/.gitkeep Normal file
View File

View File

@ -1,5 +1,7 @@
<?php
date_default_timezone_set('Australia/Melbourne');
/**
* The directory in which your application specific resources are located.
* The application directory must contain the config/kohana.php file.
@ -44,7 +46,7 @@ define('EXT', '.php');
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL & ~E_DEPRECATED);
/**
* End of standard configuration! Changing any of the code below should only be

0
robots.txt Normal file
View File