home.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <?php
  2. /**
  3. * Insipid
  4. * Personal web-bookmark-system
  5. *
  6. * Copyright 2016-2020 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" autocomplete=off>
  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="field is-grouped is-grouped-multiline" id="category-listbox">
  144. <div class="control" id="category-template" style="display: none;">
  145. <div class="tags has-addons">
  146. <span class="tag"></span>
  147. <a class="tag is-delete" onclick="removeTag('','category')"></a>
  148. </div>
  149. </div>
  150. <?php foreach($formData['categories'] as $t) { ?>
  151. <div class="control" id="category-<?php echo $t; ?>">
  152. <div class="tags has-addons">
  153. <span class="tag"><?php echo $t; ?></span>
  154. <a class="tag is-delete" onclick="removeTag('<?php echo $t; ?>','category')"></a>
  155. </div>
  156. </div>
  157. <?php } ?>
  158. </div>
  159. <div class="field">
  160. <div class="control">
  161. <input type="text" placeholder="categoryname"
  162. name="categorylistinput" list="category-datalist" value="" onkeypress="addTag(event,'category')" />
  163. </div>
  164. <p class="help">Enter a new one or select an existing from the suggested and press enter.</p>
  165. </div>
  166. <datalist id="category-datalist">
  167. <?php foreach($existingCategories as $c) { ?>
  168. <option value="<?php echo $c['name']; ?>"><?php echo $c['name']; ?></option>
  169. <?php } ?>
  170. </datalist>
  171. <input type="hidden" name="data[category]" id="category-save" value="<?php echo implode(',',$formData['categories']); ?>" />
  172. </div>
  173. <div class="column is-half">
  174. <label class="label">Tag</label>
  175. <div class="field is-grouped is-grouped-multiline" id="tag-listbox">
  176. <div class="control" id="tag-template" style="display: none;">
  177. <div class="tags has-addons">
  178. <span class="tag"></span>
  179. <a class="tag is-delete" onclick="removeTag('','tag')"></a>
  180. </div>
  181. </div>
  182. <?php foreach($formData['tags'] as $t) { ?>
  183. <div class="control" id="tag-<?php echo $t; ?>">
  184. <div class="tags has-addons">
  185. <span class="tag"><?php echo $t; ?></span>
  186. <a class="tag is-delete" onclick="removeTag('<?php echo $t; ?>','tag')"></a>
  187. </div>
  188. </div>
  189. <?php } ?>
  190. </div>
  191. <div class="field">
  192. <div class="control">
  193. <input type="text" placeholder="tagname"
  194. name="taglistinput" list="tag-datalist" value="" onkeypress="addTag(event,'tag')" />
  195. </div>
  196. <p class="help">Enter a new one or select an existing from the suggested and press enter.</p>
  197. </div>
  198. <datalist id="tag-datalist">
  199. <?php foreach($existingTags as $t) { ?>
  200. <option value="<?php echo $t['name']; ?>"><?php echo $t['name']; ?></option>
  201. <?php } ?>
  202. </datalist>
  203. <input type="hidden" name="data[tag]" id="tag-save" value="<?php echo implode(',',$formData['tags']); ?>" />
  204. </div>
  205. </div>
  206. <div class="columns">
  207. <div class="column is-half">
  208. <label class="checkbox is-pulled-right">
  209. <input type="checkbox" name="data[private]" value="1" <?php if(Summoner::ifset($formData, 'private')) echo "checked"; ?> />
  210. Private
  211. </label>
  212. </div>
  213. <div class="column is-half">
  214. <div class="control">
  215. <input type="submit" class="button is-primary" name="addnewone" value="Add new Link">
  216. </div>
  217. </div>
  218. </div>
  219. </form>
  220. </section>
  221. <script type="text/javascript" src="asset/js/editlink.js"></script>
  222. <?php } ?>
  223. <section class="section">
  224. <div class="columns">
  225. <div class="column">
  226. <div class="content">
  227. <h4><a href="index.php?p=overview&m=all">Last added</a></h4>
  228. <?php if(!empty($latestLinks)) { ?>
  229. <div class="tags">
  230. <?php foreach ($latestLinks as $ll) { ?>
  231. <a class="tag is-link" href="<?php echo $ll['link']; ?>" target="_blank"><?php echo $ll['title']; ?></a>
  232. <?php } ?>
  233. </div>
  234. <?php } ?>
  235. </div>
  236. </div>
  237. </div>
  238. </section>
  239. <section class="section">
  240. <div class="columns is-multiline">
  241. <?php
  242. if(!empty($orderedCategories)) {
  243. foreach ($orderedCategories as $k=>$v) {
  244. $links = $Management->linksByCategory($v['id'],'');
  245. ?>
  246. <div class="column is-one-quarter">
  247. <div class="content">
  248. <h4><a href="?p=overview&m=category&id=<?php echo urlencode($v['id']); ?>"><?php echo $v['name']; ?></a></h4>
  249. <ul>
  250. <?php foreach ($links['results'] as $link) { ?>
  251. <li><a class="" href="<?php echo $link['link']; ?>" target="_blank"><?php echo $link['title']; ?></a></li>
  252. <?php } ?>
  253. </ul>
  254. </div>
  255. </div>
  256. <?php
  257. }
  258. }
  259. ?>
  260. </div>
  261. </section>