aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-11-05 01:25:08 -0800
committerfriendica <info@friendica.com>2012-11-05 01:25:08 -0800
commit2752b58f3323a15b964f6518b7720cb81ccf1b0e (patch)
tree6291006fdbe002d63adcca5a6c369457d10765e3
parent5f85f65dcc71c4fea12a2227b5773b991d19199f (diff)
downloadvolse-hubzilla-2752b58f3323a15b964f6518b7720cb81ccf1b0e.tar.gz
volse-hubzilla-2752b58f3323a15b964f6518b7720cb81ccf1b0e.tar.bz2
volse-hubzilla-2752b58f3323a15b964f6518b7720cb81ccf1b0e.zip
plaintext default - richtext is a feature
-rw-r--r--include/api.php10
-rw-r--r--include/conversation.php6
-rw-r--r--include/features.php2
-rw-r--r--mod/connections.php6
-rw-r--r--mod/editpost.php6
-rw-r--r--mod/item.php2
-rw-r--r--mod/message.php5
-rw-r--r--mod/parse_url.php27
-rw-r--r--mod/profiles.php6
-rw-r--r--mod/wall_attach.php7
-rw-r--r--mod/wall_upload.php18
11 files changed, 31 insertions, 64 deletions
diff --git a/include/api.php b/include/api.php
index 428c17957..ec3e9404a 100644
--- a/include/api.php
+++ b/include/api.php
@@ -480,8 +480,8 @@
return null;
}
-/*Waitman Gobble Mod*/
- function api_statuses_mediap(&$a, $type) {
+
+ function api_statuses_mediap(&$a, $type) {
if (local_user()===false) {
logger('api_statuses_update: no user');
return false;
@@ -508,7 +508,7 @@
$a->argv[1]=$user_info['screen_name']; //should be set to username?
- $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+ $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
require_once('mod/wall_upload.php');
$bebop = wall_upload_post($a);
@@ -521,7 +521,7 @@
return api_status_show($a,$type);
}
api_register_func('api/statuses/mediap','api_statuses_mediap', true);
-/*Waitman Gobble Mod*/
+
function api_statuses_update(&$a, $type) {
@@ -575,7 +575,7 @@
$_REQUEST['type'] = 'wall';
if(x($_FILES,'media')) {
// upload the image if we have one
- $_REQUEST['hush']='yeah'; //tell wall_upload function to return img info instead of echo
+ $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo
require_once('mod/wall_upload.php');
$media = wall_upload_post($a);
if(strlen($media)>0)
diff --git a/include/conversation.php b/include/conversation.php
index e9e550a12..532fe0ba1 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1661,9 +1661,9 @@ function status_editor($a,$x,$popup=false) {
$geotag = (($x['allow_location']) ? get_markup_template('jot_geotag.tpl') : '');
- $plaintext = false;
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
- $plaintext = true;
+ $plaintext = true;
+ if(feature_enabled(local_user(),'richtext'))
+ $plaintext = false;
$tpl = get_markup_template('jot-header.tpl');
diff --git a/include/features.php b/include/features.php
index efd9c3455..dfed4ad02 100644
--- a/include/features.php
+++ b/include/features.php
@@ -26,7 +26,7 @@ array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comme
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use')),
array('preview', t('Post Preview'), t('Preview posts and comments before publishing them')),
array('edit_posts', t('Edit Sent Posts'), t('Edit/correct posts and comments after sending')),
-
+array('richtext', t('Richtext Editor'), t('Use richtext/visual editor where applicable')),
);
call_hooks('get_features',$arr);
diff --git a/mod/connections.php b/mod/connections.php
index 5af8e1212..152395679 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -289,9 +289,9 @@ EOT;
$contact_id = $a->data['abook']['abook_id'];
$contact = $a->data['abook'];
- $editselect = 'exact';
- if(intval(get_pconfig(local_user(),'system','plaintext')))
- $editselect = 'none';
+ $editselect = 'none';
+ if(feature_enabled(local_user(),'richtext'))
+ $editselect = 'exact';
$a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => $a->get_baseurl(true),
diff --git a/mod/editpost.php b/mod/editpost.php
index b705afa4b..73faa59c5 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -28,9 +28,9 @@ function editpost_content(&$a) {
return;
}
- $plaintext = false;
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
- $plaintext = true;
+ $plaintext = true;
+ if(feature_enabled(local_user(),'richtext'))
+ $plaintext = false;
$o .= '<h2>' . t('Edit post') . '</h2>';
diff --git a/mod/item.php b/mod/item.php
index 3e0384aa2..811537be2 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -283,7 +283,7 @@ function item_post(&$a) {
// First figure out if it's a status post that would've been
// created using tinymce. Otherwise leave it alone.
- $plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) : 0);
+ $plaintext = ((feature_enabled($profile_uid,'richtext')) ? false : true);
if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body);
}
diff --git a/mod/message.php b/mod/message.php
index d501f3b54..2e4f175e2 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -50,10 +50,7 @@ function message_post(&$a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 );
- // Work around doubled linefeeds in Tinymce 3.5b2
-
- $plaintext = intval(get_pconfig(local_user(),'system','plaintext'));
- if(! $plaintext) {
+ if(feature_enabled(local_user(),'richtext')) {
$body = fix_mce_lf($body);
}
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 962c3e368..600d3dc8b 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -237,12 +237,8 @@ function parse_url_content(&$a) {
$text = null;
$str_tags = '';
- $textmode = false;
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
- $textmode = true;
- //if($textmode)
- $br = (($textmode) ? "\n" : '<br />');
+ $br = "\n";
if(x($_GET,'binurl'))
$url = trim(hex2bin($_GET['binurl']));
@@ -265,10 +261,7 @@ function parse_url_content(&$a) {
logger('parse_url: ' . $url);
- if($textmode)
- $template = $br . '[url=%s]%s[/url]%s' . $br;
- else
- $template = "<br /><a href=\"%s\" >%s</a>%s<br />";
+ $template = $br . '[url=%s]%s[/url]%s' . $br;
$arr = array('url' => $url, 'text' => '');
@@ -282,10 +275,8 @@ function parse_url_content(&$a) {
if($url && $title && $text) {
- if($textmode)
- $text = $br . '[quote]' . trim($text) . '[/quote]' . $br;
- else
- $text = '<br /><blockquote>' . trim($text) . '</blockquote><br />';
+
+ $text = $br . '[quote]' . trim($text) . '[/quote]' . $br;
$title = str_replace(array("\r","\n"),array('',''),$title);
@@ -320,10 +311,7 @@ function parse_url_content(&$a) {
$max_images = intval($max_images);
foreach ($siteinfo["images"] as $imagedata) {
- if($textmode)
- $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
- else
- $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" /><br />';
+ $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
$total_images ++;
if($max_images && $max_images >= $total_images)
break;
@@ -331,10 +319,7 @@ function parse_url_content(&$a) {
}
if(strlen($text)) {
- if($textmode)
- $text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
- else
- $text = '<br /><blockquote>'.trim($text).'</blockquote><br />';
+ $text = $br.'[quote]'.trim($text).'[/quote]'.$br ;
}
if($image) {
diff --git a/mod/profiles.php b/mod/profiles.php
index f1e67b86b..9661fac69 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -454,9 +454,9 @@ function profiles_content(&$a) {
require_once('include/profile_selectors.php');
- $editselect = 'textareas';
- if(intval(get_pconfig(local_user(),'system','plaintext')))
- $editselect = 'none';
+ $editselect = 'none';
+ if(feature_enabled(local_user(),'richtext'))
+ $editselect = 'textareas';
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => $a->get_baseurl(true),
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index 1b539031b..5d9331ed0 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -135,12 +135,7 @@ function wall_attach_post(&$a) {
killme();
}
- $lf = '<br />';
-
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
- $lf = "\n";
-
- echo $lf . $lf . '[attachment]' . $r[0]['hash'] . '[/attachment]' . $lf;
+ echo "\n\n" . '[attachment]' . $r[0]['hash'] . '[/attachment]' . "\n";
killme();
// NOTREACHED
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index 8abb7e5a7..c695f9b3e 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -155,23 +155,13 @@ function wall_upload_post(&$a) {
$basename = basename($filename);
-/* mod Waitman Gobble NO WARRANTY */
-
-//if we get the signal then return the image url info in BBCODE, otherwise this outputs the info and bails (for the ajax image uploader on wall post)
- if ($_REQUEST['hush']!='yeah') {
-
- /*existing code*/
- if(local_user() && intval(get_pconfig(local_user(),'system','plaintext')))
- echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
- else
- echo '<br /><br /><a href="' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."\" alt=\"$basename\" /></a><br /><br />";
- /*existing code*/
-
- } else {
+ if($_REQUEST['silent']) {
$m = '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m);
}
-/* mod Waitman Gobble NO WARRANTY */
+ else {
+ echo "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . $a->get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
+ }
killme();
// NOTREACHED