コード例 #1
0
ファイル: functions.php プロジェクト: HoshinoTouko/NHentaiAPI
function getTagsInfoByUrl($url)
{
    //Load url
    $html = file_get_html($url);
    $classCount = substr_count($html, 'class="tag tag-');
    if ($classCount == 0) {
        return getGalleryInfo($url);
    }
    if ($html == '') {
        $dieObj = array("error" => "404 Not Found");
        echo json_encode($dieObj);
        die;
    }
    $tempHtml = $html->find('div[id=tag-container]', 0);
    //echo $tempHtml;
    $output = array();
    $iii = 0;
    while ($iii < $classCount) {
        $tempHtmlItem = $tempHtml->find('a[class=tag]', $iii);
        $tagUrl = getbetween($tempHtmlItem, '<a href="/', '/"');
        $tagFather = getbetween($tempHtmlItem, '<a href="/', '/');
        $tagSon = getbetween($tagUrl, '/', '/"');
        //echo $tagUrl . '<br>';
        $tempItem = array('tagUrl' => urlencode('http://nhentai.net/' . $tagUrl), 'tagFather' => $tagFather, 'tagSon' => $tagSon);
        array_push($output, $tempItem);
        $iii++;
    }
    return $output;
}
コード例 #2
0
ファイル: functions.php プロジェクト: qwazix/viood
/**
 * Recurses into a directory and writes the structure
 * in an associative array
 * @global string $pictureDir from config.php
 * @param string $directory The directory to recurse into
 * @param array $array The array to put the results in
 * @param int $depth How deep should it go? (Default 1)
 * @return array
 * 
 */
function recurse_dir($directory, $array, $depth = 1, $include_info = true, $full_path = false)
{
    //    echo $directory,"<br><br>";
    global $pictureDir;
    $dirName = basename($directory);
    if (!is_dir($directory)) {
        include '404.php';
    }
    $gallery_info = getGalleryInfo($dirName);
    //get images to be ignored from gallery.json
    if (is_array($gallery_info["ignore"])) {
        $ignore_images = $gallery_info["ignore"];
    } else {
        $ignore_images = array();
    }
    if ($handle = opendir($directory)) {
        //for each entry found inside $directory
        while (false !== ($entry = readdir($handle))) {
            $path = $directory . "/" . $entry;
            //echo "$pictureDir -- $dirName -- $path -- $entry \n </br>";
            //ignore . and .. , write directories to the array and recurse into them
            if ($entry != "." && $entry != ".." && !in_array($entry, $ignore_images)) {
                if (is_dir($path)) {
                    $array[$entry] = array();
                    if ($include_info) {
                        $array[$entry]["__info__"] = getGalleryInfo($path);
                    }
                    if ($depth != 0) {
                        $array[$entry] = recurse_dir($path, $array[$entry], $depth - 1, $include_info, $full_path);
                    }
                } else {
                    if (is_image($path)) {
                        $array[$entry] = $full_path ? $path : $entry;
                    }
                }
            }
        }
        closedir($handle);
    }
    //echo "final"; _print_r($array);
    return $array;
}
コード例 #3
0
ファイル: index.php プロジェクト: HoshinoTouko/NHentaiAPI
<?php

header('content-type:text/html;charset="utf-8"');
error_reporting(0);
//头部保留信息
//HoshinoTouko
//2015-10-02 18:20
//引用函数
include "../functions.php";
include "../config.php";
//引用统计
include "../analysis/analysis.php";
Analysis();
//analysisMAC($MACMD5);
$bookID = isset($_GET['id']) ? intval($_GET['id']) : -1;
$MACMD5 = isset($_GET['mac']) ? intval($_GET['mac']) : 0;
if ($bookID === -1) {
    $dieObj = array("error" => "NoID");
    echo json_encode($dieObj);
    die;
}
//main
$galleryDetail = getGalleryDetailById($bookID);
$recommend = getGalleryInfo('http://nhentai.net/g/' . $bookID);
$galleryOutput = array("Detail" => $galleryDetail, "Recommend" => $recommend);
$temp = json_encode($galleryOutput, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
echo urldecode($temp);
コード例 #4
0
ファイル: index.php プロジェクト: HoshinoTouko/NHentaiAPI
<?php

header('content-type:text/html;charset="utf-8"');
error_reporting(0);
//ͷ��������Ϣ
//HoshinoTouko
//2015-10-02 18:20
//���ú���
include "../functions.php";
include "../config.php";
//����ͳ��
include "../analysis/analysis.php";
Analysis();
//===========================
$pageFromHome = isset($_GET['page']) ? intval($_GET['page']) : -1;
if ($pageFromHome === -1) {
    $pageFromHome = 1;
}
$url = 'http://nhentai.net/?page=' . $pageFromHome;
$galleryInfo = getGalleryInfo($url);
$temp = json_encode($galleryInfo, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
echo urldecode($temp);
コード例 #5
0
ファイル: index.php プロジェクト: qwazix/viood
        if (!is_dir($pictureDir . "/" . $requested_path)) {
            $goToImage = basename($requested_path);
            $requested_path = str_replace($goToImage, "", $requested_path);
        }
        $path = $pictureDir . "/" . $requested_path;
        $array = recurse_dir($pictureDir . "/" . $requested_path, $galleries, 1);
        $galleryName = basename($requested_path);
        //    echo $requested_path; die;
        include 'slideshow.php';
        //showcase
    } else {
        if ($requested_path_array[0] == "showcase") {
            $counter = 0;
            $requested_path = str_replace("/showcase/", "", $requested_path);
            $path = $pictureDir . "/" . $requested_path;
            $array = flatten(recurse_dir($pictureDir . "/" . $requested_path, $galleries, 100, false, true));
            shuffle($array);
            $galleryName = basename($requested_path);
            //    echo $requested_path; die;
            include 'showcase.php';
            //gallery
        } else {
            $galleryInfo = getGalleryInfo($pictureDir . "/" . $requested_path);
            $galleryName = "- " . $galleryInfo["name"];
            $array = recurse_dir($pictureDir . "/" . $requested_path, $galleries, 1);
            ksort($array);
            $hasImages = hasImages($array);
            include './gallery.php';
        }
    }
}