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.

151 lines
4.3 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. <?php
  2. require_once('include/acl_selectors.php');
  3. function editpost_content(App $a) {
  4. $o = '';
  5. if (! local_user()) {
  6. notice( t('Permission denied.') . EOL);
  7. return;
  8. }
  9. $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
  10. if (! $post_id) {
  11. notice( t('Item not found') . EOL);
  12. return;
  13. }
  14. $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
  15. intval($post_id),
  16. intval(local_user())
  17. );
  18. if (! dbm::is_result($itm)) {
  19. notice( t('Item not found') . EOL);
  20. return;
  21. }
  22. $o .= replace_macros(get_markup_template("section_title.tpl"),array(
  23. '$title' => t('Edit post')
  24. ));
  25. $tpl = get_markup_template('jot-header.tpl');
  26. $a->page['htmlhead'] .= replace_macros($tpl, array(
  27. '$baseurl' => App::get_baseurl(),
  28. '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
  29. '$geotag' => $geotag,
  30. '$nickname' => $a->user['nickname']
  31. ));
  32. $tpl = get_markup_template('jot-end.tpl');
  33. $a->page['end'] .= replace_macros($tpl, array(
  34. '$baseurl' => App::get_baseurl(),
  35. '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
  36. '$geotag' => $geotag,
  37. '$nickname' => $a->user['nickname']
  38. ));
  39. $tpl = get_markup_template("jot.tpl");
  40. if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
  41. $lockstate = 'lock';
  42. else
  43. $lockstate = 'unlock';
  44. $jotplugins = '';
  45. $jotnets = '';
  46. $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
  47. $mail_enabled = false;
  48. $pubmail_enabled = false;
  49. if(! $mail_disabled) {
  50. $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
  51. intval(local_user())
  52. );
  53. if (dbm::is_result($r)) {
  54. $mail_enabled = true;
  55. if(intval($r[0]['pubmail']))
  56. $pubmail_enabled = true;
  57. }
  58. }
  59. // I don't think there's any need for the $jotnets when editing the post,
  60. // and including them makes it difficult for the JS-free theme, so let's
  61. // disable them
  62. /* if($mail_enabled) {
  63. $selected = (($pubmail_enabled) ? ' checked="checked" ' : '');
  64. $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> '
  65. . t("Post to Email") . '</div>';
  66. }*/
  67. call_hooks('jot_tool', $jotplugins);
  68. //call_hooks('jot_networks', $jotnets);
  69. //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
  70. $o .= replace_macros($tpl,array(
  71. '$is_edit' => true,
  72. '$return_path' => $_SESSION['return_url'],
  73. '$action' => 'item',
  74. '$share' => t('Save'),
  75. '$upload' => t('Upload photo'),
  76. '$shortupload' => t('upload photo'),
  77. '$attach' => t('Attach file'),
  78. '$shortattach' => t('attach file'),
  79. '$weblink' => t('Insert web link'),
  80. '$shortweblink' => t('web link'),
  81. '$video' => t('Insert video link'),
  82. '$shortvideo' => t('video link'),
  83. '$audio' => t('Insert audio link'),
  84. '$shortaudio' => t('audio link'),
  85. '$setloc' => t('Set your location'),
  86. '$shortsetloc' => t('set location'),
  87. '$noloc' => t('Clear browser location'),
  88. '$shortnoloc' => t('clear location'),
  89. '$wait' => t('Please wait'),
  90. '$permset' => t('Permission settings'),
  91. '$ptyp' => $itm[0]['type'],
  92. '$content' => undo_post_tagging($itm[0]['body']),
  93. '$post_id' => $post_id,
  94. '$baseurl' => App::get_baseurl(),
  95. '$defloc' => $a->user['default-location'],
  96. '$visitor' => 'none',
  97. '$pvisit' => 'none',
  98. '$emailcc' => t('CC: email addresses'),
  99. '$public' => t('Public post'),
  100. '$jotnets' => $jotnets,
  101. '$title' => htmlspecialchars($itm[0]['title']),
  102. '$placeholdertitle' => t('Set title'),
  103. '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
  104. '$placeholdercategory' => (feature_enabled(local_user(),'categories') ? t('Categories (comma-separated list)') : ''),
  105. '$emtitle' => t('Example: bob@example.com, mary@example.com'),
  106. '$lockstate' => $lockstate,
  107. '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
  108. '$bang' => (($group) ? '!' : ''),
  109. '$profile_uid' => $_SESSION['uid'],
  110. '$preview' => t('Preview'),
  111. '$jotplugins' => $jotplugins,
  112. '$sourceapp' => t($a->sourcename),
  113. '$cancel' => t('Cancel'),
  114. '$rand_num' => random_digits(12),
  115. //jot nav tab (used in some themes)
  116. '$message' => t('Message'),
  117. '$browser' => t('Browser'),
  118. '$shortpermset' => t('permissions'),
  119. ));
  120. return $o;
  121. }