Skip to content

Commit 72e7cfe

Browse files
committed
Some fixes
1 parent 6b8c6bf commit 72e7cfe

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

CHANGELOG

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Version 2.8.0-alpha3 - 2012-
2020
- added configurable maintenance mode (Thorsten)
2121
- dropped support for IBM DB2, Interbase/Firebird and Sybase (Thorsten)
2222
- improved usability of administration backend (Thorsten)
23-
- improved setup and update (Thorsten)
23+
- improved setup and update (Thorsten, Florian)
2424
- improved security with salted passwords (Thorsten)
2525
- improved CSS development with LESS (Thorsten)
2626
- simplified the link verification (Thorsten)

phpmyfaq/inc/Comment.php

+39-39
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ class PMF_Comment
6969
*/
7070
public function __construct(PMF_Configuration $config)
7171
{
72-
global $pmfStr;
72+
global $pmfStr;
7373

74-
$this->config = $config;
75-
$this->pmfStr = $pmfStr;
74+
$this->config = $config;
75+
$this->pmfStr = $pmfStr;
7676
}
7777

7878
//
@@ -99,8 +99,8 @@ public function getCommentDataById($id)
9999
PMF_Db::getTablePrefix(),
100100
$id);
101101

102-
$result = $this->config->getDb()->query($query);
103-
if (($this->config->getDb()->numRows($result) > 0) && ($row = $this->config->getDb()->fetchObject($result))) {
102+
$result = $this->config->getDb()->query($query);
103+
if (($this->config->getDb()->numRows($result) > 0) && ($row = $this->config->getDb()->fetchObject($result))) {
104104
$item = array(
105105
'id' => $row->id_comment,
106106
'recordId' => $row->id,
@@ -140,9 +140,9 @@ public function getCommentsData($id, $type)
140140
$type,
141141
$id);
142142

143-
$result = $this->config->getDb()->query($query);
144-
if ($this->config->getDb()->numRows($result) > 0) {
145-
while ($row = $this->config->getDb()->fetchObject($result)) {
143+
$result = $this->config->getDb()->query($query);
144+
if ($this->config->getDb()->numRows($result) > 0) {
145+
while ($row = $this->config->getDb()->fetchObject($result)) {
146146
$comments[] = array(
147147
'id' => $row->id_comment,
148148
'content' => $row->comment,
@@ -169,20 +169,20 @@ public function getCommentsData($id, $type)
169169
public function getComments($id, $type)
170170
{
171171
$comments = $this->getCommentsData($id, $type);
172-
$date = new PMF_Date($this->config);
173-
$mail = new PMF_Mail($this->config);
172+
$date = new PMF_Date($this->config);
173+
$mail = new PMF_Mail($this->config);
174174

175175
$output = '';
176176
foreach ($comments as $item) {
177177
$output .= '<p class="comment">';
178178
$output .= '<img src="assets/img/bubbles.gif" />';
179-
$output .= sprintf(
180-
'<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br />%s</p>',
181-
$this->pmfStr['msgCommentBy'],
179+
$output .= sprintf(
180+
'<strong>%s<a href="mailto:%s">%s</a>:</strong><br />%s<br />%s</p>',
181+
$this->pmfStr['msgCommentBy'],
182182
$mail->safeEmail($item['email']),
183183
$item['user'],
184-
$this->showShortComment($id, $item['content']),
185-
$this->pmfStr['newsCommentDate'] .
184+
$this->showShortComment($id, $item['content']),
185+
$this->pmfStr['newsCommentDate'] .
186186
$date->format(
187187
PMF_Date::createIsoDate($item['date'], 'Y-m-d H:i', false)
188188
)
@@ -206,7 +206,7 @@ function addComment(Array $commentData)
206206
VALUES
207207
(%d, %d, '%s', '%s', '%s', '%s', %d, '%s')",
208208
PMF_Db::getTablePrefix(),
209-
$this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faqcomments', 'id_comment'),
209+
$this->config->getDb()->nextId(PMF_Db::getTablePrefix().'faqcomments', 'id_comment'),
210210
$commentData['record_id'],
211211
$commentData['type'],
212212
$commentData['username'],
@@ -216,7 +216,7 @@ function addComment(Array $commentData)
216216
$commentData['helped']
217217
);
218218

219-
if (!$this->config->getDb()->query($query)) {
219+
if (!$this->config->getDb()->query($query)) {
220220
return false;
221221
}
222222

@@ -248,7 +248,7 @@ public function deleteComment($recordId, $commentId)
248248
$commentId
249249
);
250250

251-
if (!$this->config->getDb()->query($query)) {
251+
if (!$this->config->getDb()->query($query)) {
252252
return false;
253253
}
254254

@@ -279,9 +279,9 @@ public function getNumberOfComments($type = self::COMMENT_TYPE_FAQ)
279279
$type
280280
);
281281

282-
$result = $this->config->getDb()->query($query);
283-
if ($this->config->getDb()->numRows($result) > 0) {
284-
while ($row = $this->config->getDb()->fetchObject($result)) {
282+
$result = $this->config->getDb()->query($query);
283+
if ($this->config->getDb()->numRows($result) > 0) {
284+
while ($row = $this->config->getDb()->fetchObject($result)) {
285285
$num[$row->id] = $row->anz;
286286
}
287287
}
@@ -322,9 +322,9 @@ public function getAllComments($type = self::COMMENT_TYPE_FAQ)
322322
$type
323323
);
324324

325-
$result = $this->config->getDb()->query($query);
326-
if ($this->config->getDb()->numRows($result) > 0) {
327-
while ($row = $this->config->getDb()->fetchObject($result)) {
325+
$result = $this->config->getDb()->query($query);
326+
if ($this->config->getDb()->numRows($result) > 0) {
327+
while ($row = $this->config->getDb()->fetchObject($result)) {
328328
$comments[] = array(
329329
'comment_id' => $row->comment_id,
330330
'record_id' => $row->record_id,
@@ -350,20 +350,20 @@ public function getAllComments($type = self::COMMENT_TYPE_FAQ)
350350
*/
351351
public function showShortComment($id, $comment)
352352
{
353-
$words = explode(' ', nl2br($comment));
354-
$numWords = 0;
355-
356-
$comment = '';
357-
foreach ($words as $word) {
358-
$comment .= $word . ' ';
359-
if (15 === $numWords) {
360-
$comment .= '<span class="comment-dots-' . $id . '">... </span>' .
361-
'<a onclick="showLongComment(' . $id . ')" class="comment-show-more-' . $id . '">show more</a>' .
362-
'<span class="comment-more-' . $id . ' hide">';
363-
}
364-
$numWords++;
365-
}
366-
367-
return $comment . '</span>';
353+
$words = explode(' ', nl2br($comment));
354+
$numWords = 0;
355+
356+
$comment = '';
357+
foreach ($words as $word) {
358+
$comment .= $word . ' ';
359+
if (15 === $numWords) {
360+
$comment .= '<span class="comment-dots-' . $id . '">... </span>' .
361+
'<a onclick="showLongComment(' . $id . ')" class="comment-show-more-' . $id . '">show more</a>' .
362+
'<span class="comment-more-' . $id . ' hide">';
363+
}
364+
$numWords++;
365+
}
366+
367+
return $comment . '</span>';
368368
}
369369
}

0 commit comments

Comments
 (0)