Beispiel #1
0
 public function content()
 {
     echo '<div id="thumbnails">';
     // generate a basic newest search with a range from 0 to 12
     $s = new Search();
     $s->order(SORT_NEWEST);
     $s->range(0, 12);
     $res = $s->search();
     while ($image = $res->fetch_object()) {
         echo $this->imageBlock($image);
     }
     echo '</div><div id="modal"></div><div id="modalContent"> </div>';
 }
Beispiel #2
0
require_once "./lib/Upload.php";
require_once "./lib/Search.php";
// we really don't want to have errors showing up here
if (!isset($_GET['debug'])) {
    error_reporting(!E_ALL);
}
switch ($_GET['do']) {
    /**
     *  This will fetch a full list of images
     */
    case 'getImages':
        $s = new Search();
        // gets the range of our search
        if (isset($_GET['offset'])) {
            if (isset($_GET['count'])) {
                $s->range($_GET['offset'], $_GET['count']);
            } else {
                $s->range($_GET['offset']);
            }
        } else {
            if (isset($_GET['count'])) {
                $s->range(NULL, $_GET['count']);
            }
        }
        // sets our tags
        if (isset($_GET['include'])) {
            $tags = explode(',', $_GET['include']);
            foreach ($tags as $k => $v) {
                $tags[$k] = urldecode($v);
            }
            $s->with($tags);
Beispiel #3
0
<body>
	<div id="dialog">
		<div class='content'></div>
	</div>
    <div id="menu"><h2>iZwei</h2>
    <?php 
echo $site->form(FORM_SIMPLESEARCH);
echo $site->form(FORM_UPLOAD);
?>
    </div>
    <div id="content">
    <?php 
// will be moved to design later on
$s = new Search();
$s->order(SORT_NEWEST);
$s->range(0, 12);
$res = $s->search();
while ($image = $res->fetch_object()) {
    echo $site->imageBlock($image);
}
?>
    </div>
    <div id="modal">
    	
    </div>
    <div id="modalContent"> </div>
</body>

<?php 
$site->footer();
Beispiel #4
0
function axSetSearch(Search $search)
{
    // gets the range of our search
    if (isset($_GET['offset'])) {
        if (isset($_GET['count'])) {
            $search->range($_GET['offset'], $_GET['count']);
        } else {
            $search->range($_GET['offset']);
        }
    } else {
        if (isset($_GET['count'])) {
            $search->range(NULL, $_GET['count']);
        }
    }
    // sets our tags
    if (isset($_GET['include'])) {
        $tags = explode(',', $_GET['include']);
        foreach ($tags as $k => $v) {
            $tags[$k] = urldecode($v);
        }
        $search->with($tags);
    }
    if (isset($_GET['exclude'])) {
        $tags = explode(',', $_GET['exclude']);
        foreach ($tags as $k => $v) {
            $tags[$k] = urldecode($v);
        }
        $search->without($tags);
    }
    // sets our order
    if (isset($_GET['order'])) {
        $orders = explode(',', $_GET['order']);
        foreach ($orders as $key => &$o) {
            switch ($o) {
                case 'newest':
                    $o = SORT_NEWEST;
                    break;
                case 'oldest':
                    $o = SORT_OLDEST;
                    break;
                case 'best':
                    $o = SORT_POPULARITY;
                    break;
                case 'worst':
                    $o = SORT_IMPOPULARITY;
                    break;
                case 'random':
                    $o = SORT_RANDOM;
                    break;
                case 'mosttags':
                    $o = SORT_MORETAGS;
                    break;
                case 'leasttags':
                    $o = SORT_LESSTAGS;
                    break;
                default:
                    trigger_error("Sort mode {$o} is not supported!", E_USER_NOTICE);
            }
        }
        $search->order($orders);
    }
    return $search;
}