Fix fatal error due an query see BT#13031

pull/2487/head
jmontoyaa 8 years ago
parent 94c85054f0
commit c58d0f5dfb
  1. 60
      main/lp/learnpathItem.class.php

@ -161,42 +161,36 @@ class learnpathItem
$this->children[] = $row['id']; $this->children[] = $row['id'];
} }
} }
}
//$this->seriousgame_mode = $this->get_seriousgame_mode();
$this->seriousgame_mode = 0;
// Get search_did. // Get search_did.
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {
$tbl_se_ref = Database::get_main_table( $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
TABLE_MAIN_SEARCH_ENGINE_REF $sql = 'SELECT *
); FROM %s
$sql = 'SELECT * WHERE
FROM %s course_code=\'%s\' AND
WHERE course_code=\'%s\' tool_id=\'%s\' AND
AND tool_id=\'%s\' ref_id_high_level=%s AND
AND ref_id_high_level=%s ref_id_second_level=%d
AND ref_id_second_level=%d LIMIT 1';
LIMIT 1'; // TODO: Verify if it's possible to assume the actual course instead
// TODO: Verify if it's possible to assume the actual course instead // of getting it from db.
// of getting it from db. $sql = sprintf(
$sql = sprintf( $sql,
$sql, $tbl_se_ref,
$tbl_se_ref, api_get_course_id(),
api_get_course_id(), TOOL_LEARNPATH,
TOOL_LEARNPATH, $this->lp_id,
$this->lp_id, $id
$id );
); $res = Database::query($sql);
if (self::DEBUG > 0) { if (Database::num_rows($res) > 0) {
error_log($sql); $se_ref = Database::fetch_array($res);
}; $this->search_did = (int) $se_ref['search_did'];
$res = Database::query($sql); }
if (Database::num_rows($res) > 0) {
$se_ref = Database::fetch_array($res);
$this->search_did = (int) $se_ref['search_did'];
} }
} }
$this->seriousgame_mode = 0;
$this->audio = $row['audio']; $this->audio = $row['audio'];
if (self::DEBUG > 0) { if (self::DEBUG > 0) {
error_log( error_log(

Loading…
Cancel
Save