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


PHP getLocation函数代码示例

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


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

示例1: getAndroidVideoUrl

 private function getAndroidVideoUrl($vid)
 {
     $videoAddressUrl = "";
     if (isset($vid) && !is_null($vid)) {
         $url = replaceStr(YouKuContent::BASE_URL, "{id}", $vid);
         //check gaoqing
         $hdurl = replaceStr($url, "{format}", "3gphd");
         $location = getLocation($hdurl);
         //  		  writetofile("daa.txt", $hdurl);
         $flag = false;
         if (!isN($location) && strpos($location, $this->notfound) === false) {
             $videoAddressUrl = $videoAddressUrl . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $hdurl;
             $flag = true;
         }
         $hdurl = replaceStr($url, "{format}", "3gp");
         $location = getLocation($hdurl);
         //  		  writetofile("daa.txt", $hdurl);
         if (!isN($location) && strpos($location, $this->notfound) === false) {
             if ($flag) {
                 $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION;
             }
             $videoAddressUrl = $videoAddressUrl . MovieType::NORMAL . MovieType::VIDEO_NAME_URL_SEP . $hdurl;
         }
     }
     return $videoAddressUrl;
 }
开发者ID:andyongithub,项目名称:joyplus-cms,代码行数:26,代码来源:YouKuContent.php

示例2: onCommand

 public function onCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     if ($sender instanceof Player) {
         if (count($args) == 0) {
             $sender->sendMessage(TextFormat::RED . "Not enough arguments.");
             return;
         }
         if (count($args) == 1) {
             if ($this->getServer()->getPlayer($args[0])) {
                 $location = $this->getServer()->getPlayer($args[0])->getLocation();
                 $sender->teleport($location);
                 $sender->sendMessage(TextFormat::BLUE . "[Server] You have teleported to {$args['0']}");
                 return;
             } else {
                 $sender->sendMessage(TextFormat::RED . "[Server] That player isn't online!");
                 return;
             }
         }
         if (count($args) == 2) {
             if ($this->getServer()->getPlayer($args[0]) & getLocation() && $this->getServer()->getPlayer($args[1])) {
                 $location2 = $this->getServer()->getPlayer($args[1])->getLocation();
                 $player1 = $this->getServer()->getPlayer($args[0]);
                 $player2 = $this->getServer()->getPlayer($args[1]);
                 $player1->teleport($location2);
                 $player1->sendMessage(TextFormat::BLUE . "[Server] You have teleported to {$args['1']}");
                 return;
             }
         }
     }
 }
开发者ID:0-DevMatthew-0,项目名称:RandomCommandsPlugin,代码行数:30,代码来源:teleport.php

示例3: catch_url

function catch_url($k)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.xiami.com/search?key=" . $k);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $output = curl_exec($ch);
    curl_close($ch);
    $regs = array();
    //<a target="_blank" href="http://www.xiami.com/song/1773101670?spm=a1z1s.3521865.23309997.1.cT77HE" title="Palpitation!" data-spm-anchor-id="a1z1s.3521865.23309997.1">Palpitation!</a>
    preg_match_all("/href=\"http:\\/\\/www.xiami.com\\/song\\/(\\d+)/is", $output, $regs);
    $ids = $regs[1];
    $index = 0;
    foreach ($ids as $item) {
        $xml_url = "http://www.xiami.com/widget/xml-single/uid/0/sid/" . $item;
        $info = getInfo($xml_url);
        $location = getLocation($info->location);
        ?>

<audio controls="controls">
  <source src="<?php 
        echo $location;
        ?>
" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
<span><?php 
        echo $info->song_name;
        ?>
</span><img src="<?php 
        echo $info->album_cover;
        ?>
"/></br>
<input type="hidden" value="<?php 
        echo $location;
        ?>
"/>
<span style="display:none;">src:<?php 
        echo $location;
        ?>
</span><br/>
<?php 
        echo '<span><input type="button" onclick="mpg(' . $index . ')" value="mpg it"/></span><br/>';
        $index += 1;
    }
}
开发者ID:surevision,项目名称:node_mpg123_pi,代码行数:46,代码来源:xmu.php

