• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getDomain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: index

 public function index()
 {
     if ($this->isPost()) {
         $params = $this->input->post();
         $return_url = $params['return_url'];
         unset($params['return_url']);
         $ret = $this->user_model->checkLogin($params);
         if ($ret) {
             if ($return_url) {
                 $result = array_for_result(true, 'login success', array(), $return_url);
             } else {
                 $result = array_for_result(true, 'login success', array(), '/index.php/tips/index');
             }
             $cookie_d['u_id'] = $ret;
             $cookie_d['sso_key'] = encrypt_string_by_time();
             $cookie_data = json_encode($cookie_d);
             setcookie('admin_permit', $cookie_data, time() + 3600, '/', getDomain($_SERVER['HTTP_HOST']));
         } else {
             $result = array_for_result(false, 'login failed');
         }
         $this->renderJsonp($result, $params);
     } else {
         $params = $this->input->get();
         $return_url = isset($params['returnurl']) ? $params['returnurl'] : '';
         $data['title'] = 'Login';
         $data['return_url'] = $return_url;
         $this->render('login/index', $data);
     }
 }
开发者ID:fixbugs,项目名称:tips,代码行数:29,代码来源:Login.php


示例2: createData

 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     if ($this->params['sort'] != 2) {
         $this->supportCached();
     }
     switch ($this->params['sort']) {
         default:
         case 1:
             $sort = "sort";
             break;
         case 2:
             $sort = "RAND()";
             break;
     }
     $where = "i.idsec={$this->section_id}";
     if ($this->params['idalb'] > 0) {
         $where .= " AND i.iditem=" . (int) $this->params['idalb'];
     } elseif ($this->params['idcat'] > 0) {
         if ($idalbs = A::$DB->getCol("SELECT id FROM {$this->section}_albums WHERE idcat=" . (int) $this->params['idcat'])) {
             $where .= " AND (i.iditem=" . implode(" OR i.iditem=", $idalbs) . ")";
         }
     }
     $images = array();
     A::$DB->query("\r\r\n\tSELECT i.* FROM " . getDomain($this->section) . "_images AS i\r\r\n\tLEFT JOIN {$this->section}_albums AS a ON a.id=i.iditem\r\r\n\tWHERE {$where} AND a.active='Y' ORDER BY {$sort}" . (!empty($this->params['rows']) ? " LIMIT 0," . (int) $this->params['rows'] : ""));
     while ($row = A::$DB->fetchRow()) {
         if (isset($links[$row['iditem']])) {
             $row['link'] = $links[$row['iditem']];
         } else {
             $row['link'] = $links[$row['iditem']] = gallery_createItemLink($row['iditem'], $this->section);
         }
         $images[] = $row;
     }
     $this->Assign("images", $images);
 }
开发者ID:procivam,项目名称:s-mir-new,代码行数:37,代码来源:gallery.php


示例3: getUri

/**
 * This helper function can be used to get a valid uri from an url and return it.
 *
 * @param string $url
 *
 * @return mixed
 */
function getUri($url)
{
    if (!empty($url)) {
        // Sanitize URL first by removing unwanted chars
        $url = preg_replace("/[\n\r]/", '', $url);
        // Sanitize URL accourding to RFC1738 (perhaps use RFC3986?)
        $entities = [' '];
        $replacements = ['%20'];
        $url = str_replace($entities, $replacements, $url);
        // Check weither the domain is actually valid
        if (getDomain($url) == false) {
            return false;
        }
        $pslManager = new Pdp\PublicSuffixListManager();
        $urlParser = new Pdp\Parser($pslManager->getList());
        $urlData = $urlParser->parseUrl($url)->toArray();
        $path = $urlData['path'] . (!empty($urlData['query']) ? '?' . $urlData['query'] : '');
        // Set the path to root if empty (default)
        if (empty($path)) {
            $path = '/';
        }
        // Sanitize PATH accourding to RFC1738 (perhaps use RFC3986?)
        $entities = [' '];
        $replacements = ['%20'];
        $path = str_replace($entities, $replacements, $path);
        return $path;
    } else {
        return false;
    }
}
开发者ID:ihatehandles,项目名称:AbuseIO,代码行数:37,代码来源:getUri.php


