Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4185067
  • 博文数量: 601
  • 博客积分: 15410
  • 博客等级: 上将
  • 技术积分: 6884
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-16 08:11
个人简介

独学而无友,则孤陋而寡闻!

文章分类

全部博文(601)

文章存档

2020年(1)

2018年(4)

2017年(7)

2016年(42)

2015年(25)

2014年(15)

2013年(36)

2012年(46)

2011年(117)

2010年(148)

2009年(82)

2008年(37)

2007年(41)

分类:

2009-02-05 15:45:57

Here are some conventions to follow when developping a Claroline module :

1. do not use php short tags '
2. never use external data coming from the user directly : all input data MUST filtered and validated BEFORE using them

3. as a consequence : never use the super globals variables $_REQUEST, $_GET, $_POST or $_COOKIE directly in SQL or HTML code :
3.1. always escape SQL variables using casting for numbers or claro_sql_escape() for strings, the use of addslashes is DEPRECATED since in it does not take mysql escaped chars into account, not respecting this rule leads to potential execution of arbitrary SQL queries !
3.2. always protect external data in display by using htmlspecialchars() or striptags() functions or a similar mechanism, not respecting this rule leads to potential data stealing from the user web navigator (cookies, session identifier, identity theft...)

4. avoid the use of the global namespace through either the global key worg or the $GLOBALS super variable, not repsecting this rule can lead to strange side-effect bugs

5. use the Claroline API provided by the kernel libraries like sql.lib.php, init.lib.php, path.lib.php, module.lib.php, icon.lib.php, file.lib.php, fileManage.lib.php... they have been written to answer common tasks and issues in the Claroline platform and to ensure common behaviour in all the scripts

6. avoid mixing php and html code (except in the Claroline 1.9 template system) to enhance code readability and maintenance

7. as a consequence always separate business logic from display

A more complete developer's documentation will follow as soon as possible.

Thanks for helping to make Claroline a better LMS.

Regards,
阅读(1301) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~