Example #1
0
/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V4					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless,putyn.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    //$last_date = mysqli_fetch_assoc(sql_query("SELECT date_diff FROM diffusions ORDER BY date_diff DESC LIMIT 1")) or sqlerr(__FILE__, __LINE__);
    //$now = date("Y-m-d");
    //if (strtotime($last_date) < strtotime($now)) {
    $url = "https://api.betaseries.com/shows/list?v=2.4&key=d8a25885862b&format=json";
    $options = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
    $CURL = curl_init();
    curl_setopt_array($CURL, $options);
    $content = curl_exec($CURL);
    $data = json_decode($content, true);
    foreach ($data as $key => $value) {
        $i = 0;
        while ($i < sizeof($value)) {
            $id_serie = $value[$i][id];
            $id_tvdb = $value[$i][thetvdb_id];
            $nb_saison = $value[$i][seasons];
            $nb_episode = $value[$i][episodes];
            $titre = $value[$i][title];
            $url_serie = "http://api.betaseries.com/shows/display?v=2.4&key=d8a25885862b&format=json&id=" . $id_serie;
            $url_acteurs = "http://api.betaseries.com/shows/characters?v=2.4&key=d8a25885862b&format=json&id=" . $id_serie;
            $url_lastep = "http://api.betaseries.com/episodes/latest?v=2.4&key=d8a25885862b&format=json&id=" . $id_serie;
            $url_similaire = "http://api.betaseries.com/shows/similars?v=2.4&key=d8a25885862b&format=json&id=" . $id_serie;
            //$url_picture = "http://api.betaseries.com/shows/pictures?v=2.4&key=d8a25885862b&format=json&id=".$id_serie;
            $options2 = array(CURLOPT_URL => $url_serie, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
            $CURL2 = curl_init();
            curl_setopt_array($CURL2, $options2);
            $content2 = curl_exec($CURL2);
            $serie = json_decode($content2, true);
            $statut = $serie[show][status];
            $followers = $serie[show][followers];
            if ($followers > 2000) {
                if ($statut == "Continuing") {
                    $url_planning = "http://api.betaseries.com/shows/episodes?v=2.4&key=d8a25885862b&format=json&id=" . $id_serie;
                    $options3 = array(CURLOPT_URL => $url_planning, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
                    $CURL3 = curl_init();
                    curl_setopt_array($CURL3, $options3);
                    $content3 = curl_exec($CURL3);
                    $result = json_decode($content3, true);
                    $planning = $result[episodes];
                    for ($j = 0; $j < sizeof($planning); $j++) {
                        $saison = $planning[$j][season];
                        //if ($saison == $nb_saison) {
                        $episode = $planning[$j][code];
                        $date_diff = $planning[$j]['date'];
                        $titre_ep = $planning[$j][title];
                        sql_query("INSERT INTO diffusions (date_diff, episode, titre, titre_ep, id_serie) VALUES (" . sqlesc($date_diff) . ", " . sqlesc($episode) . ", " . sqlesc($titre) . "," . sqlesc($titre_ep) . "," . sqlesc($id_tvdb) . ")");
                        //}
                    }
                }
                $res = sql_query("SELECT COUNT(id_serie) FROM serie WHERE id_serie= " . sqlesc($id_tvdb)) or sqlerr(__FILE__, __LINE__);
                $row = mysqli_fetch_row($res);
                $count = $row[0];
                if ($count == 0) {
                    $options3 = array(CURLOPT_URL => $url_acteurs, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
                    $CURL3 = curl_init();
                    curl_setopt_array($CURL3, $options3);
                    $content3 = curl_exec($CURL3);
                    $acteurs = json_decode($content3, true);
                    $count = sizeof($acteurs[characters]);
                    if ($count >= 3) {
                        $acteur = $acteurs[characters][0][actor];
                        for ($j = 1; $j < 3; $j++) {
                            $acteur .= ", " . $acteurs[characters][$j][actor];
                        }
                    } else {
                        $acteur = $acteurs[characters][0][actor];
                        for ($j = 1; $j < sizeof($acteurs[characters]); $j++) {
                            $acteur .= ", " . $acteurs[characters][$j][actor];
                        }
                    }
                    $options4 = array(CURLOPT_URL => $url_lastep, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
                    $CURL4 = curl_init();
                    curl_setopt_array($CURL4, $options4);
                    $content4 = curl_exec($CURL4);
                    $last_ep = json_decode($content4, true);
                    $last_episode = $last_ep[episode][code];
                    $date_lastep = $last_ep[episode]['date'];
                    $options5 = array(CURLOPT_URL => $url_similaire, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
                    $CURL5 = curl_init();
                    curl_setopt_array($CURL5, $options5);
                    $content5 = curl_exec($CURL5);
                    $similaires = json_decode($content5, true);
                    $similaire = $similaires[similars][0][show_title];
                    for ($j = 1; $j < sizeof($similaires[similars]); $j++) {
                        $similaire .= ", " . $similaires[similars][$j][show_title];
                    }
                    $descr = $serie[show][description];
                    $annee = $serie[show][creation];
                    $genres = $serie[show][genres];
                    $genre = $genres[0];
                    for ($j = 1; $j < sizeof($genres); $j++) {
                        $genre .= ", " . $genres[$j];
                    }
                    $duree = $serie[show][length];
                    $chaine = $serie[show][network];
                    $statut = $serie[show][status];
                    $statut = "En cours";
                    $langue = $serie[show][language];
                    if ($langue == "en") {
                        $langue = "Anglais";
                    }
                    if ($langue == "fr") {
                        $langue = "Français";
                    }
                    $note = $serie[show][notes][mean];
                    $note = round($note, 0);
                    $picture = "http://thetvdb.com/banners/_cache/graphical/" . $id_tvdb . "-g.jpg";
                    $picture_name = poster($picture);
                    sql_query("INSERT INTO serie VALUES (" . sqlesc($id_tvdb) . ", " . sqlesc($titre) . ", " . sqlesc($descr) . "," . sqlesc($picture_name) . ", " . sqlesc($annee) . ", " . sqlesc($genre) . ", " . sqlesc($chaine) . ", " . sqlesc($statut) . ", " . sqlesc($langue) . ", " . sqlesc($note) . ", " . sqlesc($acteur) . ", " . sqlesc($last_episode) . ", " . sqlesc($date_lastep) . ", " . sqlesc($nb_saison) . ", " . sqlesc($nb_episode) . ", " . sqlesc($similaire) . ", " . sqlesc($duree) . ")");
                }
            }
            $i++;
        }
    }
    //}
    if ($queries > 0) {
        write_log("Stats clean-------------------- Stats cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
$option['modul'] = fetch_array(query("SELECT `id`, `nazev` FROM `modul` WHERE `druh`='main' ORDER BY `poradi`"), "id");
$smarty->assign("option", $option);
if ($_GET['id']) {
    $edit_id = intval($_GET['id']);
    $edit = fetch_assoc(query("\r            SELECT m.*, mm.`page` AS modul_page\r            FROM `modul` AS m\r            LEFT JOIN `modul` AS mm ON (mm.`id` = m.`modul_id`)\r            WHERE m.`id`='{$edit_id}'"));
    $smarty->assign("edit", $edit);
}
if ($_POST['submitValue'] == 'new') {
    if ($_POST['def']['nazev'] == '' or $_POST['def']['page'] == '') {
        $err[] = "Musíte vyplnit všechny povinné položky.";
    }
    if ($err) {
        $smarty->assign("err", $err);
    } else {
        $inp = poster($_POST['def'], "db_set");
        if (!is_null($edit['modul_id'])) {
            $inp['db_set'][] = "`url`='{$edit['modul_page']}/{$_POST['def']['page']}.html'";
        }
        if ($_POST['zobraz']) {
            $inp['db_set'][] = "`zobraz`='2'";
        } else {
            $inp['db_set'][] = "`zobraz`='0'";
        }
        query("START TRANSACTION");
        if (!query("UPDATE `modul` SET " . implode(",", $inp['db_set']) . " WHERE `id`='{$edit_id}'")) {
            $db_err[] = "Chyba pri ukladani modulu";
        }
        if ($edit['druh'] == 'main') {
            $subModul_sql = query("SELECT `id`, `page` FROM `modul` WHERE `modul_id`='{$edit_id}' AND `druh`='sub'");
            while ($it = fetch_assoc($subModul_sql)) {
Example #3
0
$aktualniUrlFull = curPageURL();
//Aktualni URL návštěvníka
function poster($str, $type = NULL, $trim = NULL)
{
    if (is_array($str)) {
        foreach ($str as $k => $v) {
            if (is_array($v)) {
                $ret[$k] = poster($v, $type, $trim);
            } else {
                if ($v == "") {
                    //BOF - nic - prazdna hodnota
                    $ret['db'][$k] = $v;
                    $ret['plain'][$k] = $v;
                    if ($type == "db_set") {
                        $ret['db_set'][$k] = "`" . $k . "`='" . $v . "'";
                    } elseif ($type == "db_insert") {
                        $ret['db_insert'][$k] = "`" . $k . "`";
                        $ret['db_value'][$k] = "'" . $v . "'";
                    } elseif ($type == "db_set_date") {
                        $ret['db_set_date'][$k] = "`" . $k . "`= NULL ";
                    } elseif ($type == "db_set_timestamp") {
                        $ret['db_set_timestamp'][$k] = "`" . $k . "`= NULL ";
                    } elseif ($type == "db_set_null") {
                        $ret['db_set_null'][$k] = "`" . $k . "`= NULL ";
                    }
                    //EOF- nic
                } else {
                    //BOF - osetreni - hodnoty se osetruji
                    //vyhod prazdne znaky kdyz mas
                    if ($trim == "trim") {
                        $v = str_replace(" ", "", $v);
                    } elseif ($trim == "telephone") {
                        $v = str_replace(" ", "", $v);
                        $v = str_replace("+", "", $v);
                    }
                    if (get_magic_quotes_gpc()) {
                        $ret['db'][$k] = $v;
                        $ret['plain'][$k] = stripslashes($v);
                        if ($type == "db_set") {
                            $ret['db_set'][$k] = "`" . $k . "`='" . $v . "'";
                        } elseif ($type == "db_insert") {
                            $ret['db_insert'][$k] = "`" . $k . "`";
                            $ret['db_value'][$k] = "'" . $v . "'";
                        } elseif ($type == "db_set_date") {
                            $ret['db_set_date'][$k] = "`" . $k . "`='" . dateDB($v) . "'";
                        } elseif ($type == "db_set_timestamp") {
                            $ret['db_set_timestamp'][$k] = "`" . $k . "`='" . dateDB($v, "od") . "'";
                        } elseif ($type == "db_set_null") {
                            $ret['db_set_null'][$k] = "`" . $k . "`= '{$v}' ";
                        }
                    } else {
                        $ret['db'][$k] = addslashes($v);
                        $ret['plain'][$k] = $v;
                        if ($type == "db_set") {
                            $ret['db_set'][$k] = "`" . $k . "`='" . addslashes($v) . "'";
                        } elseif ($type == "db_insert") {
                            $ret['db_insert'][$k] = "`" . $k . "`";
                            $ret['db_value'][$k] = "'" . addslashes($v) . "'";
                        } elseif ($type == "db_set_date") {
                            $ret['db_set_date'][$k] = "`" . $k . "`='" . dateDB($v) . "'";
                        } elseif ($type == "db_set_timestamp") {
                            $ret['db_set_timestamp'][$k] = "`" . $k . "`='" . dateDB($v, "od") . "'";
                        } elseif ($type == "db_set_null") {
                            $ret['db_set_null'][$k] = "`" . $k . "`= '" . addslashes($v) . "' ";
                        }
                    }
                    //EOF - osetreni
                }
            }
        }
    } else {
        $arr = poster(array($str), $type, $trim);
        foreach ($arr as $key => $value) {
            $ret[$key] = $value[0];
        }
    }
Example #4
0
<?php
$smarty->caching = 0;
$allowed = array('admin','poster');

require("../site_init.php");

if (is_int($_GET['id']))
	if ($is_admin == 'poster' && $current_user!=poster($_GET['id'])) $is_admin = ''; /*Remove access to blog if is not owner os this post*/
else 
	if ($is_admin == 'poster' && $current_user!=$_GET['user']) $is_admin = ''; /*Remove access to blog if is not owner os this post*/

require("site_credentials.php");

$cache_id = $_GET['id'].$current_user;



if (isset($_POST['edita_grava'])) {

	/*Serialized vars*/
	foreach ($languages as $chave => $lingua) {
		$text[$lingua] = $_POST['text_'.$lingua];
		$title[$lingua] = $_POST['title_'.$lingua];
		$seo_desc[$lingua] = $_POST['seo_desc_'.$lingua];

	}
	$user = cleanQuery($_GET['user']);
	
	$id = cleanQuery($_GET['id']);
	$text_bd = prepData(serialize($text));
	$title_bd = prepData(serialize($title));
Example #5
0
                                                }
                                            }
                                            echo "<textarea rows=\"20\" cols=\"70\" name=\"ch_tresc\">" . $wpis->getContent() . "</textarea>\n";
                                            echo "<br/>\n<input type=\"submit\" value=\"Zmień\"/>\n</form>";
                                        } else {
                                            echo "there you are";
                                            header("Location:index.php?post=" . $_GET['post']);
                                        }
                                    }
                                } else {
                                    $count = current($db->showPosts(0, 3));
                                    foreach ($db->showPosts(0, 3) as $key => $wpis) {
                                        if ($key < 1) {
                                            continue;
                                        }
                                        poster($wpis);
                                    }
                                    pagination($count, 0);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
} else {
    echo "";
}
//Widok prawej kolumny zalogowany/niezalogowany
if (isset($_SESSION['login']) && $db->logStatus($_SESSION['login']) == 1) {