Code Duplication    Length = 25-26 lines in 2 locations

manager/processors/save_module.processor.php 1 location

@@ 184-208 (lines=25) @@
181
}
182
183
// saves module user group access
184
function saveUserGroupAccessPermissons()
185
{
186
    global $modx;
187
    global $id, $newid;
188
    global $use_udperms;
189
190
    if ($newid) {
191
        $id = $newid;
192
    }
193
    $usrgroups = $_POST['usrgroups'];
194
195
    // check for permission update access
196
    if ($use_udperms == 1) {
197
        // delete old permissions on the module
198
        $modx->db->delete($modx->getFullTableName("site_module_access"), "module='{$id}'");
199
        if (is_array($usrgroups)) {
200
            foreach ($usrgroups as $value) {
201
                $modx->db->insert(array(
202
                    'module' => $id,
203
                    'usergroup' => stripslashes($value),
204
                ), $modx->getFullTableName('site_module_access'));
205
            }
206
        }
207
    }
208
}
209

manager/processors/save_tmplvars.processor.php 1 location

@@ 209-234 (lines=26) @@
206
    }
207
}
208
209
function saveDocumentAccessPermissons()
210
{
211
    global $id, $newid;
212
    global $modx, $use_udperms;
213
214
    $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_access');
215
216
    if ($newid) {
217
        $id = $newid;
218
    }
219
    $docgroups = $_POST['docgroups'];
220
221
    // check for permission update access
222
    if ($use_udperms == 1) {
223
        // delete old permissions on the tv
224
        $modx->db->delete($tbl_site_tmplvar_templates, "tmplvarid='{$id}'");
225
        if (is_array($docgroups)) {
226
            foreach ($docgroups as $value) {
227
                $modx->db->insert(array(
228
                    'tmplvarid' => $id,
229
                    'documentgroup' => stripslashes($value),
230
                ), $tbl_site_tmplvar_templates);
231
            }
232
        }
233
    }
234
}
235