Code Duplication    Length = 31-31 lines in 2 locations

brokerlib.php 2 locations

@@ 324-354 (lines=31) @@
321
 *
322
 * @return array
323
 */
324
function bigbluebuttonbn_broker_recording_action_publish($params, $recordings) {
325
    if (bigbluebuttonbn_broker_recording_is_imported($recordings, $params['id'])) {
326
        // Execute publish on imported recording link, if the real recording is published.
327
        $realrecordings = bigbluebuttonbn_get_recordings_array(
328
            $recordings[$params['id']]['meetingID'],
329
            $recordings[$params['id']]['recordID']
330
        );
331
        // Only if the physical recording exist and it is published, execute publish on imported recording link.
332
        if (!isset($realrecordings[$params['id']])) {
333
            return array(
334
                'status' => false,
335
                'message' => get_string('view_recording_publish_link_deleted', 'bigbluebuttonbn')
336
            );
337
        }
338
        if ($realrecordings[$params['id']]['published'] !== 'true') {
339
            return array(
340
                'status' => false,
341
                'message' => get_string('view_recording_publish_link_not_published', 'bigbluebuttonbn')
342
            );
343
        }
344
        return array(
345
            'status' => bigbluebuttonbn_publish_recording_imported(
346
                $recordings[$params['id']]['imported'],
347
                true
348
            )
349
        );
350
    }
351
    // As the recordingid was not identified as imported recording link, execute actual publish.
352
    return array(
353
        'status' => bigbluebuttonbn_publish_recordings(
354
            $params['id'],
355
            'true'
356
        )
357
    );
@@ 368-398 (lines=31) @@
365
 *
366
 * @return array
367
 */
368
function bigbluebuttonbn_broker_recording_action_unprotect($params, $recordings) {
369
    if (bigbluebuttonbn_broker_recording_is_imported($recordings, $params['id'])) {
370
        // Execute unprotect on imported recording link, if the real recording is unprotected.
371
        $realrecordings = bigbluebuttonbn_get_recordings_array(
372
            $recordings[$params['id']]['meetingID'],
373
            $recordings[$params['id']]['recordID']
374
        );
375
        // Only if the physical recording exist and it is published, execute unprotect on imported recording link.
376
        if (!isset($realrecordings[$params['id']])) {
377
            return array(
378
                'status' => false,
379
                'message' => get_string('view_recording_unprotect_link_deleted', 'bigbluebuttonbn')
380
            );
381
        }
382
        if ($realrecordings[$params['id']]['protected'] === 'true') {
383
            return array(
384
                'status' => false,
385
                'message' => get_string('view_recording_unprotect_link_not_unprotected', 'bigbluebuttonbn')
386
            );
387
        }
388
        return array(
389
            'status' => bigbluebuttonbn_protect_recording_imported(
390
                $recordings[$params['id']]['imported'],
391
                false
392
            )
393
        );
394
    }
395
    // As the recordingid was not identified as imported recording link, execute actual uprotect.
396
    return array(
397
        'status' => bigbluebuttonbn_update_recordings(
398
            $params['id'],
399
            array('protect' => 'false')
400
        )
401
    );