Learning Path (Courses): PHP sessions of a LP are destroyed when visiting the main course page.
Assignment tool: Work.php deletes all homeworks bugs fixed. Reported and fixed by carlosbrolotobar http://www.chamilo.org/node/143
Core API: Support has been implemented for json_encode() function for PHP version < 5.2. The correspondent bug-report "Hide and show not working" and testing have been done by Hubert Borderiou http://support.chamilo.org/issues/761
';
diff --git a/main/link/linkfunctions.php b/main/link/linkfunctions.php
index d93a2ff69d..750317062c 100755
--- a/main/link/linkfunctions.php
+++ b/main/link/linkfunctions.php
@@ -293,6 +293,7 @@ function editlinkcategory($type) {
global $description;
global $category_title;
global $onhomepage;
+ global $target_link;
$tbl_link = Database :: get_course_table(TABLE_LINK);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
@@ -300,18 +301,20 @@ function editlinkcategory($type) {
if ($type == 'link') {
// This is used to populate the link-form with the info found in the database
- $sql = "SELECT * FROM ".$tbl_link." WHERE id='".$_GET['id']."'";
- $result = Database::query($sql);
- if ($myrow = Database::fetch_array($result)) {
- $urllink = $myrow['url'];
- $title = $myrow['title'];
- $description = $myrow['description'];
- $category = $myrow['category_id'];
- if ($myrow['on_homepage'] != 0) {
- $onhomepage = 'checked';
+ if (!empty($_GET['id'])) {
+ $sql = "SELECT * FROM ".$tbl_link." WHERE id='".intval($_GET['id'])."'";
+ $result = Database::query($sql);
+ if ($myrow = Database::fetch_array($result)) {
+ $urllink = $myrow['url'];
+ $title = $myrow['title'];
+ $description = $myrow['description'];
+ $category = $myrow['category_id'];
+ if ($myrow['on_homepage'] != 0) {
+ $onhomepage = 'checked';
+ }
+ $target_link = $myrow['target'];
}
}
-
// This is used to put the modified info of the link-form into the database
if ($_POST['submitLink']) {
@@ -331,7 +334,7 @@ function editlinkcategory($type) {
$category_id = $row['category_id'];
if ($category_id != $_POST['selectcategory']) {
- $sql = "SELECT MAX(display_order) FROM ".$tbl_link." WHERE category_id='".$_POST['selectcategory']."'";
+ $sql = "SELECT MAX(display_order) FROM ".$tbl_link." WHERE category_id='".intval($_POST['selectcategory'])."'";
$result = Database::query($sql);
list ($max_display_order) = Database::fetch_row($result);
$max_display_order ++;
@@ -344,11 +347,11 @@ function editlinkcategory($type) {
// Update search enchine and its values table if enabled
if (api_get_setting('search_enabled') == 'true') {
- $link_id = $_POST['id'];
+ $link_id = intval($_POST['id']);
$course_id = api_get_course_id();
- $link_url = $_POST['urllink'];
- $link_title = $_POST['title'];
- $link_description = $_POST['description'];
+ $link_url = Database::escape_string($_POST['urllink']);
+ $link_title = Database::escape_string($_POST['title']);
+ $link_description = Database::escape_string($_POST['description']);
// Actually, it consists on delete terms from db, insert new ones, create a new search engine document, and remove the old one
// get search_did
@@ -440,7 +443,7 @@ function editlinkcategory($type) {
// This is used to populate the category-form with the info found in the database
if (!$submit_category) {
- $sql = "SELECT * FROM ".$tbl_categories." WHERE id='".$_GET['id']."'";
+ $sql = "SELECT * FROM ".$tbl_categories." WHERE id='".intval($_GET['id'])."'";
$result = Database::query($sql);
if ($myrow = Database::fetch_array($result)) {
$category_title = $myrow["category_title"];
@@ -512,10 +515,10 @@ function showlinksofcategory($catid) {
$myrow[3] = text_filter($myrow[3]);
if ($myrow['visibility'] == '1') {
- echo '