$href_tag_begin = "<a target=\"entry\" class=\"autolink\" title=\"$title\" href=\"$CFG->wwwroot/mod/glossary/showentry.php?courseid=$courseid&concept=$concepttitle\" ".
"onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid\&concept=$concepttitle', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
}
- $replace = "\\[]'\"*()";
+ $replace = "\\[]'\"*()\?";
$currentconcept = glossary_addslashes($replace,$concept->concept);
if ( $currentconcept = trim(strip_tags($currentconcept)) ) {
if ( !$concept->category ) {
<?PHP // $Id$
-global $CFG, $USER, $THEME;
require_once("../../config.php");
require_once("lib.php");
+global $CFG, $USER, $THEME;
+
require_variable($id); // Course Module ID
optional_variable($e); // EntryID
optional_variable($confirm,0); // proceed. Edit the edtry
$newentry->casesensitive = $form->casesensitive;
$newentry->fullmatch = $form->fullmatch;
$newentry->timemodified = $timenow;
- $newentry->approved = $glossary->defaultapproval or isteacher($course->id);
+ $newentry->approved = 0;
+ if ( $glossary->defaultapproval or isteacher($course->id) ) {
+ $newentry->approved = 1;
+ }
if ($form->concept == '' or trim($form->text) == '' ) {
$errors = get_string('fillfields','glossary');
} else {
unset($newentry->attachment);
}
+
if (! update_record("glossary_entries", $newentry)) {
error("Could not update your glossary");
} else {
$newentry->timecreated = $timenow;
$newentry->sourceglossaryid = 0;
$newentry->teacherentry = isteacher($course->id);
-
+
$permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
if ($dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id)) {
if ( $displayformat < 0 ) {
$displayformat = $glossary->displayformat;
}
- if ($entry->approved or ($USER->id == $entry->userid and !isteacher($course->id)) or $mode == 'approval') {
+ if ($entry->approved or ($USER->id == $entry->userid) or ($mode == 'approval' and !$entry->approved) ) {
$permissiongranted = 0;
$formatfile = "$CFG->dirroot/mod/glossary/formats/$displayformat.php";
$functionname = "glossary_print_entry_by_format";
/// if we're browsing by alphabet and the current concept does not begin with
/// the letter we are look for.
$showentry = 1;
+ $num = 0;
if ( $mode == 'letter' and $hook != 'SPECIAL' and $hook != 'ALL' ) {
if ( strtoupper(substr($entry->concept, 0, strlen($hook))) != strtoupper($hook) ) {
$showentry = 0;
/// if the entry is not approved, deal with it based on the current view and
/// user.
if ( $showentry and $mode != 'approval' ) {
- if ( !$entry->approved and isteacher($course->id, $entry->userid) ) {
+ if ( !$entry->approved and $USER->id != $entry->userid ) {
$showentry = 0;
}
}