function html_timestamp($datetime) { $result = time::splitts($datetime); echo $result['date']; nbsp(2); echo '<span class="small">' . $result['time'] . '</span>'; }
function connect_error() { global $adminer, $connection, $token, $error, $drivers; if (DB != "") { header("HTTP/1.1 404 Not Found"); page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); } else { if ($_POST["db"] && !$error) { queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); } //Encabezado y botones de la parte superior en la seleccion de bases de datos page_header(lang('Select database'), $error, false); echo "<p>\n"; foreach (array('database' => lang('Create new database'), 'privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) { if (support($key)) { echo "<a class='btn btn-xs btn-primary' href='" . h(ME) . "{$key}='>{$val}</a>\n"; } } //Presenta informacion de la conexion echo "<p><i class='fa fa-exchange fa-fw'></i> " . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>{$connection->extension}</b>") . "\n"; echo "<p><i class='fa fa-user fa-fw'></i> " . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n"; //Presenta la lista de bases de datos existentes y los encabezados $databases = $adminer->databases(); if ($databases) { $scheme = support("scheme"); $collations = collations(); echo "<form action='' method='post'>\n"; echo "<table cellspacing='0' class='checkable table table-condensed table-responsive table-hover' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n"; echo "<thead><tr>" . (support("database") ? "<th> " : "") . "<th>" . lang('Database') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "refresh=1'><i class='fa fa-refresh fa-fw'></i> " . lang('Refresh') . "</a>" . "<th>" . lang('Collation') . "<th>" . lang('Tables') . "<th>" . lang('Size') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>" . "</thead>\n"; //Presenta la lista de bases de datos $databases = $_GET["dbsize"] ? count_tables($databases) : array_flip($databases); foreach ($databases as $db => $tables) { $root = h(ME) . "db=" . urlencode($db); echo "<tr" . odd() . ">" . (support("database") ? "\n\t\t\t\t\t<td align=center>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : ""); echo "<th><a href='{$root}'>" . h($db) . "</a>"; $collation = nbsp(db_collation($db, $collations)); echo "<td>" . (support("database") ? "<a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>{$collation}</a>" : $collation); echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>"; echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?"); echo "\n"; } echo "</table>\n"; //Agrega boton de eliminar echo support("database") ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n" . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" . "<input class='btn btn-xs btn-danger' type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n" . "</div></fieldset>\n" : ""; echo "<script type='text/javascript'>tableCheck();</script>\n"; echo "<input type='hidden' name='token' value='{$token}'>\n"; echo "</form>\n"; } } page_footer("db"); }
function connect_error() { global $connection, $token, $error, $drivers; $databases = array(); if (DB != "") { page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true); } else { if ($_POST["db"] && !$error) { queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"])); } page_header(lang('Select database'), $error, false); echo "<p><a href='" . h(ME) . "database='>" . lang('Create new database') . "</a>\n"; foreach (array('privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) { if (support($key)) { echo "<a href='" . h(ME) . "{$key}='>{$val}</a>\n"; } } echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>{$connection->server_info}</b>", "<b>{$connection->extension}</b>") . "\n"; echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n"; if ($_GET["refresh"]) { set_session("dbs", null); } $databases = get_databases(); if ($databases) { $scheme = support("scheme"); $collations = collations(); echo "<form action='' method='post'>\n"; echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n"; echo "<thead><tr><td> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n"; foreach ($databases as $db) { $root = h(ME) . "db=" . urlencode($db); echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])); echo "<th><a href='{$root}'>" . h($db) . "</a>"; echo "<td><a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>" . nbsp(db_collation($db, $collations)) . "</a>"; echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>?</a>"; echo "\n"; } echo "</table>\n"; echo "<script type='text/javascript'>tableCheck();</script>\n"; echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n"; // 1 - eventStop echo "<input type='hidden' name='token' value='{$token}'>\n"; echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n"; echo "</form>\n"; } } page_footer("db"); if ($databases) { echo "<script type='text/javascript'>ajaxSetHtml('" . js_adminer_escape(ME) . "script=connect');</script>\n"; } }
function popup($mID, $url, $shouldBeModal = True, $look = 'plain', $image = False, $forceNoPop = False) { /* return the link to either "modal", "popup" or "normal" window. */ $urlWithoutBrackets = $look == 'plain'; if ($forceNoPop || !$this->browserCapable()) { $shouldBeModal = False; } if ($forceNoPop || !$this->browserCapable()) { $this->popupIfNotModal = False; } core_dbg(get_class($this) . ".popup(id={$mID}, url={$url}, shouldBeModal={$shouldBeModal}, look={$look})", '', '', $this->debug); if (!$image) { switch ($look) { case 'plain': $mID = nbsp($mID); break; case 'brackets': $mID = nbsp(" [ {$mID} ] "); break; case 'input': $mID = "<input type='submit' value='{$mID}'>"; break; } } if ($shouldBeModal) { list($file, $query_string) = split('\\?', $url); $loader = 'loader_' . eregi_replace('.php$', '', $file); core_dbg(get_class($this) . ".popup(loader={$loader})", 0, 0, $this->debug); if (function_exists($loader)) { return $this->modalTEXT($mID, catchSysout($loader, array('modal' => 'yes'), $query_string)); } elseif (is_file($file)) { return $this->modalTEXT($mID, catchSysout($file, array('modal' => 'yes'), $query_string)); } else { return $this->modalURL($mID, $url); } } else { // non-modal if ($this->popupIfNotModal) { $href = $this->popupWindow($mID, $url); } else { $href = x("a href='{$url}'", $mID); } return $href; } }
function prepareSubfilterOutput($data, $subfilter, $subfilterName) { order_result($data, 'name'); $output = array(); foreach ($data as $id => $element) { $element['name'] = nbsp(CHtml::encode($element['name'])); // is activated if (str_in_array($id, $subfilter)) { $span = new CSpan($element['name'] . SPACE . '(' . $element['count'] . ')', 'subfilter_enabled'); $span->onClick(CHtml::encode('javascript: create_var("zbx_filter", "subfilter_set", "1", false);' . 'create_var("zbx_filter", ' . CJs::encodeJson($subfilterName . '[' . $id . ']') . ', null, true);')); $output[] = $span; } else { // subfilter has 0 items if ($element['count'] == 0) { $span = new CSpan($element['name'] . SPACE . '(' . $element['count'] . ')', 'subfilter_inactive'); $output[] = $span; } else { // this level has no active subfilters $nspan = $subfilter ? new CSpan(SPACE . '(+' . $element['count'] . ')', 'subfilter_active') : new CSpan(SPACE . '(' . $element['count'] . ')', 'subfilter_active'); $span = new CSpan($element['name'], 'subfilter_disabled'); $span->onClick(CHtml::encode('javascript: create_var("zbx_filter", "subfilter_set", "1", false);' . 'create_var("zbx_filter", ' . CJs::encodeJson($subfilterName . '[' . $id . ']') . ', ' . CJs::encodeJson($id) . ', ' . 'true' . ');')); $output[] = $span; $output[] = $nspan; } } $output[] = ', '; } array_pop($output); return $output; }
function _printFolderOptions($dir = NULL, $indent = '') { if (is_null($dir)) { $dir = $this->_rootpath; } $di = new DirectoryIterator($dir); if (!$di->valid()) { return; } // nothing to list $currentprinted = $this->getPrintedDir(); foreach ($di as $fileinfo) { if ($fileinfo->isDir() && !$fileinfo->isDot()) { $printed_dir = $this->getPrintedDir($fileinfo->getPath() . '/' . $fileinfo->getFilename()); $sel = $printed_dir == $currentprinted ? ' selected="seelected"' : ''; ?> <option value="<?php echo ents($printed_dir); ?> "<?php echo $sel; ?> ><?php echo nbsp(ents($indent . $fileinfo->getFilename())); ?> </option> <?php if (strlen($indent) < 3) { // going too far down into the tree is too slow, limit ourselves to depth 4 $this->_printFolderOptions($dir . '/' . $fileinfo->getFilename(), $indent . ' '); } } } }
echo nbsp($TD["size"]); ?> </pre></td> <td height="1" align="center" class="<?php echo $StyleClass; ?> "><pre><?php echo nbsp($TD["info"]); ?> </pre></td> <?if($AllowWrite && isset($TD["write"])){?> <td height="1" align="center" class="<?php echo $StyleClass; ?> "><pre><?php echo nbsp($TD["write"]); ?> </pre></td> <?}?> </tr> <?}?> <tr> <td class="DataRow1"> </td> <td class="DataRow1"> </td> <td class="DataRow1"> </td> <td class="DataRow1"> </td> <?if($AllowWrite){?> <td class="DataRow1"> </td> <?}?> </tr> </table>
<?php $status = isset($_GET["status"]); page_header($status ? lang('Status') : lang('Variables')); $variables = $status ? show_status() : show_variables(); if (!$variables) { echo "<p class='message'>" . lang('No rows.') . "\n"; } else { echo "<table cellspacing='0'>\n"; foreach ($variables as $key => $val) { echo "<tr>"; echo "<th><code class='jush-" . $jush . ($status ? "status" : "set") . "'>" . h($key) . "</code>"; echo "<td>" . nbsp($val); } echo "</table>\n"; }
<?if ($ss_prmev[ro]=="M") { // bouton ajouter en modif echo (nbsp(3));?> <a href="#" onclick="javascript:popup('popup_fichpext.php?TE=A');" title="Ajouter une personne"><img src="../images/ajout_pers.gif" border="0"></a> <? echo (nbsp(3));?> <a href="#" onclick="javascript:popup('popup_fichste.php?TE=A');" title="Ajouter une structure"><img src="../images/ajout_struct.gif" border="0"></a> <? } // fin si en modif } // fin si assez de lignes à afficher // gestion des boutons suivant et précédent if ($FirstPers>0) { echo "<A HREF=\"list_pext.php?lc_FirstPers=".max(0,$FirstPers-$NbLigPPP)."\" title=\"afficher les $NbLigPPP enregistrements précédents\"><img src=\"../../intranet/partage/IMAGES/preced.gif\" border=\"0\"></A> "; } if (($FirstPers+$NbLigPPP)<$nbrows) { echo " <A HREF=\"list_pext.php?lc_FirstPers=".($FirstPers+$NbLigPPP)."\" title=\"afficher les $NbLigPPP enregistrements suivants\"><img src=\"../../intranet/partage/IMAGES/suivant.gif\" border=\"0\"></A>"; } ?> </td></tr><? } // fin si nbrows >0 ?> <tr><td colspan="2" align="center"> <? if ($ss_prmev[aff_pop]=="Y") { // Bouton fermer si affichage en popup, depuis page accueil intranet ?> <a href="#" onclick="javascript:self.close()"><img src="../../intranet/partage/IMAGES/bout_fermer.gif" border="0" alt="fermer cette fenêtre"></A> <? echo (nbsp(3));} ?> <a href="req_rech_pext.php"><img src="../../../intranet/partage/IMAGES/retour.gif" border="0" title="retour à la grille de requête" onmouseover="self.status='Retour';return true" width="70" height="11"></a> </td></tr></table> </BODY> </HTML>
function print_widget($name, $params, $value) { $classes = array_get($params, 'class', ''); if (!array_get($params, 'allow_empty', 1)) { $classes .= ' compulsory'; } $attrs = array(); foreach (array_get($params, 'attrs', array()) as $attr => $val) { $attrs[] = $attr . '="' . ents($val) . '"'; } $attrs = implode(' ', $attrs); switch ($params['type']) { case 'phone': $lengths = get_valid_phone_number_lengths($params['formats']); $width = max(get_phone_format_lengths($params['formats'])); ?> <input name="<?php echo $name; ?> " type="tel" size="<?php echo $width; ?> " value="<?php echo format_phone_number($value, $params['formats']); ?> " class="phone-number" validlengths="<?php echo implode(',', $lengths); ?> " <?php echo $attrs; ?> /> <?php break; case 'bibleref': require_once 'bible_ref.class.php'; $br = new bible_ref($value); $value = $br->toShortString(); $params['class'] = 'bible-ref'; // fall through // fall through case 'text': case 'email': $maxlength_exp = empty($params['maxlength']) ? '' : 'maxlength="' . $params['maxlength'] . '"'; if (array_get($params, 'height', 1) > 1) { $cols_exp = empty($params['width']) ? '' : 'cols="' . $params['width'] . '"'; ?> <textarea name="<?php echo $name; ?> " rows="<?php echo $params['height']; ?> " <?php echo $cols_exp; ?> class="<?php echo trim($classes); ?> " <?php echo $maxlength_exp; ?> ><?php echo ents($value); ?> </textarea> <?php } else { $width_exp = empty($params['width']) ? '' : 'size="' . $params['width'] . '"'; $regex_exp = empty($params['regex']) ? '' : 'regex="' . trim($params['regex'], '/ ') . '"'; $autocomplete_exp = isset($params['autocomplete']) ? 'autocomplete=' . ($params['autocomplete'] ? 'on' : 'off') . '"' : ''; ?> <input type="<?php echo $params['type']; ?> " name="<?php echo $name; ?> " value="<?php echo ents($value); ?> " class="<?php echo trim($classes); ?> " <?php echo implode(' ', array($maxlength_exp, $width_exp, $regex_exp, $autocomplete_exp)); ?> <?php echo $attrs; ?> /> <?php } break; case 'html': static $includedCK = false; if (!$includedCK) { ?> <script src="<?php echo BASE_URL . 'resources/ckeditor/ckeditor.js'; ?> "></script> <?php } ?> <textarea class="ckeditor" name="<?php echo $name; ?> " <?php echo $attrs; ?> ><?php echo $value; ?> </textarea> <?php break; case 'int': $classes .= ' int-box'; $width_exp = ''; if (!empty($params['width'])) { $width_exp = 'size="' . $params['width'] . '" '; } else { $width_exp = 'size="3" '; } ?> <input type="text" name="<?php echo $name; ?> " value="<?php echo $value; ?> " class="<?php echo trim($classes); ?> " <?php echo $width_exp; ?> <?php echo $attrs; ?> /> <?php break; case 'select': $our_val = is_array($value) ? $value : ($value === '' ? array() : array("{$value}")); foreach ($our_val as $k => $v) { $our_val[$k] = "{$v}"; } if (array_get($params, 'style', 'dropbox') == 'colour-buttons') { ?> <div class="radio-button-group <?php echo array_get($params, 'class', ''); ?> " <?php if (!SizeDetector::isNarrow()) { echo ' tabindex="1"'; } ?> > <input type="hidden" name="<?php echo $name; ?> " value="<?php echo reset($our_val); ?> " /> <?php foreach ($params['options'] as $k => $v) { $classes = 'btn value-' . $k; if (in_array("{$k}", $our_val, true)) { $classes .= ' active'; } ?> <div class="<?php echo $classes; ?> " title="<?php echo $v; ?> " data-val="<?php echo $k; ?> " > <?php echo strtoupper($v[0]); ?> </div> <?php } ?> </div> <?php } else { if (array_get($params, 'allow_multiple')) { $height = array_get($params, 'height', min(count($params['options']), 4)); if (substr($name, -2) != '[]') { $name .= '[]'; } $style = 'height: ' . $height * 1.8 . 'em'; $classes .= ' multi-select'; // the empty onclick below is to make labels work on iOS // see http://stackoverflow.com/questions/5421659/html-label-command-doesnt-work-in-iphone-browser ?> <div class="<?php echo $classes; ?> " style="<?php echo $style; ?> " tabindex="0" onclick="" <?php echo $attrs; ?> > <?php foreach ($params['options'] as $k => $v) { $checked_exp = in_array("{$k}", $our_val, true) ? ' checked="checked"' : ''; $disabled_exp = !empty($params['disabled_prefix']) && strpos($k, $params['disabled_prefix']) === 0 ? ' disabled="disabled" ' : ''; ?> <label class="checkbox" title="<?php echo ents($v); ?> "> <input type="checkbox" name="<?php echo $name; ?> " value="<?php echo $k; ?> " <?php echo $checked_exp . $disabled_exp; ?> > <?php echo ents($v); ?> </label> <?php } ?> </div> <?php } else { ?> <select name="<?php echo $name; ?> " class="<?php echo $classes; ?> " <?php echo $attrs; ?> > <?php if (array_get($params, 'allow_empty') && !array_get($params, 'allow_multiple')) { ?> <option value=""><?php echo array_get($params, 'empty_text', '(None)'); ?> </option> <?php } foreach (array_get($params, 'options', array()) as $k => $v) { $selected_exp = in_array("{$k}", $our_val, true) ? ' selected="selected"' : ''; $disabled_exp = !empty($params['disabled_prefix']) && strpos($k, $params['disabled_prefix']) === 0 ? ' disabled="disabled" ' : ''; ?> <option value="<?php echo $k; ?> "<?php echo $selected_exp . $disabled_exp; ?> ><?php echo ents($v); ?> </option> <?php } ?> </select> <?php } } break; case 'date': $day_year_classes = trim($classes . ' int-box'); if (FALSE === strpos($name, '[')) { $name_template = $name . '%s'; } else { $name_template = substr($name, 0, strpos($name, '[')) . '%s' . substr($name, strpos($name, '[')); } $months = array(); if (array_get($params, 'allow_empty', false)) { $months[''] = '(Month)'; } for ($i = 1; $i < 13; $i++) { $months[$i] = date(array_get($params, 'month_format', 'F'), strtotime("2007-{$i}-01")); } if (empty($value)) { $value = date('Y-m-d'); } // blank dates not allowed list($year_val, $month_val, $day_val) = explode('-', substr($value, 0, 10)); ?> <span class="nowrap" <?php echo $attrs; ?> > <input type="text" name="<?php printf($name_template, '_d'); ?> " class="day-box <?php echo $day_year_classes; ?> " size="2" maxlength="2" value="<?php echo $day_val; ?> " placeholder="DD" /><select name="<?php printf($name_template, '_m'); ?> " class="month-box <?php echo $classes; ?> "> <?php foreach ($months as $i => $month_name) { $selected = $i == $month_val ? ' selected="selected"' : ''; ?> <option value="<?php echo $i; ?> "<?php echo $selected; ?> ><?php echo $month_name; ?> </option> <?php } ?> </select><input type="text" name="<?php printf($name_template, '_y'); ?> " class="year-box <?php echo $day_year_classes; ?> " size="4" maxlength="4" value="<?php echo $year_val; ?> " placeholder="YYYY"/> </span> <?php break; case 'reference': if (!empty($params['references'])) { $where = array(); if (!empty($params['filter']) && is_array($params['filter'])) { $where = $params['filter']; } $where_logic = array_get($params, 'filter_logic', 'AND'); $options = $GLOBALS['system']->getDBObjectData($params['references'], $where, $where_logic, array_get($params, 'order_by')); $dummy = new $params['references'](); $our_val = is_array($value) ? $value : (empty($value) ? array() : array($value)); if (!empty($params['filter']) && is_callable($params['filter'])) { foreach ($options as $i => $o) { $dummy->populate($i, $o); if (!in_array($i, $our_val) && !$params['filter']($dummy)) { unset($options[$i]); } } } $params['options'] = array(); foreach ($options as $k => $details) { $dummy->populate($k, $details); $params['options'][$k] = $dummy->toString(); } $params['type'] = 'select'; print_widget($name, $params, $value); } break; case 'bitmask': $value = (int) $value; ?> <div class="bitmask-boxes"> <?php $percol = false; $cols = 3; require_once 'include/size_detector.class.php'; if (SizeDetector::getWidth()) { if (SizeDetector::isNarrow()) { $cols = 1; } else { if (SizeDetector::isMedium()) { $cols = 2; } } } if ($cols > 1) { $percol = ceil(count($params['options']) / $cols); ?> <div class="bitmask-column" <?php echo $attrs; ?> > <?php } $i = 0; foreach ($params['options'] as $k => $v) { $checked_exp = ($value & (int) $k) == $k ? 'checked="checked"' : ''; // the empty onclick below is to make labels work on iOS // see http://stackoverflow.com/questions/5421659/html-label-command-doesnt-work-in-iphone-browser ?> <label class="checkbox" onclick=""> <input type="checkbox" name="<?php echo ents($name); ?> []" value="<?php echo ents($k); ?> " <?php echo $checked_exp; ?> > <?php echo nbsp(ents($v)); ?> </label> <?php if ($percol && ++$i % $percol == 0) { ?> </div> <div> <?php } } if ($percol) { ?> </div> <?php } ?> </div> <?php break; } }
echo '<th>' . (support("table") || support("indexes") ? '<a href="' . h(ME) . 'table=' . urlencode($name) . '" title="' . lang('Show structure') . '">' . h($name) . '</a>' : h($name)); if ($view) { echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . (preg_match('~materialized~i', $type) ? lang('Materialized View') : lang('View')) . '</a>'; echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>'; } else { foreach (array("Engine" => array(), "Collation" => array(), "Data_length" => array("create", lang('Alter table')), "Index_length" => array("indexes", lang('Alter indexes')), "Data_free" => array("edit", lang('New item')), "Auto_increment" => array("auto_increment=1&create", lang('Alter table')), "Rows" => array("select", lang('Select data'))) as $key => $link) { $id = " id='{$key}-" . h($name) . "'"; echo $link ? "<td align='right'>" . (support("table") || $key == "Rows" || support("indexes") && $key != "Data_length" ? "<a href='" . h(ME . "{$link['0']}=") . urlencode($name) . "'{$id} title='{$link['1']}'>?</a>" : "<span{$id}>?</span>") : "<td id='{$key}-" . h($name) . "'> "; } $tables++; } echo support("comment") ? "<td id='Comment-" . h($name) . "'> " : ""; } echo "<tr><td> <th>" . lang('%d in total', count($tables_list)); echo "<td>" . nbsp($jush == "sql" ? $connection->result("SELECT @@storage_engine") : ""); echo "<td>" . nbsp(db_collation(DB, collations())); foreach (array("Data_length", "Index_length", "Data_free") as $key) { echo "<td align='right' id='sum-{$key}'> "; } echo "</table>\n"; if (!information_schema(DB)) { $vacuum = "<input type='submit' value='" . lang('Vacuum') . "'" . on_help("'VACUUM'") . "> "; $optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'" . on_help($jush == "sql" ? "'OPTIMIZE TABLE'" : "'VACUUM OPTIMIZE'") . "> "; echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>" . ($jush == "sqlite" ? $vacuum : ($jush == "pgsql" ? $vacuum . $optimize : ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'" . on_help("'ANALYZE TABLE'") . "> " . $optimize . "<input type='submit' name='check' value='" . lang('Check') . "'" . on_help("'CHECK TABLE'") . "> " . "<input type='submit' name='repair' value='" . lang('Repair') . "'" . on_help("'REPAIR TABLE'") . "> " : ""))) . "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . on_help($jush == "sqlite" ? "'DELETE'" : "'TRUNCATE" . ($jush == "pgsql" ? "'" : " TABLE'")) . "> " . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . on_help("'DROP TABLE'") . ">\n"; $databases = support("scheme") ? $adminer->schemas() : $adminer->databases(); if (count($databases) != 1 && $jush != "sqlite") { $db = isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB); echo "<p>" . lang('Move to other database') . ": "; echo $databases ? html_select("target", $databases, $db) : '<input name="target" value="' . h($db) . '" autocapitalize="off">'; echo " <input type='submit' name='move' value='" . lang('Move') . "'>"; echo support("copy") ? " <input type='submit' name='copy' value='" . lang('Copy') . "'>" : "";
<form action="" method="post"> <table cellspacing="0" onclick="tableClick(event);" ondblclick="tableClick(event, true);" class="nowrap checkable"> <?php // HTML valid because there is always at least one process $i = -1; foreach (process_list() as $i => $row) { if (!$i) { echo "<thead><tr lang='en'>" . (support("kill") ? "<th> " : ""); foreach ($row as $key => $val) { echo "<th>{$key}" . doc_link(array('sql' => "show-processlist.html#processlist_" . strtolower($key), 'pgsql' => "monitoring-stats.html#PG-STAT-ACTIVITY-VIEW", 'oracle' => "../b14237/dynviews_2088.htm")); } echo "</thead>\n"; } echo "<tr" . odd() . ">" . (support("kill") ? "<td>" . checkbox("kill[]", $row[$jush == "sql" ? "Id" : "pid"], 0) : ""); foreach ($row as $key => $val) { echo "<td>" . ($jush == "sql" && $key == "Info" && preg_match("~Query|Killed~", $row["Command"]) && $val != "" || $jush == "pgsql" && $key == "current_query" && $val != "<IDLE>" || $jush == "oracle" && $key == "sql_text" && $val != "" ? "<code class='jush-{$jush}'>" . shorten_utf8($val, 100, "</code>") . ' <a href="' . h(ME . ($row["db"] != "" ? "db=" . urlencode($row["db"]) . "&" : "") . "sql=" . urlencode($val)) . '">' . lang('Clone') . '</a>' : nbsp($val)); } echo "\n"; } ?> </table> <script type='text/javascript'>tableCheck();</script> <p> <?php if (support("kill")) { echo $i + 1 . "/" . lang('%d in total', max_connections()); echo "<p><input type='submit' value='" . lang('Kill') . "'>\n"; } ?> <input type="hidden" name="token" value="<?php echo $token;
/** * Creates and returns the trigger overview table for the given hosts. * * @param array $hostIds * @param string $application name of application to filter * @param string $pageFile the page where the element is displayed * @param int $viewMode table display style: either hosts on top, or host on the left side * @param string $screenId the ID of the screen, that contains the trigger overview table * * @return CTableInfo */ function getTriggersOverview($hostIds, $application, $pageFile, $viewMode = null, $screenId = null) { if (is_null($viewMode)) { $viewMode = CProfile::get('web.overview.view.style', STYLE_TOP); } // get application ids $applicationIds = null; if ($application !== '') { $dbApplications = API::Application()->get(array('hostids' => $hostIds, 'filter' => array('name' => $application), 'output' => array('applicationid'))); $applicationIds = zbx_objectValues($dbApplications, 'applicationid'); $hostIds = null; } // get triggers $dbTriggers = API::Trigger()->get(array('hostids' => $hostIds, 'applicationids' => $applicationIds, 'monitored' => true, 'skipDependent' => true, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid', 'name'), 'sortfield' => 'description')); // get hosts $hostIds = array(); foreach ($dbTriggers as $trigger) { $host = reset($trigger['hosts']); $hostIds[$host['hostid']] = $host['hostid']; } $hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostIds, 'preservekeys' => true, 'selectScreens' => $viewMode == STYLE_LEFT ? API_OUTPUT_COUNT : null)); $triggers = array(); $hostNames = array(); foreach ($dbTriggers as $trigger) { $host = reset($trigger['hosts']); $host['name'] = get_node_name_by_elid($host['hostid'], null, NAME_DELIMITER) . $host['name']; $trigger['description'] = CMacrosResolverHelper::resolveTriggerReference($trigger['expression'], $trigger['description']); $hostNames[$host['hostid']] = $host['name']; // a little tricky check for attempt to overwrite active trigger (value=1) with // inactive or active trigger with lower priority. if (!isset($triggers[$trigger['description']][$host['name']]) || ($triggers[$trigger['description']][$host['name']]['value'] == TRIGGER_VALUE_FALSE && $trigger['value'] == TRIGGER_VALUE_TRUE || ($triggers[$trigger['description']][$host['name']]['value'] == TRIGGER_VALUE_FALSE || $trigger['value'] == TRIGGER_VALUE_TRUE) && $trigger['priority'] > $triggers[$trigger['description']][$host['name']]['priority'])) { $triggers[$trigger['description']][$host['name']] = array('hostid' => $host['hostid'], 'triggerid' => $trigger['triggerid'], 'value' => $trigger['value'], 'lastchange' => $trigger['lastchange'], 'priority' => $trigger['priority'], 'flags' => $trigger['flags'], 'url' => $trigger['url'], 'hosts' => array($host)); } } $triggerTable = new CTableInfo(_('No triggers found.')); if (empty($hostNames)) { return $triggerTable; } $triggerTable->makeVerticalRotation(); order_result($hostNames); if ($viewMode == STYLE_TOP) { // header $header = array(new CCol(_('Triggers'), 'center')); foreach ($hostNames as $hostName) { $header[] = new CCol($hostName, 'vertical_rotation'); } $triggerTable->setHeader($header, 'vertical_header'); // data foreach ($triggers as $description => $triggerHosts) { $columns = array(nbsp($description)); foreach ($hostNames as $hostName) { $columns[] = getTriggerOverviewCells(isset($triggerHosts[$hostName]) ? $triggerHosts[$hostName] : null, $pageFile, $screenId); } $triggerTable->addRow($columns); } } else { // header $header = array(new CCol(_('Host'), 'center')); foreach ($triggers as $description => $triggerHosts) { $header[] = new CCol($description, 'vertical_rotation'); } $triggerTable->setHeader($header, 'vertical_header'); // data $scripts = API::Script()->getScriptsByHosts(zbx_objectValues($hosts, 'hostid')); foreach ($hostNames as $hostId => $hostName) { $name = new CSpan($hostName, 'link_menu'); $name->setMenuPopup(getMenuPopupHost($hosts[$hostId], $scripts[$hostId])); $columns = array($name); foreach ($triggers as $triggerHosts) { $columns[] = getTriggerOverviewCells(isset($triggerHosts[$hostName]) ? $triggerHosts[$hostName] : null, $pageFile, $screenId); } $triggerTable->addRow($columns); } } return $triggerTable; }
/** * Print the value of a field to the HTML interface * * Subclasses should add links and other HTML markup by overriding this */ public function printFieldValue($name, $value = null) { if (!isset($this->fields[$name])) { trigger_error('Cannot get value for field ' . ents($name) . ' - field does not exist', E_USER_WARNING); return NULL; } if (is_null($value)) { $value = $this->values[$name]; } if ($name == 'history' && !empty($value)) { ?> <table class="history table table-full-width table-striped"> <?php foreach ($value as $time => $detail) { ?> <tr> <th class="narrow"><?php echo format_datetime($time); ?> </th> <td><?php echo nl2br(ents($detail)); ?> </td> </tr> <?php } ?> </table> <?php } else { if ($this->fields[$name]['type'] == 'bitmask') { $percol = false; if (!empty($this->fields[$name]['cols']) && (int) $this->fields[$name]['cols'] > 1) { $percol = ceil(count($this->fields[$name]['options']) / $this->fields[$name]['cols']); } $i = 0; foreach ($this->fields[$name]['options'] as $k => $v) { $checked_exp = ($value & (int) $k) == $k ? 'checked="checked"' : ''; ?> <label class="checkbox"> <input type="checkbox" disabled="disabled" name="<?php echo ents($name); ?> []" value="<?php echo ents($k); ?> " id="<?php echo ents($name . '_' . $k); ?> " <?php echo $checked_exp; ?> > <?php echo nbsp(ents($v)); ?> </label> <?php } } else { if ($this->fields[$name]['type'] == 'text' && array_get($this->fields[$name], 'height', 1) > 1) { echo nl2br(ents($this->getFormattedValue($name, $value))); } else { if ($this->fields[$name]['type'] == 'phone') { echo '<a href="tel:' . $value . '">' . ents($this->getFormattedValue($name, $value)) . '</a>'; } else { if ($this->fields[$name]['type'] == 'email') { $personName = $this->values[$name] == $value ? $this->values['first_name'] . ' ' . $this->values['last_name'] : ''; echo '<a href="' . get_email_href($value, $personName) . '" ' . email_link_extras() . '>' . ents($value) . '</a>'; } else { if ($this->fields[$name]['type'] == 'html') { echo $this->getFormattedValue($name, $value); } else { echo ents($this->getFormattedValue($name, $value)); } } } } } } }
<td> <!-- <td class="grosliens" bgcolor="#A491BE"> Ancien fond--> <a href="http://*****:*****@195.115.122.8:81" target="_blank"><img src="../images/logo_nocia2.gif" border="0" width="63" height="50" alt="Nocia, le portail Intranet du Ministère"></a></td> <!-- <td class="grosliens" bgcolor="#600F63"> ANcien fond --> <td> <a href="http://www.legifrance.gouv.fr/citoyen/new_officiels.ow" target="_blank"><img src="../images/logo_legifrance.gif" border="0" width="130" height="43" alt="Légifrance.gouv.fr, le service public de la diffusion du droit"></a> </td></tr> </table> </td> <td width="250" align="center" valign="top"> </td> <!-- <img src="../images/imag_mil_acc_prov2.jpg" border="0"></td> --> <td width="275" align="center" valign="top" align="center"> <? EchoTitIm1(nbsp(20)."Actualités".nbsp(20),"_b"); ?> <table border="0" cellpadding="0" cellspacing="5" align="center"><tr><td> <IFRAME SRC="actus_pa.php" frameborder="no" MARGINWIDTH="1" MARGINHEIGHT="1" SCROLLING="auto" width="265" height="290" align="center"></IFRAME> </td></tr> </table> <table width="90%" border="0" cellpadding="0" cellspacing="1" align="center"> <tr align="center"><td class="liensmoy" bgcolor="#AD9AC3"> <a href="#" onclick="popup('../../intranet/HTML/actu_vrac.php?Emplact=DRH_notserv',500,350);"> Notes de<br>service</a></td> <td bgcolor="#6C4D96" class="liensmoy"> <a href="#" onclick="popup('../../intranet/HTML/actu_vrac.php?Emplact=DRH_txtregl',500,300);"> Textes<br>réglementaires</a></td> <td bgcolor="#600F63" class="liensmoy"> <a href="#" onclick="popup('../../intranet/HTML/actu_vrac.php?Emplact=DRH_mobint',500,300);"> Mobilité</a></td>
function stage1() { $LICENCE_FILE = 'conf/COPYING'; $this->DISABLE_NEXT_BUTTON = !$this->getConfig('agree', false); return array(new CTag('div', 'yes', file_exists($LICENCE_FILE) ? new CScript(nl2br(nbsp(htmlspecialchars(file_get_contents($LICENCE_FILE))))) : 'Missing licence file. See GPL licence.', 'licence'), BR(), new CTag('div', 'yes', array(new CCheckBox('agree', $this->getConfig('agree', false), 'submit();'), 'I agree'), 'center')); }
/** * Retrieve overview table object for items. * * @param array $hostIds * @param string $application name of application to filter * @param int $viewMode * * @return CTableInfo */ function getItemsDataOverview($hostIds, $application, $viewMode) { $sqlFrom = ''; $sqlWhere = ''; if ($application !== '') { $sqlFrom = 'applications a,items_applications ia,'; $sqlWhere = ' AND i.itemid=ia.itemid AND a.applicationid=ia.applicationid AND a.name=' . zbx_dbstr($application); } $dbItems = DBfetchArray(DBselect('SELECT DISTINCT h.hostid,h.name AS hostname,i.itemid,i.key_,i.value_type,i.units,' . 'i.name,t.priority,i.valuemapid,t.value AS tr_value,t.triggerid' . ' FROM hosts h,' . $sqlFrom . 'items i' . ' LEFT JOIN functions f ON f.itemid=i.itemid' . ' LEFT JOIN triggers t ON t.triggerid=f.triggerid AND t.status=' . TRIGGER_STATUS_ENABLED . ' WHERE ' . dbConditionInt('h.hostid', $hostIds) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . dbConditionInt('i.flags', array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED)) . $sqlWhere)); $dbItems = CMacrosResolverHelper::resolveItemNames($dbItems); CArrayHelper::sort($dbItems, array(array('field' => 'name_expanded', 'order' => ZBX_SORT_UP), array('field' => 'itemid', 'order' => ZBX_SORT_UP))); // fetch latest values $history = Manager::History()->getLast(zbx_toHash($dbItems, 'itemid'), 1, ZBX_HISTORY_PERIOD); // fetch data for the host JS menu $hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'monitored_hosts' => true, 'hostids' => $hostIds, 'with_monitored_items' => true, 'preservekeys' => true, 'selectScreens' => $viewMode == STYLE_LEFT ? API_OUTPUT_COUNT : null)); $items = array(); foreach ($dbItems as $dbItem) { $name = $dbItem['name_expanded']; $dbItem['hostname'] = get_node_name_by_elid($dbItem['hostid'], null, NAME_DELIMITER) . $dbItem['hostname']; $hostNames[$dbItem['hostid']] = $dbItem['hostname']; // a little tricky check for attempt to overwrite active trigger (value=1) with // inactive or active trigger with lower priority. if (!isset($items[$name][$dbItem['hostname']]) || ($items[$name][$dbItem['hostname']]['tr_value'] == TRIGGER_VALUE_FALSE && $dbItem['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$name][$dbItem['hostname']]['tr_value'] == TRIGGER_VALUE_FALSE || $dbItem['tr_value'] == TRIGGER_VALUE_TRUE) && $dbItem['priority'] > $items[$name][$dbItem['hostname']]['severity'])) { $items[$name][$dbItem['hostname']] = array('itemid' => $dbItem['itemid'], 'value_type' => $dbItem['value_type'], 'value' => isset($history[$dbItem['itemid']]) ? $history[$dbItem['itemid']][0]['value'] : null, 'units' => $dbItem['units'], 'name' => $name, 'valuemapid' => $dbItem['valuemapid'], 'severity' => $dbItem['priority'], 'tr_value' => $dbItem['tr_value'], 'triggerid' => $dbItem['triggerid']); } } $table = new CTableInfo(_('No items found.')); if (empty($hostNames)) { return $table; } $table->makeVerticalRotation(); order_result($hostNames); if ($viewMode == STYLE_TOP) { $header = array(new CCol(_('Items'), 'center')); foreach ($hostNames as $hostName) { $header[] = new CCol($hostName, 'vertical_rotation'); } $table->setHeader($header, 'vertical_header'); foreach ($items as $descr => $ithosts) { $tableRow = array(nbsp($descr)); foreach ($hostNames as $hostName) { $tableRow = getItemDataOverviewCells($tableRow, $ithosts, $hostName); } $table->addRow($tableRow); } } else { $scripts = API::Script()->getScriptsByHosts(zbx_objectValues($hosts, 'hostid')); $header = array(new CCol(_('Hosts'), 'center')); foreach ($items as $descr => $ithosts) { $header[] = new CCol($descr, 'vertical_rotation'); } $table->setHeader($header, 'vertical_header'); foreach ($hostNames as $hostId => $hostName) { $host = $hosts[$hostId]; $name = new CSpan($host['name'], 'link_menu'); $name->setMenuPopup(getMenuPopupHost($host, $scripts[$hostId])); $tableRow = array(new CCol($name)); foreach ($items as $ithosts) { $tableRow = getItemDataOverviewCells($tableRow, $ithosts, $hostName); } $table->addRow($tableRow); } } return $table; }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $output = array(); $stime = zbxDateToTime($this->timeline['stime']); $iv_string = array(ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1); $iv_numeric = array(ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1); if ($this->action == 'showvalues' || $this->action == 'showlatest') { $options = array('history' => $this->item['value_type'], 'itemids' => array_keys($this->items), 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN); if ($this->action == 'showlatest') { $options['limit'] = 500; } elseif ($this->action == 'showvalues') { $config = select_config(); $options['time_from'] = $stime - 10; // some seconds to allow script to execute $options['time_till'] = $stime + $this->timeline['period']; $options['limit'] = $config['search_limit']; } // text log if (isset($iv_string[$this->item['value_type']])) { $isManyItems = count($this->items) > 1; $useLogItem = $this->item['value_type'] == ITEM_VALUE_TYPE_LOG; $useEventLogItem = strpos($this->item['key_'], 'eventlog[') === 0; if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), $isManyItems ? _('Item') : null, $useLogItem ? _('Local time') : null, $useEventLogItem && $useLogItem ? _('Source') : null, $useEventLogItem && $useLogItem ? _('Severity') : null, $useEventLogItem && $useLogItem ? _('Event ID') : null, _('Value')), 'header'); } if (!zbx_empty($this->filter) && in_array($this->filterTask, array(FILTER_TASK_SHOW, FILTER_TASK_HIDE))) { $options['search'] = array('value' => $this->filter); if ($this->filterTask == FILTER_TASK_HIDE) { $options['excludeSearch'] = 1; } } $options['sortfield'] = 'id'; $historyData = API::History()->get($options); foreach ($historyData as $data) { $data['value'] = encode_log(trim($data['value'], "\r\n")); if (empty($this->plaintext)) { $item = $this->items[$data['itemid']]; $host = reset($item['hosts']); $color = null; if (isset($this->filter) && !zbx_empty($this->filter)) { $contain = zbx_stristr($data['value'], $this->filter); if ($contain && $this->filterTask == FILTER_TASK_MARK) { $color = $this->markColor; } if (!$contain && $this->filterTask == FILTER_TASK_INVERT_MARK) { $color = $this->markColor; } switch ($color) { case MARK_COLOR_RED: $color = 'red'; break; case MARK_COLOR_GREEN: $color = 'green'; break; case MARK_COLOR_BLUE: $color = 'blue'; break; } } $row = array(nbsp(zbx_date2str(_('Y.M.d H:i:s'), $data['clock']))); if ($isManyItems) { $row[] = $host['name'] . NAME_DELIMITER . $item['name_expanded']; } if ($useLogItem) { $row[] = $data['timestamp'] == 0 ? '-' : zbx_date2str(HISTORY_LOG_LOCALTIME_DATE_FORMAT, $data['timestamp']); // if this is a eventLog item, showing additional info if ($useEventLogItem) { $row[] = zbx_empty($data['source']) ? '-' : $data['source']; $row[] = $data['severity'] == 0 ? '-' : new CCol(get_item_logtype_description($data['severity']), get_item_logtype_style($data['severity'])); $row[] = $data['logeventid'] == 0 ? '-' : $data['logeventid']; } } $row[] = new CCol($data['value'], 'pre'); $newRow = new CRow($row); if (!is_null($color)) { $newRow->setAttribute('class', $color); } $historyTable->addRow($newRow); } else { $output[] = zbx_date2str(HISTORY_LOG_ITEM_PLAINTEXT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($data['value']) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } else { if (empty($this->plaintext)) { $historyTable = new CTableInfo(_('No values found.')); $historyTable->setHeader(array(_('Timestamp'), _('Value'))); } $options['sortfield'] = array('itemid', 'clock'); $historyData = API::History()->get($options); foreach ($historyData as $data) { $item = $this->items[$data['itemid']]; $value = $data['value']; // format the value as float if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) { sscanf($data['value'], '%f', $value); } // html table if (empty($this->plaintext)) { if ($item['valuemapid']) { $value = applyValueMap($value, $item['valuemapid']); } $historyTable->addRow(array(zbx_date2str(HISTORY_ITEM_DATE_FORMAT, $data['clock']), zbx_nl2br($value))); } else { $output[] = zbx_date2str(HISTORY_PLAINTEXT_DATE_FORMAT, $data['clock']); $output[] = "\t" . $data['clock'] . "\t" . htmlspecialchars($value) . "\n"; } } if (empty($this->plaintext)) { $output[] = $historyTable; } } } if ($this->action == 'showgraph' && !isset($iv_string[$this->item['value_type']])) { $this->dataId = 'historyGraph'; $containerId = 'graph_cont1'; $src = 'chart.php?itemid=' . $this->item['itemid'] . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stime'] . $this->getProfileUrlParams(); $output[] = new CDiv(null, 'center', $containerId); } // time control if (!$this->plaintext && str_in_array($this->action, array('showvalues', 'showgraph'))) { $graphDims = getGraphDims(); $this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($this->item['itemid'])); $timeControlData = array('periodFixed' => CProfile::get('web.history.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); if (!empty($this->dataId)) { $timeControlData['id'] = $this->getDataId(); $timeControlData['containerid'] = $containerId; $timeControlData['src'] = $src; $timeControlData['objDims'] = $graphDims; $timeControlData['loadSBox'] = 1; $timeControlData['loadImage'] = 1; $timeControlData['dynamic'] = 1; } else { $this->dataId = 'historyGraph'; $timeControlData['id'] = $this->getDataId(); $timeControlData['mainObject'] = 1; } if ($this->mode == SCREEN_MODE_JS) { $timeControlData['dynamic'] = 0; return 'timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'; } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . zbx_jsvalue($this->timeline) . ', ' . zbx_jsvalue($timeControlData) . ');'); } } if (!empty($this->plaintext)) { return $output; } else { if ($this->mode != SCREEN_MODE_JS) { $flickerfreeData = array('itemids' => $this->itemids, 'action' => $this->action, 'filter' => $this->filter, 'filterTask' => $this->filterTask, 'markColor' => $this->markColor); return $this->getOutput($output, true, $flickerfreeData); } } }
if (!uint_in_array(0, $_REQUEST['applications']) && !isset($show_all_apps)) { continue; } if (isset($db_item['lastclock'])) { $lastclock = zbx_date2str(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']); } else { $lastclock = new CCol(' - '); } $lastvalue = format_lastvalue($db_item); if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) { if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) { $change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); $change = nbsp($change); } else { $change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); $change = nbsp($change); } } else { $change = new CCol(' - '); } if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) { $actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action'); } else { $actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action'); } array_push($app_rows, new CRow(array(is_show_subnodes() ? $db_host['item_cnt'] ? SPACE : get_node_name_by_elid($db_item['itemid']) : null, $_REQUEST['hostid'] ? NULL : ($db_host['item_cnt'] ? SPACE : $db_item['host']), str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue), $change, $actions))); } unset($app_rows); unset($db_host); foreach ($db_hosts as $hostid => $db_host) { if (!isset($tab_rows[$hostid])) {
if (isset($services[$row['serviceid']])) { $services[$row['serviceid']] = array_merge($services[$row['serviceid']], $row); } else { $services[$row['serviceid']] = $row; } if (isset($row['serviceupid'])) { $services[$row['serviceupid']]['childs'][] = array('id' => $row['serviceid'], 'soft' => 0, 'linkid' => 0); } if (isset($row['servicedownid'])) { $services[$row['serviceid']]['childs'][] = array('id' => $row['servicedownid'], 'soft' => 1, 'linkid' => $row['linkid']); } } $treeServ = array(); createShowServiceTree($services, $treeServ); //return into $treeServ parametr //permission issue $treeServ = del_empty_nodes($treeServ); $tree = new CTree($treeServ, array('caption' => bold(S_SERVICE), 'status' => bold(S_STATUS), 'reason' => bold(S_REASON), 'sla' => bold(S_SLA_LAST_7_DAYS), 'sla2' => bold(nbsp(S_SLA)), 'graph' => bold(S_GRAPH))); if ($tree) { $url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1'); $fs_icon = new CDiv(SPACE, 'fullscreen'); $fs_icon->AddOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN); $fs_icon->AddAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); $tab = create_hat(S_IT_SERVICES_BIG, $tree->getHTML(), null, 'hat_services', get_profile('web.srv_status.hats.hat_services.state', 1)); $tab->Show(); unset($tab); } else { error('Can not format Tree. Check logik structure in service links'); } } include_once "include/page_footer.php";
} echo '<p class="links"><a href="' . h(ME) . 'indexes=' . urlencode($TABLE) . '">' . lang('Alter indexes') . "</a>\n"; } if (fk_support($table_status)) { echo "<h3 id='foreign-keys'>" . lang('Foreign keys') . "</h3>\n"; $foreign_keys = foreign_keys($TABLE); if ($foreign_keys) { echo "<table cellspacing='0'>\n"; echo "<thead><tr><th>" . lang('Source') . "<td>" . lang('Target') . "<td>" . lang('ON DELETE') . "<td>" . lang('ON UPDATE') . "<td> </thead>\n"; foreach ($foreign_keys as $name => $foreign_key) { echo "<tr title='" . h($name) . "'>"; echo "<th><i>" . implode("</i>, <i>", array_map('h', $foreign_key["source"])) . "</i>"; echo "<td><a href='" . h($foreign_key["db"] != "" ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME) : ($foreign_key["ns"] != "" ? preg_replace('~ns=[^&]*~', "ns=" . urlencode($foreign_key["ns"]), ME) : ME)) . "table=" . urlencode($foreign_key["table"]) . "'>" . ($foreign_key["db"] != "" ? "<b>" . h($foreign_key["db"]) . "</b>." : "") . ($foreign_key["ns"] != "" ? "<b>" . h($foreign_key["ns"]) . "</b>." : "") . h($foreign_key["table"]) . "</a>"; echo "(<i>" . implode("</i>, <i>", array_map('h', $foreign_key["target"])) . "</i>)"; echo "<td>" . nbsp($foreign_key["on_delete"]) . "\n"; echo "<td>" . nbsp($foreign_key["on_update"]) . "\n"; echo '<td><a href="' . h(ME . 'foreign=' . urlencode($TABLE) . '&name=' . urlencode($name)) . '">' . lang('Alter') . '</a>'; } echo "</table>\n"; } echo '<p class="links"><a href="' . h(ME) . 'foreign=' . urlencode($TABLE) . '">' . lang('Add foreign key') . "</a>\n"; } } if (support(is_view($table_status) ? "view_trigger" : "trigger")) { echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n"; $triggers = triggers($TABLE); if ($triggers) { echo "<table cellspacing='0'>\n"; foreach ($triggers as $key => $val) { echo "<tr valign='top'><td>" . h($val[0]) . "<td>" . h($val[1]) . "<th>" . h($key) . "<td><a href='" . h(ME . 'trigger=' . urlencode($TABLE) . '&name=' . urlencode($key)) . "'>" . lang('Alter') . "</a>\n"; }
public function setCaption($value = NULL) { $this->addItem(nbsp($value)); }
function get_triggers_overview($hostids, $view_style = null) { $available_triggers = get_accessible_triggers(PERM_READ_ONLY, $hostids); if (is_null($view_style)) { $view_style = get_profile('web.overview.view.style', STYLE_TOP); } $table = new CTableInfo(S_NO_TRIGGERS_DEFINED); $result = DBselect('SELECT DISTINCT t.triggerid,t.description,t.expression,t.value,t.priority,t.lastchange,h.hostid,h.host' . ' FROM hosts h,items i,triggers t, functions f ' . ' WHERE h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY t.description'); unset($triggers); unset($hosts); $triggers = array(); while ($row = DBfetch($result)) { if (trigger_dependent($row['triggerid'])) { continue; } $row['host'] = get_node_name_by_elid($row['hostid']) . $row['host']; $row['description'] = expand_trigger_description_constants($row['description'], $row); $hosts[strtolower($row['host'])] = $row['host']; // A little tricky check for attempt to overwrite active trigger (value=1) with // inactive or active trigger with lower priority. if (!isset($triggers[$row['description']][$row['host']]) || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE && $row['value'] == TRIGGER_VALUE_TRUE || ($triggers[$row['description']][$row['host']]['value'] == TRIGGER_VALUE_FALSE || $row['value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $triggers[$row['description']][$row['host']]['priority'])) { $triggers[$row['description']][$row['host']] = array('hostid' => $row['hostid'], 'triggerid' => $row['triggerid'], 'value' => $row['value'], 'lastchange' => $row['lastchange'], 'priority' => $row['priority']); } } if (!isset($hosts)) { return $table; } ksort($hosts); if ($view_style == STYLE_TOP) { $header = array(new CCol(S_TRIGGERS, 'center')); foreach ($hosts as $hostname) { $header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname))); } $table->setHeader($header, 'vertical_header'); foreach ($triggers as $descr => $trhosts) { $table_row = array(nbsp($descr)); foreach ($hosts as $hostname) { $table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname); } $table->AddRow($table_row); } } else { $header = array(new CCol(S_HOSTS, 'center')); foreach ($triggers as $descr => $trhosts) { $descr = array(new CImg('vtext.php?text=' . $descr)); array_push($header, $descr); } $table->SetHeader($header, 'vertical_header'); foreach ($hosts as $hostname) { $table_row = array(nbsp($hostname)); foreach ($triggers as $descr => $trhosts) { $table_row = get_trigger_overview_cells($table_row, $trhosts, $hostname); } $table->AddRow($table_row); } } return $table; }
public function addSpanRow($value, $class = NULL) { if (is_string($value)) { $item1 = nbsp($value); } if (is_null($value)) { $value = SPACE; } if (is_null($class)) { $class = 'form_row_c'; } $col = new CCol($value, $class); $col->setColSpan(2); array_push($this->center_items, new CRow($col)); }
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 } }
public function addRow($item1, $item2 = null, $class = null, $id = null) { if (is_object($item1) && zbx_strtolower(get_class($item1)) == 'crow') { } elseif (is_object($item1) && zbx_strtolower(get_class($item1)) == 'ctable') { $td = new CCol($item1, 'form_row_c'); $td->setColSpan(2); $item1 = new CRow($td); } else { if (is_string($item1)) { $item1 = nbsp($item1); } if (empty($item1)) { $item1 = SPACE; } if (empty($item2)) { $item2 = SPACE; } $item1 = new CRow(array(new CCol($item1, 'form_row_l'), new CCol($item2, 'form_row_r')), $class); } if (!is_null($id)) { $item1->attr('id', zbx_formatDomId($id)); } array_push($this->center_items, $item1); return $item1; }
function make_latest_data() { global $USER_DETAILS; $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); while ($db_app = DBfetch($db_applications)) { $db_items = DBselect('SELECT DISTINCT i.* ' . ' FROM items i,items_applications ia' . ' WHERE ia.applicationid=' . $db_app['applicationid'] . ' AND i.itemid=ia.itemid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . order_by('i.description,i.itemid,i.lastclock')); $app_rows = array(); $item_cnt = 0; while ($db_item = DBfetch($db_items)) { $description = item_description($db_item); if (!zbx_empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) { continue; } ++$item_cnt; if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($show_all_apps)) { continue; } if (isset($db_item['lastclock'])) { $lastclock = date(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']); } else { $lastclock = new CCol('-', 'center'); } $lastvalue = format_lastvalue($db_item); if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && $db_item['value_type'] == 0 && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) { if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) { $change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); } else { $change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); } $change = nbsp($change); } else { $change = new CCol('-', 'center'); } if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) { $actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action'); } else { $actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action'); } array_push($app_rows, new CRow(array(is_show_all_nodes() ? SPACE : null, $_REQUEST['hostid'] > 0 ? NULL : SPACE, str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue, $lastvalue == '-' ? 'center' : null), $change, $actions))); } if ($item_cnt > 0) { if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) { $link = new CLink(new CImg('images/general/opened.gif'), '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select')); } else { $link = new CLink(new CImg('images/general/closed.gif'), '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select')); } $col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $item_cnt . SPACE . S_ITEMS . ')')); $col->setColSpan(5); $table->ShowRow(array(get_node_name_by_elid($db_app['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col)); $any_app_exist = true; foreach ($app_rows as $row) { $table->ShowRow($row); } } } }
<?php header("Content-Type: text/javascript; charset=utf-8"); if ($_GET["script"] == "db") { $sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0); foreach (table_status() as $name => $table_status) { $id = is_adminer_escape($name); json_row("Comment-{$id}", nbsp($table_status["Comment"])); if (!is_view($table_status)) { foreach (array("Engine", "Collation") as $key) { json_row("{$key}-{$id}", nbsp($table_status[$key])); } foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) { if ($table_status[$key] != "") { $val = format_number($table_status[$key]); json_row("{$key}-{$id}", $key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB") ? "~ {$val}" : $val); if (isset($sums[$key])) { // ignore innodb_file_per_table because it is not active for tables created before it was enabled $sums[$key] += $table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0; } } elseif (array_key_exists($key, $table_status)) { json_row("{$key}-{$id}"); } } } } foreach ($sums as $key => $val) { json_row("sum-{$key}", format_number($val)); } json_row(""); } elseif ($_GET["script"] == "kill") {
} } unset($service); // fetch sla $slaData = API::Service()->getSla(array('intervals' => array(array('from' => $period_start, 'to' => $period_end)))); // expand problem trigger descriptions foreach ($slaData as &$serviceSla) { foreach ($serviceSla['problems'] as &$problemTrigger) { $problemTrigger['description'] = $triggers[$problemTrigger['triggerid']]['description']; } unset($problemTrigger); } unset($serviceSla); $treeData = array(); createServiceMonitoringTree($services, $slaData, $period, $treeData); $tree = new CServiceTree('service_status_tree', $treeData, array('caption' => _('Service'), 'status' => _('Status'), 'reason' => _('Reason'), 'sla' => _('Problem time'), 'sla2' => nbsp(_('SLA') . ' / ' . _('Acceptable SLA')))); if ($tree) { // creates form for choosing a preset interval $r_form = new CForm(); $r_form->setAttribute('class', 'nowrap'); $r_form->setMethod('get'); $r_form->setAttribute('name', 'period_choice'); $r_form->addVar('fullscreen', $_REQUEST['fullscreen']); $period_combo = new CComboBox('period', $period, 'javascript: submit();'); foreach ($periods as $key => $val) { $period_combo->addItem($key, $val); } $r_form->addItem(array(_('Period') . SPACE, $period_combo)); $srv_wdgt = new CWidget('hat_services', 'service-list service-mon'); $srv_wdgt->addPageHeader(_('IT SERVICES'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']))); $srv_wdgt->addHeader(_('IT services'), $r_form);
/** Print edit input field * @param array one field from fields() * @param mixed * @param string * @return null */ function input($field, $value, $function) { global $connection, $types, $adminer, $jush; $name = h(bracket_escape($field["field"])); echo "<td class='function'>"; if (is_array($value) && !$function) { $args = array($value); if (version_compare(PHP_VERSION, 5.4) >= 0) { $args[] = JSON_PRETTY_PRINT; } $value = call_user_func_array('json_encode', $args); //! requires PHP 5.2 $function = "json"; } $reset = $jush == "mssql" && $field["auto_increment"]; if ($reset && !$_POST["save"]) { $function = null; } $functions = (isset($_GET["select"]) || $reset ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field); $attrs = " name='fields[{$name}]'"; if ($field["type"] == "enum") { echo nbsp($functions[""]) . "<td>" . $adminer->editInput($_GET["edit"], $field, $attrs, $value); } else { $first = 0; foreach ($functions as $key => $val) { if ($key === "" || !$val) { break; } $first++; } $onchange = $first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ({$first} > f.selectedIndex) f.selectedIndex = {$first};\" onkeyup='keyupChange.call(this);'" : ""; $attrs .= $onchange; $has_function = in_array($function, $functions) || isset($functions[$function]); echo (count($functions) > 1 ? "<select name='function[{$name}]' onchange='functionChange(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>" : nbsp(reset($functions))) . '<td>'; $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table if ($input != "") { echo $input; } elseif ($field["type"] == "set") { //! 64 bits preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches); foreach ($matches[1] as $i => $val) { $val = stripcslashes(str_replace("''", "'", $val)); $checked = is_int($value) ? $value >> $i & 1 : in_array($val, explode(",", $value), true); echo " <label><input type='checkbox' name='fields[{$name}][{$i}]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "{$onchange}>" . h($adminer->editVal($val, $field)) . '</label>'; } } elseif (preg_match('~blob|bytea|raw|file~', $field["type"]) && ini_bool("file_uploads")) { echo "<input type='file' name='fields-{$name}'{$onchange}>"; } elseif (($text = preg_match('~text|lob~', $field["type"])) || preg_match("~\n~", $value)) { if ($text && $jush != "sqlite") { $attrs .= " cols='50' rows='12'"; } else { $rows = min(12, substr_count($value, "\n") + 1); $attrs .= " cols='30' rows='{$rows}'" . ($rows == 1 ? " style='height: 1.2em;'" : ""); // 1.2em - line-height } echo "<textarea{$attrs}>" . h($value) . '</textarea>'; } elseif ($function == "json") { echo "<textarea{$attrs} cols='50' rows='12' class='jush-js'>" . h($value) . '</textarea>'; } else { // int(3) is only a display hint $maxlength = !preg_match('~int~', $field["type"]) && preg_match('~^(\\d+)(,(\\d+))?$~', $field["length"], $match) ? (preg_match("~binary~", $field["type"]) ? 2 : 1) * $match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0); if ($jush == 'sql' && $connection->server_info >= 5.6 && preg_match('~time~', $field["type"])) { $maxlength += 7; // microtime } // type='date' and type='time' display localized value which may be confusing, type='datetime' uses 'T' as date and time separator echo "<input" . ((!$has_function || $function === "") && preg_match('~(?<!o)int~', $field["type"]) && !preg_match('~\\[\\]~', $field["full_type"]) ? " type='number'" : "") . " value='" . h($value) . "'" . ($maxlength ? " maxlength='{$maxlength}'" : "") . (preg_match('~char|binary~', $field["type"]) && $maxlength > 20 ? " size='40'" : "") . "{$attrs}>"; } } }