コード例 #1
0
ファイル: index.php プロジェクト: rasomu/chuza
$page_size = 10;
$page = get_current_page();
$offset=($page-1)*$page_size;

$cat=$_REQUEST['category'];

do_header('Chuza! mobile');
do_tabs('main','published');

$from_where = "FROM links WHERE link_status='published' ";
$order_by = " ORDER BY link_date DESC ";

echo '<div id="newswrap">'."\n";

$link = new LinkMobile;
$rows = $db->get_var("SELECT SQL_CACHE count(*) $from_where");

$links = $db->get_col("SELECT SQL_CACHE link_id $from_where $order_by LIMIT $offset,$page_size");
if ($links) {
	foreach($links as $link_id) {
		$link->id=$link_id;
		$link->read();
		$link->print_summary();
	}
}

do_pages($rows, $page_size);
echo '</div>'."\n";

do_footer();
コード例 #2
0
ファイル: search.php プロジェクト: brainsqueezer/fffff
$globals['ads'] = false;
$globals['noindex'] = true;
$_REQUEST['q'] = trim(stripslashes($_REQUEST['q']));
$response = do_search(false, $offset, $page_size);
$search_txt = htmlspecialchars($_REQUEST['q']);
do_header(sprintf(_('búsqueda de «%s»'), $search_txt));
do_tabs('main', _('búsqueda'), htmlentities($_SERVER['REQUEST_URI']));
echo '<div id="newswrap">' . "\n";
if (!empty($_REQUEST['q'])) {
    echo '<div style="background:#FFE2C5;margin: 4px; padding:4px;">' . _('búsqueda') . ': <em>' . $search_txt . '</em>';
    echo '&nbsp;&nbsp;' . _('encontrados') . ': ' . $response['rows'] . ', ' . _('tiempo total') . ': ' . sprintf("%1.3f", $response['time']) . ' ' . _('segundos') . '</div>';
}
echo '<form action="' . $globals['base_url'] . 'search.php" method="get">' . "\n";
echo '<fieldset>';
echo '<label for="search">' . _('búsqueda') . '</label>' . "\n";
echo '<div><input type="text" name="q" id="search" value="' . htmlspecialchars(strip_tags($_REQUEST['q'])) . '" /></div>';
echo '<input type="submit" value="' . _('buscar') . '" />' . "\n";
echo '</fieldset>';
echo '</form>';
$link = new LinkMobile();
if ($response['ids']) {
    $rows = min($response['rows'], 1000);
    foreach ($response['ids'] as $link_id) {
        $link->id = $link_id;
        $link->read();
        $link->print_summary('full', $link->status == 'published' ? 100 : 20);
    }
}
do_pages($rows, $page_size);
echo '</div>';
do_footer();
コード例 #3
0
ファイル: story.php プロジェクト: GallardoAlba/Meneame
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2008 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
//		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'linkmobile.php';
include mnminclude . 'commentmobile.php';
include mnminclude . 'html1-mobile.php';
$link = new LinkMobile();
$url_args = $globals['path'];
array_shift($url_args);
// Discard "story"
if (!isset($_REQUEST['id']) && $url_args[0] && !is_numeric($url_args[0])) {
    // Compatibility with story.php?id=x and /story/x
    $link->uri = $db->escape($url_args[0]);
    if (!$link->read('uri')) {
        not_found();
    }
} else {
    if (isset($_REQUEST['id'])) {
        $link->id = intval($_REQUEST['id']);
    } else {
        $link->id = intval($url_args[0]);
    }
    if ($id > 0 && $link->read()) {
        // Redirect to the right URL if the link has a "semantic" uri
        if (!empty($link->uri)) {
コード例 #4
0
ファイル: story.php プロジェクト: brainsqueezer/fffff
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2008 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
include mnminclude . 'linkmobile.php';
include mnminclude . 'commentmobile.php';
include mnminclude . 'html1-mobile.php';
$globals['ads'] = true;
$link = new LinkMobile();
if (!isset($_REQUEST['id']) && !empty($_SERVER['PATH_INFO'])) {
    $url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO'], 3, PREG_SPLIT_NO_EMPTY);
    $link->uri = $db->escape($url_args[0]);
    if (!$link->read('uri')) {
        not_found();
    }
} else {
    $url_args = preg_split('/\\/+/', $_REQUEST['id']);
    $link->id = intval($url_args[0]);
    if (is_numeric($url_args[0]) && $link->read('id')) {
        // Redirect to the right URL if the link has a "semantic" uri
        if (!empty($link->uri) && !empty($globals['base_story_url'])) {
            if (!empty($url_args[1])) {
                $extra_url = '/' . urlencode($url_args[1]);
            }
            header('Location: ' . $link->get_permalink() . $extra_url);
            die;