function getMenu($type = 'object') { global $conf, $registry; require_once 'Horde/Menu.php'; $menu =& new Menu(); if (Auth::isAdmin('nwadmin:admin')) { $menu->add(Horde::applicationUrl('start.php'), _("Run"), 'reload.png', $registry->getImageDir('horde')); $menu->add(Horde::applicationUrl('player.php'), _("Players"), 'user.png', $registry->getImageDir('horde')); } $menu->add(Horde::applicationUrl('server.php'), _("Server Settings"), 'map_eu.png', $registry->getImageDir('horde')); $menu->add(Horde::applicationUrl('module.php'), _("Modules"), 'download.png', $registry->getImageDir('horde')); $menu->add(Horde::applicationUrl('savegame.php'), _("Saved Games"), 'data.png', $registry->getImageDir('horde')); if ($type == 'object') { return $menu; } return $menu->render(); }
/** * return a version details hash by version id * @param integer $version_id The ID of the stock item to display as a version * @return array The version hash containing stock name as name, stock note as description and a link */ public function getVersionDetails($version_id) { $item = $GLOBALS['backend']->fetch($version_id); return array('id' => $version_id, 'name' => $item->stock_name, 'description' => $item->note, 'link' => Horde::applicationUrl('stock.php', true)->add(array('stock_id' => $version_id, 'actionId' => 'view_stock'))->setRaw(true), 'readonly' => true); }
/* Hook to preselect the correct language in the widget. */ $_GET['new_lang'] = $language; } if (isset($_POST['horde_user']) && isset($_POST['horde_pass'])) { /* Destroy any existing session on login and make sure to use a * new session ID, to avoid session fixation issues. */ Horde::getCleanSession(); if ($auth->authenticate(Util::getPost('horde_user'), array('password' => Util::getPost('horde_pass')))) { $entry = sprintf('Login success for %s [%s] to Horde', Auth::getAuth(), $_SERVER['REMOTE_ADDR']); Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_INFO); if ($url_param) { $url = Horde::url(Util::removeParameter($url_param, session_name()), true); $horde_url = Horde::applicationUrl($registry->getParam('webroot', 'horde') . '/index.php', true); $horde_url = Util::addParameter($horde_url, 'url', $url); } else { $horde_url = Horde::applicationUrl('index.php', true); } $horde_url = Util::addParameter($horde_url, 'frameset', Util::getFormData('frameset') ? 1 : 0); header('Location: ' . $horde_url); exit; } else { $entry = sprintf('FAILED LOGIN for %s [%s] to Horde', Util::getFormData('horde_user'), $_SERVER['REMOTE_ADDR']); Horde::logMessage($entry, __FILE__, __LINE__, PEAR_LOG_ERR); if ($conf['menu']['always'] && !Util::getFormData('framed')) { $main_page = Util::addParameter(Horde::selfUrl(), 'framed', $auth->getLogoutReasonString()); if ($browser->hasQuirk('scrollbar_in_way')) { $scrollbar = 'yes'; } else { $scrollbar = 'auto'; } require HORDE_TEMPLATES . '/index/frames_index.inc';
/** * $Horde: horde/services/portal/rpcsum.php,v 2.19 2004/02/23 01:52:55 jon Exp $ * * Copyright 2001-2004 Jan Schneider <*****@*****.**> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. */ function _returnToPrefs() { $url = Horde::applicationUrl('services/prefs.php', true); header('Location: ' . Util::addParameter($url, 'group', 'display')); exit; }
require_once HORDE_LIBS . 'Horde/Identity.php'; require_once HORDE_LIBS . 'Horde/Menu.php'; require_once HORDE_LIBS . 'Horde/Help.php'; if (!Auth::isAuthenticated()) { Horde::authenticationFailureRedirect(); } // Get full name for title $identity =& Identity::singleton(); $fullname = $identity->getValue('fullname'); if (empty($fullname)) { $fullname = Auth::getAuth(); } // Get refresh interval. if ($prefs->getValue('summary_refresh_time')) { $refresh_time = $prefs->getValue('summary_refresh_time'); $refresh_url = Horde::applicationUrl('services/portal/'); } // Load layout from preferences. $layout_pref = @unserialize($prefs->getValue('portal_layout')); if (!is_array($layout_pref)) { $layout_pref = array(); } // Store the apps we need to load stylesheets for. $cssApps = array(); foreach ($layout_pref as $row) { foreach ($row as $item) { if (is_array($item) && !in_array($item['app'], $cssApps)) { $cssApps[] = $item['app']; } } }
<?php /** * $Horde: horde/scripts/http_login_refer.php,v 1.3 2004/01/01 15:16:54 jan Exp $ * * Copyright 1999-2004 Charles J. Hagenbuch <*****@*****.**> * Copyright 1999-2004 Jon Parise <*****@*****.**> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. */ require_once '../lib/base.php'; $auth =& Auth::singleton($conf['auth']['driver']); // Check for HTTP auth. if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW']) || !$auth->authenticate($_SERVER['PHP_AUTH_USER'], array('password' => $_SERVER['PHP_AUTH_PW']))) { header('WWW-Authenticate: Basic realm="' . $auth->getParam('realm') . '"'); header('HTTP/1.0 401 Unauthorized'); exit('Forbidden'); } if ($url = Util::getFormData('url')) { header('Location: ' . $url); } else { header('Location: ' . Horde::applicationUrl('login.php')); }
$matrix[$g_id] = Perms::integerToArray($g_perms); } $form->addVariable(_("Group permissions"), 'g', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_groups)); /* Set form title. */ $form->setTitle(Horde::img('perms.gif') . ' ' . sprintf(_("Edit permissions for '%s'"), $perms->getTitle($permission->getName()))); if ($form->validate($vars)) { $form->getInfo($vars, $info); /* Collapse the array for default/guest/creator. */ $info['default'] = isset($info['default'][0]) ? $info['default'][0] : null; $info['guest'] = isset($info['guest'][0]) ? $info['guest'][0] : null; $info['creator'] = isset($info['creator'][0]) ? $info['creator'][0] : null; /* Update and save the permissions. */ $permission->updatePermissions($info); $permission->save(); $notification->push(sprintf(_("Updated '%s'."), $permission->getShortName()), 'horde.success'); $url = Horde::applicationUrl('admin/perms/edit.php', true); $url = Util::addParameter($url, 'cid', $permission->getId()); header('Location: ' . $url); exit; } $title = _("Permissions Administration"); require HORDE_TEMPLATES . '/common-header.inc'; require HORDE_TEMPLATES . '/admin/common-header.inc'; $notification->notify(array('listeners' => 'status')); /* Render the form. */ $renderer =& new Horde_Form_Renderer(); $form->renderActive($renderer, $vars, 'edit.php', 'post'); echo '<br />'; require_once HORDE_LIBS . 'Horde/Perms/UI.php'; $ui =& new Perms_UI($perms); $ui->renderTree($cid);
if ($browser->isMobile()) { require HORDE_BASE . '/services/portal/mobile.php'; exit; } else { $url = Util::getFormData('url'); $initial_app = $prefs->getValue('initial_application'); if (!empty($url)) { $main_page = $url; } elseif (!empty($initial_app) && !($GLOBALS['perms']->exists($initial_app) && !$GLOBALS['perms']->hasPermission($initial_app, Auth::getAuth(), PERMS_READ))) { $main_page = Horde::url($registry->getInitialPage($initial_app)); } elseif (isset($registry->applications['horde']['initial_page'])) { $main_page = Horde::applicationUrl($registry->applications['horde']['initial_page']); } elseif (Auth::getAuth()) { $main_page = Horde::applicationUrl('services/portal/'); } else { $main_page = Horde::applicationUrl('login.php'); } if (!Util::getFormData('frameset') && ($conf['menu']['always'] || $conf['menu']['display'] && Auth::getAuth() && $prefs->getValue('show_sidebar'))) { if ($browser->hasQuirk('scrollbar_in_way')) { $scrollbar = 'yes'; } else { $scrollbar = 'auto'; } $main_page = Util::addParameter($main_page, 'frameset', 1); require HORDE_TEMPLATES . '/index/frames_index.inc'; } else { header('Location: ' . $main_page); exit; } } } else {
$form->validate($vars); if ($form->isValid()) { $form->getInfo($vars, $info); $result = $perms->removePermission($permission, true); if (is_a($result, 'PEAR_Error')) { $notification->push(sprintf(_("Unable to delete '%s': %s."), $permission->getShortName(), $result->getMessage()), 'horde.error'); } else { $notification->push(sprintf(_("Successfully deleted '%s'."), $permission->getShortName()), 'horde.success'); $url = Horde::applicationUrl('admin/perms/index.php', true); header('Location: ' . $url); exit; } } } elseif (!empty($form_submit)) { $notification->push(sprintf(_("Permission '%s' not deleted."), $permission->getShortName()), 'horde.success'); $url = Horde::applicationUrl('admin/perms/index.php', true); header('Location: ' . $url); exit; } $title = _("Permissions Administration"); require HORDE_TEMPLATES . '/common-header.inc'; require HORDE_TEMPLATES . '/admin/common-header.inc'; $notification->notify(array('listeners' => 'status')); /* Render the form. */ $renderer =& new Horde_Form_Renderer(); $form->renderActive($renderer, $vars, 'delete.php', 'post'); echo '<br />'; require_once HORDE_LIBS . 'Horde/Perms/UI.php'; $ui =& new Perms_UI($perms); $ui->renderTree($cid); require HORDE_TEMPLATES . '/common-footer.inc';
<?php /** * $Horde: horde/services/portal/mobile.php,v 2.12 2004/02/07 17:37:41 jan Exp $ * * Copyright 2002-2004 Chuck Hagenbuch <*****@*****.**> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. */ @define('HORDE_BASE', dirname(__FILE__) . '/../..'); require_once HORDE_BASE . '/lib/base.php'; require_once HORDE_LIBS . 'Horde/Identity.php'; require_once HORDE_LIBS . 'Horde/Mobile.php'; if (!Auth::getAuth()) { header('Location: ' . Util::addParameter(Horde::applicationUrl('login.php', true), 'url', Horde::selfUrl())); exit; } $identity =& Identity::singleton(); $fullname = $identity->getValue('fullname'); if (empty($fullname)) { $fullname = Auth::getAuth(); } $m =& new Horde_Mobile(_("Welcome")); $m->add(new Horde_Mobile_text(sprintf(_("Welcome, %s"), $fullname))); // Messy way of linking to active apps that support mobile // devices. Should be made more elegant at some point. if (!empty($registry->applications['mimp']['status']) && $registry->applications['mimp']['status'] != 'inactive') { $m->add(new Horde_Mobile_link($registry->getParam('name', 'mimp'), Horde::url($registry->getParam('webroot', 'mimp') . '/'), $registry->getParam('name', 'mimp'))); } $m->display();
$data .= '} else {' . "\n"; $data .= ' echo \'' . sprintf(_("Could not save %s configuration."), $app) . '\' . "\\n";' . "\n"; $data .= '}' . "\n\n"; } } if ($save == 'tmp') { $tmp_dir = Horde::getTempDir(); /* Add self-destruct code. */ $data .= 'echo \'Self-destructing...\' . "\\n";' . "\n"; $data .= 'if (unlink(__FILE__)) {' . "\n"; $data .= ' echo \'' . _("Upgrade script deleted.") . '\' . "\\n";' . "\n"; $data .= '} else {' . "\n"; $data .= ' echo \'' . sprintf(_("WARNING!!! REMOVE SCRIPT MANUALLY FROM %s."), $tmp_dir) . '\' . "\\n";' . "\n"; $data .= '}' . "\n"; /* The script should be saved to server's temporary directory. */ if ($fp = @fopen($tmp_dir . '/' . $filename, 'w')) { fwrite($fp, $data); fclose($fp); chmod($tmp_dir . '/' . $filename, 0777); $notification->push(sprintf(_("Saved setup upgrade script to: '%s'."), $tmp_dir . '/' . $filename), 'horde.success'); } else { $notification->push(sprintf(_("Could not save setup upgrade script to: '%s'."), $tmp_dir . '/' . $filename), 'horde.error'); } $url = Horde::applicationUrl('admin/setup/index.php', true); header('Location: ' . $url); exit; } else { /* Output script to browser for download. */ $browser->downloadHeaders($filename, 'text/plain', false, strlen($data)); echo $data; }
} if (!empty($banType) && !empty($theBan)) { $bans[$banType][] = $theBan; } } if (empty($bans)) { $notification->push(_("There are no bans in place.")); } } } // page setup $title = _("Player Information"); require_once NWNADMIN_TEMPLATES . '/common-header.inc'; require_once NWNADMIN_TEMPLATES . '/menu.inc'; // render the player info $baseUrl = Horde::applicationUrl('player.php', true); if (!empty($players)) { require NWNADMIN_TEMPLATES . '/player/pheader.inc'; $style = 'item1'; foreach ($players as $player) { if ($style == 'item1') { $style = 'item0'; } else { $style = 'item1'; } require NWNADMIN_TEMPLATES . '/player/player.inc'; } require NWNADMIN_TEMPLATES . '/player/footer.inc'; } // render ban info if (!empty($bans)) {
$name = $vals['name']; } $img = isset($vals['icon']) ? $registry->getParam('graphics', $app) . '/' . $vals['icon'] : $registry->getParam('icon', $app); $menutext .= '<tr><td align="center" width="28" height="20">' . Horde::img('tree/blank.gif', $name, 'width="16" height="16"') . '</td>'; $link = Horde::link(Horde::url($registry->applicationWebPath($vals['link'], $app)), $name, 'menuitem sidebaritem', $target, 'this.blur()', $name); $menutext .= '<td width="28" align="center">' . $link . Horde::img($img, $name, '', '') . '</a></td><td>' . $link . $name . '</a></td></tr>'; } } } } $menutext .= '</table></div></div>'; } if (Auth::isAuthenticated()) { /* Add an options link. */ $link = Horde::link(Horde::applicationUrl('services/prefs.php'), _("Options"), 'menuitem sidebaritem', $target, null, _("Options")); $label = _("Options"); $icon = 'prefs.gif'; $menutext .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center" width="28" height="20">' . $link . Horde::img($icon, $label) . '</a></td><td>' . $link . $label . '</a></td></tr></table>'; /* Add a logout link. */ $link = Horde::link(Auth::addLogoutParameters(Horde::applicationUrl('login.php'), AUTH_REASON_LOGOUT), _("Logout"), 'menuitem sidebaritem', $conf['menu']['always'] ? $target : '_parent', null, sprintf(_("Log out of %s"), $registry->getParam('name'))); $label = _("Logout"); $icon = 'logout.gif'; } else { /* Add a login link. */ $link = Horde::link(Horde::applicationUrl('login.php'), _("Login"), 'menuitem sidebaritem', $target, null, sprintf(_("Log in to %s"), $registry->getParam('name'))); $label = _("Login"); $icon = 'login.gif'; } $menutext .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center" width="28" height="20">' . $link . Horde::img($icon, $label) . '</a></td><td>' . $link . $label . '</a></td></tr></table>'; require HORDE_TEMPLATES . '/horde/menu.inc'; require HORDE_TEMPLATES . '/common-footer.inc';
require HORDE_TEMPLATES . '/common-header.inc'; require HORDE_TEMPLATES . '/admin/common-header.inc'; $notification->notify(array('listeners' => 'status')); if (!empty($form)) { include HORDE_TEMPLATES . '/admin/groups/' . $form; } /* Get the perms tree. */ $nodes = $groups->_datatree->get(DATATREE_FORMAT_FLAT, -1, true); /* Set up some node params. */ $spacer = ' '; $current = Util::getFormData('cid'); $icondir = array('icondir' => $registry->getParam('graphics')); $group_node = $icondir + array('icon' => 'group.gif'); $add = Horde::applicationUrl('admin/groups.php?actionID=addchild'); $edit = Horde::applicationUrl('admin/groups.php?actionID=edit'); $delete = Horde::applicationUrl('admin/groups.php?actionID=delete'); $edit_img = Horde::img('edit.gif', _("Edit Group"), 'hspace="2"'); $delete_img = Horde::img('delete.gif', _("Delete Group"), 'hspace="2"'); /* Set up the tree. */ $tree =& Horde_Tree::singleton('datatree', 'javascript'); $tree->setOption(array('border' => '0', 'class' => 'item', 'cellpadding' => '0', 'cellspacing' => '0', 'alternate' => true)); foreach ($nodes as $cid => $node) { $node_class = $current == $cid ? array('class' => 'selected') : array(); if ($cid == -1) { $add_img = Horde::img('group.gif', _("Add New Group"), 'hspace="2"'); $add_link = Horde::link(Util::addParameter($add, 'cid', $cid), _("Add New Group")) . $add_img . '</a>'; $base_node_params = $icondir + array('icon' => 'administration.gif'); $tree->addNode($cid, null, _("All Groups"), 0, true, $base_node_params + $node_class, array($spacer, $add_link)); } else { $add_img = Horde::img('group.gif', _("Add Child Group"), 'hspace="2"'); $add_link = Horde::link(Util::addParameter($add, 'cid', $cid), _("Add Child Group")) . $add_img . '</a>';
$upload = _uploadFTP($info); if ($upload) { $notification->push(sprintf(_("Uploaded all application setup files to server '%s'."), $info['hostspec']), 'horde.success'); $url = Horde::applicationUrl('admin/setup/index.php', true); header('Location: ' . $url); exit; } } /* Render the form. */ require_once HORDE_LIBS . 'Horde/Form/Renderer.php'; $renderer =& new Horde_Form_Renderer(); $ftpform = Util::bufferOutput(array($ftpform, 'renderActive'), $renderer, $vars, 'index.php', 'post'); } if (file_exists(Horde::getTempDir() . '/horde_setup_upgrade.php')) { /* Action to remove the configuration upgrade PHP script. */ $url = Horde::applicationUrl('admin/setup/scripts.php'); $url = Util::addParameter($url, 'clean', 'tmp'); $action = _("Remove saved script from server's temporary directory."); $actions[] = Horde::link($url, $action, '', '', '', $action) . $action . '</a>'; } /* Set up the template. */ $template =& new Horde_Template(); $menu =& new Menu(true, true, true); $template->set('apps', $apps); $template->set('actions', $actions, true); $template->set('ftpform', $ftpform, true); $template->set('menu', $menu->getMenu()); $template->set('notify', Util::bufferOutput(array($notification, 'notify'))); $title = _("Horde Configuration"); require HORDE_TEMPLATES . '/common-header.inc'; echo $template->fetch(HORDE_TEMPLATES . '/admin/setup/index.html');
/** * Generate a URL that links into Chora. * * @param string $script Name of the Chora script to link into * @param string $uri Any PATH_INFO portion that should be included * @param array $args Key/value pair of any GET parameters to append * @param string $anchor Anchor entity name * * @return string The URL, with session information if necessary. */ function url($script, $uri = '', $args = array(), $anchor = '') { global $conf; $arglist = array_merge(Chora::differingVars(), $args); $script = $script . '.php'; if ($conf['options']['use_path_info']) { if (substr($uri, 0, 1) != '/') { $script .= '/'; } $script .= $uri; } else { $arglist['f'] = $uri; } $url = Horde::applicationUrl($script); foreach ($arglist as $key => $val) { if (!empty($val) || $val === 0) { $url = Util::addParameter($url, $key, $val); } } if (!empty($anchor)) { $url .= "#{$anchor}"; } return $url; }