getHttpHost() public static method

The port name will be appended to the host if it's non-standard.
public static getHttpHost ( ) : string
return string
Example #1
0
 public function dcp()
 {
     $domain = Domain::whereDomain(Request::getHttpHost())->first();
     //$domain = Domain::whereDomain(Request::server("SERVER_NAME"))->first();
     $cookie = Cookie::make('domain_hash', $domain->id);
     return Redirect::to('/')->withCookie($cookie);
 }
Example #2
0
 /**
  * @param \Illuminate\Config\Repository $config
  */
 public function __construct(Config $config, Session $session)
 {
     $scheme = \Request::isSecure() ? 'https://' : 'http://';
     $this->u2f = new \u2flib_server\U2F($scheme . \Request::getHttpHost());
     $this->config = $config;
     $this->session = $session;
 }
 /**
  * @param $postCode
  * @param $houseNumber
  * @return Address
  */
 public function findByPostcodeAndHouseNumber($postCode, $houseNumber)
 {
     $this->setRequestUrl(sprintf($this->getRequestUrl(), $postCode, $houseNumber, \Request::getHttpHost()));
     $response = $this->request();
     $address = new Address();
     $address->setStreet($response['details'][0]['street'])->setHouseNo($houseNumber)->setTown($response['details'][0]['city'])->setMunicipality($response['details'][0]['municipality'])->setProvince($response['details'][0]['province'])->setLatitude($response['details'][0]['lat'])->setLongitude($response['details'][0]['lon']);
     return $address;
 }
Example #4
0
function switchLanguageUrl($lang)
{
    $segments = explode('/', Request::path());
    if ($segments[0] == 'en' || $segments[0] == 'zh') {
        $segments[0] = $lang;
        $newPath = implode('/', $segments);
    }
    $url = 'http://' . Request::getHttpHost() . "/" . $newPath . "?" . http_build_query(Input::all());
    return $url;
}
Example #5
0
 private function _checkDcp()
 {
     $ret = TRUE;
     if (Auth::user()->status == 4) {
         if (Auth::user()->domain->domain != Request::getHttpHost()) {
             $ret = FALSE;
         }
     } elseif (Auth::user()->status == 3) {
         /* fixme anton
         			$domain = array('localhost','localhost:8000','local.teleponrakyat.id','local.teleponrakyat.id:8000','teleponrakyat.id','www.teleponrakyat.id');
         			//foreach (Domain::whereUserId(Auth::user()->id)->get() as $row) {
         			//	$domain[] = $row->domain;
         			//}
         			if(!in_array(Request::getHttpHost(), $domain)) {
         				$ret = FALSE;
         			}
         			*/
         $ret = TRUE;
     }
     return $ret;
 }
Example #6
0
 /**
  * Determine if the current request is for HTTP api.
  *
  * @return bool
  */
 function is_api_request()
 {
     return starts_with(Request::getHttpHost(), env('API_DOMAIN'));
 }
Example #7
0
 /**
  * Get the host
  *
  * @deprecated use $request->getHttpHost() instead
  *
  * @return string
  */
 public function getHost()
 {
     return $this->request->getHttpHost();
 }
Example #8
0
*
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Explicit > Implicit. Easier to change stuff without breaking anything.
|
*/
// home section
if (Config::get('app.debug')) {
    Route::get('/', ["as" => "home", "uses" => "HomeController@getNews"]);
} else {
    Route::get('/', function () {
        $host = Request::getHttpHost();
        $subdomain = substr($host, 0, strpos($host, "."));
        $redirect_path = $subdomain === "store" ? "/store" : "/forum";
        return Redirect::to($redirect_path);
    });
}
Route::get('/home/news', ["as" => "news", "uses" => "HomeController@getNews"]);
Route::get('/home/download', ["as" => "download", "uses" => "HomeController@getDownload"]);
Route::get('/home/changelog', ["as" => "changelog", "uses" => "HomeController@getChangelog"]);
Route::get("/icons", "HomeController@getIcons");
// beatmaps section
Route::get('/beatmaps/listing/{ajax?}', ["as" => "beatmap-listing", "uses" => "BeatmapController@getListing"]);
// maps
Route::get('/beatmaps/set/{id}', ["as" => "set", "uses" => 'BeatmapController@getMapSet']);
Route::get('/beatmaps/map/{id}', ["as" => "beatmap", "uses" => 'BeatmapController@getMap']);
Route::get('/beatmaps/modding/{id?}', ["as" => "modding", "uses" => "ModdingController@getModding"]);
 /**
  * Checks to see if text has at least one internal link
  * @param $text
  * @return bool
  */
 public function hasInternalLink($text)
 {
     $links = $this->getLinks($text);
     foreach ($links as $link) {
         if (parse_url($link, PHP_URL_HOST) == \Request::getHttpHost()) {
             return true;
         }
     }
     return false;
 }
Example #10
0
 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function getRegister()
 {
     $host = Rq::getHttpHost();
     return view('auth.register', compact('host'));
 }
 public function testGetHttpHost_FromNameAndPort()
 {
     $request = new Request(array(), array(), array(), array('SERVER_NAME' => 'server', 'SERVER_PORT' => '8080'));
     $this->assertThat($request->getHttpHost(), $this->equalTo('server:8080'));
 }
 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function showRegistrationForm()
 {
     $host = Rq::getHttpHost();
     return view('auth.register', compact('host'));
 }
Example #13
0
<?php