示例4: check_permission

 public function check_permission()
 {
     $WebSiteID = $this->session->userdata('WebSiteID');
     $GroupID = $this->session->userdata('GroupID');
     $AccID = $this->session->userdata('AccID');
     $PreWebSiteID = $this->session->userdata('WebSiteID');
     $url = trim($this->uri->uri_string());
     $routestring = explode('/', $url);
     $controller = @$routestring[0];
     $method = @$routestring[1];
     $WebID = $WebSiteID;
     $curr_class = @$controller;
     $curr_method = @$method;
     if (trim($curr_class) == '') {
         $curr_class = "redirect";
     }
     if (trim($curr_method) == '') {
         $curr_method = "index";
     }
     $controllerfile = 'application/controllers/' . $WebID . '/' . $curr_class . '.php';
     if (!file_exists($controllerfile)) {
         if ($curr_class == 'ajax') {
             $controllerfile = 'application/controllers/ajax.php';
         } else {
             $controllerfile = 'application/controllers/common/' . $curr_class . '.php';
             if (!file_exists($controllerfile)) {
                 $curr_class = "redirect";
                 $curr_method = "index";
             }
         }
     }
     $sql = "SELECT WebSiteID, Suspend FROM tbl_websites WITH (NOLOCK) WHERE Domain='" . mssql_real_escape_string(getDomain()) . "' AND Activate=1 AND StartTime< GETDATE() AND GETDATE()< ExpireTime";
     $query = $this->db->query($sql);
     $rowcount = $query->num_rows();
     if ($rowcount > 0) {
         $row = $query->row();
         if ($row->Suspend) {
             //show suspend page
             echo "suspend";
             show_404();
         } else {
             $WebSiteID = $row->WebSiteID;
             $this->session->set_userdata('WebSiteID', $row->WebSiteID);
         }
     } else {
         show_404();
     }
     if ($GroupID == '' || $GroupID === false) {
         $GroupID = 'public';
         $this->session->set_userdata('GroupID', $GroupID);
     }
     $sql = "SELECT count(*) total FROM tbl_websites_accounts_groups_models WITH (NOLOCK) WHERE Activate=1 AND GroupID='" . mssql_real_escape_string($GroupID) . "' AND ModelID='" . mssql_real_escape_string($curr_class) . "' AND (AccID='" . mssql_real_escape_string($AccID) . "' OR AccID='') AND (WebSiteID='" . mssql_real_escape_string($WebSiteID) . "' OR WebSiteID='')";
     $query = $this->db->query($sql);
     $row = $query->row();
     $total = $row->total;
     if ($total <= 0) {
         show_404();
     }
 }
开发者ID:mdbhk,项目名称:retailersurvey.themdbfamily.com,代码行数:59,代码来源:permission_model.php


示例5: getSocialUser

