1
1
<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
2
2
namespace BNETDocs \Templates \Comment ;
3
+ use \BNETDocs \Libraries \Authentication ;
3
4
use \BNETDocs \Libraries \Comment ;
4
5
use \BNETDocs \Libraries \User ;
5
6
use \CarlBennett \MVC \Libraries \Common ;
6
- $ c_edit_visible_admin = ($ logged_in && ($ logged_in ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_MODIFY ));
7
- $ c_delete_visible_admin = ($ logged_in && ($ logged_in ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_DELETE ));
7
+ $ active_user = $ this ->getContext ()->active_user ?? Authentication::$ user ;
8
+ $ active_user_id = ($ active_user ? $ active_user ->getId () : null );
9
+ $ c_edit_visible_admin = ($ active_user && ($ active_user ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_MODIFY ));
10
+ $ c_delete_visible_admin = ($ active_user && ($ active_user ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_DELETE ));
8
11
?>
9
12
<div class="row mt-3">
10
13
<div class="col">
@@ -25,8 +28,8 @@ $c_delete_visible_admin = ($logged_in && ($logged_in->getOptionsBitmask() & User
25
28
26
29
$ c_user_string = ($ c_user ? sprintf ('<a href="%s"><img src="%s"/> %s</a> ' , $ c_user_url , $ c_user_avatar , $ c_user_name ) : $ c_user_name );
27
30
28
- $ c_edit_visible = ($ c_user_id == $ logged_in_id || $ c_edit_visible_admin );
29
- $ c_delete_visible = ($ c_user_id == $ logged_in_id || $ c_delete_visible_admin ); ?>
31
+ $ c_edit_visible = ($ c_user_id == $ active_user_id || $ c_edit_visible_admin );
32
+ $ c_delete_visible = ($ c_user_id == $ active_user_id || $ c_delete_visible_admin ); ?>
30
33
<tr><td>
31
34
<?= $ c_user_string?> <br/>
32
35
<time datetime="<?= $ c_created_dt ->format ('c ' )?> "><?= $ c_created_dt ->format ('D M j, Y g:ia T ' )?> </time>
@@ -43,13 +46,13 @@ $c_delete_visible_admin = ($logged_in && ($logged_in->getOptionsBitmask() & User
43
46
<? } ?>
44
47
</div>
45
48
</div>
46
- <? if ($ logged_in ) { ?>
49
+ <? if ($ active_user ) { ?>
47
50
<div class="row mt-3">
48
51
<div class="col-2"></div>
49
52
<div class="col-8">
50
53
<form method="POST" action="<?= Common::relativeUrlToAbsolute ('/comment/create ' )?> ">
51
54
<input type="hidden" name="parent_type" value="<?= $ comment_parent_type?> "/>
52
- <input type="hidden" name="parent_id" value="<?= $ object_id ?> "/>
55
+ <input type="hidden" name="parent_id" value="<?= $ comment_parent_id ?> "/>
53
56
<div class="form-group">
54
57
<label for="comment-content" class="font-weight-bold">Make a Comment:</label>
55
58
<textarea id="comment-content" class="border border-secondary form-control bg-dark text-light" name="content"></textarea>
0 commit comments