verify_auth(); load_plugins(); # # 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); 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);
<?php $dir = dirname(__FILE__); include "{$dir}/lib/init.php"; verify_auth(); load_plugins(); $instance = getPluginInstance($_GET['id']); if (!is_object($instance)) { die("instance not found"); } if ($_POST['delete-instance']) { $instance->deleteMe(); header("location: ./"); exit; } if ($_POST['new-token']) { $instance->regenToken(); $instance->saveConfig(); header("location: {$instance->getViewUrl()}&newtoken=1"); exit; } $instance->checkRequirements(); $smarty->assign('instance', $instance); $smarty->assign('html', $instance->onView()); $smarty->display('page_view.txt');
<?php $dir = dirname(__FILE__); include "{$dir}/lib/init.php"; verify_auth(); load_plugins(); $id = $_GET['id']; if ($_POST['channel']) { $instance = getPluginInstance($id); if (is_object($instance)) { if ($_POST['channel'] != $instance->icfg['channel']) { $instance->icfg['channel'] = $_POST['channel']; $instance->icfg['channel_name'] = $instance->getChannelName($_POST['channel']); } if ($_POST['label']) { $instance->icfg['label'] = $_POST['label']; } if ($_POST['bot_name']) { $instance->icfg['bot_name'] = $_POST['bot_name']; } if ($_POST['bot_icon']) { $instance->icfg['bot_icon'] = $_POST['bot_icon']; } $instance->saveConfig(); } else { $instance = createPluginInstance($id); $instance->iid = $_POST['uid']; $instance->onParentInit(); $instance->onInit(); $instance->icfg['created'] = time(); $instance->icfg['creator_id'] = $GLOBALS['cfg']['user']['user_id'];