Ejemplo n.º 1
0
    public function action_view()
    {
        $id = $_GET['id'];
        $hmanga = Model::factory('Hmanga')->find_one($id);
        $thumbnails = $hmanga->thumbnails();
        $pages = $hmanga->pages();
        ?>
		
		<dl class="dl-horizontal">
			<dt>Title</dt><dd><a href="<?php 
        echo Fakku::$base . $hmanga->url;
        ?>
"><?php 
        echo $hmanga->title;
        ?>
</a></dd>
			<dt>Series</dt><dd><?php 
        echo $hmanga->series;
        ?>
</dd>
			<dt>Artist</dt><dd><?php 
        echo $hmanga->artist;
        ?>
</dd>
			<dt>Date</dt><dd><?php 
        echo $hmanga->date;
        ?>
</dd>
			<dt>Description</dt><dd><?php 
        echo $hmanga->desc;
        ?>
</dd>
			<dt>Page</dt><dd><?php 
        echo $hmanga->count();
        ?>
</dd>
			<dt>Tags</dt><dd><?php 
        echo str_replace('#', ' ', $hmanga->tags);
        ?>
</dd>
			<dd><a href="<?php 
        echo Fakku::$base . $hmanga->url;
        ?>
">ORIGIN</a></dd>
		</dl>
		
		<?php 
        HH::print_downloads($hmanga->title, $thumbnails, $pages);
    }
Ejemplo n.º 2
0
    public function action_view()
    {
        $id = $_GET['id'];
        $hmanga = Model::factory('Hmanga')->find_one($id);
        $thumbnails = $hmanga->thumbnails();
        $pages = $hmanga->pages();
        ?>
		
		<dl class="dl-horizontal">
			<dt>Title</dt><dd><a href="<?php 
        echo self::$base . $hmanga->url;
        ?>
"><?php 
        echo $hmanga->title;
        ?>
</a></dd>
			<dt>Real ID</dt><dd><?php 
        echo $hmanga->real_id;
        ?>
</dd>
			<dt>Date</dt><dd><?php 
        echo $hmanga->date;
        ?>
</dd>
			<dt>Description</dt><dd><?php 
        echo $hmanga->description;
        ?>
</dd>
			<dt>Page</dt><dd><?php 
        echo $hmanga->pages;
        ?>
</dd>
			<dt>Tags</dt><dd><?php 
        echo str_replace('#', ', ', trim($hmanga->tags, '#'));
        ?>
</dd>
			<dd><a href="<?php 
        echo self::$base . $hmanga->url;
        ?>
">ORIGIN</a></dd>
		</dl>
		
		<?php 
        HH::print_downloads($hmanga->title, $thumbnails, $pages);
    }
Ejemplo n.º 3
0
    public function action_view()
    {
        $id = $_GET['id'];
        $book = Model::factory('Book')->find_one($id);
        $thumbnails = $book->thumbnails();
        $pages = $book->pages();
        ?>
		
		<dl class="dl-horizontal">
			<dt>Title</dt><dd><a href="<?php 
        echo $book->url;
        ?>
"><?php 
        echo $book->title;
        ?>
</a></dd>
			<dt>Date</dt><dd><?php 
        echo $book->date;
        ?>
</dd>
			<dt>Page</dt><dd><?php 
        echo $book->pages;
        ?>
</dd>
			<dt>Tags</dt><dd><?php 
        echo str_replace('#', ', ', trim($book->tags, '#'));
        ?>
</dd>
			<dd><a href="<?php 
        echo $book->url;
        ?>
">ORIGIN</a></dd>
		</dl>
		
		<?php 
        HH::print_downloads($book->title, $thumbnails, $pages);
    }
