Exemple #1
0
        $script = '<script type="text/javascript">';
        $tcount = 0;
        $result = $db->query($query) or die($db->error);
        //Limit main tag listing to $tags_limit tags. Keep the loop down to the minimum really.
        while ($row = $result->fetch_assoc()) {
            $tags = mb_trim($row['tags']);
            if ($tcount <= $tags_limit) {
                $ttags = explode(" ", $tags);
                foreach ($ttags as $current) {
                    if ($current != "" && $current != " " && empty($gtags[$current])) {
                        $gtags[$current] = $current;
                        ++$tcount;
                    }
                }
            }
            $images .= '<span class="thumb"><a id="p' . $row['id'] . '" href="index.php?page=post&amp;s=view&amp;id=' . $row['id'] . '"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['directory']) . '" alt="post" border="0" title="' . $row['tags'] . ' score:' . $row['score'] . ' rating:' . $row['rating'] . '"/></a></span>';
            $script .= 'posts[' . $row['id'] . '] = {\'tags\':\'' . strtolower(str_replace('\\', "&#92;", str_replace("'", "&#039;", $tags))) . '\'.split(/ /g), \'rating\':\'' . $row['rating'] . '\', \'score\':' . $row['score'] . ', \'user\':\'' . str_replace('\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['owner']))) . '\'};
				';
        }
        $result->free_result();
        if (isset($_GET['tags']) && $_GET['tags'] != "" && $_GET['tags'] != "all") {
            $ttags = $db->real_escape_string(str_replace("'", "&#039;", $_GET['tags']));
        } else {
            $ttags = "";
        }
        asort($gtags);
        /*Tags have been sorted in ascending order
        		Let's now grab the index count from database
        		Needs to be escaped before query is sent!
        		URL Decode and entity decode for the links
        		*/
<?php 
    $query = "SELECT favorite FROM {$favorites_table} WHERE user_id='{$id}' ORDER BY added DESC LIMIT 5";
    $result = $db->query($query) or die($db->error);
    while ($row = $result->fetch_assoc()) {
        $query = "SELECT id, directory as dir, image, tags, owner, rating, score FROM {$post_table} WHERE id='" . $row['favorite'] . "'";
        $res = $db->query($query) or die($db->error);
        $r = $res->fetch_assoc();
        ?>
				<span class="thumb" id="p<?php 
        print $r['id'];
        ?>
"><a href="index.php?page=post&amp;s=view&amp;id=<?php 
        print $r['id'];
        ?>
"><img src="<?php 
        print $thumbnail_url . $misc->getThumb($r['image'], $r['dir']);
        ?>
" alt="<?php 
        print $r['tags'] . ' rating:' . $r['rating'] . ' score:' . $r['score'] . ' user:'******'owner'];
        ?>
" class="preview" title="<?php 
        print $r['tags'] . ' rating:' . $r['rating'] . ' score:' . $r['score'] . ' user:'******'owner'];
        ?>
