aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ItemObject.php9
-rw-r--r--include/conversation.php3
-rw-r--r--js/main.js31
-rw-r--r--mod/photos.php3
-rw-r--r--view/theme/redbasic/js/redbasic.js30
-rwxr-xr-xview/tpl/comment_item.tpl21
6 files changed, 55 insertions, 42 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 818f8c0b2..6dbb38564 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -27,6 +27,7 @@ class Item extends BaseObject {
private $threaded = false;
private $visiting = false;
private $channel = null;
+ private $cipher = 'aes256';
public function __construct($data) {
$a = $this->get_app();
@@ -34,6 +35,10 @@ class Item extends BaseObject {
$this->data = $data;
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
+ $cipher = get_pconfig($x['profile_uid'],'system','default_cipher');
+ if($cipher)
+ $this->cipher = $cipher;
+
// Prepare the children
if(count($data['children'])) {
@@ -538,7 +543,11 @@ class Item extends BaseObject {
'$edvideo' => t('Video'),
'$preview' => ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''),
'$indent' => $indent,
+ '$feature_encrypt' => ((feature_enabled($conv->get_profile_owner(),'content_encrypt')) ? true : false),
+ '$encrypt' => t('Encrypt text'),
+ '$cipher' => $this->cipher,
'$sourceapp' => get_app()->sourcename
+
));
return $comment_box;
diff --git a/include/conversation.php b/include/conversation.php
index 59ca24d41..e2a4a0723 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -532,9 +532,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$items = $cb['items'];
- $cmnt_tpl = get_markup_template('comment_item.tpl');
- $hide_comments_tpl = get_markup_template('hide_comments.tpl');
-
$alike = array();
$dlike = array();
diff --git a/js/main.js b/js/main.js
index 22b2571d0..29e408e64 100644
--- a/js/main.js
+++ b/js/main.js
@@ -49,6 +49,37 @@
$("#comment-edit-text-" + id).val(tmpStr + ins);
}
+
+ function insertbbcomment(comment,BBcode,id) {
+ // allow themes to override this
+ if(typeof(insertFormatting != 'undefined'))
+ return(insertFormatting(comment,BBcode,id));
+
+ var tmpStr = $("#comment-edit-text-" + id).val();
+ if(tmpStr == comment) {
+ tmpStr = "";
+ $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
+ $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
+ openMenu("comment-edit-submit-wrapper-" + id);
+ $("#comment-edit-text-" + id).val(tmpStr);
+ }
+
+ textarea = document.getElementById("comment-edit-text-" +id);
+ if (document.selection) {
+ textarea.focus();
+ selected = document.selection.createRange();
+ selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
+ } else if (textarea.selectionStart || textarea.selectionStart == "0") {
+ var start = textarea.selectionStart;
+ var end = textarea.selectionEnd;
+ textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
+ }
+ return true;
+ }
+
+
+
+
function qCommentInsert(obj,id) {
var tmpStr = $("#comment-edit-text-" + id).val();
if(tmpStr == aStr['comment']) {
diff --git a/mod/photos.php b/mod/photos.php
index fe5777fe9..72084665c 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1079,7 +1079,8 @@ function photos_content(&$a) {
'$comment' => t('Comment'),
'$submit' => t('Submit'),
'$preview' => t('Preview'),
- '$ww' => ''
+ '$ww' => '',
+ '$feature_encrypt' => false
));
}
}
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index a97e906bf..e40a94fcc 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -1,35 +1,5 @@
-function insertFormatting(comment,BBcode,id) {
-
- var tmpStr = $("#comment-edit-text-" + id).val();
- if(tmpStr == comment) {
- tmpStr = "";
- $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
- $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
- openMenu("comment-edit-submit-wrapper-" + id);
- $("#comment-edit-text-" + id).val(tmpStr);
- }
-
- textarea = document.getElementById("comment-edit-text-" +id);
- if (document.selection) {
- textarea.focus();
- selected = document.selection.createRange();
- if (BBcode == "url"){
- selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
- } else
- selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
- } else if (textarea.selectionStart || textarea.selectionStart == "0") {
- var start = textarea.selectionStart;
- var end = textarea.selectionEnd;
- if (BBcode == "url"){
- textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
- } else
- textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
- }
- return true;
-}
-
function cmtBbOpen(comment, id) {
if($(comment).hasClass('comment-edit-text-full')) {
$(".comment-edit-bb-" + id).show();
diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl
index 7b6113105..fb08624f2 100755
--- a/view/tpl/comment_item.tpl
+++ b/view/tpl/comment_item.tpl
@@ -18,28 +18,33 @@
<ul class="comment-edit-bb-{{$id}}">
<li><i class="icon-bold shadow comment-icon"
style="cursor: pointer;" title="{{$edbold}}"
- onclick="insertFormatting('{{$comment}}','b', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','b', {{$id}});"></i></li>
<li><i class="icon-italic shadow comment-icon"
style="cursor: pointer;" title="{{$editalic}}"
- onclick="insertFormatting('{{$comment}}','i', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','i', {{$id}});"></i></li>
<li><i class="icon-underline shadow comment-icon"
style="cursor: pointer;" title="{{$eduline}}"
- onclick="insertFormatting('{{$comment}}','u', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','u', {{$id}});"></i></li>
<li><i class="icon-quote-left shadow comment-icon"
style="cursor: pointer;" title="{{$edquote}}"
- onclick="insertFormatting('{{$comment}}','quote', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','quote', {{$id}});"></i></li>
<li><i class="icon-terminal shadow comment-icon"
style="cursor: pointer;" title="{{$edcode}}"
- onclick="insertFormatting('{{$comment}}','code', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','code', {{$id}});"></i></li>
<li><i class="icon-camera shadow comment-icon"
style="cursor: pointer;" title="{{$edimg}}"
- onclick="insertFormatting('{{$comment}}','img', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','img', {{$id}});"></i></li>
<li><i class="icon-link shadow comment-icon"
style="cursor: pointer;" title="{{$edurl}}"
- onclick="insertFormatting('{{$comment}}','url', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','url', {{$id}});"></i></li>
<li><i class="icon-facetime-video shadow comment-icon"
style="cursor: pointer;" title="{{$edvideo}}"
- onclick="insertFormatting('{{$comment}}','video', {{$id}});"></i></li>
+ onclick="insertbbcomment('{{$comment}}','video', {{$id}});"></i></li>
+ {{if $feature_encrypt}}
+ <li><i class="icon-key shadow comment-icon"
+ style="cursor: pointer;" title="{{$encrypt}}"
+ onclick="red_encrypt('{{$cipher}}','#comment-edit-text-' + {{$id}},''); return false;"></i></li>
+ {{/if}}
</ul>
<div class="comment-edit-bb-end"></div>
<textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});" >{{$comment}}</textarea>