Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: FCKEditor for snews 1.7  (Read 7610 times)

Joost

  • Guest
FCKEditor for snews 1.7
« on: June 03, 2009, 04:37:58 AM »

note: This mod works for the FCKeditor 2.x series.

- Download FCKeditor, unpack and upload it to the folder where index.php (sNews) resides.

- find in function form_article() the following lines:

Code: (snews.php) [Select]
<?php


echo html_input('textarea''text''txt'$frm_textl('text'), '''''''''''2''100''''''');
buttons();


?>

remove these, or comment out.
Below add the following lines (without <?php and ?>)


note: This mod works for the FCKeditor 2.x series.
For CKeditor 3.x, scroll further down the page.

Code: (snews.php) [Select]
<?php


require dirname($_SERVER['SCRIPT_FILENAME']) . '/fckeditor/fckeditor.php';
echo '<div class="editor">';
$oFCKeditor = new FCKeditor('text') ;
$oFCKeditor->BasePath './fckeditor/';
$oFCKeditor->Value $r['text'];
$oFCKeditor->Width  '98%' ;
$oFCKeditor->Height '550' ;
$oFCKeditor->ToolbarSet 'Default' ;
$oFCKeditor->Create() ;
echo '</div>';#end fck


?>


You probably want to use the file upload manager as well. If that is the case, you MUST do the following, or else anyone can upload anything to your site! (FCKeditor 2.x)

In connectors/php/config.php replace:

Code: (connectors/php/config.php) [Select]
<?php

$Config
['Enabled'] = false ;

?>

with

Code: (connectors/php/config.php) [Select]
<?php

     $SITE 
'http://localhost/snews17/' #EDIT !!
    
    
session_start();
     
$atoken md5(substr(session_id(), 27));
    
$btoken $_SERVER['HTTP_USER_AGENT'];
    
$token md5($atoken.$btoken.$SITE);
    if( isset(
$_SESSION[$SITE.'Logged_In']) && $_SESSION[$SITE.'Logged_In'] === $token )
        { 
$Config['Enabled'] = true ; }
    else { 
$Config['Enabled'] = false ; } 

?>

edit $SITE.



    -------------------------------------------------------------------------------------------------------------


Replacement for CKeditor 3.x

note: upload directory "ckeditor" to the root

Code: [Select]
<?php


//echo html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
echo '<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
<textarea class="ckeditor" cols="80" id="txt" name="text" rows="10"></textarea>'
;
//buttons();





?>




Enable CKFinder: Its a standalone file mananger

In config.php change function CheckAuthentication to:

Code: [Select]
<?php 

session_start
(); # THIS YOU NEED AS WELL
function CheckAuthentication()
{
 
$SITE 'http://localhost/17/' #EDIT !!

     
$atoken md5(substr(session_id(), 27));
    
$btoken $_SERVER['HTTP_USER_AGENT'];
    
$token md5($atoken.$btoken.$SITE);
    if( isset(
$_SESSION[$SITE.'Logged_In']) && $_SESSION[$SITE.'Logged_In'] === $token ) {
return true;
    }
return false;
}



?>

Edit variable $SITE: Use the path to the site.
More documentation: CKFinder




-------------------------------------------------------------------------
Howto adjust the properties, visit www.fckeditor.net/



FCKEditor is not fully compatible with sNews. So you probably will encounter strange characters here and there.
Solutions can be found tn this thread amongst others.


Oops! I forgot to thank Mosh and Edsil for help and testing.... Thanks.

« Last Edit: October 27, 2009, 03:24:16 PM by Joost »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: FCKEditor for snews 1.7
« Reply #1 on: June 03, 2009, 12:10:44 PM »

Mhm... I found this extremely useful due to the commented text above that enable/disable line... However, for non-coders this might be pointed out... You should remove the <?php--- tag and the ending one -- ?>

Thanks Joosty, Mosh and Edsil for this...
Logged
"It's only dead fish that goes with the flow... "
Updated

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: FCKEditor for snews 1.7
« Reply #2 on: June 03, 2009, 01:36:34 PM »

Could you just test for _ADMIN? ...
I am assuming that the editor will be running in the snews environment.
Logged
Of all the things I have lost, it is my mind that I miss the most.

Joost

  • Guest
Re: FCKEditor for snews 1.7
« Reply #3 on: June 03, 2009, 04:05:00 PM »

Could you just test for _ADMIN? ...
I am assuming that the editor will be running in the snews environment.

Not needed, function form_article(), which calls the editor, is tested.
That's why I chose Mosh's approach.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: FCKEditor for snews 1.7
« Reply #4 on: June 03, 2009, 04:31:02 PM »

Could you just test for _ADMIN? ...
I am assuming that the editor will be running in the snews environment.

Not needed, function form_article(), which calls the editor, is tested.
That's why I chose Mosh's approach.
Not sure I grasp your meaning, and looking at my post, am not sure I was very clear at all...
Code: [Select]
   
    session_start();
     $atoken = md5(substr(session_id(), 2, 7));
    $btoken = $_SERVER['HTTP_USER_AGENT'];
    $token = md5($atoken.$btoken.$SITE);
    if( isset($_SESSION[$SITE.'Logged_In']) && $_SESSION[$SITE.'Logged_In'] === $token )
        { $Config['Enabled'] = true ; }
    else { $Config['Enabled'] = false ; }
Isn't this just a reworking of the _ADMIN constant definition. If so, why not just use
if _ADMIN{true}else{false}
Logged
Of all the things I have lost, it is my mind that I miss the most.

Joost

  • Guest
Re: FCKEditor for snews 1.7
« Reply #5 on: June 03, 2009, 05:15:59 PM »

I see what you mean.
 _ADMIN is not defined in connectors/php/config.php
Of course, I could have chosen to simply check for the existence of $_SESSION[$SITE.'Logged_In'], but verifying its value, is how we do it in sNews.
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: FCKEditor for snews 1.7
« Reply #6 on: June 04, 2009, 12:58:18 PM »

Does it need to be defined there? Isn't the editor being operated in the snews environment?

Wouldn't that make _ADMIN available to that config.php?
Logged
Of all the things I have lost, it is my mind that I miss the most.

Joost

  • Guest
Re: FCKEditor for snews 1.7
« Reply #7 on: June 04, 2009, 03:48:33 PM »

Does it need to be defined there? Isn't the editor being operated in the snews environment?

Wouldn't that make _ADMIN available to that config.php?

connectors/php/config.php is not part of the snews or the fckeditor program flow. It configures a popupscreen showing an upload directory and an upload form.
Here is a demo. Try inserting an image, then you see what I mean.
Logged

Kaito

  • Newbie
  • *
  • Karma: 0
  • Posts: 46
Re: FCKEditor for snews 1.7
« Reply #8 on: October 25, 2009, 11:50:44 AM »

What version of FCKeditor is this topic?

There is CKEditor 3.0.1, released on 16 October 2009

Can't find any thing what You are talking about... after editing snews.php in article funk. it showns nothing :/

Can any one update this topic to CKv301?

Thx

I just started new topic whit new version ...
« Last Edit: October 25, 2009, 12:18:34 PM by Kaito »
Logged

Q5Host_LTD

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
Re: FCKEditor for snews 1.7
« Reply #9 on: March 08, 2010, 04:23:44 AM »

so my problem is when I try to edit news i have to star all over again because they are deleting themself when i press edit there is nothing to edit just empty place to start from the beggining..



PLease i need solution very quick
« Last Edit: March 08, 2010, 07:16:21 PM by Q5Host_LTD »
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: FCKEditor for snews 1.7
« Reply #10 on: November 15, 2010, 03:18:25 PM »

Hello,
That's true.
Very strange thing  ??? ???
When adding CKEditor like Joost method, everything is working BUT there is nothing in the editor !?

Stephane
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: FCKEditor for snews 1.7
« Reply #11 on: November 19, 2010, 03:05:26 PM »

Mhm I'm kind of hijacking this thread in desperation... I've tried both editors now. I've copied it from other locations, I've dl'ed both, I can firstly second Sven's problem, CKeditor empties the article field every time one gets there...

But my problem, which is slowly driving me over the edge here, is the character problem previously debated in other threads, I can't for the life of me get them to be outputted like they should, I'm on UTF-8, snews is set to UTF-8 (I have tried ISO blahaha-1) coll. is utf unicode and that freaking fckconfig.js should be the only place to change settings in in order to make this work... I only get them freaking HTML entities  - I WANNA TURN THIS CRAP OFF... as them HTML entities (ie &Aring; for ) will not outout as , but as &Aring; This is for both editors,,,

Feck, feck, feck, feck... It have always worked before, I'm going nuts here.
Logged
"It's only dead fish that goes with the flow... "
Updated

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: FCKEditor for snews 1.7
« Reply #12 on: November 19, 2010, 03:50:53 PM »

Patric, det kan ha att gra med file_include(la-la-la). Allts samma sak som pverkar hur kodbitar hanteras i artiklar. Har du provat det hr tricket? Har inte testat sjlv men det kan funka.

Quote
//FILE INCLUSION
function file_include($text, $shorten) {
   $fulltext = substr($text, 0, $shorten);
#   if(substr_count ($fulltext, '&')>0){$fulltext = str_replace('&', '&amp;', str_replace('&amp;', '&', $fulltext));}
   if ($shorten < 9999000 && preg_match('<p>',$fulltext)) {
      if (substr_count ($fulltext, '<p>') > substr_count ($fulltext, '</p>')) {
         $fulltext .='</p>';
      }
   }

// It might be caused by the same thing that affects the output of code entered in articles. Have you tried the trick above? Not tested but might work.
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: FCKEditor for snews 1.7
« Reply #13 on: November 19, 2010, 04:01:28 PM »

For this accents problem I just put this in function articles()
Code: [Select]
$infoline = $r['displayinfo'] == 'YES' ? true : false;
$text = stripslashes($r['text']);
//// correction pour CKEditor et accents //////
$text = str_replace('&nbsp;', '&#160;' , $text);
$text = html_entity_decode( $text, ENT_QUOTES, "utf-8" );
/// FIN correction////
if (!empty($currentPage)) {

it's working fine with French accents.
The File inclusion function is the same as above ( Fred K )
« Last Edit: November 19, 2010, 04:09:11 PM by stephane »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: FCKEditor for snews 1.7
« Reply #14 on: November 19, 2010, 04:11:59 PM »

Damn it did it, thanks a million, Sven, K for you. And thanks to you to Fred, although I did try Svens first and it did the trick,.
Logged
"It's only dead fish that goes with the flow... "
Updated
Pages: [1] 2 3