示例4: edit

 public function edit()
 {
     $tid = intval($_GET['tid']);
     if ($this->checkFormSubmit()) {
         $tasknew = $_GET['tasknew'];
         if ($tasknew['title'] && $tasknew['contact'] && $tasknew['catid']) {
             $location = getLocation($tasknew['city'], $tasknew['address']);
             $tasknew['longitude'] = $location['longitude'];
             $tasknew['latitude'] = $location['latitude'];
             $this->t('task')->where(array('uid' => $this->uid, 'tid' => $tid))->update($tasknew);
             $pics = $_GET['pic'];
             if ($pics && is_array($pics)) {
                 $this->t('task')->where(array('tid' => $tid))->update(array('pic' => $pics[0]));
                 $this->t('image')->where(array('dataid' => $tid, 'datatype' => 'task'))->delete();
                 foreach ($pics as $pic) {
                     $this->t('image')->insert(array('dataid' => $tid, 'datatype' => 'task', 'image' => $pic));
                 }
             }
             $this->showSuccess('save_succeed');
         } else {
             $this->showError('undefined_action');
         }
     } else {
         global $G, $lang;
         $task = $this->t('task')->where(array('uid' => $this->uid, 'tid' => $tid))->selectOne();
         if (!$task) {
             $this->showError('page_notfound');
         }
         $pics = $this->t('image')->where(array('dataid' => $tid, 'datatype' => 'task'))->select();
         if ($pics) {
             $newlist = array();
             foreach ($pics as $plist) {
                 $plist['url'] = image($plist['image']);
                 $newlist[] = $plist;
             }
             $pics = $newlist;
             unset($newlist);
         }
         $categorylist = $this->getCategoryList();
         $category = new \Core\Category();
         $category->dataList = $categorylist;
         $categoryoptions = $category->getOptions(0, $task['catid']);
         include template('task_form');
     }
 }
开发者ID:xy113,项目名称:XiangBaLaoServer,代码行数:45,代码来源:class.TaskController.php

示例5: getLatLong

function getLatLong($address)
{
    echo "<fieldset><legend>Info about {$address}</legend>";
    $geocodeURL = "https://maps.googleapis.com/maps/api/geocode/xml?";
    $address = "address=" . urlencode($address);
    $key = "key=AIzaSyD66xa224cyoktCawBN9CfMjPwzG6JVoYM";
    $geocoderequest = "{$geocodeURL}{$address}" . "&" . $key;
    //die( "The url is >" . $geocoderequest . "<" );
    $xml = new SimpleXMLElement(file_get_contents($geocoderequest));
    if ($xml->status != 'OK') {
        $status = $xml->error_message;
        die("bad result status {$status}");
    }
    $loc = getLocation($xml);
    echo "<pre>";
    print_r($xml);
    echo "</pre>";
    return $loc;
}
开发者ID:lowriek,项目名称:CSCI1154_Examples,代码行数:19,代码来源:geocodes.php

示例6: userinfo

 function userinfo()
 {
     if ($_POST) {
         $data['uname'] = t($_POST['nickname']);
         if (mb_strlen($data['uname'], 'UTF8') > 10) {
             $this->error('昵称不能超过10个字符');
         }
         $data['sex'] = intval($_POST['sex']);
         $data['province'] = intval($_POST['area_province']);
         $data['city'] = intval($_POST['area_city']);
         $data['location'] = getLocation($data['province'], $data['city']);
         $data['is_init'] = 1;
         M('user')->where('uid=' . $this->mid)->data($data)->save();
         redirect(U('home/public/followuser'));
     } else {
         $this->display();
     }
 }
开发者ID:laiello,项目名称:thinksns-2,代码行数:18,代码来源:PublicAction.class.php

示例7: error_reporting

<?php

