139 lines
3.7 KiB
PHP
139 lines
3.7 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">' . "\n";
|
|
echo '<table cellspacing="0" style="width: 97%;">' . "\n";
|
|
|
|
foreach ($bookmarks as $value) {
|
|
echo '<tr class="sh">' . "\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 '<td style="width:' . $column_width_folder . ';">';
|
|
echo '<a class="f" href="./index.php?expand=' . implode (",", $expand) . '&folderid='. $value['fid'] .'#' . $value['fid'] . '">';
|
|
echo $folder_image . " " . $value['name'] . "</a>";
|
|
echo "</td>\n";
|
|
}
|
|
|
|
if ($show_checkbox){
|
|
# the checkbox, needed in any case
|
|
echo '<td class="ten">';
|
|
echo '<input type="checkbox" name="' . $value['id'] . '">';
|
|
echo "</td>\n";
|
|
}
|
|
|
|
# the bookmark image if configured to be displayed
|
|
if ($show_icon){
|
|
echo '<td class="ten">';
|
|
if ($value['favicon'] && is_file ($value['favicon'])) {
|
|
echo '<img src="' . $value['favicon'] . '" width="16" height="16">';
|
|
}
|
|
else {
|
|
echo $bookmark_image;
|
|
}
|
|
echo "</td>\n";
|
|
}
|
|
|
|
# the link if configured to be displayed
|
|
echo '<td>';
|
|
|
|
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 '<div>' . $link . "</div>\n";
|
|
|
|
# the description if configured to be displayed and if not empty
|
|
# thanks to Tim Hogan <tlhogan22@yahoo.com>
|
|
# also display the public status here
|
|
if ($show_desc && $value['description'] != "") {
|
|
echo '<div class="description">' . $value['description'] . "</div>\n";
|
|
}
|
|
echo "</td>\n";
|
|
|
|
if ($show_date) {
|
|
echo '<td class="ten">';
|
|
echo '<div class="date">'. date ($date_formats[$settings['date_format']], $value['timestamp']) .'</div>';
|
|
echo "</td>\n";
|
|
}
|
|
|
|
|
|
if ($show_share) {
|
|
echo '<td class="ten">';
|
|
$share = $value['public'] ? 'public' : 'private';
|
|
echo '<div class="'.$share.'">'.$share.'</div> ';
|
|
echo "</td>\n";
|
|
}
|
|
|
|
|
|
# the edit column if configured to be displayed
|
|
if ($show_edit) {
|
|
echo '<td class="ten">';
|
|
echo '<a href="javascript:bookmarkedit(\'' . $value['id'] . '\')">';
|
|
echo sprintf ($edit_image, "Edit");
|
|
echo "</a></td>\n";
|
|
}
|
|
|
|
# the move column if configured to be displayed
|
|
if ($show_move) {
|
|
echo '<td class="ten">';
|
|
echo '<a href="javascript:bookmarkmove(\'' . $value['id'] . '\', \'' . 'expand=' . implode (",", $expand) . '&folderid=' . $folderid . '\')">';
|
|
echo sprintf ($move_image, "Move");
|
|
echo "</a></td>\n";
|
|
}
|
|
|
|
# the delete column if configured to be displayed
|
|
if ($show_delete) {
|
|
echo '<td class="ten">';
|
|
echo '<a href="javascript:bookmarkdelete(\'' . $value['id'] . '\')">';
|
|
echo sprintf ($delete_image, "Delete");
|
|
echo "</a></td>\n";
|
|
}
|
|
|
|
echo "</tr>\n";
|
|
}
|
|
echo "</table></form>\n";
|
|
}
|
|
|
|
?>
|