Skip to content

Commit 47da2e5

Browse files
committed
Try to fix #89
1 parent 544e626 commit 47da2e5

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

src/Report.php

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ public function displayReport(&$result, $Addressing, $values, $ping_status = [])
228228
$item_num = 1;
229229
$colnum = 0;
230230
$i++;
231-
$html_output .= $output::showNewLine($i % 2 === 1);
231+
if ($is_html_output) {
232+
$html_output .= $output::showNewLine($i % 2 === 1);
233+
}
232234
$ip = self::string2ip(substr($num, 2));
233235

234236
if (count($lines)) {
@@ -244,15 +246,17 @@ public function displayReport(&$result, $Addressing, $values, $ping_status = [])
244246
$name = $line["dname"];
245247
$namep = $line["pname"];
246248
// IP
247-
if ($Addressing->fields["reserved_ip"] && strstr(
248-
$line["pname"],
249-
"reserv"
250-
)) {
251-
$html_output .= $output::showNewLine("reserved");
252-
} else {
253-
$html_output .= $output::showNewLine(
254-
(count($lines) > 1 ? "double" : $row_num % 2)
255-
);
249+
if ($is_html_output) {
250+
if ($Addressing->fields["reserved_ip"] && strstr(
251+
$line["pname"],
252+
"reserv"
253+
)) {
254+
$html_output .= $output::showNewLine("reserved");
255+
} else {
256+
$html_output .= $output::showNewLine(
257+
(count($lines) > 1 ? "double" : $row_num % 2)
258+
);
259+
}
256260
}
257261
$rand = mt_rand();
258262
$params = [
@@ -484,7 +488,9 @@ public function displayReport(&$result, $Addressing, $values, $ping_status = [])
484488
} else {
485489
$reserv = "";
486490
$content = __('Success', 'addressing');
487-
$html_output .= $output::showItem($content, $item_num, $row_num);
491+
if ($is_html_output) {
492+
$html_output .= $output::showItem($content, $item_num, $row_num);
493+
}
488494
if ($Addressing->fields["reserved_ip"] && strstr(
489495
$line["pname"],
490496
"reserv"
@@ -645,7 +651,9 @@ function updateFA$rand() {
645651
// rows="5" cols="33"></textarea></td>';
646652
// End
647653
$rows[$row_num] = $current_row;
648-
$html_output .= $output::showEndLine(false);
654+
if ($is_html_output) {
655+
$html_output .= $output::showEndLine(false);
656+
}
649657
}
650658
}
651659
} elseif ($Addressing->fields["free_ip"]) {
@@ -664,7 +672,9 @@ function updateFA$rand() {
664672
];
665673

666674
if (!$ping) {
667-
$html_output .= $output::showNewLine("free");
675+
if ($is_html_output) {
676+
$html_output .= $output::showNewLine("free");
677+
}
668678
$rand = mt_rand();
669679
$params = [
670680
'ip' => trim($ip),
@@ -677,7 +687,9 @@ function updateFA$rand() {
677687
"IP ping",
678688
'addressing'
679689
) . "'></i></a>";
680-
$html_output .= $output::showItem("$ping_link ", $item_num, $row_num, "class='center'");
690+
if ($is_html_output) {
691+
$html_output .= $output::showItem("$ping_link ", $item_num, $row_num, "class='center'");
692+
}
681693
if (isset($params) && count($params) > 0 && $is_html_output) {
682694
echo Ajax::createIframeModalWindow(
683695
'ping' . $rand,
@@ -816,7 +828,9 @@ function updateFA$rand() {
816828
$current_row[$itemtype . '_' . (++$colnum)] = ['displayname' => ""];
817829
}
818830
$rows[$row_num] = $current_row;
819-
$html_output .= $output::showEndLine(false);
831+
if ($is_html_output) {
832+
$html_output .= $output::showEndLine(false);
833+
}
820834
} else {
821835
$ping_action = NOT_AVAILABLE;
822836
$plugin_addressing_pinginfo = new PingInfo();
@@ -850,7 +864,9 @@ function updateFA$rand() {
850864
if ($ping_value) {
851865
if ($see_ping_on == 1) {
852866
$ping_response++;
853-
$html_output .= $output::showNewLine("ping_off");
867+
if ($is_html_output) {
868+
$html_output .= $output::showNewLine("ping_off");
869+
}
854870
$rand = mt_rand();
855871
$params = [
856872
'ip' => trim($ip),
@@ -1017,11 +1033,15 @@ function updateFA$rand() {
10171033
} else {
10181034
$current_row[$itemtype . '_' . (++$colnum)] = ['displayname' => " "];
10191035
}
1020-
$html_output .= $output::showEndLine(false);
1036+
if ($is_html_output) {
1037+
$html_output .= $output::showEndLine(false);
1038+
}
10211039
}
10221040
} else {
10231041
if ($see_ping_off == 1) {
1024-
$html_output .= $output::showNewLine("ping_on");
1042+
if ($is_html_output) {
1043+
$html_output .= $output::showNewLine("ping_on");
1044+
}
10251045
$rand = mt_rand();
10261046
$params = [
10271047
'id_addressing' => $Addressing->getID(),
@@ -1202,8 +1222,9 @@ function updateFA$rand() {
12021222
};
12031223
</script>";
12041224
}
1205-
1206-
$html_output .= $output::showEndLine(false);
1225+
if ($is_html_output) {
1226+
$html_output .= $output::showEndLine(false);
1227+
}
12071228
}
12081229
}
12091230
}

0 commit comments

Comments
 (0)