- Remove $theme_richtext_editor boot var

- Remove "richtext" feature
- Remove fix_mce_lf() function
- Remove nomce parameter
This commit is contained in:
Hypolite Petovan 2017-01-26 22:57:53 -05:00
parent 4ad6a7f073
commit 66482c1d9c
11 changed files with 36 additions and 115 deletions

View file

@ -530,7 +530,6 @@ class App {
public $videoheight = 350; public $videoheight = 350;
public $force_max_items = 0; public $force_max_items = 0;
public $theme_thread_allow = true; public $theme_thread_allow = true;
public $theme_richtext_editor = true;
public $theme_events_in_profile = true; public $theme_events_in_profile = true;
/** /**

View file

@ -11,11 +11,6 @@
* @return boolean * @return boolean
*/ */
function feature_enabled($uid, $feature) { function feature_enabled($uid, $feature) {
if (($feature == 'richtext') AND !get_app()->theme_richtext_editor) {
return false;
}
$x = get_config('feature_lock', $feature); $x = get_config('feature_lock', $feature);
if ($x === false) { if ($x === false) {
@ -35,7 +30,7 @@ function feature_enabled($uid, $feature) {
/** /**
* @brief check if feature is enabled or disabled by default * @brief check if feature is enabled or disabled by default
* *
* @param string $feature * @param string $feature
* @return boolean * @return boolean
*/ */
@ -52,13 +47,13 @@ function get_feature_default($feature) {
/** /**
* @brief Get a list of all available features * @brief Get a list of all available features
* *
* The array includes the setting group, the setting name, * The array includes the setting group, the setting name,
* explainations for the setting and if it's enabled or disabled * explainations for the setting and if it's enabled or disabled
* by default * by default
* *
* @param bool $filtered True removes any locked features * @param bool $filtered True removes any locked features
* *
* @return array * @return array
*/ */
function get_features($filtered = true) { function get_features($filtered = true) {
@ -77,7 +72,6 @@ function get_features($filtered = true) {
// Post composition // Post composition
'composition' => array( 'composition' => array(
t('Post Composition Features'), t('Post Composition Features'),
array('richtext', t('Richtext Editor'), t('Enable richtext editor'), false, get_config('feature_lock','richtext')),
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, get_config('feature_lock','preview')), array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, get_config('feature_lock','preview')),
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, get_config('feature_lock','aclautomention')), array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, get_config('feature_lock','aclautomention')),
), ),
@ -142,11 +136,6 @@ function get_features($filtered = true) {
} }
} }
// Remove the richtext editor setting if the theme doesn't support it
if (!get_app()->theme_richtext_editor) {
unset($arr['composition'][1]);
}
call_hooks('get_features',$arr); call_hooks('get_features',$arr);
return $arr; return $arr;
} }

View file

@ -2045,13 +2045,6 @@ function undo_post_tagging($s) {
return $s; return $s;
} }
function fix_mce_lf($s) {
$s = str_replace("\r\n","\n",$s);
// $s = str_replace("\n\n","\n",$s);
return $s;
}
function protect_sprintf($s) { function protect_sprintf($s) {
return(str_replace('%','%%',$s)); return(str_replace('%','%%',$s));
} }
@ -2073,17 +2066,19 @@ function is_a_date_arg($s) {
/** /**
* remove intentation from a text * remove intentation from a text
*/ */
function deindent($text, $chr="[\t ]", $count=NULL) { function deindent($text, $chr = "[\t ]", $count = NULL) {
$text = fix_mce_lf($text);
$lines = explode("\n", $text); $lines = explode("\n", $text);
if (is_null($count)) { if (is_null($count)) {
$m = array(); $m = array();
$k=0; while($k<count($lines) && strlen($lines[$k])==0) $k++; $k = 0;
preg_match("|^".$chr."*|", $lines[$k], $m); while ($k < count($lines) && strlen($lines[$k]) == 0) {
$k++;
}
preg_match("|^" . $chr . "*|", $lines[$k], $m);
$count = strlen($m[0]); $count = strlen($m[0]);
} }
for ($k=0; $k<count($lines); $k++){ for ($k=0; $k < count($lines); $k++) {
$lines[$k] = preg_replace("|^".$chr."{".$count."}|", "", $lines[$k]); $lines[$k] = preg_replace("|^" . $chr . "{" . $count . "}|", "", $lines[$k]);
} }
return implode("\n", $lines); return implode("\n", $lines);

View file

@ -191,13 +191,13 @@ function contacts_post(App $a) {
$fetch_further_information = intval($_POST['fetch_further_information']); $fetch_further_information = intval($_POST['fetch_further_information']);
$ffi_keyword_blacklist = fix_mce_lf(escape_tags(trim($_POST['ffi_keyword_blacklist']))); $ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
$priority = intval($_POST['poll']); $priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0) if($priority > 5 || $priority < 0)
$priority = 0; $priority = 0;
$info = fix_mce_lf(escape_tags(trim($_POST['info']))); $info = escape_tags(trim($_POST['info']));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s', $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
`hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d, `hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d,

View file

@ -353,20 +353,6 @@ function item_post(App $a) {
$categories .= file_tag_list_to_file($filedas, 'file'); $categories .= file_tag_list_to_file($filedas, 'file');
} }
// Work around doubled linefeeds in Tinymce 3.5b2
// 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')) || !feature_enabled($profile_uid,'richtext') : 0);
if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body);
}*/
$plaintext = (local_user() ? !feature_enabled($profile_uid,'richtext') : 0);
if((! $parent) && (! $api_source) && (! $plaintext)) {
$body = fix_mce_lf($body);
}
// get contact info for poster // get contact info for poster
$author = null; $author = null;

