Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1020B

  1. <?php
  2. /**
  3. * @file mod/filer.php
  4. */
  5. use Friendica\App;
  6. use Friendica\Core\L10n;
  7. use Friendica\Core\Logger;
  8. use Friendica\Core\PConfig;
  9. use Friendica\Core\Renderer;
  10. use Friendica\Model\FileTag;
  11. use Friendica\Util\XML;
  12. function filer_content(App $a)
  13. {
  14. if (! local_user()) {
  15. killme();
  16. }
  17. $term = XML::unescape(trim(defaults($_GET, 'term', '')));
  18. $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
  19. Logger::log('filer: tag ' . $term . ' item ' . $item_id);
  20. if ($item_id && strlen($term)) {
  21. // file item
  22. FileTag::saveFile(local_user(), $item_id, $term);
  23. } else {
  24. // return filer dialog
  25. $filetags = PConfig::get(local_user(), 'system', 'filetags');
  26. $filetags = FileTag::fileToList($filetags, 'file');
  27. $filetags = explode(",", $filetags);
  28. $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl");
  29. $o = Renderer::replaceMacros($tpl, [
  30. '$field' => ['term', L10n::t("Save to Folder:"), '', '', $filetags, L10n::t('- select -')],
  31. '$submit' => L10n::t('Save'),
  32. ]);
  33. echo $o;
  34. }
  35. killme();
  36. }