katpatuka’s sources

thoughts and lost and founds

Archive for the ‘gallery2’ Category

OpenSource photo gallery system

change title of a photo page to include parent name

Posted by katpatuka on 5. August 2007

Small change in the template.tpl to make the title of a photo when clicked on “Album name – Photo name” instead of “Photo Name” as title:

{* If Gallery doesn't provide a header, we use the album/photo title (or filename) *}
{if empty($head.title)}
  {if $theme.pageType == 'photo' || $theme.pageType == 'album'}
    <title>{$theme.parent.title|markup:strip} - {$theme.item.title|markup:strip}</title>
  {else}
    <title>{$theme.item.title|markup:strip|default:$theme.item.pathComponent}</title>
  {/if}
{/if}

Posted in gallery2 | Leave a Comment »

delete spam from gallery2

Posted by katpatuka on 26. May 2007

Unless there’s no Akismet module for gallery2 one occasionally has to delete spam manually from the comment table of the gallery system (ref.: Gallery2: deleting comment spam) – if your table and field prefix is g2_ and g_ you can use the code below:

CREATE TEMPORARY TABLE tmptable
SELECT g_id
FROM `g2_Comment` gc
WHERE
g_subject like '%url%' or
g_subject like '%http%' or
g_subject like '%personals%' or
g_subject like '%poker%' or
g_subject like '%blackjack%' or
g_subject like '%gambling%' or
g_subject like '%viagra%' or
g_subject like '%phentermine%' or
g_subject like '%casino%' or
g_subject like '100%' or
g_subject like '%slots%' or
g_subject like '%Cialis%' or
g_subject like '%url%' or
g_comment like '%http%' or
g_comment like '%personals%' or
g_comment like '%poker%' or
g_comment like '%blackjack%' or
g_comment like '%gambling%' or
g_comment like '%viagra%' or
g_comment like '%phentermine%' or
g_comment like '%casino%' or
g_comment like '100%' or
g_comment like '%slots%' or
g_comment like '%Cialis%';
DELETE g2_Entity FROM g2_Entity
INNER JOIN tmptable ON g2_Entity.g_id = tmptable.g_id;
DELETE g2_ChildEntity FROM g2_ChildEntity
INNER JOIN tmptable ON g2_ChildEntity.g_id = tmptable.g_id;
DELETE g2_Comment FROM g2_Comment
INNER JOIN tmptable ON g2_Comment.g_id = tmptable.g_id;DROP TEMPORARY TABLE tmptable;

Posted in gallery2 | 1 Comment »