function render_page($params) { if (sizeof($params) > 0 && $_POST['commenting'] == 'true') { create_comment(Entry::find_by_name(urldecode($params[0])), $_POST); } else { if (sizeof($params) > 0) { render_entry(Entry::find_by_name(urldecode($params[0]))); } else { echo '<ul id="entries">'; foreach (Entry::find_all() as $entry) { render_summary($entry); } echo '</ul>'; } } }
# if we have no service instances, redirect to new.php # $instance_data = $data->get_all('instances'); if (!count($instance_data)) { header("location: new.php"); exit; } # # get instances and group by service # $instance_groups = array(); foreach ($instance_data as $k => $instance) { $inst = getPluginInstance($k); $inst->icon_48 = $inst->iconUrl(48, "bot", true); $inst->name = $inst::NAME; $inst->summary = render_summary($GLOBALS['cfg']['team'], $inst); if ($inst->icfg['creator_id']) { $u = $GLOBALS['data']->get('users', $inst->icfg['creator_id']); $inst->icfg['creator_name'] = $u['user']; $inst->icfg['creator_url'] = "{$u['url']}team/{$u['user']}"; } $instance_groups[$inst->id]['plugin'] = $inst; $instance_groups[$inst->id]['instances'][] = $inst; } usort($instance_groups, 'local_sort'); function local_sort($a, $b) { return strcasecmp($a['plugin']->name, $b['plugin']->name); } $smarty->assign('instances', $instance_groups); #