function getSocialUser()
{
    global $twitterFollowers;
    global $facebookFriends;
    global $relationshipStatus;
    global $politicalViews;
    global $logFileHandle;
    $thisUser = getUserBasics();
    $yob = substr($thisUser["birthday"], 0, 4);
    $age = date("Y") - $yob;
    $userValues["domain"] = getDomain();
    fwrite($logFileHandle, "<p>The domain is " . $userValues["domain"]);
    $userValues["identifier"] = getIdentifier($userValues["domain"]);
    /******************* Facebook ************************/
    if ($userValues["domain"] == "facebook.com") {
        if ($age > 18 && rand(1, 100) > 20) {
            $userValues["profile"]["relationshipStatus"] = getRelationshipStatus($age);
        }
        // if (!empty($relStatus)) { $userValues["profile"]["relationshipStatus"] = $relStatus; }
        // get political views
        if ($thisUser["primaryAddress"]["country"] == "United States") {
            if (rand(1, 100) > 61) {
                $polViews = getRandomValue($politicalViews);
                $userValues["profile"]["politicalViews"] = skewPoliticalViews($polViews, $age, $thisUser["gender"], $thisUser["primaryAddress"]["stateAbbreviation"]);
            }
        }
        $range = getRandomValue($facebookFriends);
        $numberOfFBfriends = rand($range["min"], $range["max"]);
        fwrite($logFileHandle, "<p>The number of friends is: " . $numberOfFBfriends);
        $userValues["friends"] = getFriendsOrFollowersArray($numberOfFBfriends, $userValues["domain"]);
        //*************** Interests, Movies, Books, Music **************/
        // parameters: &attribute_name=profiles%23181683&uuid=ea1bc321-4320-4fbb-8f07-fb939b90cf46&value={"profile":{"interests":[{"interest":"scrapbooking"},{"interest":"cats"},{"interest":"dogs"}],"movies":[{"movie":"Platoon"},{"movie":"Star+Trek+Into+Darkness"}],"books":[{"book":"Call+It+Sleep"},{"book":"The+Death+of+the+Heart"},{"book":"The+French+Lieutenant%27s+Woman"}],"music":[{"music":"Britney+Spears"}]}}
        $psychInfoTypes = array("interests" => "interest", "movies" => "movie", "books" => "book", "music" => "music");
        foreach ($psychInfoTypes as $categoryName => $itemName) {
            $numberOfItems = getNumberOfItems($itemName);
            $itemString = $itemName . "s";
            if ($itemName == "music") {
                $itemString = $itemName . " artists";
            }
            fwrite($logFileHandle, "<p>The number of {$itemString} is: " . $numberOfItems);
            if ($numberOfItems > 0) {
                $userValues["profile"][$categoryName] = getItems($itemName, $numberOfItems);
            }
        }
    }
    /********************* Twitter ***********************/
    if ($userValues["domain"] == "twitter.com") {
        $range = getRandomValue($twitterFollowers);
        $numberOfTWfollowers = rand($range["min"], $range["max"]);
        fwrite($logFileHandle, "<p>The number of followers is: " . $numberOfTWfollowers);
        $userValues["followers"] = getFriendsOrFollowersArray($numberOfTWfollowers, $userValues["domain"]);
    }
    $thisUser["profiles"] = array();
    $thisUser["profiles"][] = $userValues;
    return $thisUser;
}
开发者ID:tomgsmith99,项目名称:j-rug,代码行数:56,代码来源:getSocialUser.php


示例6: createData

 /**
  * Формирование данных доступных в шаблоне.
  */
 function createData()
 {
     if ($this->params['sort'] != 5) {
         $this->supportCached();
     }
     $this->params['idcat'] = (int) $this->params['idcat'];
     $this->params['rows'] = (int) $this->params['rows'];
     if ($this->params['idcat']) {
         $catrow = A::$DB->getRowById($this->params['idcat'], "{$this->section}_categories");
         $catrow['link'] = gallery_createCategoryLink($this->params['idcat'], $this->section);
         $this->Assign("category", $catrow);
     }
     switch ($this->params['sort']) {
         default:
         case 1:
             $sort = "date DESC";
             break;
         case 2:
             $sort = "date";
             break;
         case 3:
             $sort = "name";
             break;
         case 4:
             $sort = "sort";
             break;
         case 5:
             $sort = "RAND()";
             break;
     }
     $sql = "\r\r\n\tSELECT *,svote/cvote AS vote FROM {$this->section}_albums\r\r\n\tWHERE active='Y'" . ($this->params['idcat'] ? " AND idcat={$this->params['idcat']}" : "") . (!empty($this->params['filter']) ? " AND {$this->params['filter']}" : "") . "\r\r\n\tORDER BY {$sort}";
     if ($this->params['rows']) {
         A::$DB->queryLimit($sql, 0, $this->params['rows']);
     } else {
         A::$DB->query($sql);
     }
     $albums = array();
     while ($row = A::$DB->fetchRow()) {
         $row['category'] = getTreePath($this->section . "_categories", $row['idcat']);
         $row['link'] = gallery_createItemLink($row['id'], $this->section);
         $row['vote'] = round($row['vote'], 2);
         $row['images'] = A::$DB->getAll("\r\r\n\t  SELECT * FROM " . getDomain($this->section) . "_images\r\r\n\t  WHERE idsec=? AND iditem=? ORDER BY sort", array($this->section_id, $row['id']));
         if ($this->options['usetags']) {
             $row['tags'] = A_SearchEngine::getInstance()->convertTags($row['tags']);
         }
         prepareValues($this->section, $row);
         $row = A::$OBSERVER->Modifier('gallery_prepareValues', $this->section, $row);
         $albums[] = $row;
     }
     A::$DB->free();
     $this->Assign("albums", $albums);
 }
