home.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?php
  2. /**
  3. * Insipid
  4. * Personal web-bookmark-system
  5. *
  6. * Copyright 2016-2019 Johannes Keßler
  7. *
  8. * Development starting from 2011: Johannes Keßler
  9. * https://www.bananas-playground.net/projekt/insipid/
  10. *
  11. * creator:
  12. * Luke Reeves <luke@neuro-tech.net>
  13. *
  14. * This program is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation, either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.
  26. *
  27. */
  28. ?>
  29. <section class="section">
  30. <div class="columns">
  31. <div class="column">
  32. <form method="post" action="index.php">
  33. <input type="hidden" name="password" />
  34. <input type="hidden" name="username" />
  35. <div class="field has-addons">
  36. <div class="control is-expanded">
  37. <div class="control has-icons-left">
  38. <input class="input" type="text" name="data[searchfield]" placeholder="Search your bookmarks or add a new one">
  39. <span class="icon is-small is-left">
  40. <i class="ion-link"></i>
  41. </span>
  42. </div>
  43. </div>
  44. <div class="control">
  45. <input type="submit" class="button is-info" value="Search" name="submitsearch">
  46. </div>
  47. </div>
  48. </form>
  49. </div>
  50. <div class="column">
  51. <p class="has-text-right">
  52. <a href="index.php?p=overview&m=tag" title="all tags" class="button">
  53. <span class="icon"><i class="ion-md-pricetags"></i></span>
  54. </a>
  55. <a href="index.php?p=overview&m=category" title="all categories" class="button">
  56. <span class="icon"><i class="ion-md-filing"></i></span>
  57. </a>
  58. <a href="index.php" title="... back to home" class="button">
  59. <span class="icon"><i class="ion-md-home"></i></span>
  60. </a>
  61. </p>
  62. </div>
  63. </div>
  64. <?php require('_displaySubmitStatus.inc.php'); ?>
  65. </section>
  66. <?php if(!empty($searchResult)) { ?>
  67. <section class="section">
  68. <div class="columns">
  69. <div class="column">
  70. <div class="content">
  71. <h3>Something has been found...</h3>
  72. <div class="field is-grouped is-grouped-multiline">
  73. <?php foreach ($searchResult as $sr) { ?>
  74. <div class="control">
  75. <div class="tags has-addons">
  76. <a class="tag is-dark" href="<?php echo $sr['link']; ?>" target="_blank" ><?php echo $sr['title']; ?></a>
  77. <a class="tag is-info" title="more details..." href="index.php?p=linkinfo&id=<?php echo $sr['hash']; ?>" ><i class="ion-md-information-circle-outline"></i></a>
  78. </div>
  79. </div>
  80. <?php } ?>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </section>
  86. <?php } ?>
  87. <?php if($showAddForm) { ?>
  88. <section class="section">
  89. <form method="post">
  90. <input type="hidden" name="password" />
  91. <input type="hidden" name="username" />
  92. <div class="columns">
  93. <div class="column">
  94. <div class="content">
  95. <h3>This URL was not found. Want to add it?</h3>
  96. </div>
  97. <div class="field has-addons">
  98. <div class="control is-expanded">
  99. <div class="control has-icons-left">
  100. <input type="url" name="data[url]" class="input" value="<?php echo Summoner::ifset($formData, 'url'); ?>" />
  101. <span class="icon is-small is-left">
  102. <i class="ion-link"></i>
  103. </span>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="columns">
  110. <div class="column is-half">
  111. <div class="field">
  112. <label class="label">Title</label>
  113. <div class="control">
  114. <input class="input" type="text" name="data[title]" value="<?php echo Summoner::ifset($formData, 'title'); ?>" />
  115. </div>
  116. </div>
  117. </div>
  118. <div class="column is-half">
  119. <div class="field">
  120. <label class="label">Description</label>
  121. <div class="control">
  122. <input class="input" type="text" name="data[description]" value="<?php echo Summoner::ifset($formData, 'description'); ?>" />
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="columns">
  128. <div class="column is-half">
  129. <img class="linkthumbnail" src="<?php echo Summoner::ifset($formData, 'imageToShow'); ?>" alt="Image from provided link" />
  130. </div>
  131. <div class="column is-half">
  132. <div class="field">
  133. <label class="label">Image Link</label>
  134. <div class="control">
  135. <input class="input" type="url" name="data[image]" value="<?php echo Summoner::ifset($formData, 'image'); ?>" />
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="columns">
  141. <div class="column is-half">
  142. <label class="label">Category</label>
  143. <div class="control">
  144. <input type="text" name="data[category]" list="categorylist"
  145. class="flexdatalist input" multiple='multiple'
  146. data-min-length="0" data-cache="0"
  147. value="<?php echo Summoner::ifset($formData, 'category'); ?>" />
  148. <datalist id="categorylist">
  149. <?php foreach($existingCategories as $c) { ?>
  150. <option value="<?php echo $c['name']; ?>"><?php echo $c['name']; ?></option>
  151. <?php } ?>
  152. </datalist>
  153. </div>
  154. </div>
  155. <div class="column is-half">
  156. <label class="label">Tag</label>
  157. <div class="control">
  158. <input type="text" name="data[tag]" list="taglist"
  159. class="flexdatalist input" multiple='multiple'
  160. data-min-length="0" data-cache="0"
  161. value="<?php echo Summoner::ifset($formData, 'tag'); ?>" />
  162. <datalist id="taglist">
  163. <?php foreach($existingTags as $t) { ?>
  164. <option value="<?php echo $t['name']; ?>"><?php echo $t['name']; ?></option>
  165. <?php } ?>
  166. </datalist>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="columns">
  171. <div class="column is-half">
  172. <label class="checkbox is-pulled-right">
  173. <input type="checkbox" name="data[private]" value="1" <?php if(Summoner::ifset($formData, 'private')) echo "checked"; ?> />
  174. Private
  175. </label>
  176. </div>
  177. <div class="column is-half">
  178. <div class="control">
  179. <input type="submit" class="button is-primary" name="addnewone" value="Add new Link">
  180. </div>
  181. </div>
  182. </div>
  183. </form>
  184. </section>
  185. <link rel="stylesheet" href="asset/css/jquery.flexdatalist.min.css">
  186. <script type="text/javascript" src="asset/js/jquery.min.js"></script>
  187. <script type="text/javascript" src="asset/js/jquery.flexdatalist.min.js"></script>
  188. <?php } ?>
  189. <section class="section">
  190. <div class="columns">
  191. <div class="column">
  192. <div class="content">
  193. <h4><a href="index.php?p=overview&m=all">Last added</a></h4>
  194. <?php if(!empty($latestLinks)) { ?>
  195. <div class="tags">
  196. <?php foreach ($latestLinks as $ll) { ?>
  197. <a class="tag is-link" href="<?php echo $ll['link']; ?>" target="_blank"><?php echo $ll['title']; ?></a>
  198. <?php } ?>
  199. </div>
  200. <?php } ?>
  201. </div>
  202. </div>
  203. </div>
  204. </section>
  205. <section class="section">
  206. <div class="columns is-multiline">
  207. <?php
  208. if(!empty($orderedCategories)) {
  209. foreach ($orderedCategories as $k=>$v) {
  210. $links = $Management->linksByCategory($v['id'],false);
  211. ?>
  212. <div class="column is-one-quarter">
  213. <div class="content">
  214. <h4><a href="?p=overview&m=category&id=<?php echo urlencode($v['id']); ?>"><?php echo $v['name']; ?></a></h4>
  215. <ul>
  216. <?php foreach ($links['results'] as $link) { ?>
  217. <li><a class="" href="<?php echo $link['link']; ?>" target="_blank"><?php echo $link['title']; ?></a></li>
  218. <?php } ?>
  219. </ul>
  220. </div>
  221. </div>
  222. <?php
  223. }
  224. }
  225. ?>
  226. </div>
  227. </section>