Файл: EasyHost v2.0/system/htdocs/admin/packages/package/search_init.pl
Строк: 49
<?php
my $sort = (length $system->param('sort') > 0) ? $system->param('sort') : 'name';
my $order = ($system->param('order') eq 'desc') ? 'DESC' : 'ASC';
my $interval = ($system->param('interval') > 0) ? $system->param('interval') : 1;
my %types =
(
'new' => 'date_created > NOW() - INTERVAL '.$interval.' DAY',
'active' => 'date_online > NOW() - INTERVAL '.$interval.' DAY',
'disabled' => 'status = 0'
);
my $search = $package->users($types{$system->param('type')},$sort.' '.$order);
my $email = EasyHost::Email->new($system->param('email'));
my $page = ($system->param('page') > 0) ? $system->param('page') : 1;
my $amount = ($system->param('amount') > 0) ? $system->param('amount') : 10;
my $start = $page * $amount - $amount + 1;
my $finish = ($page * $amount > $search->count) ? $search->count : $page * $amount;
if ($system->param('temp') == 1)
{
my $delete = $system->db->prepare('DELETE FROM config WHERE name = ?');
my $insert = $system->db->prepare('REPLACE INTO config VALUES (?,'on')');
foreach my $name ('d_email','d_status','d_category','d_package','d_date_created','d_date_online')
{
if ($system->param($name) ne $system->service->config($name))
{
if ($system->param($name) eq 'on')
{
$insert->execute($name);
$system->service->{'config'}{$name} = 'on' if ($system->service->{'config'});
}
else
{
$delete->execute($name);
delete $system->service->{'config'}{$name} if ($system->service->{'config'});
}
}
}
$delete->finish;
$insert->finish;
}
?>