开发者ID:procivam,项目名称:s-mir-new,代码行数:55,代码来源:albums.php


示例7: parse

 /**
  * Parse attachments
  * @return array    Returns array with failed or success data
  *                  (See parser-common/src/Parser.php) for more info.
  */
 public function parse()
 {
     $reports = [];
     if ($this->parsedMail->getHeader('subject') == "[SpamCop] summary report") {
         $this->feedName = 'summary';
         $reports = $this->parseSummaryReport();
     } elseif ($this->parsedMail->getHeader('subject') == "[SpamCop] Alert") {
         $this->feedName = 'alert';
         $reports = $this->parseAlerts();
     } elseif (strpos($this->parsedMail->getHeader('from'), "@reports.spamcop.net") !== false && $this->arfMail !== false) {
         $this->feedName = 'spamreport';
         $reports = $this->parseSpamReportArf();
     } elseif (strpos($this->parsedMail->getHeader('from'), "@reports.spamcop.net") !== false && strpos($this->parsedMail->getMessageBody(), '[ Offending message ]')) {
         $this->feedName = 'spamreport';
         $reports = $this->parseSpamReportCustom();
     } else {
         $this->warningCount++;
     }
     foreach ($reports as $report) {
         // If feed is known and enabled, validate data and save report
         if ($this->isKnownFeed() && $this->isEnabledFeed()) {
             // Sanity check
             if ($this->hasRequiredFields($report) === true) {
                 // incident has all requirements met, filter and add!
                 $report = $this->applyFilters($report);
                 if (!empty($report['Spam-URL'])) {
                     $url = $report['Spam-URL'];
                 }
                 if (!empty($report['Reported-URI'])) {
                     $url = $report['Reported-URI'];
                 }
                 if (!empty($url)) {
                     $urlData = getUrldata($url);
                     if (!empty($urlData['host']) && !empty($urlData['path'])) {
                         $this->feedName = 'spamvertizedreport';
                     }
                 }
                 $incident = new Incident();
                 $incident->source = config("{$this->configBase}.parser.name");
                 $incident->source_id = false;
                 $incident->ip = $report['Source-IP'];
                 $incident->domain = empty($url) ? false : getDomain($url);
                 $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class");
                 $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type");
                 $incident->timestamp = strtotime($report['Received-Date']);
                 $incident->information = json_encode($report);
                 $this->incidents[] = $incident;
             }
         }
     }
     return $this->success();
 }
开发者ID:abuseio,项目名称:parser-spamcop,代码行数:57,代码来源:Spamcop.php


示例8: archive_createSection

/**
 * Обработчик события "Создание раздела".
 *
 * @param string $section Полный строковой идентификатор раздела.
 * @param array $params Параметры события.
 */
function archive_createSection($section, $params)
{
    if ($params['module'] == 'archive') {
        $ids = A::$DB->getCol("\r\r\n    SELECT id FROM " . getDomain($section) . "_sections\r\r\n\tWHERE module='catalog' AND (lang='" . A::$LANG . "' OR lang='all')");
        setOption($section, 'sections', serialize($ids));
    } elseif ($params['module'] == 'catalog') {
        if ($archive = getSectionByModule('archive')) {
            $ids = getOption($archive, 'sections');
            $ids = !empty($ids) ? unserialize($ids) : array();
            $ids[] = $params['id'];
            setOption($archive, 'sections', serialize($ids));
        }
    }
}
开发者ID:procivam,项目名称:s-mir-new,代码行数:20,代码来源:include.php


示例9: sitemap_createSection

