1
1
Fork 0

- 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 $force_max_items = 0;
public $theme_thread_allow = true;
public $theme_richtext_editor = true;
public $theme_events_in_profile = true;
/**

View file

@ -11,11 +11,6 @@
* @return boolean
*/
function feature_enabled($uid, $feature) {
if (($feature == 'richtext') AND !get_app()->theme_richtext_editor) {
return false;
}
$x = get_config('feature_lock', $feature);
if ($x === false) {
@ -35,7 +30,7 @@ function feature_enabled($uid, $feature) {
/**
* @brief check if feature is enabled or disabled by default
*
*
* @param string $feature
* @return boolean
*/
@ -52,13 +47,13 @@ function get_feature_default($feature) {
/**
* @brief Get a list of all available features
*
*
* The array includes the setting group, the setting name,
* explainations for the setting and if it's enabled or disabled
* by default
*
*
* @param bool $filtered True removes any locked features
*
*
* @return array
*/
function get_features($filtered = true) {
@ -77,7 +72,6 @@ function get_features($filtered = true) {
// Post composition
'composition' => array(
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('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);
return $arr;
}

View file

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

View file

@ -191,13 +191,13 @@ function contacts_post(App $a) {
$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']);
if($priority > 5 || $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',
`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');
}
// 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
$author = null;

View file

@ -52,17 +52,6 @@ function message_post(App $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') && !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);
$norecip = false;

View file

@ -4,13 +4,8 @@
* @file mod/parse_url.php
* @brief The parse_url module
*
* This module does parse an url for embedable content (audio, video, image files or link)
* information and does format this information to BBCode or html (this depends
* 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.
* This module does parse an url for embeddable content (audio, video, image files or link)
* information and does format this information to BBCode
*
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/
@ -24,13 +19,7 @@ function parse_url_content(App $a) {
$text = null;
$str_tags = "";
$textmode = false;
if (local_user() && (!feature_enabled(local_user(), "richtext"))) {
$textmode = true;
}
$br = (($textmode) ? "\n" : "<br />");
$br = "\n";
if (x($_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";
} else {
$template = "<a class=\"bookmark\" href=\"%s\" >%s</a>%s";
}
$template = "[bookmark=%s]%s[/bookmark]%s";
$arr = array("url" => $url, "text" => "");
@ -118,12 +103,7 @@ function parse_url_content(App $a) {
$title = str_replace(array("\r","\n"),array("",""),$title);
if ($textmode) {
$text = "[quote]" . trim($text) . "[/quote]" . $br;
} else {
$text = "<blockquote>" . htmlspecialchars(trim($text)) . "</blockquote><br />";
$title = htmlspecialchars($title);
}
$text = "[quote]" . trim($text) . "[/quote]" . $br;
$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
$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;
killme();

View file

@ -313,19 +313,19 @@ function profiles_post(App $a) {
$politic = notags(trim($_POST['politic']));
$religion = notags(trim($_POST['religion']));
$likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
$dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
$likes = escape_tags(trim($_POST['likes']));
$dislikes = escape_tags(trim($_POST['dislikes']));
$about = fix_mce_lf(escape_tags(trim($_POST['about'])));
$interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
$contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
$music = fix_mce_lf(escape_tags(trim($_POST['music'])));
$book = fix_mce_lf(escape_tags(trim($_POST['book'])));
$tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
$film = fix_mce_lf(escape_tags(trim($_POST['film'])));
$romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
$work = fix_mce_lf(escape_tags(trim($_POST['work'])));
$education = fix_mce_lf(escape_tags(trim($_POST['education'])));
$about = escape_tags(trim($_POST['about']));
$interest = escape_tags(trim($_POST['interest']));
$contact = escape_tags(trim($_POST['contact']));
$music = escape_tags(trim($_POST['music']));
$book = escape_tags(trim($_POST['book']));
$tv = escape_tags(trim($_POST['tv']));
$film = escape_tags(trim($_POST['film']));
$romance = escape_tags(trim($_POST['romance']));
$work = escape_tags(trim($_POST['work']));
$education = escape_tags(trim($_POST['education']));
$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 */
//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(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";
}
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 {
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 {
$m = '[url='.App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.App::get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
return($m);
}

View file

@ -43,12 +43,6 @@ function wallmessage_post(App $a) {
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);
switch($ret){

View file

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