Added database tables for advertisements, controller is still missing.
Added IP columns to dmails, forum_posts, comments.
This commit is contained in:
parent
ee3b6c37ac
commit
0ab3ef62b8
@ -25,7 +25,7 @@ class CommentController extends ApplicationController
|
|||||||
{
|
{
|
||||||
$comment = Comment::find($this->params()->id);
|
$comment = Comment::find($this->params()->id);
|
||||||
if (current_user()->has_permission($comment)) {
|
if (current_user()->has_permission($comment)) {
|
||||||
$comment->updateAttributes($this->params()->comment);
|
$comment->updateAttributes(array_merge($this->params()->comment, ['updater_ip_addr' => $this->request()->remoteIp()]));
|
||||||
$this->respond_to_success("Comment updated", '#index');
|
$this->respond_to_success("Comment updated", '#index');
|
||||||
} else {
|
} else {
|
||||||
$this->access_denied();
|
$this->access_denied();
|
||||||
@ -52,7 +52,7 @@ class CommentController extends ApplicationController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user_id = current_user()->id;
|
$user_id = current_user()->id;
|
||||||
Rails::log($this->params()->comment);
|
|
||||||
$comment = new Comment(array_merge($this->params()->comment, array('ip_addr' => $this->request()->remoteIp(), 'user_id' => $user_id)));
|
$comment = new Comment(array_merge($this->params()->comment, array('ip_addr' => $this->request()->remoteIp(), 'user_id' => $user_id)));
|
||||||
if ($this->params()->commit == "Post without bumping") {
|
if ($this->params()->commit == "Post without bumping") {
|
||||||
$comment->do_not_bump_post = true;
|
$comment->do_not_bump_post = true;
|
||||||
|
@ -36,7 +36,7 @@ class DmailController extends ApplicationController
|
|||||||
$dmail = $this->params()->dmail;
|
$dmail = $this->params()->dmail;
|
||||||
if (empty($dmail['parent_id']))
|
if (empty($dmail['parent_id']))
|
||||||
$dmail['parent_id'] = null;
|
$dmail['parent_id'] = null;
|
||||||
$this->dmail = Dmail::create(array_merge($dmail, ['from_id' => $this->current_user->id]));
|
$this->dmail = Dmail::create(array_merge($dmail, ['from_id' => $this->current_user->id, 'ip_addr' => $this->request()->remoteIp()]));
|
||||||
|
|
||||||
if ($this->dmail->errors()->none()) {
|
if ($this->dmail->errors()->none()) {
|
||||||
$this->notice("Message sent to ".$dmail['to_name']);
|
$this->notice("Message sent to ".$dmail['to_name']);
|
||||||
|
@ -65,7 +65,7 @@ class ForumController extends ApplicationController
|
|||||||
if (empty($params['parent_id']) || !ctype_digit($params['parent_id']))
|
if (empty($params['parent_id']) || !ctype_digit($params['parent_id']))
|
||||||
$params['parent_id'] = null;
|
$params['parent_id'] = null;
|
||||||
|
|
||||||
$this->forum_post = ForumPost::create(array_merge($params, ['creator_id' => $this->current_user->id]));
|
$this->forum_post = ForumPost::create(array_merge($params, ['creator_id' => $this->current_user->id, 'ip_addr' => $this->request()->remoteIp()]));
|
||||||
|
|
||||||
if ($this->forum_post->errors()->blank()) {
|
if ($this->forum_post->errors()->blank()) {
|
||||||
if (!$this->params()->forum_post['parent_id']) {
|
if (!$this->params()->forum_post['parent_id']) {
|
||||||
@ -120,7 +120,7 @@ class ForumController extends ApplicationController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->forum_post->assignAttributes($this->params()->forum_post);
|
$this->forum_post->assignAttributes(array_merge($this->params()->forum_post, ['updater_ip_addr' => $this->request()->remoteIp()]);
|
||||||
if ($this->forum_post->save()) {
|
if ($this->forum_post->save()) {
|
||||||
$this->notice("Post updated");
|
$this->notice("Post updated");
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class CreateAdvertisements extends Rails\ActiveRecord\Migration\Base
|
class CreateAdvertisements extends Rails\ActiveRecord\Migration\Base
|
||||||
{
|
{
|
||||||
public function change()
|
public function up()
|
||||||
{
|
{
|
||||||
$this->createTable('advertisements', function($t) {
|
$this->createTable('advertisements', function($t) {
|
||||||
$t->column('image_url', 'string', ['null' => false]);
|
$t->column('image_url', 'string', ['null' => false]);
|
||||||
|
8
db/migrate/20131118173429_add_ip_addr_to_dmails.php
Executable file
8
db/migrate/20131118173429_add_ip_addr_to_dmails.php
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
class AddIpAddrToDmails extends Rails\ActiveRecord\Migration\Base
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn('dmails', 'ip_addr', 'string', ['length' => 46]);
|
||||||
|
}
|
||||||
|
}
|
9
db/migrate/20131118173629_add_ip_addr_to_forum_posts.php
Executable file
9
db/migrate/20131118173629_add_ip_addr_to_forum_posts.php
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
class AddIpAddrToForumPosts extends Rails\ActiveRecord\Migration\Base
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn('forum_posts', 'ip_addr', 'string', ['length' => 46]);
|
||||||
|
$this->addColumn('forum_posts', 'updater_ip_addr', 'string', ['length' => 46]);
|
||||||
|
}
|
||||||
|
}
|
8
db/migrate/20131118173949_add_updater_ip_addr_to_comments.php
Executable file
8
db/migrate/20131118173949_add_updater_ip_addr_to_comments.php
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
class AddUpdaterIpAddrToComments extends Rails\ActiveRecord\Migration\Base
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn('comments', 'updater_ip_addr', 'string', ['limit' => 46]);
|
||||||
|
}
|
||||||
|
}
|
2
db/seeds.php
Executable file
2
db/seeds.php
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
|
54
db/table_schema/production/advertisements.php
Normal file
54
db/table_schema/production/advertisements.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
return array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
|
'id' =>
|
||||||
|
array (
|
||||||
|
'type' => 'int(11)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'image_url' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'referral_url' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'ad_type' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'status' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'hit_count' =>
|
||||||
|
array (
|
||||||
|
'type' => 'int(11)',
|
||||||
|
'default' => '0',
|
||||||
|
),
|
||||||
|
'width' =>
|
||||||
|
array (
|
||||||
|
'type' => 'int(11)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'height' =>
|
||||||
|
array (
|
||||||
|
'type' => 'int(11)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array (
|
||||||
|
'pri' =>
|
||||||
|
array (
|
||||||
|
0 => 'id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
;
|
@ -42,6 +42,11 @@ return array (
|
|||||||
'type' => 'tinyint(1)',
|
'type' => 'tinyint(1)',
|
||||||
'default' => '0',
|
'default' => '0',
|
||||||
),
|
),
|
||||||
|
'updater_ip_addr' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(46)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
array (
|
array (
|
||||||
|
@ -42,6 +42,11 @@ return array (
|
|||||||
'type' => 'int(11)',
|
'type' => 'int(11)',
|
||||||
'default' => NULL,
|
'default' => NULL,
|
||||||
),
|
),
|
||||||
|
'ip_addr' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
array (
|
array (
|
||||||
|
@ -62,6 +62,16 @@ return array (
|
|||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'default' => NULL,
|
'default' => NULL,
|
||||||
),
|
),
|
||||||
|
'ip_addr' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
'updater_ip_addr' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
1 =>
|
1 =>
|
||||||
array (
|
array (
|
||||||
|
15
db/table_schema/production/schema_migrations.php
Normal file
15
db/table_schema/production/schema_migrations.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
return array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
|
'version' =>
|
||||||
|
array (
|
||||||
|
'type' => 'varchar(255)',
|
||||||
|
'default' => NULL,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
1 =>
|
||||||
|
array (
|
||||||
|
),
|
||||||
|
)
|
||||||
|
;
|
Reference in New Issue
Block a user