/**
 * Обработчик события "Создание раздела".
 *
 * @param string $section Полный строковой идентификатор раздела.
 * @param array $params Параметры события.
 */
function sitemap_createSection($section, $params)
{
    if ($params['module'] == 'sitemap') {
        $ids = A::$DB->getCol("SELECT id FROM " . getDomain($section) . "_sections WHERE lang='" . A::$LANG . "' OR lang='all'");
        setTextOption($section, 'sections', serialize($ids));
    } elseif ($sitemap = getSectionByModule('sitemap')) {
        $ids = getTextOption($sitemap, 'sections');
        $ids = !empty($ids) ? unserialize($ids) : array();
        if (!$ids) {
            $ids = array();
        }
        $ids[] = $params['id'];
        setTextOption($sitemap, 'sections', serialize($ids));
    }
}
开发者ID:procivam,项目名称:s-mir-new,代码行数:21,代码来源:include.php


示例10: termSearchByUrl

 public function termSearchByUrl(Request $request)
 {
     $url = $request['url'];
     $connection = getSiteName(getDomain($url));
     $path_alias = getUri($url);
     if (empty($connection) || empty($path_alias)) {
         return AJAX::argumentError();
     }
     $termModule = new TermModule($connection);
     $result = $termModule->getTermInfo(array('path_alias' => $path_alias));
     if (count($result) > 0) {
         return AJAX::success(array('info' => $result));
     } else {
         return AJAX::notExist();
     }
 }
开发者ID:nosun,项目名称:laravel_base,代码行数:16,代码来源:TermController.php


示例11: productSearchByURL

 public function productSearchByURL(Request $request)
 {
     $url = $request['url'];
     $connection = getSiteName(getDomain($url));
     $sn = getSn($url);
     if (empty($connection) || empty($sn)) {
         return AJAX::argumentError();
     }
     $termModule = new ProductModule($connection);
     $result = $termModule->getProductInfo(array('sn' => $sn));
     if (count($result) > 0) {
         return AJAX::success(array('info' => $result));
     } else {
         return AJAX::notExist();
     }
 }
开发者ID:nosun,项目名称:laravel_base,代码行数:16,代码来源:ProductController.php


示例12: parse

 /**
  * Parse attachments
  * @return array    Returns array with failed or success data
  *                  (See parser-common/src/Parser.php) for more info.
  */
 public function parse()
 {
     $xml = simplexml_load_string($this->parsedMail->getMessageBody());
     $timestamp = strtotime($xml->attributes()->date);
     foreach ($xml->list as $reports) {
         $this->feedName = (string) $reports->attributes()->type;
         // If feed is known and enabled, validate data and save report
         if ($this->isKnownFeed() && $this->isEnabledFeed()) {
             foreach ($reports->url_info as $url_info) {
                 $url = (string) $url_info->attributes()->url;
                 $ip = (string) $url_info->attributes()->ip;
                 $urlData = getUrlData($url);
                 if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
                     // No IP supplied by Google
                     if (!empty($urlData['host']) && !filter_var($urlData['host'], FILTER_VALIDATE_IP) === false) {
                         // Hostname is an IP address
                         $ip = $urlData['host'];
                     } else {
                         // We have no IP address, try to get the IP address by resolving the domain
                         $ip = @gethostbyname($urlData['host']);
                         // If it fails, set to localhost
                         $ip = $ip == $urlData['host'] ? '127.0.0.1' : $ip;
                     }
                 }
                 $report = ['domain' => getDomain($url), 'uri' => getUri($url), 'category' => config("{$this->configBase}.feeds.{$this->feedName}.category")];
                 // Sanity check
                 if ($this->hasRequiredFields($report) === true) {
                     // incident has all requirements met, filter and add!
                     $report = $this->applyFilters($report);
                     $incident = new Incident();
                     $incident->source = config("{$this->configBase}.parser.name");
                     $incident->source_id = false;
                     $incident->ip = $ip;
                     $incident->domain = $report['domain'];
                     $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class");
                     $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type");
                     $incident->timestamp = $timestamp;
                     $incident->information = json_encode(array_merge($urlData, $report));
                     $this->incidents[] = $incident;
                 }
             }
         }
     }
     return $this->success();
 }
