foreach ($svnlogs as $svnlog) { $show_menu .= $sep; $revlist[] = $svnlog['rev']; if ($vars['rev'] == $svnlog['rev']) { $show_menu .= '<span class="pagemenu-selected">'; } $linktext = 'r' . $svnlog['rev'] . ' <small>' . format_timestamp($svnlog['date']) . '</small>'; $show_menu .= generate_link($linktext, array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig', 'rev' => $svnlog['rev'])); if ($vars['rev'] == $svnlog['rev']) { $show_menu .= '</span>' . PHP_EOL; } } } echo $show_menu; print_optionbar_end(); if (check_extension_exists('svn') && in_array($vars['rev'], $revlist)) { list($diff, $errors) = svn_diff($device_config_file, $vars['rev'] - 1, $device_config_file, $vars['rev']); if (!$diff) { $text = '没有区别'; } else { $text = ''; while (!feof($diff)) { $text .= fread($diff, 8192); } fclose($diff); fclose($errors); } } else { $fh = fopen($device_config_file, 'r') or die("Can't open file"); $text = fread($fh, filesize($device_config_file)); fclose($fh);
<div class="col-lg-6"> <?php echo generate_box_open(array('header-border' => TRUE, 'title' => 'Access Keys')); ?> <table class="table table-striped table-condensed"> <tr> <td>RSS/Atom access key</td> <?php // Warn about lack of mcrypt unless told not to. if (!check_extension_exists('mcrypt')) { echo '<td colspan="2"><span class="text text-danger">To use RSS/Atom feeds the PHP mcrypt module is required.</span></td>'; } else { if (!check_extension_exists('SimpleXML')) { echo '<td colspan="2"><span class="text text-danger">To use RSS/Atom feeds the PHP SimpleXML module is required.</span></td>'; } else { echo " <td>RSS/Atom access key created {$atom_key_updated}.</td>"; echo ' <td>'; $form = array('type' => 'simple'); // Elements $form['row'][0]['key_type'] = array('type' => 'hidden', 'value' => 'atom'); $form['row'][0]['atom_key'] = array('type' => 'submit', 'name' => 'Reset', 'icon' => '', 'class' => 'btn-mini btn-success', 'value' => 'toggle'); print_form($form); unset($form); echo '</td>'; } } ?> </tr>
/** * This function convert array based group/alerts to observium xml based template * * Template attributes: * type - Type (ie: alert, group, notification) * description - Description * version - Template format version * created - Created date * observium - Used observium version * id - Unique template id, based on conditions/associations/text * * Template params: * entity - Type of entity * name - Unique name for current set of params * description - Description for current set of params * message - Text message * conditions - Set of conditions * conditions_and - 1 - require all conditions, 0 - require any condition * conditions_complex - oneline conditions set (not used for now) * associations - Set of associations * device - Set of device associations * entity - Set of entity associations * * @param string $type Current template type for generate (alert or group) * @param array $params * @param boolean $as_xml_object If set to TRUE, return template as SimpleXMLElement object * * @return mixed XML based template (as string or SimpleXMLElement object if $as_xml_object set to true) */ function generate_template($type, $params, $as_xml_object = FALSE) { if (!check_extension_exists('SimpleXML', 'SimpleXML php extension not found, it\'s required for generate templates.')) { return ''; } // r($params); var_export($params); $type = strtolower(trim($type, " '\"\t\n\r\v")); // Clean template type $template_xml = new SimpleXMLElement('<template/>'); // Template type $template_xml->addAttribute('type', $type); // Template description $template_xml->addAttribute('description', 'Autogenerated observium template'); // Format version. If something changed in templates format, increase version! $template_xml->addAttribute('version', '0.91'); // Template created date and time $template_xml->addAttribute('created', date('r')); // Used observium version $template_xml->addAttribute('observium', OBSERVIUM_VERSION); $template_array = array(); switch ($type) { case 'group': $template_array['entity_type'] = strtolower(trim($params['entity_type'], " '\"\t\n\r\v")); $template_array['name'] = strtolower(trim($params['group_name'], " '\"\t\n\r\v")); $template_array['description'] = trim($params['group_descr'], " '\"\t\n\r\v"); break; case 'alert': $template_array['entity_type'] = strtolower(trim($params['entity_type'], " '\"\t\n\r\v")); $template_array['name'] = strtolower(trim($params['alert_name'], " '\"\t\n\r\v")); //$template_array['description'] = trim($params['alert_descr'], " '\"\t\n\r\0\x0B"); $template_array['message'] = $params['alert_message']; $template_array['severity'] = strtolower(trim($params['severity'], " '\"\t\n\r\v")); if (in_array($params['suppress_recovery'], array('1', 'on', 'yes', TRUE))) { $template_array['suppress_recovery'] = 1; } else { $template_array['suppress_recovery'] = 0; } $template_array['delay'] = trim($params['delay'], " '\"\t\n\r\v"); $template_array['delay'] = (int) $template_array['delay']; $template_array['conditions_and'] = (int) $params['and']; $and_or = $params['and'] ? " AND " : " OR "; $conds = array(); if (!is_array($params['conditions'])) { $params['conditions'] = json_decode($params['conditions'], TRUE); } foreach ($params['conditions'] as $cond) { if (!is_array($cond)) { $cond = json_decode($cond, TRUE); } $count = count($cond); if (isset($cond['metric']) && $count >= 3) { $line = $cond['metric'] . ' ' . $cond['condition'] . ' ' . $cond['value']; } else { if ($count === 3) { $line = implode(' ', $cond); } else { continue; } } $conds[] = $line; } if ($conds) { $template_array['conditions'] = $conds; $template_array['conditions_complex'] = implode($and_or, $conds); } break; case 'notification': $template_array['name'] = strtolower(trim($params['name'], " '\"\t\n\r\v")); $template_array['description'] = trim($params['description'], " '\"\t\n\r\v"); $template_array['message'] = $params['message']; break; default: print_error("Unknown template type '{$type}' passed to " . __FUNCTION__ . "()."); return ''; } // Associations $associations = array(); foreach ($params['associations'] as $assoc) { // Each associations set if (!is_array($assoc)) { $assoc = json_decode($assoc, TRUE); } //r($assoc); foreach (array('device', 'entity') as $param) { if (isset($assoc[$param . '_attribs'])) { $association[$param] = array(); if (!is_array($assoc[$param . '_attribs'])) { $assoc[$param . '_attribs'] = json_decode($assoc[$param . '_attribs'], TRUE); } foreach ($assoc[$param . '_attribs'] as $attrib) { if (!is_array($attrib)) { $attrib = json_decode($attrib, TRUE); } //r($attrib); $count = count($attrib); if (empty($attrib) || $attrib['attrib'] == '*') { $association[$param] = array('*'); break; } else { if (isset($attrib['attrib']) && $count >= 3) { $line = $attrib['attrib'] . ' ' . $attrib['condition'] . ' ' . $attrib['value']; } else { if ($count === 3) { $line = implode(' ', $attrib); } else { continue; } } } $association[$param][] = $line; } } } $associations[] = $association; } //r($associations); if ($associations) { $template_array['associations'] = $associations; } //foreach (array('device', 'entity') as $param) //{ // $conds = array(); // if (isset($params['assoc_' . $param . '_conditions'])) // { // foreach (explode("\n", $params['assoc_' . $param . '_conditions']) as $cond) // { // $line = trim($cond); // if ($line == "*") // { // $conds = array($line); // break; // } // $count = count(explode(" ", $line, 3)); // if ($count === 3) // { // $line = implode(' ', $cond); // $conds[] = $line; // } // } // } // else if (isset($params[$param . '_attribs'])) // { // if (!is_array($params[$param . '_attribs'])) // { // $params[$param . '_attribs'] = json_decode($params[$param . '_attribs'], TRUE); // } // foreach ($params[$param . '_attribs'] as $attribs) // { // if (!is_array($attribs)) // { // $attribs = json_decode($attribs, TRUE); // } // foreach ($attribs as $cond) // { // $count = count($cond); // if (empty($cond) || $cond['attrib'] == '*') // { // $conds = array('*'); // break; // } // else if ($count === 3) // { // if (isset($cond['attrib'])) // { // $line = $cond['attrib'] . ' ' . $cond['condition'] . ' ' . $cond['value']; // } else { // $line = implode(' ', $cond); // } // $attrib[] = $line; // } // } // $conds[] = $attrib; // } // } // r($conds); // if ($conds) // { // $and_or = " AND "; // $template_array['associations'][$param] = $conds; // } //} // Convert template array to xml array_to_xml($template_array, $template_xml); // Add unique id, based on conditions/associations (can used for quick compare templates) if ($type != 'notification') { $template_id = md5(serialize(array($template_array['conditions'], $template_array['associations']))); } else { $template_id = md5($template_array['message']); } $template_xml->addAttribute('id', $template_id); // Name must be safe and not empty! if (!empty($template_array['name'])) { $template_array['name'] = safename($template_array['name']); } else { $template_array['name'] = 'autogenerated_' . $template_id; } if ($as_xml_object) { return $template_xml; } else { // Convert objected template to XML string return $template_xml->asXML(); } }
/** * Store encrypted password in $_SESSION['user_encpass'], required for some auth mechanism, ie ldap * * @param string $auth_password Plain password * @param string $key Key for password encrypt * @return string Encrypted password */ function session_encrypt_password($auth_password, $key) { // Store encrypted password if ($GLOBALS['config']['auth_mechanism'] == 'ldap' && !($GLOBALS['config']['auth_ldap_bindanonymous'] || strlen($GLOBALS['config']['auth_ldap_binddn'] . $GLOBALS['config']['auth_ldap_bindpw']))) { if (check_extension_exists('mcrypt')) { // For some admin LDAP functions required store encrypted password in session (userslist) $_SESSION['user_encpass'] = encrypt($auth_password, $key . get_unique_id()); } else { $_SESSION['user_encpass'] = base64_encode($auth_password); $_SESSION['mcrypt_required'] = 1; } } return $_SESSION['user_encpass']; }
function print_prompt($text, $default_yes = FALSE) { if (is_cli()) { if (check_extension_exists('posix') && !posix_isatty(STDOUT)) { // If now not have interactive TTY skip any prompts, return default $return = TRUE && $default_yes; } $question = $default_yes ? 'Y/n' : 'y/N'; echo trim($text), " [{$question}]: "; $handle = fopen('php://stdin', 'r'); $line = strtolower(trim(fgets($handle, 3))); fclose($handle); if ($default_yes) { $return = $line === 'no' || $line === 'n'; } else { $return = $line === 'yes' || $line === 'y'; } } else { // Here placeholder for web prompt $return = TRUE && $default_yes; } return $return; }
include $config['html_dir'] . '/includes/authenticate-functions.inc.php'; } else { session_logout(); header('Location: ' . $config['base_url']); $auth_message = '错误: 没有有效的 auth_mechanism 被指定!'; exit; } if ($vars['page'] == "logout" && $_SESSION['authenticated']) { if (auth_can_logout()) { session_logout(function_exists('auth_require_login')); $auth_message = "注销"; } header('Location: ' . $config['base_url']); exit; } $mcrypt_exists = check_extension_exists('mcrypt'); $user_unique_id = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']); if (!$_SESSION['authenticated'] && isset($_GET['username']) && isset($_GET['password'])) { $_SESSION['username'] = $_GET['username']; $_SESSION['password'] = $_GET['password']; } else { if (!$_SESSION['authenticated'] && isset($_POST['username']) && isset($_POST['password'])) { $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; } else { if ($mcrypt_exists && !$_SESSION['authenticated'] && isset($_COOKIE['ckey'])) { $ckey = dbFetchRow("SELECT * FROM `users_ckeys` WHERE `user_uniq` = ? AND `user_ckey` = ? LIMIT 1", array($user_unique_id, $_COOKIE['ckey'])); if (is_array($ckey)) { if ($ckey['expire'] > $currenttime) { $_SESSION['username'] = $ckey['username']; $_SESSION['password'] = decrypt($ckey['user_encpass'], $_COOKIE['dkey']);
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage authentication * @copyright (C) 2006-2014 Adam Armstrong * */ // Warn if authentication will be impossible. check_extension_exists('ldap', 'LDAP selected as authentication module, but PHP does not have LDAP support! Please load the PHP LDAP module.', TRUE); // If kerberized login is used, take user from Apache to bypass login screen if ($config['auth_ldap_kerberized']) { $_SESSION['username'] = $_SERVER['REMOTE_USER']; } // Set LDAP debugging level to 7 (dumped to Apache daemon error log) (not virtualhost error log!) if ($debug) { // Disabled by default, VERY chatty. // ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); } // If a single server is specified, convert it to array anyway for use in functions below if (!is_array($config['auth_ldap_server'])) { // If no server set and domain is specified, get domain controllers from SRV records if ($config['auth_ldap_server'] == '' && $config['auth_ldap_ad_domain'] != '') { $config['auth_ldap_server'] = ldap_domain_servers_from_dns($config['auth_ldap_ad_domain']); } else { $config['auth_ldap_server'] = array($config['auth_ldap_server']); }
print_error("RRD Directory is missing ({$config['rrd_dir']}). Graphing may fail."); } if (!is_dir($config['log_dir'])) { print_error("Log Directory is missing ({$config['log_dir']}). Logging may fail."); } if (!is_dir($config['temp_dir'])) { print_error("Temp Directory is missing ({$config['temp_dir']}). Graphing may fail."); } if (!is_writable($config['temp_dir'])) { print_error("Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail."); } if (ini_get('register_globals')) { $notifications[] = array('text' => 'register_globals enabled in php.ini. Disable it!', 'severity' => 'alert'); } // verify if PHP supports session, die if it does not check_extension_exists('session', '', TRUE); ob_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <base href="<?php echo $config['base_url']; ?> " /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <link href="css/bootstrap.css" rel="stylesheet" type="text/css" /> <link href="css/bootstrap-select.css" rel="stylesheet" type="text/css" /> <link href="css/bootstrap-hacks.css" rel="stylesheet" type="text/css" />
check_extension_exists('mcrypt', 'This extension required for use by the "remember me" feature. Please install the php5-mcrypt package on Ubuntu/Debian or the php-mcrypt package on RHEL/CentOS. Alternatively, you can disable this feature by setting $config[\'login_remember_me\'] = FALSE; in your config.'); } // Warning about web_url config, only for ssl if (is_ssl() && preg_match('/^http:/', $config['web_url'])) { $notifications[] = array('text' => 'Setting \'web_url\' for "External Web URL" not set or incorrect, please update on ' . generate_link('Global Settings Edit', array('page' => 'settings', 'section' => 'wui')) . ' page.', 'severity' => 'warning'); } // Warning about need DB schema update $db_version = get_db_version(); $db_version = sprintf("%03d", $db_version + 1); if (is_file($config['install_dir'] . "/update/{$db_version}.sql") || is_file($config['install_dir'] . "/update/{$db_version}.php")) { $notifications[] = array('text' => 'Your database schema is old and needs updating. Run from server console: <pre style="padding: 3px" class="small">' . $config['install_dir'] . '/discovery.php -u</pre>', 'severity' => 'alert'); } unset($db_version); // Check mysqli extension if (OBS_DB_EXTENSION != 'mysqli' && check_extension_exists('mysqli', '')) { $notifications[] = array('title' => 'Deprecated MySQL Extension', 'text' => 'The deprecated mysql extension is still in use, we recommend using mysqli.<br />To switch, add the following to your config.php: <pre>$config[\'db_extension\'] = \'mysqli\';</pre>', 'severity' => 'warning'); } //$notifications[] = array('text' => dbHostInfo(), 'severity' => 'debug'); // Warning about obsolete config on some pages if (OBS_DEBUG || in_array($vars['tab'], array('data', 'perf', 'edit', 'showtech')) || in_array($vars['page'], array('pollerlog', 'settings', 'preferences'))) { // FIXME move to notification center? print_obsolete_config(); } } if (isset($cache['maint']['count']) && $cache['maint']['count'] > 0) { $notifications[] = array('text' => '<h4>Scheduled Maintenance in Progress</h4>' . 'Some or all alert notifications have been suppressed due to a scheduled maintenance.', 'severity' => 'warning'); $alerts[] = array('text' => '<h4>Scheduled Maintenance in Progress</h4>' . 'Some or all alert notifications have been suppressed due to a scheduled maintenance.', 'severity' => 'warning'); } foreach ($alerts as $alert) { // FIXME handle severity parameter with colour or icon?
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage authentication * @copyright (C) 2006-2015 Adam Armstrong * */ // Warn if authentication will be impossible. check_extension_exists('ldap', 'LDAP作为认证模块, 但PHP不支持LDAP! 请加载PHP LDAP模块.', TRUE); // If kerberized login is used, take user from Apache to bypass login screen if ($config['auth_ldap_kerberized']) { $_SESSION['username'] = $_SERVER['REMOTE_USER']; } // Set LDAP debugging level to 7 (dumped to Apache daemon error log) (not virtualhost error log!) if (OBS_DEBUG > 1) { // Disabled by default, VERY chatty. ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); } // If a single server is specified, convert it to array anyway for use in functions below if (!is_array($config['auth_ldap_server'])) { // If no server set and domain is specified, get domain controllers from SRV records if ($config['auth_ldap_server'] == '' && $config['auth_ldap_ad_domain'] != '') { $config['auth_ldap_server'] = ldap_domain_servers_from_dns($config['auth_ldap_ad_domain']); } else { $config['auth_ldap_server'] = array($config['auth_ldap_server']); }
include $config['html_dir'] . "/includes/cache-data.inc.php"; // Include navbar if ($vars['bare'] != "yes") { include $config['html_dir'] . "/includes/navbar.inc.php"; } } ?> <div class="container"> <?php if ($_SESSION['authenticated']) { if ($_SESSION['userlevel'] > 7) { // Warn about lack of mcrypt unless told not to. if ($config['login_remember_me']) { check_extension_exists('mcrypt', 'This extension required for use by the "remember me" feature. Please install the php5-mcrypt package on Ubuntu/Debian or the php-mcrypt package on RHEL/Centos. Alternatively, you can disable this feature by setting $config[\'login_remember_me\'] = FALSE; in your config.'); } // Warn about need DB schema update $db_version = get_db_version(); $db_version = sprintf("%03d", $db_version + 1); if (is_file($config['install_dir'] . "/update/{$db_version}.sql") || is_file($config['install_dir'] . "/update/{$db_version}.php")) { print_warning("Your database schema is old and needs updating. Run from server console:\n <pre class='small'>{$config['install_dir']}/discovery.php -h none</pre>"); } unset($db_version); } // Authenticated. Print a page. if (isset($vars['page']) && !strstr("..", $vars['page']) && is_file($config['html_dir'] . "/pages/" . $vars['page'] . ".inc.php")) { include $config['html_dir'] . "/pages/" . $vars['page'] . ".inc.php"; } else { if (isset($config['front_page']) && is_file($config['html_dir'] . "/" . $config['front_page'])) { include $config['front_page'];
<input type="text" class="input-xlarge" id="username" name="username"> </div> </div> <div class="control-group"> <label class="control-label" for="password">密   码</label> <div class="controls"> <input type="password" class="input-xlarge" id="password" name="password"> </div> </div> <div class="control-group"> <label class="control-label" for="optionsCheckbox2"></label> <div class="controls"> <?php if (check_extension_exists('mcrypt')) { ?> <label class="checkbox"> <input type="checkbox" id="remember" name="remember"> 保持登录状态 </label> <?php } ?> </div> </div> <div class="controls"> <button type="submit" class="btn-large btn"> <i class="icon-lock"></i> 登录系统 </button>
function get_http_request($request, $context = array(), $rate_limit = FALSE) { global $config; $ok = TRUE; if (defined('OBS_HTTP_REQUEST') && OBS_HTTP_REQUEST === FALSE) { print_debug("HTTP requests skipped since previous request exit with timeout"); $ok = FALSE; $GLOBALS['response_headers'] = array('code' => '408', 'status' => 'Request Timeout'); } else { if (!ini_get('allow_url_fopen')) { print_debug('HTTP requests disabled, since PHP config option "allow_url_fopen" set to off. Please enable this option in your PHP config.'); $ok = FALSE; $GLOBALS['response_headers'] = array('code' => '501', 'status' => 'Not Implemented'); } else { if (preg_match('/^https/i', $request) && !check_extension_exists('openssl')) { // Check if Secure requests allowed, but ssl extensin not exist print_debug(__FUNCTION__ . '() wants to connect with https but https is not enabled on this server. Please check your PHP settings, the openssl extension must exist and be enabled.'); logfile(__FUNCTION__ . '() wants to connect with https but https is not enabled on this server. Please check your PHP settings, the openssl extension must exist and be enabled.'); $ok = FALSE; $GLOBALS['response_headers'] = array('code' => '501', 'status' => 'HTTPS Method Not Implemented'); } } } if ($ok && $rate_limit && is_numeric($rate_limit) && $rate_limit >= 0) { // Check limit rates to this domain (per/day) if (preg_match('/^https?:\\/\\/([\\w\\.]+[\\w\\-\\.]*(:\\d+)?)/i', $request, $matches)) { $date = format_unixtime($config['time']['now'], 'Y-m-d'); $domain = $matches[0]; // base domain (with http(s)): https://test-me.com/ -> https://test-me.com $rate_db = json_decode(get_obs_attrib('http_rate_' . $domain), TRUE); //print_vars($date); print_vars($rate_db); if (is_array($rate_db) && isset($rate_db[$date])) { $rate_count = $rate_db[$date]; } else { $rate_count = 0; } $rate_count++; set_obs_attrib('http_rate_' . $domain, json_encode(array($date => $rate_count))); if ($rate_count > $rate_limit) { print_debug("HTTP requests skipped because the rate limit {$rate_limit}/day for domain '{$domain}' is exceeded (count: {$rate_count})"); $GLOBALS['response_headers'] = array('code' => '429', 'status' => 'Too Many Requests'); $ok = FALSE; } else { if (OBS_DEBUG > 1) { print_debug("HTTP rate count for domain '{$domain}': {$rate_count} ({$rate_limit}/day)"); } } } else { $rate_limit = FALSE; } } if (OBS_DEBUG > 0) { $debug_request = $request; if (OBS_DEBUG < 2 && strpos($request, 'update.observium.org')) { $debug_request = preg_replace('/&stats=.+/', '&stats=***', $debug_request); } $debug_msg = PHP_EOL . 'REQUEST[%y' . $debug_request . '%n]'; } if (!$ok) { if (OBS_DEBUG > 0) { print_message($debug_msg . PHP_EOL . 'REQUEST STATUS[' . $GLOBALS['response_headers']['code'] . ' ' . $GLOBALS['response_headers']['status'] . ']', 'console'); } return FALSE; } $response = ''; if (!is_array($context)) { $context = array(); } // Fix context if not array passed $opts = array('http' => $context); $opts['http']['timeout'] = '15'; // User agent (required for some type of queries, ie geocoding) if (!isset($opts['http']['header'])) { $opts['http']['header'] = ''; } // Avoid 'undefined index' when concatting below $opts['http']['header'] .= 'User-Agent: ' . OBSERVIUM_PRODUCT . '/' . OBSERVIUM_VERSION . '\\r\\n'; if (isset($config['http_proxy']) && $config['http_proxy']) { $opts['http']['proxy'] = 'tcp://' . $config['http_proxy']; $opts['http']['request_fulluri'] = TRUE; } // Basic proxy auth if (isset($config['proxy_user']) && $config['proxy_user'] && isset($config['proxy_password'])) { $auth = base64_encode($config['proxy_user'] . ':' . $config['proxy_password']); $opts['http']['header'] .= 'Proxy-Authorization: Basic ' . $auth . '\\r\\n'; } $start = utime(); $context = stream_context_create($opts); $response = file_get_contents($request, FALSE, $context); $runtime = utime() - $start; // Parse response headers $head = array(); foreach ($http_response_header as $k => $v) { $t = explode(':', $v, 2); if (isset($t[1])) { $head[trim($t[0])] = trim($t[1]); } else { if (preg_match("!HTTP/([\\d\\.]+)\\s+(\\d+)(.*)!", $v, $matches)) { $head['http'] = $matches[1]; $head['code'] = intval($matches[2]); $head['status'] = trim($matches[3]); } else { $head[] = $v; } } } $GLOBALS['response_headers'] = $head; if (OBS_DEBUG > 0) { if (OBS_DEBUG < 2 && strpos($request, 'update.observium.org')) { $request = preg_replace('/&stats=.+/', '&stats=***', $request); } print_message($debug_msg . PHP_EOL . 'REQUEST STATUS[' . $head['code'] . ' ' . $head['status'] . ']' . PHP_EOL . 'REQUEST RUNTIME[' . ($runtime > 3 ? '%r' : '%g') . round($runtime, 4) . 's%n]', 'console'); if (OBS_DEBUG > 1) { print_message("RESPONSE[\n" . $response . "\n]", 'console', FALSE); print_vars($http_response_header); print_vars($opts); } } // Set OBS_HTTP_REQUEST for skip all other requests if (!defined('OBS_HTTP_REQUEST')) { if ($response === FALSE && empty($http_response_header)) { $GLOBALS['response_headers'] = array('code' => '408', 'status' => 'Request Timeout'); // Timeout error, only if not received responce headers define('OBS_HTTP_REQUEST', FALSE); print_debug(__FUNCTION__ . '() exit with timeout. Access to outside localnet is blocked by firewall or network problems. Check proxy settings.'); logfile(__FUNCTION__ . '() exit with timeout. Access to outside localnet is blocked by firewall or network problems. Check proxy settings.'); } else { define('OBS_HTTP_REQUEST', TRUE); } } // FIXME. what if first request fine, but second broken? //else if ($response === FALSE) //{ // if (function_exists('runkit_constant_redefine')) { runkit_constant_redefine('OBS_HTTP_REQUEST', FALSE); } //} return $response; }
* */ ?> <div class="row" style="margin-top: 50px;"> <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2 col-xl-6 col-xl-offset-3"> <div class="box box-solid" style="background-image: url('images/login-hamster-large.png'); background-position: left 10px top -65px; background-repeat: no-repeat;"> <div class="login-box"> <div class="row"> <div class="col-xs-4 col-sm-4 col-md-4"> </div> <div class="col-xs-8 col-sm-8 col-md-8"> <?php $form = array('type' => 'horizontal', 'id' => 'logonform', 'class' => NULL, 'fieldset' => array('logon' => 'Please log in:')); $form['row'][0]['username'] = array('type' => 'text', 'fieldset' => 'logon', 'name' => 'Username', 'placeholder' => '', 'class' => 'input-xlarge', 'value' => ''); $form['row'][1]['password'] = array('type' => 'password', 'fieldset' => 'logon', 'name' => 'Password', 'placeholder' => '', 'class' => 'input-xlarge', 'value' => ''); if ($config['login_remember_me'] && check_extension_exists('mcrypt')) { $form['row'][2]['remember'] = array('type' => 'checkbox', 'fieldset' => 'logon', 'placeholder' => 'Remember my login'); } $form['row'][3]['submit'] = array('type' => 'submit', 'name' => 'Log in', 'icon' => 'icon-lock', 'div_class' => 'controls', 'class' => 'btn-large'); print_form($form); unset($form); if (isset($_SESSION['auth_message'])) { echo '<div class="controls" style="text-align: center; font-weight: bold; color: #cc0000; margin-top: 15px;">' . escape_html($_SESSION['auth_message']) . '</div'; unset($_SESSION['auth_message']); } ?> </div> </div> </div> </div> </div>