<?php
/* Projekt: shitIMGv2
* Plik: index.php
* Data modyfikacji: 01-08-2011
*
* Copyright (C) 2011 Paweł Klockiewicz & Wojciech Król
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('connect.php');
if(@$first_run == 1
) header("LOCATION: install.php"); require_once('functions.php');
$reklama_i=0;
?>
<html>
<head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30889538-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#wysuwane").css("left","-210px");
$("#wysuwane").hover(
function () {
$("#wysuwane").animate({left: "0px"}, 1000 );
$(this).addClass("zamknij");
},
function () {
$("#wysuwane").animate({left: "-210px"}, 1000 );
$(this).removeClass("zamknij");
}
);
});
</script>
<style type="text/css">
#wysuwane
{
background: url("http://burned.pl/wp-content/uploads/2011/02/fbpodklad.png") no-repeat scroll 0 0 transparent;
padding: 10px;
width: 235px;
height:402px;
position: fixed;
margin-top: -200px; /*połowa wysokości panelu w górę */
left: 0px;
top: 50%;
}
.zamknij
{
background-position: 0px 0px -242px 0px;
}
</style>
<title>
<?php echo $ustawienia['tytul']; ?></title>
<?php include('tpl/head.php') ?>
</head>
<body>
<div id="naglowek">
<?php include('tpl/naglowek.php') ?>
</div>
<div id="menu">
<?php include('tpl/menu.php') ?>
</div>
<div id="kontener">
<?php
$limit = $ustawienia['img_na_strone']; // Ilość pozycji na stronę...
$pg = $_GET['page']; // Pobranie do zmiennej numeru strony...
//Obliczenie granic rekordów...
$l1 = 0;
$l2 = $limit; //Jeśli zmienna $pg ma pustą zawartość nastawiamy granice od 0 do wartości $limit
} else {
$l1 = $limit * $pg - $limit; //W przeciwnym wypadku oblicz dolną granicę...
$l2 = $limit; //Oraz górną granicę...
}
$zapytanie = mysql_query("SELECT * FROM shity WHERE czeka='0' ORDER BY id DESC LIMIT $l1,$l2"); //wybiera tabelę i pobiera z niej wszystkie dane
if ($zapytanie) { //jeśli zapytanie można wykonać to...
while ($shit = mysql_fetch_array($zapytanie)) { //robi pętlę i przypisuje wszystkie dane do zmiennej if($shit['typ']=='obrazek') {
if($ustawienia['img_title']) {
echo '<div class="img_title"><a href="obrazek.php?'.$shit['id'].'">'.$shit['tytul'].'</a></div>'; }
echo '<div class="shit"><a href="obrazek.php?'.$shit['id'].'"><img src="'.$shit['obrazek'].'" alt="'.$shit['tytul'].'" title="'.$shit['tytul'].'"/></a>'; echo'<div class="fb_share"> <a name="fb_share" type="button_count" share_url="http://'.$host.$uri.'/obrazek.php?'.$shit['id'].'" href="http://www.facebook.com/sharer.php">Udostępnij</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
</div>'; }
if($shit['typ']=='film')
{
$id_filmu=str_replace("http://www.youtube.com/watch?v=", "", $shit['obrazek']); if($ustawienia['img_title']) {
echo '<div class="img_title"><a href="obrazek.php?'.$shit['id'].'">'.$shit['tytul'].'</a></div>'; }
<object width="480" height="390"><param name="movie" value="http://www.youtube.com/v/'.$id_filmu.'?version=3&hl=pl_PL"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$id_filmu.'?version=3&hl=pl_PL" type="application/x-shockwave-flash" width="480" height="390" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<div class="fb_share">
<a name="fb_share" type="button_count" share_url="http://'.$host.$uri.'/obrazek.php?'.$shit['id'].'" href="http://www.facebook.com/sharer.php">Udostępnij</a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
</div>'; }
//###########################REKLAMA
if($ustawienia['reklama']) {
$reklama_i = $reklama_i+1;
$reklama_query = mysql_query("SELECT * FROM `reklama` WHERE `pod_obrazkiem`='".$reklama_i."' AND `pod_obrazkiem`!='0'"); if(mysql_num_rows($reklama_query) == 1) { //co który obrazek ma być wyświetlana echo '<div class="shit">'.$reklama['kod'].'</div>'; //echo '<div class="img_title" style="text-align:center; margin:-20px 0 20px 0;">Reklama</div>';
}
}
//####################KONIEC REKLAMA
}
} else {
echo 'Nie można pobrać danych z tabeli "shity".'; //jeśli nie to błąd ^^ }
//Liczymy ile jest w sumie rekordów do wyświetlenia
//zapytanie może mieć odpowiednie warunki np. WHERE itp.
if($records>=1)
{
$minus_strona = $_GET['page']-1;
$plus_strona = $_GET['page']+1;
$rekordy = $records/$ustawienia['img_na_strone'];
if($_GET['page'] >= 2 ){
echo '<a href="?page='.$minus_strona.'" class="button" style="float:left;">« NOWSZE</a>'; }
if($_GET['page'] < $rekordy && $_GET['page'] != 0){
echo '<a href="?page='.$plus_strona.'" class="button" style="float:right;">STARSZE »</a>'; }
if($_GET['page'] == 0 && $records>$ustawienia['img_na_strone']){
echo '<a href="?page=2" class="button" style="float:right;">STARSZE »</a>'; }
}
else
{
echo 'Brak obiektów do wyświetlenia.'; }
?>
<div style="clear:left;"></div><div style="clear:right;"></div>
</div>
<div id="strony">
<?php
//Jeśli są jakieś rekordy do wyświetlenia wygeneruj paginację...
if($records >= 1){
//Funkcja musi przyjąć odpowiednią tablicę jako parametr:
$pag['posts'] = $records; //Ilość rekordów...
$pag['limit'] = $limit; //Rekordów na stronę...
$pag['page'] = $_GET['page']; //Aktualna strona...
$pag['separator'] = '?'; //Separatror - ? lub &
$pag['url_class'] = 'pages'; //Klasa linków paginowania w CSS...
$pag['a_pg_class'] = 'active_pg'; //Klasa numeru aktywnej strony.
$pag['page_label'] = 'Strona:'; //Etykieta z napisem ''Strona: x/x'' obok paginacji.
//Wywołanie funkcji z tablicą jako parametr poprzez ECHO...
ECHO print_pagination
($pag); }
?>
</div>
<div id="stopka">
<?php include('tpl/stopka.php') ?>
</div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/pl_PL/all.js#xfbml=1&appId=411522678876022";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div id="wysuwane">
<div id="wewnatrz" style="float:left;width:180px; display:block; margin-left:0px;">
<div class="fb-like-box" data-href="http://facebook.com/skunbook" data-width="185" data-height="380" data-colorscheme="dark" data-show-faces="true" data-stream="false" data-header="false"></div>
</div>
</div>
</body>
</html>