/** * Overrides the action when a user is authenticated. * If the user authenticated but does not exist in the user table we create them. * @param Request $request * @param Authenticatable $user * @return \Illuminate\Http\RedirectResponse * @throws AuthException */ protected function authenticated(Request $request, Authenticatable $user) { // Explicitly log them out for now if they do no exist. if (!$user->exists) { auth()->logout($user); } if (!$user->exists && $user->email === null && !$request->has('email')) { $request->flash(); session()->flash('request-email', true); return redirect('/login'); } if (!$user->exists && $user->email === null && $request->has('email')) { $user->email = $request->get('email'); } if (!$user->exists) { // Check for users with same email already $alreadyUser = $user->newQuery()->where('email', '=', $user->email)->count() > 0; if ($alreadyUser) { throw new AuthException('A user with the email ' . $user->email . ' already exists but with different credentials.'); } $user->save(); $this->userRepo->attachDefaultRole($user); auth()->login($user); } $path = session()->pull('url.intended', '/'); $path = baseUrl($path, true); return redirect($path); }
/** * @param $path * @return string */ function url($path) { if (substr($path, 0, 1) === '/') { $path = substr($path, 1); } return baseUrl() . $path; }
/** * Get the url for this book. * @param string|bool $path * @return string */ public function getUrl($path = false) { if ($path !== false) { return baseUrl('/books/' . urlencode($this->slug) . '/' . trim($path, '/')); } return baseUrl('/books/' . urlencode($this->slug)); }
/** * Get the url of this chapter. * @param string|bool $path * @return string */ public function getUrl($path = false) { $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug; if ($path !== false) { return baseUrl('/books/' . urlencode($bookSlug) . '/chapter/' . urlencode($this->slug) . '/' . trim($path, '/')); } return baseUrl('/books/' . urlencode($bookSlug) . '/chapter/' . urlencode($this->slug)); }
function fixFolderPaths($content) { $fixed_content = ''; if (strlen(strstr($content, baseUrl())) > 0) { $fixed_content = str_replace(baseUrl() . '/', 'files/', $content); } else { $fixed_content = $content; } return $fixed_content; }
function u($uri, $options = array()) { $base = baseUrl(); if (0 !== strpos($uri, 'http') && 0 !== strpos($uri, '/')) { if (@$options['absolute']) { $uri = 'http://' . $_SERVER['HTTP_HOST'] . $uri; } } return $uri; }
/** * Create a new controller instance. * * @param SocialAuthService $socialAuthService * @param EmailConfirmationService $emailConfirmationService * @param UserRepo $userRepo */ public function __construct(SocialAuthService $socialAuthService, EmailConfirmationService $emailConfirmationService, UserRepo $userRepo) { $this->middleware('guest')->except(['socialCallback', 'detachSocialAccount']); $this->socialAuthService = $socialAuthService; $this->emailConfirmationService = $emailConfirmationService; $this->userRepo = $userRepo; $this->redirectTo = baseUrl('/'); $this->redirectPath = baseUrl('/'); parent::__construct(); }
public static function addJs($js, $callback = '') { if (strpos($js, 'http') === false) { $js = baseUrl() . $js; } static::$template_vars['js'][] = $js; if ($callback) { static::$template_vars['jsCallback'][$js] = $callback; } }
/** * 可以设置,自动过滤的内容 */ private function auto() { if (baseUrl(0) == __CLASS__) { die; } $ip = array('188.0.0.1'); $refer = array('http://127.0.0.1'); $this->frequency(8)->refer($refer); return $this; }
/** * Get the url for this page. * @param string|bool $path * @return string */ public function getUrl($path = false) { $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug; $midText = $this->draft ? '/draft/' : '/page/'; $idComponent = $this->draft ? $this->id : urlencode($this->slug); if ($path !== false) { return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/')); } return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent); }
/** * Handle an incoming request. * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->check() && setting('registration-confirmation') && !$this->auth->user()->email_confirmed) { return redirect(baseUrl('/register/confirm/awaiting')); } if ($this->auth->guest() && !setting('app-public')) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->guest(baseUrl('/login')); } } return $next($request); }
/** * 监视本地文件上传, $name为文件表单名,可发送单独POST['name']定义存储文件名 */ function upload($name, $storName = null) { $ret = $this->commonCheck($name, $storName); if ($ret['code'] == 0) { $destination = self::$uploadDir . date('Ymd'); if (!is_readable($destination)) { is_file($destination) or mkdir($destination, 0700); } $destination = $destination . '/' . $ret['msg']; move_uploaded_file($_FILES[$name]['tmp_name'], $destination); $ret['msg'] = baseUrl($destination); return $ret; } return $ret; }
/** * Register the service provider. * * @return void */ public function register() { Paginator::viewFactoryResolver(function () { return $this->app['view']; }); Paginator::currentPathResolver(function () { return baseUrl($this->app['request']->path()); }); Paginator::currentPageResolver(function ($pageName = 'page') { $page = $this->app['request']->input($pageName); if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) { return $page; } return 1; }); }
public function use(string $randomPageVariable, array $randomDataVariable = NULL, bool $randomObGetContentsVariable = false) { if (!empty(Properties::$parameters['usable'])) { $randomObGetContentsVariable = Properties::$parameters['usable']; } if (!empty(Properties::$parameters['data'])) { $randomDataVariable = Properties::$parameters['data']; } Properties::$parameters = []; $eol = EOL; $randomPageVariableExtension = extension($randomPageVariable); $randomPageVariableBaseUrl = baseUrl($randomPageVariable); $return = ''; if (!is_file($randomPageVariable)) { throw new InvalidArgumentException('Error', 'fileParameter', '1.($randomPageVariable)'); } if ($randomPageVariableExtension === 'js') { $return = '<script type="text/javascript" src="' . $randomPageVariableBaseUrl . '"></script>' . $eol; } elseif ($randomPageVariableExtension === 'css') { $return = '<link href="' . $randomPageVariableBaseUrl . '" rel="stylesheet" type="text/css" />' . $eol; } elseif (stristr('svg|woff|otf|ttf|' . implode('|', Config::get('ViewObjects', 'font')['differentFontExtensions']), $randomPageVariableExtension)) { $return = '<style type="text/css">@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}</style>' . $eol; } elseif ($randomPageVariableExtension === 'eot') { $return = '<style type="text/css"><!--[if IE]>@font-face{font-family:"' . divide(removeExtension($randomPageVariable), "/", -1) . '"; src:url("' . $randomPageVariableBaseUrl . '") format("truetype")}<![endif]--></style>' . $eol; } else { $randomPageVariable = suffix($randomPageVariable, '.php'); if (is_file($randomPageVariable)) { if (is_array($randomDataVariable)) { extract($randomDataVariable, EXTR_OVERWRITE, 'zn'); } if ($randomObGetContentsVariable === false) { require $randomPageVariable; } else { ob_start(); require $randomPageVariable; $randomSomethingFileContent = ob_get_contents(); ob_end_clean(); return $randomSomethingFileContent; } } } if ($randomObGetContentsVariable === false) { echo $return; } else { return $return; } }
/** * afterLayout * * @return void * @access public */ function afterLayout() { /* 出力データをSJISに変換 */ $view =& ClassRegistry::getObject('view'); if (isset($this->params['url']['ext']) && $this->params['url']['ext'] == 'rss') { $rss = true; } else { $rss = false; } if ($view && !$rss && Configure::read('AgentPrefix.currentAgent') == 'mobile' && $view->layoutPath != 'email' . DS . 'text') { $view->output = str_replace('&', '&', $view->output); $view->output = str_replace('<', '<', $view->output); $view->output = str_replace('>', '>', $view->output); $view->output = mb_convert_kana($view->output, "rak", "UTF-8"); $view->output = mb_convert_encoding($view->output, "SJIS-win", "UTF-8"); // 内部リンクの自動変換 $currentAlias = Configure::read('AgentPrefix.currentAlias'); $baseUrl = baseUrl(); $view->output = preg_replace('/href=\\"' . str_replace('/', '\\/', $baseUrl) . '([^\\"]+?)\\"/', "href=\"" . $baseUrl . $currentAlias . "/\$1\"", $view->output); $view->output = preg_replace('/href=\\"' . str_replace('/', '\\/', $baseUrl) . $currentAlias . '\\/' . $currentAlias . '\\//', "href=\"" . $baseUrl . $currentAlias . "/", $view->output); // 変換した上キャッシュを再保存しないとキャッシュ利用時に文字化けしてしまう $caching = isset($view->loaded['cache']) && $view->cacheAction != false && Configure::read('Cache.check') === true; if ($caching) { if (is_a($view->loaded['cache'], 'CacheHelper')) { $cache =& $view->loaded['cache']; $cache->base = $view->base; $cache->here = $view->here; $cache->helpers = $view->helpers; $cache->action = $view->action; $cache->controllerName = $view->name; $cache->layout = $view->layout; $cache->cacheAction = $view->cacheAction; $cache->cache($___viewFn, $view->output, true); } } else { // nocache で コンテンツヘッダを出力する場合、逆にキャッシュを利用しない場合に、 // nocache タグが残ってしまってエラーになるので除去する $view->output = str_replace('<cake:nocache>', '', $view->output); $view->output = str_replace('</cake:nocache>', '', $view->output); } // XMLとして出力する場合、デバッグモードで出力する付加情報で、 // ブラウザによってはXMLパースエラーとなってしまうので強制的にデバッグモードをオフ Configure::write('debug', 0); } }
function js($path, $fileName = '') { $result = ""; if (empty($fileName)) { $temp = removeMultiple(baseUrl() . "/Resources/" . $path); return removeMultiple('<script type="text/javascript" src="' . $temp . '"></script>') . PHP_EOL; } else { if (is_array($fileName)) { foreach ($fileName as $file) { $temp = removeMultiple(baseUrl() . "/Resources/" . $path . "/" . $file); $result .= '<script type="text/javascript" src="' . $temp . '"></script>' . PHP_EOL; } return $result; } else { $temp = removeMultiple(baseUrl() . "/Resources/" . $path . '/' . $fileName); return removeMultiple('<script type="text/javascript" src="' . $temp . '"></script>') . PHP_EOL; } } }
/** * コンストラクタ * * @return void * @access private */ function __construct($id = false, $table = null, $ds = null) { if ($this->useDbConfig && ($this->name || !empty($id['name']))) { // DBの設定がない場合、存在しないURLをリクエストすると、エラーが繰り返されてしまい // Cakeの正常なエラーページが表示されないので、設定がある場合のみ親のコンストラクタを呼び出す。 $cm =& ConnectionManager::getInstance(); if (isset($cm->config->baser['driver'])) { if ($cm->config->baser['driver'] != '') { parent::__construct($id, $table, $ds); } elseif ($cm->config->baser['login'] == 'dummy' && $cm->config->baser['password'] == 'dummy' && $cm->config->baser['database'] == 'dummy' && Configure::read('Baser.urlParam') == '') { // データベース設定がインストール段階の状態でトップページへのアクセスの場合、 // 初期化ページにリダイレクトする App::import('Controller', 'App'); $AppController = new AppController(); session_start(); $_SESSION['Message']['flash'] = array('message' => 'インストールに失敗している可能性があります。<br />インストールを最初からやり直すにはbaserCMSを初期化してください。', 'layout' => 'default'); $AppController->redirect(baseUrl() . 'installations/reset'); } } } }
function redirect($path = '/', $lvl = 2, $header = 301) { switch ($header) { case 301: $header = 'HTTP/1.1 301 Moved Permanently'; break; case 403: $header = 'HTTP/1.1 403 Forbidden'; break; } $url = $path; if (is_array($path)) { $dir = each($path); $url = BASE_PATH . '/' . $dir['key'] . '/' . $dir['value']; } if ($lvl >= 2) { $url = baseUrl($url, $lvl); } header($header); header("Location: {$url}"); exit; }
public function use(...$scripts) { $str = ''; $eol = EOL; $args = $this->_parameters($scripts, 'scripts'); $lastParam = $args->lastParam; $arguments = $args->arguments; $links = $args->cdnLinks; foreach ($arguments as $script) { if (is_array($script)) { $script = ''; } $scriptFile = SCRIPTS_DIR . suffix($script, ".js"); if (!is_file($scriptFile)) { $scriptFile = EXTERNAL_SCRIPTS_DIR . suffix($script, ".js"); } if (!in_array("script_" . $script, Properties::$isImport)) { if (is_file($scriptFile)) { $str .= '<script type="text/javascript" src="' . baseUrl($scriptFile) . '"></script>' . $eol; } elseif (isUrl($script) && extension($script) === 'js') { $str .= '<script type="text/javascript" src="' . $script . '"></script>' . $eol; } elseif (isset($links[strtolower($script)])) { $str .= '<script type="text/javascript" src="' . $links[strtolower($script)] . '"></script>' . $eol; } Properties::$isImport[] = "script_" . $script; } } if (!empty($str)) { if ($lastParam === true) { return $str; } else { echo $str; } } else { return false; } }
public function use(...$styles) { $str = ''; $eol = EOL; $args = $this->_parameters($styles, 'styles'); $lastParam = $args->lastParam; $arguments = $args->arguments; $links = $args->cdnLinks; foreach ($arguments as $style) { if (is_array($style)) { $style = ''; } $styleFile = STYLES_DIR . suffix($style, ".css"); if (!is_file($styleFile)) { $styleFile = EXTERNAL_STYLES_DIR . suffix($style, ".css"); } if (!in_array("style_" . $style, Properties::$isImport)) { if (is_file($styleFile)) { $str .= '<link href="' . baseUrl($styleFile) . '" rel="stylesheet" type="text/css" />' . $eol; } elseif (isUrl($style) && extension($style) === 'css') { $str .= '<link href="' . $style . '" rel="stylesheet" type="text/css" />' . $eol; } elseif (isset($links[strtolower($style)])) { $str .= '<link href="' . $links[strtolower($style)] . '" rel="stylesheet" type="text/css" />' . $eol; } Properties::$isImport[] = "style_" . $style; } } if (!empty($str)) { if ($lastParam === true) { return $str; } else { echo $str; } } else { return false; } }
loadSiteConfig(); /** * メンテナンスチェック */ $isMaintenance = $parameter == 'maintenance/index'; Configure::write('BcRequest.isMaintenance', $isMaintenance); /** * アップデートチェック */ $isUpdater = false; $bcSite = Configure::read('BcSite'); $updateKey = preg_quote(Configure::read('BcApp.updateKey'), '/'); if (preg_match('/^' . $updateKey . '(|\\/index\\/)/', $parameter)) { $isUpdater = true; } elseif (BC_INSTALLED && !$isMaintenance && (!empty($bcSite['version']) && getVersion() > $bcSite['version'])) { header('Location: ' . topLevelUrl(false) . baseUrl() . 'maintenance/index'); exit; } Configure::write('BcRequest.isUpdater', $isUpdater); } /** * プラグインをCake側で有効化 * * カレントテーマのプラグインも読み込む */ if (BC_INSTALLED && !$isUpdater && !$isMaintenance) { App::build(array('Plugin' => array_merge(array(BASER_THEMES . $bcSite['theme'] . DS . 'Plugin' . DS), App::path('Plugin')))); $plugins = getEnablePlugins(); foreach ($plugins as $plugin) { loadPlugin($plugin['Plugin']['name'], $plugin['Plugin']['priority']); }
/** * Show a listing of recently created pages * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showRecentlyUpdated() { $pages = $this->pageRepo->getRecentlyUpdatedPaginated(20)->setPath(baseUrl('/pages/recently-updated')); return view('pages/detailed-listing', ['title' => 'Recently Updated Pages', 'pages' => $pages]); }
<div class="uk-width-1-4" style="width:110px;"> <?php if (!empty($merchant_photo)) { ?> <img src="<?php echo baseUrl() . "/upload/{$merchant_photo}"; ?> " alt="" title="" class="uk-thumbnail uk-thumbnail-mini"> <?php } else { ?> <?php //echo Yii::t("default","no image") ?> <img src="<?php echo baseUrl() . "/assets/images/thumbnail-medium.png"; ?> " alt="" title="" class="uk-thumbnail uk-thumbnail-mini"> <?php } ?> </div> <!--END uk-width-1-4--> <div class="uk-width-1-3"> <h5 style="position:relative;"> <?php echo stripslashes($re_info['restaurant_name']); ?> </h5>
$cliente = $UsuarioDao->getUsuario($aux->id_empreendimento, $id_cliente); $estado = array('uf' => '', 'nome' => ''); if (is_numeric($cliente['id_estado'])) { $estado = $EstadoDao->getEstado($cliente['id_estado']); } $cidade = array('nome' => ''); if (is_numeric($cliente['id_cidade'])) { $cidade = $CidadeDao->getCidade($cliente['id_cidade']); } ?> <htmlpageheader name="myHTMLHeaderOdd" style="display:none"> <div> <div style="float: left; width: 80px;"> <span> <img style="width: 80px; height: 80px;" src="<?php echo baseUrl() . "assets/imagens/logos/" . $empreendimento['nme_logo']; ?> "> </span> </div> <div style="float: left; width:70%;"> <div style="margin-left: 10px;"> <?php if ($venda['venda_confirmada'] == 1) { ?> <h3 style="color: #888585;">Comprovante de <?php echo !$aux->pagamento_fulso ? 'Venda' : 'Pagamento'; ?> </h3> <?php } else {
protected function _activation($user = '', $pass = '', $activationReturnLink = '', $email = '') { if (!isUrl($activationReturnLink)) { $url = baseUrl(suffix($activationReturnLink)); } else { $url = suffix($activationReturnLink); } $templateData = array('url' => $url, 'user' => $user, 'pass' => $pass); $message = Import::template('UserEmail/Activation', $templateData, true); $user = !empty($email) ? $email : $user; $sendEmail = uselib('Email'); $sendEmail->receiver($user, $user); $sendEmail->subject(lang('User', 'activationProcess')); $sendEmail->content($message); if ($sendEmail->send()) { $this->success = lang('User', 'activationEmail'); return true; } else { $this->success = false; $this->error = lang('User', 'emailError'); return false; } }
/** * RewriteBase の設定を取得する * * @param string $base * @return string */ function getRewriteBase($url) { $baseUrl = baseUrl(); if (preg_match("/index\\.php/", $baseUrl)) { $baseUrl = str_replace('index.php/', '', baseUrl()); } $baseUrl = preg_replace("/\\/\$/", '', $baseUrl); if ($url != '/' || !$baseUrl) { $url = $baseUrl . $url; } else { $url = $baseUrl; } return $url; }
menu(); ?> <div class="container"> <?php if (isset($_GET['1']["message"])) { echo '<div class="alert alert-' . $_GET['type'] . '" role=alert>' . $_GET['1']['message'] . " </div>"; } ?> <h1>Uw bestellingen</h1> <form action="<?php echo baseUrl('bestel/voegToeAanWinkelwagen'); ?> " method="post"> <label>maand: <?php echo getdate()['month']; ?> </label> <br> <label for="day">Dag: </label> <select name="day" id="day"> <?php for ($i = getdate()['mday']; $i <= cal_days_in_month(0, getdate()['mon'], getdate()['year']); $i++) { if ($i > getdate()['mday'] && $i < getdate()['mday'] + 4) { echo "<option value='{$i}'>{$i}</option>"; } }
public function searchArea() { $resto_cuisine = ''; $rating = ''; $minimum = ''; $pay_by = ''; $minus_has_delivery_rates = 0; $cuisine_list = Yii::app()->functions->Cuisine(true); $country_list = Yii::app()->functions->CountryList(); $this->data['s'] = isset($this->data['s']) ? $this->data['s'] : ""; $search_str = explode(",", $this->data['s']); if (is_array($search_str) && count($search_str) >= 2) { $city = isset($search_str[1]) ? trim($search_str[1]) : ''; $state = isset($search_str[2]) ? trim($search_str[2]) : ''; } else { $city = trim($this->data['s']); $state = trim($this->data['s']); } $from_address = $this->data['s']; if (empty($from_address)) { $from_address = isset($this->data['st']) ? $this->data['st'] : ''; if (!empty($this->data['st'])) { $_SESSION['kr_search_address'] = $this->data['st']; } } if ($res = Yii::app()->functions->searchByArea($city, $state)) { if (is_array($res) && count($res) >= 1) { $total = Yii::app()->functions->search_result_total; $feed_datas['sEcho'] = $this->data['sEcho']; $feed_datas['iTotalRecords'] = $total; $feed_datas['iTotalDisplayRecords'] = $total; /*dump($feed_datas); die();*/ foreach ($res as $val) { $merchant_address = $val['street'] . " " . $val['city'] . " " . $val['post_code']; $miles = 0; $kms = 0; $ft = false; $new_distance_raw = 0; if ($distance = getDistance($from_address, $merchant_address, $val['country_code'], false)) { $miles = $distance->rows[0]->elements[0]->distance->text; //dump($miles); if (preg_match("/ft/i", $miles)) { $ft = true; $miles_raw = $miles; $new_distance_raw = str_replace("ft", '', $miles); $new_distance_raw = ft2kms(trim($new_distance_raw)); } else { $miles_raw = str_replace(array(" ", "mi"), "", $miles); $kms = miles2kms(unPrettyPrice($miles_raw)); $new_distance_raw = $kms; $kms = standardPrettyFormat($kms); } } /*get merchant distance */ $mt_delivery_miles = Yii::app()->functions->getOption("merchant_delivery_miles", $val['merchant_id']); $merchant_distance_type = Yii::app()->functions->getOption("merchant_distance_type", $val['merchant_id']); /*dump($mt_delivery_miles); dump($miles_raw);*/ $resto_cuisine = ''; $cuisine = !empty($val['cuisine']) ? (array) json_decode($val['cuisine']) : false; if ($cuisine != false) { foreach ($cuisine as $valc) { if (array_key_exists($valc, (array) $cuisine_list)) { $resto_cuisine .= $cuisine_list[$valc] . ", "; } } $resto_cuisine = !empty($resto_cuisine) ? substr($resto_cuisine, 0, -2) : ''; } $resto_info = "<h5><a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">" . $val['restaurant_name'] . "</a></h5>"; //$resto_cuisine="<span class=\"cuisine-list\">".$resto_cuisine."</span>"; $resto_cuisine = wordwrap($resto_cuisine, 50, "<br />\n"); $resto_info .= "<p class=\"uk-text-muted\">" . $val['street'] . " " . $val['city'] . " " . $val['post_code'] . "</p>"; if (array_key_exists($val['country_code'], (array) $country_list)) { $resto_info .= "<p class=\"uk-text-bold\">" . $country_list[$val['country_code']] . "</p>"; } $resto_info .= "<p class=\"uk-text-bold\">" . Yii::t('default', "Cuisine") . " - " . $resto_cuisine . "</p>"; $delivery_est = Yii::app()->functions->getOption("merchant_delivery_estimation", $val['merchant_id']); $distancesya = $miles_raw; $unit_distance = $merchant_distance_type; if (!empty($from_address)) { if ($ft == TRUE) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} </p>"; if ($merchant_distance_type == "km") { $distance_type = Yii::t("default", "km"); } else { $distance_type = Yii::t("default", "miles"); } } else { if ($merchant_distance_type == "km") { $distance_type = Yii::t("default", "km"); $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$kms} " . Yii::t("default", "km") . "</p>"; $distancesya = $kms; } else { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Distance") . ": </span> {$miles_raw} " . Yii::t("default", "miles") . "</p>"; $distance_type = Yii::t("default", "miles"); } } } $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Est") . ": </span> " . $delivery_est . "</p>"; if (is_numeric($mt_delivery_miles)) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Distance") . ": </span> " . $mt_delivery_miles . " " . $distance_type . "</p>"; } $shipping_enabled = Yii::app()->functions->getOption("shipping_enabled", $val['merchant_id']); //delivery rates table $delivery_fee = $val['delivery_charges']; if ($shipping_enabled == 2) { $FunctionsK = new FunctionsK(); //$distancesya=round($distancesya); //dump($distancesya); $delivery_fee = $FunctionsK->getDeliveryChargesByDistance($val['merchant_id'], $distancesya, $unit_distance, $delivery_fee); if ($delivery_fee >= 0.01) { if (isset($_GET['filter_promo'])) { if (preg_match("/free-delivery/i", $_GET['filter_promo'])) { $minus_has_delivery_rates++; continue; } } } } if (is_numeric($delivery_fee) && $delivery_fee >= 1) { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . displayPrice(getCurrencyCode(), prettyFormat($delivery_fee)) . "</p>"; } else { $resto_info .= "<p><span class=\"uk-text-bold\">" . Yii::t("default", "Delivery Fee") . ":</span> " . "<span class=\"uk-text-success\">" . Yii::t("default", "Free Delivery") . "</span>" . "</p>"; } $image = ''; $merchant_photo = Yii::app()->functions->getOption("merchant_photo", $val['merchant_id']); if (!empty($merchant_photo)) { $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/upload/" . $merchant_photo . "\" alt=\"\" title=\"\">"; $image .= "</a>"; } if (empty($image)) { $image .= "<a href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $image .= "<img class=\"uk-thumbnail uk-thumbnail-mini\" src=\"" . baseUrl() . "/assets/images/thumbnail-medium.png\" alt=\"\" title=\"\">"; $image .= "</a>"; } $ratings = Yii::app()->functions->getRatings($val['merchant_id']); $rating_meanings = ''; if ($ratings['ratings'] >= 1) { $rating_meaning = Yii::app()->functions->getRatingsMeaning($ratings['ratings']); $rating_meanings = ucwords($rating_meaning['meaning']); } $rating = "<div class=\"rate-wrap\">\r\n\t \t\t\t\t<h6 class=\"rounded2\" data-uk-tooltip=\"{pos:'bottom-left'}\" title=\"{$rating_meanings}\" >" . number_format($ratings['ratings'], 1) . "</h6>\r\n\t \t\t\t\t<span>" . $ratings['votes'] . " " . Yii::t("default", "Votes") . "</span>\r\n\t \t\t\t\t</div>"; $stores_open_day = Yii::app()->functions->getOption("stores_open_day", $val['merchant_id']); $stores_open_starts = Yii::app()->functions->getOption("stores_open_starts", $val['merchant_id']); $stores_open_ends = Yii::app()->functions->getOption("stores_open_ends", $val['merchant_id']); $stores_open_custom_text = Yii::app()->functions->getOption("stores_open_custom_text", $val['merchant_id']); $stores_open_day = !empty($stores_open_day) ? (array) json_decode($stores_open_day) : false; $stores_open_starts = !empty($stores_open_starts) ? (array) json_decode($stores_open_starts) : false; $stores_open_ends = !empty($stores_open_ends) ? (array) json_decode($stores_open_ends) : false; $stores_open_custom_text = !empty($stores_open_custom_text) ? (array) json_decode($stores_open_custom_text) : false; $tip = ''; $open_starts = ''; $open_ends = ''; $open_text = ''; $tip .= "<ul class=\"hr_op rounded2\"><i class=\"fa fa-caret-up\"></i>"; if (is_array($stores_open_day) && count($stores_open_day) >= 1) { foreach ($stores_open_day as $val_open) { if (array_key_exists($val_open, (array) $stores_open_starts)) { $open_starts = timeFormat($stores_open_starts[$val_open], true); } if (array_key_exists($val_open, (array) $stores_open_ends)) { $open_ends = timeFormat($stores_open_ends[$val_open], true); } if (array_key_exists($val_open, (array) $stores_open_custom_text)) { $open_text = $stores_open_custom_text[$val_open]; } $tip .= '<li><span>' . ucwords(Yii::t("default", $val_open)) . '</span><value>' . $open_starts . " - " . $open_ends . " " . ucfirst($open_text) . '</value></li>'; $open_starts = ''; $open_ends = ''; $open_text = ''; } } else { $tip .= '<li>' . Yii::t("default", "Not available.") . '</li>'; } $tip .= "<div class=\"clear\"></div>"; $tip .= "</ul>"; $tips = "<a class=\"opening-hours-wrap\" href=\"javascript:;\">" . Yii::t("default", "Hours of Operation") . "{$tip}</a>"; $resto_info .= $tips; $resto_info .= "<div class=\"spacer\"></div>"; $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "\">"; $resto_info .= Yii::t("default", "Order Now"); $resto_info .= "</a></div>"; $resto_info .= "<div class=\"spacer\"></div>"; $table_book = Yii::app()->functions->getOption("merchant_table_booking", $val['merchant_id']); if ($table_book == "") { $resto_info .= "<div>\r\n\t\t\t\t\t\t<a class=\"uk-button uk-button-success uk-width-1-2\" href=\"" . baseUrl() . "/store/menu/merchant/" . $val['restaurant_slug'] . "/?tab=booking" . "\">"; $resto_info .= Yii::t("default", "Book a Table"); $resto_info .= "</a></div>"; } $is_sponsored = ''; if ($val['is_sponsored'] == 2) { $is_sponsored = "<br/><div class=\"uk-badge uk-badge-warning\">" . Yii::t("default", "sponsored") . "</div>"; } $is_merchant_open = Yii::app()->functions->isMerchantOpen($val['merchant_id']); $merchant_preorder = Yii::app()->functions->getOption("merchant_preorder", $val['merchant_id']); $now = date('Y-m-d'); $is_holiday = false; if ($m_holiday = Yii::app()->functions->getMerchantHoliday($val['merchant_id'])) { if (in_array($now, (array) $m_holiday)) { $is_merchant_open = false; } } $tag_open = ''; if ($is_merchant_open == TRUE) { $tag_open = '<div class="uk-badge uk-badge-success">' . t("Open") . '</div>'; } else { if ($merchant_preorder) { $tag_open = '<div class="uk-badge uk-badge-warning">' . t("Pre-Order") . '</div>'; } else { $tag_open = '<div class="uk-badge uk-badge-danger">' . t("Closed") . '</div>'; } } $is_sponsored .= $tag_open; $offers = Widgets::offers($val['merchant_id'], 2); $is_sponsored .= $offers; $merchant_latitude = Yii::app()->functions->getOption("merchant_latitude", $val['merchant_id']); $merchant_longtitude = Yii::app()->functions->getOption("merchant_longtitude", $val['merchant_id']); $merchant_latitude = !empty($merchant_latitude) ? $merchant_latitude : '0'; $merchant_longtitude = !empty($merchant_longtitude) ? $merchant_longtitude : '0'; $feed_data[] = array($image, $resto_info, $rating, !empty($val['minimum_order']) ? displayPrice(getCurrencyCode(), prettyFormat($val['minimum_order'])) . "<br/>" . $is_sponsored : "{$is_sponsored}", $miles_raw, $merchant_latitude, $merchant_longtitude, addslashes($val['restaurant_name']), $merchant_address, $val['restaurant_slug'], $image, $new_distance_raw); } $this->data['sort_filter'] = isset($this->data['sort_filter']) ? $this->data['sort_filter'] : ''; //dump($feed_data); if ($this->data['sort_filter'] == "distance") { Yii::app()->functions->arraySortByColumn($feed_data, 11); $feed_datas['aaData'] = $feed_data; } else { /** sort by distance */ if (Yii::app()->functions->getOptionAdmin('search_result_bydistance') == 2) { Yii::app()->functions->arraySortByColumn($feed_data, 11); $feed_datas['aaData'] = $feed_data; } else { $feed_datas['aaData'] = $feed_data; } } //dump("minus_has_delivery_rates->".$minus_has_delivery_rates); if ($minus_has_delivery_rates >= 1) { $feed_datas['iTotalRecords'] = $feed_datas['iTotalRecords'] - $minus_has_delivery_rates; $feed_datas['iTotalDisplayRecords'] = $feed_datas['iTotalDisplayRecords'] - $minus_has_delivery_rates; if ($feed_datas['iTotalRecords'] <= 0) { $this->otableNodata(); } } $this->otableOutput($feed_datas); } } $this->otableNodata(); }
/** * アップデートのURLを記載したメールを送信する */ function sendUpdateMail() { $bcSite = Configure::read('BcSite'); $bcSite['update_id'] = String::uuid(); $SiteConfig = ClassRegistry::init('SiteConfig'); $SiteConfig->saveKeyValue(array('SiteConfig' => $bcSite)); ClassRegistry::removeObject('SiteConfig'); $BcEmail = new BcEmailComponent(); if (!empty($bcSite['mail_encode'])) { $encode = $bcSite['mail_encode']; } else { $encode = 'ISO-2022-JP'; } $BcEmail->charset = $encode; $BcEmail->sendAs = 'text'; $BcEmail->lineLength = 105; if (!empty($bcSite['smtp_host'])) { $BcEmail->delivery = 'smtp'; $BcEmail->smtpOptions = array('host' => $bcSite['smtp_host'], 'port' => 25, 'timeout' => 30, 'username' => $bcSite['smtp_user'] ? $bcSite['smtp_user'] : null, 'password' => $bcSite['smtp_password'] ? $bcSite['smtp_password'] : null); } else { $BcEmail->delivery = "mail"; } $BcEmail->to = $bcSite['email']; $BcEmail->subject = 'baserCMSアップデート'; $BcEmail->from = $bcSite['name'] . ' <' . $bcSite['email'] . '>'; $message = array(); $message[] = '下記のURLよりbaserCMSのアップデートを完了してください。'; $message[] = topLevelUrl(false) . baseUrl() . 'updaters/index/' . $bcSite['update_id']; $BcEmail->send($message); }
protected function _activation($user = "", $pass = "", $activationReturnLink = '', $email = '') { if (!isUrl($activationReturnLink)) { $url = baseUrl(suffix($activationReturnLink)); } else { $url = suffix($activationReturnLink); } $message = "<a href='" . $url . "user/" . $user . "/pass/" . $pass . "'>" . lang('User', 'activation') . "</a>"; $user = !empty($email) ? $email : $user; $sendEmail = uselib('Email'); $sendEmail->receiver($user, $user); $sendEmail->subject(lang('User', 'activationProcess')); $sendEmail->content($message); if ($sendEmail->send()) { $this->success = lang('User', 'activationEmail'); return true; } else { $this->success = false; $this->error = lang('User', 'emailError'); return false; } }