本文整理汇总了PHP中Addresses类的典型用法代码示例。如果您正苦于以下问题:PHP Addresses类的具体用法?PHP Addresses怎么用?PHP Addresses使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Addresses类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: resolve_address
/**
* Resolves hostname
*
* @access public
* @param mixed $address address object
* @param boolena $override override DNS resolving flag
* @return void
*/
public function resolve_address($address, $override = false)
{
# settings
$this->get_settings();
# addresses object
$Address = new Addresses($this->Database);
# make sure it is dotted format
$address->ip = $Address->transform_address($address->ip_addr, "dotted");
# if dns_nameis set try to check
if (empty($address->dns_name) || is_null($address->dns_name)) {
# if permitted in settings
if ($this->settings->enableDNSresolving == 1 || $override) {
# resolve
$resolved = gethostbyaddr($address->ip);
if ($resolved == $address->ip) {
$resolved = "";
}
//resolve fails
return array("class" => "resolved", "name" => $resolved);
} else {
return array("class" => "", "name" => "");
}
} else {
return array("class" => "", "name" => $address->dns_name);
}
}
开发者ID:Benchwork,项目名称:phpipam,代码行数:34,代码来源:class.DNS.php
示例2: updateAddress
function updateAddress($addr, $keep_photo = true)
{
global $keep_history, $domain_id, $base_from_where, $table, $table_grp_adr, $table_groups;
$addresses = new Addresses($addr['id']);
$resultsnumber = $addresses->count();
$homepage = str_replace('http://', '', $addr['homepage']);
$is_valid = $resultsnumber > 0;
if ($is_valid) {
if ($keep_history) {
// Get current photo, if "$keep_photo"
if ($keep_photo) {
$r = $addresses->nextAddress()->getData();
$addr['photo'] = $r['photo'];
}
$sql = "UPDATE {$table}\r\n\t SET deprecated = now()\r\n\t\t WHERE deprecated is null\r\n\t\t AND id\t = '" . $addr['id'] . "'\r\n\t\t AND domain_id = '" . $domain_id . "';";
$result = mysql_query($sql);
saveAddress($addr);
} else {
$sql = "UPDATE {$table} SET firstname = '" . $addr['firstname'] . "'\r\n\t , lastname = '" . $addr['lastname'] . "'\r\n\t , nickname = '" . $addr['nickname'] . "'\r\n\t , company = '" . $addr['company'] . "'\r\n\t , title = '" . $addr['title'] . "'\r\n\t , address = '" . $addr['address'] . "'\r\n\t , home = '" . $addr['home'] . "'\r\n\t , mobile = '" . $addr['mobile'] . "'\r\n\t , work = '" . $addr['work'] . "'\r\n\t , fax = '" . $addr['fax'] . "'\r\n\t , email = '" . $addr['email'] . "'\r\n\t , email2 = '" . $addr['email2'] . "'\r\n\t , email3 = '" . $addr['email3'] . "'\r\n\t , homepage = '" . $addr['homepage'] . "'\r\n\t , aday = '" . $addr['aday'] . "'\r\n\t , amonth = '" . $addr['amonth'] . "'\r\n\t , ayear = '" . $addr['ayear'] . "'\r\n\t , bday = '" . $addr['bday'] . "'\r\n\t , bmonth = '" . $addr['bmonth'] . "'\r\n\t , byear = '" . $addr['byear'] . "'\r\n\t , address2 = '" . $addr['address2'] . "'\r\n\t , phone2 = '" . $addr['phone2'] . "'\r\n\t , notes = '" . $addr['notes'] . "'\r\n\t " . ($keep_photo ? "" : ", photo = '" . $addr['photo'] . "'") . "\r\n\t , modified = now()\r\n\t\t WHERE id = '" . $addr['id'] . "'\r\n\t\t AND domain_id = '{$domain_id}';";
$result = mysql_query($sql);
}
// header("Location: view?id=$id");
}
return $is_valid;
}
开发者ID:karanikn,项目名称:php-addressbook,代码行数:25,代码来源:address.class.php
示例3: run
public function run()
{
$faker = Faker\Factory::create();
//Addresses::truncate();
for ($i = 0; $i < 30; $i++) {
$addresses = Addresses::create(array('streetName' => $faker->streetName, 'buildingNumber' => $faker->buildingNumber, 'postalCode' => $faker->postcode, 'province' => $faker->state, 'city' => $faker->city, 'country' => $faker->country));
}
}
开发者ID:jmrodriguesgoncalves,项目名称:NewTownCabinetry,代码行数:8,代码来源:AddressesTableSeeder.php
示例4: run
public function run()
{
$faker = Faker\Factory::create();
//Suppliers::truncate();
$address = Addresses::all()->lists('id');
for ($i = 0; $i < 20; $i++) {
$suppliers = Suppliers::create(array('name' => $faker->company, 'phone' => $faker->phoneNumber, 'email' => $faker->email, 'addressId' => $faker->randomElement($address)));
}
}
开发者ID:jmrodriguesgoncalves,项目名称:NewTownCabinetry,代码行数:9,代码来源:SuppliersTableSeeder.php
示例5: dirname
<?php
/*
* Print truncate subnet
*********************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->create_csrf_cookie();
# id must be numeric
if (!is_numeric($_POST['subnetId'])) {
$Result->show("danger", _("Invalid ID"), true, true);
}
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
# verify that user has write permissions for subnet
$subnetPerm = $Subnets->check_permission($User->user, $subnet->id);
if ($subnetPerm < 3) {
$Result->show("danger", _('You do not have permissions to resize subnet') . '!', true, true);
}
?>
开发者ID:mwodz,项目名称:phpipam,代码行数:30,代码来源:truncate.php
示例6: Database_PDO
# set sorting
$sort['direction'] = 'asc';
$sort['field'] = 'ip_addr';
$sort['directionNext'] = "desc";
} else {
# use required functions
require '../../../functions/functions.php';
# database object
$Database = new Database_PDO();
# initialize objects
$Result = new Result();
$User = new User($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# set sorting
$tmp = explode("|", $_POST['direction']);
$sort['field'] = $tmp[0];
$sort['direction'] = $tmp[1];
if ($sort['direction'] == "asc") {
$sort['directionNext'] = "desc";
} else {
$sort['directionNext'] = "asc";
}
# subnet-related variables
$subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
//subnet details
$subnet_detailed = $Subnets->get_network_boundaries($subnet['subnet'], $subnet['mask']);
开发者ID:rtd,项目名称:phpipam,代码行数:31,代码来源:print-address-table.php
示例7: dirname
<?php
/**
* Script to check edited / deleted / new IP addresses
* If all is ok write to database
*************************************************/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
$Log = new Logging($Database, $User->settings);
$Zones = new FirewallZones($Database);
$Ping = new Scan($Database);
# verify that user is logged in
$User->check_user_session();
# validate csrf cookie
$User->csrf_cookie("validate", "address", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
# validate action
$Tools->validate_action($_POST['action']);
$action = $_POST['action'];
//reset delete action form visual visual
if (isset($_POST['action-visual'])) {
if (@$_POST['action-visual'] == "delete") {
$action = "delete";
}
}
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:address-modify-submit.php
示例8: dirname
<?php
/**
* Generate XLS file for subnet
*********************************/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# we dont need any errors!
//ini_set('display_errors', 0);
# fetch subnet details
$subnet = (array) $Subnets->fetch_subnet(null, $_GET['subnetId']);
# fetch all IP addresses in subnet
$addresses = $Addresses->fetch_subnet_addresses($_GET['subnetId'], "ip_addr", "asc");
# get all custom fields
$custom_fields = $Tools->fetch_custom_fields('ipaddresses');
# Create a workbook
$filename = "phpipam_subnet_export.xls";
$workbook = new Spreadsheet_Excel_Writer();
//formatting headers
$format_header =& $workbook->addFormat();
$format_header->setBold();
开发者ID:netbuild,项目名称:phpipam,代码行数:31,代码来源:export-subnet.php
示例9: dirname
/*
* Script to display search results
**********************************/
# for ajax-loaded pages
if (!isset($Subnets)) {
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Sections = new Sections($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
}
# set searchterm
if (isset($_REQUEST['ip'])) {
// trim
$_REQUEST['ip'] = trim($_REQUEST['ip']);
// escape
$_REQUEST['ip'] = htmlspecialchars($_REQUEST['ip']);
$search_term = @$search_term == "search" ? "" : $_REQUEST['ip'];
}
# verify that user is logged in
$User->check_user_session();
# change * to % for database wildchar
$search_term = trim($search_term);
$search_term = str_replace("*", "%", $search_term);
//initialize Pear IPv6 object
开发者ID:dajo,项目名称:phpipam,代码行数:30,代码来源:search-results.php
示例10: reformat_IPv4_for_search
/**
* Reformat possible nun-full IPv4 address for search
*
* e.g. 10.10.10 -> 10.10.10.0 - 10.10.10.255
*
* @access public
* @param mixed $address
* @return array high/low decimal address
*/
public function reformat_IPv4_for_search($address)
{
# remove % sign if present
$address = str_replace("%", "", $address);
# we need Addresses class
$Addresses = new Addresses($this->Database);
# if subnet is provided we have all data
if (strpos($address, "/") > 0) {
# Initialize PEAR NET object
$this->initialize_pear_net_IPv4();
$net = $this->Net_IPv4->parseAddress($ip);
$result['low'] = $Addresses->transform_to_decimal($net->network);
$result['high'] = $Addresses->transform_to_decimal($net->broadcast);
} else {
# if subnet is not provided maye wildcard is, so explode it to array
$address = array_filter(explode(".", $address));
# 4 pieces is ok, host
if (sizeof($address) == 4) {
$result['low'] = $result['high'] = $Addresses->transform_to_decimal(implode(".", $address));
} elseif (sizeof($address) == 3) {
$result['low'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(0))));
$result['high'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(255))));
} elseif (sizeof($address) == 2) {
$result['low'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(0, 0))));
$result['high'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(255, 255))));
} elseif (sizeof($address) == 1) {
$result['low'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(0, 0, 0))));
$result['high'] = $Addresses->transform_to_decimal(implode(".", array_merge($address, array(255, 255, 255))));
} else {
$result['low'] = implode(".", $address);
$result['high'] = implode(".", $address);
}
}
# return result array low/high
return $result;
}
开发者ID:julsoj,项目名称:phpipam,代码行数:45,代码来源:class.Tools.php
示例11: Address
$homeAddr = $addrs->getColumn('homeAddress');
$homeAddr->setColumn('city', 'san francisco');
$homeAddr->setColumn('street', '1234 x street');
$homeAddr->setColumn('zip', '94107');
// work address
$workAddr = $addrs->getColumn('workAddress');
$workAddr->setColumn('city', 'san jose');
$workAddr->setColumn('street', '9876 y drive');
// custom labelled supercolumn
$customAddr = new Address('customAddress');
$customAddr->setColumn('city', 'another city');
$addrs->addSuper($customAddr);
if (!$addrs->save()) {
die($addrs->lastError());
}
unset($addrs);
// Load the saved Addresses
$addrs = new Addresses();
if (!$addrs->load($keyID)) {
die($addrs->lastError());
}
// Show our loaded CF in JSON format, including key path
echo '<pre>' . $addrs->toJSON(TRUE) . '</pre>';
// Example export -> import of JSON structure from loaded data into new object
$addrsClone = new Addresses();
// Populates data from JSON export (therefore must exclude key path)
$addrsClone->populate($addrs->toJSON());
// Set key
$addrsClone->setKeyID($keyID);
// Show the JSON for our CF with cloned data. This and the prior echo should match
echo '<pre>' . $addrsClone->toJSON(TRUE) . '</pre>';
开发者ID:jlaprise,项目名称:Pandra,代码行数:31,代码来源:address_supercolumn.php
示例12: getXMLDataMap
/**
* Get the reviews data map coordinates
*/
public static function getXMLDataMap($locale = 1)
{
$data = array();
$j = 0;
$translator = Shineisp_Registry::getInstance()->Zend_Translate;
$records = Doctrine_Query::create()->from('Reviews r')->leftJoin('r.Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->where("active = ?", true)->andWhere('latitude <> ?', "")->andWhere('longitude <> ?', "")->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
foreach ($records as $record) {
$text = "<div id=\"mycontent\">";
$text .= "<div id=\"bodyContent\">";
$text .= "<h4><a href=\"/" . $record['Products']['uri'] . ".html\">" . $record['Products']['ProductsData'][0]['name'] . "</a></h4>";
for ($i = 0; $i < $record['stars']; $i++) {
$text .= "*";
}
$text .= "<br/><br/>" . $record['review'] . "<br/>";
$text .= "<p><b>inviato da " . $record['nick'] . "</b> il " . Shineisp_Commons_Utilities::formatDateOut($record['publishedat']) . "</p>";
$text .= "</div></div>";
$data['marker'][$j]['@attributes'] = array('lat' => $record['latitude'], 'lng' => $record['longitude']);
$data['marker'][$j]['text']['@cdata'] = $text;
$j++;
}
$customers = Addresses::getMapCoords();
foreach ($customers as $record) {
if (!empty($record['company'])) {
$text = "";
#$text = "<div id=\"mycontent\">";
#$text .= "<div id=\"bodyContent\">";
#$text .= "<p>". $translator->_('%s has choosen our company as I.T. partners', "<b>" . $record['company']. "</b>") . "</p>";
#$text .= "</div></div>";
$data['marker'][$j]['@attributes'] = array('lat' => $record['latitude'], 'lng' => $record['longitude'], 'icontype' => "purple");
$data['marker'][$j]['text']['@cdata'] = $text;
$j++;
}
}
$xml = Shineisp_Commons_Array2XML::createXML('markers', $data);
$xml->save(PUBLIC_PATH . "/documents/reviews.xml");
return true;
}
开发者ID:kokkez,项目名称:shineisp,代码行数:40,代码来源:Reviews.php
示例13: dirname
*
*
* In case of problems set reset_debugging to true
*
* Statuses:
* 0 = online
* 2 = offline
*
*/
# include required scripts
require dirname(__FILE__) . '/../functions.php';
require dirname(__FILE__) . '/../../functions/classes/class.Thread.php';
# initialize objects
$Database = new Database_PDO();
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Tools = new Tools($Database);
$Scan = new Scan($Database);
$Result = new Result();
// set exit flag to true
$Scan->ping_set_exit(true);
// set debugging
$Scan->reset_debugging(false);
// fetch agent
$agent = $Tools->fetch_object("scanAgents", "id", 1);
// change scan type?
// $Scan->reset_scan_method ("fping");
// set ping statuses
$statuses = explode(";", $Scan->settings->pingStatus);
// set mail override flag
$send_mail = true;
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:pingCheck.php
示例14: dirname
<?php
/**
* Script that checks if IP is alive
*/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
$Ping = new Scan($Database, $User->settings);
# verify that user is logged in
$User->check_user_session();
# validate post
is_numeric($_POST['subnetId']) ?: $Result->show("danger", _("Invalid ID"), true);
is_numeric($_POST['id']) || strlen($_POST['id']) == 0 ?: $Result->show("danger", _("Invalid ID"), true);
# set and check permissions
$subnet_permission = $Subnets->check_permission($User->user, $_POST['subnetId']);
$subnet_permission > 2 ?: $Result->show("danger", _('Cannot edit IP address details') . '! <br>' . _('You do not have write access for this network'), true, true);
# fetch address
$address = (array) $Addresses->fetch_address(null, $_POST['id']);
# try to ping it
$pingRes = $Ping->ping_address($address['ip']);
# update last seen if success
if ($pingRes == 0) {
@$Ping->ping_update_lastseen($address['id']);
}
开发者ID:netbuild,项目名称:phpipam,代码行数:31,代码来源:ping-address.php
示例15: dirname
<?php
/*
* insert new hosts to database
*******************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# subnet Id must be a integer
if (!is_numeric($_POST['subnetId']) || $_POST['subnetId'] == 0) {
$Result->show("danger", _("Invalid ID"), true);
}
# verify that user has write permissionss for subnet
if ($Subnets->check_permission($User->user, $_POST['subnetId']) != 3) {
$Result->show("danger", _('You do not have permissions to modify hosts in this subnet') . "!", true, true);
}
# ok, lets get results form post array!
foreach ($_POST as $key => $line) {
// IP address
if (substr($key, 0, 2) == "ip") {
$res[substr($key, 2)]['ip_addr'] = $line;
}
// description
开发者ID:rtd,项目名称:phpipam,代码行数:31,代码来源:subnet-scan-icmp-result.php
示例16: dirname
<?php
/**
* Script to print edit / delete / new IP address
*
* Fetches info from database
*************************************************/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->create_csrf_cookie();
# validate action
$Tools->validate_action($_POST['action']);
# validate post
is_numeric($_POST['subnetId']) ?: $Result->show("danger", _("Invalid subnet ID"), true, true);
is_numeric($_POST['id']) || strlen($_POST['id']) == 0 ?: $Result->show("danger", _("Invalid ID"), true, true);
# get posted values
$subnetId = $_POST['subnetId'];
$action = $_POST['action'];
$id = $_POST['id'];
# fetch subnet
$subnet = (array) $Subnets->fetch_subnet(null, $subnetId);
开发者ID:mwodz,项目名称:phpipam,代码行数:31,代码来源:address-modify.php
示例17: verify_subnet_split
/**
* Checks if it ok to split subnet
*
* @access private
* @param mixed $subnet_old
* @param mixed $number
* @param string $group
* @param string $strict
* @return void
*/
private function verify_subnet_split($subnet_old, $number, $group, $strict)
{
# addresses class
$Addresses = new Addresses($this->Database);
# get new mask - how much we need to add to old mask?
switch ($number) {
case "2":
$mask_diff = 1;
break;
case "4":
$mask_diff = 2;
break;
case "8":
$mask_diff = 3;
break;
case "16":
$mask_diff = 4;
break;
case "32":
$mask_diff = 5;
break;
case "64":
$mask_diff = 6;
break;
case "128":
$mask_diff = 7;
break;
case "256":
$mask_diff = 8;
break;
//otherwise die
//otherwise die
default:
$Result->show("danger", _("Invalid number of subnets"), true);
}
//set new mask
$mask = $subnet_old->mask + $mask_diff;
//set number of subnets
$number_of_subnets = pow(2, $mask_diff);
//set max hosts per new subnet
$max_hosts = $this->get_max_hosts($mask, $this->identify_address($this->transform_to_dotted($subnet_old->subnet)), false);
# create array of new subnets based on number of subnets (number)
for ($m = 0; $m < $number_of_subnets; $m++) {
$newsubnets[$m] = (array) $subnet_old;
$newsubnets[$m]['id'] = $m;
$newsubnets[$m]['mask'] = $mask;
// if group is selected rewrite the masterSubnetId!
if ($group == "yes") {
$newsubnets[$m]['masterSubnetId'] = $subnet_old->id;
}
// recalculate subnet
if ($m > 0) {
$newsubnets[$m]['subnet'] = gmp_strval(gmp_add($newsubnets[$m - 1]['subnet'], $max_hosts));
}
}
// recalculate old hosts to put it to right subnet
$addresses = $Addresses->fetch_subnet_addresses($subnet_old->id, "ip_addr", "asc");
# get all IP addresses
$subSize = sizeof($newsubnets);
# how many times to check
$n = 0;
# ip address count
// loop
foreach ($addresses as $ip) {
//cast
$ip = (array) $ip;
# check to which it belongs
for ($m = 0; $m < $subSize; $m++) {
# check if between this and next - strict
if ($strict == "yes") {
# check if last
if ($m + 1 == $subSize) {
if ($ip['ip_addr'] > $newsubnets[$m]['subnet']) {
$addresses[$n]->subnetId = $newsubnets[$m]['id'];
}
} elseif ($ip['ip_addr'] > $newsubnets[$m]['subnet'] && $ip['ip_addr'] < @$newsubnets[$m + 1]['subnet']) {
$addresses[$n]->subnetId = $newsubnets[$m]['id'];
}
} else {
# check if last
if ($m + 1 == $subSize) {
if ($ip['ip_addr'] >= $newsubnets[$m]['subnet']) {
$addresses[$n]->subnetId = $newsubnets[$m]['id'];
}
} elseif ($ip['ip_addr'] >= $newsubnets[$m]['subnet'] && $ip['ip_addr'] < $newsubnets[$m + 1]['subnet']) {
$addresses[$n]->subnetId = $newsubnets[$m]['id'];
}
}
}
# if subnetId is still the same save to error
//.........这里部分代码省略.........
开发者ID:seisen,项目名称:phpipam,代码行数:101,代码来源:class.Subnets.php
示例18: dirname
<?php
/**
* Script to confirm / reject IP address request
***********************************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database, false);
$Addresses = new Addresses($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# strip input tags
$_POST = $Admin->strip_input_tags($_POST);
# validate csrf cookie
$User->csrf_cookie("validate", "requests", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
# verify permissions
if ($Subnets->check_permission($User->user, $_POST['subnetId']) != 3) {
$Result->show("danger", _('You do not have permissions to process this request') . "!", true);
}
# fetch custom fields
$custom = $Tools->fetch_custom_fields('ipaddresses');
if (sizeof($custom) > 0) {
foreach ($custom as $myField) {
if (isset($_POST[$myField['name']])) {
$_POST[$myField['name']] = $_POST[$myField['name']];
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:edit-result.php
示例19: dirname
<?php
/**
* Export search results
****************************/
# include required scripts
require dirname(__FILE__) . '/../../../functions/functions.php';
require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php';
# initialize required objects
$Database = new Database_PDO();
$Result = new Result();
$User = new User($Database);
$Subnets = new Subnets($Database);
$Sections = new Sections($Database);
$Tools = new Tools($Database);
$Addresses = new Addresses($Database);
# verify that user is logged in
$User->check_user_session();
# fetch search term
$search_term = $_REQUEST['search_term'];
//initialize Pear IPv6 object
require_once dirname(__FILE__) . '/../../../functions/PEAR/Net/IPv6.php';
$Net_IPv6 = new Net_IPv6();
// ipv6 ?
if ($Net_IPv6->checkIPv6($search_term) != false) {
$type = "IPv6";
} elseif (strlen($search_term) == 17 && substr_count($search_term, ":") == 5) {
$type = "mac";
//count : -> must be 5
} else {
if (strlen($search_term) == 12 && substr_count($search_term, ":") == 0 && substr_count($search_term, ".") == 0) {
开发者ID:martinsv,项目名称:phpipam,代码行数:31,代码来源:search-results-export.php
示例20: dirname
<?php
/**
* Generate XLS file
*********************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Sections = new Sections($Database);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
// Create a workbook
$filename = "phpipam_IP_adress_export_" . date("Y-m-d") . ".xls";
$workbook = new Spreadsheet_Excel_Writer();
$workbook->setVersion(8);
//fetch sections, and for each section write new tab, inside tab write all values!
$sections = $Sections->fetch_sections();
//we need to reformat state!
$ip_types = $Addresses->addresses_types_fetch();
//fetch devices and reorder
$devices = $Tools->fetch_all_objects("devices", "hostname");
$devices_indexed = array();
if ($devices !== false) {
foreach ($devices as $d) {
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:generate-xls.php
注:本文中的Addresses类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论