开发者ID:abuseio,项目名称:parser-google,代码行数:50,代码来源:Google.php


示例13: BuildCleanURL

 /**
  * Builds a Clean URL. Domain name is pulled from getDomain
  *
  * @param string $c the controller object to invoke
  * @param string $m the method of the controller to call
  * @param int $id (optional) the id of the record being updated
  * @param array $qs (optional) array/assoc array/model of query string variables and values
  * @return string a clean URL
  *
  */
 public function BuildCleanURL($c, $m, $id = null, $qs = null)
 {
     $idStr = "";
     $qsStr = "";
     if (is_object($qs)) {
         $qs2 = array();
         foreach ($qs as $k => $v) {
             $qs2[] = "{$k}={$v}";
         }
         $qsStr = "/?" . implode("&", $qs2);
     } elseif (_isArray($qs)) {
         $qsStr = $this->BuildQSFromArray($qs);
     }
     if ($id != null) {
         $idStr = "/" . (string) $id;
     }
     $dir = $this->state == "live" ? "" : "Public/";
     return str_replace(array("~d~", "~dir~", "~c~", "~m~", "~id~", "~qs~"), array(getDomain(), $dir, $c, $m, $idStr, $qsStr), $this->cleanURLTemplate);
 }
开发者ID:guidamedia,项目名称:powerrankings.ui,代码行数:29,代码来源:Url.php


示例14: parse

 /**
  * Parse attachments
  * @return array    Returns array with failed or success data
  *                  (See parser-common/src/Parser.php) for more info.
  */
 public function parse()
 {
     foreach ($this->parsedMail->getAttachments() as $attachment) {
         if (strpos($attachment->filename, '-report.txt') === false) {
             continue;
         }
         // Handle aliasses first
         foreach (config("{$this->configBase}.parser.aliases") as $alias => $real) {
             if ($attachment->filename == "{$alias}-report.txt") {
                 $this->feedName = $real;
                 break;
             }
         }
         if ($this->isKnownFeed() && $this->isEnabledFeed()) {
             // Sanity check
             $report = str_replace("\r", "", $attachment->getContent());
             if (preg_match_all('/([\\w\\-]+): (.*)[ ]*\\r?\\n/', $report, $matches)) {
                 $report = array_combine($matches[1], $matches[2]);
                 if ($this->hasRequiredFields($report) === true) {
                     // incident has all requirements met, filter and add!
                     $report = $this->applyFilters($report);
                     $incident = new Incident();
                     $incident->source = config("{$this->configBase}.parser.name");
                     $incident->source_id = false;
                     $incident->ip = $report['ip'];
                     $incident->domain = empty($report['uri']) ? false : getDomain($report['uri']);
                     $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class");
                     $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type");
                     $incident->timestamp = strtotime($report['last_seen']);
                     $incident->information = json_encode($report);
                     $this->incidents[] = $incident;
                 }
             } else {
                 // Unable to build report
                 $this->warningCount++;
             }
         }
     }
     return $this->success();
 }
开发者ID:abuseio,项目名称:parser-cyscon,代码行数:45,代码来源:Cyscon.php


