--- img_assist.old/img_assist.module 2005-01-27 23:00:14.000000000 +0200 +++ img_assist/img_assist.module 2005-03-29 00:43:08.833006000 +0200 @@ -26,13 +26,13 @@ $and_clause = 'AND '; $images = img_assist_map_load($nid); foreach ($images as $id) { - $and_clause .= "nid = $id OR "; + $and_clause .= "n.nid = $id OR "; } $and_clause = substr($and_clause, 0, -3); if ($images) { $block['subject'] = t('This image appears in...'); - $block['content'] = node_title_list(db_query_range("SELECT title, nid FROM {node} WHERE status = 1 $and_clause ORDER BY nid DESC", 0, 10)); + $block['content'] = node_title_list(db_query_range("SELECT title, n.nid FROM {node} n ".node_access_join_sql()." WHERE ".node_access_where_sql()." AND status = 1 $and_clause ORDER BY n.nid DESC", 0, 10)); } } break; @@ -341,11 +341,11 @@ if (!$image) { if (variable_get('img_assist_loader', 1)) { //File API - $result = db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n WHERE f.nid = n.nid AND f.filemime LIKE "image/%" ORDER BY n.title'); + $result = db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n '.node_access_join_sql(). ' WHERE '.node_access_where_sql().' AND f.nid = n.nid AND f.filemime LIKE "image/%" ORDER BY n.title'); $id = 'fid'; } else { //Image.module - $result = db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n WHERE i.nid = n.nid ORDER BY n.title'); + $result = db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n '.node_access_join_sql().' WHERE '.node_access_where_sql().' AND i.nid = n.nid ORDER BY n.title'); $id = 'nid'; } @@ -377,11 +377,11 @@ if (!$image) { if (variable_get('img_assist_loader', 1)) { //File API - $result = db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n WHERE n.uid = %d AND f.nid = n.nid AND f.filemime LIKE "image/%%" ORDER BY n.title', $uid); + $result = db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n '.node_access_join_sql().' WHERE '.node_access_where_sql().' AND n.uid = %d AND f.nid = n.nid AND f.filemime LIKE "image/%%" ORDER BY n.title', $uid); $id = 'fid'; } else { //Image.module - $result = db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n WHERE n.uid = %d AND i.nid = n.nid ORDER BY n.title', $uid); + $result = db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n '.node_access_join_sql().' WHERE '.node_access_where_sql().' AND n.uid = %d AND i.nid = n.nid ORDER BY n.title', $uid); $id = 'nid'; } @@ -400,7 +400,7 @@ function img_assist_load_image($id) { if (variable_get('img_assist_loader', 1)) { //File API - $image = db_fetch_object(db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n WHERE f.nid = n.nid AND f.fid = %d', $id)); + $image = db_fetch_object(db_query('SELECT n.title, n.body, n.nid, f.fid, f.filepath as image_path, f.filepath as thumb_path FROM {files} AS f, {node} AS n '. node_access_join_sql(). ' WHERE '.node_access_where_sql().' AND f.nid = n.nid AND f.fid = %d', $id)); $dim = getimagesize($image->image_path, $info); $image->width = $dim[0]; $image->height = $dim[1]; @@ -408,7 +408,7 @@ return $image; } else { - $image = db_fetch_object(db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n WHERE i.nid = n.nid AND n.nid = %d', $id)); + $image = db_fetch_object(db_query('SELECT n.title, n.body, n.nid, i.thumb_path, i.image_path, i.width, i.height FROM {image} AS i, {node} AS n '.node_access_join_sql(). ' WHERE '.node_access_where_sql().' AND i.nid = n.nid AND n.nid = %d', $id)); $image->id = $image->nid; return $image; }