Filter code trong Drupal từ Stripping Out Code

Filter code trong Drupal từ Stripping Out Code

Code can be dangerous. The right code in the right place brings your site to life, but there are many places where it can be a huge security risk.

Inside your content, code can be dangerous. If you allow people to use PHP, Javascript, iframes or other code inside content, you greatly increase the chances of a malicious script being used.

To minimize this risk, by default Drupal restricts the code you can use in content.

The downside to this is that some common code isn't allowed. For example, most HTML is blocked by default. Here's how to allow those on your site by stopping Joomla from stripping out code.

Text Formats

tutuploadsmedia_1322079982179.png

By default, Drupal content is entered as "Filtered HTML". What does that mean? Drupal explains in the image above.

  • Web page addresses and e-mail addresses turn into links automatically.
  • There are only twelve allowed HTML tags.

Click on the dropdown link and you'll get extra options:

tutuploadsmedia_1322080284110.png

Full HTML is described in this way:

  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text is described in this way:

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

You can also to the Modules page and enable PHP filter:

tutuploadsmedia_1322080495187.png

This is described more simply:

  • You may post PHP code. You should include tags.

How does this impact your content?

tutuploadsmedia_1322080687743.png

Let's see an example of how text filters impact your content. In this example we're adding a Google Map to our content.

If we save this page with Filtered HTML, the end result will look like the image below.

tutuploadsmedia_1322080731057.png

If we save this page with Full HTML, the end result will look like the image below.

tutuploadsmedia_1322080824150.png

Modifying the Text Filters

If the default settings aren't right for you, go to Configuration > Text format.

Filter code trong Drupal từ Stripping Out Code

You'll see that different filters are set up for different user groups. For security reasons, anonymous users and authenticated users only get access to Filtered HTML.

tutuploadsmedia_1322080958715.png

Click on Configure next to any text filter to change the options:

tutuploadsmedia_1322081085284.png

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Window 8 chưa thực sự thu hút các doanh nghiệp

Window 8 chưa thực sự thu hút các doanh nghiệp

Nhiều doanh nghiệp cho rằng Windows 8 phù hợp với người tiêu dùng cá nhân hơn, các thiết bị chạy Windows 8 cũng không dễ quản lí hơn so với iPad.

Chính phủ Mỹ "sờ gáy" Facebook vì vấn đề bảo mật

Chính phủ Mỹ sờ gáy Facebook vì vấn đề bảo mật

Facebook đang phải tiến hành những cuộc đàm phán với chính phủ Mỹ về việc sử dụng thông tin cá nhân người dùng trên mạng xã nội này. Theo thông tin nội bộ, chính phủ yêu cầu Facebook phải nhận được sự đồng ý của người sử dụng trước khi hãng thay đổi những điều khoản quan trọng trong chính sách bảo mật. Điều đó có nghĩa việc người dùng cho phép chia sẻ thông tin của mình là một chuyện, việc Facebook sử dụng thông tin đó như thế nào lại là một chuyện khác.

How To Make Video Calls On Android Phones Through Skype

How To Make Video Calls On Android Phones Through Skype

Skype has an app that was developed specifically for Android users called Skype for Android. This app has brought video calling to this very lovely market.

Công ty diệt chuột T&C

 

Diet con trung