コード例 #1
0
ファイル: GasController.php プロジェクト: airis333/recolife
 /**
  * デバイス判定をしてテンプレートを返す
  */
 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;
     }
 }
コード例 #2
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;
		}
	}
コード例 #3
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']);

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

			//--------------------------
			// アクセス情報更新
			// DBException
			//--------------------------
			//↓↓===========nm00260 2011/12/20 start===================================
			//$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option);
			$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option, $device);
			//↑↑===========nm00260 2011/12/20 end=====================================

			//↓↓===========nm90041 2010/11/24 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;
			} 
			//↑↑===========nm90041 2010/11/24 end=====================================

			//--------------------------
			// 実施タイプ別に実行します
			// RedirectUrlException
			// Index_LandingPageNotFountException
			//--------------------------
			// 1:リダイレクト 2:ランディング
			$type = $this->_anken['type_cd'];
			if ($type == 1) {
				// リダイレクト
				$this->_log->debug('db.redirect');
				// 飛び先取得しリダイレクト
				//↓↓===========nm00260 2011/12/20 start===================================
				//$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId);
				$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId, $device);
				//↑↑===========nm00260 2011/12/20 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);
				//↓↓===========nm00260 2011/12/20 start===================================
				//$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken);
				$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken, $device);
				//↑↑===========nm00260 2011/12/20 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);
			}
			
			//↓↓===========nm90041 2010/11/24 start===================================
			//パラメータの入力URLの値はエラー画面に設定
			if (empty($this->_redirectUrl) == false) {
				$e->assign('url', $this->_redirectUrl);
			}
			//↑↑===========nm90041 2010/11/24 end=====================================
			
			throw $e;

		} catch (Exception $e) {

			//--------------------------
			// 想定外の例外処理
			//--------------------------
			$this->_log->fatal('unexpected: ' . get_class($e));
			throw $e;
		}
	}
コード例 #4
0
ファイル: global.php プロジェクト: airis333/recolife
	        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');
        }
    });
コード例 #5
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']);

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

			//--------------------------
			// アクセス情報更新
			// DBException
			//--------------------------
			//↓↓===========nm00260 2012/01/05 start===================================
			//$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option);
			$this->updateAccessInfo($this->_anken, $this->_teikeiMedia, $lpo, $this->_option, $device);
			//↑↑===========nm00260 2012/01/05 end=====================================

			//--------------------------
			// 実施タイプ別に実行します
			// RedirectUrlException
			// Index_LandingPageNotFountException
			//--------------------------
			// 1:リダイレクト 2:ランディング
			$type = $this->_anken['type_cd'];
			if ($type == 1) {
				// リダイレクト
				$this->_log->debug('db.redirect');
				// 飛び先取得しリダイレクト
				//↓↓===========nm00260 2012/01/05 start===================================
				//$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId);
				$url = $this->getRedirectUrl($this->_anken, $this->_teikeiMedia, $this->_sessionId, $device);
				//↑↑===========nm00260 2012/01/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);
				//↓↓===========nm00260 2012/01/05 start===================================
				//$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken);
				$this->landing($path, $this->_sessionId, $lpo, $this->_teikeiMedia, $this->_anken, $device);
				//↑↑===========nm00260 2012/01/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);
			}
			throw $e;

		} catch (Exception $e) {

			//--------------------------
			// 想定外の例外処理
			//--------------------------
			$this->_log->fatal('unexpected: ' . get_class($e));
			throw $e;
		}
	}