error_reporting(E_ALL);
if (isset($_GET['classLocationId'])) {
    $classLocationId = $_GET['classLocationId'];
}
$chooseState = getAllState($dbconn);
$location = getLocation($dbconn, $classLocationId);
$contactId = $location['contactId'];
try {
    if (isset($_POST['edit'])) {
        //valildators
        $tlname = trim($_POST['locationName']);
        //eliminate accidental space
        if (empty($tlname)) {
            $errors['locationName'] = 'Please create a class name you will remember.';
        } else {
            if (!preg_match("/^[a-zA-Z0-9’'. -]+\$/", $_POST['locationName'])) {
                $errors['locationName'] = 'Please use appropriate format. Letters and numbers only.';
            }
        }
        $tadd = trim($_POST['address']);
        //eliminate accidental space
        if (empty($tadd)) {
            $errors['address'] = 'Please give us the address';
        } else {
            if (!preg_match("/^[a-zA-Z0-9’'. -]+\$/", $_POST['address'])) {
                $errors['address'] = 'Please use appropriate format.';
            }
        }
        $tadd2 = trim($_POST['address2']);
开发者ID:TXNWG,项目名称:fytme,代码行数:31,代码来源:trLocationsc.php

示例8: welcome

 /**
  * Welcome page
  *
  * @return string
  */
 public function welcome()
 {
     $oSession = $this->getInstance("oxSetupSession");
     //setting admin area default language
     $sAdminLang = $oSession->getSessionParam('setup_lang');
     $this->getInstance("oxSetupUtils")->setCookie("oxidadminlanguage", $sAdminLang, time() + 31536000, "/");
     $oView = $this->getView();
     $oView->setTitle('STEP_1_TITLE');
     $oView->setViewParam("aCountries", getCountryList());
     $oView->setViewParam("aLocations", getLocation());
     $oView->setViewParam("sSetupLang", $this->getInstance("oxSetupLang")->getSetupLang());
     $oView->setViewParam("sLocationLang", $oSession->getSessionParam('location_lang'));
     $oView->setViewParam("sCountryLang", $oSession->getSessionParam('country_lang'));
     return "welcome.php";
 }
开发者ID:JulianaSchuster,项目名称:oxid-frontend,代码行数:20,代码来源:oxsetup.php

示例9: getLocation

            $markup .= <<<MARKUP
<tr><td>{$key}</td><td>{$value}</td></tr>
MARKUP;
        }
        $markup .= '</table>';
    }
    if ($self) {
        return $markup;
    } else {
        echo $markup;
    }
}
if (!empty($_GET['ip'])) {
    getLocation();
} else {
    $result = getLocation(true);
    $html = <<<MARKUP
<html>
<head><title>IP Locator</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.9.0/build/reset-fonts-grids/reset-fonts-grids.css"> 
<style type="text/css">
#bd{
    margin-top: 25px;
    border: 1px solid #C0C0C0;
    border-radius: 8px 8px 8px 8px;
    margin-top: 25px;
    padding: 25px; 
}
#submit_form{
    text-align: center;
}
开发者ID:ravikiranj,项目名称:misc-tools,代码行数:31,代码来源:ip_locator_ajax.php

