Exemplo n.º 1
0
function addspam($type, $rlsname, $url, $filename, $fromnet, $ann = true)
{
    global $mc;
    $whichdb = array('ADDNFO' => 'nfosdb', 'OLDNFO' => 'nfosdb', 'ADDSFV' => 'sfvsdb', 'OLDSFV' => 'sfvsdb', 'ADDM3U' => 'm3usdb', 'OLDM3U' => 'm3usdb');
    $w = mysql_query("SELECT COUNT(id) AS tid FROM " . $whichdb[$type] . " WHERE rlsname = " . sqlesc($rlsname) . "") or exit("Err1 " . mysql_error());
    $qw = mysql_fetch_assoc($w);
    if ($qw['tid'] == 0) {
        $a = get_url_data(trim($url));
        $size = $a['size'] == 0 ? strlen($a['data']) : $a['size'];
        if ($size == 0 || $size < 25 || $a['error'] == 404 || $a['data'] == "") {
            return 'URL FAIL';
        } else {
            $crc = strtoupper(dechex(crc32($a['data'])));
            $newdata = gzcompress($a['data'], 9);
            $grp = explode("-", $rlsname);
            $grp = $grp[count($grp) - 1];
            $fromdata = explode(":", trim($fromnet));
            $fromdata[1] = "#" . $fromdata[1];
            mysql_query("INSERT INTO " . $whichdb[$type] . " ( `rlsname` , `grp` , `time` , `data` , `filename` , `size` ) VALUES (" . sqlesc($rlsname) . "," . sqlesc($grp) . "," . time() . "," . sqlesc($newdata) . "," . sqlesc($filename) . "," . sqlesc($size) . ")") or exit('Err2 ' . mysql_error());
            $id = mysql_insert_id();
            mysql_query("INSERT INTO fromspamdata ( `spamid` , `type` , `time` , `nick` , `chan` , `network` ) VALUES (" . $id . "," . sqlesc($type) . "," . time() . "," . sqlesc($fromdata[0]) . "," . sqlesc($fromdata[1]) . "," . sqlesc($fromdata[2]) . ")") or exit('Err3 ' . mysql_error());
            if ($ann == true) {
                $mcdata = array('ID' => $id, 'TYPE' => $type);
                $hash1 = md5($id . $type . $rlsname . $url);
                $hash2 = md5(md5($filename . time()) . time() . $rlsname);
                $key = md5(md5($hash1 . $hash2) . md5($hash2 . $hash1));
                $mc->set($key, $mcdata, false, 300) or die("Failed to save data at memcache server");
                return $key . " " . $crc . " " . $size;
            } else {
                return;
            }
        }
    }
}
Exemplo n.º 2
0
function check_with_curl($url)
{
    $data = get_url_data($url);
    if (empty($data)) {
        return false;
    }
    $results = strpos($data, 'var host =');
    if ($results) {
        $results = strpos($data, '/?cid=');
        if ($results) {
            $results = strpos($data, '/report/spam/');
            if ($results) {
                return true;
            }
        }
    }
    return false;
}
Exemplo n.º 3
0
<?php

/**
 * All URL requests come to this script which searches for
 * the correct controller and method to handle and return a
 * response
 *
 * @author: Humberto Moreira <*****@*****.**>
 */
require_once "config/settings.php";
require_once "lib/util.php";
require_once "config/urls.php";
// Grabs path from url and search on our config/urls or the correct controller/method
$url_info = get_url_data($URLS);
if (sizeof($url_info)) {
    require_once "controllers/" . get_controller_file_name($url_info['controller']);
    $method = array($url_info['controller'], $url_info['method']);
    if (is_callable($method)) {
        call_user_func_array($method, $url_info['params']);
        exit;
    }
}
// No valid URL was found for this request
echo "Invalid Request";
exit;
Exemplo n.º 4
0
 function get_plugin()
 {
     $plugin_url = 'http://elearningplugin.dokumenary.net/index.php';
     $plugin_data = get_url_data($plugin_url);
     $result_body = json_decode($plugin_data, true);
     $data['plugins'] = $result_body;
     # panggil datatables
     $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js')));
     $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css')));
     $this->twig->display('get-plugin.html', $data);
 }
Exemplo n.º 5
0
function get_posts()
{
    $raw_posts = file_get_contents(__DIR__ . '/../posts.txt');
    $raw_posts = trim(str_replace("\n\n", "\n", str_replace("\n\r", "\n", $raw_posts)));
    $posts_lines = explode("\n", $raw_posts);
    $posts = array();
    foreach ($posts_lines as $key => $value) {
        // Title
        if ($key % 2 == 0) {
            $post_key = slugify($value);
            $posts[$post_key] = array('title' => $value, 'slug' => $post_key);
            // URL
        } else {
            $post_key = slugify($posts_lines[$key - 1]);
            $doc_url = $value;
            $archslug = get_url_data($doc_url);
            $xml_data_url = "https://archive.org/download" . $archslug . $archslug . "_meta.xml";
            $xml_files_url = "https://archive.org/download" . $archslug . $archslug . "_files.xml";
            // Uncomment for debug
            //$xml_data_url = "http://localhost/PERSO/archonaut-WBM/archonaut/debug/An_Animation_Of_Me_lol_meta.xml";
            //$xml_files_url = "http://localhost/PERSO/archonaut-WBM/archonaut/debug/An_Animation_Of_Me_lol_files.xml";
            $xml_data = xml_eye($xml_data_url, "data");
            $xml_files = xml_eye($xml_files_url, "files");
            $posts[$post_key]['archurl'] = (object) array('title' => $xml_data[0], 'authorname' => $xml_data[1], 'creation_date' => $xml_data[4], 'main_file_url' => "https://archive.org/download/" . $archslug . "/" . $xml_files, 'doc_url' => $doc_url, 'data_url' => $xml_data_url, 'files_url' => $xml_files_url);
            $posts[$post_key] = (object) $posts[$post_key];
        }
    }
    // Cached dimensions
    $cached_posts = get_cached_posts();
    array_walk($posts, function (&$post, $slug) use($cached_posts) {
        if (isset($cached_posts[$slug])) {
            $post->image->width = $cached_posts[$slug]['width'];
            $post->image->height = $cached_posts[$slug]['height'];
            $post->image->html_attributes = $cached_posts[$slug]['html_attributes'];
        }
    });
    return $posts;
}