SELECT *
FROM jos_session
WHERE session_id = '79319eeee32e5aa78857a290f679b64c'
DELETE
FROM jos_session
WHERE ( TIME < '1725900845' )
SELECT *
FROM jos_session
WHERE session_id = '79319eeee32e5aa78857a290f679b64c'
INSERT INTO `jos_session` ( `session_id`,`time`,`username`,`gid`,`guest`,`client_id` )
VALUES ( '79319eeee32e5aa78857a290f679b64c','1725904445','','0','1','0' )
SELECT *
FROM jos_components
WHERE parent = 0
SELECT folder AS TYPE, element AS name, params
FROM jos_plugins
WHERE published >= 1
AND access <= 0
ORDER BY ordering
SELECT m.*, c.`option` AS component
FROM jos_menu AS m
LEFT JOIN jos_components AS c
ON m.componentid = c.id
WHERE m.published = 1
ORDER BY m.sublevel, m.parent, m.ordering
SELECT *
FROM jos_joomgallery_config
WHERE id = 0
SELECT
uid,
uuserid,
zipname
FROM
jos_joomgallery_users
WHERE
zipname != ''
AND TIME != ''
AND TIME < NOW()-INTERVAL 60 SECOND
SELECT id, title, module, POSITION, content, showtitle, control, params
FROM jos_modules AS m
LEFT JOIN jos_modules_menu AS mm
ON mm.moduleid = m.id
WHERE m.published = 1
AND m.access <= 0
AND m.client_id = 0
AND ( mm.menuid = 16 OR mm.menuid = 0 )
ORDER BY POSITION, ordering
SELECT
COUNT(cid)
FROM
jos_joomgallery_catg
WHERE
cid = '280'
AND access <= '0'
AND published = '1'
SELECT
COUNT(cid)
FROM
jos_joomgallery_catg AS d
WHERE
d.parent = 280
AND d.published = '1'
AND d.access <= '0'
SELECT
d.*
FROM
jos_joomgallery_catg AS d
WHERE
d.parent = 280
AND d.published = '1'
AND d.access<= '0'
ORDER BY d.ordering
LIMIT 0,12
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (401)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (401)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (402,404,403,405,407)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (402,404,403,405,407)
AND access <= 0
AND published = '1'
SELECT ca.cid,ca.parent,IFNULL(COUNT(p.id),0) AS piccount
FROM jos_joomgallery_catg AS ca
LEFT JOIN jos_joomgallery AS p
ON p.catid = ca.cid
WHERE ca.published = '1'
AND ca.access <= '0'
AND (isnull(p.published) OR p.published=1)
AND (isnull(p.approved) OR p.approved=1)
/* unpublished approved picture for category, only working with own coice */
OR ((isnull(p.published) OR p.published=0)
AND (isnull(p.approved) OR p.approved=1))
GROUP BY ca.cid
ORDER BY CAST(parent AS UNSIGNED)
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '404'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 404
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=401
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=402
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=404
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=403
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=405
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=407
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=408
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (401,402,404,403,405,407,408)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (397)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (397)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (399)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (399)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '399'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 399
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=397
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=399
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (397,399)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (391)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (391)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (389,394,392,395,396)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (389,394,392,395,396)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '395'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 395
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=391
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=389
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=394
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=392
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=395
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=396
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (391,389,394,392,395,396)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (368)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (368)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (369,371,381,385,387)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (369,371,381,385,387)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '371'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 371
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=368
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=369
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=371
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=381
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=385
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=387
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (368,369,371,381,385,387)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (352)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (352)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (355,353,366,364)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (355,353,366,364)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '366'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 366
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=352
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=355
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=353
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=366
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=364
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (352,355,353,366,364)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (334)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (334)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (337,350,339)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (337,350,339)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '339'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 339
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=334
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=337
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=350
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=339
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (334,337,350,339)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (322)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (322)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (324,328,325,332)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (324,328,325,332)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '332'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 332
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=322
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=324
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=328
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=325
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=329
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=332
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (322,324,328,325,329,332)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (313)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (313)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (320,318,316)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (320,318,316)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '318'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 318
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=313
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=320
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=318
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=316
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=321
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (313,320,318,316,321)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (295)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (295)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (296,306)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (296,306)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '296'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 296
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=295
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=296
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=306
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (295,296,306)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (291)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (291)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (292,293)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (292,293)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '292'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 292
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=291
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=292
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=293
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (291,292,293)
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (281)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (281)
AND access <= 0
AND published = '1'
SELECT MAX(imgdate)
FROM jos_joomgallery AS a
LEFT JOIN jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE a.catid IN (282,283)
AND a.published = '1'
AND a.approved='1'
AND c.access <= 0
AND c.published = '1'
SELECT cid
FROM jos_joomgallery_catg
WHERE parent IN (282,283)
AND access <= 0
AND published = '1'
SELECT catpath
FROM jos_joomgallery_catg
WHERE cid= '282'
SELECT
*,
c.access
FROM
jos_joomgallery AS p
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = p.catid
WHERE
p.catid = 282
AND p.published = '1'
AND p.approved = '1'
AND c.access <= 0
AND c.published = '1'
ORDER BY
rand()
LIMIT 1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=281
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=282
AND published=1
SELECT cid
FROM jos_joomgallery_catg
WHERE parent=283
AND published=1
SELECT COUNT(id) AS COUNT
FROM jos_joomgallery
WHERE published = 1
AND approved = 1
AND catid IN (281,282,283)
SELECT
COUNT(id)
FROM
jos_joomgallery AS a
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE
a.published = '1'
AND a.catid = '280'
AND a.approved = '1'
AND c.access <= '0'
SELECT
name,
cid
FROM
jos_joomgallery_catg
WHERE
cid = '280'
SELECT
COUNT(*)
FROM
jos_joomgallery AS a
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE
a.published = '1'
AND a.catid = '280'
AND a.approved = '1'
AND c.access <= '0'
SELECT
*,
a.owner AS owner,
ROUND(imgvotesum/imgvotes, 2) AS rating
FROM
jos_joomgallery AS a
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid=a.catid
WHERE
a.published = '1'
AND a.catid = '280'
AND a.approved = '1'
AND c.access <= '0'
ORDER BY
a.imgtitle ASC, a.ordering ASC, a.imgdate ASC
LIMIT
0,24
SELECT
COUNT(id),
SUM(imgcounter)
FROM
jos_joomgallery AS a
LEFT JOIN
jos_joomgallery_catg AS c
ON c.cid = a.catid
WHERE
a.published = '1'
AND a.approved = '1'
AND c.published = '1'
AND c.access <= 0
SELECT
name,
parent,
cid
FROM
jos_joomgallery_catg
WHERE
cid = '280'
AND published = '1'
AND access <= '0'
SELECT
name,
parent,
cid
FROM
jos_joomgallery_catg
WHERE
cid = '445'
AND published = '1'
AND access <= '0'
SELECT template
FROM jos_templates_menu
WHERE client_id = 0
AND (menuid = 0 OR menuid = 16)
ORDER BY menuid DESC
LIMIT 0, 1
SELECT p.id AS picid, p.catid, p.imgthumbname, p.imgfilename, p.imgdate
, p.imgtitle, p.imgtext,p.imgauthor,p.owner, p.imgcounter, p.imgvotes
, (p.imgvotesum/p.imgvotes) AS vote, c.name AS cattitle,c.catpath AS catpath
FROM jos_joomgallery AS p
JOIN jos_joomgallery_catg AS c
ON c.cid=p.catid
WHERE c.published='1'
AND c.access<=0
AND p.published='1'
AND p.approved='1'
AND p.catid NOT IN (643)
ORDER BY rand()
LIMIT 1
SELECT id
FROM jos_menu
WHERE link LIKE '%com_joomgallery%'
AND (access = '0' OR access = '1')
AND TYPE = 'component'
ORDER BY access, id DESC
LIMIT 1