<commit_before><?php // $Id$

/// This page prints a particular instance of glossary
    require_once("../../config.php");
    require_once("lib.php");
    
    require_variable($id);             // Course Module ID
    require_variable($eid);            // Entry ID
    optional_variable($cid,0);         // Comment ID

    optional_variable($action,"add");     // Action to perform
    optional_variable($confirm,0);     // Confirm the action
    
    $action = strtolower($action);
	
	global $THEME, $USER, $CFG;
    
    if (! $cm = get_record("course_modules", "id", $id)) {
        error("Course Module ID was incorrect");
    } 
    
    if (! $course = get_record("course", "id", $cm->course)) {
        error("Course is misconfigured");
    } 
    
    if (! $glossary = get_record("glossary", "id", $cm->instance)) {
        error("Course module is incorrect");
    } 
    
   if (! $entry = get_record("glossary_entries", "id", $eid)) {
      error("Entry is incorrect");
   }
   
   if ( $cid ) {
      if (! $comment = get_record("glossary_comments", "id", $cid)) {
          error("Comment is incorrect");
      }
   } 

    require_login($course->id);    
    if (!$cm->visible and !isteacher($course->id)) {
        notice(get_string("activityiscurrentlyhidden"));
    } 
    
    add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
    
/// Printing the page header
    if ($course->category) {
        $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
    } 
    
    switch ( $action ){
        case "add":
            $straction = get_string("addingcomment","glossary");
        break;
        case "edit":
            $straction = get_string("editingcomment","glossary");<commit_msg>- Preventing guest for posting comments on entries<commit_after><?php // $Id$

/// This page prints a particular instance of glossary
    require_once("../../config.php");
    require_once("lib.php");
    
    require_variable($id);             // Course Module ID
    require_variable($eid);            // Entry ID
    optional_variable($cid,0);         // Comment ID

    optional_variable($action,"add");     // Action to perform
    optional_variable($confirm,0);     // Confirm the action
    
    $action = strtolower($action);
	
	global $THEME, $USER, $CFG;
    
    if (! $cm = get_record("course_modules", "id", $id)) {
        error("Course Module ID was incorrect");
    } 
    
    if (! $course = get_record("course", "id", $cm->course)) {
        error("Course is misconfigured");
    } 
    
    if (! $glossary = get_record("glossary", "id", $cm->instance)) {
        error("Course module is incorrect");
    } 
    
   if (! $entry = get_record("glossary_entries", "id", $eid)) {
      error("Entry is incorrect");
   }
   
   if ( $cid ) {
      if (! $comment = get_record("glossary_comments", "id", $cid)) {
          error("Comment is incorrect");
      }
   } 

    require_login($course->id);    
    if (!$cm->visible and !isteacher($course->id)) {
        notice(get_string("activityiscurrentlyhidden"));
    } 
    if (isguest()) {
        error("Guests are not allowed to post comments", $_SERVER["HTTP_REFERER"]);
    }    
    add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
    
/// Printing the page header
    if ($course->category) {
        $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
    } 
    
    switch ( $action ){
        case "add":
            $straction = get_string("addingcomment","glossary");
        break;
        case "edit":
            $straction = get_string("editingcomment","glossary");
{'fraction_non_alphanumeric': 0.17705802968960863, 'fraction_numerical': 0.0010796221322537112, 'mean_word_length': 2.4442379182156135, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '888749', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1137, 'n_words': 240}