function page_admin_images($act = "", $id = "") { requires_admin(); use_template("admin"); if ($act == "add") { if (form_file_uploaded("file")) { $fname = $_FILES["file"]['name']; db_query("INSERT INTO images (link) VALUES ('')"); $id = db_last_id(); $fname = $id . "." . fileext($fname); form_file_uploaded_move("file", "img/" . $fname); db_query("UPDATE images SET link='img/{$fname}' WHERE id=%d", $id); redir("admin/images"); } form_start("", "post", " enctype='multipart/form-data' "); form_file("Файл", "file"); form_submit("Загрузить", "submit"); form_end(); $o = form(); return $o; } if ($act == "del") { $im = db_object_get("images", $id); @unlink("../{$im->link}"); } $o = table_edit("images", "admin/images", $act, $id, "", "", "", "image_func"); return $o; }
function wormhole_show_wormhole($wormhole_id) { assert(!empty($wormhole_id)); global $_GALAXY; if (!anomaly_is_wormhole($wormhole_id)) { return; } $wormhole = anomaly_get_anomaly($wormhole_id); $sector = sector_get_sector($wormhole['sector_id']); $race = user_get_race($wormhole['user_id']); $result = sql_query("SELECT * FROM w_wormhole WHERE id=" . $wormhole['id']); $dst_wormhole = sql_fetchrow($result); if ($race == "") { $race = "-"; } echo "<table border=1 width=500 align=center>\n"; echo " <tr><td align=center><b><i>Sector: " . $sector['name'] . " / Anomaly: " . $wormhole['name'] . "</i></b></td></tr>\n"; echo " <tr><td>\n"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>\n"; echo " <tr><td width=200>\n"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>\n"; echo " <tr><th>Anomaly View</th></tr>\n"; echo " <tr><td width=100%><center><img src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/wormholes/" . $wormhole['image'] . ".jpg\" width=150 height=150></center></td></tr>\n"; echo " <tr><th> </th></tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " <td> </td>\n"; echo " <td nowrap valign=top>\n"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>\n"; echo " <tr><td nowrap width=40%><strong>Wormhole Name </strong></td><td nowrap width=1%><b>:</b></td>\n"; if ($wormhole['unknown'] == 1) { form_start(); echo "<td nowrap>\n"; echo " <input type=hidden name=aid value=" . encrypt_get_vars($wormhole_id) . ">\n"; echo " <input type=hidden name=cmd value=" . encrypt_get_vars("claim") . ">\n"; echo " <input type=text size=15 maxlength=30 name=ne_name>\n"; echo " <input name=submit type=submit value=\"Claim\">\n"; echo "</td>\n"; form_end(); } else { echo "<td nowrap>" . $wormhole['name'] . "</td>\n"; } echo " </tr>\n"; echo " <tr><td colspan=3> </td></tr>\n"; echo " <tr><td nowrap width=40%><strong>Caretaker </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $race . "</td></tr>\n"; echo " <tr><td nowrap width=40%><strong>Radius </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $wormhole['radius'] . " km</td></tr>\n"; echo " <tr><td nowrap width=40%><strong>Distance to sun </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $wormhole['distance'] . " km (10<sup>6</sup>)</td></tr>\n"; echo " <tr><td colspan=3> </td></tr>\n"; echo " <tr><td nowrap width=40%><strong>Destination </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $dst_wormhole['distance'] . " / " . $dst_wormhole['angle'] . "</td></tr>\n"; echo " <tr><td nowrap width=40%><strong>Stability </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . wormhole_get_wormhole_stability($dst_wormhole['next_jump']) . " </td></tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<br><br>\n"; }
public function parse($orig_name) { global $CORE; ob_start(); if (is_action()) { try { $name = post('name'); if (!$name) { throw new FieldInputError('name', l('Please provide a map name.')); } if (!preg_match(MATCH_MAP_NAME, $name)) { throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME))); } if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) { throw new FieldInputError('name', l('A map with this name already exists.')); } // Read the old config $MAPCFG = new GlobalMapCfg($orig_name); $MAPCFG->readMapConfig(); // Create a new map config $NEW = new GlobalMapCfg($name); $NEW->createMapConfig(); foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) { $NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id); } success(l('The map has been created.')); reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (NagVisException $e) { form_error(null, $e->message()); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; echo '<div class="simple_form">' . N; js_form_start('to_new_map'); input('name'); submit(l('Save')); focus('name'); // Keep the view parameters the users has set $params = ltrim(req('view_params'), '&'); if ($params) { $parts = explode('&', $params); foreach ($parts as $part) { list($key, $val) = explode('=', $part); hidden($key, $val); } } form_end(); echo '</div>' . N; return ob_get_clean(); }
function starbase_show_starbase($starbase_id) { assert(!empty($starbase_id)); global $_GALAXY; if (!anomaly_is_starbase($starbase_id)) { return; } $starbase = anomaly_get_anomaly($starbase_id); $sector = sector_get_sector($starbase['sector_id']); $race = user_get_race($starbase['user_id']); if ($race == "") { $race = "-"; } echo "<table border=1 width=500 align=center>"; echo " <tr><td align=center><b><i>Starbase: " . $starbase['name'] . "</i></b></td></tr>"; echo " <tr><td>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><td width=200>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><th>Starbase View</th></tr>"; echo " <tr><td width=100%><center><img src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/starbase/" . $starbase['image'] . ".jpg\" width=150 height=150></center></td></tr>"; echo " <tr><th> </th></tr>"; echo " </table>"; echo " </td>"; echo " <td> </td>"; echo " <td nowrap valign=top>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><td nowrap width=40%><strong>Starbase Name </strong></td><td nowrap width=1%><b>:</b></td>"; if ($starbase['unknown'] == 1) { form_start(); echo "<td nowrap>"; echo " <input type=hidden name=aid value=" . encrypt_get_vars($starbase_id) . ">"; echo " <input type=hidden name=cmd value=" . encrypt_get_vars("claim") . ">"; echo " <input type=text size=15 maxlength=30 name=ne_name> "; echo " <input name=submit type=submit value=\"Claim\">"; echo "</td>"; form_end(); } else { echo "<td nowrap>" . $starbase['name'] . "</td>"; } echo " </tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr><td nowrap width=40%><strong>Caretaker </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $race . "</td></tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr><td nowrap width=40%><strong>Attack </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $starbase['cur_attack'] . "</td></tr>"; echo " <tr><td nowrap width=40%><strong>Defense </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $starbase['cur_defense'] . "</td></tr>"; echo " <tr><td nowrap width=40%><strong>Strength </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $starbase['cur_strength'] . "</td></tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " </table>"; echo " </td>"; echo " </tr>"; echo " </table>"; echo " </td>"; echo " </tr>"; echo "</table>"; echo "<br><br>"; }
function listSearchesGUI() { global $months; h3("Vis artikler fra gitt måned"); form_start_post(); select_open("month"); for ($i = 1; $i < 10; $i++) { option_open("0" . $i); echo $months[$i]; option_close(); } for ($i = 10; $i < 13; $i++) { option_open($i); echo $months[$i]; option_close(); } select_close(); form_hidden("m_c", "monthSearchResultGUI"); form_select_number("year", 2004, date("Y"), date("Y")); form_submit("submit", "Søk"); form_end(); br(); br(); h3("Fritekstsøk"); $author_usernames = array(); $author_names = array(); $author_usernames[] = "0"; $author_names[] = "(ikke begrens)"; $author_usernames = array_merge($author_usernames, getAllAuthorsUsernames()); $author_names = array_merge($author_names, getAllAuthorsNames()); form_start_post(); form_textfield("text", ""); br(); echo "Sjekk mot hele ord "; form_checkbox("nopartialmatch", "1", "1"); br(); echo "Søk i kommentarer "; form_checkbox("searchcomments", "1", "0"); form_hidden("m_c", "textSearchResultGUI"); br(); echo "Begrens til én forfatter "; form_dropdown("author", $author_usernames, $author_names, 0); br(); form_submit("submit", "Fritekstsøk"); form_end(); br(); br(); h3("Vis alle kommentarer av gitt bruker"); $author_usernames = getAllUsersUsernames(); $author_names = getAllUsersNames(); form_start_post(); echo "Velg forfatter "; form_dropdown("author", $author_usernames, $author_names, 0); form_submit("submit", "Vis kommentarer"); form_hidden("m_c", "listCommentsSearchResultGUI"); form_end(); }
function blackhole_show_blackhole($blackhole_id) { assert(is_numeric($blackhole_id)); global $_GALAXY; if (!anomaly_is_blackhole($blackhole_id)) { return; } $blackhole = anomaly_get_anomaly($blackhole_id); $race = user_get_race($blackhole['user_id']); $sector = sector_get_sector($blackhole['sector_id']); if ($race == "") { $race = "-"; } echo "<table border=1 width=500 align=center>"; echo " <tr><td align=center><b><i>Sector: " . $sector['name'] . " / Anomaly: " . $blackhole['name'] . "</i></b></td></tr>"; echo " <tr><td>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><td width=200>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><th>Anomaly View</th></tr>"; echo " <tr><td width=100%><center><img src=\"" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/blackholes/" . $blackhole['image'] . ".jpg\" width=150 height=150></center></td></tr>"; echo " <tr><th> </th></tr>"; echo " </table>"; echo " </td>"; echo " <td> </td>"; echo " <td nowrap valign=top>"; echo " <table border=0 cellpadding=0 cellspacing=0 width=100%>"; echo " <tr><td nowrap width=40%><strong>Blackhole Name </strong></td><td nowrap width=1%><b>:</b></td>"; if ($blackhole['unknown'] == 1) { form_start(); echo "<td nowrap>"; echo " <input type=hidden name=aid value=" . encrypt_get_vars($blackhole_id) . ">"; echo " <input type=hidden name=cmd value=" . encrypt_get_vars("claim") . ">"; echo " <input type=text size=15 maxlength=30 name=ne_name> "; echo " <input name=submit type=submit value=\"Claim\">"; echo "</td>"; form_end(); } else { echo "<td nowrap>" . $blackhole['name'] . "</td>"; } echo " </tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr><td nowrap width=40%><strong>Caretaker </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $race . "</td></tr>"; echo " <tr><td nowrap width=40%><strong>Radius </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $blackhole['radius'] . " km</td></tr>"; echo " <tr><td nowrap width=40%><strong>Distance to sun </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . $blackhole['distance'] . " km (10<sup>6</sup>)</td></tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr><td nowrap width=40%><strong>Fatalities </strong></td><td nowrap width=1%><b>:</b> </td><td nowrap>" . blackhole_get_fatalities($blackhole_id) . " ship(s)</td></tr>"; echo " </table>"; echo " </td>"; echo " </tr>"; echo " </table>"; echo " </td>"; echo " </tr>"; echo "</table>"; echo "<br><br>"; }
function page_admin_images($act = "", $id = "") { requires_admin(); use_layout("admin"); form_start("", "post", " enctype='multipart/form-data' "); form_file("Файл", "file"); $caption = "Загрузить картинку"; if ($act == "edit") { $caption = "Изменить картинку"; } form_submit($caption, "submit"); form_end(); $upload = form(); if (form_file_uploaded("file")) { $fname = $_FILES["file"]['name']; $ext = strtolower(fileext($fname)); if (!($ext == "swf" || $ext == "jpg" || $ext == "gif" || $ext == "png" || $ext == "bmp" || $ext == "jpeg" || $ext == "pdf")) { $o = "Данный тип файла не является картинкой"; return $o; } else { if ($act == "add") { db_query("INSERT INTO images (link) VALUES ('')"); $id = db_last_id(); } else { @unlink(db_result(db_query("SELECT link FROM images WHERE id=%d", $id))); } $fname = $id . "." . fileext($fname); form_file_uploaded_move("file", "img/" . $fname); db_query("UPDATE images SET link='img/{$fname}' WHERE id=%d", $id); redir("admin/images/edit/{$id}"); } } if ($act == "add") { $o = $upload; return $o; } if ($act == "del") { $im = db_object_get("images", $id); @unlink("{$im->link}"); } $o = table_edit("images", "admin/images", $act, $id, "", "", "", "image_func"); if ($act == 'edit') { $im = db_object_get("images", $id); $o .= "<img width=100px src={$im->link}><br>{$upload}"; } return $o; }
function edit_description($anomaly_id) { assert(is_numeric($anomaly_id)); $anomaly = anomaly_get_anomaly($anomaly_id); print_subtitle("Edit description for " . $anomaly['name']); echo " <center>\n"; form_start(); echo " <input type=hidden name=aid value=" . encrypt_get_vars($anomaly_id) . ">\n"; echo " <input type=hidden name=cmd value=" . encrypt_get_vars("description2") . ">\n"; echo " <textarea name=ne_description maxlength=255 rows=10 cols=80>"; echo px2html4edit($anomaly['description']); echo "</textarea>\n"; echo " <input name=submit type=submit value=\"Change Description\">\n"; form_end(); echo " </center>\n"; create_submenu(array("Back to planet view" => "anomaly.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($anomaly_id))); }
function package() { $menu_items = array( "remove" => "Remove", "duplicate" => "Duplicate" ); $filter_array = array(); /* search field: filter (searches package name) */ if (isset_get_var("search_filter")) { $filter_array["name"] = get_get_var("search_filter"); } /* get a list of all packages on this page */ $packages = api_package_list($filter_array); form_start("packages.php"); $box_id = "1"; html_start_box("<strong>" . _("Template Packages") . "</strong>", "packages.php?action=new"); html_header_checkbox(array(_("Name"), _("Author"), _("Category")), $box_id); $i = 0; if (sizeof($packages) > 0) { foreach ($packages as $package) { ?> <tr class="item" id="box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>" onClick="display_row_select('<?php echo $box_id;?>',document.forms[0],'box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>', 'box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>')" onMouseOver="display_row_hover('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')" onMouseOut="display_row_clear('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')"> <td class="title"> <a onClick="display_row_block('box-<?php echo $box_id;?>-row-<?php echo $package["id"];?>')" href="packages.php?action=view&id=<?php echo $package["id"];?>"><span id="box-<?php echo $box_id;?>-text-<?php echo $package["id"];?>"><?php echo html_highlight_words(get_get_var("search_filter"), $package["name"]);?></span></a> </td> <td> Ian Berry </td> <td> <?php echo $package["category"];?> </td> <td class="checkbox" align="center"> <input type='checkbox' name='box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>' id='box-<?php echo $box_id;?>-chk-<?php echo $package["id"];?>' title="<?php echo $package["name"];?>"> </td> </tr> <?php } }else{ ?> <tr class="empty"> <td colspan="6"> No template packages found. </td> </tr> <?php } html_box_toolbar_draw($box_id, "0", "3", HTML_BOX_SEARCH_NONE); html_end_box(false); //html_box_actions_menu_draw($box_id, "0", $menu_items); html_box_actions_area_create($box_id); form_hidden_box("action_post", "package_list"); form_end(); echo "<br />\n"; form_start("packages.php", "import_package", true); html_start_box("<strong>" . _("Import Package") . "</strong>"); _package_import_field__file("import_package_file"); _package_import_field__text("import_package_text"); ?> <tr> <td style="border-top: 1px solid #b5b5b5; padding: 1px;" colspan="2"> <table width="100%" cellpadding="2" cellspacing="0"> <tr> <td align="right"> <input type="image" src="<?php echo html_get_theme_images_path('button_import.gif');?>" alt="<?php echo _('Import');?>" name="package_import" align="absmiddle"> </td> </tr> </table> </td> </tr> <?php html_end_box(); form_hidden_box("action", "save"); form_hidden_box("action_post", "package_import"); form_end(); //print_a(htmlspecialchars(package_export("1"))); ?> <script language="JavaScript"> <!-- function action_area_handle_type(box_id, type, parent_div, parent_form) { if (type == 'remove') { parent_div.appendChild(document.createTextNode('Are you sure you want to remove these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); action_area_update_header_caption(box_id, 'Remove Data Template'); action_area_update_submit_caption(box_id, 'Remove'); action_area_update_selected_rows(box_id, parent_form); }else if (type == 'duplicate') { parent_div.appendChild(document.createTextNode('Are you sure you want to duplicate these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); parent_div.appendChild(action_area_generate_input('text', 'box-' + box_id + '-action-area-txt1', '')); action_area_update_header_caption(box_id, 'Duplicate Data Templates'); action_area_update_submit_caption(box_id, 'Duplicate'); action_area_update_selected_rows(box_id, parent_form); } } --> </script> <?php }
function showModulesDropDown($module = "") { $table = getModules(); div_open(); form_start_post(); form_select("module"); if ($table) { while ($row = nextResultInTable($table)) { if ($module == $row['module']) { form_option($row['module'], $row['module'], "true"); } else { form_option($row['module'], $row['module']); } } } else { // no modules with settings available form_option("-", ""); } form_select_end(); // this module form_hidden("m_c", "showSettingsGUI"); // button form_submit("submit", getString("settings_show_settings", "Vis innstillinger")); form_end(); div_close(); }
private function deleteForm() { global $CORE; echo '<h2>' . l('Delete Shape') . '</h2>'; if (is_action() && post('mode') == 'delete') { try { $name = post('name'); if (!$name) { throw new FieldInputError('name', l('Please choose a shape')); } $shapes = $CORE->getAvailableShapes(); if (!isset($shapes[$name])) { throw new FieldInputError('name', l('The shape does not exist.')); } // Check whether or not the shape is in use $using = array(); foreach ($CORE->getAvailableMaps() as $map) { $MAPCFG = new GlobalMapCfg($map); try { $MAPCFG->readMapConfig(); } catch (Exception $e) { continue; // don't fail on broken map configs } foreach ($MAPCFG->getDefinitions('shape') as $key => $obj) { if (isset($obj['icon']) && $obj['icon'] == $name) { $using[] = $MAPCFG->getName(); } } } if ($using) { throw new FieldInputError('name', l('Unable to delete this shape, because it is ' . 'currently used by these maps: [M].', array('M' => implode(',', $using)))); } $path = path('sys', '', 'shapes', $name); if ($path !== '') { unlink($path); } success(l('The shape has been deleted.')); //reload(null, 1); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; js_form_start('delete_shape'); hidden('mode', 'delete'); echo '<table class="mytable">'; echo '<tr><td class="tdlabel">' . l('Shape') . '</td>'; echo '<td class="tdfield">'; $shapes = array('' => l('Choose a shape')); foreach ($CORE->getAvailableShapes() as $name) { $shapes[$name] = $name; } select('name', $shapes); echo '</td></tr>'; echo '</table>'; submit(l('Delete')); form_end(); }
function template() { $menu_items = array("remove" => "Remove", "duplicate" => "Duplicate"); $filter_array = array(); /* search field: filter (searches template name) */ if (isset_get_var("search_filter")) { $filter_array["template_name"] = get_get_var("search_filter"); } /* get a list of all data templates on this page */ $data_templates = api_data_template_list($filter_array); /* get a list of data input types for display in the data sources list */ $data_input_types = api_data_source_input_type_list(); form_start("data_templates.php"); $box_id = "1"; html_start_box("<strong>" . _("Data Templates") . "</strong>", "data_templates.php?action=edit"); html_header_checkbox(array(_("Template Name"), _("Data Input Type"), _("Status")), $box_id); $i = 0; if (sizeof($data_templates) > 0) { foreach ($data_templates as $data_template) { ?> <tr class="item" id="box-<?php echo $box_id; ?> -row-<?php echo $data_template["id"]; ?> " onClick="display_row_select('<?php echo $box_id; ?> ',document.forms[0],'box-<?php echo $box_id; ?> -row-<?php echo $data_template["id"]; ?> ', 'box-<?php echo $box_id; ?> -chk-<?php echo $data_template["id"]; ?> ')" onMouseOver="display_row_hover('box-<?php echo $box_id; ?> -row-<?php echo $data_template["id"]; ?> ')" onMouseOut="display_row_clear('box-<?php echo $box_id; ?> -row-<?php echo $data_template["id"]; ?> ')"> <td class="title"> <a onClick="display_row_block('box-<?php echo $box_id; ?> -row-<?php echo $data_template["id"]; ?> ')" href="data_templates.php?action=edit&id=<?php echo $data_template["id"]; ?> "><span id="box-<?php echo $box_id; ?> -text-<?php echo $data_template["id"]; ?> "><?php echo html_highlight_words(get_get_var("search_filter"), $data_template["template_name"]); ?> </span></a> </td> <td> <?php echo $data_input_types[$data_template["data_input_type"]]; ?> </td> <td> <?php if ($data_template["active"] == "1") { echo _("Active"); } else { echo _("Disabled"); } ?> </td> <td class="checkbox" align="center"> <input type='checkbox' name='box-<?php echo $box_id; ?> -chk-<?php echo $data_template["id"]; ?> ' id='box-<?php echo $box_id; ?> -chk-<?php echo $data_template["id"]; ?> ' title="<?php echo $data_template["template_name"]; ?> "> </td> </tr> <?php } } else { ?> <tr class="empty"> <td colspan="6"> No data templates found. </td> </tr> <?php } html_box_toolbar_draw($box_id, "0", "3", HTML_BOX_SEARCH_NO_ICON); html_end_box(false); html_box_actions_menu_draw($box_id, "0", $menu_items); html_box_actions_area_create($box_id); form_hidden_box("action_post", "data_template_list"); form_end(); ?> <script language="JavaScript"> <!-- function action_area_handle_type(box_id, type, parent_div, parent_form) { if (type == 'remove') { parent_div.appendChild(document.createTextNode('Are you sure you want to remove these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); action_area_update_header_caption(box_id, 'Remove Data Template'); action_area_update_submit_caption(box_id, 'Remove'); action_area_update_selected_rows(box_id, parent_form); }else if (type == 'duplicate') { parent_div.appendChild(document.createTextNode('Are you sure you want to duplicate these data templates?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); parent_div.appendChild(action_area_generate_input('text', 'box-' + box_id + '-action-area-txt1', '')); action_area_update_header_caption(box_id, 'Duplicate Data Templates'); action_area_update_submit_caption(box_id, 'Duplicate'); action_area_update_selected_rows(box_id, parent_form); } } --> </script> <?php }
function webseer_urls($header_label) { global $assoc_actions, $item_rows; /* ================= input validation and session storage ================= */ $filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'associated' => array('filter' => FILTER_CALLBACK, 'default' => 'true', 'options' => array('options' => 'sanitize_search_string'))); validate_store_request_vars($filters, 'sess_maint_ws'); /* ================= input validation ================= */ /* if the number of rows is -1, set it to the default */ if (get_request_var('rows') == '-1') { $rows = read_config_option('num_rows_table'); } else { $rows = get_request_var('rows'); } ?> <script type='text/javascript'> function applyFilter() { strURL = 'maint.php?tab=webseer&action=edit&id=<?php print get_request_var('id'); ?> '; strURL += '&rows=' + $('#rows').val(); strURL += '&associated=' + $('#associated').is(':checked'); strURL += '&filter=' + $('#filter').val(); strURL += '&header=false'; loadPageNoHeader(strURL); } function clearFilter() { strURL = 'maint.php?tab=webseer&action=edit&id=<?php print get_request_var('id'); ?> &clear=true&header=false'; loadPageNoHeader(strURL); } </script> <?php html_start_box(__('Associated Web URL\'s ') . htmlspecialchars($header_label), '100%', '', '3', 'center', ''); ?> <tr class='even'> <td> <form name='form_devices' method='post' action='maint.php?action=edit&tab=webseer'> <table class='filterTable'> <tr> <td> <?php print __('Search'); ?> </td> <td> <input type='text' id='filter' size='25' value='<?php print htmlspecialchars(get_request_var('filter')); ?> ' onChange='applyFilter()'> </td> <td> <?php print __('Rules'); ?> </td> <td> <select id='rows' onChange='applyFilter()'> <option value='-1'<?php if (get_request_var('rows') == '-1') { ?> selected<?php } ?> ><?php print __('Default'); ?> </option> <?php if (sizeof($item_rows) > 0) { foreach ($item_rows as $key => $value) { print "<option value='" . $key . "'"; if (get_request_var('rows') == $key) { print ' selected'; } print '>' . htmlspecialchars($value) . "</option>\n"; } } ?> </select> </td> <td> <input type='checkbox' id='associated' onChange='applyFilter()' <?php print get_request_var('associated') == 'true' || get_request_var('associated') == 'on' ? 'checked' : ''; ?> > </td> <td> <label for='associated'><?php print __('Associated'); ?> </label> </td> <td> <input type='button' value='<?php print __('Go'); ?> ' onClick='applyFilter()' title='<?php print __('Set/Refresh Filters'); ?> '> </td> <td> <input type='button' name='clear' value='<?php print __('Clear'); ?> ' onClick='clearFilter()' title='<?php print __('Clear Filters'); ?> '> </td> </tr> </table> <input type='hidden' name='page' value='<?php print get_request_var('page'); ?> '> <input type='hidden' name='id' value='<?php print get_request_var('id'); ?> '> </form> </td> </tr> <?php html_end_box(); /* form the 'where' clause for our main sql query */ if (strlen(get_request_var('filter'))) { $sql_where = "WHERE ((u.url LIKE '%" . get_request_var('filter') . "%') \n\t\t\tOR (u.display_name LIKE '%" . get_request_var('filter') . "%') \n\t\t\tOR (u.ip LIKE '%" . get_request_var('filter') . "%'))"; } else { $sql_where = ''; } if (get_request_var('associated') == 'false') { $sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' (pmh.type=2 OR pmh.type IS NULL)'; } else { $sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' pmh.type=2 AND pmh.schedule=' . get_request_var('id'); } $total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(*)\n\t\tFROM plugin_webseer_urls AS u\n\t\tLEFT JOIN plugin_maint_hosts AS pmh\n\t\tON u.id=pmh.host\n\t\t{$sql_where}"); $sql_query = "SELECT u.*, pmh.host AS associated, pmh.type AS maint_type\n\t\tFROM plugin_webseer_urls AS u\n\t\tLEFT JOIN plugin_maint_hosts AS pmh\n\t\tON u.id=pmh.host\n\t\t{$sql_where} \n\t\tLIMIT " . $rows * (get_request_var('page') - 1) . ',' . $rows; $urls = db_fetch_assoc($sql_query); $nav = html_nav_bar('notify_lists.php?action=edit&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 13, __('Lists'), 'page', 'main'); form_start('maint.php', 'chk'); print $nav; html_start_box('', '100%', '', '3', 'center', ''); $display_text = array(__('Description'), __('ID'), __('Associated Schedules'), __('Enabled'), __('Hostname'), __('URL')); html_header_checkbox($display_text); if (sizeof($urls)) { foreach ($urls as $url) { form_alternate_row('line' . $url['id']); form_selectable_cell(strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($url['display_name'])) : htmlspecialchars($url['display_name']), $url['id'], 250); form_selectable_cell(round($url['id'], 2), $url['id']); if ($url['associated'] != '' && $url['maint_type'] == '2') { form_selectable_cell('<span class="deviceUp">' . __('Current Schedule') . '</span>', $url['id']); } else { if (sizeof($lists = db_fetch_assoc('SELECT name FROM plugin_maint_schedules INNER JOIN plugin_maint_hosts ON plugin_maint_schedules.id=plugin_maint_hosts.schedule WHERE type=2 AND host=' . $url['id']))) { $names = ''; foreach ($lists['name'] as $name) { $names .= (strlen($names) ? ', ' : '') . "<span class='deviceRecovering'>{$name}</span>"; } form_selectable_cell($names, $url['id']); } else { form_selectable_cell('<span class="deviceUnknown">' . __('No Schedules') . '</span>', $url['id']); } } form_selectable_cell($url['enabled'] == 'on' ? __('Enabled') : __('Disabled'), $url['id']); if (empty($url['ip'])) { $url['ip'] = __('USING DNS'); } form_selectable_cell(strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", '<i>' . htmlspecialchars($url['ip'])) . '</i>' : '<i>' . htmlspecialchars($url['ip']) . '</i>', $url['id']); form_selectable_cell(strlen(get_request_var('filter')) ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", htmlspecialchars($url['url'])) : htmlspecialchars($url['url']), $url['id']); form_checkbox_cell($url['display_name'], $url['id']); form_end_row(); } } else { print "<tr><td><em>" . __('No Associated WebSeer URL\'s Found') . "</em></td></tr>"; } html_end_box(false); if (sizeof($urls)) { print $nav; } form_hidden_box('id', get_request_var('id'), ''); form_hidden_box('save_webseer', '1', ''); /* draw the dropdown containing a list of available actions for this form */ draw_actions_dropdown($assoc_actions); form_end(); }
function mod_pick_style() { $styles = array("Standardstil" => "css/aviscms.css", "Thormod" => "http://www.stud.ntnu.no/~nordram/thorstyle.css", "Heimegut" => "http://www.festsiden.org/_tore/heimegut.css", "Blogspot" => "http://www.festsiden.org/_tore/blogspot.css", "Galápagos" => "css/galapagos.css"); global $stylestatus, $layout, $css_file, $languageChoice; echo '<div class="options"><div class="optionsheader">Stilvelger</div>'; form_start_get(); echo '<select name="chosenstyle">'; foreach ($styles as $stylename => $stylefile) { if ($stylefile == $css_file) { echo '<option value="' . $stylefile . '" selected="selected">' . $stylename . '</option>'; } else { echo '<option value="' . $stylefile . '">' . $stylename . '</option>'; } } echo "</select>"; form_hidden("module_right_2", "mod_pick_style"); form_hidden("styleselect", "styleselect"); echo "<br/>"; echo "<br/>"; echo '<div class="optionsheader">Velg layout</div>'; ?> <select name="chosenlayout"> <?php echo '<option value="1">En kolonne</option>'; echo '<option value="2">To kolonner</option>'; echo '<option value="3">Tre kolonner</option>'; echo '<option value="4">Fire kolonne</option>'; ?> </select> <?php form_hidden("redirect", "true"); form_hidden("module_right_2", "mod_pick_style"); form_hidden("layoutselect", "layoutselect"); echo "<br/>"; echo "<br/>"; echo '<div class="optionsheader">Velg språk</div>'; $arrayWithAllLanguageIds = getAllLanguageIds(); $arrayWithAllLanguageNames = getAllLanguageNames(); // Add a choice for viewing articles in all languages array_unshift($arrayWithAllLanguageIds, "-1"); array_unshift($arrayWithAllLanguageNames, "Alle språk"); debug("fra cookie..:" . $languageChoice . "!"); debug("fra cookie..:" . $_REQUEST['languageChoice'] . "!"); form_dropdown("languageChoice", $arrayWithAllLanguageIds, $arrayWithAllLanguageNames, $languageChoice + 1); echo "<br/>"; echo "<br/>"; form_submit("submitlayout", "Endre"); form_end(); echo "</div>"; }
negative($errors); } } else { neutral(array('<strong>Zmiana tych parametrów może sparaliżować całą witrynę!</strong>', 'Poniższe ustawienia są zapisane w pliku config.php', $lang_system['REQUIRED'])); } // Form echo '<form action="' . local_url . 'admin/system/server" method="post"><table class="form"> <tr class="top title"><th> </th><td class="title">Baza danych</td></tr> <tr><th><label for="f_db_host"><span class="required">*</span> Serwer</label></th><td><input type="text" name="db_host" value="' . $form['db_host'] . '" class="big' . ($errors[1] ? ' error' : '') . '" id="f_db_host" /></td></tr> <tr><th><label for="f_db_name"><span class="required">*</span> Nazwa</label></th><td><input type="text" name="db_name" value="' . $form['db_name'] . '" class="big' . ($errors[2] ? ' error' : '') . '" id="f_db_name" /></td></tr> <tr><th><label for="f_db_user"><span class="required">*</span> Użytkownik</label></th><td><input type="text" name="db_user" value="' . $form['db_user'] . '" class="big' . ($errors[3] ? ' error' : '') . '" id="f_db_user" /></td></tr> <tr><th><label for="f_db_pass"><span class="required">*</span> Hasło</label></th><td><input type="text" name="db_pass" value="' . $form['db_pass'] . '" class="big' . ($errors[4] ? ' error' : '') . '" id="f_db_pass" /></td></tr> <tr><th><label for="f_db_prefix"><span class="required">*</span> Prefix tabel</label></th><td><input type="text" name="db_prefix" value="' . $form['db_prefix'] . '" class="big' . ($errors[5] ? ' error' : '') . '" id="f_db_prefix" /></td></tr> <tr><th><label for="f_db_type"><span class="required">*</span> Typ</label></th><td><select name="db_type" id="f_db_type"><option value="mysql">MySQL</option></select></td></tr> <tr class="title"><th> </th><td class="title">Pozostałe</td></tr> <tr><th><label for="f_site_url"><span class="required">*</span> Adres strony</label></th><td><input type="text" name="site_url" value="' . $form['site_url'] . '" class="big" id="f_site_url" /></td></tr> <tr><th><label for="f_local_dir"><span class="required">*</span> Folder główny</label></th><td><input type="text" name="local_dir" value="' . $form['local_dir'] . '" class="big" id="f_local_dir" /></td></tr> <tr><th><label for="f_cookie_name"><span class="required">*</span> Nazwa ciasteczek</label></th><td><input type="text" name="cookie_name" value="' . $form['cookie_name'] . '" class="big" id="f_cookie_name" /></td></tr> <tr><th rowspan="2"><label for="f_errors"><span class="required">*</span> Raportowanie błędów</label></th><td><select onchange="document.getElementById(\'f_errors\').value = this.options[this.selectedIndex].value;">'; $reporting_types = array('0' => 'Wyłaczone (Zalecane)', '1' => 'E_ERROR', '2' => 'E_WARNING', '4' => 'E_PARSE', '7' => 'E_ERROR + E_WARNING + E_PARSE', '8' => 'E_NOTICE', '2048' => 'E_STRICT', '6143' => 'E_ALL'); foreach ($reporting_types as $reporting_value => $reporting_constant) { echo '<option value="' . $reporting_value . '"' . ($form['errors'] == $reporting_value ? ' selected="selected"' : '') . '>' . $reporting_constant . '</option>'; } echo '<option value="' . $form['errors'] . '"' . (!in_array($form['errors'], array_keys($reporting_types)) ? ' selected="selected"' : '') . '>Inne - wpisz niżej</option></select></td></tr> <tr><td><input type="text" name="errors" id="f_errors" value="' . $form['errors'] . '" class="auto" size="4" /><div class="description">Aby dowiedzieć się więcej przeczytaj <a href="http://www.php.net/error_reporting" target="_blank">opis funkcji "error_reporting"</a></div></td></tr> <tr><th rowspan="2"><label>Opcje</label></th><td><label><input type="checkbox" name="logs"' . ($form['logs'] ? ' checked="checked"' : '') . ' /> Zapisuj logi</label></td></tr> <tr><td><label><input type="checkbox" name="lock_config"' . (!is_writable(root_dir . 'config.php') ? ' disabled="disabled"' : '') . ($form['lock_config'] ? ' checked="checked"' : '') . ' /> Zablokuj możliwość edycji tych ustawień</label></td></tr>'; form_end(false);
function graph() { $current_page = get_get_var_number("page", "1"); $menu_items = array("remove" => "Remove", "duplicate" => "Duplicate", "change_graph_template" => "Change Graph Template", "change_host" => "Change Host", "convert_graph_template" => "Convert to Graph Template", "place_tree" => "Place on Tree"); $filter_array = array(); /* search field: device template */ if (isset_get_var("search_device")) { $filter_array["host_id"] = get_get_var("search_device"); } /* search field: filter (searches data source name) */ if (isset_get_var("search_filter")) { $filter_array["filter"] = array("title_cache|title" => get_get_var("search_filter")); } /* get a list of all graphs on this page */ $graphs = api_graph_list($filter_array, $current_page, read_config_option("num_rows_data_source")); /* get the total number of graphs on all pages */ $total_rows = api_graph_total_get($filter_array); /* generate page list */ $url_string = build_get_url_string(array("search_device", "search_filter")); $url_page_select = get_page_list($current_page, MAX_DISPLAY_PAGES, read_config_option("num_rows_graph"), $total_rows, "graphs.php" . $url_string . ($url_string == "" ? "?" : "&") . "page=|PAGE_NUM|"); form_start("graphs.php"); $box_id = "1"; html_start_box("<strong>" . _("Graphs") . "</strong>", "graphs.php?action=edit", $url_page_select); html_header_checkbox(array(_("Graph Title"), _("Template Name"), _("Size")), $box_id); $i = 0; if (sizeof($graphs) > 0) { foreach ($graphs as $graph) { ?> <tr class="item" id="box-<?php echo $box_id; ?> -row-<?php echo $graph["id"]; ?> " onClick="display_row_select('<?php echo $box_id; ?> ',document.forms[0],'box-<?php echo $box_id; ?> -row-<?php echo $graph["id"]; ?> ', 'box-<?php echo $box_id; ?> -chk-<?php echo $graph["id"]; ?> ')" onMouseOver="display_row_hover('box-<?php echo $box_id; ?> -row-<?php echo $graph["id"]; ?> ')" onMouseOut="display_row_clear('box-<?php echo $box_id; ?> -row-<?php echo $graph["id"]; ?> ')"> <td class="title"> <a onClick="display_row_block('box-<?php echo $box_id; ?> -row-<?php echo $graph["id"]; ?> ')" href="graphs.php?action=edit&id=<?php echo $graph["id"]; ?> "><span id="box-<?php echo $box_id; ?> -text-<?php echo $graph["id"]; ?> "><?php echo html_highlight_words(get_get_var("search_filter"), $graph["title_cache"]); ?> </span></a> </td> <td> <?php echo empty($graph["template_name"]) ? "<em>" . _("None") . "</em>" : $graph["template_name"]; ?> </td> <td> <?php echo $graph["height"]; ?> x<?php echo $graph["width"]; ?> </td> <td class="checkbox" align="center"> <input type='checkbox' name='box-<?php echo $box_id; ?> -chk-<?php echo $graph["id"]; ?> ' id='box-<?php echo $box_id; ?> -chk-<?php echo $graph["id"]; ?> ' title="<?php echo $graph["title_cache"]; ?> "> </td> </tr> <?php } } else { ?> <tr class="empty"> <td colspan="6"> No graphs found. </td> </tr> <?php } html_box_toolbar_draw($box_id, "0", "3", sizeof($filter_array) == 0 ? HTML_BOX_SEARCH_INACTIVE : HTML_BOX_SEARCH_ACTIVE, $url_page_select); html_end_box(false); html_box_actions_menu_draw($box_id, "0", $menu_items); html_box_actions_area_create($box_id); form_hidden_box("action_post", "graph_list"); form_end(); /* pre-cache the device list since we need it in more than one place below */ $device_list = array_rekey(api_device_list(), "id", "description"); /* fill in the list of available devices for the search dropdown */ $search_devices = array(); $search_devices["-1"] = "Any"; $search_devices["0"] = "None"; $search_devices += $device_list; /* fill in the list of available devices for the change host dropdown */ $change_host_list = array(); $change_host_list["0"] = "None"; $change_host_list += $device_list; ?> <script language="JavaScript"> <!-- function action_area_handle_type(box_id, type, parent_div, parent_form) { if (type == 'remove') { parent_div.appendChild(document.createTextNode('Are you sure you want to remove these graphs?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); action_area_update_header_caption(box_id, 'Remove Graph'); action_area_update_submit_caption(box_id, 'Remove'); action_area_update_selected_rows(box_id, parent_form); }else if (type == 'duplicate') { parent_div.appendChild(document.createTextNode('Are you sure you want to duplicate these graphs?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); parent_div.appendChild(action_area_generate_input('text', 'box-' + box_id + '-action-area-txt1', '')); action_area_update_header_caption(box_id, 'Duplicate Graph'); action_area_update_submit_caption(box_id, 'Duplicate'); action_area_update_selected_rows(box_id, parent_form); }else if (type == 'search') { _elm_dt_input = action_area_generate_select('box-' + box_id + '-search_device'); <?php echo get_js_dropdown_code('_elm_dt_input', $search_devices, isset_get_var("search_device") ? get_get_var("search_device") : "-1"); ?> _elm_ht_input = action_area_generate_input('text', 'box-' + box_id + '-search_filter', '<?php echo get_get_var("search_filter"); ?> '); _elm_ht_input.size = '30'; parent_div.appendChild(action_area_generate_search_field(_elm_dt_input, 'Device', true, false)); parent_div.appendChild(action_area_generate_search_field(_elm_ht_input, 'Filter', false, true)); action_area_update_header_caption(box_id, 'Search'); action_area_update_submit_caption(box_id, 'Search'); }else if (type == 'change_host') { parent_div.appendChild(document.createTextNode('Are you sure you want to change the host for these graphs?')); parent_div.appendChild(action_area_generate_selected_rows(box_id)); _elm_dt_input = action_area_generate_select('box-' + box_id + '-change_device'); <?php echo get_js_dropdown_code('_elm_dt_input', $change_host_list, "0"); ?> parent_div.appendChild(action_area_generate_search_field(_elm_dt_input, 'New Device', true, true)); action_area_update_header_caption(box_id, 'Change Host'); action_area_update_submit_caption(box_id, 'Change'); action_area_update_selected_rows(box_id, parent_form); } } --> </script> <?php }
function thold_add_select_host() { global $config; $host_id = get_filter_request_var('host_id'); $local_graph_id = get_filter_request_var('local_graph_id'); $data_template_rrd_id = get_filter_request_var('data_template_rrd_id'); $hosts = get_allowed_devices(); top_header(); form_start('thold.php?action=save', 'tholdform'); html_start_box(__('Threshold Creation Wizard'), '50%', '', '3', 'center', ''); if ($host_id == '') { print '<tr><td class="center">' . __('Please select a Device') . '</td></tr>'; } else { if ($local_graph_id == '') { print '<tr><td class="center">' . __('Please select a Graph') . '</td></tr>'; } else { if ($data_template_rrd_id == '') { print '<tr><td class="center">' . __('Please select a Data Source') . '</td></tr>'; } else { print '<tr><td class="center">' . __('Please press \'Create\' to activate your Threshold') . '</td></tr>'; } } } html_end_box(); html_start_box('', '50%', '', '3', 'center', ''); /* display the host dropdown */ ?> <tr><td><table class='filterTable' align='center'> <tr> <?php print html_host_filter(get_request_var('host_id')); ?> </tr><?php if ($host_id != '') { $graphs = get_allowed_graphs('gl.host_id=' . $host_id); ?> <tr> <td> <?php print __('Graph'); ?> </td> <td> <select id='local_graph_id' name='local_graph_id' onChange='applyFilter("graph")'> <option value=''></option><?php foreach ($graphs as $row) { echo "<option value='" . $row['local_graph_id'] . "'" . ($row['local_graph_id'] == $local_graph_id ? ' selected' : '') . '>' . htmlspecialchars($row['title_cache'], ENT_QUOTES) . '</option>'; } ?> </select> </td> </tr><?php } else { ?> <tr> <td> <input type='hidden' id='local_graph_id' name='local_graph_id' value=''> </td> </tr><?php } if ($local_graph_id != '') { $dt_sql = 'SELECT DISTINCT dtr.local_data_id FROM data_template_rrd AS dtr LEFT JOIN graph_templates_item AS gti ON gti.task_item_id=dtr.id LEFT JOIN graph_local AS gl ON gl.id=gti.local_graph_id WHERE gl.id = ' . $local_graph_id; $local_data_id = db_fetch_cell($dt_sql); $dss = db_fetch_assoc('SELECT DISTINCT id, data_source_name FROM data_template_rrd WHERE local_data_id IN (' . $dt_sql . ') ORDER BY data_source_name'); /* show the data source options */ ?> <tr> <td> <?php print __('Data Source'); ?> </td> <td> <input type='hidden' id='local_data_id' name='local_data_id' value='<?php print $local_data_id; ?> '> <select id='data_template_rrd_id' name='data_template_rrd_id' onChange='applyFilter("ds")'> <option value=''></option><?php foreach ($dss as $row) { echo "<option value='" . $row['id'] . "'" . ($row['id'] == $data_template_rrd_id ? ' selected' : '') . '>' . htmlspecialchars($row['data_source_name'], ENT_QUOTES) . '</option>'; } ?> </select> </td> </tr></table></td></tr><?php } else { ?> <tr> <td> <input type='hidden' id='data_template_rrd_id' name='data_template_rrd_id' value=''> </td> </tr></table></td></tr><?php } if ($data_template_rrd_id != '') { echo "<tr><td class='center' colspan='2'><input type='hidden' name='save' id='save' value='save'><input id='go' type='button' value='" . __('Create') . "' title='" . __('Create Threshold') . "'></td></tr>"; } else { echo "<tr><td class='center' colspan='2'></td></tr>"; } html_end_box(); form_end(); html_start_box('', '50%', '', '3', 'center', ''); if ($local_graph_id != '') { print "<tr><td style='text-align:center'><img id='graphi' src='../../graph_image.php?local_graph_id={$local_graph_id}&rra_id=0'></td></tr>"; } html_end_box(); ?> <script type='text/javascript'> function applyFilter(target) { strURL = 'thold.php?action=add&header=false&host_id=' + $('#host_id').val(); if (target != 'host_id') { strURL += '&local_graph_id=' + $('#local_graph_id').val(); } if (target == 'ds') { strURL += '&data_template_rrd_id=' + $('#data_template_rrd_id').val(); } loadPageNoHeader(strURL); } $(function() { $('#go').button().click(function() { strURL = $('#tholdform').attr('action'); json = $('input, select').serializeObject(); $.post(strURL, json).done(function(data) { $('#main').html(data); applySkin(); window.scrollTo(0, 0); }); }); }); </script> <?php }
function syslog_removal() { global $syslog_actions, $message_types, $config; include dirname(__FILE__) . '/config.php'; /* ================= input validation and session storage ================= */ $filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'id' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'enabled' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'sort_column' => array('filter' => FILTER_CALLBACK, 'default' => 'name', 'options' => array('options' => 'sanitize_search_string')), 'sort_direction' => array('filter' => FILTER_CALLBACK, 'default' => 'ASC', 'options' => array('options' => 'sanitize_search_string'))); validate_store_request_vars($filters, 'sess_syslogr'); /* ================= input validation ================= */ html_start_box(__('Syslog Removal Rule Filters'), '100%', '', '3', 'center', 'syslog_removal.php?action=edit&type=1'); syslog_filter(); html_end_box(); $sql_where = ''; if (get_request_var('rows') == -1) { $row_limit = read_config_option('num_rows_table'); } elseif (get_request_var('rows') == -2) { $row_limit = 999999; } else { $row_limit = get_request_var('rows'); } $removals = syslog_get_removal_records($sql_where, $row_limit); $rows_query_string = "SELECT COUNT(*)\n\t\tFROM `" . $syslogdb_default . "`.`syslog_remove`\n\t\t{$sql_where}"; $total_rows = syslog_db_fetch_cell($rows_query_string); $nav = html_nav_bar('syslog_removal.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $row_limit, $total_rows, 13, 'Rules', 'page', 'main'); form_start('syslog_removal.php', 'chk'); print $nav; html_start_box('', '100%', '', '3', 'center', ''); $display_text = array('name' => array(__('Removal Name'), 'ASC'), 'enabled' => array(__('Enabled'), 'ASC'), 'type' => array(__('Match Type'), 'ASC'), 'message' => array(__('Search String'), 'ASC'), 'method' => array(__('Method'), 'DESC'), 'date' => array(__('Last Modified'), 'ASC'), 'user' => array(__('By User'), 'DESC')); html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction')); if (sizeof($removals)) { foreach ($removals as $removal) { form_alternate_row('line' . $removal['id'], true); form_selectable_cell(filter_value(title_trim($removal['name'], read_config_option('max_title_length')), get_request_var('filter'), $config['url_path'] . 'plugins/syslog/syslog_removal.php?action=edit&id=' . $removal['id']), $removal['id']); form_selectable_cell($removal['enabled'] == 'on' ? __('Yes') : __('No'), $removal['id']); form_selectable_cell($message_types[$removal['type']], $removal['id']); form_selectable_cell($removal['message'], $removal['id']); form_selectable_cell($removal['method'] == 'del' ? __('Deletion') : __('Transfer'), $removal['id']); form_selectable_cell(date('Y-m-d H:i:s', $removal['date']), $removal['id']); form_selectable_cell($removal['user'], $removal['id']); form_checkbox_cell($removal['name'], $removal['id']); form_end_row(); } } else { print "<tr><td colspan='4'><em>" . __('No Syslog Removal Rules Defined') . "</em></td></tr>"; } html_end_box(false); if (sizeof($removals)) { print $nav; } draw_actions_dropdown($syslog_actions); form_end(); }
function preset_show_all_presets($user_id) { assert(is_numeric($user_id)); echo "<table align=center widht=75%>\n"; echo " <tr class=wb>\n"; echo " <th>Preset name</th>\n"; echo " <th>Distance</th>\n"; echo " <th>Angle</th>\n"; echo " <th> </th>\n"; echo " </tr>\n"; // Get all presets $result = sql_query("SELECT * FROM g_presets WHERE user_id=" . $user_id); while ($preset = sql_fetchrow($result)) { echo " <tr class=bl>\n"; echo " <td> " . $preset['name'] . " </td>\n"; echo " <td> " . $preset['distance'] . " </td>\n"; echo " <td> " . $preset['angle'] . " </td>\n"; echo " <td> [ <a href=vesselpreset.php?cmd=" . encrypt_get_vars("delete") . "&uid=" . encrypt_get_vars($user_id) . "&pid=" . encrypt_get_vars($preset['id']) . ">Delete</a> ] </td>\n"; echo " </tr>\n"; } // And add room to create a new one... echo " <tr class=bl>\n"; form_start(); echo " <input type=hidden name=cmd value=" . encrypt_get_vars("create") . ">\n"; echo " <input type=hidden name=uid value=" . encrypt_get_vars($user_id) . ">\n"; echo " <td><input type=text name=ne_name size=20 maxlength=20></td>\n"; echo " <td><input type=text name=ne_distance size=6 maxlength=6></td>\n"; echo " <td><input type=text name=ne_angle size=7 maxlength=7></td>\n"; echo " <td><input type=submit name=name=submit value=Add></td>\n"; form_end(); echo " </tr>\n"; echo "</table>\n"; }
public function parse() { global $CORE, $_BACKEND, $AUTH; ob_start(); $map = req('map'); if (!$map || count($CORE->getAvailableMaps('/^' . $map . '$/')) == 0) { throw new NagVisException(l('Please provide a valid map name.')); } $object_id = req('object_id'); if (!$object_id || !preg_match(MATCH_OBJECTID, $object_id)) { throw new NagVisException(l('Please provide a valid object id.')); } $MAPCFG = new GlobalMapCfg($map); $MAPCFG->skipSourceErrors(); $MAPCFG->readMapConfig(); if (!$MAPCFG->objExists($object_id)) { throw new NagVisException(l('The object does not exist.')); } $backendIds = $MAPCFG->getValue($object_id, 'backend_id'); foreach ($backendIds as $backendId) { if (!$_BACKEND->checkBackendFeature($backendId, 'actionAcknowledge', false)) { return '<div class=err>' . l('The requested feature is not available for this backend. ' . 'The MKLivestatus backend supports this feature.') . '</div>'; } } if (is_action()) { try { $type = $MAPCFG->getValue($object_id, 'type'); if ($type == 'host') { $spec = $MAPCFG->getValue($object_id, 'host_name'); } else { $spec = $MAPCFG->getValue($object_id, 'host_name') . ';' . $MAPCFG->getValue($object_id, 'service_description'); } $comment = post('comment'); if (!$comment) { throw new FieldInputError('comment', l('You need to provide a comment.')); } $sticky = get_checkbox('sticky'); $notify = get_checkbox('notify'); $persist = get_checkbox('persist'); // Now send the acknowledgement foreach ($backendIds as $backendId) { $BACKEND = $_BACKEND->getBackend($backendId); $BACKEND->actionAcknowledge($type, $spec, $comment, $sticky, $notify, $persist, $AUTH->getUser()); } success(l('The problem has been acknowledged.')); js('window.setTimeout(function() {' . 'popupWindowClose(); refreshMapObject(null, \'' . $object_id . '\');}, 2000);'); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (NagVisException $e) { form_error(null, $e->message()); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; js_form_start('acknowledge'); echo '<label>' . l('Comment'); input('comment'); echo '</label>'; echo '<label>'; checkbox('sticky', cfg('global', 'dialog_ack_sticky')); echo l('Sticky') . '</label>'; echo '<label>'; checkbox('notify', cfg('global', 'dialog_ack_notify')); echo l('Notify contacts') . '</label>'; echo '<label>'; checkbox('persist', cfg('global', 'dialog_ack_persist')); echo l('Persist comment') . '</label>'; submit(l('Acknowledge')); form_end(); focus('comment'); return ob_get_clean(); }
function module_polladmin() { // adminpage, stop here if not logged in/right access-level if (!isValidAdmin()) { echo getString("not_valid_admin", "Administratorside, du må logge inn for å få tilgang her"); return; } echo '<a href="http://localhost/avisCMS/index.php?m_c=module_polladmin&page_title=Polladmin">Tilbake til oversikt</a>'; $pollaction = $_REQUEST['pollaction']; if ($pollaction == 'addpoll') { if (strlen($_REQUEST['polltitle']) < 1) { echo "Husk tittel."; return; } echo '<div class="default_header">Avstemning opprettet.</div>'; $query = "INSERT INTO poll SET title='" . $_REQUEST['polltitle'] . "';"; $result = DB_insert($query); if ($result) { echo '<a href="index.php?m_c=module_polladmin&pollaction=editpoll&pollid=' . mysql_insert_id() . '">Rediger den nye pollen</a>'; } else { echo "Feilmelding: " . mysql_error(); } } else { if ($pollaction == 'delpoll') { $confirm = $_REQUEST['dc']; $pollid = $_REQUEST['pollid']; if ($confirm == "yes") { $query = "DELETE FROM poll WHERE pollid = " . $pollid . ";"; $result = DB_update($query); $num_results += DB_rows_affected($query); $query = "DELETE FROM pollquestion WHERE pollid = " . $pollid . ";"; $result = DB_update($query); $num_results += DB_rows_affected($query); $query = "DELETE FROM vote WHERE pollid = " . $pollid . ";"; $result = DB_update($query); $num_results += DB_rows_affected($query); if ($num_results < 1) { echo "<br/>Ingenting slettet - feilmelding: " . mysql_error(); } else { echo "<br/>Avstemningen med tilhørende stemmer og det hele aldeles pulverisert."; } } else { echo "<br/><br/>Sikker på at du vil slette avstemning med id " . $pollid . "? Dette medfører også sletting av alle tilknyttede spørsmål og avlagte stemmer!!<br/>"; echo '<a href="index.php?m_c=module_polladmin&pollaction=delpoll&dc=yes&pollid=' . $pollid . '">Ja!</a>'; } } else { if ($pollaction == 'editpoll') { $pollaction2 = $_REQUEST['pollaction2']; $pollid = $_REQUEST['pollid']; $question = $_REQUEST['question']; $description = $_REQUEST['description']; if ($pollaction2 == "changetime") { $query = "UPDATE poll SET description = '" . $description . "', time_opened='" . $_REQUEST['time_opened'] . "', time_closed='" . $_REQUEST['time_closed'] . "' WHERE pollid=" . $pollid . ";"; DB_update($query); if (!result) { echo 'mysql_error()'; } } if ($pollaction2 == "delquestion") { $altid = $_REQUEST['altid']; $query = "DELETE FROM pollquestion WHERE questionid=" . $altid . " AND pollid=" . $pollid . ";"; $result = DB_update($query); //echo $query; if (!$result) { echo mysql_error(); } } if ($pollaction2 == 'addquestion') { $querymax = "SELECT MAX(questionid) as maxid FROM pollquestion;"; $row = DB_search($querymax); $newid = $row['maxid'] + 1; $query = "INSERT INTO pollquestion SET pollid=" . $pollid . ", questionid='" . $newid . "', question='" . $question . "';"; //echo $query; $result = DB_insert($query); if (!result) { echo mysql_error(); } } $pollid = $_REQUEST['pollid']; $query = "SELECT * FROM poll WHERE pollid=" . $pollid . ";"; $row = DB_search($query); $query_questions = "SELECT * FROM pollquestion WHERE pollid=" . $pollid . ";"; $result = DB_get_table($query_questions); $pollid = $row['pollid']; echo '<table class="default_table">'; echo '<tr><td colspan=2><div class="default_header">Rediger spørreundersøkelse</div></td></tr>'; echo "<tr><td>Tittel</td><td>" . $row['title'] . "</td></tr>"; form_start_post(); form_hidden("pollid", $pollid); form_hidden("m_c", "module_polladmin"); form_hidden("pollaction", "editpoll"); form_hidden("pollaction2", "changetime"); echo "<tr><td>Beskrivelse (300 tegn)</td><td>" . $row['description'] . "</td><td>"; form_textarea("description", $row['description'], 10, 10); echo "</td></tr>"; echo "<tr><td>Dato start</td><td>" . $row['time_opened'] . "</td><td>"; form_textfield("time_opened", $row['time_opened']); echo "</td></tr>"; echo "<tr><td>Date slutt</td><td>" . $row['time_closed'] . "</td><td>"; form_textfield("time_closed", $row['time_closed']); echo "</td></tr>"; echo "<tr><td colspan=2>Datoformat: 2005-01-31 23:10<br/>Utelat tidspunkt og det settes til 00:00.</td><td>"; form_submit("submit", "Lagre endringer"); form_end(); echo "</tr>"; while ($row = DB_next_row($result)) { echo '<tr>'; echo '<td>' . $row['questionid'] . '</td>'; echo '<td>' . $row['question'] . '</td>'; echo '<td>'; form_start_post(); form_submit("submit", "Slett"); form_hidden("m_c", "module_polladmin"); form_hidden("pollaction2", "delquestion"); form_hidden("altid", $row['questionid']); form_hidden("pollaction", "editpoll"); form_hidden("pollid", $pollid); form_end(); echo '</td>'; echo '</tr>'; } echo '</table><br/><br/>'; echo '<table class="default_table">'; echo '<tr><td colspan=2>Legg til et alternativ</td></tr>'; form_start_post(); echo '<tr><td>Alternativnavn</td><td>'; form_textfield("question", $_SESSION['question']); echo '</td></tr>'; echo '<tr><td colspan=2>'; form_submit("submit", "Legg til"); echo '</td></tr>'; form_hidden("pollaction", "editpoll"); form_hidden("pollaction2", "addquestion"); form_hidden("pollid", $pollid); form_hidden("m_c", "module_polladmin"); form_end(); echo '</table>'; } else { echo '<table class="default_table">'; echo '<tr><td colspan=4><div class="default_header">Polladmin</div></td></tr>'; echo "<tr><td colspan=4>Lag en ny</td></tr>"; form_start_post(); echo "<tr><td colspan=2>Tittel</td><td colspan=2>"; form_textfield("polltitle", $_SESSION['polltitle']); echo '</td></tr>'; echo '<tr><td colspan=4>'; form_submit("submit", "Opprett(rediger den for å fullføre)"); echo '</td></tr>'; form_hidden("pollaction", "addpoll"); form_hidden("m_c", "module_polladmin"); form_end(); echo '<tr><td colspan=2></td></tr>'; echo '<tr><td colspan=4><div class="default_header">Eksisterende polls</div></td></tr>'; $query = "SELECT * FROM poll"; $result = DB_get_table($query); echo '<tr><td>Tittel</td><td>Start</td><td>Slutt</td><td>Rediger</td></tr>'; while ($row = DB_next_row($result)) { echo '<tr><td>' . $row['title'] . '</td><td>' . $row['time_opened'] . '</td>'; echo '<td>' . $row['time_closed'] . '</td>'; echo '<td><a href="index.php?m_c=module_polladmin&pollaction=editpoll&pollid=' . $row['pollid'] . '">Rediger</a>'; echo '<br/><a href="index.php?m_c=module_polladmin&pollaction=delpoll&pollid=' . $row['pollid'] . '">Slett</a></td>'; echo '</tr>'; } echo '</table>'; } } } }
function page_admin_settings() { requires_admin(); use_layout("admin"); global $tables; $o = ""; if (form_post("save")) { $set = ""; foreach ($tables['settings']['fields'] as $field) { if ($set) { $set .= ","; } $set = "{$field}='" . form_post($field) . "'"; } db_query("UPDATE settings SET {$set}"); $o .= "<font color=green>changes saved</font>"; } $vals = db_fetch_object(db_query("SELECT * FROM settings LIMIT 1")); form_start(); foreach ($tables['settings']['fields'] as $field) { form_input($field, $field, $vals->{$field}); } form_submit("Save", "save"); form_end(); $o .= form(); return $o; }
private function drawForm() { js_form_start('addmodify'); $obj_spec = $this->getProperties(); $props_by_section = array(); foreach ($obj_spec as $propname => $prop) { $sec = $prop['section']; if (!isset($props_by_section[$sec])) { $props_by_section[$sec] = array(); } $props_by_section[$sec][$propname] = $prop; } $sections = array(); foreach (array_keys($props_by_section) as $sec) { if ($sec != 'hidden') { $sections[$sec] = $this->MAPCFG->getSectionTitle($sec); } } $open = get_open_section('general'); render_section_navigation($open, $sections); foreach ($props_by_section as $sec => $sec_props) { if ($sec != 'hidden') { render_section_start($sec, $open); echo '<table class="mytable">'; $this->drawFields($sec_props); echo '</table>'; render_section_end(); } } if ($this->mode == 'view_params') { echo '<table class=mytable>'; echo '<tr><td class=tdlabel style="width:70px">' . l('Make permanent') . '</td>'; echo '<td class=tdfield>'; checkbox('perm'); echo l('for all users') . '<br>'; checkbox('perm_user'); echo l('for you'); echo '</td></tr>'; echo '</table>'; } submit(l('Save')); form_end(); }
function show_devices() { global $action, $expire_arr, $rotation_arr, $version_arr, $nesting_arr; global $config, $flow_actions; /* ================= input validation and session storage ================= */ $filters = array('page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'sort_column' => array('filter' => FILTER_CALLBACK, 'default' => 'name', 'options' => array('options' => 'sanitize_search_string')), 'sort_direction' => array('filter' => FILTER_CALLBACK, 'default' => 'ASC', 'options' => array('options' => 'sanitize_search_string'))); validate_store_request_vars($filters, 'sess_fvd'); /* ================= input validation ================= */ $sql_where = get_request_var('filter') != '' ? "name LIKE '%" . get_request_var('filter') . "%'" : ''; $num_rows = read_config_option('num_rows_table'); $sql = "SELECT * \n\t\tFROM plugin_flowview_devices \n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var('sort_column') . ' ' . get_request_var('sort_direction') . ' LIMIT ' . ($num_rows * (get_request_var('page') - 1) . ',' . $num_rows); $result = db_fetch_assoc($sql); $total_rows = db_fetch_cell("SELECT COUNT(*) FROM plugin_flowview_devices {$sql_where}"); html_start_box('FlowView Listeners', '100%', '', '4', 'center', 'flowview_devices.php?action=edit'); ?> <tr class='even'> <td> <form name='listeners' action='flowview_devices.php'> <table class='fitlerTable'> <tr> <td> Search </td> <td> <input type='text' id='filter' size='40' value='<?php print htmlspecialchars(get_request_var('filter')); ?> '> </td> <td> <input id='refresh' type='button' value='Go' title='Set/Refresh Filters'> </td> <td> <input id='clear' type='button' name='clear' value='Clear' title='Clear Filters'> </td> </tr> </table> <input type='hidden' name='page' value='<?php print get_request_var('page'); ?> '> </form> </td> </tr> <?php html_end_box(); $nav = html_nav_bar('flowview_devices.php', MAX_DISPLAY_PAGES, get_request_var('page'), $num_rows, $total_rows, 10, 'Listeners', 'page', 'main'); form_start('flowview_devices.php', 'chk'); print $nav; html_start_box('', '100%', '', '4', 'center', ''); $display_array = array('name' => array('Name', 'ASC'), 'folder' => array('Directory', 'ASC'), 'nexting' => array('Nesting', 'ASC'), 'allowfrom' => array('Allowed From', 'ASC'), 'port' => array('Port', 'ASC'), 'version' => array('Version', 'ASC'), 'compression' => array('Compression', 'ASC'), 'rotation' => array('Rotation', 'ASC'), 'expire' => array('Expire', 'ASC')); html_header_sort_checkbox($display_array, get_request_var('sort_column'), get_request_var('sort_direction'), false); if (count($result)) { foreach ($result as $row) { form_alternate_row('line' . $row['id'], true); form_selectable_cell('<a class="linkEditMain" href="flowview_devices.php?&tab=listeners&action=edit&id=' . $row['id'] . '">' . $row['name'] . '</a>', $row['id']); form_selectable_cell($row['folder'], $row['id']); form_selectable_cell($nesting_arr[$row['nesting']], $row['id']); form_selectable_cell($row['allowfrom'], $row['id']); form_selectable_cell($row['port'], $row['id']); form_selectable_cell($version_arr[$row['version']], $row['id']); form_selectable_cell($row['compression'], $row['id']); form_selectable_cell($rotation_arr[$row['rotation']], $row['id']); form_selectable_cell($expire_arr[$row['expire']], $row['id']); form_checkbox_cell($row['name'], $row['id']); form_end_row(); } } else { print "<tr class='even'><td colspan=10><center>No Devices</center></td></tr>\n"; } html_end_box(false); if (count($result)) { print $nav; } draw_actions_dropdown($flow_actions); form_end(); }
function newai_export($fields, $mode = 'table') { global $common_html, $html_etc; global $return_sql_line, $db; global $columns; //print_R($_GET); global $showlistfieldlist, $group_filter; $tablename = $fields['table']['name']; $SQL = $fields['sql']['SQL']; $init = explode('_', $_GET['action']); $mark = $init[1]; global $tablewidth; $tablewidth = $tablewidth != "" ? $tablewidth : 450; if ($group_filter != "") { $group_filter_Array = explode(':', $group_filter); $TableFieldIndex = $group_filter_Array[0]; $KeyName = $columns[$TableFieldIndex]; $ChildTableName = $group_filter_Array[1]; $ChildTableFieldValueIndex = $group_filter_Array[2]; $ChildTableFieldNameIndex = $group_filter_Array[3]; $ChildColumns = returntablecolumn($ChildTableName); $ChildTableFieldValue = $ChildColumns[$ChildTableFieldValueIndex]; $ChildTableFieldName = $ChildColumns[$ChildTableFieldNameIndex]; $Childhtml_etc = returnsystemlang($ChildTableName, $SYTEM_CONFIG_TABLE); //print_R($Childhtml_etc); $ChildTableFieldHTMLValue = $Childhtml_etc[$ChildTableName][$ChildTableFieldValue]; $ChildTableFieldHTMLName = $Childhtml_etc[$ChildTableName][$ChildTableFieldName]; } else { $KeyName = "说明"; } print "<script>\n\t//CSV\n\tfunction selectid_str_init_CSV(mark)\n\t{\n\tselectid_str = \"\";\n\tfor(i=0;i<document.all(\"selectid\").length-1;i++)\n\t\t{\n\n\t\tel = document.all(\"selectid\").item(i);\n\t\tif(el.checked)\n\t\t{\tval = el.value;\n\t\t\tif(val !=\"\")\t{\n\t\t\t\tselectid_str += val + \",\";\n\t\t\t}\n\t\t}\n\t}\n\n\tell = document.all(\"selectid\").item(document.all(\"selectid\").length-1);\n\tif(ell.checked)\n\t{\tval = ell.value;\n\t\tif(val !=\"\")\t{\n\t\t\tselectid_str += val ;\n\t\t}\n\t}\n\n\ttablename_\t\t=\tdocument.form1.tablename.value;\n\tsearchfield_\t=\tdocument.form1.searchfield.value;\n\tsearchvalue_\t=\tdocument.form1.searchvalue.value;\n\tAdvanceSearch_\t=\tdocument.form1.AdvanceSearch.value;\n\texportfield= selectid_str;\n\n\n\t"; if ($_GET['actionadv'] == "exportadv_default") { //不用显示或得到SELECTID的值 print "\turl=\"?action=export_\"+mark+\"_data&method=CSV&actionadv=exportadv_default&exportfield=\"+exportfield+\"&tablename=\"+tablename_+\"&searchfield=\"+searchfield_+\"&searchvalue=\"+searchvalue_+AdvanceSearch_"; } else { print "\tvar " . $KeyName . "SelectValue = document.form1." . $KeyName . ".options[document.form1." . $KeyName . ".selectedIndex].value;\n\t\t"; print "\turl=\"?action=export_\"+mark+\"_data&method=CSV&exportfield=\"+exportfield+\"&tablename=\"+tablename_+\"&searchfield=\"+searchfield_+\"&searchvalue=\"+searchvalue_+\"&" . $KeyName . "=\"+" . $KeyName . "SelectValue+AdvanceSearch_"; } print "\n\t//alert(url);\n\tlocation=url;\n\t}\n\t//XLS\n\tfunction selectid_str_init_XLS(mark)\n\t{\n\tselectid_str = \"\";\n\tfor(i=0;i<document.all(\"selectid\").length-1;i++)\n\t\t{\n\n\t\tel = document.all(\"selectid\").item(i);\n\t\tif(el.checked)\n\t\t{\tval = el.value;\n\t\t\tif(val !=\"\")\t{\n\t\t\t\tselectid_str += val + \",\";\n\t\t\t}\n\t\t}\n\t}\n\n\tell = document.all(\"selectid\").item(document.all(\"selectid\").length-1);\n\tif(ell.checked)\n\t{\tval = ell.value;\n\t\tif(val !=\"\")\t{\n\t\t\tselectid_str += val ;\n\t\t}\n\t}\n\n\ttablename_\t\t=\tdocument.form1.tablename.value;\n\tsearchfield_\t=\tdocument.form1.searchfield.value;\n\tsearchvalue_\t=\tdocument.form1.searchvalue.value;\n\tAdvanceSearch_\t=\tdocument.form1.AdvanceSearch.value;\n\texportfield= selectid_str;\n\t"; if ($_GET['actionadv'] == "exportadv_default") { //不用显示或得到SELECTID的值 print "\turl=\"?action=export_\"+mark+\"_data&actionadv=exportadv_default&exportfield=\"+exportfield+\"&tablename=\"+tablename_+\"&searchfield=\"+searchfield_+\"&searchvalue=\"+searchvalue_+AdvanceSearch_"; } else { print "\tvar " . $KeyName . "SelectValue = document.form1." . $KeyName . ".options[document.form1." . $KeyName . ".selectedIndex].value;\n\t\t"; print "\turl=\"?action=export_\"+mark+\"_data&exportfield=\"+exportfield+\"&tablename=\"+tablename_+\"&searchfield=\"+searchfield_+\"&searchvalue=\"+searchvalue_+\"&" . $KeyName . "=\"+" . $KeyName . "SelectValue+AdvanceSearch_"; } print "\n\t//url\n\t//alert(url);\n\tlocation=url;\n\t}\n\t</script>"; form_begin("form1"); table_begin($tablewidth); switch ($mode) { case 'table': print_title($common_html['common_html']['tableexport'], 3); print "<TR class=TableData>\n"; print "<TD noWrap align=middle>选择</TD>\n"; print "<TD width=200>字段描述</TD>\n"; print "<TD width=200>字段名称</TD>\n"; print "</TR>\n"; for ($i = 0; $i < sizeof($columns); $i++) { $list = $columns[$i]; print "<TR class=TableData>\n"; print "<TD noWrap align=middle width=20><input type=\"checkbox\" checked name=\"selectfield\" value=\"{$list}\"></TD>\n"; print "<TD>" . $html_etc[$tablename][$list] . "</TD>\n"; print "<TD>{$list}</TD>\n"; print "</TR>\n"; $temp_function = 'selectfield_str'; } break; case 'content': print_title($common_html['common_html']['contentexport'], 3); print "<TR class=TableData>\n"; print "<TD noWrap align=center width=30>选择</TD>\n"; print "<TD width=100>字段描述</TD>\n"; print "<TD width=150>字段名称</TD>\n"; print "</TR>\n"; //附加组数据导出--开始 //print_R($group_filter_Array); if ($group_filter != "" && $_GET['actionadv'] != "exportadv_default") { //如果强制GET变量已经进行过预定义,那么沿用预定义内容进行 2010-9-2 $TableFieldIndex = $group_filter_Array[0]; $KeyName = $columns[$TableFieldIndex]; $PHP_SELF_ARRAY = explode('/', $_SERVER['PHP_SELF']); $FILE_SELF_NAME = array_pop($PHP_SELF_ARRAY); $FileDirName = array_pop($PHP_SELF_ARRAY); //用于PGSQL下面不进行数据较验 //print $_SESSION['LOGIN_USER_ID']; //如果强制GET变量已经进行过预定义,那么沿用预定义内容进行 2010-9-2 //&&$FileDirName=="Teacher" 只有在Teacher目录下面使用 2010-9-25 正常使用 if ($_GET[$KeyName] != "") { //$ChildTableName = $group_filter_Array[1]; //$ChildTableFieldValueIndex = $group_filter_Array[2]; //$ChildTableFieldNameIndex = $group_filter_Array[3]; //print $KeyName; $附加判断条件Array = explode(',', $_GET[$KeyName]); $附加判断条件 = "'" . join("','", $附加判断条件Array) . "'"; $sql = "\n\t\t\t\t\tselect {$ChildTableFieldValue},{$ChildTableFieldName}\n\t\t\t\t\tfrom {$ChildTableName}\n\t\t\t\t\twhere ( {$ChildTableFieldValue} in ({$附加判断条件})\n\t\t\t\t\t\t\tor\n\t\t\t\t\t\t\t{$ChildTableFieldName} in ({$附加判断条件})\n\t\t\t\t\t\t\t)\n\t\t\t\t\torder by {$ChildTableFieldName}"; // } else { $sql = "select {$ChildTableFieldValue},{$ChildTableFieldName} from {$ChildTableName} order by {$ChildTableFieldName}"; } //print $sql; //print $index_name;print_R($_GET); $rs = $db->CacheExecute(150, $sql); $rs_a = $rs->GetArray(); if ($Childhtml_etc[$ChildTableName][$ChildTableFieldName] != "") { $ShowText = "按" . $html_etc[$tablename][$KeyName] . "过滤"; //$ShowText = "按".$Childhtml_etc[$ChildTableName][$ChildTableFieldName]."过滤"; } else { $ShowText = "按" . $html_etc[$tablename][$KeyName] . "过滤"; } print "<TR class=TableData>\n"; print "<TD noWrap align=middle><input type=\"checkbox\" checked name=\"selectidtemp\" disabled value=\"{$index}\"></TD>\n"; print "<TD width=120 nowrap>" . $ShowText . "</TD>\n"; print "<TD width=150 nowrap>"; //print_R($_GET); //print $KeyName; //如果隐藏的话就显示为只读 if ($group_filter_Array[4] == "hidden") { //如果隐藏的话就显示为只读 $显示名称 = returntablefield($ChildTableName, $ChildTableFieldValue, $_GET[$KeyName], $ChildTableFieldName); print "<select class=\"SmallSelect\" name=\"" . $KeyName . "\">\n"; print "<option value=\"" . $_GET[$KeyName] . "\" >" . $显示名称 . "[" . $_GET[$KeyName] . "]</option>\n"; print "</select>\n"; } else { //显示成为列表 print "<select class=\"SmallSelect\" name=\"" . $KeyName . "\" >\n"; //print "<option value=\"\" >".$common_html['common_html']['allrecords']."</option>\n"; print "<option value=\"\" >" . $html_etc[$tablename][$list['index_name']] . "[" . $common_html['common_html']['allrecords'] . "]</option>\n"; //2009-12-24加入对列表组的过滤 for ($i = 0; $i < sizeof($rs_a); $i++) { if ($_GET[$KeyName] == $rs_a[$i][$ChildTableFieldValue]) { $CheckedX = "selected"; } else { $CheckedX = ""; } print "<option value=\"" . $rs_a[$i][$ChildTableFieldValue] . "\" {$CheckedX} >" . $rs_a[$i][$ChildTableFieldName] . "[" . $rs_a[$i][$ChildTableFieldValue] . "]</option>\n"; } print "</select>\n"; } //2009-12-24加入对搜索属性的支持 print "<input type=hidden name='searchfield' value='" . $_GET['searchfield'] . "'>\n"; print "<input type=hidden name='searchvalue' value='" . $_GET['searchvalue'] . "'>\n"; print "<input type=hidden name='tablename' value='{$tablename}'>\n"; print "<input type=hidden name='AdvanceSearch' value='{$ADD_SEARCH_VALUE}'>\n"; print "</TD></TR>\n"; } else { //高级搜索时出现的隐藏变量 if ($_GET['actionadv'] == "exportadv_default") { print "<TR class=TableData>\n"; print "<TD noWrap align=middle><input type=\"checkbox\" checked name=\"selectidtemp\" disabled value=\"{$index}\"></TD>\n"; print "<TD width=90% colspan=2>高级搜索:\n"; //print "<select class=\"SmallSelect\" name=\"".$KeyName."\" disabled>\n"; //print "<option value=\"\" >".$common_html['common_html']['allrecords']."</option>\n"; //print "<option value=\"\" >".$html_etc[$tablename][$list['index_name']]."[".$common_html['common_html']['allrecords']."]</option>\n"; //print "</select>\n"; $showlistfieldlist_array = explode(',', $showlistfieldlist); //print_R($showlistfieldlist_array); for ($i = 0; $i < sizeof($showlistfieldlist_array); $i++) { $index = $showlistfieldlist_array[$i]; $list = $columns[$index]; if ($_GET[$list] != "") { $ADD_SEARCH_VALUE .= "&{$list}=" . $_GET[$list]; $ADD_SEARCH_TEXT .= " {$list}:" . $_GET[$list]; } else { if ($_GET[$list . "_最小值"] != "" && $_GET[$list . "_最大值"] != "") { $ADD_SEARCH_VALUE .= "&" . $list . "_最小值=" . $_GET[$list . "_最小值"] . "&" . $list . "_最大值=" . $_GET[$list . "_最大值"] . ""; $ADD_SEARCH_TEXT .= " " . $list . "最小值:" . $_GET[$list . "_最小值"] . " " . $list . "最大值:" . $_GET[$list . "_最大值"] . ""; } else { if ($_GET[$list . "_开始时间"] != "" && $_GET[$list . "_结束时间"] != "") { $ADD_SEARCH_VALUE .= "&" . $list . "_开始时间=" . $_GET[$list . "_开始时间"] . "&" . $list . "_结束时间=" . $_GET[$list . "_结束时间"] . ""; $ADD_SEARCH_TEXT .= " " . $list . "开始时间:" . $_GET[$list . "_开始时间"] . " " . $list . "结束时间:" . $_GET[$list . "_结束时间"] . ""; } } } } print $ADD_SEARCH_TEXT; //print $ADD_SEARCH_VALUE; print "<input type=hidden name='{$KeyName}' value='" . $_GET['searchfield'] . "'>\n"; print "<input type=hidden name='searchfield' value='" . $_GET['searchfield'] . "'>\n"; print "<input type=hidden name='searchvalue' value='" . $_GET['searchvalue'] . "'>\n"; print "<input type=hidden name='tablename' value='{$tablename}'>\n"; print "<input type=hidden name='AdvanceSearch' value='{$ADD_SEARCH_VALUE}'>\n"; print "</TD></TR>\n"; } else { print "<TR class=TableData>\n"; print "<TD noWrap align=middle><input type=\"checkbox\" checked name=\"selectidtemp\" disabled value=\"{$index}\"></TD>\n"; print "<TD width=120 disabled>数据过滤</TD>\n"; print "<TD width=150 nowrap>"; print "<select class=\"SmallSelect\" name=\"" . $KeyName . "\" disabled>\n"; //print "<option value=\"\" >".$common_html['common_html']['allrecords']."</option>\n"; print "<option value=\"\" >" . $html_etc[$tablename][$list['index_name']] . "[" . $common_html['common_html']['allrecords'] . "]</option>\n"; print "</select>\n"; print "<input type=hidden name='searchfield' value='" . $_GET['searchfield'] . "'>\n"; print "<input type=hidden name='searchvalue' value='" . $_GET['searchvalue'] . "'>\n"; print "<input type=hidden name='tablename' value='{$tablename}'>\n"; print "<input type=hidden name='AdvanceSearch' value='{$ADD_SEARCH_VALUE}'>\n"; print "</TD></TR>\n"; } } //附加组数据导出--结束 $showlistfieldlist_array = explode(',', $showlistfieldlist); //print_R($showlistfieldlist_array); for ($i = 0; $i < sizeof($showlistfieldlist_array); $i++) { $index = $showlistfieldlist_array[$i]; $list = $columns[$index]; print "<TR class=TableData>\n"; print "<TD noWrap align=middle><input type=\"checkbox\" checked name=\"selectid\" value=\"{$index}\"></TD>\n"; print "<TD >" . $html_etc[$tablename][$list] . "</TD>\n"; print "<TD >{$list}</TD>\n"; print "</TR>\n"; $temp_function = 'selectid_str_init'; } break; } global $returnmodel; $returnmodelArray = explode(',', $returnmodel); if ($returnmodelArray[1] != "") { $returnmodelURL = $returnmodelArray[1]; } else { $returnmodelURL = "?"; } print "<tr align=\"center\" class=\"TableControl\">\n<td colspan=\"3\" nowrap>\n<div align=\"center\">\n\n\t<input type=\"button\" value=\"" . $common_html['common_html']['export'] . "CSV\" accesskey='v' title=\"" . $common_html['common_html']['accesskey'] . ":ALT+V\" class=\"SmallButton\" onClick=\"selectid_str_init_CSV('{$mark}');\">\n\t<input type=\"button\" value=\" " . $common_html['common_html']['export'] . "EXCEL \" accesskey='x' title=\"" . $common_html['common_html']['accesskey'] . ":ALT+X\" class=\"SmallButton\" onClick=\"selectid_str_init_XLS('{$mark}');\">\n\t<input type=\"button\" accesskey='c' title=\"" . $common_html['common_html']['accesskey'] . ":ALT+C\" value=\"" . $common_html['common_html']['cancel'] . "\" class=\"SmallButton\" onClick=\"location='{$returnmodelURL}'\"></div>\n</td></tr>\n"; table_end(); form_end(); print "<BR>"; }
function mactrack_snmp() { global $config, $item_rows; global $mactrack_snmp_actions; /* ================= input validation and session storage ================= */ $filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'sort_column' => array('filter' => FILTER_CALLBACK, 'default' => 'name', 'options' => array('options' => 'sanitize_search_string')), 'sort_direction' => array('filter' => FILTER_CALLBACK, 'default' => 'ASC', 'options' => array('options' => 'sanitize_search_string'))); validate_store_request_vars($filters, 'sess_mactrack_snmp'); /* ================= input validation ================= */ if (get_request_var('rows') == '-1') { $rows = read_config_option('num_rows_table'); } else { $rows = get_request_var('rows'); } html_start_box(__('Mactrack SNMP Options'), '100%', '', '3', 'center', 'mactrack_snmp.php?action=edit'); snmp_options_filter(); html_end_box(); /* form the 'where' clause for our main sql query */ $sql_where = ''; if (get_request_var('filter') != '') { $sql_where .= "WHERE (mac_track_snmp.name LIKE '%" . get_request_var('filter') . "%')"; } $total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(mac_track_snmp.id)\n\t\tFROM mac_track_snmp\n\t\t{$sql_where}"); $snmp_groups = db_fetch_assoc("SELECT *\n\t\tFROM mac_track_snmp\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var('sort_column') . ' ' . get_request_var('sort_direction') . ' LIMIT ' . $rows * (get_request_var('page') - 1) . ',' . $rows); $nav = html_nav_bar('mactrack_snmp.php?filter=' . get_request_var('filter'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 12, __('SNMP Settings')); print $nav; html_start_box('', '100%', '', '3', 'center', ''); $display_text = array('name' => array(__('Title of SNMP Option Set'), 'ASC')); html_header_sort_checkbox($display_text, get_request_var('sort_column'), get_request_var('sort_direction')); if (sizeof($snmp_groups)) { foreach ($snmp_groups as $snmp_group) { form_alternate_row('line' . $snmp_group['id'], true); form_selectable_cell(filter_value($snmp_group['name'], get_request_var('filter'), 'mactrack_snmp.php?action=edit&id=' . $snmp_group['id'] . '&page=1'), $snmp_group['id']); form_checkbox_cell($snmp_group['name'], $snmp_group['id']); form_end_row(); } } else { print '<tr><td colspan="3"><em>' . __('No SNMP Option Sets') . '</em></td></tr>'; } html_end_box(false); if (sizeof($snmp_groups)) { print $nav; } draw_actions_dropdown($mactrack_snmp_actions); form_end(); }
private function changeForm() { global $CORE, $AUTH; if (is_action()) { try { $user = $AUTH->getUser(); $password_old = post('password_old'); if (!$password_old) { throw new FieldInputError('password_old', l('You need to specify the old password.')); } $password_new1 = post('password_new1'); if (!$password_new1) { throw new FieldInputError('password_new1', l('You need to specify the new password.')); } $password_new2 = post('password_new2'); if (!$password_new2) { throw new FieldInputError('password_new2', l('You need to specify to confirm the new password.')); } if ($password_new1 != $password_new2) { throw new FieldInputError('password_new1', l('The new passwords do not match.')); } if ($password_old == $password_new1) { throw new FieldInputError('password_new1', l('The new and old passwords are equal. Won\'t change anything.')); } // Set new passwords in authentication module, then change it $AUTH->passNewPassword(array('user' => $user, 'password' => $password_old, 'passwordNew' => $password_new1)); if (!$AUTH->changePassword()) { throw new NagVisException(l('Your password could not be changed.')); } success(l('Your password has been changed.')); js('setTimeout(popupWindowClose, 1000);'); // close window after 1 sec } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (NagVisException $e) { form_error(null, $e->message()); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; js_form_start('change_password'); echo '<table class="mytable">'; echo '<tr><td class="tdlabel">' . l('Old password') . '</td>'; echo '<td class="tdfield">'; password('password_old'); echo '</td></tr>'; echo '<tr><td class="tdlabel">' . l('New password') . '</td>'; echo '<td class="tdfield">'; password('password_new1'); echo '</td></tr>'; echo '<tr><td class="tdlabel">' . l('New password (confirm)') . '</td>'; echo '<td class="tdfield">'; password('password_new2'); echo '</td></tr>'; echo '</table>'; js('try{document.getElementById(\'password_old\').focus();}catch(e){}'); submit(l('Change password')); form_end(); }
private function deleteForm() { global $CORE; echo '<h2>' . l('Delete Template') . '</h2>'; $map_name = req('show'); if (!$map_name) { throw new NagVisException(l('Map name missing')); } if (count($CORE->getAvailableMaps('/^' . preg_quote($map_name) . '$/')) == 0) { throw new NagVisException(l('A map with this name does not exists')); } $MAPCFG = new GlobalMapCfg($map_name); $MAPCFG->readMapConfig(!ONLY_GLOBAL, false, false); if (is_action() && post('mode') == 'delete') { try { $name = post('name'); if (count($MAPCFG->getTemplateNames('/^' . $name . '$/')) == 0) { throw new FieldInputError('name', l('A template with this name does not exist.')); } $obj_id = $MAPCFG->getTemplateIdByName($name); $MAPCFG->deleteElement($obj_id, true); success(l('The template has been deleted.')); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (NagVisException $e) { form_error(null, $e->message()); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; js_form_start('delete'); hidden('mode', 'delete'); echo '<table class="mytable">'; echo '<tr><td class="tdlabel">' . l('Name') . '</td>'; echo '<td class="tdfield">'; $choices = array('' => l('Please choose')); foreach (array_keys($MAPCFG->getTemplateNames()) as $tmpl_name) { $choices[$tmpl_name] = $tmpl_name; } select('name', $choices, '', 'updateForm(this.form)'); echo '</td></tr>'; echo '</table>'; submit(l('Delete')); form_end(); }
<?php require '../../include/mellivora.inc.php'; enforce_authentication(CONFIG_UC_MODERATOR); $rule = db_select_one('instances', array('*'), array('id' => $_SESSION['IID'])); head('Site management'); menu_management(); section_subhead('Edit Instance Settings'); form_start(CONFIG_SITE_ADMIN_RELPATH . 'actions/edit_settings'); echo '<div class="form-group"> <label class="col-sm-2 control-label" for="rule">Registration Token</label> <div class="col-sm-10"> <input id="rule" readonly name="rule" class="form-control" placeholder="Registration Token" value="', $rule['registrationToken'] != 0 ? $rule['registrationToken'] : 'Registration Tokens are not enabled.', '" type="text"> </div> </div>'; form_hidden('action', 'edit'); echo $rule['registrationToken'] == 0 ? form_button_submit('Enable Registration Token') : form_button_submit('Disable Registration Token'); form_end(); foot();
private function delForm() { global $CORE; echo '<h2>' . l('Delete Backend') . '</h2>'; if (is_action() && post('mode') == 'delete') { try { $backend_id = post('backend_id'); if (!isset($this->editable_backends[$backend_id])) { throw new FieldInputError('backend_id', l('The choosen backend does not exist.')); } // FIXME: Check whether or not the backend is used anywhere $CORE->getUserMainCfg()->delSection('backend_' . $backend_id); $CORE->getUserMainCfg()->writeConfig(); success(l('The backend has been deleted.')); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; js_form_start('delete'); hidden('mode', 'delete'); echo '<table class="mytable">'; echo '<tr><td class="tdlabel">' . l('Backend ID') . '</td>'; echo '<td class="tdfield">'; $choices = array('' => l('Please choose')); foreach ($this->editable_backends as $choice) { $choices[$choice] = $choice; } select('backend_id', $choices); echo '</td></tr>'; echo '</table>'; submit(l('Delete')); form_end(); }