Joomla editor removes HTML tags in administrator screen

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
elbro001
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Sep 10, 2012 11:31 pm

Joomla editor removes HTML tags in administrator screen

Post by elbro001 » Sun Jan 13, 2013 12:16 pm

Hello,

I have been searching forums to find a solution to this but I can only find solutions relevant to Joomla 1.5 not 2.5.

I have been modifying a component to include a mass mail function where by you can select from a list of all the users and post the same message.
The reason I do not wish to use the standard Joomla mass mail is that I would like the functionality to select specific users and also I have email templates which have my logo embedded, a background and an opening line which changes names for each user.

Everything works fine apart from when I specify text for the body of the message - all HTML tags are removed.
Even the most basic ones like

Code: Select all

<p> Test </p><p>New Line</p>
They get displayed like this

Code: Select all

<p>Test New Line</p>
As a brief work around for new lines I have substituted a replace function so i must specify [p] and [/p] which then get replaced afterwards.

All my filtering is turned off and I am able to edit using HTML in articles, just not in the admin menu.

I have had a look at using JREQUEST_ALLOWHTML for the getVar function, but I get a service error 500.

The only code which seems to be able to pick up my message is:

Code: Select all

$message =& JTable::getInstance('message', 'Table');
I do not wish to modify the Joomla core files to somehow remove filtering as this will put my site in a vulnerable state.

the code for the controller of my component in the admin site is:

Code: Select all

function massMail(){
		// Check for request forgeries
		JRequest::checkToken() or jexit('Invalid Token');
		
		$Itemid = JRequest::getInt('Itemid');
		$now = JFactory::getDate();
		$user 	= JFactory::getUser();
		$post   = JRequest::get('post');
		
		$message =& JTable::getInstance('message', 'Table');
		//$message = JRequest::getVar('message', '', 'POST', 'string');
		
		//take all recipients in array
		$recipients = JRequest::getVar('id_categ');
		//$recipient = JRequest::getVar('recipient', '', 'POST', 'string');		
		
		foreach($recipients as $recipient){
				
				$recipientInfo = JFactory::getUser($recipient);		//get the recipient info from the recipient's username
				
				//check if the recipient info is valid/username exists
				if(empty($recipientInfo)){
					$msg = JText::_('COM_JBLANCE_INVALID_USERNAME');
					//$link	= JRoute::_('index.php?option=com_jblance&view=admproject&layout=dashboard', false);
					$link	= JRoute::_('index.php?option=com_jblance&view=admproject&layout=mail', false);
					
					$this->setRedirect($link, $msg, 'error');
					return false;
				}
				
				$message->date_sent = $now->toMySQL();
				$message->idFrom = $user->id;
				$message->idTo = $recipientInfo->id;
				
				//save the file attachment `if` checked
				$chkAttach = JRequest::getVar('chk-attach', 0, 'POST', 'int');
				$attachedFile = JRequest::getVar('attached-file', '', 'POST', 'string');
				
				if($chkAttach){
					$message->attachment = $attachedFile;
				}
				else {
					$attFile = explode(';', $attachedFile);
					$filename = $attFile[1];
					$delete = JBMESSAGE_PATH.DS.$filename;
					unlink($delete);
				}
				
				if(!$message->save($post)){
					JError::raiseError(500, $message->getError());
				}
				
				//send PM notification email
				$jbmail = JblanceHelper::get('helper.email');		// create an instance of the class EmailHelper
				$post['idFrom'] = $user->id;
				$post['idTo'] = $recipientInfo->id;
				$jbmail->massMailNotification($post);
				
				$msg	= JText::_('COM_JBLANCE_MESSAGE_SENT_SUCCESSFULLY');
				$return	= JRoute::_('index.php?option=com_jblance&view=admproject&layout=dashboard', false);
				$this->setRedirect($return, $msg);
			}
	
	
	}
I have tried this with the TinyMCE, JCE and the standard text area and the problem persists.

Any help would be appreciated

Kind Regards,
Dave

Locked

Return to “Extensions for Joomla! 2.5”