Closed (fixed)
Project:
Image
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Dec 2003 at 11:03 UTC
Updated:
17 Feb 2004 at 16:20 UTC
Jump to comment: Most recent file
Hi,
Attached is a small patch that selects only images with status=1.
Currently all nodes were shown, the module only checked for the moderate=0 but not for status=1.
Assigned it to myself, because i first want to know via this way, if there was a reason for not checking the status. If there was, what is tat reason?
btw: thwe patch is really ugly. Sorry for that.
Ber
Index: image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.74.2.5
diff -u -r1.74.2.5 image.module
--- image.module 7 Dec 2003 20:32:32 -0000 1.74.2.5
+++ image.module 11 Dec 2003 12:34:20 -0000
@@ -1,5 +1,5 @@
<?php
-// $Id: image.module,v 1.74.2.5 2003/12/07 20:32:32 bruno Exp $
+// $Id: image.module,v 1.74.2.3 2003/11/27 08:14:24 bruno Exp $
@@ -645,11 +645,11 @@
if (preg_match_all("/\[image:(\d+)(,(left|right|top|middle|bottom|absmiddle|texttop|baseline))?(,(\d+))?(,(\d+))?(,(\d+))?\]/i", $text, $match)) {
// then we make the html
foreach ($match[1] as $key => $value) {
- $map[$value] = $key;
+ $map[$value] = $key;
}
- $result = db_query("SELECT n.nid, n.teaser, i.thumb_path FROM {image} i, {node} n WHERE i.nid = n.nid AND n.nid IN ('".implode("','", array_map("check_query", $match[1]))."')");
+ $result = db_query("SELECT n.nid, n.teaser, i.thumb_path FROM {image} i, {node} n WHERE i.nid = n.nid AND n.status = 1 AND n.nid IN ('".implode("','", array_map("check_query", $match[1]))."')");
while ($img = db_fetch_object($result)) {
- $n = $map[$img->nid];
+ $n = $map[$img->nid];
$img->align = $match[3][$n];
$img->hspace = $match[5][$n];
$img->vspace = $match[7][$n];
@@ -1128,7 +1128,7 @@
if (user_access("access images") && variable_get("image_nav_vocabulary", "")) {
// view user personal gallery if personal gallery is enabled
if ($uid && _image_can_personal()) {
- $sql = "SELECT n.nid, n.title, n.body, i.thumb_path FROM {node} n, {image} i, {users} u WHERE n.nid = i.nid AND i.personal = 1 AND n.uid = u.uid AND u.uid = '%s' AND n.moderate = 0 ORDER BY ";
+ $sql = "SELECT n.nid, n.title, n.body, i.thumb_path FROM {node} n, {image} i, {users} u WHERE n.nid = i.nid AND i.personal = 1 AND n.uid = u.uid AND u.uid = '%s' AND n.moderate = 0 AND n.status = 1 ORDER BY ";
$sql .= _image_get_thumb_order();
$result = db_query($sql, $uid);
@@ -1160,7 +1163,7 @@
$subalbums = taxonomy_get_children($tid, variable_get("image_nav_vocabulary", ""));
$subalbums = _image_album_properties($subalbums);
- $sql = "SELECT n.nid, n.title, n.teaser, n.body, i.thumb_path FROM {node} n, {term_node} t, {image} i WHERE n.nid = t.nid AND n.nid = i.nid AND t.tid = '%s' AND i.personal = 0 AND n.moderate = 0";
+ $sql = "SELECT n.nid, n.title, n.teaser, n.body, i.thumb_path FROM {node} n, {term_node} t, {image} i WHERE n.nid = t.nid AND n.nid = i.nid AND t.tid = '%s' AND i.personal = 0 AND n.moderate = 0 AND n.status = 1";
$result = db_query($sql, $tid);
$data["total_images"] = db_num_rows($result);
@@ -1246,7 +1249,7 @@
foreach ($children as $term) {
$terms[] = $term->tid;
}
- $result = db_query("SELECT COUNT(*) AS c FROM {term_node} t, {node} n, {image} i WHERE t.nid = n.nid AND i.nid = n.nid AND t.tid IN (". implode(",", $terms) .") AND i.personal = 0 AND n.moderate = 0");
+ $result = db_query("SELECT COUNT(*) AS c FROM {term_node} t, {node} n, {image} i WHERE t.nid = n.nid AND i.nid = n.nid AND t.tid IN (". implode(",", $terms) .") AND i.personal = 0 AND n.moderate = 0 AND n.status = 1");
while ($term = db_fetch_object($result)) {
$albums[$term_id]->image_count = $term->c;
}
@@ -1256,7 +1259,7 @@
$albums[$term_id]->thumb = $last_update->thumb_path;
if (variable_get("image_gallery_thumb", "last") == "random") {
- $random = db_fetch_object(db_query_range("SELECT i.thumb_path FROM {node} n INNER JOIN {image} i ON n.nid = i.nid INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid IN (".implode(",", $terms).") AND n.type = 'image' AND i.personal = 0 AND n.moderate = 0 ORDER BY RAND()", 0, 1));
+ $random = db_fetch_object(db_query_range("SELECT i.thumb_path FROM {node} n INNER JOIN {image} i ON n.nid = i.nid INNER JOIN {term_node} t ON n.nid = t.nid WHERE t.tid IN (".implode(",", $terms).") AND n.type = 'image' AND i.personal = 0 AND n.moderate = 0 AND n.status = 1 ORDER BY RAND()", 0, 1));
$albums[$term_id]->thumb = $random->thumb_path;
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | image_status_check.patch | 4.13 KB | Bèr Kessels |
Comments
Comment #1
Bèr Kessels commentedhmm. it seems the post is trimmed. I already thought so after previewing. Anyway: i have the patch.
Comment #2
bruno commentedAny update on this, Bèr?
Comment #3
Bèr Kessels commentedSorry Bruno, i haven't been @ work for a while, and i did not have the patch at home. Holydays are over, so here it is.
Ber
Comment #4
bruno commentedApplied patch to CVS and 4.3 branch. Thanks Bèr.
Comment #5
(not verified) commented