Ejemplo n.º 4
0
    public function action_search()
    {
        $search = array('any' => explode(' ', @$_REQUEST['any']), 'title' => explode(' ', @$_REQUEST['title']), 'artist' => explode(' ', @$_REQUEST['artist']), 'origin' => explode(' ', @$_REQUEST['origin']), 'tags' => explode(' ', @$_REQUEST['tags']), 'include' => @$_REQUEST['include'], 'exclude' => @$_REQUEST['exclude']);
        $order_choices = array('added desc', 'added asc', 'title asc', 'title desc', 'id desc', 'id asc', 'length asc', 'length desc');
        $order = isset($_REQUEST['order']) ? $_REQUEST['order'] : 'added desc';
        $perpage = isset($_REQUEST['perpage']) ? $_REQUEST['perpage'] : 20;
        $curpage = isset($_REQUEST['curpage']) ? $_REQUEST['curpage'] : 1;
        if (isset($_REQUEST['next'])) {
            $curpage++;
        } else {
            if (isset($_REQUEST['prev'])) {
                $curpage--;
            }
        }
        if ($curpage < 1) {
            $curpage = 1;
        }
        ?>
		<form method="post" class="form-horizontal">
			<div class="form-group row">
				<?php 
        HH::print_form_field('Any', 'any', @$_REQUEST['any']);
        ?>
			
				<?php 
        HH::print_form_field('Title', 'title', @$_REQUEST['title']);
        ?>
			</div>
			<div class="form-group row">
				<?php 
        HH::print_form_field('Artist', 'artist', @$_REQUEST['artist']);
        ?>

				<?php 
        HH::print_form_field('Origin', 'origin', @$_REQUEST['origin']);
        ?>
			</div>
			<div class="form-group row">
				<?php 
        HH::print_form_field('Items', 'perpage', $perpage, 3);
        ?>
				
				<?php 
        HH::print_form_field('Page', 'curpage', $curpage, 3);
        ?>
				
				<?php 
        HH::print_radio_field('Order', 'order', $order_choices, $order);
        ?>
			</div>
			<div class="form-group row">
				<?php 
        HH::print_submit_buttons();
        ?>
			</div>
	<?php 
        $q = Model::factory('Hmanga')->limit($perpage)->offset(($curpage - 1) * $perpage);
        foreach ($order_choices as $choice) {
            if ($order == $choice) {
                list($column, $direction) = explode(' ', $choice);
                if ($direction == 'desc') {
                    $q->order_by_desc($column);
                } else {
                    $q->order_by_asc($column);
                }
            }
        }
        // filter
        foreach ($search['title'] as $term) {
            if ($term) {
                $q->where_like('title', "%{$term}%");
            }
        }
        foreach ($search['origin'] as $term) {
            if ($term) {
                $q->where_like('origin', "%{$term}%");
            }
        }
        foreach ($search['artist'] as $term) {
            if ($term) {
                $q->where_like('artist', "%{$term}%");
            }
        }
        foreach ($search['any'] as $term) {
            if ($term) {
                $q->where_raw('(title LIKE ? OR origin LIKE ? OR artist LIKE ?)', array("%{$term}%", "%{$term}%", "%{$term}%"));
            }
        }
        if (@$_REQUEST['include']) {
            foreach ($_REQUEST['include'] as $key => $vals) {
                foreach ($vals as $val) {
                    $q->where_like($key, "%#{$val}#%");
                }
            }
        }
        if (@$_REQUEST['exclude']) {
            foreach ($_REQUEST['exclude'] as $key => $vals) {
                foreach ($vals as $val) {
                    $q->where_not_like($key, "%#{$val}#%");
                }
            }
        }
        $result = $q->find_many();
        $ref = $this->get_ref();
        ?>
			<?php 
        foreach ($result as $i => $hmanga) {
            ?>
				<?php 
            if ($i % 2 == 0) {
                echo '<div class="row">';
            }
            ?>
				<div class="col-md-6 result">
					<?php 
            $samples = $hmanga->samples();
            ?>
					<a href="<?php 
            echo HH::url($this, "action=view&id={$hmanga->id}");
            ?>
">
						<img src="<?php 
            echo $samples[0];
            ?>
" alt="th">
						<img src="<?php 
            echo $samples[1];
            ?>
" alt="th">
					</a>

					<dl class="dl-horizontal result">
						<dt>Title</dt><dd><a href="<?php 
            echo HH::url($this, "action=view&id={$hmanga->id}");
            ?>
"><?php 
            echo $hmanga->title;
            ?>
</a></dd>
						<dt>Origin</dt><dd><?php 
            echo $hmanga->origin;
            ?>
</dd>
						<dt>Artist</dt><dd><?php 
            echo $hmanga->artist;
            ?>
</dd>
						<dt>Date</dt><dd><?php 
            echo $hmanga->added;
            ?>
</dd>
						<dt>Page</dt><dd><?php 
            echo $hmanga->length;
            ?>
</dd>
						<dt>Tags</dt><dd><?php 
            echo str_replace('#', ' ', $hmanga->type);
            ?>
</dd>
						<dt><a href="<?php 
            echo HH::url($this, "action=view&id={$hmanga->id}");
            ?>
">VIEW</a></dt>
						<dd><a href="<?php 
            echo $hmanga->link;
            ?>
">ORIGIN</a></dd>
					</dl>
				</div>
				<?php 
            if ($i % 2 == 1) {
                echo '</div>';
            }
            ?>
			<?php 
        }
        ?>
			
			<div class="form-group row" style="display:block;clear:both">
				<?php 
        HH::print_submit_buttons();
        ?>
			</div>

			<table border="2">
				<tr valign="top">
				<?php 
        $i = 0;
        ?>
				<?php 
        foreach ($ref as $key => $vals) {
            $i++;
            ?>
					<td>
					<table>
						<tr>
							<th><?php 
            echo $key;
            ?>
</th>
							<th>V</th>
							<th>X</th>
						</tr>
						<?php 
            foreach ($vals as $val) {
                ?>
							<tr>
								<td><?php 
                echo $val;
                ?>
</td>
								<td><input type="checkbox" name="include[<?php 
                echo $key;
                ?>
][]" value="<?php 
                echo $val;
                ?>
" <?php 
                if (in_array($val, (array) @$_REQUEST['include'][$key])) {
                    echo 'checked';
                }
                ?>
/></td>
								<td><input type="checkbox" name="exclude[<?php 
                echo $key;
                ?>
][]" value="<?php 
                echo $val;
                ?>
" <?php 
                if (in_array($val, (array) @$_REQUEST['exclude'][$key])) {
                    echo 'checked';
                }
                ?>
/></td>
							</tr>
						<?php 
            }
            ?>
					</table>
					</td>
					<?php 
            if ($i % 6 == 0) {
                ?>
				</tr>
				<tr valign="top">
					<?php 
            }
            ?>
				<?php 
        }
        ?>
				</tr>
			</table>
			<input type="submit" value="search" />
		</form>
		<?php 
    }