/**
  * Determine if the device is Windows Phone.
  *
  * @param Device $device
  * @param UserAgent $userAgent
  * @return bool
  */
 private static function checkWindowsPhone(Device $device, UserAgent $userAgent)
 {
     if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) {
         $device->setName($device::WINDOWS_PHONE);
         return true;
     }
     return false;
 }
 /**
  * Determine if the device is Iphone.
  *
  * @return bool
  */
 public function checkIphone()
 {
     if (stripos($this->userAgent->getUserAgentString(), 'iphone;') !== false) {
         $this->device->setName(Device::IPHONE);
         return true;
     }
     return false;
 }
 /**
  * analyze
  * @static
  * @param  string $string         UserAgent String]
  * @param  string $imageSize      Image Size(16 / 24)
  * @param  string $imagePath      Image Path
  * @param  string $imageExtension Image Description
  * @return UserAgent
  */
 public static function analyze($string, $imageSize = null, $imagePath = null, $imageExtension = null)
 {
     $class = new UserAgent();
     $imageSize === null || ($class->imageSize = $imageSize);
     $imagePath === null || ($class->imagePath = $imagePath);
     $imageExtension === null || ($class->imageExtension = $imageExtension);
     $class->analyze($string);
     return $class;
 }
Exemple #4
0
 /**
  * @param string $userAgent
  * @return integer
  */
 public static function getId($userAgent)
 {
     $hash = md5($userAgent);
     $search = UserAgent::model()->find("hash = ?", $hash);
     if ($search) {
         return $search->id;
     }
     $ua = new UserAgent();
     $ua->userAgent = $userAgent;
     $ua->hash = md5($userAgent);
     $ua->save();
     return $ua->id;
 }
Exemple #5
0
 /**
  * デバイス判定をしてテンプレートを返す
  */
 public function getTemplate()
 {
     // デバイス判定
     $ua = new \UserAgent();
     $device = $ua->getDevice();
     $template = 'denki.choice.list.gas.index';
     // デバイス別にテンプレートを変える
     if ($device === 'pc') {
         // PC用テンプレートを返す
         return $template;
     } else {
         // PC以外の共通テンプレートを返す(モバイル)
         return 'm.' . $template;
     }
 }
Exemple #6
0
 /**
  * Get <html> tag css classes with browser name and version
  * @return string 
  */
 private function _getHtmlClass()
 {
     $userAgent = UserAgent::getInstance();
     $browser = strtolower($userAgent->getBrowser());
     preg_match('#^([0-9]*)[\\.]?#', $userAgent->getBrowserVersion(), $matches);
     return $browser . ' ' . $browser . $matches[1];
 }
Exemple #7
0
 public static function details($user_agent)
 {
     if (is_null(self::$browscap)) {
         $cache_dir = self::BROWSCAP_CACHE_DIR;
         if (!is_dir($cache_dir)) {
             mkdir($cache_dir);
         }
         self::$browscap = new Browscap($cache_dir);
     }
     // Reset the user agents cache if we've cached too many
     if (count(self::$user_agents) > self::MAX_USER_AGENTS_COUNT) {
         self::$user_agents = array();
     }
     // If user agent info is cached then return it
     if ($details = array_key(self::$user_agents, $user_agent)) {
         return $details;
     }
     // Look up the user agent using the browscap.ini file
     $browscap = self::$browscap->getBrowser($user_agent, TRUE);
     $browser = array_key($browscap, 'Browser');
     // e.g. "IE"
     $version = array_key($browscap, 'Parent');
     // e.g. "IE 9.0"
     $version = $version && $browser && strpos($version, $browser) === 0 ? substr($version, strlen($browser) + 1) : $version;
     $op_sys = array_key($browscap, 'Platform');
     $is_mobile = array_key($browscap, 'isMobileDevice');
     $details = array('op_sys' => $op_sys, 'browser' => $browser, 'version' => $version, 'browser_version' => $browser . ($version ? " {$version}" : ''), 'is_robot' => $op_sys == 'unknown' ? TRUE : FALSE, 'is_mobile' => $is_mobile);
     return self::$user_agents[$user_agent] = new Object($details);
 }
 /**
  * Return singleton instance
  * 
  * @return UserAgent
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemple #9
0
 /**
  * 加载精确的ua词典和字段匹配的ua词典
  * @param string $extract_ualist
  * @param string $rough_ualist
  */
 public static function getInstance($extract_ualist = '', $rough_ualist = '')
 {
     if (self::$_instance === null) {
         self::$_instance = new UserAgent($extract_ualist, $rough_ualist);
     }
     return self::$_instance;
 }
