Issues (994)

etc/server/comments/admin.php (2 issues)

Labels
Severity
1
<?php
2
3
include 'class.php';
4
5
$db_details = [
6
    'db_host' => 'localhost',
7
    'db_user' => 'root',
8
    'db_pass' => '',
9
    'db_name' => 'test',
10
];
11
12
$settings = ['isAdmin' => true, 'public' => false]; // that is all you need to specify to be in admin mode :D
13
14
$page_id = 1;
15
16
$comments = new Comments_System($db_details, $settings);
17
18
$comments->grabComment($page_id);
19
20
if ($comments->success) {
21
    echo "<div class='alert alert-success' id='comm_status'>" . $comments->success . '</div>';
0 ignored issues
show
Are you sure $comments->success of type true can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
    echo "<div class='alert alert-success' id='comm_status'>" . /** @scrutinizer ignore-type */ $comments->success . '</div>';
Loading history...
22
} elseif ($comments->error) {
23
    echo "<div class='alert alert-error' id='comm_status'>" . $comments->error . '</div>';
0 ignored issues
show
Are you sure $comments->error of type true can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
    echo "<div class='alert alert-error' id='comm_status'>" . /** @scrutinizer ignore-type */ $comments->error . '</div>';
Loading history...
24
}
25
26
// a simple form
27
echo $comments->generateForm();
28
29
// we show the posted comments
30
echo $comments->generateComments($page_id); // we pass the page id
31