示例15: parse

 /**
  * Parse attachments
  * @return array    Returns array with failed or success data
  *                  (See parser-common/src/Parser.php) for more info.
  */
 public function parse()
 {
     if ($this->arfMail !== true) {
         $this->feedName = 'default';
         // If feed is known and enabled, validate data and save report
         if ($this->isKnownFeed() && $this->isEnabledFeed()) {
             // To get some more consitency, remove "\r" from the report.
             $this->arfMail['report'] = str_replace("\r", "", $this->arfMail['report']);
             // Build up the report
             preg_match_all("/([\\w\\-]+): (.*)[ ]*\n/m", $this->arfMail['report'], $matches);
             $report = array_combine($matches[1], $matches[2]);
             // Sanity check
             if ($this->hasRequiredFields($report) === true) {
                 // Grap the domain and user from the authentication results for contact lookup (byDomain)
                 preg_match("/smtp.auth=(?<user>.*)@(?<domain>.*)/m", $report['Authentication-Results'], $matches);
                 if (!empty($matches) && is_array($matches) && !empty($matches[0])) {
                     $report['Source-User'] = $matches['user'];
                     $report['Source-Domain'] = $matches['domain'];
                 }
                 ksort($report);
                 // incident has all requirements met, filter and add!
                 $report = $this->applyFilters($report);
                 $incident = new Incident();
                 $incident->source = config("{$this->configBase}.parser.name");
                 $incident->source_id = false;
                 $incident->ip = $report['Source-IP'];
                 $incident->domain = empty($report['Source-Domain']) ? false : getDomain($report['Source-Domain']);
                 $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class");
                 $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type");
                 $incident->timestamp = strtotime($report['Arrival-Date']);
                 $incident->information = json_encode($report);
                 $this->incidents[] = $incident;
             }
         }
     }
     return $this->success();
 }
开发者ID:abuseio,项目名称:parser-spamexperts,代码行数:42,代码来源:Spamexperts.php


示例16: initCookie

 public static function initCookie()
 {
     //在非命令行下设置相关的cookie
     if (strpos(php_sapi_name(), 'cli') === false) {
         ini_set('session.cookie_domain', getDomain());
         //设置cookie作用域
         ini_set('session.cookie_path', '/');
         //设置cookie的有效路径
         ini_set('session.save_path', ROOT_PATH . 'temp/session');
         //设置session的保存路径
         ini_set('session.cookie_lifetime', 0);
         //表示用于session的cookie的有效期在浏览器打开期间有效
         ini_set('session.gc_maxlifetime', 72000);
         //如果session放在redis那么这里不起作用
         ini_set('session.gc_probability', 1);
         //垃圾收集的处理几率
         ini_set('session.gc_divisor', 50);
         //设置进程比率
         ini_set('session.use_cookies', 1);
         //session使用cookie的功能
         //创建session路径文件夹
         if (!is_dir(ROOT_PATH . 'temp/session')) {
             mkdir(ROOT_PATH . 'temp/session', 0755, true);
         }
         //开启session
         if (SESSION_AUTO_START == true) {
             if (!session_id()) {
                 session_start();
             }
         }
     }
 }
开发者ID:lughong,项目名称:test,代码行数:32,代码来源:LuS.class.php


