Example #1
0
}
$limit = appconf('limit');
$q = db_query('SELECT * FROM digger_linkstory
	WHERE status = "enabled" ' . $cat . '
	ORDER BY posted_on desc, score desc');
if ($q->execute()) {
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, $limit);
    $q->free();
} else {
    die($q->error());
}
// has voted?
foreach (array_keys($res) as $k) {
    if (digger_has_voted($res[$k]->id)) {
        $res[$k]->voted = 'style="display: none"';
    }
}
// pager
loader_import('saf.GUI.Pager');
$pg = new Pager($cgi->offset, $limit, $total);
$pg->setUrl(site_prefix() . '/index/digger-app?category=' . $cgi->category);
$pg->getInfo();
// output
if (!empty($cgi->category)) {
    page_title(appconf('digger_title') . ' - ' . db_shift('select category from digger_category where id = ?', $cgi->category));
} else {
    page_title(appconf('digger_title'));
}
template_simple_register('pager', $pg);
echo template_simple('index.spt', array('category' => $cgi->category, 'results' => $res, 'banned_score' => appconf('ban_threshold')));
Example #2
0
        $results[$key]['url'] .= '?highlight=' . $enc;
    }
}
loader_import('saf.GUI.Pager');
$pg = new Pager($cgi->offset, appconf('limit'));
if ($parameters['multiple'] == 'yes') {
    $t = '';
    if (is_array($parameters['ctype'])) {
        foreach ($parameters['ctype'] as $ct) {
            $t .= '&ctype[]=' . urlencode($ct);
        }
    }
    $d = '';
    if (is_array($parameters['domains'])) {
        foreach ($parameters['domains'] as $ds) {
            $d .= '&domains[]=' . $ds;
        }
    }
} else {
    $t = '&ctype=' . urlencode($parameters['ctype']);
    $d = '&domains=' . urlencode($parameters['domains']);
}
$pg->setUrl(site_current() . '?query=%s' . $t . $d . '&show_types=%s&multiple=%s&show_domains=%s', $enc, $parameters['show_types'], $parameters['multiple'], $parameters['show_domains']);
$pg->total = $total;
$pg->setData($results);
$pg->update();
page_id('search');
page_title('SiteSearch - Results For "' . $cgi->query . '"');
template_simple_register('cgi', $cgi);
template_simple_register('pager', $pg);
echo template_simple('stats_search.spt', array('show_types' => $show_types, 'show_domains' => $show_domains, 'types' => $types, 'domains' => $domains, 'multiple' => $multiple, 'syntax' => $res['metadata']['syntax']));
Example #3
0
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
} else {
    $q = db_query('select * from siteblog_post where category = ? order by created desc');
    if (!$q->execute($parameters['id'])) {
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
}
$res =& siteblog_translate($res);
$pg = new Pager($cgi->offset, appconf('limit'), $total);
$pg->setUrl(site_prefix() . '/index/siteblog-topic-action/id.' . $parameters['id'] . '/title.' . $parameters['title']);
$pg->getInfo();
template_simple_register('pager', $pg);
foreach (array_keys($res) as $k) {
    $res[$k]->comments = db_shift('select count(id) from siteblog_comment where child_of_post = ?', $res[$k]->id);
    $res[$k]->comments_on = true;
    $res[$k]->category_name = siteblog_filter_category($res[$k]->category);
    if ($res[$k]->status == 'visible') {
        $res[$k]->sitellite_status = 'approved';
    } else {
        $res[$k]->sitellite_status = 'draft';
    }
}
page_add_style(site_prefix() . '/inc/app/siteblog/html/post.css');
echo template_simple('posts.spt', array('post' => $res));
Example #4
0
if (!$parameters['query']) {
    echo template_simple('search.spt', $parameters);
    return;
}
loader_import('news.Functions');
loader_import('news.Story');
$story = new NewsStory();
if (!$parameters['limit']) {
    $parameters['limit'] = 10;
}
if (!$parameters['offset']) {
    $parameters['offset'] = 0;
}
$story->limit($parameters['limit']);
$story->offset($parameters['offset']);
loader_import('help.Help');
$params = array();
foreach (help_split_query($parameters['query']) as $item) {
    $q = db_quote('%' . $item . '%');
    $params[] = 'title like ' . $q . ' or
		summary like ' . $q . ' or
		body like ' . $q;
}
$parameters['results'] = $story->find($params);
$parameters['total'] = $story->total;
loader_import('saf.GUI.Pager');
$pg = new Pager($parameters['offset'], $parameters['limit'], $parameters['total']);
$pg->getInfo();
$pg->setUrl(site_prefix() . '/index/news-search-action?query=' . urlencode($parameters['query']));
template_simple_register('pager', $pg);
echo template_simple('search.spt', $parameters);
Example #5
0
page_title('SiteInvoice - Invoices');
echo template_simple('nav.spt');
loader_import('siteinvoice.Filters');
loader_import('saf.Date');
loader_import('saf.GUI.Pager');
$q = db_query($sql);
if (!$q->execute()) {
    $total = 0;
    $invoices = array();
} else {
    $total = $q->rows();
    $invoices = $q->fetch($cgi->offset, 20);
}
$q->free();
$pg = new Pager($cgi->offset, 20, $total);
$pg->setUrl(site_current() . '?client=%s&status=%s', $cgi->client, $cgi->status);
$pg->update();
$dc = appconf('default_currency');
$exch = new Services_ExchangeRates('ECB', 'UN', 'UN', array('roundToDecimal' => 2, 'roundAutomatically' => true, 'thousandsSeparator' => '', 'decimalCharacter' => '.', 'cacheDirectory' => 'inc/app/siteinvoice/data/rates/', 'cacheLengthRates' => 86400, 'cacheLengthCurrencies' => 2592000, 'cacheLengthCountries' => 2592000));
$subtotal = 0;
$taxes = 0;
$total = 0;
if ($cgi->status == 'unpaid') {
    $today = date('Y-m-d');
    $thirty = Date::subtract($today, '30 day') . ' 00:00:00';
    $forty_five = Date::subtract($today, '45 day') . ' 00:00:00';
    $sixty = Date::subtract($today, '60 day') . ' 00:00:00';
    $ninety = Date::subtract($today, '90 day') . ' 00:00:00';
    foreach (array_keys($invoices) as $k) {
        if ($invoices[$k]->sent_on < $ninety) {
            $invoices[$k]->range = 90;
Example #6
0
    }
    $list = $story->find($params);
    if (!$list) {
        echo template_simple('no_stories.spt', array('error' => $story->error));
        return;
    }
    $total = $story->total;
    if (appconf('comments_blog_style')) {
        loader_import('news.Comment');
        $c = new NewsComment();
        foreach ($list as $k => $item) {
            $list[$k]->comments = $c->count($item->id);
        }
    }
    if (!appconf('sections') || $parameters['menu'] == 'no') {
        $menu = 'no';
    } else {
        $menu = '';
    }
    if (!appconf('sections')) {
        loader_import('saf.GUI.Pager');
        $pg = new Pager($parameters['offset'], $parameters['limit'], $total);
        $pg->setUrl(site_prefix() . '/index/news-app?menu=no&limit=' . $parameters['limit']);
        $pg->getInfo();
        template_simple_register('pager', $pg);
    }
    if ($context == 'action') {
        page_title(appconf('news_name'));
    }
    echo template_simple('frontpage.spt', array('pager' => is_object($pg), 'list' => $list, 'menu' => $menu, 'date' => $parameters['date'], 'context' => $box['context'], 'comments' => appconf('comments_blog_style'), 'rss' => appconf('rss_links'), 'sec' => $parameters['sec'], 'home' => $parameters['home'], 'limit' => $parameters['limit'], 'total' => $total));
}
Example #7
0
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
} else {
    $q = db_query('select * from siteblog_post where author = ? order by created desc');
    if (!$q->execute($parameters['author'])) {
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
}
$res =& siteblog_translate($res);
$pg = new Pager($cgi->offset, appconf('limit'), $total);
$pg->setUrl(site_prefix() . '/index/siteblog-author-action/author.' . $parameters['author']);
$pg->getInfo();
template_simple_register('pager', $pg);
foreach (array_keys($res) as $k) {
    $res[$k]->comments = db_shift('select count(id) from siteblog_comment where child_of_post = ?', $res[$k]->id);
    $res[$k]->comments_on = true;
    $res[$k]->category_name = siteblog_filter_category($res[$k]->category);
    if ($res[$k]->status == 'visible') {
        $res[$k]->sitellite_status = 'approved';
    } else {
        $res[$k]->sitellite_status = 'draft';
    }
}
page_add_style(site_prefix() . '/inc/app/siteblog/html/post.css');
echo template_simple('posts.spt', array('post' => $res));
Example #8
0
<?php

loader_import('siteforum.Post');
loader_import('siteforum.Topic');
loader_import('siteforum.Filters');
loader_import('saf.GUI.Pager');
global $cgi;
if (empty($cgi->topic)) {
    header('Location: ' . site_prefix() . '/index/siteforum-app');
    exit;
}
if (!isset($cgi->offset) || !is_numeric($cgi->offset)) {
    $cgi->offset = 0;
}
$p = new SiteForum_Post();
$p->limit(appconf('limit'));
$p->offset($cgi->offset);
$list = $p->getThreads($cgi->topic);
$pg = new Pager($cgi->offset, appconf('limit'), $p->total);
$pg->setUrl(site_prefix() . '/index/siteforum-topic-action?topic=%s', $cgi->topic);
$pg->getInfo();
$t = new SiteForum_Topic();
$topic = $t->getTitle($cgi->topic);
page_title($topic);
template_simple_register('pager', $pg);
echo template_simple('thread_list.spt', array('forum_name' => appconf('forum_name'), 'topic' => $topic, 'list' => $list, 'sitesearch' => @file_exists('inc/app/sitesearch/data/sitesearch.pid')));
if (appconf('template')) {
    page_template(appconf('template'));
}
Example #9
0
<?php

loader_import('saf.GUI.Pager');
if (!$parameters['offset']) {
    $parameters['offset'] = 0;
}
$limit = 100;
$signature = new Signature();
$signature->orderBy('ts asc');
$signature->limit($limit);
$signature->offset($parameters['offset']);
$parameters['list'] = $signature->find(array('petition_id' => $parameters['id']));
$parameters['total'] = $signature->total;
$pg = new Pager($parameters['offset'], $limit, $signature->total);
$pg->setUrl(site_prefix() . '/index/petition-signatures-action/id.%s?', $parameters['id']);
$pg->getInfo();
template_simple_register('pager', $pg);
foreach ($parameters['list'] as $k => $v) {
    $parameters['list'][$k]->num = $k + 1 + $parameters['offset'];
}
page_title(intl_get('Signatures'));
echo template_simple('signatures.spt', $parameters);
Example #10
0
<?php

loader_import('sitesearch.Filters');
loader_import('sitesearch.Logger');
loader_import('saf.GUI.Pager');
// single day's searches
$logger = new SiteSearchLogger();
global $cgi;
if (empty($cgi->date)) {
    $cgi->date = date('Y-m-d');
}
if (!isset($cgi->offset)) {
    $cgi->offset = 0;
}
$res = $logger->getSearches($cgi->date, $cgi->offset, 20);
if (!is_array($res)) {
    $res = array();
}
$pg = new Pager($cgi->offset, 20, $logger->total);
$pg->getInfo();
$pg->setUrl(site_prefix() . '/index/sitesearch-stats-day-action?date=%s', $cgi->date);
page_title('SiteSearch - Searches by Day - ' . sitesearch_filter_shortdate($cgi->date));
template_simple_register('pager', $pg);
echo template_simple('stats_day.spt', array('list' => $res));
Example #11
0
    page_title(intl_get('Search'));
}
if (!empty($parameters['query'])) {
    loader_import('saf.GUI.Pager');
    $res = $y->query($parameters['query'], $cgi->offset);
    if (!$res) {
        page_title('Search Error');
        echo '<p>' . $y->error . '</p>';
        return;
    } elseif (isset($res['Error'])) {
        page_title('Search Error');
        echo '<p>' . $res['Error']['Message'] . '</p>';
        return;
    }
    $parameters['results'] = array();
    foreach ($res['ResultSet']['Result'] as $result) {
        $result['CacheUrl'] = $result['Cache']['Url'];
        $result['CacheSize'] = ysearch_filter_size($result['Cache']['Size']);
        $result['Title'] = ysearch_filter_title($result['Title']);
        $result['Title'] = search_highlight($result['Title'], $cgi->query);
        $result['Summary'] = search_highlight($result['Summary'], $cgi->query);
        $parameters['results'][] = $result;
    }
    $pg = new Pager($cgi->offset, 25, $res['ResultSet']['totalResultsAvailable']);
    $pg->setUrl(site_current() . '?query=%s&site=%s', $parameters['query'], $parameters['site']);
    $pg->getInfo();
    template_simple_register('pager', $pg);
    echo template_simple('search_results.spt', $parameters);
} else {
    echo template_simple('search_form.spt');
}
Example #12
0
}
if (!isset($cgi->offset) || !is_numeric($cgi->offset)) {
    $cgi->offset = 0;
}
$p = new SiteForum_Post();
$p->orderBy('ts asc');
$p->limit(appconf('limit'));
$p->offset($cgi->offset);
$list = $p->getThread($cgi->post);
if (!empty($cgi->highlight)) {
    $highlight = '?highlight=' . $cgi->highlight;
} else {
    $highlight = '?highlight=';
}
$pg = new Pager($cgi->offset, appconf('limit'), $p->total);
$pg->setUrl(site_prefix() . '/index/siteforum-list-action/post.%s' . $highlight, $cgi->post);
$pg->getInfo();
if (!$cgi->topic) {
    $cgi->topic = $list[0]->topic_id;
}
$t = new SiteForum_Topic();
$topic = $t->getTitle($cgi->topic);
$subject = $list[0]->subject;
if (!empty($cgi->highlight)) {
    loader_import('saf.Misc.Search');
    echo search_bar($cgi->highlight, '/index/sitesearch-app?ctype=siteforum_post&show_types=yes');
    $queries = search_split_query($cgi->highlight);
    foreach (array_keys($list) as $key) {
        $list[$key]->body = search_highlight($list[$key]->body, $queries);
    }
}
Example #13
0
 function draw()
 {
     global $cgi;
     if (!isset($cgi->orderBy)) {
         $cgi->orderBy = array_shift(array_keys($this->fields));
     }
     if (!isset($cgi->sort)) {
         $cgi->sort = 'asc';
     }
     if (!isset($cgi->offset)) {
         $cgi->offset = 0;
     }
     $list = $this->getList();
     if (!$list) {
         return false;
     }
     if (!$this->primary_key) {
         $this->primary_key = array_shift(array_keys($this->fields));
     }
     $this->list = array();
     foreach ($list as $row) {
         if (!is_object($row)) {
             $row = (object) $row;
         }
         $this->list[$row->{$this->primary_key}] = $row;
     }
     $pg = new Pager($cgi->offset, $this->limit, $this->total);
     $pg->setUrl(site_current() . '?orderBy=%s&sort=%s' . $this->rememberParams(), $cgi->orderBy, $cgi->sort);
     $pg->getInfo();
     $headers = array();
     foreach ($this->fields as $name => $display) {
         $headers[$name] = new TableHeader($name, $display);
     }
     $this->headers =& $headers;
     $this->first_field = array_shift(array_keys($this->fields));
     template_simple_register('pager', $pg);
     return template_simple($this->template, $this);
 }
