当前位置: 首页>>代码示例>>PHP>>正文


PHP Addresses类代码示例

本文整理汇总了PHP中Addresses的典型用法代码示例。如果您正苦于以下问题:PHP Addresses类的具体用法?PHP Addresses怎么用?PHP Addresses使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Addresses类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Addresses类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。