/** * Loads up the specified theme for usage * @param string $theme Theme 'folder' name to be loaded * @return array Array containing the theme's .info data */ function theme_get_info($theme = null) { global $ssc_site_path, $ssc_site_url; static $info = null; if ($theme) { // Get the theme data $info = ssc_parse_ini_file('theme', "{$ssc_site_path}/themes/{$theme}/{$theme}.info"); if (!$info) { ssc_die(array('title' => 'Invalid Theme', 'body' => 'The selected theme is borked')); } if (isset($info['js']) && is_array($info['js'])) { foreach ($info['js'] as $path) { ssc_add_js("/themes/{$theme}/{$path}"); } } if (isset($info['css']) && is_array($info['css'])) { foreach ($info['css'] as $path) { $tmp = explode("#", $path); ssc_add_css("/themes/{$theme}/{$tmp['0']}", $tmp[1]); } } } return $info; }
/** * Generates the base admin listing */ function _admin_base_content() { global $ssc_user, $ssc_database, $ssc_site_path, $ssc_site_url; $out = ''; // Get list of modules if ($ssc_user->gid == SSC_USER_ROOT) { $result = $ssc_database->query("SELECT filename FROM #__module ORDER BY filename ASC"); } else { $result = $ssc_database->query("SELECT filename FROM #__permission p LEFT JOIN #__module m ON module_id = m.id WHERE group_id = %d", $ssc_user->gid); } // For storage $list = array(); // Get the info about each module while ($mod = $ssc_database->fetch_object($result)) { $info = ssc_parse_ini_file('module', "{$ssc_site_path}/modules/{$mod->filename}/{$mod->filename}.info"); $list[$info['package']][$mod->filename] = $info; } // Show the list $op = array('html' => true, 'attributes' => array('class' => 'admin-block')); foreach ($list as $type => $mod) { if ($type == '') { $type = t('Uncategorized'); } // Category title $out .= "<h3>{$type}</h3>"; foreach ($mod as $file => $module) { // Hide "admin" admin options if ($file == 'admin') { continue; } $block = "<img src=\"{$ssc_site_url}/images/{$file}.png\" alt=\"\" /><span><span>{$module['name']}</span><span>{$module['description']}</span></span>"; $out .= l($block, "/admin/{$file}", $op); } } return $out; }