<% use Mojo::JSON qw/encode_json decode_json/; %> <% use Mojo::IOLoop; %> <% my $ghome = {}; my $appts; if ($view eq 'home') { <% if ($settings->{'search'}) { $appts = &subs::db_query('select * from appointments where (app like ? or file like ?) and file is not null and (type=? or type=?) order by timestamp desc', '%' . $settings->{'search'} . '%', '%' . $settings->{'search'} . '%','image','video')->hashes; $view = 'album'; my @temp_apps; @temp_apps = map { $_->{'app'} } @{$appts}; foreach my $ta ( @temp_apps ) { unless ( grep { $_ eq $ta } @{$apps} ) { push @{$apps}, $ta; } } } else { $appts = &subs::db_query('select * from appointments where file is not null and (type=? or type=?) order by timestamp desc','image','video')->hashes; } } %>