function mdo_generate_default_xml_metadata() { global $iso639_2_code, $ieee_xml; $xhtDoc = new xhtdoc($ieee_xml); $_user = api_get_user_info(); if ($xhtDoc->htt_error) { give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error); } $xhtDoc->xht_get_lang = 'get_lang'; $xhtDoc->xht_xmldoc = new xmddoc(''); if ($xhtDoc->xht_xmldoc->error) { give_up($xhtDoc->xht_xmldoc->error); } $xhtDoc->xht_param['siteUri'] = make_uri(); $xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] . '.Document.' . $this->mdo_id; // 2005-05-30: path->sysCode $xhtDoc->xht_param['location'] = api_get_path(WEB_PATH) . 'main/metadata/openobject.php?cidReq=' . urlencode($this->mdo_course['sysCode']) . '&eid=' . urlencode($this->mdo_eid); $xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code); $xhtDoc->xht_param['lang'] = strtolower($iso639_2_code); $xhtDoc->xht_param['title'] = $this->mdo_title ? $this->mdo_title : ($this->mdo_path ? $this->mdo_path : get_lang('MdTitle', '')); $xhtDoc->xht_param['description'] = $this->mdo_comment ? $this->mdo_comment : get_lang('MdDescription', ''); $xhtDoc->xht_param['coverage'] = get_lang('MdCoverage', ''); if (isset($_user)) { $xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\\nEMAIL:" . $_user['mail'] . "\\nEND:VCARD\\n"; } $xhtDoc->xht_param['dateTime'] = date('Y-m-d'); if ($this->mdo_filetype == 'folder') { $format = "inode/directory"; } else { require_once api_get_path(LIBRARY_PATH) . 'document.lib.php'; $format = DocumentManager::file_get_mime_type($this->mdo_path); } $xhtDoc->xht_param['format'] = $format; $xhtDoc->xht_param['size'] = ($s = filesize(get_course_path() . $this->mdo_course['path'] . '/document' . $this->mdo_path)) ? $s : '0'; return $xhtDoc->xht_fill_template('XML'); }
* sites: site_id, site_url (e.g. http://xx.yy.zz/), upddate, ... * * spider: spider_id, site_id, upddate, num_words, first_words, * path (e.g. uu/vv/ww/), file (e.g. index.php?sid=xxx), ... * * engine: spider_id, key_id, weight * * Most of the function code is a simplified version of real PhpDig code * released under the GNU GPL V2, see www.phpdig.net. * */ // PHPDIG CONNECTION ----------------------------------------------------------> $phpDigInc = get_course_path() . $_course['path'] . '/phpdig-1.8.6/includes/'; $phpDigIncCn = $phpDigInc. 'connect.php'; // to connect to PhpDig's database $phpDigIncCw = $phpDigInc. 'common_words.txt'; // stopwords // if (!file_exists($phpDigIncCn)) return(); doesn't seem to work properly... if (file_exists($phpDigIncCw)) if (is_array($lines = @file($phpDigIncCw))) while (list($id,$word) = each($lines)) $common_words[trim($word)] = 1; define('SUMMARY_DISPLAY_LENGTH', 700); //define('PHPDIG_ENCODING', 'iso-8859-1'); define('PHPDIG_ENCODING', strtolower($charset)); define('SMALL_WORDS_SIZE', 2);
$sdisub = ''; } $sdisub = substr(ereg_replace("[^0-9A-Za-z]", "", $sdisub), 0, 4); // $sdisub is for split manifests - Scorm.NNN.$sdisub_xxx e.g. Scorm.3.1979_12 define('MFFNAME', 'imsmanifest'); define('MFFDEXT', '.xml'); define('HTF', 'mdp_scorm.htt'); $regs = array(); $nameTools && get_lang('Sorry') or give_up('Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'"); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); $is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) { give_up(get_lang('Denied')); } $baseWorkDir = get_course_path() . ($courseDir = $_course['path'] . '/scorm'); $mdStore = new mdstore($is_allowed_to_edit); // create table if needed require api_get_path(LIBRARY_PATH) . 'xmd.lib.php'; require api_get_path(LIBRARY_PATH) . 'xht.lib.php'; require 'md_phpdig.php'; // SET CURRENT SCORM DIRECTORY - HEADER ---------------------------------------> if (isset($workWith)) { $scormdocument = Database::get_course_table(TABLE_LP_MAIN); $sql = "SELECT id FROM {$scormdocument} WHERE path='" . Database::escape_string(api_substr($workWith, 1)) . "' OR path='" . Database::escape_string(substr($workWith, 1)) . "/.'"; $result = Database::query($sql); if (Database::num_rows($result) == 1) { if ($row = Database::fetch_array($result)) { $sdi = $row['id']; } }
function define_kwds($mdo) { if (!($newtext = trim(@fgc(get_course_path() . $mdo->mdo_course['path'] . '/document' . $mdo->mdo_path )))) { unlink(KEYWORDS_CACHE); return; } // templates to define the tree as JScript object $xhtDocKw = new xhtdoc(<<<EOD <!-- {-KWTREE_OBJECT-} --> KWTREE_OBJECT = {n:"", ti:"{-X @title-}" , c:[{-R * C DOWN_THE_KWTREE-}]}; document.write(traverseKwObj(KWTREE_OBJECT, '', 0)); KWDS_ARRAY.sort(); <!-- {-DOWN_THE_KWTREE-} --> {-T number > 1 , -}{n:"{-V @.-}"{-D cm {-X @comment-}-}{-T cm != empty , cm:"{-P cm-}"-}{-D pt {-X @postit-}-}{-T pt != empty , pt:"{-P pt-}"-}{-R * P empty-}{-T number >= 1 , c:[-}{-T number >= 1 R * C DOWN_THE_KWTREE-}{-R * P empty-}{-T number >= 1 ]-}} <!-- {--} --> EOD ); // traverseKwObj (md_script) generates clickable tree and populates KWDS_ARRAY if ($xhtDocKw->htt_error) give_up('KwdTree template (metadata/md_funcs): ' . $xhtDocKw->htt_error); $xhtDocKw->xht_xmldoc = new xmddoc(explode("\n", $newtext)); if ($xhtDocKw->xht_xmldoc->error) give_up('CourseKwds (metadata/md_funcs): XML error: ' . $xhtDocKw->xht_xmldoc->error); if (count($xhtDocKw->xht_xmldoc->children[0]) < 2) { unlink(KEYWORDS_CACHE); return; } $fileHandler = @fopen(KEYWORDS_CACHE, 'w'); @fwrite($fileHandler, $xhtDocKw->xht_fill_template('KWTREE_OBJECT')); @fclose($fileHandler); }
$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) { give_up(get_lang('Denied')); } $mdStore = new mdstore(FALSE); // no create from statistics require api_get_path(LIBRARY_PATH) . 'xmd.lib.php'; require api_get_path(LIBRARY_PATH) . 'xht.lib.php'; $htmldecode = array_flip(get_html_translation_table(HTML_SPECIALCHARS)); // STATISTICS -----------------------------------------------------------------> $noPHP_SELF = TRUE; // in breadcrumps Display::display_header($nameTools); echo '<h3>', get_lang('Statistics'), '</h3>', "\n"; $ckw = $_course['path'] . '/CourseKwds.js'; define('KEYWORDS_CACHE', get_course_path() . $ckw); if (!file_exists(KEYWORDS_CACHE)) { echo get_lang('NoKeywords'); Display::display_footer(); exit; } if (!($myFile = @fopen(KEYWORDS_CACHE, 'r'))) { echo get_lang('KwCacheProblem'); Display::display_footer(); exit; } $kwds = array(); $kwcnt = array(); $kwrefs = array(); while ($kwline = fgets($myFile)) { if (ereg('�>(.+)<�', $kwline, $regs) || ereg('">(.+)<�', $kwline, $regs)) {