Эх сурвалжийг харах

Fixing queries due the single database changes see #3910

Julio Montoya 13 жил өмнө
parent
commit
d267cbc1af

+ 1 - 1
main/group/group.php

@@ -156,7 +156,7 @@ if (api_is_allowed_to_edit(false, true)) {
 echo '<div class="actions">';
 if (api_is_allowed_to_edit(false, true)) {
 	echo '<a href="group_creation.php?'.api_get_cidreq().'">'.Display::return_icon('new_group.png', get_lang('NewGroupCreate'),'','32').'</a>';
-	if (CourseManager::count_rows_course_table(Database::get_course_table(TABLE_GROUP),api_get_session_id(), api_get_course_int_id())) > 0) {
+	if (CourseManager::count_rows_course_table(Database::get_course_table(TABLE_GROUP),api_get_session_id(), api_get_course_int_id()) > 0) {
 		//echo '<a href="group_overview.php?'.api_get_cidreq().'">'.Display::return_icon('group_view.gif').'&nbsp;'.get_lang('GroupOverview').'</a>&nbsp;';
 		echo '<a href="group_overview.php?'.api_get_cidreq().'">'.Display::return_icon('group_summary.png', get_lang('GroupOverview'),'','32').'</a>';
 	}

+ 1 - 1
main/group/group_space.php

@@ -53,7 +53,7 @@ if ($current_group['doc_state'] != 1 && $current_group['calendar_state'] != 1 &&
 
 /*	Header */
 
-Display::display_header($nameTools.' '.stripslashes($current_group['name']), 'Group');
+Display::display_header($nameTools.' '.Security::remove_XSS($current_group['name']), 'Group');
 
 /*	Introduction section (editable by course admin) */
 

+ 2 - 2
main/inc/local.inc.php

@@ -1070,8 +1070,8 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) { // ses
 
 if ((isset($gidReset) && $gidReset) || (isset($cidReset) && $cidReset)) { // session data refresh requested
 	if ($gidReq && $_cid ) { // have keys to search data
-		$group_table = Database::get_course_table(TABLE_GROUP);
-		$sql = "SELECT * FROM $group_table WHERE id = '$gidReq'";
+		$group_table = Database::get_course_table(TABLE_GROUP);    
+		$sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$gidReq'";
 		$result = Database::query($sql);
 		if (Database::num_rows($result) > 0) { // This group has recorded status related to this course
 			$gpData = Database::fetch_array($result);

+ 1 - 1
main/link/link.php

@@ -218,7 +218,7 @@ if (api_is_allowed_to_edit(null, true) && isset($_GET['action'])) {
 		}
 		echo '	<div class="row">
 					<div class="label">
-						<span class="form_required">*</span> '.get_lang('Url').'
+						<span class="form_required">*</span> URL
 					</div>
 					<div class="formw">
 						<input type="text" name="urllink" size="50" value="' . (empty($urllink) ? 'http://' : Security::remove_XSS($urllink)) . '" />

+ 7 - 5
main/metadata/md_link.php

@@ -135,6 +135,8 @@ function mdo_override(&$xmlDoc)  // by ref!
 
 function mdo_storeback(&$xmlDoc)  // by ref!
 {
+    $course_id = api_get_course_int_id();
+    
     if (!$this->mdo_url) return;  // no record in link table, most probably
 
     if (!($v = $xmlDoc->xmd_value('metadata/lom/technical/location'))) return;
@@ -164,7 +166,7 @@ function mdo_storeback(&$xmlDoc)  // by ref!
 
     $link_table = Database::get_course_table(TABLE_LINK);
     if ($u) Database::query("UPDATE $link_table SET " . substr($u, 2) .
-        " WHERE id='" . addslashes($this->mdo_id) . "'");
+        " WHERE c_id = $course_id AND id='" . addslashes($this->mdo_id) . "'");
 }
 
 
@@ -186,7 +188,8 @@ function mdo_add_breadcrump_nav()
 function mdobject($_course, $id)
 {
     global $ieee_dcmap_e, $ieee_dcmap_v;  // md_funcs
-
+    $course_id = api_get_course_int_id();
+    
     $this->mdo_course = $_course; $this->mdo_type = 'Link';
     $this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;
 
@@ -194,8 +197,7 @@ function mdobject($_course, $id)
 
     $link_table = Database::get_course_table(TABLE_LINK);
     if (($linkinfo = @Database::fetch_array(Database::query(
-            "SELECT url,title,description,category_id FROM $link_table WHERE id='" .
-            addslashes($id) . "'"))))
+            "SELECT url,title,description,category_id FROM $link_table WHERE c_id = $course_id AND id='" .intval($id) . "'"))))
     {
         $this->mdo_url =         $linkinfo['url'];
         $this->mdo_title =       $linkinfo['title'];
@@ -204,7 +206,7 @@ function mdobject($_course, $id)
 
         $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
         if (($catinfo = @Database::fetch_array(Database::query(
-                "SELECT category_title FROM $linkcat_table WHERE id='" .
+                "SELECT category_title FROM $linkcat_table WHERE c_id = $course_id AND id='" .
                 addslashes($lci) . "'"))))
             $this->mdo_category_title =    $catinfo['category_title'];
     }