Code Duplication    Length = 47-48 lines in 2 locations

htdocs/modules/system/admin/modulesadmin/modulesadmin.php 2 locations

@@ 1166-1213 (lines=48) @@
1163
            }
1164
        }
1165
        // RMV-NOTIFY
1166
        if ($module->getVar('hasnotification') != 0) {
1167
            if (empty($configs)) {
1168
                $configs = array();
1169
            }
1170
            // Main notification options
1171
            include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
1172
            include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
1173
            $options                             = array();
1174
            $options['_NOT_CONFIG_DISABLE']      = XOOPS_NOTIFICATION_DISABLE;
1175
            $options['_NOT_CONFIG_ENABLEBLOCK']  = XOOPS_NOTIFICATION_ENABLEBLOCK;
1176
            $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
1177
            $options['_NOT_CONFIG_ENABLEBOTH']   = XOOPS_NOTIFICATION_ENABLEBOTH;
1178
1179
            //$configs[] = array ('name' => 'notification_enabled', 'title' => '_NOT_CONFIG_ENABLED', 'description' => '_NOT_CONFIG_ENABLEDDSC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
1180
            $configs[] = array(
1181
                'name'        => 'notification_enabled',
1182
                'title'       => '_NOT_CONFIG_ENABLE',
1183
                'description' => '_NOT_CONFIG_ENABLEDSC',
1184
                'formtype'    => 'select',
1185
                'valuetype'   => 'int',
1186
                'default'     => XOOPS_NOTIFICATION_ENABLEBOTH,
1187
                'options'     => $options);
1188
            // Event specific notification options
1189
            // FIXME: for some reason the default doesn't come up properly
1190
            //  initially is ok, but not when 'update' module..
1191
            $options    = array();
1192
            $categories =& notificationCategoryInfo('', $module->getVar('mid'));
1193
            foreach ($categories as $category) {
1194
                $events =& notificationEvents($category['name'], false, $module->getVar('mid'));
1195
                foreach ($events as $event) {
1196
                    if (!empty($event['invisible'])) {
1197
                        continue;
1198
                    }
1199
                    $option_name           = $category['title'] . ' : ' . $event['title'];
1200
                    $option_value          = $category['name'] . '-' . $event['name'];
1201
                    $options[$option_name] = $option_value;
1202
                    //$configs[] = array ('name' => notificationGenerateConfig($category,$event,'name'), 'title' => notificationGenerateConfig($category,$event,'title_constant'), 'description' => notificationGenerateConfig($category,$event,'description_constant'), 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1);
1203
                }
1204
            }
1205
            $configs[] = array(
1206
                'name'        => 'notification_events',
1207
                'title'       => '_NOT_CONFIG_EVENTS',
1208
                'description' => '_NOT_CONFIG_EVENTSDSC',
1209
                'formtype'    => 'select_multi',
1210
                'valuetype'   => 'array',
1211
                'default'     => array_values($options),
1212
                'options'     => $options);
1213
        }
1214
1215
        if ($configs !== false) {
1216
            $msgs[]         = 'Adding module config data...';
@@ 336-382 (lines=47) @@
333
                    }
334
                }
335
                // RMV-NOTIFY
336
                if ($module->getVar('hasnotification') != 0) {
337
                    if (empty($configs)) {
338
                        $configs = array();
339
                    }
340
                    // Main notification options
341
                    include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
342
                    include_once XOOPS_ROOT_PATH . '/include/notification_functions.php';
343
                    $options                             = array();
344
                    $options['_NOT_CONFIG_DISABLE']      = XOOPS_NOTIFICATION_DISABLE;
345
                    $options['_NOT_CONFIG_ENABLEBLOCK']  = XOOPS_NOTIFICATION_ENABLEBLOCK;
346
                    $options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE;
347
                    $options['_NOT_CONFIG_ENABLEBOTH']   = XOOPS_NOTIFICATION_ENABLEBOTH;
348
349
                    $configs[] = array(
350
                        'name'        => 'notification_enabled',
351
                        'title'       => '_NOT_CONFIG_ENABLE',
352
                        'description' => '_NOT_CONFIG_ENABLEDSC',
353
                        'formtype'    => 'select',
354
                        'valuetype'   => 'int',
355
                        'default'     => XOOPS_NOTIFICATION_ENABLEBOTH,
356
                        'options'     => $options);
357
                    // Event-specific notification options
358
                    // FIXME: doesn't work when update module... can't read back the array of options properly...  " changing to "
359
                    $options    = array();
360
                    $categories =& notificationCategoryInfo('', $module->getVar('mid'));
361
                    foreach ($categories as $category) {
362
                        $events =& notificationEvents($category['name'], false, $module->getVar('mid'));
363
                        foreach ($events as $event) {
364
                            if (!empty($event['invisible'])) {
365
                                continue;
366
                            }
367
                            $option_name           = $category['title'] . ' : ' . $event['title'];
368
                            $option_value          = $category['name'] . '-' . $event['name'];
369
                            $options[$option_name] = $option_value;
370
                        }
371
                        unset($events);
372
                    }
373
                    unset($categories);
374
                    $configs[] = array(
375
                        'name'        => 'notification_events',
376
                        'title'       => '_NOT_CONFIG_EVENTS',
377
                        'description' => '_NOT_CONFIG_EVENTSDSC',
378
                        'formtype'    => 'select_multi',
379
                        'valuetype'   => 'array',
380
                        'default'     => array_values($options),
381
                        'options'     => $options);
382
                }
383
384
                if ($configs !== false) {
385
                    $msgs[]         = _AM_SYSTEM_MODULES_MODULE_DATA_ADD;