View file

@ -52,17 +52,6 @@ function message_post(App $a) {
$body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : ''); $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
$recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 ); $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto']) : 0 );
// Work around doubled linefeeds in Tinymce 3.5b2
/* $plaintext = intval(get_pconfig(local_user(),'system','plaintext') && !feature_enabled(local_user(),'richtext'));
if(! $plaintext) {
$body = fix_mce_lf($body);
}*/
$plaintext = intval(!feature_enabled(local_user(),'richtext'));
if(! $plaintext) {
$body = fix_mce_lf($body);
}
$ret = send_message($recipient, $body, $subject, $replyto); $ret = send_message($recipient, $body, $subject, $replyto);
$norecip = false; $norecip = false;

View file

@ -4,13 +4,8 @@
* @file mod/parse_url.php * @file mod/parse_url.php
* @brief The parse_url module * @brief The parse_url module
* *
* This module does parse an url for embedable content (audio, video, image files or link) * This module does parse an url for embeddable content (audio, video, image files or link)
* information and does format this information to BBCode or html (this depends * information and does format this information to BBCode
* on the user settings - default is BBCode output).
* If the user has enabled the richtext editor setting the output will be in html
* (Note: This is not always possible and in some case not useful because
* the richtext editor doesn't support all kind of html).
* Otherwise the output will be constructed BBCode.
* *
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content * @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/ */
@ -24,13 +19,7 @@ function parse_url_content(App $a) {
$text = null; $text = null;
$str_tags = ""; $str_tags = "";
$textmode = false; $br = "\n";
if (local_user() && (!feature_enabled(local_user(), "richtext"))) {
$textmode = true;
}
$br = (($textmode) ? "\n" : "<br />");
if (x($_GET,"binurl")) { if (x($_GET,"binurl")) {
$url = trim(hex2bin($_GET["binurl"])); $url = trim(hex2bin($_GET["binurl"]));
@ -97,11 +86,7 @@ function parse_url_content(App $a) {
} }
} }
if ($textmode) { $template = "[bookmark=%s]%s[/bookmark]%s";
$template = "[bookmark=%s]%s[/bookmark]%s";
} else {
$template = "<a class=\"bookmark\" href=\"%s\" >%s</a>%s";
}
$arr = array("url" => $url, "text" => ""); $arr = array("url" => $url, "text" => "");
@ -118,12 +103,7 @@ function parse_url_content(App $a) {
$title = str_replace(array("\r","\n"),array("",""),$title); $title = str_replace(array("\r","\n"),array("",""),$title);
if ($textmode) { $text = "[quote]" . trim($text) . "[/quote]" . $br;
$text = "[quote]" . trim($text) . "[/quote]" . $br;
} else {
$text = "<blockquote>" . htmlspecialchars(trim($text)) . "</blockquote><br />";
$title = htmlspecialchars($title);
}
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags; $result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
@ -141,11 +121,6 @@ function parse_url_content(App $a) {
// Format it as BBCode attachment // Format it as BBCode attachment
$info = add_page_info_data($siteinfo); $info = add_page_info_data($siteinfo);
if (!$textmode) {
// Replace ' with - not perfect - but the richtext editor has problems otherwise
$info = str_replace(array("&#039;"), array("&#8217;"), $info);
}
echo $info; echo $info;
killme(); killme();

View file

@ -313,19 +313,19 @@ function profiles_post(App $a) {
$politic = notags(trim($_POST['politic'])); $politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion'])); $religion = notags(trim($_POST['religion']));
$likes = fix_mce_lf(escape_tags(trim($_POST['likes']))); $likes = escape_tags(trim($_POST['likes']));
$dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes']))); $dislikes = escape_tags(trim($_POST['dislikes']));
$about = fix_mce_lf(escape_tags(trim($_POST['about']))); $about = escape_tags(trim($_POST['about']));
$interest = fix_mce_lf(escape_tags(trim($_POST['interest']))); $interest = escape_tags(trim($_POST['interest']));
$contact = fix_mce_lf(escape_tags(trim($_POST['contact']))); $contact = escape_tags(trim($_POST['contact']));
$music = fix_mce_lf(escape_tags(trim($_POST['music']))); $music = escape_tags(trim($_POST['music']));
$book = fix_mce_lf(escape_tags(trim($_POST['book']))); $book = escape_tags(trim($_POST['book']));
$tv = fix_mce_lf(escape_tags(trim($_POST['tv']))); $tv = escape_tags(trim($_POST['tv']));
$film = fix_mce_lf(escape_tags(trim($_POST['film']))); $film = escape_tags(trim($_POST['film']));
$romance = fix_mce_lf(escape_tags(trim($_POST['romance']))); $romance = escape_tags(trim($_POST['romance']));
$work = fix_mce_lf(escape_tags(trim($_POST['work']))); $work = escape_tags(trim($_POST['work']));
$education = fix_mce_lf(escape_tags(trim($_POST['education']))); $education = escape_tags(trim($_POST['education']));
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);

View file

@ -277,16 +277,10 @@ function wall_upload_post(App $a, $desktopmode = true) {
/* mod Waitman Gobble NO WARRANTY */ /* 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 we get the signal then return the image url info in BBCODE
if ($_REQUEST['hush']!='yeah') { if ($_REQUEST['hush']!='yeah') {
if(local_user() && (! feature_enabled(local_user(),'richtext') || x($_REQUEST['nomce'])) ) { echo "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n";
echo "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n"; } else {
}
else {
echo '<br /><br /><a href="' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '" ><img src="' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."\" alt=\"$basename\" /></a><br /><br />";
}
}
else {
$m = '[url='.App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.App::get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; $m = '[url='.App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.App::get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m); return($m);
} }

View file

@ -43,12 +43,6 @@ function wallmessage_post(App $a) {
return; return;
} }
// Work around doubled linefeeds in Tinymce 3.5b2
$body = str_replace("\r\n","\n",$body);
$body = str_replace("\n\n","\n",$body);
$ret = send_wallmessage($user, $body, $subject, $replyto); $ret = send_wallmessage($user, $body, $subject, $replyto);
switch($ret){ switch($ret){

View file

@ -30,7 +30,7 @@ $(document).ready(function() {
if(typeof window.AjaxUpload != "undefined") { if(typeof window.AjaxUpload != "undefined") {
var uploader = new window.AjaxUpload( var uploader = new window.AjaxUpload(
window.imageUploadButton, window.imageUploadButton,
{ action: 'wall_upload/'+window.nickname+'?nomce=1', { action: 'wall_upload/' + window.nickname,
name: 'userfile', name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) { onComplete: function(file,response) {
@ -43,7 +43,7 @@ $(document).ready(function() {
if($('#wall-file-upload').length) { if($('#wall-file-upload').length) {
var file_uploader = new window.AjaxUpload( var file_uploader = new window.AjaxUpload(
'wall-file-upload', 'wall-file-upload',
{ action: 'wall_attach/'+window.nickname+'?nomce=1', { action: 'wall_attach/' + window.nickname,
name: 'userfile', name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) { onComplete: function(file,response) {