Install the HTML editor plug-in after pligg9.7beta is set up (the configuration and modification of FCKeditor supports Chinese file names in disguise)

Source: Internet
Author: User

Install the HTML editor plug-in after pligg9.7beta is set up (FCKeditor configuration and modification in disguise support the Chinese file name: cannot be called after the default upload), just like the csdn Editor

It's not that I resend the article, but that csdn blog won't let me publish it !!, I don't know what went wrong.
I saved it this time (click the third one on the left of the Editor), and finally I encountered the last article drop. I tried to restore my previous submission ,!! Always show Wait writeblog.csdn.net... Is not show content, all blank! Like writing a new article .. The person in charge of csdn can see why my article was lost again. I think this is not an accident !!

Similar articles: Install the post-HTML editor plug-in of pligg9.7beta (tinymce_2_00001_1) (and some solutions to problems encountered during use)
Address: http://blog.csdn.net/clin003/archive/2007/08/18/1749260.aspx
By clin003 from http://clin003.com or http://blog.csdn.net/clin003/
Because of the double quotation marks of tinymce (but it was not a problem with tinymce later found) and the header truncation of "add to" in pligg9.7beta: Double quotation marks appear in the source code of the page, the Digg connection is messy. I haven't seen how to solve it yet.

:

------------- By clin003 at 20070830 ---------------------------------------

Download FCKeditor first.
Decompress --> upload the FCKeditor folder to -->/pligg directory/plugins. (We recommend that you upload the FCKeditor file after the configuration is complete if you want to customize the FCKeditor file ).
Next, open the submit_step_2.tpl Template under the/templates/yget/directory where/pligg is located.
{Config_load file = "/libs/lang. conf "}

{Config_load file = "/libs/lang. conf "}

After (probably in the first line) Add:

{Literal} <SCRIPT type = "text/JavaScript" src = "/beta/plugins/FCKeditor. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">

Window. onload = function ()
{
// Automatically calculates the editor base path based on the _ samples directory.
// This is usefull only for these samples. A real application shoshould use something like this:
// Ofckeditor. basepath = '/beta/plugins/FCKeditor/'; // '/FCKeditor/' is the default value.

VaR ofckeditor = new FCKeditor ('bodytext ');
Ofckeditor. basepath = '/beta/plugins/FCKeditor /';
Ofckeditor. value = 'this hello .';
Ofckeditor. width = '000000 ';
Ofckeditor. Height = '20140901 ';
Ofckeditor. replacetextarea ();
}

</Script >{/ literal}

The basepath here is your FCKeditor directory, width defines the editor width, height is the height, replacetextarea replaces the original edit box (here it involves the different methods used by FCKeditor, I will not give an example, although this method is not recommended, it is suitable for pligg ).
More parameters:
Refer to FCKeditor. js and Google's Chinese meaning.
This step is almost ready for use.
If tinymce has been installed before, you may have modified pligg. pl. It is recommended to modify the original file (or directly overwrite the original file ).

---------------------
If you are in trouble with the following modifications, you can download my packaged FCKeditor: http://clin003.com/bbeta/fckeditor2.4.3.rar
After the download, you can directly refer to the above steps to support visual editors in PHP (pligg9.7beta), including uploading images, videos with Chinese names, and other custom files to the server.

The following describes how to modify FCKeditor (which can solve some problems encountered after the above installation is complete ):
I use PHP, so I need to modify some places.
1. Find in fckconfig. js

VaR _ filebrowserlanguage = 'php'; // ASP | aspx | CFM | lasso | Perl | PHP | py
VaR _ quickuploadlanguage = 'php'; // ASP | aspx | CFM | lasso | PHP

Modify the parameter to PhP.
By clin003 from http://clin003.com or http://blog.csdn.net/clin003/
2. Add a font

Fckconfig. fontnames = '; _ gb2312; Arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

Modify it here.

3. Modify the Default Editor button

