$result = Database::query("SELECT isocode FROM " .Database :: get_main_table(TABLE_MAIN_LANGUAGE) ." WHERE available='1' ORDER BY isocode ASC"); $sep = ":"; $langLangs = $sep . "xx" . $sep . "xx"; while ($row = Database::fetch_array($result)) if (($isocode = $row['isocode'])) $langLangs .= ",, " . $isocode . $sep . $isocode; // XML and DB STUFF -----------------------------------------------------------> $is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); $mdStore = new mdstore($is_allowed_to_edit); if (($mdt_rec = $mdStore->mds_get(EID)) === FALSE) // no record, default XML $mdt = $mdObj->mdo_generate_default_xml_metadata(); else $mdt = $mdt_rec; $xhtxmldoc = new xmddoc(explode("\n", $mdt)); $httfile = ($xhtxmldoc->error) ? 'md_editxml.htt' : HTT . '.htt'; if (!$xhtxmldoc->error && $mdt_rec !== FALSE && method_exists($mdObj, 'mdo_override')) $mdt = $mdObj->mdo_override($xhtxmldoc); $xhtDoc = define_htt($httfile, $urlp, $_course['path']); define('HSH', md5($mdt . LFN . $nameTools . get_lang('Sorry') . $httfile . implode('{}', $xhtDoc->htt_array))); // cached HTML depends on LFN+HTT $xhtDoc->xht_param['traceinfo'] = $xhtxmldoc->error; $xhtDoc->xht_param['dbrecord'] = $mdt_rec !== FALSE ? 'TRUE' : ''; $xhtDoc->xht_xmldoc = $xhtxmldoc; if ($is_allowed_to_edit) $xhtDoc->xht_param['isallowedtoedit'] = 'TRUE'; // MD updates to Doc and DB if ($is_allowed_to_edit && isset($_POST['mda'])) { $mdt = $mdStore->mds_update_xml_and_mdt($mdObj, $xhtDoc->xht_xmldoc, get_magic_quotes_gpc() ? stripslashes($_POST['mda']) : $_POST['mda'], EID, $xhtDoc->xht_param['traceinfo'], $mdt_rec !== FALSE); if ($mdt_rec !== FALSE) { if (strpos($xhtDoc->xht_param['traceinfo'], 'DELETE') !== FALSE) $xhtDoc->xht_param['dbrecord'] = ''; } else if (strpos($xhtDoc->xht_param['traceinfo'], 'INSERT') !== FALSE) $xhtDoc->xht_param['dbrecord'] = 'TRUE'; if (method_exists($mdObj, 'mdo_storeback')) $mdObj->mdo_storeback($xhtDoc->xht_xmldoc); $mdt_rec = FALSE; // cached HTML obsolete, must re-apply templates } elseif ($is_allowed_to_edit && $_POST['mdt']) { // md_editxml.htt $mdStore->mds_put(EID, get_magic_quotes_gpc() ? stripslashes($_POST['mdt']) : $_POST['mdt'], 'mdxmltext', '?'); $mdStore->mds_put(EID, HSH, 'md5'); $xhtDoc->xht_param['dbrecord'] = 'TRUE'; $mdt = ''; $xhtDoc->xht_param['traceinfo'] = get_lang('PressAgain'); $mdt_rec = FALSE; // cached HTML obsolete, must re-apply templates } $xhtDoc->xht_param['mdt'] = $mdt; define('CACHE_IS_VALID', isset($mdt_rec) && $mdt_rec !== FALSE && HSH && HSH == $mdStore->mds_get(EID, 'md5')); function md_part($part, $newtext) // callback from template (HTML cache in DB) { global $mdStore; if ($newtext === FALSE) { if (!CACHE_IS_VALID) return FALSE; return '' . $mdStore->mds_get(EID, $part); } else { $mdStore->mds_put(EID, HSH, 'md5'); $mdStore->mds_put(EID, $newtext, $part); return $newtext; } } function md_part1($newtext) { return md_part('htmlcache1', $newtext); } function md_part2($newtext) { return md_part('htmlcache2', $newtext); } function md_indexabletext($newtext) { return md_part('indexabletext', $newtext); } // GENERATE OUTPUT ------------------------------------------------------------> foreach (explode("\n", $xhtDoc->htt_array['HTTP']) as $httpXtra) if ($httpXtra) $httpHeadXtra[] = $httpXtra; $xhtDoc->xht_get_lang = 'get_lang'; function resource_for($e) {return $e;} // dummy, '=/' not used here $xhtDoc->xht_resource = 'resource_for'; $htmlHeadXtra[] = $xhtDoc->xht_fill_template('HEAD'); $mdObj->mdo_add_breadcrump_nav(); // see 'md_' . EID_TYPE . '.php' $noPHP_SELF = TRUE; // in breadcrumps Display::display_header($nameTools); echo "\n"; $xhtDoc->xht_dbgn = DBG; // for template debug info, set to e.g. 10000 if (($ti = $xhtDoc->xht_param['traceinfo'])) $xhtDoc->xht_param['traceinfo'] = '