"></a></span>
			<script type="text/javascript">
				posts['<?php 
        print $r['id'];
        ?>
'] = {'tags':'<?php 
        print mb_strtolower(str_replace('\\', "&#92;", str_replace("'", "&#039;", substr($r['tags'], 1, strlen($r['tags']) - 2))), 'UTF-8');
        ?>
Exemple #3
0
<?php

require "inv.header.php";
$id = $db->real_escape_string(basename($_SERVER["PATH_INFO"]));
if (!is_numeric($id)) {
    die;
}
$misc = new misc();
$query = "SELECT image, directory, ext FROM {$post_table} WHERE id='{$id}' LIMIT 1";
$result = $db->query($query);
$row = $result->fetch_assoc();
$f = fopen("./thumbnails" . $misc->getThumb($row['image'], $row['dir']), "rb") or die;
$data = '';
header("Cache-Control: store, cache");
header("Pragma: cache");
header("Content-type: image/" . str_replace(".", "", $row['ext']));
while (!feof($f)) {
    $data .= fread($f, 8192);
}
fclose($f);
print $data;
flush();
Exemple #4
0
    $query = "SELECT fcount FROM {$favorites_count_table} WHERE user_id='{$id}'";
    $result = $db->query($query);
    $row = $result->fetch_assoc();
    $numrows = $row['fcount'];
    $result->free_result();
    if ($numrows < 1) {
        die("<h1>You have no favorites.</h1>");
    }
    $images = '';
    $query = "SELECT t2.id, t2.image, t2.directory as dir, t2.tags, t2.owner, t2.score, t2.rating FROM {$favorites_table} as t1 JOIN {$post_table} AS t2 ON t2.id=t1.favorite WHERE t1.user_id='{$id}' LIMIT {$page}, {$limit}";
    $result = $db->query($query);
    while ($row = $result->fetch_assoc()) {
        $tags = $row['tags'];
        $tags = substr($tags, 1, strlen($tags));
        $tags = substr($tags, 0, strlen($tags) - 1);
        $images .= '<span class="thumb" style="margin: 10px;"><a href="index.php?page=post&amp;s=view&amp;id=' . $row['id'] . '" id="p' . $row['id'] . '" onclick="document.location=\'index.php?page=post&amp;s=view&amp;id=' . $row['id'] . '\'; return false;"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['directory']) . '" title="' . $tags . '" border="0" alt="image_thumb"/></a>';
        isset($_COOKIE['user_id']) && $_COOKIE['user_id'] == $id ? $images .= '<br /><a href="#" onclick="document.location=\'index.php?page=favorites&s=delete&id=' . $row['id'] . '&pid=' . $page . '\'; return false;"><b>Remove</b></a></span>' : ($images .= '</span>');
        $images .= '<script type="text/javascript">
			posts[' . $row['id'] . '] = {\'tags\':\'' . str_replace('\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $tags))) . '\'.split(/ /g), \'rating\':\'' . $row['rating'] . '\', \'score\':' . $row['score'] . ', \'user\':\'' . str_replace('\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['owner']))) . '\'}
			</script>';
    }
    $images .= '<div style="margin-top: 550px; text-align: right;"><a id="pi" href="#" onclick="showHideIgnored(\'0\',\'pi\'); return false;"></a></div>
		<script type="text/javascript">
		filterPosts(posts)
		</script>
		<div id=\'paginator\'>';
    echo $images;
    ob_flush();
    flush();
    $result->free_result();
    print $misc->pagination($_GET['page'], $_GET['s'], $id, $limit, $page_limit, $numrows, $page);
Exemple #5
0
                     ++$ttcount;
                 }
             }
             $images .= '</ul></div></div>';
         }
         $images .= '<div class="post" id="p' . $row['post_id'] . '">';
         $pat = $row['creation_date'];
         $rating = $row['rating'];
         $user = $row['owner'];
         $tags = mb_trim($row['tags']);
         $script .= 'posts.tags[' . $row['post_id'] . '] = \'' . str_replace('\\', "&#92;", str_replace("'", "&#039;", $tags)) . '\';' . 'posts.rating[' . $row['post_id'] . '] = \'' . $row['rating'] . '\';' . 'posts.score[' . $row['post_id'] . '] = \'' . $row['p_score'] . '\';';
         if ($img != "") {
             $script .= 'posts.totalcount[' . $lastpid . '] = \'' . $ptcount . '\';';
         }
         $ptcount = 0;
         $images .= '<div class="col1"><a href="index.php?page=post&amp;s=view&amp;id=' . $row['post_id'] . '"><img src="' . $thumbnail_url . $misc->getThumb($row['image'], $row['dir']) . '" border="0" class="preview" title="' . $tags . '" alt="thumbnail"/></a></div><div class="col2">';
         $img = $row['image'];
     }
     $images .= '<div class="comment" id="c' . $row['id'] . '"><h4><a href="index.php?page=account_profile&amp;uname=' . $row['user'] . '">' . $row['user'] . '</a></h4><h6 class="comment-header">Posted on ' . $posted_at . '  (';
     $row['spam'] == false ? $images .= '<a id="rc' . $row['id'] . '"></a><a href="#" id="rcl' . $row['id'] . '" onclick="Javascript:spam(\'comment\',\'' . $row['id'] . '\')">Flag for deletion</a>)</h6>' : ($images .= "<b>Already flagged</b>)</h6>");
     $images .= "<div id=\"cbody" . $row['id'] . "\"><p>" . $misc->swap_bbs_tags($misc->short_url($misc->linebreaks($row['comment']))) . "</p></div></div>";
     $script .= "posts.comments[" . $row['id'] . "] = {'score':" . $row['score'] . ", 'user':'******'\\', "&#92;", str_replace(' ', '%20', str_replace("'", "&#039;", $row['user']))) . "', 'post_id':'" . $row['post_id'] . "'};";
     ++$ccount;
     ++$ptcount;
     ++$tcount;
     $lastpid = $row['post_id'];
 }
 $ttags = explode(" ", $tags);
 $images .= '</div><div class="col3"><ul class="post-info">';
 $images .= "<li>{$pat}</li><li>rating:{$rating}</li><li>user:"******"</li>";
 $ttcount = 0;
Exemple #6
0
{
    $ext = explode('.', $img);
    $ext = array_pop($ext);
    switch ($ext) {
        case 'jpg':
        case 'jpeg':
        case 'webm':
        case 'png':
        case 'gif':
            return true;
        default:
            return false;
    }
}
$dir_contents = scandir($dir);
foreach ($dir_contents as $current) {
    if (!is_dir($dir . $current) || $current == '.' || $current == '..') {
        continue;
    }
    $dir_contents = scandir("./images/" . $current . "/");
    if (!is_dir("./thumbnails/" . $current . "/")) {
        $image->makethumbnailfolder($current);
    }
    foreach ($dir_contents as $item) {
        $thumb = "./thumbnails" . $misc->getThumb($item, $current);
        if ($item != '.' && $item != '..' && !is_dir($dir . $item) && is_valid_extension($item) && !file_exists($thumb)) {
            $image->thumbnail($current . "/" . $item);
            print $thumb . "<br>";
        }
    }
}