index.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. require_once ("./header.php");
  3. logged_in_only ();
  4. $search = set_get_string_var ('search');
  5. if ($search != '') {
  6. $search_mode = true;
  7. }
  8. else {
  9. $search_mode = false;
  10. }
  11. $order = set_get_order ();
  12. ?>
  13. <h1 id="caption"><?php echo $username; ?>&#039;s Online Bookmarks</h1>
  14. <!-- Wrapper starts here. -->
  15. <div style="min-width: <?php echo 230 + $settings['column_width_folder']; ?>px;">
  16. <!-- Menu starts here. -->
  17. <div id="menu">
  18. <h2 class="nav">Search</h2>
  19. <ul class="nav">
  20. <li>
  21. <form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="GET" class="nav">
  22. <input type="text" name="search" size="8" value="<?php echo $search; ?>">
  23. <input type="submit" value="Go" name="submit">
  24. </form>
  25. </li>
  26. </ul>
  27. <h2 class="nav">Bookmarks</h2>
  28. <ul class="nav">
  29. <?php if ($search_mode) { ?>
  30. <li><a href="./index.php"><?php echo $settings['root_folder_name']; ?></a></li>
  31. <?php } ?>
  32. <li><a href="javascript:bookmarknew('<?php echo $folderid; ?>')">New Bookmark</a></li>
  33. <li><a href="javascript:bookmarkedit(checkselected())">Edit Bookmarks</a></li>
  34. <li><a href="javascript:bookmarkmove(checkselected())">Move Bookmarks</a></li>
  35. <li><a href="javascript:bookmarkdelete(checkselected())">Delete Bookmarks</a></li>
  36. <li><a href="./shared.php">Shared Bookmarks</a></li>
  37. </ul>
  38. <h2 class="nav">Folders</h2>
  39. <ul class="nav">
  40. <li><a href="javascript:foldernew('<?php echo $folderid; ?>')">New Folder</a></li>
  41. <li><a href="javascript:folderedit('<?php echo $folderid; ?>')">Edit Folder</a></li>
  42. <li><a href="javascript:foldermove('<?php echo $folderid; ?>')">Move Folder</a></li>
  43. <li><a href="javascript:folderdelete('<?php echo $folderid; ?>')">Delete Folder</a></li>
  44. <li><a href="./index.php?expand=&amp;folderid=0">Collapse All</a></li>
  45. </ul>
  46. <h2 class="nav">Tools</h2>
  47. <ul class="nav">
  48. <?php if (admin_only ()) { ?>
  49. <li><a href="./admin.php">Admin</a></li>
  50. <?php } ?>
  51. <li><a href="./import.php">Import</a></li>
  52. <li><a href="./export.php">Export</a></li>
  53. <li><a href="./sidebar.php">View as Sidebar</a></li>
  54. <li><a href="./settings.php">Settings</a></li>
  55. <li><a href="./index.php?logout=1">Logout</a></li>
  56. </ul>
  57. <!-- Menu ends here. -->
  58. </div>
  59. <!-- Main content starts here. -->
  60. <div id="main">
  61. <?php if ($search_mode): ?>
  62. <div style="height: <?php echo $table_height; ?>; overflow:auto;">
  63. <div class="bookmark">
  64. <a class="f" href="./index.php"><img src="./images/folder_open.gif" alt=""> My Bookmarks</a>
  65. </div>
  66. <?php
  67. require_once ('./lib/BooleanSearch.php');
  68. $searchfields = array ('url', 'title', 'description');
  69. $query = assemble_query ($search, $searchfields);
  70. if ($mysql->query ($query)) {
  71. $bookmarks = array ();
  72. while ($row = mysqli_fetch_assoc ($mysql->result)) {
  73. array_push ($bookmarks, $row);
  74. }
  75. if (count ($bookmarks) > 0) {
  76. require_once (ABSOLUTE_PATH . "bookmarks.php");
  77. list_bookmarks ($bookmarks,
  78. true,
  79. true,
  80. $settings['show_bookmark_icon'],
  81. true,
  82. $settings['show_bookmark_description'],
  83. $settings['show_column_date'],
  84. $settings['show_column_edit'],
  85. $settings['show_column_move'],
  86. $settings['show_column_delete'],
  87. $settings['show_public'],
  88. false);
  89. }
  90. else {
  91. echo '<div id="content"> No Bookmarks found matching <b>' . $search . '</b>.</div>';
  92. }
  93. }
  94. else {
  95. message ($mysql->error);
  96. }
  97. ?>
  98. </div>
  99. <?php else: ?>
  100. <!-- Folders starts here. -->
  101. <div class="folders" style="width: <?php echo $column_width_folder; ?>; height: <?php echo $table_height; ?>;">
  102. <?php
  103. require_once (ABSOLUTE_PATH . "folders.php");
  104. $tree = new folder;
  105. $tree->make_tree (0);
  106. $tree->print_tree ();
  107. ?>
  108. <!-- Folders ends here. -->
  109. </div>
  110. <!-- Bookmarks starts here. -->
  111. <div class="bookmarks" style="height: <?php echo $table_height; ?>;">
  112. <?php
  113. require_once (ABSOLUTE_PATH . "bookmarks.php");
  114. $query = sprintf ("SELECT title, url, description, UNIX_TIMESTAMP(date) AS timestamp, id, favicon, public
  115. FROM bookmark
  116. WHERE user='%s'
  117. AND childof='%d'
  118. AND deleted!='1'
  119. ORDER BY $order[1]",
  120. $mysql->escape ($username),
  121. $mysql->escape ($folderid));
  122. if ($mysql->query ($query)) {
  123. $bookmarks = array ();
  124. while ($row = mysqli_fetch_assoc ($mysql->result)) {
  125. array_push ($bookmarks, $row);
  126. }
  127. list_bookmarks ($bookmarks,
  128. true,
  129. false,
  130. $settings['show_bookmark_icon'],
  131. true,
  132. $settings['show_bookmark_description'],
  133. $settings['show_column_date'],
  134. $settings['show_column_edit'],
  135. $settings['show_column_move'],
  136. $settings['show_column_delete'],
  137. $settings['show_public'],
  138. true);
  139. }
  140. else {
  141. message ($mysql->error);
  142. }
  143. ?>
  144. <!-- Bookmarks ends here. -->
  145. </div>
  146. <?php endif; ?>
  147. <!-- Main content ends here. -->
  148. </div>
  149. <!-- Wrapper ends here. -->
  150. </div>
  151. <?php
  152. print_footer ();
  153. require_once (ABSOLUTE_PATH . "footer.php");
  154. ?>