示例10: listBetween

 private function listBetween($offerIn, $model, $is_calendar = true)
 {
     $now = time();
     $collection = lib('collection');
     $quantity = $offerIn->quantity;
     $options = $offerIn->options;
     $language = $offerIn->language;
     $distance_maxB = $offerIn->distance_max;
     $start = $offerIn->start;
     $tolerance = $offerIn->tolerance;
     $oresellerid = $offerIn->reseller_id;
     $segment_id = $offerIn->segment_id;
     $start = is_null($start) ? $now + 4 * 3600 : $start;
     $tolerance = is_null($tolerance) ? 0 : $tolerance;
     $distance_maxB = is_null($distance_maxB) ? 0 : (double) $distance_maxB;
     $delai = $start - $now;
     $livraison = false;
     if (isset($options['shipping_costs'])) {
         if (isset($options['shipping_costs']['default'])) {
             $livraison = 'oui' == $options['shipping_costs']['default'] ? true : false;
         }
     }
     if ($delai <= 0) {
         return [];
     }
     $delai /= 3600;
     $list = Arrays::get($model, 'formulaire_achat.elements.quantity.values', []);
     $unite = Arrays::get($model, 'formulaire_achat.elements.quantity.unite', 'heure');
     $optionsPrice = Arrays::get($model, 'formulaire_achat.elements.quantity.options.price', []);
     $optionsDiscount = Arrays::get($model, 'formulaire_achat.elements.quantity.options.discount', []);
     $optionsFixedCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.fixed_costs', []);
     $optionsTravelCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.travel_costs', []);
     $optionsShippingCosts = Arrays::get($model, 'formulaire_achat.elements.quantity.options.shipping_costs', []);
     $locOfferIn = getLocation($offerIn);
     $queryproducts = Model::Product()->where(['segment_id', '=', $segment_id])->where(['sellzone_id', '=', $offerIn->sellzone_id]);
     if (!is_null($oresellerid)) {
         $queryproducts->where(['reseller_id', '=', (int) $oresellerid]);
     }
     $products = $queryproducts->exec(true);
     foreach ($products as $product) {
         $price = $product->price;
         $fixed_costs = $product->fixed_costs;
         $shipping_costs = $product->shipping_costs;
         $travel_costs = $product->travel_costs;
         $discount = $product->discount;
         $delai_presta = lib('option')->get('delai.intervention', $product, false);
         $montant_min = (double) lib('option')->get('montant.intervention', $product, 0);
         $distance_max = (double) lib('option')->get('zone.intervention', $product, 0);
         if (false !== $delai_presta) {
             if ($delai < $delai_presta) {
                 continue;
             }
         }
         $fixed_costs_free_from_price = 0;
         if (is_null($fixed_costs) || !is_array($fixed_costs)) {
             $fixed_costs = 0;
         } else {
             if (isset($fixed_costs['default'])) {
                 if (isset($fixed_costs['default']['value'])) {
                     $fixed_costs = (double) $fixed_costs['default']['value'];
                 }
                 if (isset($fixed_costs['default']['free_from_price'])) {
                     $fixed_costs_free_from_price = (double) $fixed_costs['default']['free_from_price'];
                 }
             } else {
                 $fixed_costs = 0;
             }
         }
         $travel_costs_free_from_price = 0;
         if (is_null($travel_costs) || !is_array($travel_costs)) {
             $travel_costs = 0;
         } else {
             if (isset($travel_costs['default'])) {
                 if (isset($travel_costs['default']['value'])) {
                     $travel_costs = (double) $travel_costs['default']['value'];
                 }
                 if (isset($travel_costs['default']['free_from_price'])) {
                     $travel_costs_free_from_price = (double) $travel_costs['default']['free_from_price'];
                 }
             } else {
                 $travel_costs = 0;
             }
         }
         if (true === $livraison) {
             $shipping_costs_free_from_price = 0;
             if (is_null($shipping_costs) || !is_array($shipping_costs)) {
                 $shipping_costs = 0;
             } else {
                 if (isset($shipping_costs['default'])) {
                     if (isset($shipping_costs['default']['value'])) {
                         $shipping_costs = (double) $shipping_costs['default']['value'];
                     }
                     if (isset($shipping_costs['default']['free_from_price'])) {
                         $shipping_costs_free_from_price = (double) $shipping_costs['default']['free_from_price'];
                     }
                 } else {
                     $shipping_costs = 0;
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:schpill,项目名称:standalone,代码行数:101,代码来源:modelzl.php

示例11: elseif

    } elseif (preg_match('/Edge/i', $agente)) {
        $navegador = 'Microsoft Edge';
    } elseif (preg_match('/Spartan/i', $agente)) {
        $navegador = 'Microsoft Spartan';
    } elseif (preg_match('/Firefox/i', $agente)) {
        $navegador = 'Mozilla Firefox';
    } elseif (preg_match('/Chromium/i', $agente)) {
        $navegador = "Chromium";
    } elseif (preg_match('/Chrome/i', $agente)) {
        $navegador = "Chrome";
    } elseif (preg_match('/Safari/i', $agente)) {
        $navegador = 'Safari';
    } elseif (preg_match('/Opera Mini/i', $agente)) {
        $navegador = 'Opera Mini';
    } elseif (preg_match('/Opera/i', $agente)) {
        $navegador = 'Opera';
    } elseif (preg_match('/Netscape/i', $agente)) {
        $navegador = 'Netscape';
    } elseif (preg_match('/UCBrowser/i', $agente)) {
        $navegador = 'UC Browser';
    } else {
        $navegador = "Desconocido";
    }
    return $navegador;
}
echo "<b>IP:</b> " . $_SERVER['REMOTE_ADDR'] . "<br>";
echo "<b>Ubicaci&oacute;n</b>: " . getLocation('ciudad_pais') . "<br>";
echo "<b>Navegador:</b> " . getBrowser() . "<br>";
echo "<b>SO:</b> " . getSO() . " " . getArquitecture() . "<br>";
//echo($_SERVER['HTTP_USER_AGENT']);
echo '</body></html>';
开发者ID:amirtorrez,项目名称:Guest-Info,代码行数:31,代码来源:userinfo.php

示例12: makeOffersOut

 public function makeOffersOut($offerin)
 {
     $collection = [];
     $errors = [];
     $infos = [];
     $resellers = [];
     $minStartDelay = Config::get('offerin.delay', 115) * 60;
     $model = lib('model')->getStaticModel((int) $offerin->segment_id);
     $isCalendar = isAke($model, 'is_calendar', true);
     $now = time();
     $isPro = false;
     if (!isset($offerin->sellzone_id)) {
         $offerin->sellzone_id = 1;
         $offerin->save();
     }
     if (isset($offerin->company_id)) {
         $address = Model::Companyaddress()->findOrFail((int) $offerin->address_id);
         $isPro = true;
     } else {
         $address = Model::Accountaddress()->findOrFail((int) $offerin->address_id);
     }
     if (true === $isPro) {
         if (!isset($offerin->company_id)) {
             $offerin->company_id = (int) $address->company_id;
             $offerin = $offerin->save();
         }
     } else {
         if (!isset($offerin->account_id)) {
             $offerin->account_id = (int) $address->account_id;
             $offerin = $offerin->save();
         }
     }
     $locationOffer = lib('utils')->remember('get.location.address.' . $address->id, function ($address) {
         return getLocation($address);
     }, $isPro ? Model::Companyaddress()->getAge() : Model::Accountaddress()->getAge(), [$address]);
     if (empty($locationOffer)) {
         $coords = lib('geo')->getCoords($address->address . ' ' . $address->zip . ' ' . $address->city, 250);
         setLocation($address, $coords['lng'], $coords['lat']);
         $locationOffer = ['lng' => $coords['lng'], 'lat' => $coords['lat']];
     }
     $segment_id = (int) $offerin->segment_id;
     $family = repo('segment')->getFamilyfromItem((int) $segment_id);
     if (!empty($family)) {
         $market = current($family);
         $market_id = (int) $market['id'];
     } else {
         $market_id = $segment_id;
     }
     $offer = $offerin->toArray();
     if (isset($offer['date']) && isset($offer['time'])) {
         list($y, $m, $d) = explode('-', $offer['date'], 3);
         list($h, $i, $s) = explode(':', $offer['time'], 3);
         $start = mktime($h, $i, $s, $m, $d, $y);
     } else {
         $start = $offerin->created_at;
     }
     if ($start < $now) {
         $errors['starttime_error'] = 'Start time [' . date('Y-m-d H:i:s', $start) . '] is before now.';
     }
     $delaySeconds = $start - $now;
     $delai = (double) round($delaySeconds / 3600, 2);
     if ($delaySeconds < $minStartDelay) {
         $errors['delay_incorrect'] = 'The delay is incorrect [' . $delaySeconds . ' seconds]. The delay me be at less egual to ' . $minStartDelay . ' seconds.';
         return ['resellers' => $resellers, 'offers' => $collection, 'errors' => $errors, 'infos' => $infos];
     }
     $langue = $offerin->langue;
     if (!strlen($langue) || empty($langue) || strtolower($langue) == 'non') {
         $langue = false;
     }
     if ($langue) {
         $langues = lib('forms')->getLanguagesFromSegmentId($segment_id);
         if (!in_array($langue, $langues)) {
             $langue = false;
         }
     }
     $this->cleanToPay($offerin->segment_id);
     $products = Model::Productdata()->where(['segment_id', '=', (int) $offerin->segment_id])->where(['sellzone_id', '=', (int) $offerin->sellzone_id])->cursor();
     foreach ($products as $product) {
         $item = [];
         $reseller = Model::Reseller()->model($product['reseller']);
         $company = Model::Company()->model($product['company']);
         // $company    = Model::Company()->where(['reseller_id', '=', (int) $product['reseller_id']])->first(true);
         if ($reseller && $company) {
             // $statusId = (int) lib('status')->getId('reseller', 'REGISTER');
             if (false === $product['status']) {
                 $infos[$reseller->id]['status'] = true;
                 continue;
             }
             $infos[$reseller->id] = [];
             $options = $product['options'];
             $hasAgenda = isAke($options, 'has_agenda', false);
             // $hasAgenda = lib('option')->get('agenda.partage', $reseller, false);
             $item['reseller_calendar'] = $hasAgenda;
             $item['reseller_id'] = $reseller->id;
             $item['segment_id'] = $segment_id;
             if (true === $isPro) {
                 $item['company_id'] = $offer['company_id'];
             } else {
                 $item['account_id'] = $offer['account_id'];
             }
//.........这里部分代码省略.........
开发者ID:schpill,项目名称:standalone,代码行数:101,代码来源:offerin.php

示例13: showSpaceCard

 public function showSpaceCard()
 {
     $uid = intval($_GET['uid']);
     if ($uid) {
         $data = getUserInfo($uid);
         $usertags = D('UserTag')->getUserTagList($this->uid);
         foreach ($usertags as $v) {
             $tags[] = '<a href="' . U('home/User/searchtag', array('k' => $v['tag_name'])) . '">' . $v['tag_name'] . '</a>';
         }
         $data['location'] = getLocation($data['province'], $data['city']);
         if (!$data['location']) {
             $data['location'] = '<br />';
         }
         $data['tags'] = !$tags ? 'None' : implode(' ', $tags);
         $data['following_url'] = U('home/Space/follow', array('type' => 'following', 'uid' => $uid));
         $data['follower_url'] = U('home/Space/follow', array('type' => 'follower', 'uid' => $uid));
         $data['space_url'] = U('home/Space/index', array('uid' => $uid));
         $data['space_link'] = getUserSpace($uid, 'nocard', '_blank');
         $data['follow_state'] = $this->mid == $uid ? 'self' : D('Follow', 'weibo')->getState($this->mid, $uid, 0);
         $this->ajaxReturn($data, L('get_success'), 1);
     } else {
         $this->ajaxReturn('', L('get_success'), 0);
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:24,代码来源:SpaceAction.class.php

示例14: renderServerReport

function renderServerReport()
{
    $aResult = array();
    $iTotal = 0;
    $sFilter = '{$typeid_4}';
    # typeid_4 = Server
    foreach (scanRealmByText('object', $sFilter) as $Result) {
        $aResult[$Result['id']] = array();
        $aResult[$Result['id']]['sName'] = $Result['name'];
        // Create active links in comment
        $aResult[$Result['id']]['sComment'] = $Result['comment'];
        // Load additional attributes:
        $attributes = getAttrValues($Result['id']);
        $aResult[$Result['id']]['sContact'] = '';
        if (isset($attributes['14']['a_value'])) {
            $aResult[$Result['id']]['sContact'] = $attributes['14']['a_value'];
        }
        $aResult[$Result['id']]['HWtype'] = '';
        if (isset($attributes['2']['a_value'])) {
            $aResult[$Result['id']]['HWtype'] = $attributes['2']['a_value'];
        }
        $aResult[$Result['id']]['OEMSN'] = '';
        if (isset($attributes['1']['a_value'])) {
            $aResult[$Result['id']]['OEMSN'] = $attributes['1']['a_value'];
        }
        $aResult[$Result['id']]['HWExpDate'] = '';
        if (isset($attributes['22']['value'])) {
            $aResult[$Result['id']]['HWExpDate'] = date("Y-m-d", $attributes['22']['value']);
        }
        $aResult[$Result['id']]['sOS'] = '';
        if (isset($attributes['4']['a_value'])) {
            $aResult[$Result['id']]['sOS'] = $attributes['4']['a_value'];
        }
        $aResult[$Result['id']]['sSlotNumber'] = 'unknown';
        if (isset($attributes['28']['a_value']) && $attributes['28']['a_value'] != '') {
            $aResult[$Result['id']]['sSlotNumber'] = $attributes['28']['a_value'];
        }
        // Location
        $aResult[$Result['id']]['sLocation'] = getLocation($Result);
        // IP Informations
        $aResult[$Result['id']]['ipV4List'] = getObjectIPv4AllocationList($Result['id']);
        $aResult[$Result['id']]['ipV6List'] = getObjectIPv6AllocationList($Result['id']);
        // Port (MAC) Informations
        $aResult[$Result['id']]['ports'] = getObjectPortsAndLinks($Result['id']);
        $iTotal++;
    }
    if (isset($_GET['csv'])) {
        header('Content-type: text/csv');
        header('Content-Disposition: attachment; filename=export_' . date("Ymdhis") . '.csv');
        header('Pragma: no-cache');
        header('Expires: 0');
        $outstream = fopen("php://output", "w");
        $aCSVRow = array('Name', 'MAC', 'IP(s)', 'Comment', 'Contact', 'Type', 'OEM', 'HW Expire Date', 'OS', 'Location');
        fputcsv($outstream, $aCSVRow);
        foreach ($aResult as $id => $aRow) {
            $aCSVRow = array();
            $aCSVRow[0] = $aRow['sName'];
            $aCSVRow[1] = '';
            foreach ($aRow['ports'] as $portNumber => $aPortDetails) {
                if (trim($aPortDetails['l2address']) != '') {
                    $aCSVRow[1] .= $aPortDetails['l2address'] . ' ';
                }
            }
            $aCSVRow[1] = trim($aCSVRow[1]);
            $aCSVRow[2] = '';
            foreach ($aRow['ipV4List'] as $key => $aDetails) {
                if (function_exists('ip4_format')) {
                    $key = ip4_format($key);
                }
                if (trim($key) != '') {
                    $aCSVRow[2] .= $key . ' ';
                }
            }
            foreach ($aRow['ipV6List'] as $key => $aDetails) {
                if (function_exists('ip6_format')) {
                    $key = ip6_format($key);
                }
                if (trim($key) != '') {
                    $aCSVRow[2] .= $key . ' ';
                }
            }
            $aCSVRow[2] = trim($aCSVRow[2]);
            $aCSVRow[3] = str_replace('&quot;', "'", $aRow['sComment']);
            $aCSVRow[4] = $aRow['sContact'];
            $aCSVRow[5] = $aRow['HWtype'];
            $aCSVRow[6] = $aRow['OEMSN'];
            $aCSVRow[7] = $aRow['HWExpDate'];
            $aCSVRow[8] = $aRow['sOS'];
            $aCSVRow[9] = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $aRow['sLocation']);
            fputcsv($outstream, $aCSVRow);
        }
        fclose($outstream);
        exit(0);
        # Exit normally after send CSV to browser
    }
    // Load stylesheet and jquery scripts
    addCSS('css/extensions/style.css');
    addJS('js/extensions/jquery-latest.js');
    addJS('js/extensions/jquery.tablesorter.js');
    addJS('js/extensions/picnet.table.filter.min.js');
//.........这里部分代码省略.........
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:101,代码来源:server-report.php

示例15: date

        ?>
</TD>
				<td style="width: 22%"><?php 
        echo $InventoryRow["product_name"];
        ?>
</td>
				<td style="width: 22%"><?php 
        echo date("m/d/Y", strtotime($InventoryRow["DateAdded"]));
        ?>
</td>
				<td style="width: 16%"><?php 
        echo $InventoryRow["status_name"];
        ?>
</td>
				<td style="width: 28%; white-space:nowrap;"><?php 
        echo getLocation($InventoryRow["invStatus"], $InventoryRow["invStatusData"]);
        ?>
</td>
			</TR> 
			<?php 
    }
} else {
    ?>
				<TR class="even">
					<td colspan="5">No Matching Inventory Found</td>
				</TR>
			<?php 
}
?>
		</TBODY>
开发者ID:aedvalson,项目名称:Nexus,代码行数:30,代码来源:NexusReport_Inventory.php


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