';
16 | echo $this->Form->Button('OK');
17 | echo $this->Form->Button('Cancel', array('type' => 'button', 'class' => 'Button Close'));
18 | echo '
';
19 | echo $this->Form->Close();
20 | ?>
21 |
--------------------------------------------------------------------------------
/src/models/ConversationMessage.php:
--------------------------------------------------------------------------------
1 | 'required|exists:GDN_Conversation,ConversationID',
9 | // 'Body' => none,
10 | 'Format' => 'max:20',
11 | ];
12 |
13 | // auditing
14 | use AuditingTrait;
15 | public function getAuditors()
16 | {
17 | return [
18 | 'InsertUserID', 'DateInserted', 'InsertIPAddress',
19 | ];
20 | }
21 |
22 | // definitions
23 | protected $table = 'GDN_ConversationMessage';
24 | protected $primaryKey = 'MessageID';
25 |
26 | public function getDates()
27 | {
28 | return [ 'DateInserted', ];
29 | }
30 |
31 | // relations
32 | public function conversation()
33 | {
34 | return $this->belongsTo(
35 | '\BishopB\Forum\Conversation', 'ConversationID', 'ConversationID'
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bishopb/laravel-forums",
3 | "description": "Forums and discussion boards for Laravel, using the Vanilla Forums engine.",
4 | "license": "GPL-2.0",
5 | "authors": [
6 | {
7 | "name": "Bishop Bettini", "email": "bishop@php.net"
8 | }
9 | ],
10 | "require": {
11 | "bishopb/vanilla": "2.2.3.6-patch1",
12 | "laravel/framework": "~4.2",
13 | "watson/validating": "0.10.*",
14 | "felixkiss/uniquewith-validator": "1.1.*"
15 | },
16 | "autoload": {
17 | "classmap": [ "src" ],
18 | "psr-4": {
19 | "BishopB\\Forum\\": "src/"
20 | }
21 | },
22 | "config": {
23 | "preferred-install": "dist"
24 | },
25 | "minimum-stability": "stable",
26 | "require-dev": {
27 | "mockery/mockery": "~0.9",
28 | "phpunit/phpunit": "~4.0"
29 | },
30 | "autoload-dev": {
31 | "psr-4": {
32 | "BishopB\\ForumTest\\": "tests/"
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/models/Invitation.php:
--------------------------------------------------------------------------------
1 | 'required|email|max:200',
10 | 'Name' => 'max:50',
11 | // 'RoleIDs' => none,
12 | 'Code' => 'max:50',
13 | 'AcceptedUserID' => 'exists:GDN_User,UserID',
14 | 'DateExpires' => 'date',
15 | ];
16 |
17 | // auditing
18 | use AuditingTrait;
19 | public function getAuditors()
20 | {
21 | return [ 'InsertUserID', 'DateInserted', ];
22 | }
23 |
24 | // definitions
25 | protected $table = 'GDN_Invitation';
26 | protected $primaryKey = 'InvitationID';
27 |
28 | public function getDates()
29 | {
30 | return [ 'DateInserted', 'DateExpires', ];
31 | }
32 |
33 | // relations
34 | public function accepting_user()
35 | {
36 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'AcceptedUserID');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/models/Media.php:
--------------------------------------------------------------------------------
1 | 'required|max:255',
10 | 'Path' => 'required|max:255',
11 | 'Type' => 'required|max:128',
12 | 'Size' => 'integer',
13 | 'ForeignID' => 'integer',
14 | 'ForeginTable' => 'max:24',
15 | 'ImageWidth' => 'integer|min:0',
16 | 'ImageHeight' => 'integer|min:0',
17 | 'ThumbWidth' => 'integer|min:0',
18 | 'ThumbHeight' => 'integer|min:0',
19 | 'ThumbPath' => 'max:255',
20 | ];
21 |
22 | // auditing
23 | use AuditingTrait;
24 | public function getAuditors()
25 | {
26 | return [ 'InsertUserID', 'DateInserted', ];
27 | }
28 |
29 | // definitions
30 | protected $table = 'GDN_Media';
31 | protected $primaryKey = 'MediaID';
32 |
33 | public function getDates()
34 | {
35 | return [ 'DateInserted', ];
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Role_table.php:
--------------------------------------------------------------------------------
1 | integer('RoleID', true);
18 | $table->string('Name', 100);
19 | $table->string('Description', 500)->nullable();
20 | $table->integer('Sort')->nullable();
21 | $table->boolean('Deletable')->default(1);
22 | $table->boolean('CanSession')->default(1);
23 | $table->boolean('PersonalInfo')->default(0);
24 | });
25 | }
26 |
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::drop('GDN_Role');
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/services/VanillaHelperTrait.php:
--------------------------------------------------------------------------------
1 | Set($key, $value, true /*overwrite*/, true /*persist*/);
24 | }
25 |
26 | /**
27 | * Get a value from the Vanilla run-time configuration
28 | */
29 | public static function get($key)
30 | {
31 | return \Gdn::Config()->Get($key);
32 | }
33 |
34 | /**
35 | * Get the version of Vanilla installed.
36 | * TODO Pull from Vanilla's index.php
37 | */
38 | public static function get_vanilla_version()
39 | {
40 | return '2.2.16.1';
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussion/profilecomments.php:
--------------------------------------------------------------------------------
1 | Data('Comments') as $Comment) {
3 | $Permalink = '/discussion/comment/'.$Comment->CommentID.'/#Comment_'.$Comment->CommentID;
4 | $User = UserBuilder($Comment, 'Insert');
5 | $this->EventArguments['User'] = $User;
6 | ?>
7 |
20 | FetchViewLocation('helper_functions');
3 |
4 | ?>
5 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/post/index.php:
--------------------------------------------------------------------------------
1 | Data('Forms');
4 | // Loop through the form collection and write out the handles
5 | $FormToggleMenu = new ToggleMenuModule();
6 | foreach ($Forms as $Form) {
7 | $Code = GetValue('Name', $Form);
8 | $Active = strtolower($Code) == strtolower($this->Data('CurrentFormName'));
9 | if ($Active)
10 | $FormToggleMenu->CurrentLabelCode($Code);
11 |
12 | $FormToggleMenu->AddLabel(GetValue('Label', $Form), $Code);
13 | }
14 | echo $FormToggleMenu->ToString();
15 |
16 | // Now loop through the form collection and dump the forms
17 | foreach ($Forms as $Form) {
18 | $Name = GetValue('Name', $Form);
19 | $Active = strtolower($Name) == strtolower($this->Data('CurrentFormName'));
20 | $Url = GetValue('Url', $Form);
21 | echo '
';
25 | }
26 |
--------------------------------------------------------------------------------
/src/models/Message.php:
--------------------------------------------------------------------------------
1 | 'required',
10 | 'Format' => 'max:20',
11 | 'AllowDismiss' => 'boolean',
12 | 'Enabled' => 'boolean',
13 | 'Application' => 'max:255',
14 | 'Controller' => 'max:255',
15 | 'Method' => 'max:255',
16 | 'Category' => 'exists:GDN_Category,CategoryID',
17 | 'IncludeSubcategories' => 'boolean',
18 | 'AssetTarget' => 'max:20',
19 | 'CssClass' => 'max:20',
20 | 'Sort' => 'integer',
21 | ];
22 |
23 | // definitions
24 | protected $table = 'GDN_Message';
25 | protected $primaryKey = 'MessageID';
26 |
27 | // relations
28 | public function category()
29 | {
30 | return $this->hasOne(
31 | '\BishopB\Forum\Category', 'CategoryID', 'CategoryID'
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_ActivityComment_table.php:
--------------------------------------------------------------------------------
1 | integer('ActivityCommentID', true);
18 | $table->integer('ActivityID')->index('FK_ActivityComment_ActivityID');
19 | $table->text('Body');
20 | $table->string('Format', 20);
21 | $table->integer('InsertUserID');
22 | $table->dateTime('DateInserted');
23 | $table->string('InsertIPAddress', 15)->nullable();
24 | });
25 | }
26 |
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::drop('GDN_ActivityComment');
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/services/UserMapperInterface.php:
--------------------------------------------------------------------------------
1 | enum('SlotType', array('d','w','m','y','a'));
18 | $table->dateTime('TimeSlot');
19 | $table->string('Source', 10)->default('Total');
20 | $table->integer('CategoryID')->default(0);
21 | $table->integer('UserID');
22 | $table->integer('Points')->default(0);
23 | $table->primary(['SlotType','TimeSlot','Source','CategoryID','UserID'], 'composite');
24 | });
25 | }
26 |
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::drop('GDN_UserPoints');
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/views/themes/default/README.md:
--------------------------------------------------------------------------------
1 | This is a direct copy of the default theme from Vanilla into a spot appropriate for Laravel.
2 |
3 | To change the theme, follow these modified Vanilla instructions:
4 |
5 | Part 1: CSS / Design
6 | ====================
7 | If you like the layout and want to change only the look and feel of the forums, you can add your custom styles to `design/custom.css`.
8 |
9 | If you want to edit the look & feel of the administrative screens, also edit `design/customadmin.css`.
10 |
11 | If you want to affect non-forum pages, then you will have to edit the Vanilla source code itself.
12 |
13 | Part 2: HTML / Views (Advanced)
14 | ===============================
15 | If you want to adjust the layout as well, you need to edit the layout files.
16 |
17 | To add a banner or menu, change the footer, or any other major layout component, edit the `views/default.master.tpl` file.
18 |
19 | To change something specific about a particular part of Vanilla, find the file in `views/*` holding the existing content and change it there.
20 |
21 | [Additional help](http://vanillaforums.org/docs/themequickstart) may be found online.
22 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussions/index_rss.php:
--------------------------------------------------------------------------------
1 |
2 |
Head->Title()); ?>
3 |
4 |
5 | DiscussionData->Result() as $Discussion) {
7 | ?>
8 |
-
9 |
Name); ?>
10 | Url; ?>
11 | DateInserted)); ?>
12 | Category); ?>
13 | FirstName); ?>
14 | DiscussionID . '@' . Url('/discussions'); ?>
15 | Body, $Discussion->Format); ?>]]>
16 |
17 | integer('MergeID', true);
18 | $table->integer('OldUserID')->index('FK_UserMerge_OldUserID');
19 | $table->integer('NewUserID')->index('FK_UserMerge_NewUserID');
20 | $table->dateTime('DateInserted');
21 | $table->integer('InsertUserID');
22 | $table->dateTime('DateUpdated')->nullable();
23 | $table->integer('UpdateUserID')->nullable();
24 | $table->text('Attributes')->nullable();
25 | });
26 | }
27 |
28 |
29 | /**
30 | * Reverse the migrations.
31 | *
32 | * @return void
33 | */
34 | public function down()
35 | {
36 | Schema::drop('GDN_UserMerge');
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_ConversationMessage_table.php:
--------------------------------------------------------------------------------
1 | integer('MessageID', true);
18 | $table->integer('ConversationID')->index('FK_ConversationMessage_ConversationID');
19 | $table->text('Body');
20 | $table->string('Format', 20)->nullable();
21 | $table->integer('InsertUserID')->nullable()->index('FK_ConversationMessage_InsertUserID');
22 | $table->dateTime('DateInserted');
23 | $table->string('InsertIPAddress', 15)->nullable();
24 | });
25 | }
26 |
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::drop('GDN_ConversationMessage');
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/services/GardenPluginManager.php:
--------------------------------------------------------------------------------
1 | $Sender,
20 | 'EventClassName' => $EventClassName,
21 | 'EventName' => $EventName,
22 | 'EventHandlerType' => $EventHandlerType,
23 | 'Options' => $Options,
24 | ]);
25 |
26 | // log if we want to
27 | if (\Config::get('forum::package.trace-include-events', false)) {
28 | Trace(['EventClassName' => $EventClassName, 'EventName' => $EventName]);
29 | }
30 |
31 | // defer
32 | return parent::CallEventHandlers(
33 | $Sender, $EventClassName, $EventName, $EventHandlerType, $Options
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Ban_table.php:
--------------------------------------------------------------------------------
1 | integer('BanID', true);
18 | $table->enum('BanType', array('IPAddress','Name','Email'));
19 | $table->string('BanValue', 50);
20 | $table->string('Notes', 255)->nullable();
21 | $table->integer('CountUsers')->unsigned()->default(0);
22 | $table->integer('CountBlockedRegistrations')->unsigned()->default(0);
23 | $table->integer('InsertUserID');
24 | $table->dateTime('DateInserted');
25 | $table->unique(['BanType','BanValue'], 'UX_Ban');
26 | });
27 | }
28 |
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::drop('GDN_Ban');
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/controllers/PassthruController.php:
--------------------------------------------------------------------------------
1 | request = $request;
18 | $this->mapper = $mapper;
19 | }
20 |
21 | public function index()
22 | {
23 | // get the segments after our route prefix (/foo/bar) and feed into vanilla
24 | $segments = $this->request->segments();
25 | if (forum_get_route_prefix() === head($segments)) {
26 | array_shift($segments);
27 | }
28 |
29 | // use a default if needed
30 | if (0 === count($segments)) {
31 | $segments = [ 'discussions' ];
32 | }
33 |
34 | // run vanilla with the path and user we want
35 | $runner = new VanillaRunner();
36 | $runner->login($this->mapper->current());
37 | return $runner->view($segments);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/modules/bookmarked.php:
--------------------------------------------------------------------------------
1 | FetchViewLocation('helper_functions');
3 | require_once Gdn::Controller()->FetchViewLocation('helper_functions', 'Discussions', 'Vanilla');
4 |
5 | $Bookmarks = $this->Data('Bookmarks');
6 | ?>
7 |
8 |
9 | Result()) > 0): ?>
10 |
11 |
12 | Result() as $Discussion) {
14 | WriteModuleDiscussion($Discussion);
15 | }
16 | if ($Bookmarks->NumRows() == $this->Limit) {
17 | ?>
18 |
19 |
20 |
21 |
22 |
23 |
30 |
31 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_ActivityType_table.php:
--------------------------------------------------------------------------------
1 | integer('ActivityTypeID', true);
18 | $table->string('Name', 20);
19 | $table->boolean('AllowComments')->default(0);
20 | $table->boolean('ShowIcon')->default(0);
21 | $table->string('ProfileHeadline', 255)->nullable();
22 | $table->string('FullHeadline', 255)->nullable();
23 | $table->string('RouteCode', 255)->nullable();
24 | $table->boolean('Notify')->default(0);
25 | $table->boolean('Public')->default(1);
26 | });
27 | }
28 |
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::drop('GDN_ActivityType');
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussions/unread.php:
--------------------------------------------------------------------------------
1 | FetchViewLocation('helper_functions', 'discussions', 'vanilla');
4 |
5 | echo '
'.
6 | AdminCheck(NULL, array('', ' ')).
7 | $this->Data('Title').
8 | ' ';
9 |
10 | if ($Description = $this->Description()) {
11 | echo Wrap($Description, 'div', array('class' => 'P PageDescription'));
12 | }
13 | // echo Gdn_Theme::Module('DiscussionFilterModule');
14 |
15 | if ($this->DiscussionData->NumRows() > 0 || (isset($this->AnnounceData) && is_object($this->AnnounceData) && $this->AnnounceData->NumRows() > 0)) {
16 | ?>
17 |
18 | FetchViewLocation('discussions')); ?>
19 |
20 | $this->Data('CountDiscussions'), 'CurrentRecords' => $this->Data('Discussions')->NumRows());
22 | if ($this->Data('_PagerUrl'))
23 | $PagerOptions['Url'] = $this->Data('_PagerUrl');
24 |
25 | PagerModule::Write($PagerOptions);
26 | } else {
27 | ?>
28 |
29 | false,
16 |
17 | /**
18 | * The logging level used to record trace. If `trace` is false, this
19 | * has no effect. If `trace` is true, the level given is used. Possible
20 | * levels are: debug, info, notice, warning, error, critical, and alert
21 | */
22 | 'trace-level' => 'debug',
23 |
24 | /**
25 | * If you would like to see the events that Vanilla's firing, enable
26 | * `trace-include-events`. This has no effect unless `trace` is on.
27 | */
28 | 'trace-include-events' => false,
29 |
30 | /**
31 | * If you would like to see the database queries that Vanilla's making, enable
32 | * `trace-include-queries`. This has no effect unless `trace` is on.
33 | */
34 | 'trace-include-queries' => false,
35 | ];
36 |
--------------------------------------------------------------------------------
/src/models/Attachment.php:
--------------------------------------------------------------------------------
1 | 'required|max:64',
10 | 'ForeignID' => 'required|max:50',
11 | 'ForeignUserID' => 'required|exists:GDN_User,UserID',
12 | 'Source' => 'required|max:64',
13 | 'SourceID' => 'required|max:32',
14 | 'SourceURL' => 'required|url|max:255',
15 | // 'Attributes' => none,
16 | ];
17 |
18 | // auditing
19 | use AuditingTrait;
20 | public function getAuditors()
21 | {
22 | return [
23 | 'InsertUserID', 'DateInserted', 'InsertIPAddress',
24 | 'UpdateUserID', 'DateUpdated', 'UpdateIPAddress',
25 | ];
26 | }
27 |
28 | // definitions
29 | protected $table = 'GDN_Attachment';
30 | protected $primaryKey = 'AttachmentID';
31 |
32 | public function getDates()
33 | {
34 | return [ 'DateInserted', 'DateUpdated', ];
35 | }
36 |
37 | // relations
38 | public function user()
39 | {
40 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'ForeignUserID');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/models/Permission.php:
--------------------------------------------------------------------------------
1 | 'exists:GDN_Role,RoleID',
10 | 'JunctionTable' => 'max:100',
11 | 'JunctionColumn' => 'max:100',
12 | 'JunctionID' => 'integer',
13 | // any other columns with dots in them are boolean
14 | ];
15 |
16 | // definitions
17 | protected $table = 'GDN_Permission';
18 | protected $primaryKey = 'PermissionID';
19 |
20 | // relations
21 | public function role()
22 | {
23 | return $this->hasOne(
24 | '\BishopB\Forum\Role', 'RoleID', 'RoleID'
25 | );
26 | }
27 |
28 | // custom
29 | /**
30 | * Any permission attribute we set needs to be boolean.
31 | * Since Vanilla can add these columns at run time, we have to react at
32 | * run-time.
33 | */
34 | public function setAttribute($key, $value)
35 | {
36 | if (str_contains($key, '.') && ! array_key_exists($key, $this->rules)) {
37 | $this->getValidator()->addRule($key, 'boolean');
38 | }
39 |
40 | return parent::setAttribute($key, $value);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/models/Tag.php:
--------------------------------------------------------------------------------
1 | 'required|max:255',
10 | 'FullName' => 'required|max:255',
11 | 'Type' => 'max:20',
12 | 'ParentTagID' => 'exists:GDN_Tag,TagID',
13 | 'CategoryID' => 'exists:GDN_Category,CategoryID|unique_with:GDN_Tag,Name',
14 | 'CountDiscussions' => 'integer|min:0',
15 | ];
16 |
17 | // auditing
18 | use AuditingTrait;
19 | public function getAuditors()
20 | {
21 | return [ 'InsertUserID', 'DateInserted', ];
22 | }
23 |
24 | // definitions
25 | protected $table = 'GDN_Tag';
26 | protected $primaryKey = 'TagID';
27 |
28 | public function getDates()
29 | {
30 | return [ 'DateInserted', ];
31 | }
32 |
33 | // relationships
34 | public function parent_tag()
35 | {
36 | return $this->hasOne('\BishopB\Forum\Tag', 'TagID', 'ParentTagID');
37 | }
38 |
39 | public function category()
40 | {
41 | return $this->hasOne(
42 | '\BishopB\Forum\Category', 'CategoryID', 'CategoryID'
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_UserAuthenticationToken_table.php:
--------------------------------------------------------------------------------
1 | string('Token', 128);
18 | $table->string('ProviderKey', 64);
19 | $table->string('ForeignUserKey')->nullable();
20 | $table->string('TokenSecret', 64);
21 | $table->enum('TokenType', array('request','access'));
22 | $table->boolean('Authorized');
23 | $table->timestamp('Timestamp')->default(DB::raw('CURRENT_TIMESTAMP'));
24 | $table->integer('Lifetime');
25 | $table->primary(['Token','ProviderKey']);
26 | });
27 | }
28 |
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::drop('GDN_UserAuthenticationToken');
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_UserDiscussion_table.php:
--------------------------------------------------------------------------------
1 | integer('UserID');
18 | $table->integer('DiscussionID')->index('FK_UserDiscussion_DiscussionID');
19 | $table->float('Score', 10, 0)->nullable();
20 | $table->integer('CountComments')->default(0);
21 | $table->dateTime('DateLastViewed')->nullable();
22 | $table->boolean('Dismissed')->default(0);
23 | $table->boolean('Bookmarked')->default(0);
24 | $table->boolean('Participated')->default(0);
25 | $table->primary(['UserID','DiscussionID']);
26 | });
27 | }
28 |
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::drop('GDN_UserDiscussion');
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/models/TagDiscussion.php:
--------------------------------------------------------------------------------
1 | 'required|integer',
10 | 'DiscussionID' => 'required|integer|unique_with:GDN_TagDiscussion,TagID',
11 | 'CategoryID' => 'required|exists:GDN_Category,CategoryID',
12 | ];
13 |
14 | // auditing
15 | use AuditingTrait;
16 | public function getAuditors()
17 | {
18 | return [ 'DateInserted', ];
19 | }
20 |
21 | // definitions
22 | protected $table = 'GDN_TagDiscussion';
23 | use NoPrimaryKeyTrait;
24 |
25 | public function getDates()
26 | {
27 | return [ 'DateInserted', ];
28 | }
29 |
30 | // relationships
31 | public function tag()
32 | {
33 | return $this->hasOne('\BishopB\Forum\Tag', 'TagID', 'TagID');
34 | }
35 |
36 | public function discussion()
37 | {
38 | return $this->hasOne(
39 | '\BishopB\Forum\Discussion', 'DiscussionID', 'DiscussionID'
40 | );
41 | }
42 |
43 | public function category()
44 | {
45 | return $this->hasOne(
46 | '\BishopB\Forum\Category', 'CategoryID', 'CategoryID'
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Invitation_table.php:
--------------------------------------------------------------------------------
1 | integer('InvitationID', true);
18 | $table->string('Email', 200)->index('IX_Invitation_Email');
19 | $table->string('Name', 50)->nullable();
20 | $table->text('RoleIDs')->nullable();
21 | $table->string('Code', 50)->unique('UX_Invitation');
22 | $table->integer('InsertUserID')->nullable();
23 | $table->dateTime('DateInserted');
24 | $table->integer('AcceptedUserID')->nullable();
25 | $table->dateTime('DateExpires')->nullable();
26 | $table->index(['InsertUserID','DateInserted'], 'IX_Invitation_userdate');
27 | });
28 | }
29 |
30 |
31 | /**
32 | * Reverse the migrations.
33 | *
34 | * @return void
35 | */
36 | public function down()
37 | {
38 | Schema::drop('GDN_Invitation');
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Tag_table.php:
--------------------------------------------------------------------------------
1 | integer('TagID', true);
18 | $table->string('Name', 255);
19 | $table->string('FullName', 255)->index('IX_Tag_FullName');
20 | $table->string('Type', 20)->default('')->index('IX_Tag_Type');
21 | $table->integer('ParentTagID')->nullable()->index('FK_Tag_ParentTagID');
22 | $table->integer('InsertUserID')->nullable()->index('FK_Tag_InsertUserID');
23 | $table->dateTime('DateInserted');
24 | $table->integer('CategoryID')->default(-1);
25 | $table->integer('CountDiscussions')->default(0);
26 | $table->unique(['Name','CategoryID'], 'UX_Tag');
27 | });
28 | }
29 |
30 |
31 | /**
32 | * Reverse the migrations.
33 | *
34 | * @return void
35 | */
36 | public function down()
37 | {
38 | Schema::drop('GDN_Tag');
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/models/BaseModel.php:
--------------------------------------------------------------------------------
1 | getTraits())) {
36 | $this->guarded = $this->guarded + $this->getAuditors();
37 | }
38 |
39 | parent::__construct($attributes);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/services/UrlGenerator.php:
--------------------------------------------------------------------------------
1 | /library/core/functions.general.php
10 | * 2.
/src/Illuminate/Support/helpers.php
11 | */
12 | class UrlGenerator extends \Illuminate\Routing\UrlGenerator
13 | {
14 | public function to($path, $parameters = null, $secure = false)
15 | {
16 | return parent::to(
17 | $this->rewrite_url($path),
18 | (is_array($parameters) ? $parameters : []),
19 | $secure
20 | );
21 | }
22 |
23 | public function asset($path, $secure = null)
24 | {
25 | return parent::to($this->rewrite_url($path), [], false);
26 | }
27 |
28 | private function rewrite_url($path)
29 | {
30 | if (starts_with($path, 'http') || starts_with($path, '//')) { // absolute
31 | return $path;
32 |
33 | } else if (starts_with($path, '{')) { // smarty template variable
34 | return $path;
35 |
36 | } else if (empty($path)) { // self
37 | return \Request::url();
38 |
39 | } else { // relative
40 | return forum_get_route_prefix() . '/' . ltrim($path, '/');
41 | }
42 | }
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Regarding_table.php:
--------------------------------------------------------------------------------
1 | integer('RegardingID', true);
18 | $table->string('Type', 255)->index('FK_Regarding_Type');
19 | $table->integer('InsertUserID');
20 | $table->dateTime('DateInserted');
21 | $table->string('ForeignType', 32);
22 | $table->integer('ForeignID');
23 | $table->text('OriginalContent')->nullable();
24 | $table->string('ParentType', 32)->nullable();
25 | $table->integer('ParentID')->nullable();
26 | $table->string('ForeignURL', 255)->nullable();
27 | $table->text('Comment');
28 | $table->integer('Reports')->nullable();
29 | });
30 | }
31 |
32 |
33 | /**
34 | * Reverse the migrations.
35 | *
36 | * @return void
37 | */
38 | public function down()
39 | {
40 | Schema::drop('GDN_Regarding');
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/drafts/drafts.php:
--------------------------------------------------------------------------------
1 | DraftData->Result() as $Draft) {
6 | $Offset = GetValue('CountComments', $Draft, 0);
7 | if($Offset > C('Vanilla.Comments.PerPage', 30)) {
8 | $Offset -= C('Vanilla.Comments.PerPage', 30);
9 | } else {
10 | $Offset = 0;
11 | }
12 |
13 | $EditUrl = !is_numeric($Draft->DiscussionID) || $Draft->DiscussionID <= 0 ? '/post/editdiscussion/0/'.$Draft->DraftID : '/discussion/'.$Draft->DiscussionID.'/'.$Offset.'/#Form_Comment';
14 | $Alt = $Alt == ' Alt' ? '' : ' Alt';
15 | $Excerpt = SliceString(Gdn_Format::Text($Draft->Body), 200);
16 | ?>
17 |
18 | DraftID.'/'.$Session->TransientKey().'?Target='.urlencode($this->SelfUrl), 'Delete'); ?>
19 |
20 | Name, FALSE), $EditUrl, 'Title DraftLink'); ?>
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | install();
37 | $this->info(
38 | 'Vanilla now connected to Laravel. Try it out at ' .
39 | \URL::to(forum_get_route_prefix())
40 | );
41 | }
42 |
43 | /**
44 | * Get the console command arguments.
45 | *
46 | * @return array
47 | */
48 | protected function getArguments()
49 | {
50 | return [];
51 | }
52 |
53 | /**
54 | * Get the console command options.
55 | *
56 | * @return array
57 | */
58 | protected function getOptions()
59 | {
60 | return [];
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussions/archives.php:
--------------------------------------------------------------------------------
1 | FetchViewLocation('helper_functions');
3 | ?>
4 |
5 | Data('Title'); ?>
6 |
7 | Data('_Description');
9 | ?>
10 |
11 |
12 |
13 |
16 |
17 |
18 | FetchViewLocation('table_functions');
22 | ?>
23 |
24 |
25 |
26 |
29 |
30 |
31 | DiscussionData->Result() as $Discussion) {
33 | WriteDiscussionRow($Discussion, $this, Gdn::Session(), FALSE);
34 | }
35 | ?>
36 |
37 |
38 |
39 |
42 |
43 | FetchViewLocation('discussions')); ?>
44 |
45 |
49 |
50 |
53 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Message_table.php:
--------------------------------------------------------------------------------
1 | integer('MessageID', true);
18 | $table->text('Content');
19 | $table->string('Format', 20)->nullable();
20 | $table->boolean('AllowDismiss')->default(1);
21 | $table->boolean('Enabled')->default(1);
22 | $table->string('Application', 255)->nullable();
23 | $table->string('Controller', 255)->nullable();
24 | $table->string('Method', 255)->nullable();
25 | $table->integer('CategoryID')->nullable();
26 | $table->boolean('IncludeSubcategories')->default(0);
27 | $table->string('AssetTarget', 20)->nullable();
28 | $table->string('CssClass', 20)->nullable();
29 | $table->integer('Sort')->nullable();
30 | });
31 | }
32 |
33 |
34 | /**
35 | * Reverse the migrations.
36 | *
37 | * @return void
38 | */
39 | public function down()
40 | {
41 | Schema::drop('GDN_Message');
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/moderation/confirmdiscussiondeletes.php:
--------------------------------------------------------------------------------
1 |
2 | Data('Title'); ?>
3 | Form->Open();
5 | echo $this->Form->Errors();
6 |
7 | $CountAllowed = GetValue('CountAllowed', $this->Data, 0);
8 | $CountNotAllowed = GetValue('CountNotAllowed', $this->Data, 0);
9 | $CountCheckedDiscussions = GetValue('CountCheckedDiscussions', $this->Data, 0);
10 |
11 | if ($CountNotAllowed > 0) {
12 | echo Wrap(sprintf(
13 | T('NoPermissionToDeleteDiscussions', 'You do not have permission to delete %1$s of the selected discussions.'),
14 | $CountNotAllowed
15 | ), 'p');
16 |
17 | echo Wrap(sprintf(
18 | T('AboutToDeleteSelectedDiscussions', 'You are about to delete %1$s of the %2$s selected discussions.'),
19 | $CountAllowed,
20 | $CountCheckedDiscussions
21 | ), 'p');
22 | } else {
23 | echo Wrap(sprintf(
24 | T('AboutToDelete', 'You are about to delete %s.'),
25 | Plural($CountAllowed, '%s discussion', '%s discussions')
26 | ), 'p');
27 | }
28 |
29 | echo ''.T('Are you sure you wish to continue?').'
';
30 |
31 | echo '',
32 | $this->Form->Button('OK', array('class' => 'Button Primary')),
33 | $this->Form->Button('Cancel', array('type' => 'button', 'class' => 'Button Close')),
34 | '
';
35 |
36 | echo $this->Form->Close();
37 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_UserConversation_table.php:
--------------------------------------------------------------------------------
1 | integer('UserID');
18 | $table->integer('ConversationID')->index('FK_UserConversation_ConversationID');
19 | $table->integer('CountReadMessages')->default(0);
20 | $table->integer('LastMessageID')->nullable();
21 | $table->dateTime('DateLastViewed')->nullable();
22 | $table->dateTime('DateCleared')->nullable();
23 | $table->boolean('Bookmarked')->default(0);
24 | $table->boolean('Deleted')->default(0);
25 | $table->dateTime('DateConversationUpdated')->nullable();
26 | $table->primary(['UserID','ConversationID']);
27 | $table->index(['UserID','Deleted','DateConversationUpdated'], 'IX_UserConversation_Inbox');
28 | });
29 | }
30 |
31 |
32 | /**
33 | * Reverse the migrations.
34 | *
35 | * @return void
36 | */
37 | public function down()
38 | {
39 | Schema::drop('GDN_UserConversation');
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/models/Draft.php:
--------------------------------------------------------------------------------
1 | 'exists:GDN_Discussion,DiscussionID',
10 | 'CategoryID' => 'exists:GDN_Category,CategoryID',
11 | 'Name' => 'max:100',
12 | 'Tags' => 'max:255',
13 | 'Closed' => 'boolean',
14 | 'Announce' => 'boolean',
15 | 'Sink' => 'boolean',
16 | 'Body' => 'required',
17 | 'Format' => 'max:20',
18 | ];
19 |
20 | // auditing
21 | use AuditingTrait;
22 | public function getAuditors()
23 | {
24 | return [
25 | 'InsertUserID', 'DateInserted',
26 | 'UpdateUserID', 'DateUpdated',
27 | ];
28 | }
29 |
30 | // definitions
31 | protected $table = 'GDN_Draft';
32 | protected $primaryKey = 'DraftID';
33 |
34 | public function getDates()
35 | {
36 | return [ 'DateInserted', 'DateUpdated', ];
37 | }
38 |
39 | // relations
40 | public function discussion()
41 | {
42 | return $this->hasOne(
43 | '\BishopB\Forum\Discussion', 'DiscussionID', 'DiscussionID'
44 | );
45 | }
46 |
47 | public function category()
48 | {
49 | return $this->hasOne(
50 | '\BishopB\Forum\Category', 'CategoryID', 'CategoryID'
51 | );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Draft_table.php:
--------------------------------------------------------------------------------
1 | integer('DraftID', true);
18 | $table->integer('DiscussionID')->nullable()->index('FK_Draft_DiscussionID');
19 | $table->integer('CategoryID')->nullable()->index('FK_Draft_CategoryID');
20 | $table->integer('InsertUserID')->index('FK_Draft_InsertUserID');
21 | $table->integer('UpdateUserID');
22 | $table->string('Name', 100)->nullable();
23 | $table->string('Tags', 255)->nullable();
24 | $table->boolean('Closed')->default(0);
25 | $table->boolean('Announce')->default(0);
26 | $table->boolean('Sink')->default(0);
27 | $table->text('Body');
28 | $table->string('Format', 20)->nullable();
29 | $table->dateTime('DateInserted');
30 | $table->dateTime('DateUpdated')->nullable();
31 | });
32 | }
33 |
34 |
35 | /**
36 | * Reverse the migrations.
37 | *
38 | * @return void
39 | */
40 | public function down()
41 | {
42 | Schema::drop('GDN_Draft');
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/categories/discussions.php:
--------------------------------------------------------------------------------
1 | '.$this->Data('Title').'';
3 | $ViewLocation = $this->FetchViewLocation('discussions', 'discussions');
4 | ?>
5 |
6 | CategoryData->Result() as $Category) :
7 | if ($Category->CategoryID <= 0)
8 | continue;
9 |
10 | $this->Category = $Category;
11 | $this->DiscussionData = $this->CategoryDiscussionData[$Category->CategoryID];
12 |
13 | if ($this->DiscussionData->NumRows() > 0) : ?>
14 |
15 |
16 |
Name), CategoryUrl($Category));
18 | Gdn::Controller()->EventArguments['Category'] = $Category;
19 | Gdn::Controller()->FireEvent('AfterCategoryTitle');
20 | ?>
21 |
22 |
23 | FetchViewLocation('discussions', 'discussions')); ?>
24 |
25 |
26 | DiscussionData->NumRows() == $this->DiscussionsPerCategory) : ?>
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/default.master.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {asset name="Head"}
5 |
6 |
7 |
8 |
9 |
10 |
{logo}
11 |
{searchbox}
12 |
21 |
22 |
23 |
24 |
25 |
{breadcrumbs}
26 |
27 | {module name="MeModule"}
28 | {asset name="Panel"}
29 |
30 |
{asset name="Content"}
31 |
32 |
33 |
39 |
40 | {event name="AfterBody"}
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Attachment_table.php:
--------------------------------------------------------------------------------
1 | integer('AttachmentID', true);
18 | $table->string('Type', 64);
19 | $table->string('ForeignID', 50)->index('IX_Attachment_ForeignID');
20 | $table->integer('ForeignUserID')->index('FK_Attachment_ForeignUserID');
21 | $table->string('Source', 64);
22 | $table->string('SourceID', 32);
23 | $table->string('SourceURL', 255);
24 | $table->text('Attributes')->nullable();
25 | $table->dateTime('DateInserted');
26 | $table->integer('InsertUserID')->index('FK_Attachment_InsertUserID');
27 | $table->string('InsertIPAddress', 64);
28 | $table->dateTime('DateUpdated')->nullable();
29 | $table->integer('UpdateUserID')->nullable();
30 | $table->string('UpdateIPAddress', 15)->nullable();
31 | });
32 | }
33 |
34 |
35 | /**
36 | * Reverse the migrations.
37 | *
38 | * @return void
39 | */
40 | public function down()
41 | {
42 | Schema::drop('GDN_Attachment');
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/ForumServiceProvider.php:
--------------------------------------------------------------------------------
1 | package('bishopb/laravel-forums', 'forum', __DIR__);
17 |
18 | require_once __DIR__ . '/boot/helpers.php';
19 | require_once __DIR__ . '/boot/routes.php';
20 |
21 | $this->commands('forum::commands.migrate', 'forum::commands.connect');
22 | }
23 |
24 | /**
25 | * Register the service provider. Keep it fast.
26 | *
27 | * @return void
28 | */
29 | public function register()
30 | {
31 | $this->app->register(
32 | 'Felixkiss\UniqueWithValidator\UniqueWithValidatorServiceProvider'
33 | );
34 |
35 | // providers
36 | $this->app->bind(
37 | 'BishopB\Forum\UserMapperInterface', 'BishopB\Forum\UserMapperAllGuestAccess'
38 | );
39 |
40 | // commands
41 | $this->app['forum::commands.migrate'] = $this->app->share(function ($app) {
42 | return new VanillaMigrate();
43 | });
44 | $this->app['forum::commands.connect'] = $this->app->share(function ($app) {
45 | return new VanillaConnect();
46 | });
47 | }
48 |
49 | /**
50 | * We have views and configuration: can't defer.
51 | *
52 | * @var bool
53 | */
54 | protected $defer = false;
55 | }
56 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Media_table.php:
--------------------------------------------------------------------------------
1 | integer('MediaID', true);
18 | $table->string('Name', 255);
19 | $table->string('Path', 255);
20 | $table->string('Type', 128);
21 | $table->integer('Size');
22 | $table->integer('InsertUserID');
23 | $table->dateTime('DateInserted');
24 | $table->integer('ForeignID')->nullable();
25 | $table->string('ForeignTable', 24)->nullable();
26 | $table->smallInteger('ImageWidth')->unsigned()->nullable();
27 | $table->smallInteger('ImageHeight')->unsigned()->nullable();
28 | $table->smallInteger('ThumbWidth')->unsigned()->nullable();
29 | $table->smallInteger('ThumbHeight')->unsigned()->nullable();
30 | $table->string('ThumbPath', 255)->nullable();
31 | $table->index(['ForeignID','ForeignTable'], 'IX_Media_Foreign');
32 | });
33 | }
34 |
35 |
36 | /**
37 | * Reverse the migrations.
38 | *
39 | * @return void
40 | */
41 | public function down()
42 | {
43 | Schema::drop('GDN_Media');
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/moderation/confirmdiscussionmoves.php:
--------------------------------------------------------------------------------
1 |
2 | Data('Title'); ?>
3 | Form->Open();
5 | echo $this->Form->Errors();
6 |
7 | $CountAllowed = GetValue('CountAllowed', $this->Data, 0);
8 | $CountNotAllowed = GetValue('CountNotAllowed', $this->Data, 0);
9 | $CountCheckedDiscussions = GetValue('CountCheckedDiscussions', $this->Data, 0);
10 |
11 | if ($CountNotAllowed > 0) {
12 | echo Wrap(sprintf(
13 | t('You do not have permission to move %1$s of the selected discussions.'),
14 | $CountNotAllowed
15 | ), 'p');
16 |
17 | echo Wrap(sprintf(
18 | t('You are about to move %1$s of the %2$s of the selected discussions.'),
19 | $CountAllowed,
20 | $CountCheckedDiscussions
21 | ), 'p');
22 | } else {
23 | echo Wrap(sprintf(
24 | t('You are about to move %s.'),
25 | Plural($CountCheckedDiscussions, '%s discussion', '%s discussions')
26 | ), 'p');
27 | }
28 | ?>
29 |
46 | Form->Close('Move');
48 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_UserAuthenticationProvider_table.php:
--------------------------------------------------------------------------------
1 | string('AuthenticationKey', 64)->primary();
18 | $table->string('AuthenticationSchemeAlias', 32);
19 | $table->string('Name', 50)->nullable();
20 | $table->string('URL')->nullable();
21 | $table->text('AssociationSecret')->nullable();
22 | $table->string('AssociationHashMethod', 20)->nullable();
23 | $table->string('AuthenticateUrl')->nullable();
24 | $table->string('RegisterUrl')->nullable();
25 | $table->string('SignInUrl')->nullable();
26 | $table->string('SignOutUrl')->nullable();
27 | $table->string('PasswordUrl')->nullable();
28 | $table->string('ProfileUrl')->nullable();
29 | $table->text('Attributes')->nullable();
30 | $table->boolean('Active')->default(1);
31 | $table->boolean('IsDefault')->default(0);
32 | });
33 | }
34 |
35 |
36 | /**
37 | * Reverse the migrations.
38 | *
39 | * @return void
40 | */
41 | public function down()
42 | {
43 | Schema::drop('GDN_UserAuthenticationProvider');
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/models/Log.php:
--------------------------------------------------------------------------------
1 | 'required|in:Delete,Edit,Spam,Moderate,Pending,Ban,Error',
10 | 'RecordType' => 'required|in:Discussion,Comment,User,Registration,Activity,ActivityComment,Configuration,Group',
11 | 'TransactionLogID' => 'integer',
12 | 'RecordID' => 'integer',
13 | 'RecordUserID' => 'exists:GDN_User,UserID',
14 | 'RecordDate' => 'required|date',
15 | 'RecordIPAddress' => 'ip|max:15',
16 | 'OtherUserIDs' => 'max:255',
17 | 'ParentRecordID' => 'integer',
18 | 'CategoryID' => 'exists:GDN_Category,CategoryID',
19 | 'Data' => none,
20 | 'CountGroup' => 'integer',
21 | ];
22 |
23 | // auditing
24 | use AuditingTrait;
25 | public function getAuditors()
26 | {
27 | return [
28 | 'InsertUserID', 'DateInserted', 'InsertIPAddress',
29 | 'DateUpdated',
30 | ];
31 | }
32 |
33 | // definitions
34 | protected $table = 'GDN_Log';
35 | protected $primaryKey = 'LogID';
36 |
37 | public function getDates()
38 | {
39 | return [ 'DateInserted', 'DateUpdated', 'RecordDate', ];
40 | }
41 |
42 | // relations
43 | public function record_user()
44 | {
45 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'RecordUserID');
46 | }
47 |
48 | public function category()
49 | {
50 | return $this->hasOne('\BishopB\Forum\Category', 'CategoryID', 'CategoryID');
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/models/AuditingTrait.php:
--------------------------------------------------------------------------------
1 | getAuditors())) {
33 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'InsertUserID');
34 | } else {
35 | return false;
36 | }
37 | }
38 |
39 | public function updating_user()
40 | {
41 | if (in_array('UpdateUserID', $this->getAuditors())) {
42 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'UpdateUserID');
43 | } else {
44 | return false;
45 | }
46 | }
47 |
48 | public function deleting_user()
49 | {
50 | if (in_array('DeleteUserID', $this->getAuditors())) {
51 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'DeleteUserID');
52 | } else {
53 | return false;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussions/popin.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | Data('Discussions'))):
5 | ?>
6 |
7 | Data('Title'), 'strong'); ?>
8 |
9 | Data('Discussions') as $Row):
11 | ?>
12 |
13 | 'First')); ?>
14 |
15 |
Name, $Row->Url.'#latest'); ?>
16 |
17 | '.Plural($Row->CountComments, '%s comment', '%s comments').' ';
19 |
20 | if ($Row->CountUnreadComments === TRUE) {
21 | echo ' '.T('new').' ';
22 | } elseif ($Row->CountUnreadComments > 0) {
23 | echo ' '.Plural($Row->CountUnreadComments, '%s new', '%s new plural').' ';
24 | }
25 |
26 | echo ' '.Gdn_Format::Date($Row->DateLastComment).' ';
27 | ?>
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/services/GardenSmarty.php:
--------------------------------------------------------------------------------
1 | Smarty();
18 |
19 | // stuff all the facades into Smarty
20 | $loader = \Illuminate\Foundation\AliasLoader::getInstance();
21 | foreach ($loader->getAliases() as $alias => $class) {
22 | $object = $this->resolve($class);
23 | $smarty->assign($alias, $object);
24 | }
25 | }
26 |
27 | /**
28 | * Yanked from davejamesmiller/laravel-aliases
29 | */
30 | protected function resolve($class)
31 | {
32 | if ($this->isFacade($class)) {
33 | if ($accessor = $this->getFacadeAccessor($class)) {
34 | return \App::make($accessor);
35 | } else {
36 | return $class::getFacadeRoot();
37 | }
38 | }
39 |
40 | return null;
41 | }
42 |
43 | protected function isFacade($class)
44 | {
45 | return get_parent_class($class) == 'Illuminate\Support\Facades\Facade';
46 | }
47 |
48 | protected function getFacadeAccessor($class)
49 | {
50 | // HACK!!
51 | $method = new \ReflectionMethod($class, 'getFacadeAccessor');
52 | $method->setAccessible(true);
53 | $accessor = $method->invoke(null);
54 |
55 | // Some facades return an object not a name, e.g. Illuminate\Support\Facades\Blade
56 | return is_string($accessor) ? $accessor : null;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/commands/VanillaMigrate.php:
--------------------------------------------------------------------------------
1 | input->getOptions() as $option => $value) {
37 | if (! empty($value)) {
38 | $options['--' . $option] = $value;
39 | }
40 | }
41 |
42 | $options['--package'] = 'bishopb/laravel-forums';
43 |
44 | $this->call('migrate', $options);
45 | }
46 |
47 | /**
48 | * Get the console command arguments.
49 | *
50 | * @return array
51 | */
52 | protected function getArguments()
53 | {
54 | return [];
55 | }
56 |
57 | /**
58 | * Get the console command options.
59 | *
60 | * @return array
61 | */
62 | protected function getOptions()
63 | {
64 | $o = InputOption::VALUE_OPTIONAL;
65 | $n = InputOption::VALUE_NONE;
66 | return [
67 | [ 'database', null, $o, 'The database connection to use.' ],
68 | [ 'force', null, $n, 'Force the operation to run when in production.' ],
69 | [ 'pretend', null, $n, 'Dump the SQL queries that would be run.' ],
70 | ];
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Conversation_table.php:
--------------------------------------------------------------------------------
1 | integer('ConversationID', true);
18 | $table->string('Type', 10)->nullable()->index('IX_Conversation_Type');
19 | $table->string('ForeignID', 40)->nullable();
20 | $table->string('Subject', 100)->nullable();
21 | $table->string('Contributors', 255);
22 | $table->integer('FirstMessageID')->nullable()->index('FK_Conversation_FirstMessageID');
23 | $table->integer('InsertUserID')->index('FK_Conversation_InsertUserID');
24 | $table->dateTime('DateInserted')->nullable()->index('FK_Conversation_DateInserted');
25 | $table->string('InsertIPAddress', 15)->nullable();
26 | $table->integer('UpdateUserID')->index('FK_Conversation_UpdateUserID');
27 | $table->dateTime('DateUpdated');
28 | $table->string('UpdateIPAddress', 15)->nullable();
29 | $table->integer('CountMessages')->default(0);
30 | $table->integer('CountParticipants')->default(0);
31 | $table->integer('LastMessageID')->nullable();
32 | $table->integer('RegardingID')->nullable()->index('IX_Conversation_RegardingID');
33 | });
34 | }
35 |
36 |
37 | /**
38 | * Reverse the migrations.
39 | *
40 | * @return void
41 | */
42 | public function down()
43 | {
44 | Schema::drop('GDN_Conversation');
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussions/index.php:
--------------------------------------------------------------------------------
1 | FetchViewLocation('helper_functions', 'discussions', 'vanilla');
4 |
5 | echo ''.
6 | AdminCheck(NULL, array('', ' ')).
7 | $this->Data('Title').
8 | ' ';
9 |
10 | if ($Description = $this->Description()) {
11 | echo Wrap($Description, 'div', array('class' => 'P PageDescription'));
12 | }
13 |
14 | $this->FireEvent('AfterPageTitle');
15 |
16 | include $this->FetchViewLocation('Subtree', 'Categories', 'Vanilla');
17 |
18 | $this->FireEvent('AfterCategorySubtree');
19 |
20 | $PagerOptions = array('Wrapper' => '%2$s
', 'RecordCount' => $this->Data('CountDiscussions'), 'CurrentRecords' => $this->Data('Discussions')->NumRows());
21 | if ($this->Data('_PagerUrl'))
22 | $PagerOptions['Url'] = $this->Data('_PagerUrl');
23 |
24 | echo '';
25 | PagerModule::Write($PagerOptions);
26 | echo Gdn_Theme::Module('NewDiscussionModule', $this->Data('_NewDiscussionProperties', array('CssClass' => 'Button Action Primary')));
27 | echo '
';
28 |
29 | if ($this->DiscussionData->NumRows() > 0 || (isset($this->AnnounceData) && is_object($this->AnnounceData) && $this->AnnounceData->NumRows() > 0)) {
30 | ?>
31 |
32 | FetchViewLocation('discussions', 'Discussions', 'Vanilla')); ?>
33 |
34 | ';
37 | PagerModule::Write($PagerOptions);
38 | echo Gdn_Theme::Module('NewDiscussionModule', $this->Data('_NewDiscussionProperties', array('CssClass' => 'Button Action Primary')));
39 | echo '
44 | integer('LogID', true);
18 | $table->enum('Operation', array('Delete','Edit','Spam','Moderate','Pending','Ban','Error'))->index('IX_Log_Operation');
19 | $table->enum('RecordType', array('Discussion','Comment','User','Registration','Activity','ActivityComment','Configuration','Group'))->index('IX_Log_RecordType');
20 | $table->integer('TransactionLogID')->nullable();
21 | $table->integer('RecordID')->nullable()->index('IX_Log_RecordID');
22 | $table->integer('RecordUserID')->nullable();
23 | $table->dateTime('RecordDate');
24 | $table->string('RecordIPAddress', 15)->nullable()->index('IX_Log_RecordIPAddress');
25 | $table->integer('InsertUserID');
26 | $table->dateTime('DateInserted');
27 | $table->string('InsertIPAddress', 15)->nullable();
28 | $table->string('OtherUserIDs', 255)->nullable();
29 | $table->dateTime('DateUpdated')->nullable();
30 | $table->integer('ParentRecordID')->nullable()->index('IX_Log_ParentRecordID');
31 | $table->integer('CategoryID')->nullable()->index('FK_Log_CategoryID');
32 | $table->text('Data')->nullable();
33 | $table->integer('CountGroup')->nullable();
34 | });
35 | }
36 |
37 |
38 | /**
39 | * Reverse the migrations.
40 | *
41 | * @return void
42 | */
43 | public function down()
44 | {
45 | Schema::drop('GDN_Log');
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/modules/categories.php:
--------------------------------------------------------------------------------
1 | _Sender->CategoryID) ? $this->_Sender->CategoryID : '';
4 | $OnCategories = strtolower($this->_Sender->ControllerName) == 'categoriescontroller' && !is_numeric($CategoryID);
5 | if ($this->Data !== FALSE) {
6 | foreach ($this->Data->Result() as $Category) {
7 | $CountDiscussions = $CountDiscussions + $Category->CountDiscussions;
8 | }
9 | ?>
10 |
44 | 'max:10',
10 | 'ForeignID' => 'max:40',
11 | 'Subject' => 'max:100',
12 | 'Contributors' => 'required|max:255',
13 | 'FirstMessageID' => 'exists:GDN_ConversationMessage,MessageID',
14 | 'CountMessages' => 'integer|min:0',
15 | 'CountParticipants' => 'integer|min:0',
16 | 'LastMessageID' => 'exists:GDN_ConversationMessage,MessageID',
17 | 'RegardingID' => 'exists:GDN_Regarding,RegardingID',
18 | ];
19 |
20 | // auditing
21 | use AuditingTrait;
22 | public function getAuditors()
23 | {
24 | return [
25 | 'InsertUserID', 'DateInserted', 'InsertIPAddress',
26 | 'UpdateUserID', 'DateUpdated', 'UpdateIPAddress',
27 | ];
28 | }
29 |
30 | // definitions
31 | protected $table = 'GDN_Conversation';
32 | protected $primaryKey = 'ConversationID';
33 |
34 | public function getDates()
35 | {
36 | return [ 'DateInserted', 'DateUpdated', ];
37 | }
38 |
39 | // relations
40 | public function messages()
41 | {
42 | return $this->hasMany(
43 | '\BishopB\Forum\ConversationMessage', 'ConversationID', 'ConversationID'
44 | );
45 | }
46 |
47 | public function first_message()
48 | {
49 | return $this->hasOne(
50 | '\BishopB\Forum\ConversationMessage', 'MessageID', 'FirstMessageID'
51 | );
52 | }
53 |
54 | public function last_message()
55 | {
56 | return $this->hasOne(
57 | '\BishopB\Forum\ConversationMessage', 'MessageID', 'LastMessageID'
58 | );
59 | }
60 |
61 | public function regarding()
62 | {
63 | return $this->hasOne(
64 | '\BishopB\Forum\Regarding', 'RegardingID', 'RegardingID'
65 | );
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/settings/deletecategory.php:
--------------------------------------------------------------------------------
1 | Form->Open();
4 | echo $this->Form->Errors();
5 | if (is_object($this->OtherCategories)) {
6 | ?>
7 |
47 | Form->Close('Proceed');
50 | }
--------------------------------------------------------------------------------
/src/migrations/2014_09_23_194713_create_GDN_Activity_table.php:
--------------------------------------------------------------------------------
1 | integer('ActivityID', true);
18 | $table->integer('ActivityTypeID');
19 | $table->integer('NotifyUserID')->default(0);
20 | $table->integer('ActivityUserID')->nullable();
21 | $table->integer('RegardingUserID')->nullable();
22 | $table->string('Photo', 255)->nullable();
23 | $table->string('HeadlineFormat', 255)->nullable();
24 | $table->text('Story')->nullable();
25 | $table->string('Format', 10)->nullable();
26 | $table->string('Route', 255)->nullable();
27 | $table->string('RecordType', 20)->nullable();
28 | $table->integer('RecordID')->nullable();
29 | $table->integer('InsertUserID')->nullable()->index('FK_Activity_InsertUserID');
30 | $table->dateTime('DateInserted');
31 | $table->string('InsertIPAddress', 15)->nullable();
32 | $table->dateTime('DateUpdated')->nullable()->index('IX_Activity_DateUpdated');
33 | $table->boolean('Notified')->default(0);
34 | $table->boolean('Emailed')->default(0);
35 | $table->text('Data')->nullable();
36 | $table->index(['NotifyUserID','Notified'], 'IX_Activity_Notify');
37 | $table->index(['NotifyUserID','DateUpdated'], 'IX_Activity_Recent');
38 | $table->index(['NotifyUserID','ActivityUserID','DateUpdated'], 'IX_Activity_Feed');
39 | });
40 | }
41 |
42 |
43 | /**
44 | * Reverse the migrations.
45 | *
46 | * @return void
47 | */
48 | public function down()
49 | {
50 | Schema::drop('GDN_Activity');
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/models/Activity.php:
--------------------------------------------------------------------------------
1 | 'required|exists:GDN_ActivityType,ActivityTypeID',
10 | 'NotifyUserID' => 'exists:GDN_User,UserID',
11 | 'ActivityUserID' => 'exists:GDN_User,UserID',
12 | 'RegardingUserID' => 'exists:GDN_User,UserID',
13 | 'Photo' => 'max:255',
14 | 'HeadlineFormat' => 'max:255',
15 | // 'Story' => none,
16 | 'Format' => 'max:10',
17 | 'Route' => 'max:255',
18 | 'RecordType' => 'max:20',
19 | 'RecordID' => 'integer',
20 | 'Notified' => 'boolean',
21 | 'Emailed' => 'boolean',
22 | // 'Data' => none,
23 | ];
24 |
25 | // auditing
26 | use AuditingTrait;
27 | public function getAuditors()
28 | {
29 | return [
30 | 'InsertUserID', 'DateInserted', 'InsertIPAddress',
31 | 'DateUpdated',
32 | ];
33 | }
34 |
35 | // definitions
36 | protected $table = 'GDN_Activity';
37 | protected $primaryKey = 'ActivityID';
38 |
39 | public function getDates()
40 | {
41 | return [ 'DateInserted', 'DateUpdated', ];
42 | }
43 |
44 | // relations
45 | public function type()
46 | {
47 | return $this->hasOne(
48 | '\BishopB\Forum\ActivityType', 'ActivityTypeID', 'ActivityTypeID'
49 | );
50 | }
51 |
52 | public function comments()
53 | {
54 | return $this->hasMany(
55 | '\BishopB\Forum\ActivityComment', 'ActivityID', 'ActivityID'
56 | );
57 | }
58 |
59 | public function user()
60 | {
61 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'ActivityUserID');
62 | }
63 |
64 | public function user_to_notify()
65 | {
66 |
67 | }
68 |
69 | public function user_regarding()
70 | {
71 | return $this->hasOne('\BishopB\Forum\User', 'UserID', 'RegardingUserID');
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussion/embed.php:
--------------------------------------------------------------------------------
1 | Data('Discussion');
3 | $ForeignSource = $this->Data('ForeignSource');
4 | $SortComments = $this->Data('SortComments');
5 | $Comments = $this->Data('Comments', FALSE);
6 | $HasCommentData = $Comments !== FALSE;
7 | $Session = Gdn::Session();
8 | if (!function_exists('WriteComment'))
9 | include($this->FetchViewLocation('helper_functions', 'discussion'));
10 |
11 | ?>
12 |
13 | ';
15 | $this->FireEvent('CommentHeading');
16 | echo '';
17 |
18 | if ($SortComments == 'desc')
19 | WriteEmbedCommentForm();
20 | else if ($HasCommentData && $Comments->NumRows() > 0)
21 | echo Wrap(T('Comments'), 'h2');
22 | ?>
23 |
36 | Pager->LastPage()) {
39 | $LastCommentID = $this->AddDefinition('LastCommentID');
40 | if(!$LastCommentID || $this->Data['Discussion']->LastCommentID > $LastCommentID)
41 | $this->AddDefinition('LastCommentID', (int)$this->Data['Discussion']->LastCommentID);
42 | $this->AddDefinition('Vanilla_Comments_AutoRefresh', Gdn::Config('Vanilla.Comments.AutoRefresh', 0));
43 | }
44 |
45 | // Send the user to the discussion in the forum when paging
46 | if (C('Garden.Embed.PageToForum') && $this->Pager->HasMorePages()) {
47 | $DiscussionUrl = DiscussionUrl($Discussion).'#latest';
48 | echo '';
51 | } else
52 | echo $this->Pager->ToString('more');
53 | }
54 |
55 | if ($SortComments != 'desc')
56 | WriteEmbedCommentForm();
57 |
58 | ?>
59 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/categories/subtree.php:
--------------------------------------------------------------------------------
1 | Data('Category');
4 | if (!$Category)
5 | return;
6 |
7 | $SubCategories = CategoryModel::MakeTree(CategoryModel::Categories(), $Category);
8 |
9 | if (!$SubCategories)
10 | return;
11 |
12 | require_once $this->FetchViewLocation('helper_functions', 'categories', 'vanilla');
13 |
14 | ?>
15 |
--------------------------------------------------------------------------------
/src/views/themes/default/views/discussion/index.php:
--------------------------------------------------------------------------------
1 | FetchViewLocation('helper_functions', 'discussion');
5 |
6 | // Wrap the discussion related content in a div.
7 | echo '
'; // close discussion wrap
33 |
34 | $this->FireEvent('AfterDiscussion');
35 | } else {
36 | echo '
'.$this->Data('_CommentsHeader', T('Comments')).'
'; 51 | ?> 52 |53 | FetchViewLocation('comments'); ?> 54 |
55 | FireEvent('AfterComments'); 57 | if($this->Pager->LastPage()) { 58 | $LastCommentID = $this->AddDefinition('LastCommentID'); 59 | if(!$LastCommentID || $this->Data['Discussion']->LastCommentID > $LastCommentID) 60 | $this->AddDefinition('LastCommentID', (int)$this->Data['Discussion']->LastCommentID); 61 | $this->AddDefinition('Vanilla_Comments_AutoRefresh', Gdn::Config('Vanilla.Comments.AutoRefresh', 0)); 62 | } 63 | echo '