예제 #1
0
$fn = getTimeCheckFile($hash_tag, $sort_by, $num_thumbs);
if ($fn['do_write']) {
    //$query = "SELECT A.*, B.username from posts A, members B, posts_comments C where A.active='1' AND A.USERID=B.USERID AND A.story like '%$p->hash_tag%' OR A.PID=C.PID AND C.comment like '%$p->hash_tag%' GROUP BY A.PID order by A.favclicks desc limit 0, $p->num_thumbs";
    $query = "SELECT A.pid, A.story, A.pic, A.favclicks from posts A, members B, posts_comments C where A.active='1' AND A.USERID=B.USERID AND (A.story like '%{$p->hash_tag}%' OR (A.PID=C.PID AND C.comment like '%{$p->hash_tag}%')) GROUP BY A.PID order by {$order_by} limit 0, {$p->num_thumbs}";
    $eq = $conn->Execute($query);
    if ($eq->recordcount() > 0) {
        $posts = $eq->getrows();
        $obj = objectify_php_source($posts);
        if ($sort_by == 'random') {
            $posts2 = $posts;
            shuffle($posts2);
            $obj2 = objectify_php_source($posts2);
        }
    } else {
        $obj = "error: 'No data was returned by Minnano',";
    }
    file_put_contents($fn['name'], $obj);
    unlink($fn['last_file']);
    if (isset($obj2)) {
        $obj = $obj2;
    }
} else {
    $obj = file_get_contents($fn['name']);
    if ($sort_by === 'random') {
        $obj = jsonShuffle2($obj);
    }
}
// do_write
Header('Content-Type: application/json; charset=utf-8');
echo $callback . "(" . $obj . ")";
//echo toJs($obj, $callback);
예제 #2
0
//exit;
if ($fn['do_write']) {
    //$query = "SELECT A.*, B.username from posts A, members B, posts_comments C where A.active='1' AND A.USERID=B.USERID AND A.story like '%$p->hash_tag%' OR A.PID=C.PID AND C.comment like '%$p->hash_tag%' GROUP BY A.PID order by A.favclicks desc limit 0, $p->num_thumbs";
    $query = "SELECT A.pid, A.story, A.pic, A.favclicks from posts A, members B, posts_comments C where A.active='1' AND A.USERID=B.USERID AND (A.story like '%{$p->hash_tag}%' OR (A.PID=C.PID AND C.comment like '%{$p->hash_tag}%')) GROUP BY A.PID order by {$order_by} limit 0, {$p->num_thumbs}";
    $eq = $conn->Execute($query);
    if ($eq->recordcount() > 0) {
        $posts = $eq->getrows();
        $obj = objectify($posts);
        if ($sort_by == 'random') {
            $posts2 = $posts;
            shuffle($posts2);
            $obj2 = objectify($posts2);
        }
    } else {
        $obj = "error: 'No data was returned by Minnano',";
    }
    file_put_contents($fn['name'], $obj);
    unlink($fn['last_file']);
    if (isset($obj2)) {
        $obj = $obj2;
    }
} else {
    $obj = file_get_contents($fn['name']);
    if ($sort_by === 'random') {
        $obj = jsonShuffle2(trim($obj));
    }
}
// do_write
Header('Content-Type: application/json; charset=utf-8');
echo $callback . "(" . $obj . ")";
//echo toJs($obj, $callback);