Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('var_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //toggle enabled state if ($_REQUEST['id'] != '' && $_REQUEST['enabled'] != '') { $sql = "update v_vars set "; $sql .= "var_enabled = '".check_str($_REQUEST['enabled'])."' "; $sql .= "where var_uuid = '".check_str($_REQUEST['id'])."' "; $db->exec(check_sql($sql)); unset($sql); //unset the user defined variables $_SESSION["user_defined_variables"] = ""; //synchronize the configuration save_var_xml(); $_SESSION["message"] = $text['message-update']; header("Location: vars.php?id=".$_REQUEST['id']); exit; } //include the header require_once "resources/header.php"; $document['title'] = $text['title-variables']; //set http values as php variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; //show the content echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['header-variables']."
\n"; echo " ".$text['description-variables']."\n"; echo "
\n"; $sql = "select * from v_vars "; if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } else { $sql .= "order by var_cat, var_order asc "; } $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); unset ($prep_statement, $sql); $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "\n"; $tmp_var_header = ''; $tmp_var_header .= "\n"; $tmp_var_header .= th_order_by('var_name', $text['label-name'], $order_by, $order); $tmp_var_header .= th_order_by('var_value', $text['label-value'], $order_by, $order); $tmp_var_header .= th_order_by('var_hostname', $text['label-hostname'], $order_by, $order); $tmp_var_header .= th_order_by('var_enabled', $text['label-enabled'], $order_by, $order); $tmp_var_header .= "\n"; $tmp_var_header .= "\n"; $tmp_var_header .= "\n"; if ($result_count > 0) { $prev_var_cat = ''; foreach($result as $row) { $var_value = $row[var_value]; $var_value = substr($var_value, 0, 50); if ($prev_var_cat != $row[var_cat]) { $c=0; if (strlen($prev_var_cat) > 0) { echo "\n"; echo "\n"; echo "\n"; } echo "\n"; echo $tmp_var_header; } $tr_link = (permission_exists('var_edit')) ? "href='var_edit.php?id=".$row['var_uuid']."'" : null; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $var_description = str_replace("\n", "
", trim(substr(base64_decode($row['var_description']),0,40))); $var_description = str_replace(" ", "       ", $var_description); echo " \n"; echo " \n"; echo "\n"; $prev_var_cat = $row[var_cat]; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-description'].""; if (permission_exists('var_add')) { $tmp_var_header .= "$v_link_label_add"; } $tmp_var_header .= "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
  "; if (permission_exists('var_add')) { echo "$v_link_label_add"; } echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " ".$row['var_cat']." 
"; if (permission_exists('var_edit')) { echo "".substr($row['var_name'],0,32).""; } else { echo substr($row['var_name'],0,32); } echo " ".substr($var_value,0,30)."".$row['var_hostname']." "; echo " ".(($row['var_enabled'] == 'true') ? $text['option-true'] : $text['option-false']).""; echo " ".$var_description." "; if (permission_exists('var_edit')) { echo "$v_link_label_edit"; } if (permission_exists('var_delete')) { echo "$v_link_label_delete"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls"; if (permission_exists('var_add')) { echo "$v_link_label_add"; } echo "
\n"; echo "
"; echo "

"; //include the footer require_once "resources/footer.php"; ?>