mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
schemamigration: expand titles to 50 chars
This commit is contained in:
parent
795543d5c2
commit
39d665615a
@ -281,6 +281,30 @@ class Main extends CI_Controller
|
||||
$this->db->query("ALTER TABLE " . $db_prefix . "ci_sessions CHANGE COLUMN ip_address ip_address VARCHAR(45) NOT NULL DEFAULT '0'");
|
||||
}
|
||||
}
|
||||
|
||||
//expand title to 50
|
||||
$fields = $this->db->field_data('pastes');
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
|
||||
if ($field->name == 'title')
|
||||
{
|
||||
|
||||
if ($field->max_length < 50)
|
||||
{
|
||||
$db_prefix = config_item('db_prefix');
|
||||
|
||||
if ($this->db->dbdriver == "postgre")
|
||||
{
|
||||
$this->db->query("ALTER TABLE " . $db_prefix . "pastes ALTER COLUMN title TYPE VARCHAR(50), ALTER COLUMN title SET NOT NULL");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ALTER TABLE " . $db_prefix . "pastes CHANGE COLUMN title title VARCHAR(50) NOT NULL");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
|
||||
@ -698,8 +722,9 @@ class Main extends CI_Controller
|
||||
function _valid_recaptcha()
|
||||
{
|
||||
|
||||
if ($this->recaptcha_privatekey == null || $this->recaptcha_privatekey == '') {
|
||||
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
if ($this->recaptcha_privatekey == null || $this->recaptcha_privatekey == '')
|
||||
{
|
||||
die("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||
}
|
||||
|
||||
if ($this->input->post('g-recaptcha-response'))
|
||||
@ -707,12 +732,11 @@ class Main extends CI_Controller
|
||||
$pk = $this->recaptcha_privatekey;
|
||||
$ra = $_SERVER['REMOTE_ADDR'];
|
||||
$rf = trim($this->input->post('g-recaptcha-response'));
|
||||
$url = "https://www.google.com/recaptcha/api/siteverify?secret=" . $pk . "&response;=" . $rf . "&remoteip;=" . $ra;
|
||||
$response = $this->curl->simple_get($url);
|
||||
$status = json_decode($response, true);
|
||||
|
||||
$url="https://www.google.com/recaptcha/api/siteverify?secret=".$pk."&response;=".$rf."&remoteip;=".$ra;
|
||||
$response = $this->curl->simple_get($url);
|
||||
$status= json_decode($response, true);
|
||||
|
||||
if($status['success'])
|
||||
if ($status['success'])
|
||||
{
|
||||
$recaptcha_response->is_valid = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user