Fckconfig. toolbarsets ["default"] = [
['Source', 'docprops', '-', 'save', 'newpage', 'preview', '-', 'templates'],
['Cut ', 'copy', 'paste', 'pastetext ', 'pasteword','-', 'spellcheck'],
['Undo ', 'redo', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat'],
'/',
['Bold ', 'italic', 'underline', 'strikethangout', '-', 'subscript', 'superscript'],
['Orderedlist', 'unorderedlist', '-', 'outdent ', 'indent'],
['Justifyleft', 'justifycenter', 'justifyright', 'justifyfull'],
['Link', 'unlink', 'anchor '],
['Image', 'flash', 'table', 'rule', 'smilil', 'specialchar ', 'pagebreak'],
['Textcolor', 'bgcolor'],
'/',
['Style', 'fontformat', 'fontname', 'fontsize']
];

Modify the settings here. I have made some modifications. Please modify them as needed.

4. Find the config. php file in the directory -- FCKeditor-Editor-filemanager-browser-default-connectors-PHP.

$ Config ['enabled'] = true; // edit by clin003 for Use PHP Lang

$ Date_time_arrayss = getdate (Time ());
$ Dddfiles = $ date_time_arrayss ["mon"]. $ date_time_arrayss ["year"];

// Path to user files relative to the document root.
$ Config ['userfilespath'] = '/beta/userfiles/'. $ dddfiles. '/'; // edit by clin003 use time for subdir

Refer to my modifications and the instructions for me after the // number. See
The main purpose is to use time to name and upload files (to prevent Chinese names from being recognized by browsers)

5. Find the config. php file in the directory -- FCKeditor-Editor-filemanager-upload-PHP -.


$ Config ['enabled'] = true;

// Set if the file type must be considere in the target path.
// Ex:/userfiles/image/or/userfiles/file/
$ Config ['usefiletype'] = true;
// Add By clin003 for submunu for files
$ Date_time_arrayss = getdate (Time ());
$ Dddfiles = $ date_time_arrayss ["mon"]. $ date_time_arrayss ["year"];
// Add By clin003 for submunu for files useing time number.

// Path to uploaded files relative to the document root.
$ Config ['userfilespath'] = '/beta/userfiles/'. $ dddfiles. '/'; // edit by clin003 for submunu for files useing time number.

The modification method is similar to the previous step.
By clin003 from http://clin003.com or http://blog.csdn.net/clin003/
6. Find the commands. php file in the directory -- FCKeditor-Editor-filemanager-browser-default-connectors-PHP-

By clin003 from http://clin003.com or http://blog.csdn.net/clin003/

If (isset ($ _ FILES ['newfile']) &! Is_null ($ _ FILES ['newfile'] ['tmp _ name'])
{
Global $ config;

$ Ofile = $ _ FILES ['newfile'];

// Map the virtual path to the local server path.
$ Sserverdir = servermapfolder ($ resourcetype, $ CurrentFolder );

// Get the uploaded file name.
$ Sfilename = $ ofile ['name'];

// Replace dots in the name with underscores (only one dot can be there... security issue ).
If ($ config ['forcesingleextension'])
$ Sfilename = preg_replace ('//.(?! [^.] * $)/',' _ ', $ Sfilename );
// Add By clin003 at 20070830 for Chinese file name can be get .!
$ Date_time_array_files = getdate (Time ());
$ Ddd_chinese_file_names = $ date_time_array_files ["seconds"]. $ date_time_array_files ["Minutes"]. $ date_time_array_files ["hours"]. $ date_time_array_files ["mday"]. $ date_time_array_files ["mon"]. $ date_time_arrayss ["year"];
// $ Soriginalfilename = $ sfilename;
$ Soriginalfilename = $ ddd_chinese_file_names; // edit by clin003 at 20070830 for Chinese names
// $ Soriginalfilename = $ sfilename;

// Get the extension.
$ Sextension = substr ($ sfilename, (strrpos ($ sfilename, '.') + 1 ));
$ Sextension = strtolower ($ sextension );

$ Arallowed = $ config ['allowedextension'] [$ resourcetype];
$ Ardenied = $ config ['deniedextension'] [$ resourcetype];

If (count ($ arallowed) = 0 | in_array ($ sextension, $ arallowed) & (count ($ ardenied) = 0 |! In_array ($ sextension, $ ardenied )))
{
$ Icounter = 0;
$ Sfilename = $ soriginalfilename. '_'. '0'. '.'. $ sextension; // Add By clin003 at 20070830 for Chinese names

While (true)
{
$ Sfilepath = $ sserverdir. $ sfilename;

If (is_file ($ sfilepath ))
{
$ Icounter ++;
$ Sfilename = $ soriginalfilename. '_'. $ icounter. '.'. $ sextension; // edit by clin003 at 20070830 for Chinese names
// $ Sfilename = removeextension ($ soriginalfilename). '('. $ icounter. ').'. $ sextension;
$ Serrornumber = '123 ';
}
Else
{
Move_uploaded_file ($ ofile ['tmp _ name'], $ sfilepath );

If (is_file ($ sfilepath ))
{
$ Oldumask = umask (0 );
Chmod ($ sfilepath, 0744 );
Umask ($ oldumask );
}

Break;
}
}
}
Else
$ Serrornumber = '123 ';
}

For details about how to modify the code, refer to the redundant code I provided to locate the location.

7. Find the upload. php file in the directory -- FCKeditor-Editor-filemanager-upload-PHP -.
Find

By clin003 from http://clin003.com or http://blog.csdn.net/clin003/

// Check if this Uploader has been enabled.
If (! $ Config ['enabled'])
Sendresults ('1', '','', 'this File Uploader is disabled. Please check the "Editor/filemanager/upload/PHP/config. php" file ');

// Check if the file has been correctly uploaded.
If (! Isset ($ _ FILES ['newfile']) | is_null ($ _ FILES ['newfile'] ['tmp _ name']) | $ _ FILES ['newfile'] ['name'] = '')
Sendresults ('20140901 ');

// Get the posted file.
$ Ofile = $ _ FILES ['newfile'];

// Get the uploaded file name extension.
$ Sfilename = $ ofile ['name'];

// Replace dots in the name with underscores (only one dot can be there... security issue ).
If ($ config ['forcesingleextension'])
$ Sfilename = preg_replace ('//.(?! [^.] * $)/',' _ ', $ Sfilename );

// Add By clin003 at 20070830 for Chinese file name can be get .!
$ Date_time_array_files = getdate (Time ());
$ Ddd_chinese_file_names = $ date_time_array_files ["seconds"]. $ date_time_array_files ["Minutes"]. $ date_time_array_files ["hours"]. $ date_time_array_files ["mday"]. $ date_time_array_files ["mon"]. $ date_time_arrayss ["year"];
// $ Soriginalfilename = $ sfilename;
$ Soriginalfilename = $ ddd_chinese_file_names; // edit by clin003 at 20070830 for Chinese names


// Get the extension.
$ Sextension = substr ($ sfilename, (strrpos ($ sfilename, '.') + 1 ));
$ Sextension = strtolower ($ sextension );

// The file type (from the querystring, by default 'file ').
$ Stype = isset ($ _ Get ['type'])? $ _ Get ['type']: 'file ';

// Check if it is an allowed type.
If (! In_array ($ stype, array ('file', 'image', 'flash', 'Media ')))
Sendresults (1, '','', 'invalidtype specified ');

// Get the allowed and denied extensions arrays.
$ Arallowed = $ config ['allowedextension'] [$ stype];
$ Ardenied = $ config ['deniedextension'] [$ stype];

// Check if it is an allowed extension.
If (count ($ arallowed)> 0 &&! In_array ($ sextension, $ arallowed) | (count ($ ardenied)> 0 & in_array ($ sextension, $ ardenied )))
Sendresults ('20140901 ');

$ Serrornumber = '0 ';
$ Sfileurl = '';

// Initializes the counter used to rename the file, if another one with the same name already exists.
$ Icounter = 0;

// Get the target directory.
If (isset ($ config ['userfilesabsolutepath']) & strlen ($ config ['userfilesabsolutepath'])> 0)
$ Sserverdir = $ config ['userfilesabsolutepath'];
Else
$ Sserverdir = getrootpath (). $ config ["userfilespath"];

If ($ config ['usefiletype'])
$ Sserverdir. = strtolower ($ stype ).'/';

// Check for the directory before uploading the file
If (! Is_dir ($ sserverdir ))
{
Mkdir ($ sserverdir, 0711 );
}

$ Sfilename = $ soriginalfilename. '_'. '0'. '.'. $ sextension; // Add By clin003 at 20070830 for Chinese names
While (true)
{

// Compose the file path.
$ Sfilepath = $ sserverdir. $ sfilename;

// If a file with that name already exists.
If (is_file ($ sfilepath ))
{
$ Icounter ++;
$ Sfilename = $ soriginalfilename. '_'. $ icounter. '.'. $ sextension; // edit by clin003 at 20070830 for Chinese names
$ Serrornumber = '123 ';
}
Else
{
Move_uploaded_file ($ ofile ['tmp _ name'], $ sfilepath );

If (is_file ($ sfilepath ))
{
$ Oldumask = umask (0 );
Chmod ($ sfilepath, 0744 );
Umask ($ oldumask );
}

If ($ config ['usefiletype'])
$ Sfileurl = $ config ["userfilespath"]. strtolower ($ stype). '/'. $ sfilename;
Else
$ Sfileurl = $ config ["userfilespath"]. $ sfilename;

Break;
}
}

Modify the settings. For more information, see here.
By clin003 from http://clin003.com or http://blog.csdn.net/clin003/
-------------------
------------- By clin003 at 20070830 ---------------------------------------

------- The following modifications are not packaged. If necessary, modify them manually ---- refer to: http: // blog.csdn.net/tearzhao/archive/2007/08/21/1752414.aspx ----------------------------------

Modify the content of the fck_image/fck_image.js file in the dialog directory in the Editor folder.
Comment out the three tabs tab, Link, upload, and advanced. The link, upload, and advanced tags are no longer displayed in the pop-up window.

Modify the fck_imageck_image.js file in the dialog directory in the Editor folder.
Comment out the three tabs tab, Link, upload, and advanced. The link, upload, and advanced tags are no longer displayed in the pop-up window.
If (! Bimagebutton &&! Fckconfig. imagedlghidelink)
// Window. Parent. addtab ('link', fcklang. dlgimglinktab );

If (fckconfig. imageupload)
// Window. Parent. addtab ('upload', fcklang. dlglnkupload );

If (! Fckconfig. imagedlghideadvanced)
// Window. Parent. addtab ('advanced ', fcklang. dlgadvancedtag );
Function ondialogtabchange (tabcode)
{
Showe ('divinfo', (tabcode = 'info '));
// Showe ('divlink', (tabcode = 'link '));
// Showe ('divupload', (tabcode = 'upload '));
// Showe ('divadvanced ', (tabcode = 'advanced '));
}

Similarly, the flash modification method is the same as the image method.

 

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


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.