1
0
Files
online-bookmarks/bookmarks.php

136 lines
3.6 KiB
PHP

<?php
if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
die ("no direct access allowed");
}
function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share) {
global $folderid,
$expand,
$settings,
$column_width_folder,
$bookmark_image,
$edit_image,
$move_image,
$delete_image,
$folder_opened,
$folder_opened_public,
$date_formats;
if ($show_folder) {
require_once (ABSOLUTE_PATH . "folders.php");
$tree = & new folder;
}
echo '<form name="bookmarks" action="">' . "\n";
foreach ($bookmarks as $value) {
echo '<div class="bookmark">' . "\n";
# the folders, only needed when searching for bookmarks
if ($show_folder) {
if ($value['fid'] == null) {
$value['name'] = $settings['root_folder_name'];
$value['fid'] = 0;
}
if ($value['fpublic']) {
$folder_image = $folder_opened_public;
}
else {
$folder_image = $folder_opened;
}
$expand = $tree->get_path_to_root ($value['fid']);
echo "\t" . '<div style="width:' . $column_width_folder . '; float: left;">';
echo '<a class="f" href="./index.php?expand=' . implode (",", $expand) . '&folderid='. $value['fid'] .'#' . $value['fid'] . '">';
echo $folder_image . " " . $value['name'] . "</a>";
echo "</div>\n";
}
# the checkbox and favicon section
echo "\t" . '<div class="bmleft">' . "\n";
# the checkbox
if ($show_checkbox){
echo "\t\t" . '<input class="link" type="checkbox" name="' . $value['id'] . '">' . "\n";
}
# the favicon
echo "\t\t";
if ($show_icon){
if ($value['favicon'] && is_file ($value['favicon'])) {
echo '<img src="' . $value['favicon'] . '" width="16" height="16">';
}
else {
echo $bookmark_image;
}
}
echo "\n\t</div>\n";
# the share, date and edit/move/delete icon section
echo "\t" . '<div class="bmright">' . "\n";
if ($show_share) {
$share = $value['public'] ? 'public' : 'private';
echo "\t\t" . '<span class="' . $share . '">' . $share . "</span>\n";
}
if ($show_date) {
echo "\t\t" . '<span class="date">';
echo date ($date_formats[$settings['date_format']], $value['timestamp']);
echo "\t</span>\n";
}
# the edit column
if ($show_edit) {
echo "\t\t" . '<a href="javascript:bookmarkedit(\'' . $value['id'] . '\')">';
echo sprintf ($edit_image, "Edit");
echo "</a>\n";
}
# the move column
if ($show_move) {
echo "\t\t" . '<a href="javascript:bookmarkmove(\'' . $value['id'] . '\', \'' . 'expand=' . implode (",", $expand) . '&amp;folderid=' . $folderid . '\')">';
echo sprintf ($move_image, "Move");
echo "</a>\n";
}
# the delete column
if ($show_delete) {
echo "\t\t" . '<a href="javascript:bookmarkdelete(\'' . $value['id'] . '\')">';
echo sprintf ($delete_image, "Delete");
echo "</a>\n";
}
echo "\t</div>\n";
# the link
if ($settings['open_new_window']) {
$target = ' target="_blank"';
}
else {
$target = null;
}
if ($show_link){
$link = '<a href="' . $value['url'] . '" title="' . $value['url'] . '"' . $target . '>' . $value['title'] . "</a>";
}
else {
$link = $value['title'];
}
echo "\t" . '<div class="link">' . $link . "</div>\n";
# the description and if not empty
if ($show_desc && $value['description'] != "") {
if ($show_folder) {
$css_extension = ' style="margin-left: ' . $column_width_folder . ';"';
}
else {
$css_extension = "";
}
echo "\t" . '<div class="description"' . $css_extension . '>' . $value['description'] . "</div>\n";
}
echo "</div>\n\n";
}
echo "</form>\n";
}
?>