Code Duplication    Length = 13-13 lines in 2 locations

locallib.php 2 locations

@@ 1054-1066 (lines=13) @@
1051
            $file = reset($files);
1052
            unset($files);
1053
            $pnoncevalue = null;
1054
            if (!is_null($id)) {
1055
                // Create the nonce component for granting a temporary public access.
1056
                $cache = cache::make_from_params(cache_store::MODE_APPLICATION,
1057
                    'mod_bigbluebuttonbn',
1058
                    'presentationdefault_cache');
1059
                $pnoncekey = sha1(context_system::instance()->id);
1060
                /* The item id was adapted for granting public access to the presentation once in order
1061
                 * to allow BigBlueButton to gather the file. */
1062
                $pnoncevalue = bigbluebuttonbn_generate_nonce();
1063
                $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1064
            }
1065
1066
            $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
1067
                $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
1068
            return(array('name' => $file->get_filename(), 'icon' => file_file_icon($file, 24),
1069
                'url' => $url->out(false), 'mimetype_description' => get_mimetype_description($file)));
@@ 1083-1095 (lines=13) @@
1080
    $file = reset($files);
1081
    unset($files);
1082
    $pnoncevalue = null;
1083
    if (!is_null($id)) {
1084
        // Create the nonce component for granting a temporary public access.
1085
        $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'mod_bigbluebuttonbn',
1086
            'presentation_cache');
1087
        $pnoncekey = sha1($id);
1088
        /* The item id was adapted for granting public access to the presentation once in order
1089
         * to allow BigBlueButton to gather the file. */
1090
        $pnoncevalue = bigbluebuttonbn_generate_nonce();
1091
        $cache->set($pnoncekey, array('value' => $pnoncevalue, 'counter' => 0));
1092
    }
1093
    $url = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(),
1094
        $file->get_filearea(), $pnoncevalue, $file->get_filepath(), $file->get_filename());
1095
    return array('name' => $file->get_filename(), 'icon' => file_file_icon($file, 24),
1096
        'url' => $url->out(false), 'mimetype_description' => get_mimetype_description($file));
1097
}
1098