<?php # Put the rows for showing gallery if ($this_page == 'xmec' || $this_page == 'chapters' || $this_page == 'college' || $this_page == 'login' || $this_page == 'contact') { show_gallery(); } ?> <?php # Put the rows for showing Edit Profile if ($this_page == 'xmec' || $this_page == 'poll') { show_profile(); } ?> <?php # Put the rows for showing Edit Password if ($this_page == 'xmec' || $this_page == 'profile' || $this_page == 'letters') { show_password(); } ?> <?php # Put the rows for showing Letters if ($this_page == 'groups' || $this_page == 'profile' || $this_page == 'college' || $this_page == 'login' || $this_page == 'gallery') { show_letters(); } ?> <?php # Put the rows for showing Downloads if ($this_page == 'xnews' || $this_page == 'letters' || $this_page == 'college' || $this_page == 'contact') { show_downloads(); } ?> <?php
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal); $iFilteredTotal = $aResultFilterTotal[0]; $sQuery = "\n SELECT COUNT(id_hist)\n FROM History\n WHERE " . $basic_query; $rResultTotal = mysql_query($sQuery, $dbh) or die(mysql_error()); $aResultTotal = mysql_fetch_array($rResultTotal); $iTotal = $aResultTotal[0]; $sOutput = '{'; $sOutput .= '"sEcho": ' . intval($_GET['sEcho']) . ', '; $sOutput .= '"iTotalRecords": ' . $iTotal . ', '; $sOutput .= '"iTotalDisplayRecords": ' . $iFilteredTotal . ', '; $sOutput .= '"aaData": [ '; while ($aRow = mysql_fetch_array($rResult)) { # do some stuff bevore generating output # if object name contains password, and PASSWD_DISPLAY is 0 (made in called function), do not show password if (stristr($aRow["attr_name"], "password")) { $aRow["attr_value"] = show_password($aRow["attr_value"]); } # item linking if (!empty($aRow["fk_id_item"]) and $show_item_links) { if ($aRow["action"] == "removed" and $aRow["attr_name"] == "service") { # removed services will link to hosts service list view $aRow['attr_value'] = '<a href="modify_item_service.php?id=' . $aRow["fk_id_item"] . '">' . $aRow["attr_value"] . '</a>'; } else { # all other entries will link to its detail view $aRow['attr_value'] = '<a href="detail.php?id=' . $aRow["fk_id_item"] . '">' . $aRow["attr_value"] . '</a>'; } } else { # entries which are removed, do not have any link } # create output (JSON) $sOutput .= "[";
echo '<tbody>'; # get basic entries $query = 'SELECT ConfigAttrs.friendly_name,attr_value, ConfigAttrs.datatype FROM ConfigAttrs,ConfigValues,ConfigItems WHERE id_attr=fk_id_attr AND id_item=fk_id_item AND ConfigAttrs.visible="yes" AND id_item=' . $_GET["id"] . ' ORDER BY ConfigAttrs.ordering'; $result = db_handler($query, "array", "get basic entries"); $basic_result = array(); # show or hide password if exists: foreach ($result as $attributes) { if ($attributes["datatype"] == "password") { # check how to display password $attributes["attr_value"] = show_password($attributes["attr_value"]); } array_push($basic_result, $attributes); } echo table_output($basic_result, $item_class); # get linked entries $query2 = 'SELECT ConfigAttrs.friendly_name,attr_value,fk_item_linked2 AS item_id, (SELECT config_class FROM ConfigItems,ConfigClasses WHERE id_class=fk_id_class AND id_item=item_id) AS config_class FROM ConfigValues,ItemLinks,ConfigAttrs,ConfigClasses WHERE fk_item_linked2=ConfigValues.fk_id_item AND id_attr=ItemLinks.fk_id_attr AND ConfigAttrs.visible="yes" AND fk_id_class=id_class AND (SELECT naming_attr FROM ConfigAttrs WHERE id_attr=ConfigValues.fk_id_attr)="yes" AND ItemLinks.fk_id_item=' . $_GET["id"] . '
echo '<td> <input id="' . $entry["attr_name"] . '" name="' . $entry["id_attr"] . '" type=text maxlength=' . $entry["max_length"] . ' value="' . htmlspecialchars($value) . '"> </td>'; } else { echo '<td> <input name="' . $entry["id_attr"] . '" type=text maxlength=' . $entry["max_length"] . ' value="' . htmlspecialchars($value) . '"> </td>'; } } # process "password" fields } elseif ($entry["datatype"] == "password") { if (isset($_SESSION["cache"]["handle"][$entry["id_attr"]])) { $value = $_SESSION["cache"]["handle"][$entry["id_attr"]]; } elseif (isset($item_data[$entry["id_attr"]])) { $value = $item_data[$entry["id_attr"]]; $value = show_password($value); } else { $value = ""; } echo '<td> <input name="' . $entry["id_attr"] . '" type=password maxlength=' . $entry["max_length"] . ' value="' . htmlspecialchars($value) . '"> </td>'; # process "select" fields } elseif ($entry["datatype"] == "select") { // ADMIN users only if ($_SESSION["group"] != "admin" and in_array($entry["attr_name"], $ADMIN_ONLY)) { echo '<input name="' . $entry["id_attr"] . '" type="HIDDEN" value="' . $entry["predef_value"] . '">'; } $dropdown = preg_split("/" . SELECT_VALUE_SEPARATOR . "/", $entry["poss_values"]); echo '<td><select name="' . $entry["id_attr"] . '" size="0"'; // ADMIN users only
'; # get basic entries $query = 'SELECT ConfigAttrs.friendly_name,attr_value, ConfigAttrs.datatype FROM ConfigAttrs,ConfigValues,ConfigItems WHERE id_attr=fk_id_attr AND id_item=fk_id_item AND ConfigAttrs.visible="yes" AND id_item=' . $_GET["id"] . ' ORDER BY ConfigAttrs.ordering'; $result = db_handler($query, "result", "get basic entries"); if ($result) { while ($entry = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td style="vertical-align:text-top" width="150" class="color_list2"> ' . $entry["friendly_name"] . ': </td>'; if ($entry["datatype"] == "password") { $password = show_password($entry["attr_value"]); // show password echo '<td class="color_list1 highlight"> ' . $password . '</td>'; } else { // Link handling if (preg_match('/^http*/', $entry["attr_value"])) { # Link echo '<td class="color_list1 highlight"> <a target="_blank"href="' . $entry["attr_value"] . '">' . $entry["attr_value"] . '</a></td>'; } else { # normal text echo '<td class="color_list1 highlight" style="word-break:break-all;word-wrap:break-word"> ' . $entry["attr_value"] . '</td>'; } } echo '</tr>'; } }