Пример #1
0
function display_each_ebook($directory, $name)
{
    $check_thumb = check_thumb_exists(urldecode($directory . $name));
    echo '<td id = "thumbnail_container" width = "14%">
			<img rel ="images" id = "' . $directory . $name . '" src = "' . \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . $directory . rtrim($name, 'pdf') . 'png' . '">	
		</td>';
    echo '<td class = "filename svg" width = "86%">
			<a class="name" href="http://localhost' . \OCP\Util::linkTo('files', 'download.php') . '?file=' . $directory . $name . '" title="' . urldecode($name) . '" dir ="' . $directory . $name . '" value  = "' . $check_thumb . '">
				<span class = "nametext">' . htmlspecialchars(urldecode($name)) . '</span>
			</a>
			<div id = "displaybox">';
    $each_row = find_tags_for_ebook(urldecode($directory) . urldecode($name));
    $tags = explode(",", $each_row);
    $tag_count = 1;
    foreach ($tags as $tag) {
        if ($tag_count == 2) {
            echo ", ";
        }
        echo '<a href = "' . \OCP\Util::linkTo('reader', 'fetch_tags.php') . '?tag=' . $tag . '">' . ucwords($tag) . '</a>';
        $tag_count += 1;
    }
    echo '</div>
			<input type="button" class="start" value="Add Tag">
			<div id="contentbox" contenteditable="true"></div>
		</td>';
}
function display_each_ebook($directory, $name)
{
    $check_thumb = check_thumb_exists(urldecode($directory . $name));
    echo '<td id = "thumbnail_container" width = "14%">
			<img rel ="images" id = "' . $directory . $name . '" src = "' . \OCP\Util::linkTo('reader', 'ajax/thumbnail.php') . '&filepath=' . $directory . rtrim($name, 'pdf') . 'png' . '" value = "' . $check_thumb . '">	
		</td>';
    echo '<td class = "filename svg" width = "86%">
			<a class="name" href="http://localhost' . \OCP\Util::linkTo('files', 'download.php') . '?file=' . $directory . $name . '" title="' . urldecode($name) . '" dir = "' . urldecode($directory . $name) . '">
				<span class = "nametext">' . htmlspecialchars(urldecode($name)) . '</span>
			</a>';
    $each_row = find_tags_for_ebook(urldecode($directory) . urldecode($name));
    $tags = explode(",", $each_row);
    if (count($tags) < 5) {
        echo '<form action = "apps/reader/ajax/tags.php" id="TagForm">
				<input type="text" name="tag" placeholder="Add Tag..." />
				<input type="submit" value="Add Tag" />
				</form>';
    }
    if (count($tags) >= 1) {
        echo '<div id="result">';
        foreach ($tags as $tag) {
            if ($tag != '') {
                echo '<div class = "each_result">';
                echo '<a id = "each_tag" href = "' . \OCP\Util::linkTo('reader', 'fetch_tags.php') . '?tag=' . $tag . '">' . ucwords($tag) . '</a>';
                echo '<a id = "close" value = "' . $tag . '">x</a></div>';
            }
        }
        echo '</div>';
    }
    echo '</td>';
}
Пример #3
0
function update_tag_for_ebook($new_tag, $path_of_ebook)
{
    $tags = find_tags_for_ebook($path_of_ebook);
    $each_tag = explode(",", $tags);
    if (count($each_tag) < 5) {
        $stmt = OCP\DB::prepare("UPDATE `*PREFIX*eBook_library` SET `tags` = ? WHERE `filepath` = ?");
        $stmt->execute(array($new_tag, $path_of_ebook));
    } else {
        return;
    }
}
Пример #4
0
<?php

include 'apps/reader/lib/tag_utils.php';
$path_of_ebook = $_POST['path'];
$new_tag = $_POST['tag'];
$path_of_ebook = urldecode($path_of_ebook);
$tags = find_tags_for_ebook($path_of_ebook);
if ($tags != NULL) {
    $new_tag = $tags . "," . $new_tag;
    update_tag_for_ebook($new_tag, $path_of_ebook);
} else {
    insert_new_tag($new_tag, $path_of_ebook);
}
Пример #5
0
<?php

include 'reader/lib/tag_utils.php';
$filepath = $_POST['filepath'];
$tag_toBeRemv = $_POST['tag'];
$tags = find_tags_for_ebook($filepath);
$arr = explode(',', $tags);
$arr2 = array();
foreach ($arr as $a) {
    if (strcmp($a, $tag_toBeRemv) != 0) {
        $arr2[] = $a;
    }
}
$new_tags = implode(",", $arr2);
update_tag_for_ebook($new_tags, $filepath);