/* Simple configuration file for Laravel Sitemap package */
return array('use_cache' => true, 'cache_key' => 'Laravel.Sitemap.' . \Request::getHttpHost(), 'cache_duration' => 3600, 'escaping' => true);
Example #14
0
 private function _getUserId($email)
 {
     $domain = Domain::where('domain', Request::getHttpHost())->first();
     $user = User::where('email', $email)->where('domain_id', $domain['id'])->first();
     return $user['id'];
 }
 public function getFilter()
 {
     $status = Auth::user()->status;
     if ($status == 2) {
         $call_detail_report = Cdr::all();
         $condq = "created is not null";
     } elseif ($status == 3) {
         $domain = Domain::whereUserId(Auth::user()->id)->get(array('sip_server'));
         $sip_server = array();
         foreach ($domain as $row) {
             $sip_server[] = $row['sip_server'];
         }
         if ($sip_server) {
             $call_detail_report = $this->_orWhereIn('caller_domain', 'callee_domain', $sip_server);
         } else {
             $call_detail_report = [];
         }
         $condq = $this->_orGenerator('caller_domain', 'callee_domain', $sip_server);
     } else {
         $sip_server = Domain::find(Cookie::get('domain_hash'))->whereDomain(Request::getHttpHost())->get(array('sip_server'));
         $domainc = array();
         foreach ($sip_server as $row) {
             $domainc[] = $row['sip_server'];
         }
         $extension_arr = PhoneNumber::whereUserId(Auth::user()->id)->get(array('extension'));
         $extension = array();
         foreach ($extension_arr as $row) {
             $extension[] = $row['extension'];
         }
         $call_detail_report = $this->_orWhereInAnd('src_uri', 'dst_uri', $extension, 'caller_domain', 'callee_domain', $domainc);
         $condq = $this->_orGeneratorAnd('src_uri', 'dst_uri', $extension, 'caller_domain', 'callee_domain', $domainc);
     }
     $input = Input::only(array('datefilter', 'datefrom', 'dateto', 'timefilter', 'timefrom', 'timeto', 'durationparam', 'durationfilter', 'duration', 'fromfilter', 'from', 'tofilter', 'to'));
     $rules = array('datefrom' => 'required_with:datefilter', 'timefrom' => 'required_with:timefilter', 'duration' => 'required_with:durationfilter');
     $v = Validator::make($input, $rules);
     if ($v->fails()) {
         return Output::push(array('path' => 'call_detail_reports', 'errors' => $v, 'input' => TRUE));
     }
     $bulan_ayeuna = "AND YEAR(call_start_time) = YEAR(curdate()) AND MONTH(call_start_time) = MONTH(curdate()) ";
     if ($input['datefilter'] || $input['timefilter'] || $input['durationfilter'] || $input['fromfilter'] || $input['tofilter']) {
         $q = "select * from opensips.cdrs where ";
         $q = $q . "(" . $condq . ") ";
         if ($input['datefilter']) {
             if ($input['datefrom'] && $input['dateto']) {
                 $fromdate = $this->_intlDate($input['datefrom']);
                 $todate = $this->_intlDate($input['dateto']);
                 $q = $q . "AND (date(call_start_time) BETWEEN '" . $fromdate . "' AND '" . $todate . "') ";
             } elseif ($input['datefrom'] && !$input['dateto']) {
                 $fromdate = $this->_intlDate($input['datefrom']);
                 $todate = date("Y-m-d");
                 $q = $q . "AND (date(call_start_time) >= '" . $fromdate . "') ";
             }
         } else {
             $q = $q . $bulan_ayeuna;
         }
         if ($input['timefilter']) {
             if ($input['timefrom'] && $input['timeto']) {
                 $q = $q . "AND (time(call_start_time) BETWEEN '" . $input['timefrom'] . "' AND '" . $input['timeto'] . "') ";
             } elseif ($input['timefrom'] && !$input['timeto']) {
                 $q = $q . "AND (time(call_start_time) >= ";
                 $q = $q . "'" . $input['timefrom'] . "') ";
             }
         }
         if ($input['durationfilter']) {
             $duration = $this->_getDuration($input['duration']);
             $q = $q . "AND (duration " . $input['durationparam'] . " " . $duration . ") ";
         }
         if ($input['fromfilter']) {
             $fromarr = explode("@", $input['from']);
             if (!isset($fromarr[1])) {
                 $fromarr[1] = null;
             }
             if ($fromarr[1] == null) {
                 $q = $q . "AND (src_uri = '" . $input['from'] . "') ";
             } else {
                 $q = $q . "AND (src_uri = '" . $fromarr[0] . "' and caller_domain = '" . $fromarr[1] . "') ";
             }
         }
         if ($input['tofilter']) {
             $toarr = explode("@", $input['to']);
             if (!isset($toarr[1])) {
                 $toarr[1] = null;
             }
             if ($toarr[1] == null) {
                 $q = $q . "AND (dst_uri = '" . $input['to'] . "') ";
             } else {
                 $q = $q . "AND (dst_uri = '" . $toarr[0] . "' and callee_domain = '" . $toarr[1] . "') ";
             }
         }
         $q = $q . "order by call_start_time desc";
         $results = [];
         $results = DB::connection('mysql2')->select($q);
         //print_r($q);
         return View::make('call_detail_reports.index')->with('call_detail_reports', $results);
     } else {
         return View::make('call_detail_reports.index')->with('call_detail_reports', $call_detail_report);
     }
 }