Exemple #10
0
 /**
  * Returns the value of the User-Agent header
  * Add environment values and php version numbers
  */
 public static function getValue()
 {
     $featureList = array('Lang=PHP', 'V=' . PHP_VERSION, 'Bit=' . UserAgent::_getPHPBit(), 'OS=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')), 'Machine=' . php_uname('m'));
     if (defined('OPENSSL_VERSION_TEXT')) {
         $opensslVersion = explode(' ', OPENSSL_VERSION_TEXT);
         $featureList[] = 'Openssl=' . $opensslVersion[1];
     }
     if (function_exists('curl_version')) {
         $curlVersion = curl_version();
         $featureList[] = 'curl=' . $curlVersion['version'];
     }
     return sprintf("PayPalSDK/%s %s (%s)", SDK_NAME, SDK_VERSION, implode(';', $featureList));
 }
Exemple #11
0
 public static function create($userId, $sessionId)
 {
     $ip = $_SERVER["REMOTE_ADDR"];
     $userAgent = $_SERVER["HTTP_USER_AGENT"];
     $uri = $_SERVER["REQUEST_URI"];
     $log = new AccessLog();
     $log->user = $userId;
     $log->session = $sessionId;
     $log->ip = $ip;
     $log->userAgent = UserAgent::getId($userAgent);
     $log->uri = $uri;
     $log->date = Database::now();
     $log->save();
     return $log;
 }
Exemple #12
0
 public function __construct()
 {
     self::$instance =& $this;
     // Classe de user agent:
     $this->userAgentParser =& UserAgent::getInstance();
     // Definindo o tipo de requisição:
     $this->setRequestMethod();
     // Definindo a página anterior do site:
     $this->setReferrer();
     // Definindo a uri (tudo que existe depois do domínio da aplicação)
     $this->setUri();
     // Setando os parâmetros dentro do array de segmentos, aí ainda temos a uri normal guardada !
     $this->explodeSegments();
     // Setando os parâmetros da url (diferente dos segmentos, retiramos o controller e a action, saca?) xD;
     $this->setUrlParams($this->segments);
 }
 public function get_ua_strategy()
 {
     $arrRes = array('type' => '', 'tpl' => '', 'name' => '', 'rollback_name' => '');
     if (empty($this->_ua_string)) {
         return $arrRes;
     }
     // 全部UA适配策略配置
     $adaptions = Bd_Conf::getConf('tpl_uaadaptation/TEMPLATE_UA_ADAPTATION');
     if (empty($adaptions)) {
         return $arrRes;
     }
     $obj = UserAgent::getInstance(VUI_CONF_PATH . '/' . 'ualist_exact');
     // 获取下全部的UA字段,包括厂商、机型、操作系统、系统版本号、浏览器、浏览器版本号等等
     $arrFields = $obj->getFieldsFromUA($this->_ua_string);
     // 未查到相关字段,不做任何处理
     if (empty($arrFields) || !is_array($arrFields)) {
         return $arrRes;
     }
     // 遍历适配规则,应用命中的策略
     foreach ($adaptions as $perAdapt) {
         if (empty($perAdapt['rule']) || !is_array($perAdapt['rule'])) {
             continue;
         }
         $bHint = true;
         // rule中的字段均是UA所要强制匹配上的
         foreach ($perAdapt['rule'] as $key => $pattern) {
             if (!preg_match('/' . $pattern . '/', $arrFields[$key])) {
                 $bHint = false;
             }
         }
         if (!$bHint) {
             continue;
         }
         // 适配策略的应用目前包括模板类型(baidu/baiduhd)、模板名(page.2.0.tpl)、退化模板名(page.tpl)
         $arrRes['type'] = isset($perAdapt['strategy']['type']) ? trim($perAdapt['strategy']['type']) : '';
         $arrRes['tpl'] = isset($perAdapt['strategy']['tpl']) ? trim($perAdapt['strategy']['tpl']) : '';
         $arrRes['none_tpl'] = isset($perAdapt['strategy']['none_tpl']) ? trim($perAdapt['strategy']['none_tpl']) : '';
         $arrRes['rollback_name'] = isset($perAdapt['strategy']['rollback_name']) ? trim($perAdapt['strategy']['rollback_name']) : '';
         $arrRes['rollback_none_name'] = isset($perAdapt['strategy']['rollback_none_name']) ? trim($perAdapt['strategy']['rollback_none_name']) : '';
         $arrRes['name'] = isset($perAdapt['strategy']['name']) ? trim($perAdapt['strategy']['name']) : '';
         break;
     }
     return $arrRes;
 }
 /**
  * Perform actions triggered from the user list page (/users). Actions performed:
  * addGroup    - Adds a given user to a given CT-group
  * assignRole  - Assigns the given role to a given user on the given CT-group.
  * removeGroup - Removes the given user from the given CT-group.
  * 
  * Browser is redirected to calling page (hopefully /users), with a flashError or 
  * flashSuccess message indicating the result.
  */
 public function groupActions($groupName)
 {
     $targetUserName = Input::get('usedId');
     $targetUser = UserAgent::find($targetUserName);
     if (!$targetUser) {
         return Redirect::back()->with('flashError', 'User does not exist: ' . $targetUserName);
     }
     $action = Input::get('action');
     if ($action == 'addGroup') {
         $userRole = ProjectHandler::grantUser($targetUser, $groupName, Roles::PROJECT_GUEST);
         return Redirect::back()->with('flashSuccess', 'User ' . $targetUserName . ' added to group ' . $groupName);
     } elseif ($action == 'assignRole') {
         $roleName = Input::get('role');
         $role = Roles::getRoleByName($roleName);
         $userRole = ProjectHandler::grantUser($targetUser, $groupName, $role);
         return Redirect::back()->with('flashSuccess', 'User ' . $targetUserName . ' assigned role ' . $roleName . ' on group ' . $groupName);
     } elseif ($action == 'removeGroup') {
         ProjectHandler::revokeUser($targetUser, $groupName);
         return Redirect::back()->with('flashSuccess', 'User ' . $targetUserName . ' removed from group ' . $groupName);
     } else {
         return Redirect::back()->with('flashError', 'Invalid action selected: ' . $action);
     }
 }
Exemple #15
0
 protected function init()
 {
     if (!extension_loaded('curl')) {
         exit('Need curl extension');
     }
     if ($this->ch) {
         return true;
     }
     try {
         $this->ch = curl_init();
         curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
         if (!empty($this->buffer)) {
             curl_setopt($this->ch, CURLOPT_BUFFERSIZE, $this->buffer);
         }
         if (\Config::get('parser.userAgent')) {
             curl_setopt($this->ch, CURLOPT_USERAGENT, UserAgent::random_user_agent());
         }
         if (\Config::get('parser.proxy')) {
             curl_setopt($this->ch, CURLOPT_PROXY, $this->getProxy());
         }
         if (\Config::get('parser.timeout')) {
             curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, \Config::get('parser.timeout'));
         }
     } catch (\Exception $e) {
         return $e;
     }
     return true;
 }
Exemple #16
0
            if (!empty($nom)) {
                if (restrictAccess::validate($_POST['reponse'], $reponses)) {
                    restrictAccess::autoLogin();
                    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
                    } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
                        $ip = $_SERVER['HTTP_CLIENT_IP'];
                    } else {
                        $ip = $_SERVER['REMOTE_ADDR'];
                    }
                    $infosclient = '<hr /><p>IP : <a href="http://ipgetinfo.com/index.php?ip=' . $ip . '">' . $ip . '</a><br />';
                    if (!empty($_SERVER['GEOIP_COUNTRY_NAME'])) {
                        $infosclient .= 'Localisation : ' . utf8_encode($_SERVER['GEOIP_CITY']) . ', ' . $_SERVER['GEOIP_COUNTRY_NAME'] . ' (<a href="http://maps.google.com/maps?q=' . $_SERVER['GEOIP_LATITUDE'] . ',' . $_SERVER['GEOIP_LONGITUDE'] . '">carte</a>)<br />';
                    }
                    require_once dirname(__FILE__) . '/libs/useragent.class.php';
                    $ua = new UserAgent();
                    $infosclient .= 'User-agent : ' . $ua->getUserAgent() . '<br />';
                    $infosclient .= 'Navigateur : ' . $ua->getBrowser() . ' ' . $ua->getBrowserVersion() . '<br />';
                    $infosclient .= 'OS : ' . $ua->getOS() . '</p>';
                    $content = '<p>L\'énigme vient d\'être résolue par ' . $nom . '.</p>' . $infosclient;
                    $headers = 'MIME-Version: 1.0' . "\r\n";
                    $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
                    $headers .= 'From: Blogornote <*****@*****.**>' . "\r\n";
                    wp_mail(get_bloginfo('admin_email'), "Le mystère a été découvert !", $content, $headers);
                }
            }
        }
    }
}
if (!is_user_logged_in()) {
    // Si le visiteur n'est pas connecté
Exemple #17
0
 public function toString()
 {
     return $this->ua->toString() . '/' . $this->os->toString();
 }
Exemple #18
0
/**
 * Try to determine if the current call causing the audit is from a real browser/person.
 * Requires core/lib/useragent-1.0/userAgent.class.php
 *
 * @return booelan TRUE if it thinks it is a real user else FALSE.
 */
function isProbablyRealWebUser()
{
    global $CFG;
    require_once $CFG->dirAddress . 'core/lib/useragent-1.0/userAgent.class.php';
    $userAgent = new UserAgent();
    $isNotRealWebUser = $userAgent->isUnknown();
    return !$isNotRealWebUser;
}
<?php

require_once 'userAgent.class.php';
$userAgent = new UserAgent();
echo "<h1>PHP User Agent</h1>";
echo "<h3>Browser Detection in PHP5</h3>";
echo "<b>Browser Name</b>     : " . $userAgent->getBrowserName() . ' <br/> ';
echo "<b>Browser Version</b>  : " . $userAgent->getBrowserVersion() . ' <br/> ';
echo "<b>Operating System</b> : " . $userAgent->getOperatingSystem() . ' <br/> ';
echo "<b>Engine</b>           : " . $userAgent->getEngine();
Exemple #20
0
require SERVER_ROOT . '/classes/util.php';
$Debug = new DEBUG();
$Debug->handle_errors();
$Debug->set_flag('Debug constructed');
$DB = new DB_MYSQL();
$Cache = new CACHE($MemcachedServers);
$Enc = new CRYPT();
// Autoload classes.
require SERVER_ROOT . '/classes/classloader.php';
// Note: G::initialize is called twice.
// This is necessary as the code inbetween (initialization of $LoggedUser) makes use of G::$DB and G::$Cache.
// TODO: remove one of the calls once we're moving everything into that class
G::initialize();
//Begin browser identification
$Browser = UserAgent::browser($_SERVER['HTTP_USER_AGENT']);
$OperatingSystem = UserAgent::operating_system($_SERVER['HTTP_USER_AGENT']);
//$Mobile = UserAgent::mobile($_SERVER['HTTP_USER_AGENT']);
$Mobile = in_array($_SERVER['HTTP_HOST'], array('m.' . NONSSL_SITE_URL, 'm.' . NONSSL_SITE_URL));
$Debug->set_flag('start user handling');
// Get classes
// TODO: Remove these globals, replace by calls into Users
list($Classes, $ClassLevels) = Users::get_classes();
//-- Load user information
// User info is broken up into many sections
// Heavy - Things that the site never has to look at if the user isn't logged in (as opposed to things like the class, donor status, etc)
// Light - Things that appear in format_user
// Stats - Uploaded and downloaded - can be updated by a script if you want super speed
// Session data - Information about the specific session
// Enabled - if the user's enabled or not
// Permissions
if (isset($_COOKIE['session'])) {
Exemple #21
0
	/**
	 * 実行します
	 */
	public function main() {

		try {
			//--------------------------
			// Index実行情報の特定
			// AnkenNotFountException
			// TeikeiMediaNotFountException
			//--------------------------
			$this->setIndexData();

			//--------------------------
			// Index実行の有効性チェック
			// DeadLineException
			// UnauthorizedAccessException
			//--------------------------
			$this->checkIndexValidity($this->_anken, $this->_teikeiMedia);

			//---------------------------
			// lpo
			//---------------------------
			$lpo = new LpoModel($this->_core, $this->_code, $this->_anken['anken_id']);

			//↓↓===========nm00241 2011/03/30 start===================================
			//--------------------------
			// 再訪フラグ取得
			//--------------------------
			$revisitFlg = $this->getRevisitFlg();
			//↑↑===========nm00241 2011/03/30 end=====================================

			//↓↓===========nm00240 2011/05/05 start===================================
			//--------------------------
			// ディバイス情報を取得
			//--------------------------
			$userAgent = new UserAgent();
			$device = $userAgent->getDevice();
			//↑↑===========nm00240 2011/05/05 end=====================================

			//--------------------------
			// アクセス情報更新
			// DBException
			//--------------------------
			//↓↓===========nm00241 2011/03/30 start===================================
			//$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option);
			//↓↓===========nm00240 2011/05/05 start===================================
			//$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option, $revisitFlg);
			$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option, $revisitFlg, $device);
			//↑↑===========nm00240 2011/05/05 end=====================================
			//↑↑===========nm00241 2011/03/30 end=====================================
			
			//↓↓===========nm00241 2011/03/30 start===================================
			//--------------------------
			// 初回/リピーター振り分け対応を判断
			//--------------------------
			// 初回/リピーター振り分け対応フラグ
			$simpleLpoFlg = $this->_anken['simple_lpo_flg'];
			// 初回用URL
			$simpleLpoFirstVisitUrl = $this->_anken['simple_lpo_first_visit_url'];
			// リピーター用URL:成果あり
			$simpleLpoRevisitUrl = $this->_anken['simple_lpo_revisit_url'];
			// リピーター用URL:成果なし
			$simpleLpoRepeaterUrl = $this->_anken['simple_lpo_repeater_url'];
			// 初回/リピーター振り分け対応(「初回用URL」&&「リピーター用URLの一つ」内容有り)の場合
			if ($simpleLpoFlg == 1 && $simpleLpoFirstVisitUrl != null && ($simpleLpoRepeaterUrl != null || $simpleLpoRevisitUrl != null)) {
				// 初回/リピーター振り分け対応イレクト
				$this->_log->debug('db.simpleLpo');
				// 飛び先取得しリダイレクト
				$url = $this->getSimpleLpoRedirectUrl($this->_anken, $this->_sessionId, $revisitFlg);
				$this->_log->debug('db.simpleLpo.' . $url);
				$this->redirect($url);
			}
			//↑↑===========nm00241 2011/03/30 end=====================================

			//↓↓===========nm00164 2009/10/30 start===================================
			//オプションのリダイレクトURL情報設定したの場合
			if (empty($this->_optionRedirectUrlInfo) == false) {
				//foreach ($this->_optionRedirectUrlInfo as $v) {
				//	//パラメータ取得の入力URLチェック
				//	if(strstr($this->_redirectUrl, $v['redirect_url']) == false) {
				//		continue;
				//	}
				//	//入力URL(パラメータ取得)に「オプションのリダイレクトチェックURL」が含まれている時:入力URLへ遷移
				//	$this->_log->debug('db.redirect.url' . $this->_redirectUrl);
				//	$this->redirect($this->_redirectUrl);
				//}
				////入力URL(パラメータ取得)に「オプションのリダイレクトチェックURL」が含まれていない時:エラー画面遷移
				//$this->_log->debug('db.invalid.url.' . $this->_redirectUrl);
				//throw new Index_RedirectUrlException;
				
				//リダイレクトURLチェックフラグ
				$isValidUrlFlg = false;
				foreach ($this->_optionRedirectUrlInfo as $v) {
					//パラメータ取得したURLチェック
					$optionRedirectUrlLength = strlen($v['redirect_url']);
					$redirectUrl = substr($this->_redirectUrl, 0, $optionRedirectUrlLength);
					//if(strstr($this->_redirectUrl, $v['redirect_url']) == false) {
					if($redirectUrl != $v['redirect_url']) {
						continue;
					} else {
						$isValidUrlFlg = true;
						break;
					}		
				}
				//入力URL(パラメータ取得)に「オプションのリダイレクトチェックURL」が含まれている時:入力URLへ遷移
				if($isValidUrlFlg) {
					// ↓↓===========nm00242 2011/03/16 start===================================
					// 入稿URL時のパラメータ設定
					$queryString = $_SERVER['QUERY_STRING'];
					// Value Commerce対象パラメータ名(当該パラメータ名よりValue Commerce判断)
					$findVcParam = "ITRACK_INFO";
					$findPlace = strpos($queryString, $findVcParam);
					// $findVcParamが見つかった場合、Value Commerce商品リンク対応
					if ($findPlace) {
						$queryString = "?" . substr($queryString, $findPlace);
						$orgQueryString = substr($this->_redirectUrl, strpos($this->_redirectUrl, "?"));
						$this->_redirectUrl = str_replace($orgQueryString, "", $this->_redirectUrl);
						$this->_redirectUrl = $this->_redirectUrl . $queryString;
					}
					// ↑↑===========nm00242 2011/03/16 end=====================================
					$this->_log->debug('db.redirect.url' . $this->_redirectUrl);
					$this->redirect($this->_redirectUrl);
				//入力URL(パラメータ取得)に「オプションのリダイレクトチェックURL」が含まれていない時:エラー画面遷移
				} else {
					$this->_log->debug('db.invalid.url.' . $this->_redirectUrl);
					throw new Index_RedirectUrlException;
				}
			} 
			//↑↑===========nm00164 2009/10/30 end=====================================

			//--------------------------
			// 実施タイプ別に実行します
			// RedirectUrlException
			// Index_LandingPageNotFountException
			//--------------------------
			// 1:リダイレクト 2:ランディング
			$type = $this->_anken['type_cd'];
			if ($type == 1) {
				// リダイレクト
				$this->_log->debug('db.redirect');
				// 飛び先取得しリダイレクト
				//↓↓===========nm00240 2011/05/05 start===================================
				//$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId);
				$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId, $device);
				//↑↑===========nm00240 2011/05/05 end=====================================
				$this->_log->debug('db.redirect.' . $url);
				$this->redirect($url);

			} else if ($type == 2) {
				// ランディングタイプ
				$this->_log->debug('db.landing');
				// ランディングページパス取得し、表示
				$path = $this->getLandingPagePath();
				$this->_log->debug('db.landing.' . $path);
				//↓↓===========nm00240 2011/05/05 start===================================
				//$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken);
				$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken, $device);
				//↑↑===========nm00240 2011/05/05 end=====================================

			} else {
				// 未知の実施タイプ
				throw new Index_UnknownAnkenTypeException($type);
			}
			exit;

		} catch (CampaignException $e) {

			//--------------------------
			// 例外処理
			//--------------------------
			// 例外表示用(企業名とリンク)
			$name = $this->_anken['campaign_error_link_name'];
			$url = $this->_anken['campaign_error_link_url'];
			if (empty($name) == false && empty($url) == false) {
				$e->assign('client_name', $name);
				$e->assign('client_url', $url);
			}
			
			//↓↓===========nm00164 2009/10/30 start===================================
			//パラメータの入力URLの値はエラー画面に設定
			if (empty($this->_redirectUrl) == false) {
				$e->assign('url', $this->_redirectUrl);
			}
			//↑↑===========nm00164 2009/10/30 end=====================================
			
			throw $e;

		} catch (Exception $e) {

			//--------------------------
			// 想定外の例外処理
			//--------------------------
			$this->_log->fatal('unexpected: ' . get_class($e));
			throw $e;
		}
	}
Exemple #22
0
<?php

include_once 'functions.php';
require_once "ua.class.php";
$ua = new UserAgent();
if ($ua->set() === "mobile") {
    //この中のコードはスマホにのみ適用
    include_once "hp/index.php";
} elseif ($ua->set() === "tablet") {
    //この中のコードはタブレットにのみ適用
} else {
    //この中のコードはスマホとタブレット以外に適用
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta name="robots" content="index,follow">
	<meta name="description" content="在宅訪問マッサージの「あいの訪問マッサージサービス」です。国家資格保持の訪問臨床経験豊富なスタッフがご自宅までお伺い致します。">
	<meta name="keywords" content="訪問リハビリ,在宅訪問マッサージ ,在宅マッサージ,堺,大阪市,東住吉区,住吉区,平野区,生野区,阿倍野区,天王寺区,東淀川区">
	<meta name="copyright" content="(C) あいの訪問マッサージサービス All Rights Reserved.">
	<meta name="author" content="ainohoumon.com">
	<meta name="revisit-after" content="7 days">
	<title>在宅訪問マッサージ  | リハビリマッサージ | あいの訪問マッサージサービス(大阪市)</title>
	<script language="JavaScript"> 
		function mouseOver(obj, filename){
			obj.src = filename;
		}
		function mouseOut(obj, filename){
Exemple #23
0
<?php

require_once '../lib/UserAgent.php';
$app->get("/", function () use($app) {
    if (UserAgent::isMobile()) {
        $app->redirect("/mobile");
        return;
    }
    $app->render('web/home.php');
});
$app->get("/search", function () use($app) {
});
Exemple #24
0
	        }
	        else
	        {
	            Log::error($e);
	            return Response::view( 'errors.500', array( 'reason' => $message ), '500' );
	        }
	    });
	}	 
	        return Response::view('errors.404', array('message'=>$e->getMessage()), '404'); 
});
*/
if (!Config::get('app.debug')) {
    App::error(function (Exception $e, $code) {
        $message = $e->getMessage() == '' ? $code . 'エラーです。' : $e->getMessage();
        // デバイス判定
        $ua = new \UserAgent();
        $device = $ua->getDevice();
        // デバイス別にテンプレートを変える
        if ($device === 'pc') {
            // PC用テンプレートを返す
            $template = '';
        } else {
            // PC以外の共通テンプレートを返す(モバイル)
            $template = 'm/';
        }
        if (File::exists(app_path() . '/views/' . $template . 'errors/' . $code . '.blade.php')) {
            return Response::view($template . 'errors.' . $code, array('reason' => $message), $code);
        } else {
            Log::error($e);
            return Response::view($template . 'errors.500', array('reason' => $message), '500');
        }
Exemple #25
0
 public function request($endpoint, $post = null, $headers = [])
 {
     $headers = array_merge($headers, ['Connection: close', 'Accept: */*', 'Content-type: application/x-www-form-urlencoded; charset=UTF-8', 'Cookie2: $Version=1', 'Accept-Language: en-US']);
     $res = parent::request(self::API_URL . $endpoint, $post, $headers);
     if ($this->debug) {
         echo "REQUEST: {$endpoint}\n";
         if (!is_null($post)) {
             if (!is_array($post)) {
                 echo "DATA: {$post}\n";
             }
         }
         echo "RESPONSE: {$res[1]}\n\n";
     }
     return array($res[0], json_decode($res[1], true));
 }
Exemple #26
0
 /**
  * Get list of all users
  */
 public static function getUserlist()
 {
     return UserAgent::orderBy('_id', 'asc')->get();
 }
Exemple #27
0
 /**
  * Determine if the user's operating system is BeOS.
  *
  * @param Os $os
  * @param UserAgent $userAgent
  *
  * @return bool
  */
 private static function checkBeOS(Os $os, UserAgent $userAgent)
 {
     if (stripos($userAgent->getUserAgentString(), 'BeOS') !== false) {
         $os->setVersion($os::VERSION_UNKNOWN);
         $os->setName($os::BEOS);
         return true;
     }
     return false;
 }
Exemple #28
0
 public function store($documentType, $parameters, $noOfVideos)
 {
     //fastcgi_finish_request();
     $listOfVideoIdentifiers = array();
     $this->listRecords($parameters, $noOfVideos, $listOfVideoIdentifiers);
     // get list of existing projects
     $projects = ProjectHandler::listProjects();
     //	dd("done");
     $status = array();
     try {
         $this->createOpenimagesVideoGetterSoftwareAgent();
     } catch (Exception $e) {
         $status['error']['OnlineData'] = $e->getMessage();
         return $status;
     }
     try {
         $activity = new Activity();
         $activity->softwareAgent_id = "openimagesgetter";
         $activity->save();
     } catch (Exception $e) {
         // Something went wrong with creating the Activity
         $status['error']['OnlineData'] = $e->getMessage();
         $activity->forceDelete();
         return $status;
     }
     $count["count"] = 0;
     foreach ($listOfVideoIdentifiers as $video) {
         $title = $video;
         try {
             $entity = new Unit();
             $entity->_id = $entity->_id;
             $entity->title = strtolower($title);
             $entity->documentType = $documentType;
             $entity->source = "openimages";
             $entity->project = "soundandvision";
             $entity->type = "unit";
             $videoMetadata = $this->getRecord($video, $parameters["metadataPrefix"]);
             $entity->content = $videoMetadata["content"];
             $parents = array();
             $entity->parents = $parents;
             $entity->tags = array("unit");
             $entity->segments = $count;
             $entity->keyframes = $count;
             $hashing = array();
             $hashing["content"] = $entity->content;
             $hashing["project"] = $entity->project;
             $entity->hash = md5(serialize($hashing));
             $entity->activity_id = $activity->_id;
             $entity->save();
             $status['success'][$title] = $title . " was successfully uploaded. (URI: {$entity->_id})";
             // add the project if it doesnt exist yet
             if (!in_array($entity->project, $projects)) {
                 ProjectHandler::createGroup($entity->project);
                 // add the project to the temporary list
                 array_push($projects, $entity->project);
             }
             // add the user to the project if it has no access yet
             if (!ProjectHandler::inGroup($entity->user_id, $entity->project)) {
                 $user = UserAgent::find($entity->user_id);
                 ProjectHandler::grantUser($user, $entity->project, Roles::PROJECT_MEMBER);
             }
         } catch (Exception $e) {
             // Something went wrong with creating the Entity
             $activity->forceDelete();
             $entity->forceDelete();
             $status['error'][$title] = $e->getMessage();
         }
     }
     $status["recno"] = count($listOfVideoIdentifiers);
     return $status;
 }
Exemple #29
0
 /**
  * Determine if the browser is Android.
  *
  * @param Browser $browser
  * @param UserAgent $userAgent
  * @return bool
  */
 private static function checkBrowserAndroid(Browser $browser, UserAgent $userAgent)
 {
     // Navigator
     if (stripos($userAgent->getUserAgentString(), 'Android') !== false) {
         if (preg_match('/Version\\/([\\d\\.]*)/i', $userAgent->getUserAgentString(), $matches)) {
             $browser->setVersion($matches[1]);
         } else {
             $browser->setVersion($browser::VERSION_UNKNOWN);
         }
         $browser->setName($browser::NAVIGATOR);
         return true;
     }
     return false;
 }
 /**
  * Criação do elemento de paginação completo:
  *
  * @access private
  */
 private function createLinks()
 {
     $pages = '';
     //Pegando o total de páginas:
     if ($this->totalPages > 1) {
         $pages .= $this->openContainer;
         // Criando link para a primeira página:
         $pages .= $this->makeFirstLink();
         // Criando link para a página anterior:
         $pages .= $this->makePrevLink();
         // Criando paginação estilo google:
         // Setando o máximo de páginas conforme o tipo de dispositivo:
         $user =& UserAgent::getInstance();
         if ($user->isMobile()) {
             $totalToShow = 6;
         } else {
             $totalToShow = 8;
         }
         for ($i = $this->actualPage - 4, $limLinks = $i + $totalToShow; $i <= $limLinks; $i++) {
             if ($i < 1) {
                 $i = 1;
                 $limLinks = 9;
             }
             if ($limLinks > $this->totalPages) {
                 $limLinks = $this->totalPages;
                 $i = $limLinks - $totalToShow;
             }
             if ($i < 1) {
                 $i = 1;
                 $limLinks = $this->totalPages;
             }
             if ($i == $this->actualPage) {
                 $pages .= $this->makeActualPage();
             } else {
                 $pages .= $this->makeLink($i);
             }
         }
         // Criando link para a próxima página:
         $pages .= $this->makeNextLink();
         // Criando link para a última página:
         $pages .= $this->makeLastLink();
         $pages .= $this->closeContainer;
     }
     return $pages;
 }