You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cms/modules/article.lib.php
+47-43Lines changed: 47 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -42,12 +42,14 @@ public static function getUploadableFileProperties(&$fileTypesArray,&$maxFileSiz
42
42
}
43
43
44
44
functionisCommentsEnabled() {
45
-
$result = mysql_fetch_array(mysql_query("SELECT `allowComments` FROM `article_content` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'"));
46
-
return$result['allowComments'];
45
+
global$pdb;
46
+
$result = $pdb->query("SELECT `allowComments` FROM `article_content` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'");
47
+
return$result[0]['allowComments'];
47
48
}
48
49
49
50
functionsetCommentEnable($val) {
50
-
mysql_query("UPDATE `article_content` SET `allowComments` ='$val' WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'");
51
+
global$pdb;
52
+
$result = $pdb->query("UPDATE `article_content` SET `allowComments` ='$val' WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'");
$id = mysql_fetch_array(mysql_query("SELECT MAX(`comment_id`) AS MAX FROM `article_comments`"));
117
-
$id = $id['MAX'] + 1;
119
+
$id = $pdb->query("SELECT MAX(`comment_id`) AS MAX FROM `article_comments`");
120
+
$id = $id[0]['MAX'] + 1;
118
121
$user = getUserName($this->userId);
119
122
$comment = escape(safe_html($_POST['comment']));
120
-
mysql_query("INSERT INTO `article_comments`(`comment_id`,`page_modulecomponentid`,`user`,`comment`) VALUES('$id','{$this->moduleComponentId}','$user','$comment')");
121
-
if(mysql_affected_rows())
123
+
$result = $pdb->query("INSERT INTO `article_comments`(`comment_id`,`page_modulecomponentid`,`user`,`comment`) VALUES('$id','{$this->moduleComponentId}','$user','$comment')");
124
+
if($result)
122
125
displayinfo("Post successful");
123
126
else
124
127
displayerror("Error in posting comment");
125
128
}
126
129
if($text==""){
127
130
$query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid='" . $this->moduleComponentId."'";
128
-
$result = mysql_query($query);
129
-
if($row = mysql_fetch_assoc($result)) {
131
+
$result = $pdb->query($query);
132
+
if($row = $result[0]) {
130
133
$text = $row['article_content'];
131
134
$text = censor_words($text);
132
135
global$PAGELASTUPDATED;
@@ -148,12 +151,12 @@ public function actionView($text="") {
148
151
149
152
150
153
if($this->isCommentsEnabled()) {
151
-
$comments = mysql_query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
152
-
if(mysql_num_rows($comments)>0)
154
+
$comments = $pdb->query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
$comments = mysql_query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
269
-
if(mysql_num_rows($comments)==0)
271
+
$comments = $pdb->query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
@@ -366,13 +369,14 @@ public function patch($article,$patch) {
366
369
return$patch;
367
370
}
368
371
publicfunctiongetRevision($revisionNo) {
372
+
global$pdb;
369
373
$currentquery = "SELECT article_content FROM article_content WHERE page_modulecomponentid='" . $this->moduleComponentId."'";
370
-
$currentresult = mysql_query($currentquery);
371
-
$currentrow = mysql_fetch_assoc($currentresult);
374
+
$currentresult = $pdb->query($currentquery);
375
+
$currentrow = $currentresult[0];
372
376
$revision = $currentrow['article_content'];
373
377
$diffquery = "SELECT * FROM `article_contentbak` WHERE `page_modulecomponentid`='$this->moduleComponentId' AND article_revision >= '$revisionNo' ORDER BY article_revision DESC";
0 commit comments