示例17: parse

 /**
  * Parse attachments
  * @return array    Returns array with failed or success data
  *                  (See parser-common/src/Parser.php) for more info.
  */
 public function parse()
 {
     // Validate user based regex
     try {
         preg_match(config("{$this->configBase}.parser.file_regex"), '', $matches);
     } catch (\Exception $e) {
         $this->warningCount++;
         return $this->failed('Configuration error in the regular expression');
     }
     foreach ($this->parsedMail->getAttachments() as $attachment) {
         if (strpos($attachment->filename, '.zip') !== false && $attachment->contentType == 'application/octet-stream') {
             $zip = new Zipper();
             if (!$this->createWorkingDir()) {
                 return $this->failed("Unable to create working directory");
             }
             file_put_contents($this->tempPath . $attachment->filename, $attachment->getContent());
             $zip->zip($this->tempPath . $attachment->filename);
             $zip->extractTo($this->tempPath);
             foreach ($zip->listFiles() as $index => $compressedFile) {
                 if (strpos($compressedFile, '.csv') !== false) {
                     // For each CSV file we find, we are going to do magic (however they usually only send 1 zip)
                     if (preg_match(config("{$this->configBase}.parser.file_regex"), $compressedFile, $matches)) {
                         $this->feedName = $matches[1];
                         // If feed is known and enabled, validate data and save report
                         if ($this->isKnownFeed() && $this->isEnabledFeed()) {
                             $csvReports = new Reader\CsvReader(new SplFileObject($this->tempPath . $compressedFile));
                             $csvReports->setHeaderRowNumber(0);
                             foreach ($csvReports as $report) {
                                 // Handle field mappings first
                                 $aliasses = config("{$this->configBase}.feeds.{$this->feedName}.aliasses");
                                 if (is_array($aliasses)) {
                                     foreach ($aliasses as $alias => $real) {
                                         if (array_key_exists($alias, $report)) {
                                             $report[$real] = $report[$alias];
                                             unset($report[$alias]);
                                         }
                                     }
                                 }
                                 /*
                                  * Legacy 3.x fix for migrations.
                                  *
                                  * This resolves shadowserver errors where the CSV was send in duplicate resulting
                                  * in the header fields being used as data. If the header is detected the row can
                                  * be skipped safely
                                  */
                                 if ($report['ip'] === 'ip') {
                                     continue;
                                 }
                                 // Sanity check
                                 if ($this->hasRequiredFields($report) === true) {
                                     // incident has all requirements met, filter and add!
                                     $report = $this->applyFilters($report);
                                     $incident = new Incident();
                                     $incident->source = config("{$this->configBase}.parser.name");
                                     $incident->source_id = false;
                                     $incident->ip = $report['ip'];
                                     $incident->domain = false;
                                     $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class");
                                     $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type");
                                     $incident->timestamp = strtotime($report['timestamp']);
                                     $incident->information = json_encode($report);
                                     // some rows have a domain, which is an optional column we want to register
                                     switch ($this->feedName) {
                                         case "spam_url":
                                             if (isset($report['url'])) {
                                                 $incident->domain = getDomain($report['url']);
                                             }
                                             break;
                                         case "ssl_scan":
                                             if (isset($report['subject_common_name'])) {
                                                 /*
                                                  * Common name does not add http://, but that is required for
                                                  * the domain helper check so lets add it manually
                                                  */
                                                 $testurl = "http://{$report['subject_common_name']}";
                                                 $incident->domain = getDomain($testurl);
                                             }
                                             break;
                                         case "compromised_website":
                                             if (isset($report['http_host'])) {
                                                 $incident->domain = getDomain($report['http_host']);
                                             }
                                             break;
                                     }
                                     $this->incidents[] = $incident;
                                 }
                                 //End hasRequired fields
                             }
                             // End foreach report loop
                         }
                         // End isKnown & isEnabled
                     } else {
                         // Pregmatch failed to get feedName from attachment
                         $this->warningCount++;
                     }
//.........这里部分代码省略.........
开发者ID:abuseio,项目名称:parser-shadowserver,代码行数:101,代码来源:Shadowserver.php


示例18: parseURL

/**
 * Gets a title from a remote URL.
 * @param  [type] $url     The URL to fetch a readable title from.
 * @param  [type] $comment A comment, if you need one.
 * @return [type]          Returns nothing; pushes data directly into $_SESSION
 *                         (This may change later)
 */
function parseURL($url, $comment)
{
    session_name('pubTool');
    header('P3P: CP="CAO PSA OUR"');
    if (verifyURL($url) == false) {
        die("That doesn't look like an URL to me. Click <a href=\"index.php\">here</a> and try again!");
    }
    $url = HttpUri::createFromString($url);
    $url = sanitizeURL($url);
    $title = getTitle($url);
    $domain = getDomain($url);
    $_SESSION["linkList"][] = ['url' => strval($url), 'title' => strval($title), 'domain' => strval($domain), 'comment' => strval($comment)];
}
开发者ID:Gl0dGroup,项目名称:CSICON-Publication-Tool,代码行数:20,代码来源:functions.php


示例19: getPathinDomain

function getPathinDomain()
{
    $dir = getDomain();
    $dir = str_replace("http://" . $_SERVER['HTTP_HOST'], "", $dir);
    if (substr($dir, 0, 1) != "/") {
        $dir = "/" . $dir;
    }
    if (substr($dir, strlen($dir) - 1, 1) == "/") {
        $dir = substr($dir, 0, strlen($dir) - 1);
    }
    return $dir;
}
开发者ID:hxf829,项目名称:Ironcms,代码行数:12,代码来源:basefunction.php


示例20: admin_folder

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getEditablePath函数代码示例发布时间:2022-05-15
下一篇:
PHP getDoliDBInstance函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap