function printView() { if ($this->_roster_view) { $end_date = NULL; if (!empty($_REQUEST['weeks'])) { $end_date = date('Y-m-d', strtotime('+' . ((int) $_REQUEST['weeks'] * 7 + 1) . ' days')); } $this->_roster_view->printView(NULL, $end_date, FALSE, TRUE); } else { if (defined('PUBLIC_ROSTER_SECRET') && strlen(PUBLIC_ROSTER_SECRET) && array_get($_REQUEST, 'secret') != PUBLIC_ROSTER_SECRET) { print_message("Please contact your church administrator to get the private URLs for viewing rosters"); exit; } else { ?> <ul> <?php $views = $GLOBALS['system']->getDBObjectData('roster_view', array('is_public' => TRUE), 'AND', 'name'); foreach ($views as $id => $detail) { ?> <li><a href="<?php echo build_url(array('roster_view' => $id)); ?> "><?php echo ents($detail['name']); ?> </a></li> <?php } ?> </ul> <?php } } }
function dbQuery($sql, $parameters = array()) { global $fullSql, $debug; $fullSql = dbMakeQuery($sql, $parameters); if ($debug) { if ($GLOBALS['cli']) { print_message("\nSQL[%y" . $fullSql . "%n] ", 'color'); } else { print_sql($fullSql); } } if ($GLOBALS['config']['profile_sql']) { $time_start = microtime(true); } $result = mysql_query($fullSql); // sets $this->result if ($GLOBALS['config']['profile_sql']) { $time_end = microtime(true); #fwrite($this->logFile, date('Y-m-d H:i:s') . "\n" . $fullSql . "\n" . number_format($time_end - $time_start, 8) . " seconds\n\n"); $GLOBALS['sql_profile'][] = array('sql' => $fullSql, 'time' => number_format($time_end - $time_start, 8)); } if ($result === false && error_reporting() & 1) { // aye. this gets triggers on duplicate Contact insert //trigger_error('QDB - Error in query: ' . $fullSql . ' : ' . mysql_error(), E_USER_WARNING); } return $result; }
function discover_new_device_ip($host) { global $config; if (match_network($config['autodiscovery']['ip_nets'], $host)) { if (isPingable($host)) { echo "Pingable "; foreach ($config['snmp']['community'] as $community) { $device = deviceArray($host, $community, "v2c", "161", "udp", NULL); print_message("Trying community {$community} ..."); if (isSNMPable($device)) { echo "SNMPable "; $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB"); if (dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE sysName = ?", array($snmphost)) == '0') { $device_id = createHost($snmphost, $community, "v2c", "161", "udp"); $device = device_by_id_cache($device_id, 1); array_push($GLOBALS['devices'], $device); return $device_id; } else { echo "Already have host with sysName {$snmphost}\n"; } } } } } }
function get_constituency_object($constituency_name) { $cosntituency = factory::create('constituency'); $search = factory::create('search'); $results = $search->search('constituency', array(array("name", "=", $constituency_name))); print_message($constituency_name); if (count($results) == 1) { $cosntituency = $results[0]; } return $cosntituency; }
public function printView() { $this->_printParams(); if (!empty($_REQUEST['params_submitted'])) { if (empty($this->cohortids)) { print_message("Please choose a congregation or group", 'error'); } else { if ($this->format == 'sequential') { $this->_printResultsSequential(); } else { $this->_printResultsTabular(); } } } }
function dbQuery($sql, $parameters = array()) { global $fullSql; $fullSql = dbMakeQuery($sql, $parameters); if (OBS_DEBUG) { // Pre query debug output if (is_cli()) { print_message(PHP_EOL . 'SQL[%y' . $fullSql . '%n]', 'console', FALSE); } else { print_sql($fullSql); } } if (OBS_DEBUG || $GLOBALS['config']['profile_sql']) { $time_start = microtime(true); } $result = mysql_query($fullSql); // sets $this->result if (OBS_DEBUG || $GLOBALS['config']['profile_sql']) { $runtime = number_format(microtime(true) - $time_start, 8); $debug_msg .= 'RUNTIME[' . ($runtime > 0.05 ? '%r' : '%g') . $runtime . 's%n]'; if ($GLOBALS['config']['profile_sql']) { #fwrite($this->logFile, date('Y-m-d H:i:s') . "\n" . $fullSql . "\n" . number_format($time_end - $time_start, 8) . " seconds\n\n"); $GLOBALS['sql_profile'][] = array('sql' => $fullSql, 'time' => $runtime); } } if (OBS_DEBUG) { if ($result === FALSE && error_reporting() & 1) { // aye. this gets triggers on duplicate Contact insert //trigger_error('QDB - Error in query: ' . $fullSql . ' : ' . mysql_error(), E_USER_WARNING); $error_msg = 'Error in query: (' . mysql_errno() . ') ' . mysql_error(); $debug_msg .= PHP_EOL . 'ERROR[%r' . $error_msg . '%n]'; } if (is_cli()) { if (OBS_DEBUG > 1) { $rows = mysql_affected_rows(); $debug_msg = 'ROWS[' . ($rows < 1 ? '%r' : '%g') . $rows . '%n]' . PHP_EOL . $debug_msg; } // After query debug output for cli print_message($debug_msg, 'console', FALSE); } else { print_error($error_msg); } } return $result; }
function printView() { if (!empty($_REQUEST['go'])) { if (!empty($_REQUEST['groupid'])) { ?> <a class="pull-right" href="<?php echo build_url(array('call' => 'contact_list', 'view' => NULL)); ?> ">Download HTML file</a> <?php $this->printResults(); return; } else { print_message("You must choose an opt-in group", 'error'); } } $this->printForm(); }
function search_whois($query) { if (eregi(".com\$", $query) || eregi(".net\$", $query) || eregi(".org\$", $query)) { $server = $GLOBALS[whois_server1]; } else { $server = $GLOBALS[whois_server2]; } $fp = fsockopen($server, 43, &$errno, &$errstr); if (!$fp) { print_message("WHOIS 서버에 접속할수가 없습니다. 잠시후 다시 시도하세요"); return; } set_socket_blocking($fp, 1); fputs($fp, "{$query}\n"); while ($buf = fgets($fp, 255)) { $result .= $buf; } fclose($fp); echo "\n<table cellspacing=0 width=600>\n<tr bgcolor=#eaeaea><td height=30><font size=3><b> 검색결과 - \n <a href=\"http://{$query}\" target=_new>{$query}</a></b></font></td></tr>\n<tr><td><br>\n\t<pre>{$result}</pre>\n </td>\n</tr>\n</table> \t\n"; }
function printView() { if ($this->stateMessage !== TRUE) { print_message($this->stateMessage, 'failure'); return; } if (defined('MEMBER_DIRECTORY_HEADER')) { echo MEMBER_DIRECTORY_HEADER; } require_once 'views/view_2_families__4_contact_list.class.php'; $GLOBALS['system']->includeDBClass('person'); $dummy = new Person(); $view = new View_Families__Contact_List(); $_REQUEST['groupid'] = MEMBER_DIRECTORY_GROUPID; $_REQUEST['all_member_details'] = FALSE; $_REQUEST['age_bracket'] = array(0); $_REQUEST['include_address'] = 1; $_REQUEST['congregationid'] = array($_REQUEST['congregationid']); $view->processView(); $view->printResults(true); }
function printView() { if (!$this->canEdit()) { print_message("Sorry, only adults are able to edit this family.", 'error'); return; } $ok = $this->family->acquireLock(); foreach ($this->persons as $p) { $ok = $ok && $p->acquireLock(); } if (!$ok) { print_message("Your family cannot be edited right now. Please try later", 'error'); } else { if (defined('MEMBER_REGO_HELP_EMAIL')) { ?> <p><i>If you need to change names or other details which are not listed in this form, please contact <a href="mailto:<?php echo ents(MEMBER_REGO_HELP_EMAIL); ?> "><?php echo ents(MEMBER_REGO_HELP_EMAIL); ?> </a>.</i></p> <?php } ?> <form method="post"> <h3>Family Details</h3> <?php $this->family->printForm('family', array('address_street', 'address_suburb', 'address_postcode', 'home_tel')); foreach ($this->persons as $person) { echo '<h3>' . $person->getValue('first_name') . ' ' . $person->getValue('last_name') . '</h3>'; $person->printForm('person_' . $person->id, array('gender', 'age_bracket', 'email', 'mobile_tel', 'work_tel')); } ?> <button class="btn" type="submit">Save</button> <a class="btn" href="?">Cancel</a> </form> <?php } }
function print_html_body_begin($parameters=null){ global $config, $sess, $auth, $errors, $message; if (!$parameters) $parameters=null; // call user defined function at html body begin if (isset($parameters['run_at_html_body_begin']) and function_exists($parameters['run_at_html_body_begin'])) $parameters['run_at_html_body_begin']($parameters); //virtual(multidomain_get_file($config->html_prolog)); if (isset($parameters['title']) and $parameters['title']) echo $parameters['title']; //virtual(multidomain_get_file($config->html_separator)); ?> <?if (isset($parameters['tab_collection']) and $parameters['tab_collection']) { print_tabs($parameters['tab_collection'], isset($parameters['path_to_pages'])?$parameters['path_to_pages']:null, isset($parameters['selected_tab'])?$parameters['selected_tab']:null); //count tabs $num_of_tabs=0; foreach($parameters['tab_collection'] as $tab) if ($tab->enabled) $num_of_tabs++; ?> <div id="swContent"> <!-- contenet of div must be sufficient wide in order to tabs displays in one line --> <div style="height:1px; width:<?echo ($num_of_tabs*100)- 50;?>px;"> </div> <?}?> <? print_errors($errors); // Display error print_message($message); if ($errors or $message) echo "<br />"; } //end function print_html_body_begin
function check_passwd($db, $idx, $rn, $passwd) { /* 데이타 확인 */ $dbh = dbconnect(); $table_name = "bbs_" . $db; $query = "select idx,replynum,passwd from {$table_name} where idx={$idx} and replynum={$rn}"; $sth = dbquery($dbh, $query); if (!$sth) { print_message(mysql_error()); } list($c_idx, $c_replynum, $c_passwd) = dbselect($sth); dbclose($dbh); /* 존재하지 않을때 */ if (!$c_idx) { return -1; } /* 비밀번호 확인 */ if ($passwd == $admin_passwd || $passwd == $c_passwd) { return 1; } return 0; }
} } print_debug("Timing housekeeping: deleted {$rows} entries (per-device)"); logfile("housekeeping.log", "Timing: deleted {$rows} entries older than " . format_unixtime($cutoff) . " (per-device)"); $rows = dbDelete('perf_times', $where); if ($rows === FALSE) { // Use LIMIT with big tables print_debug("Performance table (per-run) is too big, using LIMIT for delete entries"); $rows = 0; $i = 1000; while ($i && $rows < $count_run) { $iter = dbDelete('perf_times', $where . ' LIMIT 1000000'); if ($iter === FALSE) { break; } $rows += $iter; $i--; } } print_debug("Timing housekeeping: deleted {$rows} entries (per-run)"); logfile("housekeeping.log", "Timing: deleted {$rows} entries older than " . format_unixtime($cutoff) . " (per-run)"); } } else { if ($prompt) { print_message("No perfomance entries found older than " . format_unixtime($cutoff)); } } } else { print_message("Timing housekeeping disabled in configuration or less than 24h."); } // EOF
function _printParamsForm() { $congs = $GLOBALS['system']->getDBObjectData('congregation', array('!meeting_time' => ''), 'OR', 'meeting_time'); if (empty($congs)) { print_message("To edit services you must first go to admin > congregations and set the 'code name' for the relevant congregations", 'failure'); return; } ?> <form method="get" class="well well-small"> <input type="hidden" name="view" value="<?php echo ents($_REQUEST['view']); ?> " /> <?php if ($GLOBALS['user_system']->havePerm(PERM_BULKSERVICE)) { ?> <select name="editing"> <option value="0">View</option> <option value="1" <?php if ($this->_editing) { echo 'selected="selected"'; } ?> >Edit</option> </select> <b>the service program</b> <?php } ?> <table> <tr> <td rowspan="3" class="nowrap" style="padding-right: 2ex"> <b>For congregations</b><br /> <?php foreach ($congs as $id => $details) { ?> <label class="checkbox"> <input type="checkbox" name="congregations[]" <?php if (in_array($id, $this->_congregations)) { echo 'checked="checked" '; } ?> value="<?php echo $id; ?> " id="congregations_<?php echo $id; ?> " /> <?php echo ents($details['name']); ?> </label> <?php } ?> </td> <td><b>from</b> </td> <td class="nowrap"><?php print_widget('start_date', array('type' => 'date'), $this->_start_date); ?> </td> </tr> <tr> <td><b>to</b></td> <td class="nowrap"> <?php print_widget('end_date', array('type' => 'date'), $this->_end_date); ?> <button type="submit" class="btn">Go</button> </td> </tr> </table> </form> <?php }
// FIXME $query = 'SELECT `device_id` FROM (SELECT @rownum :=0) r, ( SELECT @rownum := @rownum +1 AS rownum, `device_id` FROM `devices` WHERE `disabled` = 0 ORDER BY `device_id` ASC ) temp WHERE MOD(temp.rownum, ' . $options['i'] . ') = ?;'; $doing = $options['n'] . "/" . $options['i']; $params[] = $options['n']; //print_vars($query); //print_vars($params); } if (!$where) { print_message("%n\nUSAGE:\n{$scriptname} [-drqV] [-i instances] [-n number] [-m module] [-h device]\n\nEXAMPLE:\n-h <device id> | <device hostname wildcard> Poll single device\n-h odd Poll odd numbered devices (same as -i 2 -n 0)\n-h even Poll even numbered devices (same as -i 2 -n 1)\n-h all Poll all devices\n-h new Poll all devices that have not had a discovery run before\n\n-i <instances> -n <id/number> Poll as instance <id/number> of <instances>\n Instance numbers start at 0. 0-3 for -i 4\n Example:\n -i 4 -n 0\n -i 4 -n 1\n -i 4 -n 2\n -i 4 -n 3\n\nOPTIONS:\n -h Device hostname, id or key odd/even/all/new.\n -i Poll instances count.\n -n Instance id (number), must start from 0 and to be less than instances count.\n -q Quiet output.\n -M Show globally enabled/disabled modules and exit.\n -V Show version and exit.\n\nDEBUGGING OPTIONS:\n -r Do not create or update RRDs\n -d Enable debugging output.\n -dd More verbose debugging output.\n -m Specify module(s) (separated by commas) to be run.\n\n%rInvalid arguments!%n", 'color', FALSE); exit; } if (isset($options['r'])) { $config['norrd'] = TRUE; } $cache['maint'] = cache_alert_maintenance(); rrdtool_pipe_open($rrd_process, $rrd_pipes); print_cli_heading("%WStarting polling run at " . date("Y-m-d H:i:s"), 0); $polled_devices = 0; if (!isset($query)) { $query = "SELECT `device_id` FROM `devices` WHERE `disabled` = 0 {$where} ORDER BY `device_id` ASC"; } foreach (dbFetch($query, $params) as $device) { $device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id'])); poll_device($device, $options);
} } print_debug("{$uptime_msg} ({$uptime} seconds)"); if (is_numeric($uptime)) { // Notify only if current uptime less than one month (eg if changed from sysUpTime to snmpEngineTime) if ($uptime < $device['uptime'] && $uptime < 2628000) { notify($device, "Device rebooted: " . $device['hostname'], "Device Rebooted : " . $device['hostname'] . " " . formatUptime($uptime) . " ago."); log_event('Device rebooted after ' . formatUptime($device['uptime']), $device, 'reboot', $device['uptime']); } $uptime_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd"; if (!is_file($uptime_rrd)) { rrdtool_create($uptime_rrd, "DS:uptime:GAUGE:600:0:U "); } rrdtool_update($uptime_rrd, "N:" . $uptime); $graphs['uptime'] = TRUE; print_message("Uptime: " . formatUptime($uptime)); $update_array['uptime'] = $uptime; $cache['devices']['uptime'][$device['device_id']]['uptime'] = $uptime; $cache['devices']['uptime'][$device['device_id']]['polled'] = $polled; } $poll_device['sysLocation'] = str_replace("\"", "", $poll_device['sysLocation']); // Rewrite sysLocation if there is a mapping array (database too?) if (!empty($poll_device['sysLocation'])) { $poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']); } $poll_device['sysContact'] = str_replace("\"", "", $poll_device['sysContact']); if ($poll_device['sysLocation'] == "not set") { $poll_device['sysLocation'] = ""; } if ($poll_device['sysContact'] == "not set") { $poll_device['sysContact'] = "";
function detect_device_snmpauth($hostname, $snmp_port = 161, $snmp_transport = 'udp', $detect_ip_version = FALSE) { global $config; // Additional checks for IP version if ($detect_ip_version) { $ip_version = get_ip_version($hostname); if (!$ip_version) { $ip = gethostbyname6($hostname); $ip_version = get_ip_version($ip); } // Detect snmp transport if (stripos($snmp_transport, 'tcp') !== FALSE) { $snmp_transport = $ip_version == 4 ? 'tcp' : 'tcp6'; } else { $snmp_transport = $ip_version == 4 ? 'udp' : 'udp6'; } } // Detect snmp port if (!is_numeric($snmp_port) || $snmp_port < 1 || $snmp_port > 65535) { $snmp_port = 161; } else { $snmp_port = (int) $snmp_port; } // Here set default snmp version order $i = 1; $snmp_version_order = array(); foreach (array('v2c', 'v3', 'v1') as $tmp_version) { if ($config['snmp']['version'] == $tmp_version) { $snmp_version_order[0] = $tmp_version; } else { $snmp_version_order[$i] = $tmp_version; } $i++; } ksort($snmp_version_order); foreach ($snmp_version_order as $snmp_version) { if ($snmp_version === 'v3') { // Try each set of parameters from config foreach ($config['snmp']['v3'] as $snmp_v3) { $device = build_initial_device_array($hostname, NULL, $snmp_version, $snmp_port, $snmp_transport, $snmp_v3); print_message("Trying v3 parameters " . $device['snmp_authname'] . "/" . $device['snmp_authlevel'] . " ... "); if (isSNMPable($device)) { return $device; } else { print_warning("证书无应答 " . $device['snmp_authname'] . "/" . $device['snmp_authlevel'] . " using {$snmp_version}."); } } } else { // if ($snmp_version === "v2c" || $snmp_version === "v1") // Try each community from config foreach ($config['snmp']['community'] as $snmp_community) { $device = build_initial_device_array($hostname, $snmp_community, $snmp_version, $snmp_port, $snmp_transport); print_message("尝试 {$snmp_version} community {$snmp_community} ..."); if (isSNMPable($device)) { return $device; } else { print_warning("Community无应答 {$snmp_community} 使用 {$snmp_version}."); } } } } return FALSE; }
2001.06 by Jungjoon Oh */ require "db-lib.php"; require "poll-lib.php"; if (!is_admin($PHP_AUTH_USER, $PHP_AUTH_PW)) { header("Location: {$URL['login']}?url={$URL['new']}"); exit; } if ($m == 'register') { /* Query 생성 */ $query = "insert into poll_data " . "(question,sdate,status,answer_no," . "answer1,answer2,answer3,answer4,answer5," . "answer6,answer7,answer8,answer9,answer10) values " . "('{$question}',now(),'1',{$answer_no}," . "'{$answer1}','{$answer2}','{$answer3}','{$answer4}','{$answer5}'," . "'{$answer6}','{$answer7}','{$answer8}','{$answer9}','{$answer10}')"; $dbh = dbconnect(); $sth = dbquery($dbh, $query); if (!$sth) { $msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error(); print_message($msg); } else { print_alert("등록이 완료되었습니다. ", "url|{$URL['list']}"); } } else { new_form(); } exit; function new_form() { global $URL; print_header(); ?> <script language="JavaScript"> <!--
$updated += dbDelete('applications', '`device_id` = ? AND `app_type` NOT IN (' . implode(',', $replace) . ')', $param); } else { $updated += dbDelete('applications', '`device_id` = ?', array($param)); } foreach (dbFetchRows('SELECT `app_type` FROM `applications` WHERE `device_id` = ?', array($device['device_id'])) as $row) { $app_in_db[] = $row['app_type']; } foreach ($enabled as $app) { if (!in_array($app, $app_in_db)) { $updated += dbInsert(array('device_id' => $device['device_id'], 'app_type' => $app), 'applications'); } } if ($updated) { print_message('Applications updated!'); } else { print_message('No changes.'); } } //end if // Show list of apps with checkboxes echo '<div style="padding: 10px;">'; $apps_enabled = dbFetchRows('SELECT * from `applications` WHERE `device_id` = ? ORDER BY app_type', array($device['device_id'])); if (count($apps_enabled)) { foreach ($apps_enabled as $application) { $app_enabled[] = $application['app_type']; } } echo "<div class='row'>\n <div class='col-md-4'>\n <form id='appedit' name='appedit' method='post' action='' role='form' class='form-horizontal'>\n <input type=hidden name=device value='" . $device['device_id'] . "'>\n <table class='table table-hover table-responsive'>\n <tr align=center>\n <th>Enable</th>\n <th>Application</th>\n </tr>\n "; $row = 1; foreach ($applications as $app) { if (is_integer($row / 2)) {
<?php /** * Observium Network Management and Monitoring System * Copyright (C) 2006-2014, Adam Armstrong - http://www.observium.org * * @package observium * @subpackage webui * @author Adam Armstrong <*****@*****.**> * @copyright (C) 2006-2014 Adam Armstrong * */ print_message("This page allows you to disable or enable certain Graphs detected for a device."); $graphs_db = array(); foreach (dbFetchRows("SELECT `graph`,`enabled` FROM `device_graphs` WHERE `device_id` = ?", array($device['device_id'])) as $entry) { $graph = $entry['graph']; $section = $config['graph_types']['device'][$graph]['section']; $graphs_db[$graph] = (bool) $entry['enabled']; // Another array sorted by sections $graphs_sections[$section][$graph] = (bool) $entry['enabled']; } $graph = $_POST['toggle_graph']; if ($graph && isset($graphs_db[$graph]) && !in_array($config['graph_types']['device'][$graph]['section'], array('poller', 'system'))) { $value = (int) (!$graphs_db[$graph]); // Toggle current 'enabled' value $updated = dbUpdate(array('enabled' => $value), 'device_graphs', '`device_id` = ? AND `graph` = ?', array($device['device_id'], $graph)); if ($updated) { print_success("Graph '{$graph}' " . ($value ? 'enabled' : 'disabled') . '.'); $graphs_sections[$config['graph_types']['device'][$graph]['section']][$graph] = (bool) $value; } }
if ($ac == $bill['bill_id']) { $done = 1; } } if (!$done) { echo "<option value='" . $bill['bill_id'] . "'>" . $bill['bill_name'] . "</option>"; } } echo "</select>\n </div>\n <button type='submit' class='btn btn-default' name='Submit' value='Add'>Add</button>\n </form>\n </div>"; } elseif ($vars['user_id'] && $vars['edit']) { if (!empty($vars['new_level'])) { if ($vars['can_modify_passwd'] == 'on') { $vars['can_modify_passwd'] = '1'; } update_user($vars['user_id'], $vars['new_realname'], $vars['new_level'], $vars['can_modify_passwd'], $vars['new_email']); print_message("User has been updated"); } if (can_update_users() == '1') { $users_details = get_user($vars['user_id']); if (!empty($users_details)) { if (empty($vars['new_realname'])) { $vars['new_realname'] = $users_details['realname']; } if (empty($vars['new_level'])) { $vars['new_level'] = $users_details['level']; } if (empty($vars['can_modify_passwd'])) { $vars['can_modify_passwd'] = $users_details['can_modify_passwd']; } elseif ($vars['can_modify_passwd'] == 'on') { $vars['can_modify_passwd'] = '1'; }
<section class="main"> <div class="container"> <div id="module_title"> <div class="m-b-md"><h3 class="m-b-none"><?php echo $menu_title; ?> </h3></div> </div> <?php if ($this->session->flashdata('message')) { ?> <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert"><i class="fa fa-times"></i></button> <?php echo print_message($this->session->flashdata('message')); ?> </div> <?php } ?> <section class="panel panel-default"> <!-- TABLE HEADER --> <div class="row text-sm wrapper"> <!-- SEARCH FORM --> <form action="" method="post"> <div class="col-sm-12 m-b-xs pull-left text-center"> Cari Tabungan Sukarela : <select name="key" class="input-sm form-control input-s-sm inline">
<?php $no_refresh = true; $param = array(); if ($vars['action'] == 'expunge' && $_SESSION['userlevel'] >= '10') { dbQuery('TRUNCATE TABLE `syslog`'); print_message('syslog truncated'); } $pagetitle[] = 'Syslog'; print_optionbar_start(); ?> <div id="{{ctx.id}}" class="{{css.header}}"> <div class="row"> <div class="col-sm-9 actionBar"> <div class="pull-left"> <form method="post" action="" class="form-inline" role="form" id="result_form"> <div class="form-group"> <select name="device" id="device" class="form-control input-sm"> <option value="">All Devices</option> <?php foreach (get_all_devices() as $hostname) { $device_id = getidbyname($hostname); if (device_permitted($device_id)) { echo '"<option value="' . $device_id . '"'; if ($device_id == $vars['device']) { echo ' selected'; } echo '>' . $hostname . '</option>'; }
$edate = tnow_date_to_mysqldate($attrib->EventDate); $eid = $attrib->EventID; $oeid = $attrib->OpponentEventID; $vid = $attrib->VenueID; $snote = mysql_escape_string($attrib->ShortNote); $mincost = $attrib->MinCost; $maxcost = $attrib->MaxCost; $bsql = "INSERT INTO Productions_temp " . "(ProductionID, EventDate, EventID, OpponentEventID, VenueID, ShortNote, MinCost, MaxCost) " . "VALUES ('{$pid}', '{$edate}', '{$eid}', '{$oeid}', '{$vid}', '{$snote}', '{$mincost}', '{$maxcost}')"; $insert_result = mysql_query($bsql) or print_message('ImportProductionsFromWS: ' . mysql_error()); } # end for } catch (Exception $e) { $errors = libxml_get_errors(); $error = $errors[0]; } } catch (SoapFault $flt) { handle_error_no_exit("ImportProductionsFromWS.php: " . $flt); echo "SOAP Fault: (faultcode: {" . $flt->faultcode . "}\n" . "faultstring: {" . $flt->faultstring . " })"; } unset($soapclient); print_message("ImportProductionsFromWS: Done. "); mysql_close($dbh); if ($num_productions_returned < 1) { print_message("ImportProductionsFromWS: No productions returned, exiting..."); } print_message("Finished Importing " . $num_productions_returned . " Productions.\n"); function tnow_date_to_mysqldate($date) { $date = str_replace('T', ' ', $date); return $date; }
function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0', $poller_group = '0', $force_add = '0') { global $config; list($hostshort) = explode(".", $host); // Test Database Exists if (dbFetchCell("SELECT COUNT(*) FROM `devices` WHERE `hostname` = ?", array($host)) == '0') { if ($config['addhost_alwayscheckip'] === TRUE) { $ip = gethostbyname($host); } else { $ip = $host; } if (ip_exists($ip) === false) { // Test reachability if ($force_add == 1 || isPingable($host)) { if (empty($snmpver)) { // Try SNMPv2c $snmpver = 'v2c'; $ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add); if (!$ret) { //Try SNMPv3 $snmpver = 'v3'; $ret = addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add); if (!$ret) { // Try SNMPv1 $snmpver = 'v1'; return addHost($host, $snmpver, $port, $transport, $quiet, $poller_group, $force_add); } else { return $ret; } } else { return $ret; } } if ($snmpver === "v3") { // Try each set of parameters from config foreach ($config['snmp']['v3'] as $v3) { $device = deviceArray($host, NULL, $snmpver, $port, $transport, $v3); if ($quiet == '0') { print_message("Trying v3 parameters " . $v3['authname'] . "/" . $v3['authlevel'] . " ... "); } if ($force_add == 1 || isSNMPable($device)) { $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB"); if (empty($snmphost) or $snmphost == $host || ($hostshort = $host)) { $device_id = createHost($host, NULL, $snmpver, $port, $transport, $v3, $poller_group); return $device_id; } else { if ($quiet == '0') { print_error("Given hostname does not match SNMP-read hostname ({$snmphost})!"); } } } else { if ($quiet == '0') { print_error("No reply on credentials " . $v3['authname'] . "/" . $v3['authlevel'] . " using {$snmpver}"); } } } } elseif ($snmpver === "v2c" or $snmpver === "v1") { // try each community from config foreach ($config['snmp']['community'] as $community) { $device = deviceArray($host, $community, $snmpver, $port, $transport, NULL); if ($quiet == '0') { print_message("Trying community {$community} ..."); } if ($force_add == 1 || isSNMPable($device)) { $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB"); if (empty($snmphost) || $snmphost && ($snmphost == $host || ($hostshort = $host))) { $device_id = createHost($host, $community, $snmpver, $port, $transport, array(), $poller_group); return $device_id; } else { if ($quiet == '0') { print_error("Given hostname does not match SNMP-read hostname ({$snmphost})!"); } } } else { if ($quiet == '0') { print_error("No reply on community {$community} using {$snmpver}"); } } } } else { if ($quiet == '0') { print_error("Unsupported SNMP Version \"{$snmpver}\"."); } } if (!$device_id) { // Failed SNMP if ($quiet == '0') { print_error("Could not reach {$host} with given SNMP community using {$snmpver}"); } } } else { // failed Reachability if ($quiet == '0') { print_error("Could not ping {$host}"); } } } else { if ($quiet == 0) { print_error("Already have host with this IP {$host}"); } } } else { // found in database if ($quiet == '0') { print_error("Already got host {$host}"); } } return 0; }
</div> </div> </form> <?php if ($vars['user_id']) { if ($vars['action'] == "deleteuser") { include "pages/edituser/deleteuser.inc.php"; } else { // Perform actions if requested if (auth_can_change_password($user_data['username']) && $vars['action'] == "changepass") { if ($vars['new_pass'] == "" || $vars['new_pass2'] == "") { print_warning("密码不能留空."); } elseif ($vars['new_pass'] == $vars['new_pass2']) { auth_change_password($user_data['username'], $vars['new_pass']); print_message("密码已更改."); } else { print_error("密码不匹配!"); } } // FIXME broken PoS code. if ($vars['action'] == "becomeuser") { $_SESSION['origusername'] = $_SESSION['username']; $_SESSION['username'] = $user_data['username']; header('位置: ' . $config['base_url']); dbInsert(array('user' => $_SESSION['origusername'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => '成为 ' . $_SESSION['username']), 'authlog'); include "includes/authenticate.inc.php"; } if ($vars['action'] == "perm_del") { if (dbFetchCell("SELECT COUNT(*) FROM `entity_permissions` WHERE `entity_type` = ? AND `entity_id` = ? AND `user_id` = ?", array($vars['entity_type'], $vars['entity_id'], $vars['user_id']))) { dbDelete('entity_permissions', "`entity_type` = ? AND `entity_id` = ? AND `user_id` = ?", array($vars['entity_type'], $vars['entity_id'], $vars['user_id']));
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id'])); } elseif ($rows_updated = '-1') { $update_message = "Device record unchanged. No update necessary."; $updated = -1; } else { $update_message = "Device record update error."; } } else { include 'includes/error-no-perm.inc.php'; } } $descr = $device['purpose']; $override_sysLocation = $device['override_sysLocation']; $override_sysLocation_string = $device['location']; if ($updated && $update_message) { print_message($update_message); } elseif ($update_message) { print_error($update_message); } ?> <div class="row"> <div class="col-sm-1"> <form id="delete_host" name="delete_host" method="post" action="delhost/" role="form"> <input type="hidden" name="id" value="<?php echo $device['device_id']; ?> "> <button type="submit" class="btn btn-danger" name="Submit">Delete device</button> </form> </div>
function printView($start_date = NULL, $end_date = NULL, $editing = FALSE, $public = FALSE) { if (empty($this->_members)) { return; } if (!$editing && !$public) { $my_email = $GLOBALS['user_system']->getCurrentUser('email'); } $GLOBALS['system']->includeDBClass('service'); $dummy_service = new Service(); if (is_null($start_date)) { $start_date = date('Y-m-d'); } $service_params = array('congregationid' => $this->getCongregations(), '>date' => date('Y-m-d', strtotime($start_date . ' -1 day'))); if (!is_null($end_date)) { $service_params['<date'] = date('Y-m-d', strtotime($end_date . ' +1 day')); } $services = $GLOBALS['system']->getDBObjectData('service', $service_params, 'AND', 'date'); $to_print = array(); foreach ($services as $id => $service_details) { $service_details['id'] = $id; $to_print[$service_details['date']]['service'][$service_details['congregationid']] = $service_details; $to_print[$service_details['date']]['assignments'] = array(); } foreach ($this->getAssignments($start_date, $end_date) as $date => $date_assignments) { $to_print[$date]['assignments'] = $date_assignments; } ksort($to_print); $role_objects = array(); $this_sunday = date('Y-m-d', strtotime('Sunday')); if (empty($to_print)) { if ($public) { ?> <div class="alert alert-error">This roster is empty for the current date range.</div> <?php } else { ?> <div class="alert alert-error">There are no services during the date range specified. Please try a different date range, or create some services using the 'Edit service program' page.</div> <?php } return; } if ($editing) { $show_lock_fail_msg = false; $show_group_denied_msg = false; foreach ($this->_members as $id => &$details) { if (!empty($details['role_id'])) { $role = $GLOBALS['system']->getDBObject('roster_role', $details['role_id']); if (!($role->canAcquireLock('assignments') && $role->acquireLock('assignments'))) { $details['readonly'] = true; $show_lock_fail_msg = true; } if (!$role->canEditAssignments()) { $details['readonly'] = true; $show_group_denied_msg = true; } } } if ($show_lock_fail_msg) { print_message("Some of the roles in this roster are currently being edited by another user. To edit assignments for these roles, wait until the other user finishes then try again.", 'failure'); } if ($show_group_denied_msg) { print_message("There are some roles in this roster which you are not able to edit because they refer to a volunteer group you do not have access to."); } ?> <form method="post" class="warn-unsaved bubble-option-props"> <script> $(document).ready(function() { setTimeout('showLockExpiryWarning()', <?php echo (strtotime('+' . LOCK_LENGTH, 0) - 60) * 1000; ?> ); setTimeout('showLockExpiredWarning()', <?php echo strtotime('+' . LOCK_LENGTH, 0) * 1000; ?> ); $('table.roster select').keypress(function() { handleRosterChange(this); }).change(function() { handleRosterChange(this); }); $('table.roster input.person-search-single, table.roster input.person-search-multiple').each(function() { this.onchange = function() { handleRosterChange(this); }; }); $('table.roster > tbody > tr').each(function() { updateClashesForRow($(this)); }); }); function handleRosterChange(inputField) { var row = null; if ($(inputField).hasClass('person-search-single') || $(inputField).hasClass('person-search-multiple')) { row = $(inputField).parents('tr:first'); } else if (inputField.tagName == 'SELECT' || inputField.type == 'hidden') { var expandableParent = $(inputField).parents('table.expandable'); if (expandableParent.length) { var row = $(inputField).parents('table:first').parents('tr:first'); } else { var row = $(inputField).parents('tr:first'); } } if (row) { updateClashesForRow(row); } } function updateClashesForRow(row) { var uses = new Object(); // Deal with the single person choosers and select boxes first var sameRowInputs = row.find('input.person-search-single, select'); sameRowInputs.removeClass('clash'); sameRowInputs.each(function() { var thisElt = this; var thisVal = 0; if (this.className == 'person-search-single') { var hiddenInput = document.getElementsByName(this.id.substr(0, this.id.length-6))[0]; thisVal = hiddenInput.value; } else if (this.tagName == 'SELECT') { thisVal = this.value; } if (thisVal != 0) { if (!uses[thisVal]) { uses[thisVal] = new Array(); } uses[thisVal].push(thisElt); } }); // Now add the multi person choosers row.find('ul.multi-person-finder li').removeClass('clash').each(function() { var thisVal = $(this).find('input')[0].value; if (thisVal != 0) { if (!uses[thisVal]) { uses[thisVal] = new Array(); } uses[thisVal].push(this); } }); for (i in uses) { if (uses[i].length > 1) { for (j in uses[i]) { if (typeof uses[i][j] == 'function') continue; $(uses[i][j]).addClass('clash'); } } } } </script> <?php } ?> <table class="table roster" border="1" cellspacing="0" cellpadding="1"> <?php $this->_printTableHeader($editing, $public); ?> <tbody> <?php foreach ($to_print as $date => $ddetail) { if ($public && empty($ddetail['assignments'])) { continue; } $class_clause = $date == $this_sunday ? 'class="tblib-hover"' : ''; ?> <tr <?php echo $class_clause; ?> > <td class="nowrap"> <?php echo '<strong>' . str_replace(' ', ' ', date('j M y', strtotime($date))) . '</strong>'; if (!$editing && !$public) { $emails = array(); foreach ($ddetail['assignments'] as $roleid => $assignees) { foreach ($assignees as $pid => $pdetails) { if (!empty($pdetails['email']) && $pdetails['email'] != $my_email) { $emails[] = $pdetails['email']; } } } $emails = array_unique($emails); if (!empty($emails)) { ?> <p class="smallprint no-print"> <a href="<?php echo get_email_href($my_email, NULL, $emails, date('jS F', strtotime($date))); ?> " <?php echo email_link_extras(); ?> >Email All</a> <?php if (defined('SMS_HTTP_URL') && constant('SMS_HTTP_URL') && $GLOBALS['user_system']->havePerm(PERM_SENDSMS)) { ?> | <span class="clickable" onclick="$(this).parent().next('form').toggle(); $(this).parents('tr:first').addClass('tblib-hover')">SMS All</span> <?php } ?> </p> <?php if (defined('SMS_HTTP_URL') && constant('SMS_HTTP_URL') && $GLOBALS['user_system']->havePerm(PERM_SENDSMS)) { $url = build_url(array('view' => '_send_sms_http', 'roster_view' => $this->id, 'start_date' => $date, 'end_date' => $date)); ?> <form method="post" action="<?php echo $url; ?> " style="position: absolute; display: none"> <div class="standard" style="border-width: 2px; border-radius: 8px"> <h3>Send SMS</h3> <textarea name="message" rows="5" cols="30" maxlength="<?php echo SMS_MAX_LENGTH; ?> "></textarea> <br /> <input type="submit" value="Send" /> <input type="button" onclick="$(this).parents('form').toggle(); $(this).parents('tr:first').removeClass('tblib-hover')" value="Cancel" /> </div> </form> <?php } } } ?> </td> <?php $last_congid = NULL; foreach ($this->_members as $id => $mdetail) { $td_class = ''; if ($mdetail['congregationid'] != $last_congid) { $td_class = 'thick-left-border'; $last_congid = $mdetail['congregationid']; } ?> <td class="<?php echo $td_class; ?> "> <?php if ($mdetail['role_id']) { if ($editing && empty($mdetail['readonly'])) { $currentval = array(); foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $pid => $pdetails) { $currentval[$pid] = $pdetails['name']; } if (empty($role_objects[$mdetail['role_id']])) { $role_objects[$mdetail['role_id']] =& $GLOBALS['system']->getDBObject('roster_role', $mdetail['role_id']); } if (empty($role_objects[$mdetail['role_id']])) { // must've been a problem continue; } $role_objects[$mdetail['role_id']]->printChooser($date, $currentval); } else { $names = array(); foreach (array_get($ddetail['assignments'], $mdetail['role_id'], array()) as $personid => $vs) { if (!$public) { $n = '<a href="' . BASE_URL . '?view=persons&personid=' . $personid . '" title="Assigned by ' . ents($vs['assigner']) . ' on ' . format_datetime($vs['assignedon']) . '">' . nbsp(ents($vs['name'])) . '</a>'; if (empty($vs['email'])) { $n .= ' <img src="' . BASE_URL . 'resources/img/no_email.png" style="display:inline" title="No Email Address" />'; } $names[] = $n; } else { $names[] = nbsp($vs['name']); } } echo implode("<br />", $names); } } else { if (!empty($ddetail['service'][$mdetail['congregationid']])) { if ($public && (!defined('SHOW_SERVICE_NOTES_PUBLICLY') || !SHOW_SERVICE_NOTES_PUBLICLY)) { // no notes in public view unset($ddetail['service'][$mdetail['congregationid']]['notes']); } $dummy_service->populate($ddetail['service'][$mdetail['congregationid']]['id'], $ddetail['service'][$mdetail['congregationid']]); $dummy_service->printFieldvalue($mdetail['service_field']); } } ?> </td> <?php } if (!$public && count($this->_members) > REPEAT_DATE_THRESHOLD) { ?> <td class="nowrap thick-left-border"> <strong><?php echo str_replace(' ', ' ', date('j M y', strtotime($date))); ?> </strong> </td> <?php } ?> </tr> <?php } ?> </tbody> <?php if (!$public && count($to_print) > 6) { $this->_printTableFooter($editing, $public); } ?> </table> <?php if ($editing) { ?> <input type="submit" class="btn" value="Save" accesskey="s" /> </form> <?php } }
private function printForm() { $_SESSION['enter_attendance_token'] = md5(time()); // STEP 2 - enter attendances ob_start(); ?> <form method="post" class="attendance warn-unsaved" action="?view=attendance__record"> <input type="hidden" name="attendance_date" value="<?php echo $this->_attendance_date; ?> " /> <input type="hidden" name="show_photos" value="<?php echo $this->_show_photos; ?> " /> <input type="hidden" name="parallel_mode" value="<?php echo $this->_parallel_mode; ?> " /> <input type="hidden" name="enter_attendance_token" value="<?php echo $_SESSION['enter_attendance_token']; ?> " /> <input type="hidden" name="attendances_submitted" value="1" /> <?php print_hidden_fields(array('cohortids' => $this->_cohortids, 'age_brackets' => $this->_age_brackets, 'statuses' => $this->_statuses)); ?> <p class="visible-desktop smallprint">For greatest speed, press P for present and A for absent. The cursor will automatically progress to the next person. To go back, use the arrow keys.</p> <?php if ($this->_parallel_mode && count($this->_cohortids) > 1 && !SizeDetector::isNarrow()) { $totalPrinted = $this->printFormParallel(); } else { $totalPrinted = $this->printFormSequential(); } ?> </form> <?php if (ini_get('max_input_vars') && $totalPrinted > ini_get('max_input_vars')) { ob_end_clean(); print_message(_("The parameters you have selected will list more persons ") . _("than your server can process. Please narrow down your parameters, ") . _("or ask your server administrator to increase the PHP max_input_vars setting") . _(" (currently ") . ini_get('max_input_vars') . ')', 'error'); } else { ob_flush(); } }
$fileHeight = $thumb_data['thumbheight']; $thumbfile = $thumb_data['thumbfilepath']; $value = str_replace("../attachments/", "", $thumbfile); } } } else { $thumbfile = ""; } //写进数据库 $fileName = $attdesc == "" ? $fileName : encode($attdesc) . "." . $fileType; $rsexits = getFieldValue($DBPrefix . "attachments", "attTitle='" . $fileName . "' and fileType='" . $updateStyle . "' and fileSize='" . $fileSize . "' and logId='0'", "name"); if ($rsexits == "") { $sql = "INSERT INTO " . $DBPrefix . "attachments(name,attTitle,fileType,fileSize,fileWidth,fileHeight,postTime,logId) VALUES ('{$value}','{$fileName}','{$updateStyle}','{$fileSize}','{$fileWidth}','{$fileHeight}','" . time() . "',0)"; $DMC->query($sql); } else { print_message($strDataExists); } do_filter("f2_attach", $basefile); if (!empty($thumbfile)) { do_filter("f2_attach", $thumbfile); //縮略圖 } settings_recount("attachments"); settings_recache(); $action = ""; } } } if ($action == "delete" || $action == "deleteall") { $stritem = ""; $fileListNew = $_POST['fileList'];