} closedir($handle); // sort the order of the templates; also make sure that the 'default' template is placed at index [0] so that 404 pages and others pick that one. sort($template, SORT_LOCALE_STRING); if (!empty($cfg['default_template'])) { array_unshift($template, $cfg['default_template']); } $ccms['template_collection'] = $template; } else { die($ccms['lang']['system']['error_templatedir']); } // GENERAL FUNCTIONS == // [i_a] moved to common.inc.php // Fill active module array and load the plugin code $modules = $db->SelectArray($cfg['db_prefix'] . 'modules'); if ($db->ErrorNumber()) { $db->Kill(); } // add index to quickly access items in the $modules array: $modules_index = array(); for ($i = count($modules) - 1; $i >= 0; $i--) { $modules_index[$modules[$i]['modName']] = $i; } // load the global permissions so we can ask what a given user may and may not do later on: if (checkAuth() && ($php_src_is_admin_code || !empty($_SESSION['ccms_userID']))) { // only do this extra work when we can expect to actually /use/ it: $perm = new CcmsGlobalPermissions($db, $cfg['db_prefix']); } else { $perm = new CcmsGlobalPermissions(); // NIL permissions }