Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fixed some bugs detected with Jeff's glossary (mostly with dynalink…

… link feature)
  • Loading branch information...
commit 4d4c38f3fe2ba267fa1dec7f918e63268bc7ea72 1 parent e023438
willcast authored
View
18 mod/glossary/dynalink.php
@@ -12,7 +12,7 @@ function glossary_dynamic_link($courseid, $text) {
$GLOSSARY_CONCEPT_IS_ENTRY = 0;
$GLOSSARY_CONCEPT_IS_CATEGORY = 1;
- $glossarieslist = get_records_select("glossary", "usedynalink = 1 and course = $courseid","id");
+ $glossarieslist = get_records_select("glossary", "usedynalink != 0 and course = $courseid","id");
if ( $glossarieslist ) {
$glossaries = "";
foreach ( $glossarieslist as $glossary ) {
@@ -20,7 +20,7 @@ function glossary_dynamic_link($courseid, $text) {
}
$glossaries=substr($glossaries,0,-1);
- $entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink = 1 and approved != 0","glossaryid","id,glossaryid,concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
+ $entries = get_records_select("glossary_entries", "glossaryid IN ($glossaries) AND usedynalink != 0 and approved != 0","glossaryid","id,glossaryid,concept,casesensitive,$GLOSSARY_CONCEPT_IS_ENTRY category,fullmatch");
$categories = get_records_select("glossary_categories", "glossaryid IN ($glossaries)", "glossaryid,id","id,glossaryid,name concept, 1 casesensitive,$GLOSSARY_CONCEPT_IS_CATEGORY category, 1 fullmatch");
if ( $entries and $categories ) {
$concepts = array_merge($entries, $categories);
@@ -80,11 +80,13 @@ function glossary_link_concepts($text,$concept,$href_tag_begin,$href_tag_end = "
$regexp = '/' . $invalidprefixs . "(" . $list_of_words_cp . ")" . "|" . "(" . $list_of_words_cp . ")". $invalidsufixs . '/is';
preg_match_all($regexp,$text,$list_of_words);
- foreach (array_unique($list_of_words[0]) as $key=>$value) {
- $words['<*'.$key.'*>'] = $value;
- }
- if ( $words ) {
- $text = str_replace($words,array_keys($words),$text);
+ if ($list_of_words) {
+ foreach (array_unique($list_of_words[0]) as $key=>$value) {
+ $words['<*'.$key.'*>'] = $value;
+ }
+ if ( $words ) {
+ $text = str_replace($words,array_keys($words),$text);
+ }
}
}
@@ -149,4 +151,4 @@ function glossary_sort_entries_by_lenght ( $entry0, $entry1 ) {
}
}
-?>
+?>
View
4 mod/glossary/edit.php
@@ -110,9 +110,9 @@
delete_records("glossary_entries_categories","entryid",$e);
- if ( $categories ) {
+ if ( isset($form->categories) ) {
$newcategory->entryid = $newentry->id;
- foreach ($categories as $category) {
+ foreach ($form->categories as $category) {
if ( $category > 0 ) {
$newcategory->categoryid =$category;
insert_record("glossary_entries_categories",$newcategory);
View
4 mod/glossary/lib.php
@@ -418,8 +418,8 @@ function glossary_search_entries($searchterms, $glossary, $includedefinition) {
// $totalcount = count_records_sql("SELECT COUNT(*) FROM $selectsql");
- return get_records_sql("SELECT e.concept, e.definition, e.userid, e.timemodified, e.id, e.format
- FROM $selectsql ORDER BY e.concept ASC $limit");
+ return get_records_sql("SELECT e.*
+ FROM $selectsql ORDER BY e.concept ASC");
}
function glossary_file_area_name($entry) {
View
4 mod/glossary/showentry.php
@@ -8,10 +8,10 @@
print_header();
$entries = get_records_sql("select e.* from {$CFG->prefix}glossary_entries e, {$CFG->prefix}glossary g".
" where e.glossaryid = g.id and".
- " (e.casesensitive = 1 and ucase(concept) = '" . strtoupper(trim($concept)). "' or".
+ " (e.casesensitive != 0 and ucase(concept) = '" . strtoupper(trim($concept)). "' or".
" e.casesensitive = 0 and concept = '$concept') and".
" g.course = $courseid and".
- " e.usedynalink = 1 and g.usedynalink = 1");
+ " e.usedynalink != 0 and g.usedynalink != 0");
glossary_print_dynaentry($courseid, $entries);
View
4 mod/glossary/view.php
@@ -296,8 +296,8 @@
}
}
}
- $dumptoscreen = 1;
}
+ $dumptoscreen = 1;
} elseif ($l == "SPECIAL" and ord($firstletter) != ord("Ñ") and
(ord($firstletter) < ord("A") or ord($firstletter) > ord("Z"))) {
$dumptoscreen = 1;
@@ -328,9 +328,9 @@
if ( $glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS ) {
echo "</center><p>";
}
- $dumptoscreen = 1;
}
}
+ $dumptoscreen = 1;
if ($glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
echo "\n</center></td></tr></table></center>";
Please sign in to comment.
Something went wrong with that request. Please try again.