Example #14
0
<?php

global $cgi;
if (!isset($cgi->offset)) {
    $cgi->offset = 0;
}
$q = db_query('select * from siteinvoice_client order by name asc');
if (!$q->execute()) {
    $total = 0;
    $clients = array();
} else {
    $total = $q->rows();
    $clients = $q->fetch($cgi->offset, 20);
}
$q->free();
loader_import('saf.GUI.Pager');
$pg = new Pager($cgi->offset, 20, $total);
$pg->setUrl(site_current() . '?');
$pg->update();
page_title('SiteInvoice - Clients (' . count($clients) . ')');
echo template_simple('nav.spt');
template_simple_register('pager', $pg);
echo template_simple('clients.spt', array('clients' => $clients));
Example #15
0
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
} else {
    $q = db_query('select * from siteblog_post order by created desc');
    if (!$q->execute()) {
        die($q->error);
    }
    $total = $q->rows();
    $res = $q->fetch($cgi->offset, appconf('limit'));
    $q->free();
}
$res =& siteblog_translate($res);
$pg = new Pager($cgi->offset, appconf('limit'), $total);
$pg->setUrl(site_prefix() . '/index/siteblog-app');
$pg->getInfo();
template_simple_register('pager', $pg);
foreach (array_keys($res) as $k) {
    $res[$k]->comments = db_shift('select count(id) from siteblog_comment where child_of_post = ?', $res[$k]->id);
    $res[$k]->comments_on = true;
    $res[$k]->category_name = siteblog_filter_category($res[$k]->category);
    if ($res[$k]->status == 'visible') {
        $res[$k]->sitellite_status = 'approved';
    } else {
        $res[$k]->sitellite_status = 'draft';
    }
}
page_add_style(site_prefix() . '/inc/app/siteblog/html/post.css');
echo template_simple('posts.spt', array('post' => $res));